summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-24 05:40:39 +0200
committerTreeki <treeki@gmail.com>2012-09-24 05:40:39 +0200
commit245bb3325f613f81973866100e86ee681b0fde9d (patch)
tree7837866a91fc6c422ffb9b730c2fdbbb6577ea53
parentaafa2a57c88c01067266244eae2a906d8771c065 (diff)
parent4f567256d015cf7a835ac03b9e5abb8a2a7eb12a (diff)
downloadkamek-245bb3325f613f81973866100e86ee681b0fde9d.tar.gz
kamek-245bb3325f613f81973866100e86ee681b0fde9d.zip
Merge branch 'level-select' into new-hud
Diffstat (limited to '')
-rw-r--r--NewerProject.yaml4
-rw-r--r--NewerProjectKP.yaml1
-rw-r--r--apDebug.yaml9
-rwxr-xr-xinclude/game.h20
-rw-r--r--include/playerAnim.h182
-rw-r--r--include/sfx.h3
-rw-r--r--kamek_pal.x14
-rw-r--r--koopatlas.yaml15
-rw-r--r--shyguy.yaml4
-rw-r--r--spritetex.yaml28
-rw-r--r--src/apDebug.cpp222
-rw-r--r--src/koopatlas/core.cpp9
-rw-r--r--src/koopatlas/core.h2
-rw-r--r--src/koopatlas/map.cpp10
-rw-r--r--src/koopatlas/map.h2
-rw-r--r--src/koopatlas/mapdata.h11
-rw-r--r--src/koopatlas/pathmanager.cpp335
-rw-r--r--src/koopatlas/pathmanager.h13
-rw-r--r--src/koopatlas/player.cpp8
-rw-r--r--src/koopatlas/player.h181
-rw-r--r--src/randomcrap.S44
-rw-r--r--src/shyguy.cpp15
-rwxr-xr-xsrc/spritetex.S26
23 files changed, 797 insertions, 361 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml
index ae354bf..056cdbd 100644
--- a/NewerProject.yaml
+++ b/NewerProject.yaml
@@ -2,8 +2,11 @@ output_dir: "NewerASM"
code_address: 0x808D9000
modules:
- processed/prolog.yaml
+# - processed/layoutDebug.yaml
- processed/fileselect.yaml
- processed/magicplatform.yaml
+ - processed/cutScene.yaml
+ - processed/bonepiece.yaml
- processed/bugfixes.yaml
- processed/worldmap.yaml
# - processed/koopatlas.yaml
@@ -54,5 +57,6 @@ modules:
- processed/makeYourOwn.yaml
- processed/challengeStar.yaml
- processed/singAlong.yaml
+ - processed/pumpkinGoomba.yaml
# - processed/pengi.yaml
# - processed/actorlog.yaml
diff --git a/NewerProjectKP.yaml b/NewerProjectKP.yaml
index 934ea99..2f66e32 100644
--- a/NewerProjectKP.yaml
+++ b/NewerProjectKP.yaml
@@ -2,6 +2,7 @@ output_dir: "NewerASM"
code_address: 0x808D9000
modules:
- processed/prolog.yaml
+# - processed/apDebug.yaml
# - processed/layoutDebug.yaml
- processed/fileselect.yaml
- processed/magicplatform.yaml
diff --git a/apDebug.yaml b/apDebug.yaml
new file mode 100644
index 0000000..25f87fd
--- /dev/null
+++ b/apDebug.yaml
@@ -0,0 +1,9 @@
+---
+source_files: [../src/apDebug.cpp]
+hooks:
+ - name: DrawAPhysics
+ type: branch_insn
+ branch_type: b
+ src_addr_pal: 0x80830BD8
+ target_func: 'APDebugDraw(void)'
+
diff --git a/include/game.h b/include/game.h
index 2dc64a6..7911880 100755
--- a/include/game.h
+++ b/include/game.h
@@ -1253,6 +1253,8 @@ public:
void update();
+ static Physics *globalListHead;
+ static Physics *globalListTail;
// todo: more stuff that might not be relevant atm
};
@@ -1315,6 +1317,9 @@ public:
float xCenter();
// Plus more stuff that isn't needed in the public API, I'm pretty sure.
+
+ static ActivePhysics *globalListHead;
+ static ActivePhysics *globalListTail;
};
@@ -3186,5 +3191,20 @@ extern "C" u32 GetActivePlayerCount();
#include "newer.h"
+class BGGMEffectRenderer : public m3d::proc_c {
+ private:
+ u32 effectGroupID;
+ public:
+ ~BGGMEffectRenderer();
+ void drawOpa();
+ void drawXlu();
+ virtual bool setupEffectRenderer(mAllocator_c *allocator, int opaPrio, int xluPrio, int groupID);
+};
+
+void CleanUpEffectThings();
+bool FreeEffects(int efNum);
+bool FreeBreff(int efNum);
+bool FreeBreft(int efNum);
+
#endif
diff --git a/include/playerAnim.h b/include/playerAnim.h
new file mode 100644
index 0000000..905703f
--- /dev/null
+++ b/include/playerAnim.h
@@ -0,0 +1,182 @@
+#ifndef PLAYERANIM_H
+#define PLAYERANIM_H
+enum PlayerAnim {
+ wait = 0,
+ walk = 1,
+ run = 2,
+ b_dash = 3,
+ b_dash2 = 4,
+ jump = 5,
+ jump2 = 6,
+ jumped = 7,
+ Tjmp_c_1 = 8,
+ Tjmp_c_2 = 9,
+ Tjumped = 10,
+ roll_jump = 11,
+ Tjump2 = 12,
+ mame_jump2 = 13,
+ turn = 14,
+ turned = 15,
+ hipsr = 16,
+ hipat = 17,
+ hiped = 18,
+ hip_to_stoop = 19,
+ stoop = 20,
+ stoop_start = 21,
+ slip = 22,
+ sliped = 23,
+ slip_to_stoop = 24,
+ carry_wait = 25,
+ carry_walk = 26,
+ carry_throw = 27,
+ Rcarry_wait = 28,
+ wsld = 29,
+ fire_at = 30,
+ swim_fire_at = 31,
+ swim_fire_at2 = 32,
+ star_roll = 33,
+ P_swim = 34,
+ swim = 35,
+ swim_wait = 36,
+ swim_throw = 37,
+ swim_walk = 38,
+ swim_standing = 39,
+ paddle_1 = 40,
+ paddle_2 = 41,
+ paddle_carry = 42,
+ tree_start = 43,
+ tree_wait = 44,
+ tree_climb = 45,
+ tree_pose = 46,
+ monkey_start = 47,
+ monkey_wait_r = 48,
+ monkey_wait_l = 49,
+ monkey_r_to_l = 50,
+ monkey_l_to_r = 51,
+ net_wait = 52,
+ net_walk1 = 53,
+ net_walk2 = 54,
+ net_attack = 55,
+ pea_plant = 56,
+ pea_plant_st = 57,
+ pea_plant_wait = 58,
+ wall_wait = 59,
+ wall_walk_l = 60,
+ wall_walk_r = 61,
+ hang_start = 62,
+ hang_up = 63,
+ hang_wait = 64,
+ hang_walk_l = 65,
+ hang_walk_r = 66,
+ w_jump1 = 67,
+ w_jump2 = 68,
+ RTjumped = 69,
+ jump_hang = 70,
+ spin_st = 71,
+ spin_end = 72,
+ spin_low_st = 73,
+ spin_low_ed = 74,
+ spin_jump2 = 75,
+ spin_jump_end = 76,
+ damF = 77,
+ damB = 78,
+ dowF = 79,
+ dowB = 80,
+ firejmp = 81,
+ e_shock = 82,
+ dead = 83,
+ dead_pose = 84,
+ Rtree_start = 85,
+ Rtree_wait = 86,
+ Rtree_pose = 87,
+ goal_jump = 88,
+ goal_jump_ed = 89,
+ goal_puton_capA = 90,
+ goal_puton_capB = 91,
+ goal_puton_capC = 92,
+ PL_Rgoal_puton_cap = 93,
+ P_Rgoal_puton_cap = 94,
+ goal_puton_capF = 95,
+ waitB = 96,
+ eat_out = 97,
+ eat_success = 98,
+ eat_fail = 99,
+ eat_successB = 100,
+ eat_successC = 101,
+ Seat = 102,
+ Seat_out = 103,
+ Seat_success = 104,
+ Seat_fail = 105,
+ Seat_successB = 106,
+ Seat_successC = 107,
+ carryP_start = 108,
+ carryP_wait = 109,
+ carryP_walk = 110,
+ carryP_throw = 111,
+ carryP_waitR = 112,
+ ride_on = 113,
+ Fjump = 114,
+ waitC = 115,
+ set_to_wait = 116,
+ star_rollB = 117,
+ Sjump = 118,
+ Sjump2 = 119,
+ Sjumped = 120,
+ get_down = 121,
+ turnB = 122,
+ turnedB = 123,
+ ice_slipF = 124,
+ ice_slipB = 125,
+ rope_swing = 126,
+ shoot = 127,
+ shoot_slip = 128,
+ shoot_slip_end = 129,
+ low_walk_start = 130,
+ low_walk = 131,
+ swim_pipe = 132,
+ door_walk = 133,
+ PL_spin_jump = 134,
+ waitL = 135,
+ waitR = 136,
+ fire_at2 = 137,
+ blow_up = 138,
+ P_slip = 139,
+ P_slip_jump = 140,
+ P_slip_jump2 = 141,
+ FjumpB = 142,
+ stamp = 143,
+ waitRB = 144,
+ waitLB = 145,
+ waitR3 = 146,
+ waitL3 = 147,
+ boss_key_get = 148,
+ balloon_wait = 149,
+ slope_waitL = 150,
+ slope_waitR = 151,
+ slope_waitL2 = 152,
+ slope_waitR2 = 153,
+ carryP_waitLB = 154,
+ carryP_waitRB = 155,
+ carry_waitL = 156,
+ carry_waitR = 157,
+ spin_jump3 = 158,
+ ride_wait = 159,
+ P_paddle_1 = 160,
+ P_paddle_2 = 161,
+ poseL = 162,
+ poseR = 163,
+ gorl_wait = 164,
+ dm_notice = 165,
+ dm_noti_wait = 166,
+ dm_surprise = 167,
+ dm_surp_wait = 168,
+ wait_select = 169,
+ course_in = 170,
+ waitD = 171,
+ waitE = 172,
+ dm_escort = 173,
+ dm_glad = 174,
+ ending_wait = 175,
+ coin_comp = 176
+};
+#endif /* PLAYERANIM_H */
diff --git a/include/sfx.h b/include/sfx.h
index 61ee664..b84e89c 100644
--- a/include/sfx.h
+++ b/include/sfx.h
@@ -4,6 +4,7 @@
#include <common.h>
enum SFX {
+ SE_NULL = -1,
SE_DEMO_OP_DUMMY_U = 0,
SE_DEMO_OP_JUMP_JR_0954f = 1,
SE_DEMO_OP_LAND_JR_0983f = 2,
@@ -1984,4 +1985,4 @@ enum SFX {
SE_GAKKI_L_2_ON = 1977
};
-#endif \ No newline at end of file
+#endif
diff --git a/kamek_pal.x b/kamek_pal.x
index 169d0b4..5f11ac5 100644
--- a/kamek_pal.x
+++ b/kamek_pal.x
@@ -1,6 +1,16 @@
SECTIONS {
/* Scrolling is annoying, clown car goes here! */
+ StockWMInit_LoadEffects__FPv = 0x80926B10;
+
+ CleanUpEffectThings__Fv = 0x80093520;
+ FreeEffects__Fi = 0x800934D0;
+ FreeBreff__Fi = 0x80093170;
+ FreeBreft__Fi = 0x800931B0;
+
+ __dt__18BGGMEffectRendererFv = 0x80092E30;
+ __vt__18BGGMEffectRenderer = 0x80311908;
+ __construct_array = 0x802DCC90;
m2d__Anm_c__Load = 0x801644F0;
m2d__AnmResHandler_c__Load = 0x80163FA0;
@@ -638,12 +648,15 @@ SECTIONS {
addToList__13ActivePhysicsFv = 0x8008C330;
initWithStruct__13ActivePhysicsFP8dActor_cPCQ213ActivePhysics4Info = 0x8008C3E0;
+ globalListHead__13ActivePhysics = 0x8042A140;
+
__ct__7PhysicsFv = 0x8007F7A0;
__dt__7PhysicsFv = 0x8007F810;
baseSetup__7PhysicsFP8dActor_cPvPvPvUcUc = 0x8007F9B0;
setup__7PhysicsFP8dActor_cffffPvPvPvUcUcP7Point2d = 0x8007FA40;
setup__7PhysicsFP8dActor_cPQ27Physics4InfoUcUcP7Point2d = 0x8007FB10;
+ globalListHead__7Physics = 0x8042A0C0;
spinningPhysicsCallback = 0x808A2380;
/* spinningPhysicsCallback__7Physics = 0x808A2380; */
@@ -1192,6 +1205,7 @@ SECTIONS {
GXSetTexCoordGen2 = 0x801C4910;
GXSetNumTexGens = 0x801C4B60;
GXBegin = 0x801C56B0;
+ GXSetLineWidth = 0x801C58E0;
GXSetCullMode = 0x801C59A0;
GXInitLightAttn = 0x801C6570;
GXInitLightSpot = 0x801C65B0;
diff --git a/koopatlas.yaml b/koopatlas.yaml
index 4c79acf..268ee12 100644
--- a/koopatlas.yaml
+++ b/koopatlas.yaml
@@ -70,3 +70,18 @@ hooks:
addr_pal: 0x80926800
data: '60000000'
+# try to fix effects?
+# - name: WMEffectFixTry
+# type: patch
+# addr_pal: 0x80124DCC
+# data: '2800000D'
+# - name: WMEffectDebug
+# type: branch_insn
+# src_addr_pal: 0x802863AC #Effect::Calc
+# src_addr_pal: 0x8016CB10 #mEf::effect_c::spawnWithName or something
+# src_addr_pal: 0x802858B0 #Effect::Draw
+# src_addr_pal: 0x8016C9CC #DealWithPuttingEffectsOnTheScreen-succeeds with extra RenderEffects
+# src_addr_pal: 0x80286A70
+# branch_type: b
+# target_func: 'UniversalFunctionLog'
+
diff --git a/shyguy.yaml b/shyguy.yaml
index 3f4ec44..c75c690 100644
--- a/shyguy.yaml
+++ b/shyguy.yaml
@@ -10,10 +10,10 @@ hooks:
- name: UpdateShyGuySpriteInfo
type: patch
- addr_pal: 0x8030DA3C #0x8030DA18
+ addr_pal: 0x8030DA1C #0x8030DA18
# [204] ( 16, 48) ( 0, -24 16: 24) 64? 64? 0? 0? | [8:Environment?]
# 00CC 0000 00000010 00000030 00000000 FFFFFFE8 00000010 00000018 0040 0040 0000 0000 0008 0000
- data: '0000 0000'
+ data: '00000010 00000030 00000000 FFFFFFC0 00000010 00000040 0040 0040 0000 0000 0000 0000'
- name: ShyGuySpriteFileInfo
type: add_func_pointer
diff --git a/spritetex.yaml b/spritetex.yaml
index 88d0d55..a15b859 100644
--- a/spritetex.yaml
+++ b/spritetex.yaml
@@ -443,12 +443,28 @@ hooks:
# data: '60000000'
# addr_pal: 0x80A9D054
+ - name: TEX_PokeySnowmanRotA
+ type: patch
+ data: '60000000'
+ addr_pal: 0x80A9F740
+
+ - name: TEX_PokeySnowmanRotB
+ type: patch
+ data: '60000000'
+ addr_pal: 0x80A9F768
+
- name: TEX_PokeySnowmanRotate
type: branch_insn
branch_type: bl
- src_addr_pal: 0x80A9F76C
+ src_addr_pal: 0x80AA0690
target_func: 'TEX_PokeySnowmanRotate'
+ - name: TEX_PokeySnowmanImmuneToIce
+ type: branch_insn
+ branch_type: bl
+ src_addr_pal: 0x80A9D940
+ target_func: 'TEX_PokeySnowmanImmuneToIce'
+
- name: TEX_PokeySnowman
type: branch_insn
@@ -648,11 +664,11 @@ hooks:
src_addr_pal: 0x808BB34C
target_func: 'TobiPukuBypass'
- - name: TEX_TobiPuku
- type: branch_insn
- branch_type: bl
- src_addr_pal: 0x80AB2288
- target_func: 'TEX_TobiPuku'
+ # - name: TEX_TobiPuku
+ # type: branch_insn
+ # branch_type: bl
+ # src_addr_pal: 0x80AB2288
+ # target_func: 'TEX_TobiPuku'
- name: TobiPukuSoundChangeB
type: branch_insn
diff --git a/src/apDebug.cpp b/src/apDebug.cpp
new file mode 100644
index 0000000..f534e58
--- /dev/null
+++ b/src/apDebug.cpp
@@ -0,0 +1,222 @@
+#include <game.h>
+#define GEKKO
+#include "rvl/mtx.h"
+#include "rvl/GXEnum.h"
+#include "rvl/GXStruct.h"
+#include "rvl/GXTransform.h"
+#include "rvl/GXGeometry.h"
+#include "rvl/GXDispList.h"
+#include "rvl/GXLighting.h"
+#include "rvl/GXTev.h"
+#include "rvl/GXTexture.h"
+#include "rvl/GXCull.h"
+#include "rvl/GXPixel.h"
+#include "rvl/GXBump.h"
+#include "rvl/GXVert.h"
+#include "rvl/vifuncs.h"
+
+class APDebugDrawer : public m3d::proc_c {
+ public:
+ APDebugDrawer();
+
+ bool amISetUp;
+ mHeapAllocator_c allocator;
+
+ void setMeUp();
+
+ void drawMe();
+
+ void drawOpa();
+ void drawXlu();
+};
+
+
+static APDebugDrawer defaultInstance;
+
+int APDebugDraw() {
+ defaultInstance.drawMe();
+ return 1;
+}
+
+
+APDebugDrawer::APDebugDrawer() {
+ amISetUp = false;
+}
+
+void APDebugDrawer::setMeUp() {
+ allocator.setup(GameHeaps[0], 0x20);
+ setup(&allocator);
+}
+
+void APDebugDrawer::drawMe() {
+ if (!amISetUp) {
+ setMeUp();
+ amISetUp = true;
+ }
+
+ scheduleForDrawing();
+}
+
+void APDebugDrawer::drawOpa() {
+}
+void APDebugDrawer::drawXlu() {
+ GXClearVtxDesc();
+
+ GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
+ GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
+
+ GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
+ GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
+
+ GXSetNumIndStages(0);
+ for (int i = 0; i < 0x10; i++)
+ GXSetTevDirect((GXTevStageID)i);
+
+ GXSetNumChans(1);
+ GXSetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
+ GXSetChanAmbColor(GX_COLOR0A0, (GXColor){255,255,255,255});
+ GXSetChanMatColor(GX_COLOR0A0, (GXColor){255,255,255,255});
+ GXSetNumTexGens(0);
+
+ GXSetNumTevStages(1);
+ GXSetNumIndStages(0);
+
+ GXSetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);
+
+ GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
+ GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
+// GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C1, GX_CC_C0, GX_CC_RASC, GX_CC_ZERO);
+// GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
+// GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_A0, GX_CA_RASA, GX_CA_ZERO);
+// GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
+
+ GXSetZCompLoc(GX_FALSE);
+ GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET);
+ GXSetZMode(GX_TRUE, GX_LEQUAL, GX_FALSE);
+ GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_GREATER, 0);
+
+ GXSetFog(GX_FOG_NONE, 0, 0, 0, 0, (GXColor){0,0,0,0});
+ GXSetFogRangeAdj(GX_FALSE, 0, 0);
+
+ GXSetCullMode(GX_CULL_NONE);
+
+ GXSetDither(GX_TRUE);
+ GXSetLineWidth(18, GX_TO_ZERO);
+
+ GXSetTevColor(GX_TEVREG0, (GXColor){255,255,255,255});
+ GXSetTevColor(GX_TEVREG1, (GXColor){0,0,0,255});
+
+ ActivePhysics *ap = ActivePhysics::globalListHead;
+
+ while (ap) {
+ u32 uptr = (u32)ap;
+ u8 r = (uptr>>16)&0xFF;
+ u8 g = (uptr>>8)&0xFF;
+ u8 b = uptr&0xFF;
+ u8 a = 0xFF;
+
+ GXBegin(GX_LINES, GX_VTXFMT0, 10);
+
+ float centreX = ap->owner->pos.x + ap->info.xDistToCenter;
+ float centreY = ap->owner->pos.y + ap->info.yDistToCenter;
+ float edgeDistX = ap->info.xDistToEdge;
+ float edgeDistY = ap->info.yDistToEdge;
+
+ float tlX = centreX - edgeDistX, tlY = centreY + edgeDistY;
+ float trX = centreX + edgeDistX, trY = centreY + edgeDistY;
+
+ float blX = centreX - edgeDistX, blY = centreY - edgeDistY;
+ float brX = centreX + edgeDistX, brY = centreY - edgeDistY;
+
+ // Top
+ GXPosition3f32(tlX, tlY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+ GXPosition3f32(trX, trY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+
+ // Left
+ GXPosition3f32(tlX, tlY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+ GXPosition3f32(blX, blY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+
+ // Right
+ GXPosition3f32(trX, trY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+ GXPosition3f32(brX, brY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+
+ // Bottom
+ GXPosition3f32(blX, blY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+ GXPosition3f32(brX, brY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+
+ // Diagonal
+ GXPosition3f32(trX, trY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+ GXPosition3f32(blX, blY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+
+ GXEnd();
+
+ ap = ap->listPrev;
+ }
+
+ Physics *p = Physics::globalListHead;
+
+ while (p) {
+ u32 uptr = (u32)p;
+ u8 r = (uptr>>16)&0xFF;
+ u8 g = (uptr>>8)&0xFF;
+ u8 b = uptr&0xFF;
+ u8 a = 0xFF;
+
+ GXBegin(GX_LINES, GX_VTXFMT0, 10);
+
+ float centreX = p->owner->pos.x;
+ float centreY = p->owner->pos.y;
+ float edgeDistX = p->_88;
+ float edgeDistY = p->_8C;
+
+ float tlX = centreX + p->x, tlY = centreY + p->y;
+ float trX = centreX + p->_88, trY = centreY + p->y;
+
+ float blX = centreX + p->x, blY = centreY + p->_8C;
+ float brX = centreX + p->_88, brY = centreY + p->_8C;
+
+ // Top
+ GXPosition3f32(tlX, tlY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+ GXPosition3f32(trX, trY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+
+ // Left
+ GXPosition3f32(tlX, tlY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+ GXPosition3f32(blX, blY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+
+ // Right
+ GXPosition3f32(trX, trY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+ GXPosition3f32(brX, brY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+
+ // Bottom
+ GXPosition3f32(blX, blY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+ GXPosition3f32(brX, brY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+
+ // Diagonal
+ GXPosition3f32(trX, trY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+ GXPosition3f32(blX, blY, 8000.0f);
+ GXColor4u8(r,g,b,a);
+
+ GXEnd();
+
+ p = p->next;
+ }
+}
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index 164ea89..c20d715 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -46,6 +46,7 @@ dScKoopatlas_c *dScKoopatlas_c::build() {
}
bool WMInit_StartLoading(void*);
+bool StockWMInit_LoadEffects(void*);
bool WMInit_LoadSIAnims(void*);
bool WMInit_EndLoading(void*);
bool WMInit_LoadResources1(void*);
@@ -56,6 +57,7 @@ bool WMInit_SetupWipe(void*);
ChainedFunc initFunctions[] = {
WMInit_StartLoading,
+ StockWMInit_LoadEffects,
WMInit_LoadSIAnims,
WMInit_EndLoading,
WMInit_LoadResources1,
@@ -409,6 +411,11 @@ int dScKoopatlas_c::onDelete() {
FreeScene(0);
FreeScene(1);
+ CleanUpEffectThings();
+ FreeEffects(1);
+ FreeBreff(1);
+ FreeBreft(1);
+
DVD_FreeFile(GetDVDClass2(), "SI_kinoko");
DVD_FreeFile(GetDVDClass2(), "SI_fireflower");
DVD_FreeFile(GetDVDClass2(), "SI_iceflower");
@@ -419,6 +426,8 @@ int dScKoopatlas_c::onDelete() {
levelInfoLoader.unload();
mapListLoader.unload();
+ CleanUpEffectThings();
+
return true;
}
diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h
index 2a69927..41fba45 100644
--- a/src/koopatlas/core.h
+++ b/src/koopatlas/core.h
@@ -18,7 +18,7 @@
#include "koopatlas/pathmanager.h"
#define WM_DEBUGGING
-// #define WM_SPAMMY_DEBUGGING
+#define WM_SPAMMY_DEBUGGING
#ifdef WM_DEBUGGING
#define MapReport OSReport
diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp
index 316c001..ff28e19 100644
--- a/src/koopatlas/map.cpp
+++ b/src/koopatlas/map.cpp
@@ -62,6 +62,12 @@ int dWMMap_c::onCreate() {
bgSrtAnm.bindEntry(&bgModel, anmRes, 0, 0);
bgModel.bindAnim(&bgSrtAnm, 0.0f);
+ static int EffectGroups[] = {1,0,4,5,7,8,9,10,11,12,13,14};
+ static int EffectPrios[] = {141,142,143,129,144,145,146,147,148,149,150,151};
+ for (int i = 0; i < EFFECT_RENDERER_COUNT; i++) {
+ effectRenderers[i].setupEffectRenderer(&allocator, -1, EffectPrios[i], EffectGroups[i]);
+ }
+
allocator.unlink();
return true;
@@ -83,6 +89,10 @@ int dWMMap_c::onDraw() {
renderer.scheduleForDrawing();
bgModel.scheduleForDrawing();
+ for (int i = 0; i < EFFECT_RENDERER_COUNT; i++) {
+ effectRenderers[i].scheduleForDrawing();
+ }
+
dKPMapData_c *dataCls = &dScKoopatlas_c::instance->mapData;
renderPathLayer(dataCls->pathLayer);
diff --git a/src/koopatlas/map.h b/src/koopatlas/map.h
index 8d3e2ae..82bee1f 100644
--- a/src/koopatlas/map.h
+++ b/src/koopatlas/map.h
@@ -58,6 +58,8 @@ class dWMMap_c : public dBase_c {
};
renderer_c renderer;
+ enum EffRenderCount { EFFECT_RENDERER_COUNT = 12 };
+ BGGMEffectRenderer effectRenderers[EFFECT_RENDERER_COUNT];
mHeapAllocator_c allocator;
m3d::mdl_c bgModel;
diff --git a/src/koopatlas/mapdata.h b/src/koopatlas/mapdata.h
index 70c31ee..bc0c599 100644
--- a/src/koopatlas/mapdata.h
+++ b/src/koopatlas/mapdata.h
@@ -112,6 +112,15 @@ struct dKPPath_s {
ALWAYS_AVAILABLE = 3
};
+ enum Animation {
+ WALK = 0, WALK_SAND = 1, WALK_SNOW = 2, WALK_WATER = 3,
+ JUMP = 4, JUMP_SAND = 5, JUMP_SNOW = 6, JUMP_WATER = 7,
+ LADDER = 8, LADDER_LEFT = 9, LADDER_RIGHT = 10, FALL = 11,
+ SWIM = 12, RUN = 13, PIPE = 14, DOOR = 15,
+ TJUMPED = 16, ENTER_CAVE_UP = 17, RESERVED_18 = 18, INVISIBLE = 19,
+ MAX_ANIM = 20
+ };
+
dKPNode_s *start, *end;
dKPLayer_s *tileLayer, *doodadLayer;
@@ -119,7 +128,7 @@ struct dKPPath_s {
u8 isSecret;
u8 _padding[2];
float speed;
- int animation;
+ Animation animation;
void setLayerAlpha(u8 alpha);
};
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 9525732..e42246e 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -7,6 +7,7 @@
void dWMPathManager_c::setup() {
isMoving = false;
isJumping = false;
+ scaleAnimProgress = -1;
timer = 0.0;
currentPath = 0;
reverseThroughPath = false;
@@ -20,6 +21,7 @@ void dWMPathManager_c::setup() {
SpammyReport("Unlocking paths\n");
isEnteringLevel = false;
+ levelStartWait = -1;
unlockPaths();
SpammyReport("done\n");
@@ -61,7 +63,7 @@ void dWMPathManager_c::setup() {
//OSReport("Path: %p nodes %p to %p\n", path, srcNode, destNode);
int ct = destNode->getAvailableExitCount();
//OSReport("Dest Node available exits: %d; type: %d\n", ct, destNode->type);
- if (destNode == node || ct > 2 || destNode->type == dKPNode_s::LEVEL) {
+ if (destNode == node || ct > 2 || destNode->type == dKPNode_s::LEVEL || destNode->type == dKPNode_s::CHANGE) {
exitTo = candidateExit;
//OSReport("Accepting this node\n");
break;
@@ -151,36 +153,36 @@ void dWMPathManager_c::unlockPaths() {
int cmdID = 0;
while (*in != 0) {
- SpammyReport("[%p] Cmd %d: Evaluating condition\n", in, cmdID);
+ UnlockCmdReport("[%p] Cmd %d: Evaluating condition\n", in, cmdID);
// begin processing a block
bool value = evaluateUnlockCondition(in, save, 0);
- SpammyReport("[%p] Cmd %d: Condition evaluated, result: %d\n", in, cmdID, value);
- //SpammyReport("Unlock condition: %d\n", value);
+ UnlockCmdReport("[%p] Cmd %d: Condition evaluated, result: %d\n", in, cmdID, value);
+ //UnlockCmdReport("Unlock condition: %d\n", value);
// get what it's supposed to affect
// for now we'll assume that it affects one or more paths
u8 affectedCount = *(in++);
- SpammyReport("[%p] Cmd %d: Affects %d path(s)\n", in, cmdID, affectedCount);
+ UnlockCmdReport("[%p] Cmd %d: Affects %d path(s)\n", in, cmdID, affectedCount);
for (int i = 0; i < affectedCount; i++) {
u8 one = *(in++);
u8 two = *(in++);
u16 pathID = (one << 8) | two;
- SpammyReport("[%p] Cmd %d: Affected %d: PathID: %d\n", in, cmdID, i, pathID);
+ UnlockCmdReport("[%p] Cmd %d: Affected %d: PathID: %d\n", in, cmdID, i, pathID);
dKPPath_s *path = pathLayer->paths[pathID];
- SpammyReport("[%p] Cmd %d: Affected %d: Path: %p\n", in, cmdID, i, path);
+ UnlockCmdReport("[%p] Cmd %d: Affected %d: Path: %p\n", in, cmdID, i, path);
path->isAvailable = value ? dKPPath_s::AVAILABLE : dKPPath_s::NOT_AVAILABLE;
- SpammyReport("[%p] Cmd %d: Affected %d: IsAvailable written\n", in, cmdID, i);
+ UnlockCmdReport("[%p] Cmd %d: Affected %d: IsAvailable written\n", in, cmdID, i);
PathAvailabilityData[pathID] = value ? dKPPath_s::AVAILABLE : dKPPath_s::NOT_AVAILABLE;
- SpammyReport("[%p] Cmd %d: Affected %d: AvailabilityData written\n", in, cmdID, i);
+ UnlockCmdReport("[%p] Cmd %d: Affected %d: AvailabilityData written\n", in, cmdID, i);
// NEWLY_AVAILABLE is set later, when that stuff is figured out
path->setLayerAlpha(value ? 255 : 0);
- SpammyReport("[%p] Cmd %d: Affected %d: Layer alpha applied\n", in, cmdID, i);
+ UnlockCmdReport("[%p] Cmd %d: Affected %d: Layer alpha applied\n", in, cmdID, i);
}
- SpammyReport("[%p] Cmd %d: %d affected path(s) processed\n", in, cmdID, affectedCount);
+ UnlockCmdReport("[%p] Cmd %d: %d affected path(s) processed\n", in, cmdID, affectedCount);
cmdID++;
}
@@ -230,14 +232,14 @@ void dWMPathManager_c::unlockPaths() {
}
bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int stack) {
- SpammyReport("[%p] CondStk:%d begin\n", in, stack);
+ UnlockCmdReport("[%p] CondStk:%d begin\n", in, stack);
u8 controlByte = *(in++);
u8 conditionType = (controlByte >> 6);
- SpammyReport("[%p] CondStk:%d control byte: %d; condition type: %d\n", in, stack, controlByte, conditionType);
+ UnlockCmdReport("[%p] CondStk:%d control byte: %d; condition type: %d\n", in, stack, controlByte, conditionType);
if (conditionType == 0) {
- SpammyReport("[%p] CondStk:%d end, returning CONSTANT 1\n", in, stack);
+ UnlockCmdReport("[%p] CondStk:%d end, returning CONSTANT 1\n", in, stack);
return true;
}
@@ -247,10 +249,10 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta
bool isSecret = (controlByte & 0x10);
u8 worldNumber = controlByte & 0xF;
u8 levelNumber = *(in++);
- SpammyReport("[%p] CondStk:%d level, w:%d l:%d secret:%d\n", in, stack, worldNumber, levelNumber, isSecret);
+ UnlockCmdReport("[%p] CondStk:%d level, w:%d l:%d secret:%d\n", in, stack, worldNumber, levelNumber, isSecret);
u32 conds = save->GetLevelCondition(worldNumber, levelNumber);
- SpammyReport("[%p] CondStk:%d returning for level conditions: %d / %x\n", in, stack, conds, conds);
+ UnlockCmdReport("[%p] CondStk:%d returning for level conditions: %d / %x\n", in, stack, conds, conds);
if (isSecret)
return (conds & COND_SECRET) != 0;
@@ -265,7 +267,7 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta
bool value = isOr ? false : true;
u8 termCount = (controlByte & 0x3F) + 1;
- SpammyReport("[%p] CondStk:%d and:%d or:%d startValue:%d termCount:%d\n", in, stack, isAnd, isOr, value, termCount);
+ UnlockCmdReport("[%p] CondStk:%d and:%d or:%d startValue:%d termCount:%d\n", in, stack, isAnd, isOr, value, termCount);
for (int i = 0; i < termCount; i++) {
bool what = evaluateUnlockCondition(in, save, stack+1);
@@ -276,27 +278,20 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta
value &= what;
}
- SpammyReport("[%p] CondStk:%d end, returning %d\n", in, stack, value);
+ UnlockCmdReport("[%p] CondStk:%d end, returning %d\n", in, stack, value);
return value;
}
void dWMPathManager_c::execute() {
- int nowPressed = Remocon_GetPressed(GetActiveRemocon());
-
- if (isMoving) {
- moveThroughPath();
- } else {
- if (nowPressed & WPAD_LEFT && canUseExit(currentNode->leftExit))
- startMovementTo(currentNode->leftExit);
- else if (nowPressed & WPAD_RIGHT && canUseExit(currentNode->rightExit))
- startMovementTo(currentNode->rightExit);
- else if (nowPressed & WPAD_UP && canUseExit(currentNode->upExit))
- startMovementTo(currentNode->upExit);
- else if (nowPressed & WPAD_DOWN && canUseExit(currentNode->downExit))
- startMovementTo(currentNode->downExit);
- else if (nowPressed & WPAD_TWO)
- activatePoint();
+ if (isEnteringLevel) {
+ if (levelStartWait > 0) {
+ levelStartWait--;
+ if (levelStartWait == 0) {
+ dScKoopatlas_c::instance->startLevel(enteredLevel);
+ }
+ }
+ return;
}
// handle path fading
@@ -305,6 +300,8 @@ void dWMPathManager_c::execute() {
if (countdownToFadeIn <= 0) {
unlockingAlpha = 0;
MapSoundPlayer(SoundRelatedClass, SE_SYS_NEW_POINT, 1);
+ } else {
+ return;
}
}
@@ -329,13 +326,46 @@ void dWMPathManager_c::execute() {
// we've reached the end
unlockingAlpha = -1;
MapSoundPlayer(SoundRelatedClass, SE_SYS_NEW_POINT_END, 1);
+ waitAfterUnlock = 15;
+ }
+
+ return;
+ }
+
+ if (waitAfterUnlock > 0) {
+ waitAfterUnlock--;
+ return;
+ }
+
+ int nowPressed = Remocon_GetPressed(GetActiveRemocon());
+
+ if (isMoving) {
+ moveThroughPath();
+ } else {
+ // Left, right, up, down
+ int pressedDir = -1;
+ if (nowPressed & WPAD_LEFT) pressedDir = 0;
+ else if (nowPressed & WPAD_RIGHT) pressedDir = 1;
+ else if (nowPressed & WPAD_UP) pressedDir = 2;
+ else if (nowPressed & WPAD_DOWN) pressedDir = 3;
+ else if (nowPressed & WPAD_TWO)
+ activatePoint();
+
+ if (pressedDir >= 0) {
+ if (canUseExit(currentNode->exits[pressedDir])) {
+ startMovementTo(currentNode->exits[pressedDir]);
+ } else {
+ // TODO: maybe remove this? got to see how it looks
+ static u16 directions[] = {-0x4000,0x4000,-0x7FFF,0};
+ daWMPlayer_c::instance->rot.y = directions[pressedDir];
+ }
}
}
}
void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
- SpammyReport("moving to path %p\n", path);
+ SpammyReport("moving to path %p [%d,%d to %d,%d]\n", path, path->start->x, path->start->y, path->end->x, path->end->y);
if (!path->isAvailable) { return; }
if (currentNode)
@@ -375,131 +405,94 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
// hang_walk_l = 65,
// hang_walk_r = 66,
- SpammyReport("h\n");
- player->rot.y = direction;
- player->hasSound = false;
- player->hasEffect = false;
- moveSpeed = 3.0f;
-
- switch (path->animation) {
-
- // Running
- case 0:
- player->startAnimation(run, 2.0, 10.0, 0.0);
- player->hasSound = true;
- player->soundName = SE_PLY_FOOTNOTE_DIRT;
- break;
- case 1:
- player->startAnimation(run, 2.0, 10.0, 0.0);
- player->hasSound = true;
- player->hasEffect = true;
- player->soundName = SE_PLY_FOOTNOTE_CS_SAND;
- player->effectName = "Wm_mr_foot_sand";
- break;
- case 2:
- player->startAnimation(run, 2.0, 10.0, 0.0);
- player->hasSound = true;
- player->hasEffect = true;
- player->soundName = SE_PLY_FOOTNOTE_CS_SNOW;
- player->effectName = "Wm_mr_foot_snow";
- break;
- case 3:
- player->startAnimation(run, 2.0, 10.0, 0.0);
- player->hasSound = true;
- player->hasEffect = true;
- player->soundName = SE_PLY_FOOTNOTE_CS_WATER;
- player->effectName = "Wm_mr_foot_water";
- break;
+ static const struct {
+ PlayerAnim anim;
+ float animParam1, animParam2;
+ s16 forceRotation;
+ float forceSpeed;
+ SFX repeatSound, initialSound;
+ const char *repeatEffect, *initialEffect;
+ } Animations[] = {
+ // Walking
+ {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_DIRT,SE_NULL, 0,0},
+ {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_CS_SAND,SE_NULL, "Wm_mr_foot_sand",0},
+ {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_CS_SNOW,SE_NULL, "Wm_mr_foot_snow",0},
+ {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_CS_WATER,SE_NULL, "Wm_mr_foot_water",0},
// Jumping
- case 4:
- player->startAnimation(jump, 1.0, 1.0, 0.0);
- MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
- isJumping = true;
- moveSpeed = 2.5f;
- break;
- case 5:
- player->startAnimation(jump, 1.0, 10.0, 0.0);
- MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
- isJumping = true;
- moveSpeed = 2.5f;
- break;
- case 6:
- player->startAnimation(jump, 1.0, 10.0, 0.0);
- MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
- isJumping = true;
- moveSpeed = 2.5f;
- break;
- case 7:
- player->startAnimation(jump, 1.0, 10.0, 0.0);
- MapSoundPlayer(SoundRelatedClass, SE_PLY_JUMP, 1);
- isJumping = true;
- SpawnEffect("Wm_mr_waterwave_out", 0, &player->pos, 0, &player->scale);
- moveSpeed = 2.0f;
- break;
-
- // Climbing
- case 8:
- player->startAnimation(pea_plant, 1.2, 10.0, 0.0);
- player->rot.y = 0x8000;
- player->hasSound = true;
- player->soundName = SE_PLY_FOOTNOTE_CS_ROCK_CLIMB;
- moveSpeed = 1.5f;
- break;
- case 9:
- player->startAnimation(tree_climb, 1.2, 10.0, 0.0);
- player->rot.y = 0xC000;
- player->hasSound = true;
- player->soundName = SE_PLY_FOOTNOTE_CS_ROCK_CLIMB;
- moveSpeed = 1.5f;
- break;
- case 10:
- player->startAnimation(tree_climb, 1.2, 10.0, 0.0);
- player->rot.y = 0x4000;
- player->hasSound = true;
- player->soundName = SE_PLY_FOOTNOTE_CS_ROCK_CLIMB;
- moveSpeed = 1.5f;
- break;
-
- // Others
- case 12:
- player->startAnimation(swim_wait, 1.2, 10.0, 0.0);
- player->hasSound = true;
- player->hasEffect = true;
- player->soundName = SE_PLY_SWIM;
- player->effectName = "Wm_mr_waterswim";
- moveSpeed = 2.0f;
- break;
- case 13:
- player->startAnimation(b_dash2, 3.0, 10.0, 0.0);
- player->hasSound = true;
- player->soundName = SE_PLY_FOOTNOTE_DIRT;
- moveSpeed = 5.0f;
- break;
- case 14:
- player->startAnimation(wait, 2.0, 10.0, 0.0);
- player->rot.y = 0x0000;
- MapSoundPlayer(SoundRelatedClass, SE_PLY_DOKAN_IN_OUT, 1);
- moveSpeed = 1.0f;
- break;
- case 15:
- player->startAnimation(wait, 2.0, 10.0, 0.0);
- player->rot.y = 0x8000;
- MapSoundPlayer(SoundRelatedClass, SE_OBJ_DOOR_OPEN, 1);
- moveSpeed = 0.2f;
- break;
- case 16:
- player->startAnimation(Tjumped, 2.0, 0.0, 0.0);
- break;
- default:
- SpammyReport("No animtaion?!");
- player->startAnimation(run, 2.0, 10.0, 0.0);
- player->hasSound = true;
- player->soundName = SE_PLY_FOOTNOTE_DIRT;
- break;
+ {jump,1.0f,1.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,0},
+ {jump,1.0f,10.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,0},
+ {jump,1.0f,10.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,0},
+ {jump,1.0f,10.0f, -1,2.5f, SE_NULL,SE_PLY_JUMP, 0,"Wm_mr_waterwave_out"},
+
+ // Ladder up, left, right
+ {pea_plant,1.2f,10.0f, -0x7FFF,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0},
+ {tree_climb,1.2f,10.0f, -0x4000,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0},
+ {tree_climb,1.2f,10.0f, 0x4000,1.5f, SE_PLY_FOOTNOTE_CS_ROCK_CLIMB,SE_NULL, 0,0},
+ // Fall (default?)
+ {run,2.0f,10.0f, -1,-1.0f, SE_PLY_FOOTNOTE_DIRT,SE_NULL, 0,0},
+
+ // Swim
+ {swim_wait,1.2f,10.0f, -1,2.0f, SE_PLY_SWIM,SE_NULL, "Wm_mr_waterswim",0},
+ // Run
+ {b_dash2,3.0f,10.0f, -1,5.0f, SE_PLY_FOOTNOTE_DIRT,SE_NULL, 0,0},
+ // Pipe
+ {wait,2.0f,10.0f, 0,1.0f, SE_NULL,SE_PLY_DOKAN_IN_OUT, 0,0},
+ // Door
+ {wait,2.0f,10.0f, -0x7FFF,0.2f, SE_NULL,SE_OBJ_DOOR_OPEN, 0,0},
+
+ // TJumped
+ {Tjumped,2.0f,0.0f, -1,-1.0f, SE_NULL,SE_NULL, 0,0},
+
+ // Enter cave, this is handled specially
+ {run,1.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0},
+ {run,1.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0},
+
+ // Invisible, this is handled specially
+ {wait,2.0f,10.0f, -1,1.0f, SE_NULL,SE_NULL, 0,0},
+ };
+
+ isJumping = (path->animation >= dKPPath_s::JUMP && path->animation <= dKPPath_s::JUMP_WATER);
+
+ float playerScale = 1.6f;
+
+ if (path->animation == dKPPath_s::ENTER_CAVE_UP) {
+ scaleAnimProgress = 60;
+ // what direction does this path go in?
+ isScalingUp = (deltaY < 0) ^ reverseThroughPath;
+
+ if (!isScalingUp)
+ playerScale = 0.0f;
}
-
- SpammyReport("i\n");
+
+ player->visible = (path->animation != dKPPath_s::INVISIBLE);
+ player->scale.x = player->scale.y = player->scale.z = playerScale;
+
+ int id = (path->animation >= dKPPath_s::MAX_ANIM) ? 0 : (int)path->animation;
+
+ player->startAnimation(Animations[id].anim, Animations[id].animParam1, Animations[id].animParam2, 0.0f);
+
+ player->rot.y = (Animations[id].forceRotation != -1) ? Animations[id].forceRotation : direction;
+ moveSpeed = (Animations[id].forceSpeed >= 0.0f) ? Animations[id].forceSpeed : 3.0f;
+
+ if (Animations[id].repeatEffect) {
+ player->hasEffect = true;
+ player->effectName = Animations[id].repeatEffect;
+ } else {
+ player->hasEffect = false;
+ }
+
+ if (Animations[id].repeatSound != SE_NULL) {
+ player->hasSound = true;
+ player->soundName = Animations[id].repeatSound;
+ } else {
+ player->hasSound = false;
+ }
+
+ if (Animations[id].initialEffect)
+ SpawnEffect(Animations[id].initialEffect, 0, &player->pos, 0, &player->scale);
+ if (Animations[id].initialSound != SE_NULL)
+ MapSoundPlayer(SoundRelatedClass, Animations[id].initialSound, 1);
}
void dWMPathManager_c::moveThroughPath() {
@@ -508,12 +501,22 @@ void dWMPathManager_c::moveThroughPath() {
from = reverseThroughPath ? currentPath->end : currentPath->start;
to = reverseThroughPath ? currentPath->start : currentPath->end;
+ daWMPlayer_c *player = daWMPlayer_c::instance;
+
+
+ if (scaleAnimProgress >= 0) {
+ float soFar = scaleAnimProgress * (1.6f / 60.0f);
+ float sc = isScalingUp ? soFar : (1.6f - soFar);
+ player->scale.x = player->scale.y = player->scale.z = sc;
+
+ scaleAnimProgress--;
+ }
+
+
Vec move = (Vec){to->x - from->x, to->y - from->y, 0};
VECNormalize(&move, &move);
VECScale(&move, &move, moveSpeed);
- daWMPlayer_c *player = daWMPlayer_c::instance;
-
if (isJumping) {
float ys = (float)from->y;
float ye = (float)to->y;
@@ -550,8 +553,10 @@ void dWMPathManager_c::moveThroughPath() {
// Check if we've reached the end yet
if (
- ((move.x > 0) ? (player->pos.x >= to->x) : (player->pos.x <= to->x)) &&
- ((move.y > 0) ? (-player->pos.y >= to->y) : (-player->pos.y <= to->y))
+ (((move.x > 0) ? (player->pos.x >= to->x) : (player->pos.x <= to->x)) &&
+ ((move.y > 0) ? (-player->pos.y >= to->y) : (-player->pos.y <= to->y)))
+ ||
+ (from->x == to->x && from->y == to->y)
) {
currentNode = to;
@@ -603,6 +608,7 @@ void dWMPathManager_c::moveThroughPath() {
SpammyReport("Change to map ID %d (%s), entrance ID %d\n", save->current_world, to->destMap, to->foreignID);
+ ActivateWipe(to->transition);
DoSceneChange(WORLD_MAP, 0x10000000 | (to->foreignID << 20), 0);
} else if (reallyStop) {
@@ -634,6 +640,9 @@ void dWMPathManager_c::moveThroughPath() {
}
void dWMPathManager_c::activatePoint() {
+ if (levelStartWait >= 0)
+ return;
+
if (currentNode->type == dKPNode_s::LEVEL) {
int w = currentNode->levelNumber[0] - 1;
int l = currentNode->levelNumber[1] - 1;
@@ -657,11 +666,11 @@ void dWMPathManager_c::activatePoint() {
MapSoundPlayer(SoundRelatedClass, SE_SYS_GAME_START, 1);
daWMPlayer_c::instance->startAnimation(170, 1.2, 10.0, 0.0);
+ daWMPlayer_c::instance->rot.y = 0;
isEnteringLevel = true;
-
- dLevelInfo_c::entry_s *level = dScKoopatlas_c::instance->levelInfo.search(w, l);
- dScKoopatlas_c::instance->startLevel(level);
+ levelStartWait = 40;
+ enteredLevel = dScKoopatlas_c::instance->levelInfo.search(w, l);
}
}
diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h
index cae96ba..5579f66 100644
--- a/src/koopatlas/pathmanager.h
+++ b/src/koopatlas/pathmanager.h
@@ -1,6 +1,13 @@
#ifndef __KOOPATLAS_PATH_MANAGER_H
#define __KOOPATLAS_PATH_MANAGER_H
+//#define WM_UNLOCK_DEBUGGING
+#ifdef WM_UNLOCK_DEBUGGING
+#define UnlockCmdReport OSReport
+#else
+#define UnlockCmdReport(...)
+#endif
+
#include "koopatlas/mapdata.h"
extern "C" void *SoundRelatedClass;
@@ -35,6 +42,9 @@ class dWMPathManager_c {
bool isJumping;
float moveSpeed;
+ int scaleAnimProgress;
+ bool isScalingUp;
+
dKPPath_s *currentPath;
bool reverseThroughPath; // direction we are going through the path
@@ -45,6 +55,7 @@ class dWMPathManager_c {
int unlockingAlpha; // -1 if not used
int countdownToFadeIn;
+ int waitAfterUnlock;
private:
void unlockPaths();
@@ -53,6 +64,8 @@ class dWMPathManager_c {
bool isEnteringLevel;
bool calledEnteredNode;
+ int levelStartWait;
+ dLevelInfo_c::entry_s *enteredLevel;
};
#endif
diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp
index ebd0124..3f791b6 100644
--- a/src/koopatlas/player.cpp
+++ b/src/koopatlas/player.cpp
@@ -48,8 +48,9 @@ int daWMPlayer_c::onExecute() {
this->modelHandler->setSRT(modifiedPos, this->rot, this->scale);
if (hasEffect) {
- Vec effPos = {pos.x, pos.y, -1000.0};
- effect.spawn(effectName, 0, &effPos, &rot, &scale); }
+ Vec effPos = {pos.x, pos.y, 3300.0f};
+ effect.spawn(effectName, 0, &effPos, &rot, &scale);
+ }
if (hasSound) {
timer++;
@@ -67,6 +68,9 @@ int daWMPlayer_c::onExecute() {
}
int daWMPlayer_c::onDraw() {
+ if (!visible)
+ return true;
+
this->modelHandler->draw();
hammerSuit.draw();
diff --git a/src/koopatlas/player.h b/src/koopatlas/player.h
index 6fbbf5a..d553afb 100644
--- a/src/koopatlas/player.h
+++ b/src/koopatlas/player.h
@@ -3,186 +3,7 @@
#include "koopatlas/core.h"
#include "poweruphax.h"
-
-enum PlayerAnim {
- wait = 0,
- walk = 1,
- run = 2,
- b_dash = 3,
- b_dash2 = 4,
- jump = 5,
- jump2 = 6,
- jumped = 7,
- Tjmp_c_1 = 8,
- Tjmp_c_2 = 9,
- Tjumped = 10,
- roll_jump = 11,
- Tjump2 = 12,
- mame_jump2 = 13,
- turn = 14,
- turned = 15,
- hipsr = 16,
- hipat = 17,
- hiped = 18,
- hip_to_stoop = 19,
- stoop = 20,
- stoop_start = 21,
- slip = 22,
- sliped = 23,
- slip_to_stoop = 24,
- carry_wait = 25,
- carry_walk = 26,
- carry_throw = 27,
- Rcarry_wait = 28,
- wsld = 29,
- fire_at = 30,
- swim_fire_at = 31,
- swim_fire_at2 = 32,
- star_roll = 33,
- P_swim = 34,
- swim = 35,
- swim_wait = 36,
- swim_throw = 37,
- swim_walk = 38,
- swim_standing = 39,
- paddle_1 = 40,
- paddle_2 = 41,
- paddle_carry = 42,
- tree_start = 43,
- tree_wait = 44,
- tree_climb = 45,
- tree_pose = 46,
- monkey_start = 47,
- monkey_wait_r = 48,
- monkey_wait_l = 49,
- monkey_r_to_l = 50,
- monkey_l_to_r = 51,
- net_wait = 52,
- net_walk1 = 53,
- net_walk2 = 54,
- net_attack = 55,
- pea_plant = 56,
- pea_plant_st = 57,
- pea_plant_wait = 58,
- wall_wait = 59,
- wall_walk_l = 60,
- wall_walk_r = 61,
- hang_start = 62,
- hang_up = 63,
- hang_wait = 64,
- hang_walk_l = 65,
- hang_walk_r = 66,
- w_jump1 = 67,
- w_jump2 = 68,
- RTjumped = 69,
- jump_hang = 70,
- spin_st = 71,
- spin_end = 72,
- spin_low_st = 73,
- spin_low_ed = 74,
- spin_jump2 = 75,
- spin_jump_end = 76,
- damF = 77,
- damB = 78,
- dowF = 79,
- dowB = 80,
- firejmp = 81,
- e_shock = 82,
- dead = 83,
- dead_pose = 84,
- Rtree_start = 85,
- Rtree_wait = 86,
- Rtree_pose = 87,
- goal_jump = 88,
- goal_jump_ed = 89,
- goal_puton_capA = 90,
- goal_puton_capB = 91,
- goal_puton_capC = 92,
- PL_Rgoal_puton_cap = 93,
- P_Rgoal_puton_cap = 94,
- goal_puton_capF = 95,
- waitB = 96,
- eat_out = 97,
- eat_success = 98,
- eat_fail = 99,
- eat_successB = 100,
- eat_successC = 101,
- Seat = 102,
- Seat_out = 103,
- Seat_success = 104,
- Seat_fail = 105,
- Seat_successB = 106,
- Seat_successC = 107,
- carryP_start = 108,
- carryP_wait = 109,
- carryP_walk = 110,
- carryP_throw = 111,
- carryP_waitR = 112,
- ride_on = 113,
- Fjump = 114,
- waitC = 115,
- set_to_wait = 116,
- star_rollB = 117,
- Sjump = 118,
- Sjump2 = 119,
- Sjumped = 120,
- get_down = 121,
- turnB = 122,
- turnedB = 123,
- ice_slipF = 124,
- ice_slipB = 125,
- rope_swing = 126,
- shoot = 127,
- shoot_slip = 128,
- shoot_slip_end = 129,
- low_walk_start = 130,
- low_walk = 131,
- swim_pipe = 132,
- door_walk = 133,
- PL_spin_jump = 134,
- waitL = 135,
- waitR = 136,
- fire_at2 = 137,
- blow_up = 138,
- P_slip = 139,
- P_slip_jump = 140,
- P_slip_jump2 = 141,
- FjumpB = 142,
- stamp = 143,
- waitRB = 144,
- waitLB = 145,
- waitR3 = 146,
- waitL3 = 147,
- boss_key_get = 148,
- balloon_wait = 149,
- slope_waitL = 150,
- slope_waitR = 151,
- slope_waitL2 = 152,
- slope_waitR2 = 153,
- carryP_waitLB = 154,
- carryP_waitRB = 155,
- carry_waitL = 156,
- carry_waitR = 157,
- spin_jump3 = 158,
- ride_wait = 159,
- P_paddle_1 = 160,
- P_paddle_2 = 161,
- poseL = 162,
- poseR = 163,
- gorl_wait = 164,
- dm_notice = 165,
- dm_noti_wait = 166,
- dm_surprise = 167,
- dm_surp_wait = 168,
- wait_select = 169,
- course_in = 170,
- waitD = 171,
- waitE = 172,
- dm_escort = 173,
- dm_glad = 174,
- ending_wait = 175,
- coin_comp = 176
-};
+#include <playeranim.h>
class daWMPlayer_c : public dActor_c {
diff --git a/src/randomcrap.S b/src/randomcrap.S
index 808009b..36bbde7 100644
--- a/src/randomcrap.S
+++ b/src/randomcrap.S
@@ -6,3 +6,47 @@ HeapChangeAttempt:
lwz 4, 0(4)
blr
+
+.extern OSReport
+.global UniversalFunctionLog
+UniversalFunctionLog:
+ stwu r1, -0x10(r1)
+ stw r0, 0x14(r1)
+ stw r31, 0xC(r1)
+ stw r30, 0x8(r1)
+ mr r31, r3
+ mr r30, r4
+
+ crclr 4*cr1+eq
+ mr r4, r31
+ #Loop through callstack, kind of
+ lwz r3, 0(r1)
+ lwz r5, 4(r3)
+ lwz r3, 0(r3)
+ lwz r6, 4(r3)
+ lwz r3, 0(r3)
+ lwz r7, 4(r3)
+ lwz r3, 0(r3)
+ lwz r8, 4(r3)
+ lwz r3, 0(r3)
+ lwz r9, 4(r3)
+ lwz r3, 0(r3)
+ lwz r10, 4(r3)
+ #lwz r10, 0x14(r29)
+
+ lis r3, UniLogStr@h
+ ori r3, r3, UniLogStr@l
+ bl OSReport
+
+ mr r3, r31
+ mr r4, r30
+ lwz r30, 0x8(r1)
+ lwz r31, 0xC(r1)
+ lwz r0, 0x14(r1)
+ mtlr r0
+ addi r1, r1, 0x10
+ blr
+
+.data
+UniLogStr: .string "[ULog] returning %8x to: %x > %x > %x > %x > %x > %x\n"
+
diff --git a/src/shyguy.cpp b/src/shyguy.cpp
index 174b075..5a21e6c 100644
--- a/src/shyguy.cpp
+++ b/src/shyguy.cpp
@@ -114,6 +114,7 @@ class daShyGuy : public dEn_c {
void _vf148();
void _vf14C();
+ bool CreateIceActors();
USING_STATES(daShyGuy);
DECLARE_STATE(Walk);
@@ -354,6 +355,20 @@ daShyGuy *daShyGuy::build() {
doStateChange(&StateID_Die);
}
+ extern "C" void sub_80024C20(void);
+ extern "C" void __destroy_arr(void*, void(*)(void), int, int);
+ //extern "C" __destroy_arr(struct DoSomethingCool, void(*)(void), int cnt, int bar);
+
+ bool daShyGuy::CreateIceActors()
+ {
+ struct DoSomethingCool my_struct = { 0, this->pos, {1.0, 1.5, 1.5}, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
+ this->frzMgr.Create_ICEACTORs( (void*)&my_struct, 1 );
+ __destroy_arr( (void*)&my_struct, sub_80024C20, 0x3C, 1 );
+ return true;
+ }
+
+
+
void daShyGuy::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
doStateChange(&StateID_Die);
}
diff --git a/src/spritetex.S b/src/spritetex.S
index 692a381..7c9f505 100755
--- a/src/spritetex.S
+++ b/src/spritetex.S
@@ -638,13 +638,10 @@ SnowmanSandToSnowB:
-
SnowmanPokeyRotate:
-
- lha r3, 0x102(r30)
+ li r5, 0x100
blr
-
.global TEX_PokeySnowmanRotate
TEX_PokeySnowmanRotate:
@@ -655,10 +652,29 @@ TEX_PokeySnowmanRotate:
cmpwi r10, 0x2
bne SnowmanPokeyRotate
+ li r5, 0
+ blr
+
+
+PokeySnowmanImmuneToIce:
+ lwz r31, 4(r5)
+ blr
+
+.global TEX_PokeySnowmanImmuneToIce
+TEX_PokeySnowmanImmuneToIce:
+ lwz r10, 4(r3)
+ srwi r10, r10, 24
+ andi. r10, r10, 0xF
+
+ cmpwi r10, 0x2
+ bne PokeySnowmanImmuneToIce
+
li r3, 0
- sth r3, 0x102(r30)
+ mtlr r0
blr
+
+
.global TEX_PokeySnowman
TEX_PokeySnowman: