diff --git a/asm/MetaRender/CCubeRenderer.s b/asm/MetaRender/CCubeRenderer.s index e475bbe1..6f092676 100644 --- a/asm/MetaRender/CCubeRenderer.s +++ b/asm/MetaRender/CCubeRenderer.s @@ -3746,7 +3746,7 @@ SetThermal__13CCubeRendererFbfRC6CColor: /* 802B8F98 002B5EF8 D0 23 02 F0 */ stfs f1, 0x2f0(r3) /* 802B8F9C 002B5EFC 80 85 00 00 */ lwz r4, 0(r5) /* 802B8FA0 002B5F00 90 83 02 F4 */ stw r4, 0x2f4(r3) -/* 802B8FA4 002B5F04 98 0D A5 EC */ stb r0, lbl_805A91AC@sda21(r13) +/* 802B8FA4 002B5F04 98 0D A5 EC */ stb r0, sMoveRedToAlphaBuffer__6CDecal@sda21(r13) /* 802B8FA8 002B5F08 98 0D A8 B8 */ stb r0, lbl_805A9478@sda21(r13) /* 802B8FAC 002B5F0C 4E 80 00 20 */ blr @@ -5376,7 +5376,7 @@ DoThermalBlendHot__13CCubeRendererFv: /* 802BA7BC 002B771C 48 05 1F 91 */ bl SetViewPointMatrix__9CGraphicsFRC12CTransform4f /* 802BA7C0 002B7720 38 00 00 00 */ li r0, 0 /* 802BA7C4 002B7724 98 0D A8 B8 */ stb r0, lbl_805A9478@sda21(r13) -/* 802BA7C8 002B7728 98 0D A5 EC */ stb r0, lbl_805A91AC@sda21(r13) +/* 802BA7C8 002B7728 98 0D A5 EC */ stb r0, sMoveRedToAlphaBuffer__6CDecal@sda21(r13) /* 802BA7CC 002B772C BB 41 00 88 */ lmw r26, 0x88(r1) /* 802BA7D0 002B7730 80 01 00 A4 */ lwz r0, 0xa4(r1) /* 802BA7D4 002B7734 7C 08 03 A6 */ mtlr r0 @@ -5780,7 +5780,7 @@ lbl_802BAA1C: /* 802BADF0 002B7D50 48 05 19 5D */ bl SetViewPointMatrix__9CGraphicsFRC12CTransform4f /* 802BADF4 002B7D54 38 00 00 01 */ li r0, 1 /* 802BADF8 002B7D58 98 0D A8 B8 */ stb r0, lbl_805A9478@sda21(r13) -/* 802BADFC 002B7D5C 98 0D A5 EC */ stb r0, lbl_805A91AC@sda21(r13) +/* 802BADFC 002B7D5C 98 0D A5 EC */ stb r0, sMoveRedToAlphaBuffer__6CDecal@sda21(r13) /* 802BAE00 002B7D60 E3 E1 00 F8 */ psq_l f31, 248(r1), 0, qr0 /* 802BAE04 002B7D64 CB E1 00 F0 */ lfd f31, 0xf0(r1) /* 802BAE08 002B7D68 BB 41 00 D8 */ lmw r26, 0xd8(r1) @@ -9981,8 +9981,8 @@ lbl_802BE89C: /* 802BE8B0 002BB810 48 04 77 11 */ bl __dt__5CFontFv /* 802BE8B4 002BB814 34 1E 00 04 */ addic. r0, r30, 4 /* 802BE8B8 002BB818 41 82 00 10 */ beq lbl_802BE8C8 -/* 802BE8BC 002BB81C 3C 60 80 3F */ lis r3, lbl_803EC538@ha -/* 802BE8C0 002BB820 38 03 C5 38 */ addi r0, r3, lbl_803EC538@l +/* 802BE8BC 002BB81C 3C 60 80 3F */ lis r3, __vt__15IWeaponRenderer@ha +/* 802BE8C0 002BB820 38 03 C5 38 */ addi r0, r3, __vt__15IWeaponRenderer@l /* 802BE8C4 002BB824 90 1E 00 04 */ stw r0, 4(r30) lbl_802BE8C8: /* 802BE8C8 002BB828 28 1E 00 00 */ cmplwi r30, 0 @@ -10509,9 +10509,9 @@ __ct__13CCubeRendererFR12IObjectStoreR10COsContextR10CMemorySysR11CResFactory: /* 802BF074 002BBFD4 38 05 8D 90 */ addi r0, r5, lbl_803D8D90@l /* 802BF078 002BBFD8 93 E1 00 1C */ stw r31, 0x1c(r1) /* 802BF07C 002BBFDC 7C 7F 1B 78 */ mr r31, r3 -/* 802BF080 002BBFE0 3C 60 80 3F */ lis r3, lbl_803EC538@ha +/* 802BF080 002BBFE0 3C 60 80 3F */ lis r3, __vt__15IWeaponRenderer@ha /* 802BF084 002BBFE4 90 1F 00 00 */ stw r0, 0(r31) -/* 802BF088 002BBFE8 38 03 C5 38 */ addi r0, r3, lbl_803EC538@l +/* 802BF088 002BBFE8 38 03 C5 38 */ addi r0, r3, __vt__15IWeaponRenderer@l /* 802BF08C 002BBFEC 3C 60 80 3F */ lis r3, lbl_803EC5D8@ha /* 802BF090 002BBFF0 90 1F 00 04 */ stw r0, 4(r31) /* 802BF094 002BBFF4 38 A3 C5 D8 */ addi r5, r3, lbl_803EC5D8@l diff --git a/asm/Weapons/CDecal.s b/asm/Weapons/CDecal.s index d9e61658..411fc2b4 100644 --- a/asm/Weapons/CDecal.s +++ b/asm/Weapons/CDecal.s @@ -2,11 +2,11 @@ .section .sbss, "wa" -.global lbl_805A91A8 -lbl_805A91A8: +.global sDecalRandom__6CDecal +sDecalRandom__6CDecal: .skip 0x4 -.global lbl_805A91AC -lbl_805A91AC: +.global sMoveRedToAlphaBuffer__6CDecal +sMoveRedToAlphaBuffer__6CDecal: .skip 0x4 .section .text, "ax" @@ -46,7 +46,7 @@ lbl_802B487C: Render__6CDecalCFv: /* 802B488C 002B17EC 94 21 FF E0 */ stwu r1, -0x20(r1) /* 802B4890 002B17F0 7C 08 02 A6 */ mflr r0 -/* 802B4894 002B17F4 38 8D A5 E8 */ addi r4, r13, lbl_805A91A8@sda21 +/* 802B4894 002B17F4 38 8D A5 E8 */ addi r4, r13, sDecalRandom__6CDecal@sda21 /* 802B4898 002B17F8 90 01 00 24 */ stw r0, 0x24(r1) /* 802B489C 002B17FC 93 E1 00 1C */ stw r31, 0x1c(r1) /* 802B48A0 002B1800 93 C1 00 18 */ stw r30, 0x18(r1) @@ -530,7 +530,7 @@ lbl_802B4F5C: /* 802B4FAC 002B1F0C 38 C0 00 07 */ li r6, 7 /* 802B4FB0 002B1F10 38 E0 00 00 */ li r7, 0 /* 802B4FB4 002B1F14 48 05 6A 75 */ bl SetAlphaCompare__9CGraphicsF13ERglAlphaFuncUc11ERglAlphaOp13ERglAlphaFuncUc -/* 802B4FB8 002B1F18 88 0D A5 EC */ lbz r0, lbl_805A91AC@sda21(r13) +/* 802B4FB8 002B1F18 88 0D A5 EC */ lbz r0, sMoveRedToAlphaBuffer__6CDecal@sda21(r13) /* 802B4FBC 002B1F1C 3B E0 00 00 */ li r31, 0 /* 802B4FC0 002B1F20 7F E3 FB 78 */ mr r3, r31 /* 802B4FC4 002B1F24 28 00 00 00 */ cmplwi r0, 0 @@ -860,7 +860,7 @@ lbl_802B5408: /* 802B5494 002B23F4 38 A3 66 A0 */ addi r5, r3, skZero3f@l /* 802B5498 002B23F8 90 DF 00 40 */ stw r6, 0x40(r31) /* 802B549C 002B23FC 38 61 00 10 */ addi r3, r1, 0x10 -/* 802B54A0 002B2400 38 8D A5 E8 */ addi r4, r13, lbl_805A91A8@sda21 +/* 802B54A0 002B2400 38 8D A5 E8 */ addi r4, r13, sDecalRandom__6CDecal@sda21 /* 802B54A4 002B2404 D0 1F 00 44 */ stfs f0, 0x44(r31) /* 802B54A8 002B2408 88 1F 00 48 */ lbz r0, 0x48(r31) /* 802B54AC 002B240C 50 E0 3E 30 */ rlwimi r0, r7, 7, 0x18, 0x18 @@ -1118,7 +1118,7 @@ SetGlobalSeed__6CDecalFUs: /* 802B5850 002B27B0 7C 08 02 A6 */ mflr r0 /* 802B5854 002B27B4 90 01 00 14 */ stw r0, 0x14(r1) /* 802B5858 002B27B8 7C 60 1B 78 */ mr r0, r3 -/* 802B585C 002B27BC 38 6D A5 E8 */ addi r3, r13, lbl_805A91A8@sda21 +/* 802B585C 002B27BC 38 6D A5 E8 */ addi r3, r13, sDecalRandom__6CDecal@sda21 /* 802B5860 002B27C0 54 04 04 3E */ clrlwi r4, r0, 0x10 /* 802B5864 002B27C4 48 05 CD 81 */ bl SetSeed__9CRandom16FUi /* 802B5868 002B27C8 80 01 00 14 */ lwz r0, 0x14(r1) @@ -1130,7 +1130,7 @@ SetGlobalSeed__6CDecalFUs: __sinit_CDecal_cpp: /* 802B5878 002B27D8 94 21 FF F0 */ stwu r1, -0x10(r1) /* 802B587C 002B27DC 7C 08 02 A6 */ mflr r0 -/* 802B5880 002B27E0 38 6D A5 E8 */ addi r3, r13, lbl_805A91A8@sda21 +/* 802B5880 002B27E0 38 6D A5 E8 */ addi r3, r13, sDecalRandom__6CDecal@sda21 /* 802B5884 002B27E4 38 80 00 63 */ li r4, 0x63 /* 802B5888 002B27E8 90 01 00 14 */ stw r0, 0x14(r1) /* 802B588C 002B27EC 48 05 CD 61 */ bl __ct__9CRandom16FUi diff --git a/asm/Weapons/IWeaponRenderer.s b/asm/Weapons/IWeaponRenderer.s index 4923d517..873c932a 100644 --- a/asm/Weapons/IWeaponRenderer.s +++ b/asm/Weapons/IWeaponRenderer.s @@ -10,8 +10,8 @@ lbl_803EC528: .4byte __dt__22CDefaultWeaponRendererFv .4byte AddParticleGen__22CDefaultWeaponRendererFRC12CParticleGen -.global lbl_803EC538 -lbl_803EC538: +.global __vt__15IWeaponRenderer +__vt__15IWeaponRenderer: # ROM: 0x3E9538 .4byte 0 .4byte 0 @@ -24,7 +24,7 @@ lbl_803EC538: .global sWeaponRenderer__15IWeaponRenderer sWeaponRenderer__15IWeaponRenderer: # ROM: 0x3F5FF0 - .4byte lbl_805A91A0 + .4byte sDefaultRenderer .4byte 0 .section .bss @@ -35,8 +35,8 @@ lbl_8046E1F0: .section .sbss, "wa" -.global lbl_805A91A0 -lbl_805A91A0: +.global sDefaultRenderer +sDefaultRenderer: .skip 0x8 .section .text, "ax" @@ -45,18 +45,18 @@ lbl_805A91A0: __sinit_IWeaponRenderer_cpp: /* 802B36A8 002B0608 94 21 FF F0 */ stwu r1, -0x10(r1) /* 802B36AC 002B060C 7C 08 02 A6 */ mflr r0 -/* 802B36B0 002B0610 3C 80 80 3F */ lis r4, lbl_803EC538@ha +/* 802B36B0 002B0610 3C 80 80 3F */ lis r4, __vt__15IWeaponRenderer@ha /* 802B36B4 002B0614 3C 60 80 3F */ lis r3, lbl_803EC528@ha /* 802B36B8 002B0618 90 01 00 14 */ stw r0, 0x14(r1) -/* 802B36BC 002B061C 38 04 C5 38 */ addi r0, r4, lbl_803EC538@l +/* 802B36BC 002B061C 38 04 C5 38 */ addi r0, r4, __vt__15IWeaponRenderer@l /* 802B36C0 002B0620 3C 80 80 2B */ lis r4, __dt__22CDefaultWeaponRendererFv@ha -/* 802B36C4 002B0624 90 0D A5 E0 */ stw r0, lbl_805A91A0@sda21(r13) +/* 802B36C4 002B0624 90 0D A5 E0 */ stw r0, sDefaultRenderer@sda21(r13) /* 802B36C8 002B0628 38 03 C5 28 */ addi r0, r3, lbl_803EC528@l /* 802B36CC 002B062C 3C 60 80 47 */ lis r3, lbl_8046E1F0@ha /* 802B36D0 002B0630 38 84 37 24 */ addi r4, r4, __dt__22CDefaultWeaponRendererFv@l -/* 802B36D4 002B0634 90 0D A5 E0 */ stw r0, lbl_805A91A0@sda21(r13) +/* 802B36D4 002B0634 90 0D A5 E0 */ stw r0, sDefaultRenderer@sda21(r13) /* 802B36D8 002B0638 38 A3 E1 F0 */ addi r5, r3, lbl_8046E1F0@l -/* 802B36DC 002B063C 38 6D A5 E0 */ addi r3, r13, lbl_805A91A0@sda21 +/* 802B36DC 002B063C 38 6D A5 E0 */ addi r3, r13, sDefaultRenderer@sda21 /* 802B36E0 002B0640 48 0D 5F AD */ bl __register_global_object /* 802B36E4 002B0644 80 01 00 14 */ lwz r0, 0x14(r1) /* 802B36E8 002B0648 7C 08 03 A6 */ mtlr r0 @@ -90,8 +90,8 @@ __dt__22CDefaultWeaponRendererFv: /* 802B3740 002B06A0 38 03 C5 28 */ addi r0, r3, lbl_803EC528@l /* 802B3744 002B06A4 90 1F 00 00 */ stw r0, 0(r31) /* 802B3748 002B06A8 41 82 00 10 */ beq lbl_802B3758 -/* 802B374C 002B06AC 3C 60 80 3F */ lis r3, lbl_803EC538@ha -/* 802B3750 002B06B0 38 03 C5 38 */ addi r0, r3, lbl_803EC538@l +/* 802B374C 002B06AC 3C 60 80 3F */ lis r3, __vt__15IWeaponRenderer@ha +/* 802B3750 002B06B0 38 03 C5 38 */ addi r0, r3, __vt__15IWeaponRenderer@l /* 802B3754 002B06B4 90 1F 00 00 */ stw r0, 0(r31) lbl_802B3758: /* 802B3758 002B06B8 7C 80 07 35 */ extsh. r0, r4 diff --git a/include/Kyoto/Graphics/CLight.hpp b/include/Kyoto/Graphics/CLight.hpp new file mode 100644 index 00000000..40892fbe --- /dev/null +++ b/include/Kyoto/Graphics/CLight.hpp @@ -0,0 +1,8 @@ +#ifndef __CLIGHT_HPP__ +#define __CLIGHT_HPP__ + + +class CLight { +}; + +#endif // __CLIGHT_HPP__ diff --git a/include/Kyoto/Math/CAABox.hpp b/include/Kyoto/Math/CAABox.hpp new file mode 100644 index 00000000..6f987ffe --- /dev/null +++ b/include/Kyoto/Math/CAABox.hpp @@ -0,0 +1,11 @@ +#ifndef __CAABOX_HPP__ +#define __CAABOX_HPP__ + +#include "Kyoto/Math/CVector3f.hpp" + +class CAABox { + CVector3f min; + CVector3f max; +}; + +#endif // __CAABOX_HPP__ diff --git a/include/Kyoto/Particles/CParticleGen.hpp b/include/Kyoto/Particles/CParticleGen.hpp new file mode 100644 index 00000000..71be9c1d --- /dev/null +++ b/include/Kyoto/Particles/CParticleGen.hpp @@ -0,0 +1,43 @@ +#ifndef _CPARTICLEGEN_HPP +#define _CPARTICLEGEN_HPP + +#include "Kyoto/Math/CTransform4f.hpp" +#include "Kyoto/Math/CVector3f.hpp" +#include "Kyoto/Math/CColor.hpp" +#include "Kyoto/Math/CAABox.hpp" +#include "Kyoto/Graphics/CLight.hpp" + +class CWarp; +class CParticleGen { +public: + virtual ~CParticleGen() = 0; + virtual void Update(double) = 0; + virtual void Render() = 0; + virtual void SetOrientation(const CTransform4f& orientation) = 0; + virtual void SetTranslation(const CVector3f& translation) = 0; + virtual void SetGlobalOrientation(const CTransform4f& orientation) = 0; + virtual void SetGlobalTranslation(const CVector3f& translation) = 0; + virtual void SetGlobalScale(const CVector3f& scale) = 0; + virtual void SetLocalScale(const CVector3f& scale) = 0; + virtual void SetParticleEmission(bool emission) = 0; + virtual void SetModulationColor(const CColor& col) = 0; + virtual void SetGeneratorRate(float rate) {} + virtual CTransform4f GetOrientation() const = 0; + virtual CVector3f GetTranslation() const = 0; + virtual CTransform4f GetGlobalOrientation() const = 0; + virtual CVector3f GetGlobalTranslation() const = 0; + virtual CVector3f GetGlobalScale() const = 0; + virtual bool GetParticleEmission() const = 0; + virtual CColor GetModulationColor() const = 0; + virtual float GetGeneratorRate() const { return 1.f; } + virtual bool IsSystemDeletable() const = 0; + virtual CAABox GetBounds() const = 0; + virtual s32 GetParticleCOunt() const = 0; + virtual bool SystemHasLight() const = 0; + virtual CLight GetLight() = 0; + virtual void DestroyParticles() = 0; + virtual void AddModifier(CWarp*) = 0; + virtual u32 Get4CharId() const = 0; +}; + +#endif // _CPARTICLEGEN_HPP diff --git a/include/Weapons/IWeaponRenderer.hpp b/include/Weapons/IWeaponRenderer.hpp new file mode 100644 index 00000000..66f2b840 --- /dev/null +++ b/include/Weapons/IWeaponRenderer.hpp @@ -0,0 +1,23 @@ +#ifndef __IWEAPONRENDERER_HPP__ +#define __IWEAPONRENDERER_HPP__ + +class CParticleGen; +class IWeaponRenderer { + virtual ~IWeaponRenderer() {} + virtual void AddParticleGen(const CParticleGen& gen) = 0; + + static void SetRenderer(IWeaponRenderer* renderer) { sWeaponRenderer = renderer; } +private: + static IWeaponRenderer* sWeaponRenderer; +}; + + +class CDefaultRenderer : public IWeaponRenderer { +public: + ~CDefaultRenderer(); + void AddParticleGen(const CParticleGen& gen); +}; + +static CDefaultRenderer sDefaultRenderer = CDefaultRenderer();; + +#endif //__IWEAPONRENDERER_HPP__ diff --git a/src/Weapons/IWeaponRenderer.cpp b/src/Weapons/IWeaponRenderer.cpp new file mode 100644 index 00000000..9f5331cb --- /dev/null +++ b/src/Weapons/IWeaponRenderer.cpp @@ -0,0 +1,15 @@ +#include "Weapons/IWeaponRenderer.hpp" + +#include "Kyoto/Particles/CParticleGen.hpp" +#include "Kyoto/Alloc/CMemory.hpp" + +//CDefaultRenderer sDefaultRenderer = CDefaultRenderer(); +IWeaponRenderer* IWeaponRenderer::sWeaponRenderer = &sDefaultRenderer; + + +CDefaultRenderer::~CDefaultRenderer() { +} + +void CDefaultRenderer::AddParticleGen(const CParticleGen& gen) { + const_cast(gen).Render(); +}