Add CActorParameters

This commit is contained in:
Henrique Gemignani Passos Lima 2022-11-04 01:54:33 +02:00
parent 0df20625e9
commit 677e291efe
No known key found for this signature in database
GPG Key ID: E224F951761145F8
10 changed files with 197 additions and 57 deletions

View File

@ -3,8 +3,8 @@
.section .data
.balign 8
.global lbl_803DFF80
lbl_803DFF80:
.global __vt__16CLightParameters
__vt__16CLightParameters:
# ROM: 0x3DCF80
.4byte 0
.4byte 0
@ -75,7 +75,7 @@ MakeActorLights__16CLightParametersCFv:
/* 80106474 001033D4 80 7F 00 24 */ lwz r3, 0x24(r31)
/* 80106478 001033D8 90 81 00 1C */ stw r4, 0x1c(r1)
/* 8010647C 001033DC 90 01 00 20 */ stw r0, 0x20(r1)
/* 80106480 001033E0 48 00 01 35 */ bl GetFramesBetweenRecalculation__16CLightParametersF26ELightRecalculationOptions
/* 80106480 001033E0 48 00 01 35 */ bl GetFramesBetweenRecalculation__16CLightParametersFQ216CLightParameters26ELightRecalculationOptions
/* 80106484 001033E4 80 BF 00 28 */ lwz r5, 0x28(r31)
/* 80106488 001033E8 7C 64 1B 78 */ mr r4, r3
/* 8010648C 001033EC 80 1F 00 20 */ lwz r0, 0x20(r31)
@ -160,8 +160,8 @@ lbl_80106598:
/* 801065AC 0010350C 38 21 00 40 */ addi r1, r1, 0x40
/* 801065B0 00103510 4E 80 00 20 */ blr
.global GetFramesBetweenRecalculation__16CLightParametersF26ELightRecalculationOptions
GetFramesBetweenRecalculation__16CLightParametersF26ELightRecalculationOptions:
.global GetFramesBetweenRecalculation__16CLightParametersFQ216CLightParameters26ELightRecalculationOptions
GetFramesBetweenRecalculation__16CLightParametersFQ216CLightParameters26ELightRecalculationOptions:
/* 801065B4 00103514 2C 03 00 02 */ cmpwi r3, 2
/* 801065B8 00103518 41 82 00 38 */ beq lbl_801065F0
/* 801065BC 0010351C 40 80 00 14 */ bge lbl_801065D0
@ -198,9 +198,9 @@ __dt__16CLightParametersFv:
/* 80106614 00103574 93 E1 00 0C */ stw r31, 0xc(r1)
/* 80106618 00103578 7C 7F 1B 79 */ or. r31, r3, r3
/* 8010661C 0010357C 41 82 00 1C */ beq lbl_80106638
/* 80106620 00103580 3C A0 80 3E */ lis r5, lbl_803DFF80@ha
/* 80106620 00103580 3C A0 80 3E */ lis r5, __vt__16CLightParameters@ha
/* 80106624 00103584 7C 80 07 35 */ extsh. r0, r4
/* 80106628 00103588 38 05 FF 80 */ addi r0, r5, lbl_803DFF80@l
/* 80106628 00103588 38 05 FF 80 */ addi r0, r5, __vt__16CLightParameters@l
/* 8010662C 0010358C 90 1F 00 00 */ stw r0, 0(r31)
/* 80106630 00103590 40 81 00 08 */ ble lbl_80106638
/* 80106634 00103594 48 20 F2 FD */ bl Free__7CMemoryFPCv
@ -216,13 +216,13 @@ lbl_80106638:
__ct__16CLightParametersFv:
/* 80106650 001035B0 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 80106654 001035B4 7C 08 02 A6 */ mflr r0
/* 80106658 001035B8 3C 80 80 3E */ lis r4, lbl_803DFF80@ha
/* 80106658 001035B8 3C 80 80 3E */ lis r4, __vt__16CLightParameters@ha
/* 8010665C 001035BC C0 02 94 78 */ lfs f0, lbl_805AB198@sda21(r2)
/* 80106660 001035C0 90 01 00 14 */ stw r0, 0x14(r1)
/* 80106664 001035C4 38 00 00 00 */ li r0, 0
/* 80106668 001035C8 93 E1 00 0C */ stw r31, 0xc(r1)
/* 8010666C 001035CC 7C 7F 1B 78 */ mr r31, r3
/* 80106670 001035D0 38 64 FF 80 */ addi r3, r4, lbl_803DFF80@l
/* 80106670 001035D0 38 64 FF 80 */ addi r3, r4, __vt__16CLightParameters@l
/* 80106674 001035D4 90 7F 00 00 */ stw r3, 0(r31)
/* 80106678 001035D8 98 1F 00 04 */ stb r0, 4(r31)
/* 8010667C 001035DC D0 1F 00 08 */ stfs f0, 8(r31)
@ -257,11 +257,11 @@ __ct__16CLightParametersFv:
/* 801066F0 00103650 38 21 00 10 */ addi r1, r1, 0x10
/* 801066F4 00103654 4E 80 00 20 */ blr
.global __ct__16CLightParametersFbfQ216CLightParameters19EShadowTessellationffRC6CColorbQ216CLightParameters21EWorldLightingOptionsQ216CLightParameters26ELightRecalculationOptionsRC9CVector3fii
__ct__16CLightParametersFbfQ216CLightParameters19EShadowTessellationffRC6CColorbQ216CLightParameters21EWorldLightingOptionsQ216CLightParameters26ELightRecalculationOptionsRC9CVector3fii:
.global __ct__16CLightParametersFbfQ216CLightParameters19EShadowTessellationffRC6CColorbQ216CLightParameters21EWorldLightingOptionsQ216CLightParameters26ELightRecalculationOptionsRC9CVector3fiibi
__ct__16CLightParametersFbfQ216CLightParameters19EShadowTessellationffRC6CColorbQ216CLightParameters21EWorldLightingOptionsQ216CLightParameters26ELightRecalculationOptionsRC9CVector3fiibi:
/* 801066F8 00103658 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 801066FC 0010365C 3D 60 80 3E */ lis r11, lbl_803DFF80@ha
/* 80106700 00103660 38 0B FF 80 */ addi r0, r11, lbl_803DFF80@l
/* 801066FC 0010365C 3D 60 80 3E */ lis r11, __vt__16CLightParameters@ha
/* 80106700 00103660 38 0B FF 80 */ addi r0, r11, __vt__16CLightParameters@l
/* 80106704 00103664 93 E1 00 0C */ stw r31, 0xc(r1)
/* 80106708 00103668 89 81 00 23 */ lbz r12, 0x23(r1)
/* 8010670C 0010366C 90 03 00 00 */ stw r0, 0(r3)
@ -310,8 +310,8 @@ lbl_801067A4:
/* 801067A8 00103708 38 21 00 10 */ addi r1, r1, 0x10
/* 801067AC 0010370C 4E 80 00 20 */ blr
.global MakeDamageableTriggerActorParms__FRC16CActorParametersRC16CVisorParameters
MakeDamageableTriggerActorParms__FRC16CActorParametersRC16CVisorParameters:
.global MakeDamageableTriggerActorParms__16CActorParametersCFRC16CVisorParameters
MakeDamageableTriggerActorParms__16CActorParametersCFRC16CVisorParameters:
/* 801067B0 00103710 94 21 FF 80 */ stwu r1, -0x80(r1)
/* 801067B4 00103714 7C 08 02 A6 */ mflr r0
/* 801067B8 00103718 90 01 00 84 */ stw r0, 0x84(r1)
@ -389,10 +389,10 @@ Scannable__16CActorParametersCFRC20CScannableParameters:
/* 801068C0 00103820 38 21 00 80 */ addi r1, r1, 0x80
/* 801068C4 00103824 4E 80 00 20 */ blr
.global sub_801068c8
sub_801068c8:
/* 801068C8 00103828 3D 60 80 3E */ lis r11, lbl_803DFF80@ha
/* 801068CC 0010382C 38 0B FF 80 */ addi r0, r11, lbl_803DFF80@l
.global "__ct__16CActorParametersFRC16CLightParametersRC20CScannableParametersRCQ24rstl11pair<Ui,Ui>RCQ24rstl11pair<Ui,Ui>RC16CVisorParametersbbbbfff"
"__ct__16CActorParametersFRC16CLightParametersRC20CScannableParametersRCQ24rstl11pair<Ui,Ui>RCQ24rstl11pair<Ui,Ui>RC16CVisorParametersbbbbfff":
/* 801068C8 00103828 3D 60 80 3E */ lis r11, __vt__16CLightParameters@ha
/* 801068CC 0010382C 38 0B FF 80 */ addi r0, r11, __vt__16CLightParameters@l
/* 801068D0 00103830 90 03 00 00 */ stw r0, 0(r3)
/* 801068D4 00103834 55 2B 06 3E */ clrlwi r11, r9, 0x18
/* 801068D8 00103838 89 21 00 0B */ lbz r9, 0xb(r1)
@ -467,9 +467,9 @@ __ct__16CActorParametersFv:
/* 801069E0 00103940 7C 7F 1B 78 */ mr r31, r3
/* 801069E4 00103944 38 61 00 0C */ addi r3, r1, 0xc
/* 801069E8 00103948 4B FD 3A 05 */ bl None__16CLightParametersFv
/* 801069EC 0010394C 3C 80 80 3E */ lis r4, lbl_803DFF80@ha
/* 801069EC 0010394C 3C 80 80 3E */ lis r4, __vt__16CLightParameters@ha
/* 801069F0 00103950 38 61 00 0C */ addi r3, r1, 0xc
/* 801069F4 00103954 38 04 FF 80 */ addi r0, r4, lbl_803DFF80@l
/* 801069F4 00103954 38 04 FF 80 */ addi r0, r4, __vt__16CLightParameters@l
/* 801069F8 00103958 38 80 FF FF */ li r4, -1
/* 801069FC 0010395C 90 1F 00 00 */ stw r0, 0(r31)
/* 80106A00 00103960 88 01 00 10 */ lbz r0, 0x10(r1)

