From f16397257b00ef02e4b21ddf5c9b5ce1e43a5f76 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 2 Oct 2022 17:45:14 -0400 Subject: [PATCH] Match CScriptSpecialFunction constructor --- asm/MetroidPrime/ScriptLoader.s | 10 +++---- .../ScriptObjects/CScriptSpecialFunction.s | 16 +++++----- include/MetroidPrime/CStateManager.hpp | 8 ----- .../ScriptObjects/CScriptSpecialFunction.hpp | 21 +++++++------ include/rstl/pointer_iterator.hpp | 21 ++++++++++--- include/rstl/reserved_vector.hpp | 2 +- include/rstl/vector.hpp | 14 +++++++++ .../ScriptObjects/CScriptSpecialFunction.cpp | 30 +++++++++++++++---- 8 files changed, 79 insertions(+), 43 deletions(-) diff --git a/asm/MetroidPrime/ScriptLoader.s b/asm/MetroidPrime/ScriptLoader.s index 1cd3bf76..1df206d2 100644 --- a/asm/MetroidPrime/ScriptLoader.s +++ b/asm/MetroidPrime/ScriptLoader.s @@ -3964,7 +3964,7 @@ lbl_800C8844: /* 800C89D8 000C5938 C8 01 00 C0 */ lfd f0, 0xc0(r1) /* 800C89DC 000C593C 93 61 00 28 */ stw r27, 0x28(r1) /* 800C89E0 000C5940 EC 60 18 28 */ fsubs f3, f0, f3 -/* 800C89E4 000C5944 48 08 A1 DD */ bl "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypesss" +/* 800C89E4 000C5944 48 08 A1 DD */ bl "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypeUsUsUs" /* 800C89E8 000C5948 7C 7C 1B 78 */ mr r28, r3 lbl_800C89EC: /* 800C89EC 000C594C 7F 20 07 75 */ extsb. r0, r25 @@ -5569,7 +5569,7 @@ lbl_800CA054: /* 800CA1A8 000C7108 C8 01 00 80 */ lfd f0, 0x80(r1) /* 800CA1AC 000C710C 93 61 00 28 */ stw r27, 0x28(r1) /* 800CA1B0 000C7110 EC 40 10 28 */ fsubs f2, f0, f2 -/* 800CA1B4 000C7114 48 08 8A 0D */ bl "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypesss" +/* 800CA1B4 000C7114 48 08 8A 0D */ bl "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypeUsUsUs" /* 800CA1B8 000C7118 7C 7D 1B 78 */ mr r29, r3 lbl_800CA1BC: /* 800CA1BC 000C711C 7F 40 07 75 */ extsb. r0, r26 @@ -5919,7 +5919,7 @@ lbl_800CA580: /* 800CA6C0 000C7620 93 41 00 20 */ stw r26, 0x20(r1) /* 800CA6C4 000C7624 93 41 00 24 */ stw r26, 0x24(r1) /* 800CA6C8 000C7628 93 41 00 28 */ stw r26, 0x28(r1) -/* 800CA6CC 000C762C 48 08 84 F5 */ bl "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypesss" +/* 800CA6CC 000C762C 48 08 84 F5 */ bl "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypeUsUsUs" /* 800CA6D0 000C7630 7C 7B 1B 78 */ mr r27, r3 lbl_800CA6D4: /* 800CA6D4 000C7634 7F C0 07 75 */ extsb. r0, r30 @@ -15309,7 +15309,7 @@ lbl_800D2E70: /* 800D3020 000CFF80 93 81 00 20 */ stw r28, 0x20(r1) /* 800D3024 000CFF84 93 81 00 24 */ stw r28, 0x24(r1) /* 800D3028 000CFF88 93 81 00 28 */ stw r28, 0x28(r1) -/* 800D302C 000CFF8C 48 07 FB 95 */ bl "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypesss" +/* 800D302C 000CFF8C 48 07 FB 95 */ bl "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypeUsUsUs" /* 800D3030 000CFF90 7C 7F 1B 78 */ mr r31, r3 lbl_800D3034: /* 800D3034 000CFF94 7F 40 07 75 */ extsb. r0, r26 @@ -15473,7 +15473,7 @@ lbl_800D31AC: /* 800D328C 000D01EC 93 21 00 20 */ stw r25, 0x20(r1) /* 800D3290 000D01F0 93 01 00 24 */ stw r24, 0x24(r1) /* 800D3294 000D01F4 92 E1 00 28 */ stw r23, 0x28(r1) -/* 800D3298 000D01F8 48 07 F9 29 */ bl "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypesss" +/* 800D3298 000D01F8 48 07 F9 29 */ bl "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypeUsUsUs" /* 800D329C 000D01FC 7C 7A 1B 78 */ mr r26, r3 lbl_800D32A0: /* 800D32A0 000D0200 38 61 00 44 */ addi r3, r1, 0x44 diff --git a/asm/MetroidPrime/ScriptObjects/CScriptSpecialFunction.s b/asm/MetroidPrime/ScriptObjects/CScriptSpecialFunction.s index 0b28a6e9..53ae372f 100644 --- a/asm/MetroidPrime/ScriptObjects/CScriptSpecialFunction.s +++ b/asm/MetroidPrime/ScriptObjects/CScriptSpecialFunction.s @@ -4288,8 +4288,8 @@ lbl_80152BA8: /* 80152BB8 0014FB18 38 21 00 10 */ addi r1, r1, 0x10 /* 80152BBC 0014FB1C 4E 80 00 20 */ blr -.global "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypesss" -"__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypesss": +.global "__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypeUsUsUs" +"__ct__22CScriptSpecialFunctionF9TUniqueIdRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fQ222CScriptSpecialFunction16ESpecialFunctionRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>ffffRC9CVector3fRC6CColorbRC11CDamageInfollQ212CPlayerState9EItemTypeUsUsUs": /* 80152BC0 0014FB20 94 21 FE 70 */ stwu r1, -0x190(r1) /* 80152BC4 0014FB24 7C 08 02 A6 */ mflr r0 /* 80152BC8 0014FB28 90 01 01 94 */ stw r0, 0x194(r1) @@ -4410,7 +4410,7 @@ lbl_80152BA8: /* 80152D94 0014FCF4 38 80 00 06 */ li r4, 6 /* 80152D98 0014FCF8 38 AD 8C 50 */ addi r5, r13, lbl_805A7810@sda21 /* 80152D9C 0014FCFC D0 1A 01 80 */ stfs f0, 0x180(r26) -/* 80152DA0 0014FD00 48 00 01 B5 */ bl "__ct__Q24rstl36vectorFRCQ24rstl17rmemory_allocator" +/* 80152DA0 0014FD00 48 00 01 B5 */ bl "__ct__11TAverageFiRCf" /* 80152DA4 0014FD04 C0 02 9D 9C */ lfs f0, lbl_805ABABC@sda21(r2) /* 80152DA8 0014FD08 3C 60 80 5A */ lis r3, sZeroVector__9CVector3f@ha /* 80152DAC 0014FD0C 38 A0 00 00 */ li r5, 0 @@ -4523,8 +4523,8 @@ lbl_80152F1C: /* 80152F4C 0014FEAC 38 21 01 90 */ addi r1, r1, 0x190 /* 80152F50 0014FEB0 4E 80 00 20 */ blr -.global "__ct__Q24rstl36vectorFRCQ24rstl17rmemory_allocator" -"__ct__Q24rstl36vectorFRCQ24rstl17rmemory_allocator": +.global "__ct__11TAverageFiRCf" +"__ct__11TAverageFiRCf": /* 80152F54 0014FEB4 94 21 FF F0 */ stwu r1, -0x10(r1) /* 80152F58 0014FEB8 7C 08 02 A6 */ mflr r0 /* 80152F5C 0014FEBC 90 01 00 14 */ stw r0, 0x14(r1) @@ -4534,7 +4534,7 @@ lbl_80152F1C: /* 80152F6C 0014FECC 90 03 00 04 */ stw r0, 4(r3) /* 80152F70 0014FED0 90 03 00 08 */ stw r0, 8(r3) /* 80152F74 0014FED4 90 03 00 0C */ stw r0, 0xc(r3) -/* 80152F78 0014FED8 48 00 00 1D */ bl sub_80152f94 +/* 80152F78 0014FED8 48 00 00 1D */ bl "resize__Q24rstl36vectorFiRCf" /* 80152F7C 0014FEDC 80 01 00 14 */ lwz r0, 0x14(r1) /* 80152F80 0014FEE0 7F E3 FB 78 */ mr r3, r31 /* 80152F84 0014FEE4 83 E1 00 0C */ lwz r31, 0xc(r1) @@ -4542,8 +4542,8 @@ lbl_80152F1C: /* 80152F8C 0014FEEC 38 21 00 10 */ addi r1, r1, 0x10 /* 80152F90 0014FEF0 4E 80 00 20 */ blr -.global sub_80152f94 -sub_80152f94: +.global "resize__Q24rstl36vectorFiRCf" +"resize__Q24rstl36vectorFiRCf": /* 80152F94 0014FEF4 94 21 FF D0 */ stwu r1, -0x30(r1) /* 80152F98 0014FEF8 7C 08 02 A6 */ mflr r0 /* 80152F9C 0014FEFC 90 01 00 34 */ stw r0, 0x34(r1) diff --git a/include/MetroidPrime/CStateManager.hpp b/include/MetroidPrime/CStateManager.hpp index beba4eb3..9e2c2d3c 100644 --- a/include/MetroidPrime/CStateManager.hpp +++ b/include/MetroidPrime/CStateManager.hpp @@ -119,14 +119,6 @@ public: bool IsGeneratingObject() const { return xf94_26_generatingObject; } void SetIsGeneratingObject(bool gen) { xf94_26_generatingObject = gen; } - inline TUniqueId GenerateObjectInline(TEditorId eid) { - bool wasGeneratingObject = IsGeneratingObject(); - SetIsGeneratingObject(true); - TUniqueId objUid = GenerateObject(eid).second; - SetIsGeneratingObject(wasGeneratingObject); - return objUid; - } - void ApplyDamageToWorld(TUniqueId, const CActor&, const CVector3f&, const CDamageInfo& info, CMaterialFilter&); bool ApplyDamage(TUniqueId damagerId, TUniqueId damageeId, TUniqueId radiusSender, diff --git a/include/MetroidPrime/ScriptObjects/CScriptSpecialFunction.hpp b/include/MetroidPrime/ScriptObjects/CScriptSpecialFunction.hpp index 9b3c534f..f25dfc99 100644 --- a/include/MetroidPrime/ScriptObjects/CScriptSpecialFunction.hpp +++ b/include/MetroidPrime/ScriptObjects/CScriptSpecialFunction.hpp @@ -9,11 +9,10 @@ #include "Kyoto/Math/CAABox.hpp" #include "Kyoto/Math/CTransform4f.hpp" #include "Kyoto/Math/CVector3f.hpp" -#include "Kyoto/TReservedAverage.hpp" +#include "Kyoto/TAverage.hpp" #include "MetroidPrime/Player/CPlayerState.hpp" - class CScriptSpecialFunction : public CActor { public: enum ESpecialFunction { @@ -90,17 +89,16 @@ private: CSfxHandle x178_sfxHandle; u32 x17c_; float x180_; - TReservedAverage x184_; // metaforce has this as TReservedAverage, but volume is uchar here - u8 x190_pad[4]; // type change in x184_ fixes it being too big, but then it becomes 4 bytes too small + TAverage< f32 > x184_; float x194_; - rstl::vector x198_ringControllers; + rstl::vector< SRingController > x198_ringControllers; ERingState x1a8_ringState; CVector3f x1ac_ringRotateTarget; bool x1b8_ringReverse; s32 x1bc_areaSaveId; s32 x1c0_layerIdx; CPlayerState::EItemType x1c4_item; - rstl::optional_object x1c8_touchBounds; + rstl::optional_object< CAABox > x1c8_touchBounds; bool x1e4_24_spinnerInitializedXf : 1; bool x1e4_25_spinnerCanMove : 1; bool x1e4_26_sfx2Played : 1; @@ -112,11 +110,12 @@ private: bool x1e5_24_doSave : 1; bool x1e5_25_playerInArea : 1; bool x1e5_26_displayBillboard : 1; - rstl::optional_object x1e8_; // CTexture? + rstl::optional_object< CToken > x1e8_; // CTexture? public: - CScriptSpecialFunction(TUniqueId, const rstl::string&, const CEntityInfo&, const CTransform4f&, ESpecialFunction, - const rstl::string&, float, float, float, float, const CVector3f&, const CColor&, - bool, const CDamageInfo&, s32, s32, CPlayerState::EItemType, s16, s16, s16); + CScriptSpecialFunction(TUniqueId, const rstl::string&, const CEntityInfo&, const CTransform4f&, + ESpecialFunction, const rstl::string&, float, float, float, float, + const CVector3f&, const CColor&, bool, const CDamageInfo&, s32, s32, + CPlayerState::EItemType, u16, u16, u16); void Accept(IVisitor& visitor) override; void Think(float, CStateManager&) override; @@ -124,7 +123,7 @@ public: void PreRender(CStateManager&, const CFrustumPlanes&) override; void AddToRenderer(const CFrustumPlanes&, CStateManager&) override; void Render(CStateManager&) override; - rstl::optional_object GetTouchBounds() const override { return x1c8_touchBounds; } + rstl::optional_object< CAABox > GetTouchBounds() const override { return x1c8_touchBounds; } void SkipCinematic(CStateManager&); void RingScramble(CStateManager&); diff --git a/include/rstl/pointer_iterator.hpp b/include/rstl/pointer_iterator.hpp index aeb4b9d7..fe2cc2b2 100644 --- a/include/rstl/pointer_iterator.hpp +++ b/include/rstl/pointer_iterator.hpp @@ -38,15 +38,22 @@ public: return *this; } const_pointer_iterator operator+(int v) const { - return const_pointer_iterator(this->current + v); + const_pointer_iterator it = *this; + return it += v; } const_pointer_iterator operator-(int v) const { - return const_pointer_iterator(this->current - v); + const_pointer_iterator it = *this; + return it -= v; } + int operator-(const const_pointer_iterator& other) const { return this->current - other.current; } const T& operator*() const { return *current; } const T* operator->() const { return current; } bool operator==(const const_pointer_iterator& other) { return current == other.current; } bool operator!=(const const_pointer_iterator& other) { return current != other.current; } + bool operator<(const const_pointer_iterator& other) { return current < other.current; } + bool operator>(const const_pointer_iterator& other) { return current > other.current; } + bool operator<=(const const_pointer_iterator& other) { return current <= other.current; } + bool operator>=(const const_pointer_iterator& other) { return current >= other.current; } // friend const_pointer_iterator operator+(const const_pointer_iterator& x, int v) { // return const_pointer_iterator(x.current + v); @@ -86,8 +93,14 @@ public: this->current -= v; return *this; } - pointer_iterator operator+(int v) const { return pointer_iterator(this->current + v); } - pointer_iterator operator-(int v) const { return pointer_iterator(this->current - v); } + pointer_iterator operator+(int v) const { + pointer_iterator it = *this; + return it += v; + } + pointer_iterator operator-(int v) const { + pointer_iterator it = *this; + return it -= v; + } }; } // namespace rstl diff --git a/include/rstl/reserved_vector.hpp b/include/rstl/reserved_vector.hpp index 628f5110..e09a1a60 100644 --- a/include/rstl/reserved_vector.hpp +++ b/include/rstl/reserved_vector.hpp @@ -22,7 +22,7 @@ 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) { rstl::uninitialized_fill_n(data(), N, value); } + // reserved_vector(const T& value) : x0_count(N) { rstl::uninitialized_fill_n(data(), N, value); } reserved_vector(const reserved_vector& other) { x0_count = other.size(); // rstl::uninitialized_copy_n(other.data(), size(), data()); diff --git a/include/rstl/vector.hpp b/include/rstl/vector.hpp index a76edae1..54f83f52 100644 --- a/include/rstl/vector.hpp +++ b/include/rstl/vector.hpp @@ -70,6 +70,7 @@ public: } void reserve(int size); + void resize(int size, const T& in); iterator erase(iterator it); void push_back(const T& in) { @@ -118,6 +119,19 @@ public: inline const T& operator[](int idx) const { return xc_items[idx]; } }; +template < typename T, typename Alloc > +void vector< T, Alloc >::resize(int size, const T& in) { + if (x4_count != size) { + if (size > x4_count) { + reserve(size); + uninitialized_fill_n(xc_items + x4_count, size - x4_count, in); + } else { + destroy(begin() + size, end()); + } + x4_count = size; + } +} + template < typename T, typename Alloc > void vector< T, Alloc >::reserve(int size) { if (size <= x8_capacity) diff --git a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp index a8ab7a0f..b706fc41 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp @@ -24,7 +24,7 @@ CScriptSpecialFunction::CScriptSpecialFunction( TUniqueId uid, const rstl::string& name, const CEntityInfo& info, const CTransform4f& xf, ESpecialFunction func, const rstl::string& lcName, float f1, float f2, float f3, float f4, const CVector3f& vec, const CColor& col, bool active, const CDamageInfo& dInfo, s32 aId1, - s32 aId2, CPlayerState::EItemType itemType, s16 sId1, s16 sId2, s16 sId3) + s32 aId2, CPlayerState::EItemType itemType, u16 sId1, u16 sId2, u16 sId3) : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(), kInvalidUniqueId) , xe8_function(func) @@ -37,14 +37,31 @@ CScriptSpecialFunction::CScriptSpecialFunction( , x118_color(col) , x11c_damageInfo(dInfo) , x13c_spinnerInitialXf(CTransform4f::Identity()) +, x138_(0.f) +, x16c_(0.f) , x170_sfx1(CSfxManager::TranslateSFXID(sId1)) , x172_sfx2(CSfxManager::TranslateSFXID(sId2)) , x174_sfx3(CSfxManager::TranslateSFXID(sId3)) -, x184_(0.f) +, x180_(0.f) +, x184_(6, 0.f) +, x194_(0.f) +, x1a8_ringState(kRS_Stopped) , x1ac_ringRotateTarget(CVector3f::Zero()) +, x1b8_ringReverse(true) , x1bc_areaSaveId(aId1) , x1c0_layerIdx(aId2) -, x1c4_item(itemType) { +, x1c4_item(itemType) +, x1e4_24_spinnerInitializedXf(false) +, x1e4_25_spinnerCanMove(false) +, x1e4_26_sfx2Played(true) +, x1e4_27_sfx3Played(false) +// , x1e4_28_frustumEntered(false) +// , x1e4_29_frustumExited(false) +// , x1e4_30_(false) +, x1e4_31_inAreaDamage(false) +, x1e5_24_doSave(false) +, x1e5_25_playerInArea(false) +, x1e5_26_displayBillboard(false) { if (xe8_function == kSF_HUDTarget) { x1c8_touchBounds = CAABox(CVector3f(-1.f, -1.f, -1.f), CVector3f(1.f, 1.f, 1.f)); } @@ -356,12 +373,13 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId if (msg == kSM_Decrement || msg == kSM_Increment) { if (x1bc_areaSaveId != -1 && x1c0_layerIdx != -1) { TAreaId aId = mgr.GetWorld()->GetAreaIdForSaveId(x1bc_areaSaveId); - rstl::rc_ptr worldLayerState(NULL); - + rstl::rc_ptr< CScriptLayerManager > worldLayerState(NULL); + if (aId != kInvalidAreaId) { // worldLayerState = mgr.WorldLayerState(); } else { - const rstl::pair worldAreaPair = gpMemoryCard->GetAreaAndWorldIdForSaveId(x1bc_areaSaveId); + const rstl::pair< CAssetId, TAreaId > worldAreaPair = + gpMemoryCard->GetAreaAndWorldIdForSaveId(x1bc_areaSaveId); if (worldAreaPair.first != kInvalidAssetId) { // worldLayerState = gpGameState->StateForWorld(worldAreaPair.first).GetLayerState();