diff options
author | Treeki <treeki@gmail.com> | 2011-09-19 21:05:05 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-09-19 21:05:05 +0200 |
commit | 2ce313d6b162fcb6e9e3790316848c72ff0bf012 (patch) | |
tree | 973dd86b8f186b6bccc4669657714a565780518a | |
parent | 318e61000f4c57758288b8826b48afb08ddd488b (diff) | |
download | kamek-2ce313d6b162fcb6e9e3790316848c72ff0bf012.tar.gz kamek-2ce313d6b162fcb6e9e3790316848c72ff0bf012.zip |
glowy model support added to MrSun
Diffstat (limited to '')
-rwxr-xr-x | include/game.h | 2 | ||||
-rw-r--r-- | kamek_ntsc.x | 6 | ||||
-rw-r--r-- | kamek_ntsc2.x | 6 | ||||
-rw-r--r-- | kamek_pal2.x | 6 | ||||
-rwxr-xr-x | src/mrsun.cpp | 52 |
5 files changed, 50 insertions, 22 deletions
diff --git a/include/game.h b/include/game.h index 93d8ae1..d16a09f 100755 --- a/include/game.h +++ b/include/game.h @@ -335,6 +335,8 @@ class mMtx { Mtx data;
public:
+ mMtx() { }
+
mMtx(float _00, float _01, float _02, float _03,
float _10, float _11, float _12, float _13,
float _20, float _21, float _22, float _23);
diff --git a/kamek_ntsc.x b/kamek_ntsc.x index 5f7042a..19cdb33 100644 --- a/kamek_ntsc.x +++ b/kamek_ntsc.x @@ -23,10 +23,12 @@ SECTIONS { /* Mr Sun Related */ - BubbleModel = 0x809D0CA0; - BubbleDraw = 0x809D0830; ActivePhysics_InitWithStruct = 0x8008C3E0; ActivePhysics_AddToList = 0x8008C330; + HandleXSpeed = 0x8006CD90; + HandleYSpeed = 0x8006CDE0; + UpdateObjectPosBasedOnSpeedValues_real = 0x8006CD40; + dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3 = 0x80096240; diff --git a/kamek_ntsc2.x b/kamek_ntsc2.x index 95523f8..1328e90 100644 --- a/kamek_ntsc2.x +++ b/kamek_ntsc2.x @@ -23,10 +23,12 @@ SECTIONS { /* Mr Sun Related */ - BubbleModel = 0x809D0CC0; - BubbleDraw = 0x809D0850; ActivePhysics_InitWithStruct = 0x8008C3E0; ActivePhysics_AddToList = 0x8008C330; + HandleXSpeed = 0x8006CD90; + HandleYSpeed = 0x8006CDE0; + UpdateObjectPosBasedOnSpeedValues_real = 0x8006CD40; + dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3 = 0x80096240; diff --git a/kamek_pal2.x b/kamek_pal2.x index a499f36..23f7941 100644 --- a/kamek_pal2.x +++ b/kamek_pal2.x @@ -23,10 +23,12 @@ SECTIONS { /* Mr Sun Related */ - BubbleModel = 0xDEADBEEF; - BubbleDraw = 0xDEADBEEF; ActivePhysics_InitWithStruct = 0xDEADBEEF; ActivePhysics_AddToList = 0xDEADBEEF; + HandleXSpeed = 0xDEADBEEF; + HandleYSpeed = 0xDEADBEEF; + UpdateObjectPosBasedOnSpeedValues_real = 0xDEADBEEF; + dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3 = 0xDEADBEEF; diff --git a/src/mrsun.cpp b/src/mrsun.cpp index b62228e..a5fa121 100755 --- a/src/mrsun.cpp +++ b/src/mrsun.cpp @@ -9,7 +9,10 @@ class daMrSun_c : public dEn_c { int onDraw(); mHeapAllocator_c allocator; - m3d::mdl_c model; + m3d::mdl_c bodyModel; + m3d::mdl_c glowModel; + + bool hasGlow; float Baseline; float SwoopSlope; @@ -28,7 +31,7 @@ class daMrSun_c : public dEn_c { static daMrSun_c *build(); - void updateModelMatrix(); + void updateModelMatrices(); USING_STATES(daMrSun_c); DECLARE_STATE(Follow); @@ -66,21 +69,26 @@ CREATE_STATE(daMrSun_c, Wait); #define DEACTIVATE 0 int daMrSun_c::onCreate() { - OSReport("Creating the Mr.Sun Model"); + OSReport("Creating the Mr.Sun Models"); allocator.link(-1, GameHeaps[0], 0, 0x20); if (this->settings == 0) { // It's a sun + hasGlow = true; + nw4r::g3d::ResFile rf(getResource("bilikyu", "g3d/sun.brres")); - model.setup(rf.GetResMdl("Sun"), &allocator, 0x224, 1, 0); - // SetupTextures_Enemy(&model, 0); - SetupTextures_Map(&model, 0); + bodyModel.setup(rf.GetResMdl("Sun"), &allocator, 0x224, 1, 0); + SetupTextures_Map(&bodyModel, 0); + + glowModel.setup(rf.GetResMdl("SunGlow"), &allocator, 0x224, 1, 0); + SetupTextures_Map(&glowModel, 0); } else { // It's a moon + hasGlow = false; + nw4r::g3d::ResFile rf(getResource("bilikyu", "g3d/bilikyu.brres")); - model.setup(rf.GetResMdl("bilikyu"), &allocator, 0x224, 1, 0); - // SetupTextures_Enemy(&model, 0); - SetupTextures_Map(&model, 0); + bodyModel.setup(rf.GetResMdl("bilikyu"), &allocator, 0x224, 1, 0); + SetupTextures_Map(&bodyModel, 0); } allocator.unlink(); @@ -117,7 +125,7 @@ int daMrSun_c::onCreate() { this->xSpiralOffset = 0.0; this->ySpiralOffset = 0.0; - this->pos.z = 3300.00 + this->pos.z = 3300.00; OSReport("Setting Mr.Sun's State"); doStateChange(&StateID_Follow); @@ -134,24 +142,36 @@ int daMrSun_c::onDelete() { int daMrSun_c::onExecute() { //OSReport("Oh Mr.Sun, Sun, Mr.Golden Sun"); acState.execute(); - updateModelMatrix(); + updateModelMatrices(); return true; } int daMrSun_c::onDraw() { - model.scheduleForDrawing(); + bodyModel.scheduleForDrawing(); + if (hasGlow) + glowModel.scheduleForDrawing(); + return true; } -void daMrSun_c::updateModelMatrix() { +void daMrSun_c::updateModelMatrices() { // This won't work with wrap because I'm lazy. matrix.translation(pos.x, pos.y, pos.z); matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); - model.setDrawMatrix(matrix); - model.setScale(&scale); - model.calcWorld(false); + bodyModel.setDrawMatrix(matrix); + bodyModel.setScale(&scale); + bodyModel.calcWorld(false); + + if (hasGlow) { + mMtx glowMatrix; + glowMatrix.translation(pos.x, pos.y, pos.z); + + glowModel.setDrawMatrix(glowMatrix); + glowModel.setScale(&scale); + glowModel.calcWorld(false); + } } |