View File

@ -8124,7 +8124,7 @@ lbl_801E119C:
/* 801E129C 001DE1FC 38 E0 00 01 */ li r7, 1
/* 801E12A0 001DE200 39 00 00 02 */ li r8, 2
/* 801E12A4 001DE204 39 20 00 00 */ li r9, 0
/* 801E12A8 001DE208 4B F2 54 51 */ bl __ct__16CLightParametersFbfQ216CLightParameters19EShadowTessellationffRC6CColorbQ216CLightParameters21EWorldLightingOptionsQ216CLightParameters26ELightRecalculationOptionsRC9CVector3fii
/* 801E12A8 001DE208 4B F2 54 51 */ bl __ct__16CLightParametersFbfQ216CLightParameters19EShadowTessellationffRC6CColorbQ216CLightParameters21EWorldLightingOptionsQ216CLightParameters26ELightRecalculationOptionsRC9CVector3fiibi
/* 801E12AC 001DE20C C0 22 AC DC */ lfs f1, lbl_805AC9FC@sda21(r2)
/* 801E12B0 001DE210 38 00 00 00 */ li r0, 0
/* 801E12B4 001DE214 90 01 00 08 */ stw r0, 8(r1)
@ -8140,7 +8140,7 @@ lbl_801E119C:
/* 801E12DC 001DE23C 3A E0 00 01 */ li r23, 1
/* 801E12E0 001DE240 39 20 00 01 */ li r9, 1
/* 801E12E4 001DE244 39 40 00 01 */ li r10, 1
/* 801E12E8 001DE248 4B F2 55 E1 */ bl sub_801068c8
/* 801E12E8 001DE248 4B F2 55 E1 */ bl "__ct__16CActorParametersFRC16CLightParametersRC20CScannableParametersRCQ24rstl11pair<Ui,Ui>RCQ24rstl11pair<Ui,Ui>RC16CVisorParametersbbbbfff"
/* 801E12EC 001DE24C C0 02 AC DC */ lfs f0, lbl_805AC9FC@sda21(r2)
/* 801E12F0 001DE250 3C 60 80 57 */ lis r3, NullConnectionList__7CEntity@ha
/* 801E12F4 001DE254 38 A3 D4 10 */ addi r5, r3, NullConnectionList__7CEntity@l

