From cee981495f3799f92b49809dc3d802b7fce1b248 Mon Sep 17 00:00:00 2001
From: Treeki <treeki@gmail.com>
Date: Sat, 17 Sep 2011 04:53:29 +0200
Subject: Mr Sun model rendering fixed

---
 src/mrsun.cpp | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/mrsun.cpp b/src/mrsun.cpp
index 3ef27ed..bce5908 100755
--- a/src/mrsun.cpp
+++ b/src/mrsun.cpp
@@ -13,6 +13,8 @@ class daMrSun_c : public dEn_c {
 
 	static daMrSun_c *build();
 
+	void updateModelMatrix();
+
 	USING_STATES(daMrSun_c);
 	DECLARE_STATE(Follow);
 	DECLARE_STATE(Swoop);
@@ -39,7 +41,7 @@ int daMrSun_c::onCreate() {
 	OSReport("Creating the Mr.Sun Model");
 	allocator.link(-1, GameHeaps[0], 0, 0x20);
 
-	nw4r::g3d::ResFile rf(getResource("g3d/bubble.brres", "bubble"));
+	nw4r::g3d::ResFile rf(getResource("bubble", "g3d/t00.brres"));
 	model.setup(rf.GetResMdl("bubble"), &allocator, 0x224, 1, 0);
 	SetupTextures_Enemy(&model, 0);
 
@@ -79,8 +81,9 @@ int daMrSun_c::onDelete() {
 }
 
 int daMrSun_c::onExecute() {
-	OSReport("Oh Mr.Sun, Sun, Mr.Golden Sun");
+	//OSReport("Oh Mr.Sun, Sun, Mr.Golden Sun");
 	acState.execute();
+	updateModelMatrix();
 	return true;
 }
 
@@ -90,6 +93,17 @@ int daMrSun_c::onDraw() {
 }
 
 
+void daMrSun_c::updateModelMatrix() {
+	// 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);
+}
+
+
 
 void daMrSun_c::beginState_Follow() { }
 void daMrSun_c::executeState_Follow() { }
-- 
cgit v1.2.3