summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-09-19 21:05:05 +0200
committerTreeki <treeki@gmail.com>2011-09-19 21:05:05 +0200
commit2ce313d6b162fcb6e9e3790316848c72ff0bf012 (patch)
tree973dd86b8f186b6bccc4669657714a565780518a /src
parent318e61000f4c57758288b8826b48afb08ddd488b (diff)
downloadkamek-2ce313d6b162fcb6e9e3790316848c72ff0bf012.tar.gz
kamek-2ce313d6b162fcb6e9e3790316848c72ff0bf012.zip
glowy model support added to MrSun
Diffstat (limited to '')
-rwxr-xr-xsrc/mrsun.cpp52
1 files changed, 36 insertions, 16 deletions
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);
+ }
}