View File

@ -2266,7 +2266,7 @@ lbl_80205314:
/* 80205404 00202364 38 E0 00 01 */ li r7, 1
/* 80205408 00202368 39 00 00 02 */ li r8, 2
/* 8020540C 0020236C 39 20 00 00 */ li r9, 0
/* 80205410 00202370 4B F0 12 E9 */ bl __ct__16CLightParametersFbfQ216CLightParameters19EShadowTessellationffRC6CColorbQ216CLightParameters21EWorldLightingOptionsQ216CLightParameters26ELightRecalculationOptionsRC9CVector3fii
/* 80205410 00202370 4B F0 12 E9 */ bl __ct__16CLightParametersFbfQ216CLightParameters19EShadowTessellationffRC6CColorbQ216CLightParameters21EWorldLightingOptionsQ216CLightParameters26ELightRecalculationOptionsRC9CVector3fiibi
/* 80205414 00202374 C0 22 B0 A0 */ lfs f1, lbl_805ACDC0@sda21(r2)
/* 80205418 00202378 38 00 00 00 */ li r0, 0
/* 8020541C 0020237C 90 01 00 08 */ stw r0, 8(r1)
@ -2282,7 +2282,7 @@ lbl_80205314:
/* 80205444 002023A4 3A C0 00 01 */ li r22, 1
/* 80205448 002023A8 39 20 00 01 */ li r9, 1
/* 8020544C 002023AC 39 40 00 01 */ li r10, 1
/* 80205450 002023B0 4B F0 14 79 */ bl sub_801068c8
/* 80205450 002023B0 4B F0 14 79 */ bl "__ct__16CActorParametersFRC16CLightParametersRC20CScannableParametersRCQ24rstl11pair<Ui,Ui>RCQ24rstl11pair<Ui,Ui>RC16CVisorParametersbbbbfff"
/* 80205454 002023B4 7F E3 FB 78 */ mr r3, r31
/* 80205458 002023B8 7F C4 F3 78 */ mr r4, r30
/* 8020545C 002023BC 81 9F 00 00 */ lwz r12, 0(r31)

View File

@ -398,8 +398,8 @@ lbl_800C55E0:
.global __ct__16CActorParametersFRC16CActorParameters
__ct__16CActorParametersFRC16CActorParameters:
/* 800C561C 000C257C 3C A0 80 3E */ lis r5, lbl_803DFF80@ha
/* 800C5620 000C2580 38 05 FF 80 */ addi r0, r5, lbl_803DFF80@l
/* 800C561C 000C257C 3C A0 80 3E */ lis r5, __vt__16CLightParameters@ha
/* 800C5620 000C2580 38 05 FF 80 */ addi r0, r5, __vt__16CLightParameters@l
/* 800C5624 000C2584 90 03 00 00 */ stw r0, 0(r3)
/* 800C5628 000C2588 88 04 00 04 */ lbz r0, 4(r4)
/* 800C562C 000C258C 98 03 00 04 */ stb r0, 4(r3)
@ -19000,9 +19000,9 @@ lbl_800D65CC:
/* 800D666C 000D35CC 38 61 00 40 */ addi r3, r1, 0x40
/* 800D6670 000D35D0 48 00 3B ED */ bl LoadLightParameters__FR12CInputStream
/* 800D6674 000D35D4 8A 21 00 44 */ lbz r17, 0x44(r1)
/* 800D6678 000D35D8 3C 60 80 3E */ lis r3, lbl_803DFF80@ha
/* 800D6678 000D35D8 3C 60 80 3E */ lis r3, __vt__16CLightParameters@ha
/* 800D667C 000D35DC C0 A1 00 48 */ lfs f5, 0x48(r1)
/* 800D6680 000D35E0 3A 03 FF 80 */ addi r16, r3, lbl_803DFF80@l
/* 800D6680 000D35E0 3A 03 FF 80 */ addi r16, r3, __vt__16CLightParameters@l
/* 800D6684 000D35E4 81 81 00 4C */ lwz r12, 0x4c(r1)
/* 800D6688 000D35E8 38 61 00 40 */ addi r3, r1, 0x40
/* 800D668C 000D35EC C0 81 00 50 */ lfs f4, 0x50(r1)
@ -22785,9 +22785,9 @@ lbl_800D9DDC:
/* 800D9DE0 000D6D40 38 61 00 58 */ addi r3, r1, 0x58
/* 800D9DE4 000D6D44 48 00 04 79 */ bl LoadLightParameters__FR12CInputStream
/* 800D9DE8 000D6D48 8A A1 00 5C */ lbz r21, 0x5c(r1)
/* 800D9DEC 000D6D4C 3C 60 80 3E */ lis r3, lbl_803DFF80@ha
/* 800D9DEC 000D6D4C 3C 60 80 3E */ lis r3, __vt__16CLightParameters@ha
/* 800D9DF0 000D6D50 C0 A1 00 60 */ lfs f5, 0x60(r1)
/* 800D9DF4 000D6D54 3A C3 FF 80 */ addi r22, r3, lbl_803DFF80@l
/* 800D9DF4 000D6D54 3A C3 FF 80 */ addi r22, r3, __vt__16CLightParameters@l
/* 800D9DF8 000D6D58 81 81 00 64 */ lwz r12, 0x64(r1)
/* 800D9DFC 000D6D5C 38 61 00 58 */ addi r3, r1, 0x58
/* 800D9E00 000D6D60 C0 81 00 68 */ lfs f4, 0x68(r1)
@ -22997,7 +22997,7 @@ lbl_800DA098:
/* 800DA0D0 000D7030 92 C1 00 08 */ stw r22, 8(r1)
/* 800DA0D4 000D7034 39 01 00 20 */ addi r8, r1, 0x20
/* 800DA0D8 000D7038 92 A1 00 0C */ stw r21, 0xc(r1)
/* 800DA0DC 000D703C 48 02 C7 ED */ bl sub_801068c8
/* 800DA0DC 000D703C 48 02 C7 ED */ bl "__ct__16CActorParametersFRC16CLightParametersRC20CScannableParametersRCQ24rstl11pair<Ui,Ui>RCQ24rstl11pair<Ui,Ui>RC16CVisorParametersbbbbfff"
/* 800DA0E0 000D7040 38 61 00 98 */ addi r3, r1, 0x98
/* 800DA0E4 000D7044 38 80 FF FF */ li r4, -1
/* 800DA0E8 000D7048 48 02 C5 21 */ bl __dt__16CLightParametersFv
@ -23211,7 +23211,7 @@ lbl_800DA388:
/* 800DA3BC 000D731C 38 C1 00 18 */ addi r6, r1, 0x18
/* 800DA3C0 000D7320 57 87 06 3E */ clrlwi r7, r28, 0x18
/* 800DA3C4 000D7324 39 41 00 1C */ addi r10, r1, 0x1c
/* 800DA3C8 000D7328 48 02 C3 31 */ bl __ct__16CLightParametersFbfQ216CLightParameters19EShadowTessellationffRC6CColorbQ216CLightParameters21EWorldLightingOptionsQ216CLightParameters26ELightRecalculationOptionsRC9CVector3fii
/* 800DA3C8 000D7328 48 02 C3 31 */ bl __ct__16CLightParametersFbfQ216CLightParameters19EShadowTessellationffRC6CColorbQ216CLightParameters21EWorldLightingOptionsQ216CLightParameters26ELightRecalculationOptionsRC9CVector3fiibi
lbl_800DA3CC:
/* 800DA3CC 000D732C CB E1 00 68 */ lfd f31, 0x68(r1)
/* 800DA3D0 000D7330 CB C1 00 60 */ lfd f30, 0x60(r1)

View File

@ -1051,7 +1051,7 @@ lbl_800FB240:
/* 800FB2B8 000F8218 7E 05 83 78 */ mr r5, r16
/* 800FB2BC 000F821C 38 61 01 FC */ addi r3, r1, 0x1fc
/* 800FB2C0 000F8220 38 81 02 64 */ addi r4, r1, 0x264
/* 800FB2C4 000F8224 48 00 B4 ED */ bl MakeDamageableTriggerActorParms__FRC16CActorParametersRC16CVisorParameters
/* 800FB2C4 000F8224 48 00 B4 ED */ bl MakeDamageableTriggerActorParms__16CActorParametersCFRC16CVisorParameters
/* 800FB2C8 000F8228 A0 0D A3 8C */ lhz r0, kInvalidUniqueId@sda21(r13)
/* 800FB2CC 000F822C 2C 1E 00 01 */ cmpwi r30, 1
/* 800FB2D0 000F8230 3A 21 00 10 */ addi r17, r1, 0x10

View File

@ -157,7 +157,7 @@ LIBS = [
"MetroidPrime/CActorLights",
["MetroidPrime/Enemies/CPatternedInfo", True],
"MetroidPrime/CSimpleShadow",
"MetroidPrime/CActorParameters",
["MetroidPrime/CActorParameters", False],
"MetroidPrime/CInGameGuiManager",
"MetroidPrime/Enemies/CWarWasp",
"MetroidPrime/CWorldShadow",

View File

@ -31,6 +31,8 @@ public:
bool HasShadowLight() const { return x29c_shadowLightArrIdx != -1; }
int GetShadowLightIndex() const { return x2a0_shadowLightIdx; }
void SetAmbientColor(const CColor& color);
void SetCastShadows(bool v) { x298_25_castShadows = v; }
void SetFindShadowLight(bool v) { x298_27_findShadowLight = v; }
void SetShadowDynamicRangeThreshold(float t) { x2d0_shadowDynamicRangeThreshold = t; }

View File

@ -14,7 +14,7 @@ class CActorLights;
class CLightParameters {
public:
enum EShadowTesselation {
enum EShadowTessellation {
kST_Invalid = -1,
kST_Zero,
};
@ -33,22 +33,26 @@ public:
kLR_OneFrame,
};
// CLightParameters() {
// // TODO
// }
CLightParameters();
CLightParameters(bool, float, EShadowTessellation, float, float, const CColor&, bool,
EWorldLightingOptions, ELightRecalculationOptions, const CVector3f&, int, int,
bool, int);
virtual ~CLightParameters();
const CColor& GetAmbientColor() const { return x18_noLightsAmbient; }
bool ShouldMakeLights() const { return x1c_makeLights; }
CVector3f GetActorPosBias() const { return x2c_actorPosBias; }
int GetMaxAreaLights() const { return x3c_maxAreaLights; }
static CLightParameters None();
static uint GetFramesBetweenRecalculation(ELightRecalculationOptions opts);
rstl::auto_ptr< CActorLights > MakeActorLights() const;
private:
bool x4_castShadow;
float x8_shadowScale;
EShadowTesselation xc_shadowTesselation;
EShadowTessellation xc_shadowTesselation;
float x10_shadowAlpha;
float x14_maxShadowHeight;
CColor x18_noLightsAmbient;
@ -77,9 +81,7 @@ CHECK_SIZEOF(CScannableParameters, 0x4)
class CVisorParameters {
public:
CVisorParameters() {
// TODO
}
CVisorParameters() : x0_mask(0xf), x0_4_b1(false), x0_5_scanPassthrough(false) {}
CVisorParameters(uchar mask, bool b1, bool scanPassthrough)
: x0_mask(mask), x0_4_b1(b1), x0_5_scanPassthrough(scanPassthrough) {}
@ -99,10 +101,18 @@ CHECK_SIZEOF(CVisorParameters, 0x4)
class CActorParameters {
public:
// CActorParameters() {
// // TODO
// }
CActorParameters();
CActorParameters(const CLightParameters& lightParms, const CScannableParameters& scanParms,
const rstl::pair< CAssetId, CAssetId >& xrayAssets,
const rstl::pair< CAssetId, CAssetId >& thermalAssets,
const CVisorParameters& visorParms, bool globalTimeProvider, bool thermalHeat,
bool renderUnsorted, bool noSortThermal, float fadeInTime, float fadeOutTime,
float thermalMag);
CActorParameters(const CActorParameters&);
CActorParameters Scannable(const CScannableParameters& sParms) const;
CActorParameters HotInThermal(bool hot) const;
CActorParameters MakeDamageableTriggerActorParms(const CVisorParameters& visorParam) const;
const CLightParameters& GetLighting() const { return x0_lightParams; }
const CScannableParameters& GetScannable() const { return x40_scanParams; }
@ -118,11 +128,6 @@ public:
float GetFadeOutTime() const { return x60_fadeOutTime; }
static CActorParameters None();
CActorParameters HotInThermal(bool hot) const;/* {
CActorParameters ret = *this;
ret.x58_25_thermalHeat = hot;
return ret;
}*/
private:
CLightParameters x0_lightParams;
@ -138,6 +143,6 @@ private:
float x60_fadeOutTime;
float x64_thermalMag;
};
CHECK_SIZEOF(CActorParameters, 0x68)
// CHECK_SIZEOF(CActorParameters, 0x68)
#endif // _CACTORPARAMETERS

View File

@ -0,0 +1,130 @@
#include "MetroidPrime/CActorParameters.hpp"
#include "MetroidPrime/CActorLights.hpp"
CActorParameters::CActorParameters()
: x0_lightParams(CLightParameters::None())
, x40_scanParams(kInvalidAssetId)
, x44_xrayAssets(0, 0)
, x4c_thermalAssets(0, 0)
, x54_visorParams()
, x58_24_globalTimeProvider(true)
, x58_25_thermalHeat(false)
, x58_27_noSortThermal(false)
, x5c_fadeInTime(0.f)
, x60_fadeOutTime(0.f)
, x64_thermalMag(0.f) {}
CActorParameters::CActorParameters(const CLightParameters& lightParms, const CScannableParameters& scanParms,
const rstl::pair<CAssetId, CAssetId>& xrayAssets, const rstl::pair<CAssetId, CAssetId>& thermalAssets,
const CVisorParameters& visorParms, bool globalTimeProvider, bool thermalHeat, bool renderUnsorted,
bool noSortThermal, float fadeInTime, float fadeOutTime, float thermalMag)
: x0_lightParams(lightParms)
, x40_scanParams(scanParms)
, x44_xrayAssets(xrayAssets)
, x4c_thermalAssets(thermalAssets)
, x54_visorParams(visorParms)
, x58_24_globalTimeProvider(globalTimeProvider)
, x58_25_thermalHeat(thermalHeat)
, x58_26_renderUnsorted(renderUnsorted)
, x58_27_noSortThermal(noSortThermal)
, x5c_fadeInTime(fadeInTime)
, x60_fadeOutTime(fadeOutTime)
, x64_thermalMag(thermalMag) {}
CActorParameters CActorParameters::Scannable(const CScannableParameters& sParms) const {
CActorParameters result(*this);
result.x40_scanParams = sParms;
return result;
}
CActorParameters CActorParameters::HotInThermal(bool hot) const {
CActorParameters result(*this);
result.x58_25_thermalHeat = hot;
return result;
}
CActorParameters
CActorParameters::MakeDamageableTriggerActorParms(const CVisorParameters& visorParam) const {
CActorParameters result(*this);
result.x54_visorParams = visorParam;
return result;
}
CLightParameters::CLightParameters(bool castShadow, float shadowScale,
CLightParameters::EShadowTessellation shadowTess,
float shadowAlpha, float maxShadowHeight,
const CColor& noLightsAmbient, bool makeLights,
CLightParameters::EWorldLightingOptions lightingOpts,
CLightParameters::ELightRecalculationOptions lightRecalcOpts,
const CVector3f& actorPosBias, int maxDynamicLights,
int maxAreaLights, bool ambChannelOverflow, int layerIdx)
: x4_castShadow(castShadow)
, x8_shadowScale(shadowScale)
, xc_shadowTesselation(shadowTess)
, x10_shadowAlpha(shadowAlpha)
, x14_maxShadowHeight(maxShadowHeight)
, x18_noLightsAmbient(noLightsAmbient)
, x1c_makeLights(makeLights)
, x1d_ambientChannelOverflow(ambChannelOverflow)
, x20_worldLightingOptions(lightingOpts)
, x24_lightRecalcOpts(lightRecalcOpts)
, x28_layerIdx(layerIdx)
, x2c_actorPosBias(actorPosBias)
, x38_maxDynamicLights(maxDynamicLights)
, x3c_maxAreaLights(maxAreaLights) {
if (x38_maxDynamicLights > 4 || x38_maxDynamicLights == -1)
x38_maxDynamicLights = 4;
if (x3c_maxAreaLights > 4 || x3c_maxAreaLights == -1)
x3c_maxAreaLights = 4;
}
CLightParameters::CLightParameters()
: x4_castShadow(false)
, x8_shadowScale(0.f)
, xc_shadowTesselation(kST_Zero)
, x10_shadowAlpha(0.f)
, x14_maxShadowHeight(0.f)
, x18_noLightsAmbient(CColor::White())
, x1c_makeLights(false)
, x1d_ambientChannelOverflow(false)
, x20_worldLightingOptions(kLO_Zero)
, x24_lightRecalcOpts(kLR_EightFrames)
, x28_layerIdx(0)
, x2c_actorPosBias(CVector3f::Zero())
, x38_maxDynamicLights(4)
, x3c_maxAreaLights(4) {}
CLightParameters::~CLightParameters() {}
uint CLightParameters::GetFramesBetweenRecalculation(ELightRecalculationOptions opts) {
switch (opts) {
case kLR_LargeFrameCount:
return 0x3FFFFFFF;
case kLR_EightFrames:
return 8;
case kLR_FourFrames:
return 4;
case kLR_OneFrame:
return 1;
default:
return 8;
}
}
rstl::auto_ptr< CActorLights > CLightParameters::MakeActorLights() const {
rstl::auto_ptr< CActorLights > result;
if (x1c_makeLights) {
result =
new CActorLights(GetFramesBetweenRecalculation(x24_lightRecalcOpts), GetActorPosBias(),
x38_maxDynamicLights, x3c_maxAreaLights, x1d_ambientChannelOverflow,
x28_layerIdx == 1, x20_worldLightingOptions == kLO_DisableWorld, 0.1f);
if (x20_worldLightingOptions == kLO_NoShadowCast) {
result->SetCastShadows(false);
}
if (x3c_maxAreaLights == 0 && x1c_makeLights) {
result->SetAmbientColor(x18_noLightsAmbient);
}
}
return result;
}

View File

@ -20,7 +20,8 @@ CScriptPlayerHint::CScriptPlayerHint(TUniqueId uid, const rstl::string& name,
void CScriptPlayerHint::ClearObjectList() { xe8_objectList.clear(); }
void CScriptPlayerHint::AddToObjectList(TUniqueId uid) {
rstl::reserved_vector< TUniqueId, 8 >::iterator it = rstl::find(xe8_objectList.begin(), xe8_objectList.end(), uid);
rstl::reserved_vector< TUniqueId, 8 >::iterator it =
rstl::find(xe8_objectList.begin(), xe8_objectList.end(), uid);
if (it != xe8_objectList.end()) {
return;
}
@ -32,7 +33,8 @@ void CScriptPlayerHint::RemoveFromObjectList(TUniqueId uid, CStateManager& mgr)
return;
}
rstl::reserved_vector< TUniqueId, 8 >::iterator it = rstl::find(xe8_objectList.begin(), xe8_objectList.end(), uid);
rstl::reserved_vector< TUniqueId, 8 >::iterator it =
rstl::find(xe8_objectList.begin(), xe8_objectList.end(), uid);
if (it == xe8_objectList.end()) {
xe8_objectList.erase(xe8_objectList.begin());
@ -46,12 +48,13 @@ void CScriptPlayerHint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId send
switch (msg) {
case kSM_Deactivate:
case kSM_Deleted:
case kSM_Deleted: {
RemoveFromObjectList(sender, mgr);
CPlayer* player = mgr.Player();
player->AddToPlayerHintRemoveList(GetUniqueId(), mgr);
xfc_deactivated = true;
break;
}
case kSM_Increment:
x108_mpId = kInvalidUniqueId;
if ((x104_overrideFlags & 0x4000) != 0) {