Some refactoring
This commit is contained in:
1 parent
7da55b1456
commit
c3a68d48a7
37 files changed
+581
-746
No files matched your search
+1
-1
@@ -66,7 +66,7 @@ KING_BOBOMB_DIRS := king_bobomb water_bubble
|
||||
BOO_DIRS := bookend book chair small_key mad_piano boo haunted_cage
|
||||
MR_I_DIRS := mr_i_eyeball mr_i_iris swoop snufit dorrie scuttlebug
|
||||
HOOT_DIRS := yellow_sphere_small hoot yoshi_egg thwomp bullet_bill heave_ho
|
||||
COINS_DIRS := mist explosion butterfly coin warp_pipe door bowser_key flame blue_fish pebble leaves warp_collision mario_cap breath_meter power_meter mushroom_1up star sand dirt transparent_star white_particle wooden_signpost tree
|
||||
COINS_DIRS := mist explosion butterfly coin warp_pipe door bowser_key flame blue_fish pebble leaves mario_cap breath_meter power_meter mushroom_1up star sand dirt transparent_star white_particle wooden_signpost tree
|
||||
BUBBA_DIRS := bubba wiggler wiggler_body_part lakitu_enemy spiny_egg spiny
|
||||
SKEETER_DIRS := skeeter seaweed water_mine cyan_fish bub water_ring treasure_chest
|
||||
KLEPTO_DIRS := klepto eyerok pokey tornado
|
||||
|
||||
+1
-2
@@ -27,6 +27,7 @@ UNUSED static const u64 binid_4 = 4;
|
||||
#include "door/model.inc.c"
|
||||
#include "door/anims/data.inc.c"
|
||||
#include "door/anims/table.inc.c"
|
||||
#include "door/collision.inc.c"
|
||||
UNUSED static const u64 binid_5 = 5;
|
||||
|
||||
#include "bowser_key/model.inc.c"
|
||||
@@ -48,8 +49,6 @@ UNUSED static const u64 binid_9 = 9;
|
||||
#include "leaves/model.inc.c"
|
||||
UNUSED static const u64 binid_10 = 10;
|
||||
|
||||
// this is still weird...
|
||||
#include "warp_collision/collision.inc.c"
|
||||
UNUSED static const u64 binid_11 = 11;
|
||||
|
||||
#include "mario_cap/model.inc.c"
|
||||
|
||||
+1
-4
@@ -113,6 +113,7 @@ extern const Gfx door_seg3_dl_03015078[];
|
||||
extern const Gfx door_seg3_dl_030150E8[];
|
||||
extern const Gfx door_seg3_dl_03015158[];
|
||||
extern const struct Animation *const door_seg3_anims_030156C0[];
|
||||
extern const Collision door_seg3_collision_door[];
|
||||
|
||||
// explosion
|
||||
extern const GeoLayout explosion_geo[];
|
||||
@@ -230,10 +231,6 @@ extern const Gfx tree_seg3_dl_spiky[];
|
||||
extern const Gfx tree_seg3_dl_snowy_pine[];
|
||||
extern const Gfx tree_seg3_dl_palm[];
|
||||
|
||||
// warp_collision
|
||||
extern const Collision door_seg3_collision_0301CE78[];
|
||||
extern const Collision lll_hexagonal_mesh_seg3_collision_0301CECC[];
|
||||
|
||||
// warp_pipe
|
||||
extern const GeoLayout warp_pipe_geo[];
|
||||
extern const Gfx warp_pipe_seg3_dl_03008E40[];
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// 0x0301CE78 - 0x0301CECC
|
||||
const Collision door_seg3_collision_door[] = {
|
||||
COL_INIT(),
|
||||
COL_VERTEX_INIT(0x8),
|
||||
COL_VERTEX(-80, 240, 30),
|
||||
COL_VERTEX(80, 240, 30),
|
||||
COL_VERTEX(80, 0, 30),
|
||||
COL_VERTEX(-80, 0, 30),
|
||||
COL_VERTEX(-80, 240, -30),
|
||||
COL_VERTEX(80, 0, -30),
|
||||
COL_VERTEX(80, 240, -30),
|
||||
COL_VERTEX(-80, 0, -30),
|
||||
|
||||
COL_TRI_INIT(SURFACE_DEFAULT, 4),
|
||||
COL_TRI(2, 1, 0),
|
||||
COL_TRI(3, 2, 0),
|
||||
COL_TRI(6, 5, 4),
|
||||
COL_TRI(5, 7, 4),
|
||||
COL_TRI_STOP(),
|
||||
COL_END(),
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
// Warp Collision (seems strange to put these collision in another file. Only instance of this seperation thus far. Not sure what this is doing as a file.)
|
||||
|
||||
// 0x0301CE78 - 0x0301CECC
|
||||
const Collision door_seg3_collision_0301CE78[] = {
|
||||
COL_INIT(),
|
||||
COL_VERTEX_INIT(0x8),
|
||||
COL_VERTEX(-80, 240, 30),
|
||||
COL_VERTEX(80, 240, 30),
|
||||
COL_VERTEX(80, 0, 30),
|
||||
COL_VERTEX(-80, 0, 30),
|
||||
COL_VERTEX(-80, 240, -30),
|
||||
COL_VERTEX(80, 0, -30),
|
||||
COL_VERTEX(80, 240, -30),
|
||||
COL_VERTEX(-80, 0, -30),
|
||||
|
||||
COL_TRI_INIT(SURFACE_DEFAULT, 4),
|
||||
COL_TRI(2, 1, 0),
|
||||
COL_TRI(3, 2, 0),
|
||||
COL_TRI(6, 5, 4),
|
||||
COL_TRI(5, 7, 4),
|
||||
COL_TRI_STOP(),
|
||||
COL_END(),
|
||||
};
|
||||
|
||||
// 0x0301CECC - 0x0301CEFC
|
||||
const Collision lll_hexagonal_mesh_seg3_collision_0301CECC[] = {
|
||||
COL_INIT(),
|
||||
COL_VERTEX_INIT(0x4),
|
||||
COL_VERTEX(-200, 0, -200),
|
||||
COL_VERTEX(200, 0, -200),
|
||||
COL_VERTEX(200, 0, 200),
|
||||
COL_VERTEX(-200, 0, 200),
|
||||
|
||||
COL_TRI_INIT(SURFACE_DEFAULT, 2),
|
||||
COL_TRI(2, 1, 0),
|
||||
COL_TRI(3, 2, 0),
|
||||
COL_TRI_STOP(),
|
||||
COL_END(),
|
||||
};
|
||||
+1
-10
@@ -1069,7 +1069,7 @@ const BehaviorScript bhvDoor[] = {
|
||||
OR_INT(oFlags, (OBJ_FLAG_ACTIVE_FROM_AFAR | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)),
|
||||
LOAD_ANIMATIONS(oAnimations, door_seg3_anims_030156C0),
|
||||
ANIMATE(0),
|
||||
LOAD_COLLISION_DATA(door_seg3_collision_0301CE78),
|
||||
LOAD_COLLISION_DATA(door_seg3_collision_door),
|
||||
SET_HITBOX(/*Radius*/ 80, /*Height*/ 100),
|
||||
SET_INT(oIntangibleTimer, 0),
|
||||
SET_FLOAT(oCollisionDistance, 1000),
|
||||
@@ -2419,15 +2419,6 @@ const BehaviorScript bhvPiranhaPlant[] = {
|
||||
END_LOOP(),
|
||||
};
|
||||
|
||||
const BehaviorScript bhvLllHexagonalMesh[] = {
|
||||
BEGIN(OBJ_LIST_SURFACE),
|
||||
OR_INT(oFlags, OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE),
|
||||
LOAD_COLLISION_DATA(lll_hexagonal_mesh_seg3_collision_0301CECC),
|
||||
BEGIN_LOOP(),
|
||||
CALL_NATIVE(load_object_collision_model),
|
||||
END_LOOP(),
|
||||
};
|
||||
|
||||
const BehaviorScript bhvLllBowserPuzzlePiece[] = {
|
||||
BEGIN(OBJ_LIST_SURFACE),
|
||||
OR_LONG(oFlags, (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE | OBJ_FLAG_DONT_CALC_COLL_DIST | OBJ_FLAG_UCODE_LARGE)),
|
||||
|
||||
@@ -195,7 +195,6 @@ extern const BehaviorScript bhvKoopaShell[];
|
||||
extern const BehaviorScript bhvKoopaShellFlame[];
|
||||
extern const BehaviorScript bhvToxBox[];
|
||||
extern const BehaviorScript bhvPiranhaPlant[];
|
||||
extern const BehaviorScript bhvLllHexagonalMesh[];
|
||||
extern const BehaviorScript bhvLllBowserPuzzlePiece[];
|
||||
extern const BehaviorScript bhvLllBowserPuzzle[];
|
||||
extern const BehaviorScript bhvTuxiesMother[];
|
||||
|
||||
+5
-3
@@ -66,7 +66,7 @@
|
||||
// 1 is similar to vanilla, but prevents Mario from moving in the wrong direction, and allows finer control with the analog stick.
|
||||
// 2 is similar to mode 1, but a bit further from vanilla, and allows instant turnaround if Mario is moving slower than a certain threshold.
|
||||
// 3 is instant turning to the intended direction regardless of speed and angle.
|
||||
#define GROUND_TURN_MODE 0
|
||||
#define GROUND_TURN_MODE 0
|
||||
// Improved hanging:
|
||||
// - Doesn't require holding down the A button
|
||||
// - Percise turning control ()
|
||||
@@ -187,11 +187,13 @@
|
||||
// This allows you to quickly test the level you're working on.
|
||||
// If you want the game to boot normally, just comment out the define again.
|
||||
//#define TEST_LEVEL LEVEL_BOB
|
||||
// Enable debug level select
|
||||
//#define DEBUG_LEVEL_SELECT
|
||||
// Custom debug mode. Press DPAD left to show the debug UI. Press DPAD right to enter the noclip mode.
|
||||
//#define CUSTOM_DEBUG
|
||||
// Include Puppyprint, a display library for text and large images. Also includes a custom, enhanced performance profiler.
|
||||
//#define PUPPYPRINT
|
||||
#define PUPPYPRINT_DEBUG 0
|
||||
#define PUPPYPRINT
|
||||
#define PUPPYPRINT_DEBUG 1
|
||||
// Use cycles instead of microseconds
|
||||
//#define PUPPYPRINT_DEBUG_CYCLES
|
||||
// Visual debug enables some collision visuals. Tapping Right on the dpad will cycle between visual hitboxes, visual surfaces, both, and neither.
|
||||
|
||||
@@ -144,14 +144,14 @@ typedef struct OSMesgQueue_s {
|
||||
|
||||
/* Message operations */
|
||||
|
||||
extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
|
||||
extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
|
||||
extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
|
||||
extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
|
||||
extern void osCreateMesgQueue(OSMesgQueue *mq, OSMesg *msg, s32 count);
|
||||
extern s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flag);
|
||||
extern s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag);
|
||||
extern s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flag);
|
||||
|
||||
/* Event operations */
|
||||
|
||||
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
|
||||
extern void osSetEventMesg(OSEvent e, OSMesgQueue *mq, OSMesg m);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ enum RenderLayers
|
||||
#define INPUT_IN_WATER /* 0x0200 */ (1 << 9)
|
||||
#define INPUT_STOMPED /* 0x0400 */ (1 << 10)
|
||||
#define INPUT_INTERACT_OBJ_GRABBABLE /* 0x0800 */ (1 << 11)
|
||||
#define INPUT_UNKNOWN_12 /* 0x1000 */ (1 << 12)
|
||||
#define INPUT_B_DOWN /* 0x1000 */ (1 << 12)
|
||||
#define INPUT_B_PRESSED /* 0x2000 */ (1 << 13)
|
||||
#define INPUT_Z_DOWN /* 0x4000 */ (1 << 14)
|
||||
#define INPUT_Z_PRESSED /* 0x8000 */ (1 << 15)
|
||||
@@ -208,7 +208,7 @@ enum RenderLayers
|
||||
#define ACT_COUGHING 0x0C40020A // (0x00A | ACT_FLAG_STATIONARY | ACT_FLAG_IDLE | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
|
||||
#define ACT_SHIVERING 0x0C40020B // (0x00B | ACT_FLAG_STATIONARY | ACT_FLAG_IDLE | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
|
||||
#define ACT_IN_QUICKSAND 0x0002020D // (0x00D | ACT_FLAG_STATIONARY | ACT_FLAG_INVULNERABLE)
|
||||
#define ACT_UNKNOWN_0002020E 0x0002020E // (0x00E | ACT_FLAG_STATIONARY | ACT_FLAG_INVULNERABLE)
|
||||
#define ACT_NO_STANDING_DEATH 0x0002020E // (0x00E | ACT_FLAG_STATIONARY | ACT_FLAG_INVULNERABLE)
|
||||
#define ACT_CROUCHING 0x0C008220 // (0x020 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
|
||||
#define ACT_START_CROUCHING 0x0C008221 // (0x021 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
|
||||
#define ACT_STOP_CROUCHING 0x0C008222 // (0x022 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "levels/hmc/header.h"
|
||||
|
||||
#include "levels/hmc/areas/1/grill_door/geo.inc.c"
|
||||
#include "levels/hmc/grill_door/geo.inc.c"
|
||||
#include "levels/hmc/rolling_rock/geo.inc.c"
|
||||
#include "levels/hmc/rolling_rock_fragment_1/geo.inc.c"
|
||||
#include "levels/hmc/rolling_rock_fragment_2/geo.inc.c"
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -38,7 +38,6 @@
|
||||
#include "levels/hmc/areas/1/26/model.inc.c"
|
||||
#include "levels/hmc/areas/1/27/model.inc.c"
|
||||
#include "levels/hmc/areas/1/28/model.inc.c"
|
||||
#include "levels/hmc/areas/1/grill_door/model.inc.c"
|
||||
#include "levels/hmc/areas/1/29/model.inc.c"
|
||||
#include "levels/hmc/areas/1/30/model.inc.c"
|
||||
#include "levels/hmc/areas/1/31/model.inc.c"
|
||||
@@ -54,7 +53,8 @@
|
||||
#include "levels/hmc/areas/1/macro.inc.c"
|
||||
#include "levels/hmc/areas/1/room.inc.c"
|
||||
#include "levels/hmc/elevator_platform/collision.inc.c"
|
||||
#include "levels/hmc/areas/1/grill_door/collision.inc.c" // This is odd, but the model data for this is in the middle of area 1. I have to conclude it is an area local object, despite the fact it has collision. Let's hope this is the only oddity...
|
||||
#include "levels/hmc/grill_door/model.inc.c"
|
||||
#include "levels/hmc/grill_door/collision.inc.c" // This is odd, but the model data for this is in the middle of area 1. I have to conclude it is an area local object, despite the fact it has collision. Let's hope this is the only oddity...
|
||||
#include "levels/hmc/arrow_platform/collision.inc.c"
|
||||
#include "levels/hmc/arrow_platform_button/collision.inc.c"
|
||||
#include "levels/hmc/areas/1/trajectory.inc.c"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// 0x0701ADE8 - 0x0701CE18
|
||||
const Collision lll_seg7_area_1_collision[] = {
|
||||
COL_INIT(),
|
||||
COL_VERTEX_INIT(0x20F),
|
||||
COL_VERTEX_INIT(0x213),
|
||||
COL_VERTEX(2775, 1280, 4567),
|
||||
COL_VERTEX(2816, 1280, 4608),
|
||||
COL_VERTEX(5888, 1280, 4608),
|
||||
@@ -529,7 +529,11 @@ const Collision lll_seg7_area_1_collision[] = {
|
||||
COL_VERTEX(6724, 554, -6532),
|
||||
COL_VERTEX(6863, 376, -6392),
|
||||
COL_VERTEX(6934, 166, -6321),
|
||||
COL_TRI_INIT(SURFACE_DEFAULT, 622),
|
||||
COL_VERTEX(-5315, 300, -3400),
|
||||
COL_VERTEX(-4915, 300, -3400),
|
||||
COL_VERTEX(-4915, 300, -3000),
|
||||
COL_VERTEX(-5315, 300, -3000),
|
||||
COL_TRI_INIT(SURFACE_DEFAULT, 624),
|
||||
COL_TRI(142, 143, 144),
|
||||
COL_TRI(48, 49, 50),
|
||||
COL_TRI(48, 50, 51),
|
||||
@@ -1152,6 +1156,8 @@ const Collision lll_seg7_area_1_collision[] = {
|
||||
COL_TRI(97, 521, 522),
|
||||
COL_TRI(97, 92, 521),
|
||||
COL_TRI(376, 524, 525),
|
||||
COL_TRI(529, 528, 527),
|
||||
COL_TRI(530, 529, 527),
|
||||
COL_TRI_INIT(SURFACE_BURNING, 82),
|
||||
COL_TRI(77, 73, 41),
|
||||
COL_TRI(41, 39, 72),
|
||||
|
||||
+1
-4
@@ -31,10 +31,7 @@ static const LevelScript script_func_local_hmc_flames_and_poles[] = {
|
||||
OBJECT(/*model*/ MODEL_LEVEL_GEOMETRY_0C, /*pos*/ -4607, 0, 3456, /*angle*/ 0, 270, 0, /*behParam*/ 0x00000000, /*beh*/ bhvStaticObject),
|
||||
OBJECT(/*model*/ MODEL_LEVEL_GEOMETRY_0C, /*pos*/ -5119, 0, -511, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvStaticObject),
|
||||
OBJECT(/*model*/ MODEL_LEVEL_GEOMETRY_0D, /*pos*/ 0, 0, -2047, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvStaticObject),
|
||||
// This behavior differs from the rest in that it actually has collision rather than being purely visual.
|
||||
// A likely explanation is that this object was added in after the collision model was made, and they didn't want
|
||||
// to redo the collision so they just added a new behavior for it.
|
||||
OBJECT(/*model*/ MODEL_LEVEL_GEOMETRY_0E, /*pos*/ -5115, 300, -3200, /*angle*/ 0, 90, 0, /*behParam*/ 0x00000000, /*beh*/ bhvLllHexagonalMesh),
|
||||
OBJECT(/*model*/ MODEL_LEVEL_GEOMETRY_0E, /*pos*/ -5115, 300, -3200, /*angle*/ 0, 90, 0, /*behParam*/ 0x00000000, /*beh*/ bhvStaticObject),
|
||||
RETURN(),
|
||||
};
|
||||
|
||||
|
||||
+51
-96
@@ -65,7 +65,11 @@ s8 sAudioEnabled = TRUE;
|
||||
u32 gNumVblanks = 0;
|
||||
s8 gResetTimer = 0;
|
||||
s8 gNmiResetBarsTimer = 0;
|
||||
#ifdef DEBUG_LEVEL_SELECT
|
||||
s8 gDebugLevelSelect = TRUE;
|
||||
#else
|
||||
s8 gDebugLevelSelect = FALSE;
|
||||
#endif
|
||||
|
||||
s8 gShowProfiler = FALSE;
|
||||
s8 gShowDebugText = FALSE;
|
||||
@@ -150,12 +154,8 @@ void receive_new_tasks(void) {
|
||||
while (osRecvMesg(&gSPTaskMesgQueue, (OSMesg *) &spTask, OS_MESG_NOBLOCK) != -1) {
|
||||
spTask->state = SPTASK_STATE_NOT_STARTED;
|
||||
switch (spTask->task.t.type) {
|
||||
case 2:
|
||||
sNextAudioSPTask = spTask;
|
||||
break;
|
||||
case 1:
|
||||
sNextDisplaySPTask = spTask;
|
||||
break;
|
||||
case 2: sNextAudioSPTask = spTask; break;
|
||||
case 1: sNextDisplaySPTask = spTask; break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +171,6 @@ void receive_new_tasks(void) {
|
||||
}
|
||||
|
||||
void start_sptask(s32 taskType) {
|
||||
UNUSED s32 pad; // needed to pad the stack
|
||||
|
||||
if (taskType == M_AUDTASK) {
|
||||
gActiveSPTask = sCurrentAudioSPTask;
|
||||
} else {
|
||||
@@ -195,9 +193,9 @@ void start_gfx_sptask(void) {
|
||||
if (gActiveSPTask == NULL && sCurrentDisplaySPTask != NULL
|
||||
&& sCurrentDisplaySPTask->state == SPTASK_STATE_NOT_STARTED) {
|
||||
profiler_log_gfx_time(TASKS_QUEUED);
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#if PUPPYPRINT_DEBUG
|
||||
rspDelta = osGetTime();
|
||||
#endif
|
||||
#endif
|
||||
start_sptask(M_GFXTASK);
|
||||
}
|
||||
}
|
||||
@@ -237,9 +235,9 @@ void handle_vblank(void) {
|
||||
if (gActiveSPTask == NULL && sCurrentDisplaySPTask != NULL
|
||||
&& sCurrentDisplaySPTask->state != SPTASK_STATE_FINISHED) {
|
||||
profiler_log_gfx_time(TASKS_QUEUED);
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#if PUPPYPRINT_DEBUG
|
||||
rspDelta = osGetTime();
|
||||
#endif
|
||||
#endif
|
||||
start_sptask(M_GFXTASK);
|
||||
}
|
||||
}
|
||||
@@ -248,15 +246,9 @@ void handle_vblank(void) {
|
||||
#endif
|
||||
|
||||
// Notify the game loop about the vblank.
|
||||
if (gVblankHandler1 != NULL) {
|
||||
osSendMesg(gVblankHandler1->queue, gVblankHandler1->msg, OS_MESG_NOBLOCK);
|
||||
}
|
||||
if (gVblankHandler2 != NULL) {
|
||||
osSendMesg(gVblankHandler2->queue, gVblankHandler2->msg, OS_MESG_NOBLOCK);
|
||||
}
|
||||
if (gVblankHandler3 != NULL) {
|
||||
osSendMesg(gVblankHandler3->queue, gVblankHandler3->msg, OS_MESG_NOBLOCK);
|
||||
}
|
||||
if (gVblankHandler1 != NULL) osSendMesg(gVblankHandler1->queue, gVblankHandler1->msg, OS_MESG_NOBLOCK);
|
||||
if (gVblankHandler2 != NULL) osSendMesg(gVblankHandler2->queue, gVblankHandler2->msg, OS_MESG_NOBLOCK);
|
||||
if (gVblankHandler3 != NULL) osSendMesg(gVblankHandler3->queue, gVblankHandler3->msg, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
void handle_sp_complete(void) {
|
||||
@@ -305,9 +297,9 @@ void handle_sp_complete(void) {
|
||||
// The SP process is done, but there is still a Display Processor notification
|
||||
// that needs to arrive before we can consider the task completely finished and
|
||||
// null out sCurrentDisplaySPTask. That happens in handle_dp_complete.
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#if PUPPYPRINT_DEBUG
|
||||
profiler_update(rspGenTime, rspDelta);
|
||||
#endif
|
||||
#endif
|
||||
profiler_log_gfx_time(RSP_COMPLETE);
|
||||
}
|
||||
}
|
||||
@@ -344,10 +336,10 @@ void thread3_main(UNUSED void *arg) {
|
||||
osSyncPrintf("Linker : %s\n", __linker__);
|
||||
#endif
|
||||
|
||||
create_thread(&gSoundThread, 4, thread4_sound, NULL, gThread4Stack + 0x2000, 20);
|
||||
create_thread(&gSoundThread, 4, thread4_sound, NULL, (gThread4Stack + 0x2000), 20);
|
||||
osStartThread(&gSoundThread);
|
||||
|
||||
create_thread(&gGameLoopThread, 5, thread5_game_loop, NULL, gThread5Stack + 0x2000, 10);
|
||||
create_thread(&gGameLoopThread, 5, thread5_game_loop, NULL, (gThread5Stack + 0x2000), 10);
|
||||
osStartThread(&gGameLoopThread);
|
||||
|
||||
while (TRUE) {
|
||||
@@ -355,24 +347,13 @@ void thread3_main(UNUSED void *arg) {
|
||||
#if PUPPYPRINT_DEBUG
|
||||
OSTime first = osGetTime();
|
||||
#endif
|
||||
|
||||
osRecvMesg(&gIntrMesgQueue, &msg, OS_MESG_BLOCK);
|
||||
switch ((uintptr_t) msg) {
|
||||
case MESG_VI_VBLANK:
|
||||
handle_vblank();
|
||||
break;
|
||||
case MESG_SP_COMPLETE:
|
||||
handle_sp_complete();
|
||||
break;
|
||||
case MESG_DP_COMPLETE:
|
||||
handle_dp_complete();
|
||||
break;
|
||||
case MESG_START_GFX_SPTASK:
|
||||
start_gfx_sptask();
|
||||
break;
|
||||
case MESG_NMI_REQUEST:
|
||||
handle_nmi_request();
|
||||
break;
|
||||
case MESG_VI_VBLANK: handle_vblank(); break;
|
||||
case MESG_SP_COMPLETE: handle_sp_complete(); break;
|
||||
case MESG_DP_COMPLETE: handle_dp_complete(); break;
|
||||
case MESG_START_GFX_SPTASK: start_gfx_sptask(); break;
|
||||
case MESG_NMI_REQUEST: handle_nmi_request(); break;
|
||||
}
|
||||
#if PUPPYPRINT_DEBUG
|
||||
profiler_update(taskTime, first);
|
||||
@@ -385,15 +366,9 @@ void set_vblank_handler(s32 index, struct VblankHandler *handler, OSMesgQueue *q
|
||||
handler->msg = msg;
|
||||
|
||||
switch (index) {
|
||||
case 1:
|
||||
gVblankHandler1 = handler;
|
||||
break;
|
||||
case 2:
|
||||
gVblankHandler2 = handler;
|
||||
break;
|
||||
case 3:
|
||||
gVblankHandler3 = handler;
|
||||
break;
|
||||
case 1: gVblankHandler1 = handler; break;
|
||||
case 2: gVblankHandler2 = handler; break;
|
||||
case 3: gVblankHandler3 = handler; break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,52 +410,34 @@ void turn_off_audio(void) {
|
||||
}
|
||||
|
||||
void change_vi(OSViMode *mode, int width, int height){
|
||||
|
||||
mode->comRegs.width = width;
|
||||
mode->comRegs.xScale = (width*512)/320;
|
||||
if(height > 240)
|
||||
{
|
||||
mode->comRegs.ctrl |= 0x40;
|
||||
mode->fldRegs[0].origin = width*2;
|
||||
mode->fldRegs[1].origin = width*4;
|
||||
mode->fldRegs[0].yScale = 0x2000000|((height*1024)/240);
|
||||
mode->fldRegs[1].yScale = 0x2000000|((height*1024)/240);
|
||||
mode->fldRegs[0].vStart = mode->fldRegs[1].vStart-0x20002;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode->fldRegs[0].origin = width*2;
|
||||
mode->fldRegs[1].origin = width*4;
|
||||
mode->fldRegs[0].yScale = ((height*1024)/240);
|
||||
mode->fldRegs[1].yScale = ((height*1024)/240);
|
||||
mode->comRegs.width = width;
|
||||
mode->comRegs.xScale = ((width * 512) / 320);
|
||||
if (height > 240) {
|
||||
mode->comRegs.ctrl |= 0x40;
|
||||
mode->fldRegs[0].origin = (width * 2);
|
||||
mode->fldRegs[1].origin = (width * 4);
|
||||
mode->fldRegs[0].yScale = (0x2000000 | ((height * 1024) / 240));
|
||||
mode->fldRegs[1].yScale = (0x2000000 | ((height * 1024) / 240));
|
||||
mode->fldRegs[0].vStart = (mode->fldRegs[1].vStart - 0x20002);
|
||||
} else {
|
||||
mode->fldRegs[0].origin = (width * 2);
|
||||
mode->fldRegs[1].origin = (width * 4);
|
||||
mode->fldRegs[0].yScale = ((height * 1024) / 240);
|
||||
mode->fldRegs[1].yScale = ((height * 1024) / 240);
|
||||
}
|
||||
}
|
||||
|
||||
void get_audio_frequency(void)
|
||||
{
|
||||
switch (gConfig.tvType)
|
||||
{
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
case MODE_NTSC:
|
||||
gConfig.audioFrequency = 1.0f;
|
||||
break;
|
||||
case MODE_MPAL:
|
||||
gConfig.audioFrequency = 0.9915f;
|
||||
break;
|
||||
case MODE_PAL:
|
||||
gConfig.audioFrequency = 0.9876f;
|
||||
break;
|
||||
#else
|
||||
case MODE_NTSC:
|
||||
gConfig.audioFrequency = 1.0126f;
|
||||
break;
|
||||
case MODE_MPAL:
|
||||
gConfig.audioFrequency = 1.0086f;
|
||||
break;
|
||||
case MODE_PAL:
|
||||
gConfig.audioFrequency = 1.0f;
|
||||
break;
|
||||
#endif
|
||||
void get_audio_frequency(void) {
|
||||
switch (gConfig.tvType) {
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
case MODE_NTSC: gConfig.audioFrequency = 1.0f; break;
|
||||
case MODE_MPAL: gConfig.audioFrequency = 0.9915f; break;
|
||||
case MODE_PAL: gConfig.audioFrequency = 0.9876f; break;
|
||||
#else
|
||||
case MODE_NTSC: gConfig.audioFrequency = 1.0126f; break;
|
||||
case MODE_MPAL: gConfig.audioFrequency = 1.0086f; break;
|
||||
case MODE_PAL: gConfig.audioFrequency = 1.0f; break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,8 +486,7 @@ void thread1_idle(UNUSED void *arg) {
|
||||
}
|
||||
|
||||
#if CLEARRAM
|
||||
void ClearRAM(void)
|
||||
{
|
||||
void ClearRAM(void) {
|
||||
bzero(_mainSegmentEnd, (size_t)osMemSize - (size_t)OS_K0_TO_PHYSICAL(_mainSegmentEnd));
|
||||
}
|
||||
#endif
|
||||
@@ -559,7 +515,6 @@ void main_func(void) {
|
||||
#ifdef ISVPRINT
|
||||
osInitialize_fakeisv();
|
||||
#endif
|
||||
|
||||
create_thread(&gIdleThread, 1, thread1_idle, NULL, gIdleThreadStack + 0x800, 100);
|
||||
osStartThread(&gIdleThread);
|
||||
}
|
||||
+26
-37
@@ -77,7 +77,7 @@ struct MainPoolBlock *sPoolListHeadR;
|
||||
static struct MainPoolState *gMainPoolState = NULL;
|
||||
|
||||
uintptr_t set_segment_base_addr(s32 segment, void *addr) {
|
||||
sSegmentTable[segment] = (uintptr_t) addr & 0x1FFFFFFF;
|
||||
sSegmentTable[segment] = ((uintptr_t) addr & 0x1FFFFFFF);
|
||||
return sSegmentTable[segment];
|
||||
}
|
||||
|
||||
@@ -87,15 +87,14 @@ void *get_segment_base_addr(s32 segment) {
|
||||
|
||||
#ifndef NO_SEGMENTED_MEMORY
|
||||
void *segmented_to_virtual(const void *addr) {
|
||||
size_t segment = (uintptr_t) addr >> 24;
|
||||
size_t offset = (uintptr_t) addr & 0x00FFFFFF;
|
||||
size_t segment = ((uintptr_t) addr >> 24);
|
||||
size_t offset = ((uintptr_t) addr & 0x00FFFFFF);
|
||||
|
||||
return (void *) ((sSegmentTable[segment] + offset) | 0x80000000);
|
||||
}
|
||||
|
||||
void *virtual_to_segmented(u32 segment, const void *addr) {
|
||||
size_t offset = ((uintptr_t) addr & 0x1FFFFFFF) - sSegmentTable[segment];
|
||||
|
||||
return (void *) ((segment << 24) + offset);
|
||||
}
|
||||
|
||||
@@ -125,8 +124,8 @@ void move_segment_table_to_dmem(void) {
|
||||
* freeing the object that was most recently allocated from a side.
|
||||
*/
|
||||
void main_pool_init(void *start, void *end) {
|
||||
sPoolStart = (u8 *) ALIGN16((uintptr_t) start) + 16;
|
||||
sPoolEnd = (u8 *) ALIGN16((uintptr_t) end - 15) - 16;
|
||||
sPoolStart = ((u8 *) ALIGN16((uintptr_t) start) + 16);
|
||||
sPoolEnd = ((u8 *) ALIGN16((uintptr_t) end - 15) - 16);
|
||||
sPoolFreeSpace = sPoolEnd - sPoolStart;
|
||||
|
||||
sPoolListHeadL = (struct MainPoolBlock *) (sPoolStart - 16);
|
||||
@@ -149,23 +148,23 @@ void *main_pool_alloc(u32 size, u32 side) {
|
||||
struct MainPoolBlock *newListHead;
|
||||
void *addr = NULL;
|
||||
|
||||
size = ALIGN16(size) + 16;
|
||||
size = (ALIGN16(size) + 16);
|
||||
if (size != 0 && sPoolFreeSpace >= size) {
|
||||
sPoolFreeSpace -= size;
|
||||
if (side == MEMORY_POOL_LEFT) {
|
||||
newListHead = (struct MainPoolBlock *) ((u8 *) sPoolListHeadL + size);
|
||||
sPoolListHeadL->next = newListHead;
|
||||
newListHead->prev = sPoolListHeadL;
|
||||
newListHead->next = NULL;
|
||||
addr = (u8 *) sPoolListHeadL + 16;
|
||||
sPoolListHeadL = newListHead;
|
||||
newListHead->prev = sPoolListHeadL;
|
||||
newListHead->next = NULL;
|
||||
addr = ((u8 *) sPoolListHeadL + 16);
|
||||
sPoolListHeadL = newListHead;
|
||||
} else {
|
||||
newListHead = (struct MainPoolBlock *) ((u8 *) sPoolListHeadR - size);
|
||||
sPoolListHeadR->prev = newListHead;
|
||||
newListHead->next = sPoolListHeadR;
|
||||
newListHead->prev = NULL;
|
||||
sPoolListHeadR = newListHead;
|
||||
addr = (u8 *) sPoolListHeadR + 16;
|
||||
newListHead->next = sPoolListHeadR;
|
||||
newListHead->prev = NULL;
|
||||
sPoolListHeadR = newListHead;
|
||||
addr = ((u8 *) sPoolListHeadR + 16);
|
||||
}
|
||||
}
|
||||
return addr;
|
||||
@@ -178,7 +177,7 @@ void *main_pool_alloc(u32 size, u32 side) {
|
||||
* Return the amount of free space left in the pool.
|
||||
*/
|
||||
u32 main_pool_free(void *addr) {
|
||||
struct MainPoolBlock *block = (struct MainPoolBlock *) ((u8 *) addr - 16);
|
||||
struct MainPoolBlock *block = (struct MainPoolBlock *) ((u8 *) addr - 16);
|
||||
struct MainPoolBlock *oldListHead = (struct MainPoolBlock *) ((u8 *) addr - 16);
|
||||
|
||||
if (oldListHead < sPoolListHeadL) {
|
||||
@@ -290,16 +289,16 @@ void *dynamic_dma_read(u8 *srcStart, u8 *srcEnd, u32 side, u32 alignment, u32 bs
|
||||
u32 size = ALIGN16(srcEnd - srcStart);
|
||||
u32 offset = 0;
|
||||
|
||||
if (alignment && side == MEMORY_POOL_LEFT)
|
||||
{
|
||||
if (alignment && side == MEMORY_POOL_LEFT) {
|
||||
offset = ALIGN((uintptr_t)sPoolListHeadL + 16, alignment) - ((uintptr_t)sPoolListHeadL + 16);
|
||||
}
|
||||
|
||||
dest = main_pool_alloc(offset + size + bssLength, side);
|
||||
if (dest != NULL) {
|
||||
dma_read((u8 *)dest + offset, srcStart, srcEnd);
|
||||
if (bssLength)
|
||||
if (bssLength) {
|
||||
bzero((u8 *)dest + offset + size, bssLength);
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
@@ -308,20 +307,15 @@ void *dynamic_dma_read(u8 *srcStart, u8 *srcEnd, u32 side, u32 alignment, u32 bs
|
||||
s32 gTlbEntries = 0;
|
||||
u8 gTlbSegments[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
|
||||
void mapTLBPages(uintptr_t virtualAddress, uintptr_t physicalAddress, s32 length, s32 segment)
|
||||
{
|
||||
while (length > 0)
|
||||
{
|
||||
if (length > TLB_PAGE_SIZE)
|
||||
{
|
||||
void mapTLBPages(uintptr_t virtualAddress, uintptr_t physicalAddress, s32 length, s32 segment) {
|
||||
while (length > 0) {
|
||||
if (length > TLB_PAGE_SIZE) {
|
||||
osMapTLB(gTlbEntries++, OS_PM_4K, (void *)virtualAddress, physicalAddress, physicalAddress + TLB_PAGE_SIZE, -1);
|
||||
virtualAddress += TLB_PAGE_SIZE;
|
||||
physicalAddress += TLB_PAGE_SIZE;
|
||||
length -= TLB_PAGE_SIZE;
|
||||
gTlbSegments[segment]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
osMapTLB(gTlbEntries++, OS_PM_4K, (void *)virtualAddress, physicalAddress, -1, -1);
|
||||
gTlbSegments[segment]++;
|
||||
}
|
||||
@@ -339,17 +333,14 @@ void mapTLBPages(uintptr_t virtualAddress, uintptr_t physicalAddress, s32 length
|
||||
void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side, u8 *bssStart, u8 *bssEnd) {
|
||||
void *addr;
|
||||
|
||||
if (bssStart != NULL && side == MEMORY_POOL_LEFT)
|
||||
{
|
||||
if (bssStart != NULL && side == MEMORY_POOL_LEFT) {
|
||||
addr = dynamic_dma_read(srcStart, srcEnd, side, TLB_PAGE_SIZE, (uintptr_t)bssEnd - (uintptr_t)bssStart);
|
||||
if (addr != NULL) {
|
||||
u8 *realAddr = (u8 *)ALIGN((uintptr_t)addr, TLB_PAGE_SIZE);
|
||||
set_segment_base_addr(segment, realAddr);
|
||||
mapTLBPages(segment << 24, VIRTUAL_TO_PHYSICAL(realAddr), (srcEnd - srcStart) + ((uintptr_t)bssEnd - (uintptr_t)bssStart), segment);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
addr = dynamic_dma_read(srcStart, srcEnd, side, 0, 0);
|
||||
if (addr != NULL) {
|
||||
set_segment_base_addr(segment, addr);
|
||||
@@ -392,7 +383,6 @@ void *load_to_fixed_pool_addr(u8 *destAddr, u8 *srcStart, u8 *srcEnd) {
|
||||
*/
|
||||
void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
void *dest = NULL;
|
||||
|
||||
#ifdef GZIP
|
||||
u32 compSize = (srcEnd - 4 - srcStart);
|
||||
#else
|
||||
@@ -439,8 +429,7 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
}
|
||||
|
||||
void *load_segment_decompress_heap(u32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
UNUSED void *dest = NULL;
|
||||
|
||||
// UNUSED void *dest = NULL;
|
||||
#ifdef GZIP
|
||||
u32 compSize = (srcEnd - 4 - srcStart);
|
||||
#else
|
||||
@@ -640,7 +629,7 @@ void *alloc_display_list(u32 size) {
|
||||
void *ptr = NULL;
|
||||
|
||||
size = ALIGN8(size);
|
||||
if (gGfxPoolEnd - size >= (u8 *) gDisplayListHead) {
|
||||
if ((gGfxPoolEnd - size) >= (u8 *) gDisplayListHead) {
|
||||
gGfxPoolEnd -= size;
|
||||
ptr = gGfxPoolEnd;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
/**
|
||||
* Hitbox for spiny both while thrown and walking. The interaction type is
|
||||
* changed to INTERACT_UNKNOWN_08 while walking.
|
||||
* changed to INTERACT_SPINY_WALKING while walking.
|
||||
*/
|
||||
static struct ObjectHitbox sSpinyHitbox = {
|
||||
/* interactType: */ INTERACT_MR_BLIZZARD,
|
||||
@@ -113,7 +113,7 @@ static void spiny_act_walk(void) {
|
||||
// Don't allow mario to punch the spiny two frames in a row?
|
||||
o->oInteractType = INTERACT_MR_BLIZZARD;
|
||||
} else {
|
||||
o->oInteractType = INTERACT_UNKNOWN_08;
|
||||
o->oInteractType = INTERACT_SPINY_WALKING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+17
-20
@@ -397,9 +397,9 @@ void render_init(void) {
|
||||
void select_gfx_pool(void) {
|
||||
gGfxPool = &gGfxPools[gGlobalTimer % ARRAY_COUNT(gGfxPools)];
|
||||
set_segment_base_addr(1, gGfxPool->buffer);
|
||||
gGfxSPTask = &gGfxPool->spTask;
|
||||
gGfxSPTask = &gGfxPool->spTask;
|
||||
gDisplayListHead = gGfxPool->buffer;
|
||||
gGfxPoolEnd = (u8 *) (gGfxPool->buffer + GFX_POOL_SIZE);
|
||||
gGfxPoolEnd = (u8 *) (gGfxPool->buffer + GFX_POOL_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -703,9 +703,9 @@ void setup_game_memory(void) {
|
||||
*/
|
||||
void thread5_game_loop(UNUSED void *arg) {
|
||||
struct LevelCommand *addr;
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#if PUPPYPRINT_DEBUG
|
||||
OSTime lastTime = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
setup_game_memory();
|
||||
#if ENABLE_RUMBLE
|
||||
@@ -719,9 +719,9 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
createHvqmThread();
|
||||
#endif
|
||||
save_file_load_all();
|
||||
#ifdef PUPPYCAM
|
||||
#ifdef PUPPYCAM
|
||||
puppycam_boot();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
set_vblank_handler(2, &gGameVblankHandler, &gGameVblankQueue, (OSMesg) 1);
|
||||
|
||||
@@ -742,14 +742,13 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
continue;
|
||||
}
|
||||
profiler_log_thread5_time(THREAD5_START);
|
||||
#if PUPPYPRINT_DEBUG
|
||||
while (TRUE)
|
||||
{
|
||||
#if PUPPYPRINT_DEBUG
|
||||
while (TRUE) {
|
||||
lastTime = osGetTime();
|
||||
collisionTime[perfIteration] = 0;
|
||||
behaviourTime[perfIteration] = 0;
|
||||
dmaTime[perfIteration] = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// If any controllers are plugged in, start read the data for when
|
||||
// read_controller_inputs is called later.
|
||||
@@ -764,26 +763,24 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||
select_gfx_pool();
|
||||
read_controller_inputs(5);
|
||||
addr = level_script_execute(addr);
|
||||
#if PUPPYPRINT_DEBUG == 0 && defined(VISUAL_DEBUG)
|
||||
#if PUPPYPRINT_DEBUG == 0 && defined(VISUAL_DEBUG)
|
||||
debug_box_input();
|
||||
#endif
|
||||
#if PUPPYPRINT_DEBUG
|
||||
#endif
|
||||
#if PUPPYPRINT_DEBUG
|
||||
profiler_update(scriptTime, lastTime);
|
||||
if (benchmarkLoop > 0 && benchOption == 0)
|
||||
{
|
||||
if (benchmarkLoop > 0 && benchOption == 0) {
|
||||
benchmarkLoop--;
|
||||
benchMark[benchmarkLoop] = osGetTime() - lastTime;
|
||||
if (benchmarkLoop == 0)
|
||||
{
|
||||
if (benchmarkLoop == 0) {
|
||||
puppyprint_profiler_finished();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
puppyprint_profiler_process();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
display_and_vsync();
|
||||
|
||||
|
||||
+282
-335
File diff suppressed because it is too large.
Load diff
+57
-56
@@ -5,83 +5,84 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define INTERACT_HOOT /* 0x00000001 */ (1 << 0)
|
||||
#define INTERACT_GRABBABLE /* 0x00000002 */ (1 << 1)
|
||||
#define INTERACT_DOOR /* 0x00000004 */ (1 << 2)
|
||||
#define INTERACT_DAMAGE /* 0x00000008 */ (1 << 3)
|
||||
#define INTERACT_COIN /* 0x00000010 */ (1 << 4)
|
||||
#define INTERACT_CAP /* 0x00000020 */ (1 << 5)
|
||||
#define INTERACT_POLE /* 0x00000040 */ (1 << 6)
|
||||
#define INTERACT_KOOPA /* 0x00000080 */ (1 << 7)
|
||||
#define INTERACT_UNKNOWN_08 /* 0x00000100 */ (1 << 8)
|
||||
#define INTERACT_BREAKABLE /* 0x00000200 */ (1 << 9)
|
||||
#define INTERACT_STRONG_WIND /* 0x00000400 */ (1 << 10)
|
||||
#define INTERACT_WARP_DOOR /* 0x00000800 */ (1 << 11)
|
||||
#define INTERACT_STAR_OR_KEY /* 0x00001000 */ (1 << 12)
|
||||
#define INTERACT_WARP /* 0x00002000 */ (1 << 13)
|
||||
#define INTERACT_CANNON_BASE /* 0x00004000 */ (1 << 14)
|
||||
#define INTERACT_BOUNCE_TOP /* 0x00008000 */ (1 << 15)
|
||||
#define INTERACT_WATER_RING /* 0x00010000 */ (1 << 16)
|
||||
#define INTERACT_BULLY /* 0x00020000 */ (1 << 17)
|
||||
#define INTERACT_FLAME /* 0x00040000 */ (1 << 18)
|
||||
#define INTERACT_KOOPA_SHELL /* 0x00080000 */ (1 << 19)
|
||||
#define INTERACT_BOUNCE_TOP2 /* 0x00100000 */ (1 << 20)
|
||||
#define INTERACT_MR_BLIZZARD /* 0x00200000 */ (1 << 21)
|
||||
#define INTERACT_HIT_FROM_BELOW /* 0x00400000 */ (1 << 22)
|
||||
#define INTERACT_TEXT /* 0x00800000 */ (1 << 23)
|
||||
#define INTERACT_TORNADO /* 0x01000000 */ (1 << 24)
|
||||
#define INTERACT_WHIRLPOOL /* 0x02000000 */ (1 << 25)
|
||||
#define INTERACT_CLAM_OR_BUBBA /* 0x04000000 */ (1 << 26)
|
||||
#define INTERACT_BBH_ENTRANCE /* 0x08000000 */ (1 << 27)
|
||||
#define INTERACT_SNUFIT_BULLET /* 0x10000000 */ (1 << 28)
|
||||
#define INTERACT_SHOCK /* 0x20000000 */ (1 << 29)
|
||||
#define INTERACT_IGLOO_BARRIER /* 0x40000000 */ (1 << 30)
|
||||
#define INTERACT_UNKNOWN_31 /* 0x80000000 */ (1 << 31)
|
||||
#define INTERACT_HOOT /* 0x00000001 */ (1 << 0)
|
||||
#define INTERACT_GRABBABLE /* 0x00000002 */ (1 << 1)
|
||||
#define INTERACT_DOOR /* 0x00000004 */ (1 << 2)
|
||||
#define INTERACT_DAMAGE /* 0x00000008 */ (1 << 3)
|
||||
#define INTERACT_COIN /* 0x00000010 */ (1 << 4)
|
||||
#define INTERACT_CAP /* 0x00000020 */ (1 << 5)
|
||||
#define INTERACT_POLE /* 0x00000040 */ (1 << 6)
|
||||
#define INTERACT_KOOPA /* 0x00000080 */ (1 << 7)
|
||||
#define INTERACT_SPINY_WALKING /* 0x00000100 */ (1 << 8)
|
||||
#define INTERACT_BREAKABLE /* 0x00000200 */ (1 << 9)
|
||||
#define INTERACT_STRONG_WIND /* 0x00000400 */ (1 << 10)
|
||||
#define INTERACT_WARP_DOOR /* 0x00000800 */ (1 << 11)
|
||||
#define INTERACT_STAR_OR_KEY /* 0x00001000 */ (1 << 12)
|
||||
#define INTERACT_WARP /* 0x00002000 */ (1 << 13)
|
||||
#define INTERACT_CANNON_BASE /* 0x00004000 */ (1 << 14)
|
||||
#define INTERACT_BOUNCE_TOP /* 0x00008000 */ (1 << 15)
|
||||
#define INTERACT_WATER_RING /* 0x00010000 */ (1 << 16)
|
||||
#define INTERACT_BULLY /* 0x00020000 */ (1 << 17)
|
||||
#define INTERACT_FLAME /* 0x00040000 */ (1 << 18)
|
||||
#define INTERACT_KOOPA_SHELL /* 0x00080000 */ (1 << 19)
|
||||
#define INTERACT_BOUNCE_TOP2 /* 0x00100000 */ (1 << 20)
|
||||
#define INTERACT_MR_BLIZZARD /* 0x00200000 */ (1 << 21)
|
||||
#define INTERACT_HIT_FROM_BELOW /* 0x00400000 */ (1 << 22)
|
||||
#define INTERACT_TEXT /* 0x00800000 */ (1 << 23)
|
||||
#define INTERACT_TORNADO /* 0x01000000 */ (1 << 24)
|
||||
#define INTERACT_WHIRLPOOL /* 0x02000000 */ (1 << 25)
|
||||
#define INTERACT_CLAM_OR_BUBBA /* 0x04000000 */ (1 << 26)
|
||||
#define INTERACT_BBH_ENTRANCE /* 0x08000000 */ (1 << 27)
|
||||
#define INTERACT_SNUFIT_BULLET /* 0x10000000 */ (1 << 28)
|
||||
#define INTERACT_SHOCK /* 0x20000000 */ (1 << 29)
|
||||
#define INTERACT_IGLOO_BARRIER /* 0x40000000 */ (1 << 30)
|
||||
#define INTERACT_UNKNOWN_31 /* 0x80000000 */ (1 << 31)
|
||||
|
||||
#define INTERACT_MASK_NO_OBJ_COLLISIONS (INTERACT_COIN | INTERACT_CAP | INTERACT_STRONG_WIND | INTERACT_STAR_OR_KEY | INTERACT_WARP | INTERACT_WATER_RING | INTERACT_FLAME)
|
||||
|
||||
// INTERACT_WARP
|
||||
#define INT_SUBTYPE_FADING_WARP 0x00000001
|
||||
#define INT_SUBTYPE_FADING_WARP /* 0x00000001 */ (1 << 0)
|
||||
|
||||
// Damaging interactions
|
||||
#define INT_SUBTYPE_DELAY_INVINCIBILITY 0x00000002
|
||||
#define INT_SUBTYPE_BIG_KNOCKBACK 0x00000008 /* Used by Bowser, sets Mario's forward velocity to 40 on hit */
|
||||
#define INT_SUBTYPE_DELAY_INVINCIBILITY /* 0x00000002 */ (1 << 1)
|
||||
#define INT_SUBTYPE_BIG_KNOCKBACK /* 0x00000008 */ (1 << 3) /* Used by Bowser, sets Mario's forward velocity to 40 on hit */
|
||||
|
||||
// INTERACT_GRABBABLE
|
||||
#define INT_SUBTYPE_GRABS_MARIO 0x00000004 /* Also makes the object heavy */
|
||||
#define INT_SUBTYPE_HOLDABLE_NPC 0x00000010 /* Allows the object to be gently dropped, and sets vertical speed to 0 when dropped with no forwards velocity */
|
||||
#define INT_SUBTYPE_DROP_IMMEDIATELY 0x00000040 /* This gets set by grabbable NPCs that talk to Mario to make him drop them after the dialog is finished */
|
||||
#define INT_SUBTYPE_KICKABLE 0x00000100
|
||||
#define INT_SUBTYPE_NOT_GRABBABLE 0x00000200 /* Used by Heavy-Ho to allow it to throw Mario, without Mario being able to pick it up */
|
||||
#define INT_SUBTYPE_GRABS_MARIO /* 0x00000004 */ (1 << 2) /* Also makes the object heavy */
|
||||
#define INT_SUBTYPE_HOLDABLE_NPC /* 0x00000010 */ (1 << 4) /* Allows the object to be gently dropped, and sets vertical speed to 0 when dropped with no forwards velocity */
|
||||
#define INT_SUBTYPE_DROP_IMMEDIATELY /* 0x00000040 */ (1 << 6) /* This gets set by grabbable NPCs that talk to Mario to make him drop them after the dialog is finished */
|
||||
#define INT_SUBTYPE_KICKABLE /* 0x00000100 */ (1 << 8)
|
||||
#define INT_SUBTYPE_NOT_GRABBABLE /* 0x00000200 */ (1 << 9) /* Used by Heavy-Ho to allow it to throw Mario, without Mario being able to pick it up */
|
||||
|
||||
// INTERACT_DOOR
|
||||
#define INT_SUBTYPE_STAR_DOOR 0x00000020
|
||||
#define INT_SUBTYPE_STAR_DOOR /* 0x00000020 */ (1 << 5)
|
||||
|
||||
//INTERACT_BOUNCE_TOP
|
||||
#define INT_SUBTYPE_TWIRL_BOUNCE 0x00000080
|
||||
// INTERACT_BOUNCE_TOP
|
||||
#define INT_SUBTYPE_TWIRL_BOUNCE /* 0x00000080 */ (1 << 7)
|
||||
|
||||
// INTERACT_STAR_OR_KEY
|
||||
#define INT_SUBTYPE_NO_EXIT 0x00000400
|
||||
#define INT_SUBTYPE_GRAND_STAR 0x00000800
|
||||
#define INT_SUBTYPE_NO_EXIT /* 0x00000400 */ (1 << 10)
|
||||
#define INT_SUBTYPE_GRAND_STAR /* 0x00000800 */ (1 << 11)
|
||||
|
||||
// INTERACT_TEXT
|
||||
#define INT_SUBTYPE_SIGN 0x00001000
|
||||
#define INT_SUBTYPE_NPC 0x00004000
|
||||
#define INT_SUBTYPE_SIGN /* 0x00001000 */ (1 << 12)
|
||||
#define INT_SUBTYPE_NPC /* 0x00004000 */ (1 << 14)
|
||||
|
||||
// INTERACT_CLAM_OR_BUBBA
|
||||
#define INT_SUBTYPE_EATS_MARIO 0x00002000
|
||||
#define INT_SUBTYPE_EATS_MARIO /* 0x00002000 */ (1 << 13)
|
||||
|
||||
|
||||
#define ATTACK_PUNCH 1
|
||||
#define ATTACK_KICK_OR_TRIP 2
|
||||
#define ATTACK_FROM_ABOVE 3
|
||||
#define ATTACK_GROUND_POUND_OR_TWIRL 4
|
||||
#define ATTACK_FAST_ATTACK 5
|
||||
#define ATTACK_FROM_BELOW 6
|
||||
#define ATTACK_PUNCH 0x01
|
||||
#define ATTACK_KICK_OR_TRIP 0x02
|
||||
#define ATTACK_FROM_ABOVE 0x03
|
||||
#define ATTACK_GROUND_POUND_OR_TWIRL 0x04
|
||||
#define ATTACK_FAST_ATTACK 0x05
|
||||
#define ATTACK_FROM_BELOW 0x06
|
||||
|
||||
#define INT_STATUS_ATTACK_MASK 0x000000FF
|
||||
#define INT_STATUS_ATTACK_MASK 0x000000FF
|
||||
|
||||
// Mario Interaction Status
|
||||
#define INT_STATUS_NONE (0 << 0) /* 0x00000000 */
|
||||
#define INT_STATUS_MARIO_STUNNED (1 << 0) /* 0x00000001 */
|
||||
#define INT_STATUS_MARIO_KNOCKBACK_DMG (1 << 1) /* 0x00000002 */
|
||||
#define INT_STATUS_MARIO_UNK2 (1 << 2) /* 0x00000004 */
|
||||
@@ -114,7 +115,7 @@ void mario_throw_held_object(struct MarioState *m);
|
||||
void mario_stop_riding_and_holding(struct MarioState *m);
|
||||
u32 does_mario_have_normal_cap_on_head(struct MarioState *m);
|
||||
void mario_blow_off_cap(struct MarioState *m, f32 capSpeed);
|
||||
u32 mario_lose_cap_to_enemy(u32 arg);
|
||||
u32 mario_lose_cap_to_enemy(u32 enemyType);
|
||||
void mario_retrieve_cap(void);
|
||||
struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType);
|
||||
u32 mario_check_object_grab(struct MarioState *m);
|
||||
|
||||
+6
-18
@@ -1245,13 +1245,8 @@ void debug_print_speed_action_normal(struct MarioState *m) {
|
||||
* Update the button inputs for Mario.
|
||||
*/
|
||||
void update_mario_button_inputs(struct MarioState *m) {
|
||||
if (m->controller->buttonPressed & A_BUTTON) {
|
||||
m->input |= INPUT_A_PRESSED;
|
||||
}
|
||||
|
||||
if (m->controller->buttonDown & A_BUTTON) {
|
||||
m->input |= INPUT_A_DOWN;
|
||||
}
|
||||
if (m->controller->buttonPressed & A_BUTTON) m->input |= INPUT_A_PRESSED;
|
||||
if (m->controller->buttonDown & A_BUTTON) m->input |= INPUT_A_DOWN;
|
||||
|
||||
#ifdef CUSTOM_DEBUG
|
||||
if (m->controller->buttonPressed & L_JPAD) {
|
||||
@@ -1272,17 +1267,10 @@ void update_mario_button_inputs(struct MarioState *m) {
|
||||
|
||||
// Don't update for these buttons if squished.
|
||||
if (m->squishTimer == 0) {
|
||||
if (m->controller->buttonPressed & B_BUTTON) {
|
||||
m->input |= INPUT_B_PRESSED;
|
||||
}
|
||||
|
||||
if (m->controller->buttonDown & Z_TRIG) {
|
||||
m->input |= INPUT_Z_DOWN;
|
||||
}
|
||||
|
||||
if (m->controller->buttonPressed & Z_TRIG) {
|
||||
m->input |= INPUT_Z_PRESSED;
|
||||
}
|
||||
if (m->controller->buttonDown & B_BUTTON) m->input |= INPUT_B_DOWN;
|
||||
if (m->controller->buttonPressed & B_BUTTON) m->input |= INPUT_B_PRESSED;
|
||||
if (m->controller->buttonDown & Z_TRIG ) m->input |= INPUT_Z_DOWN;
|
||||
if (m->controller->buttonPressed & Z_TRIG ) m->input |= INPUT_Z_PRESSED;
|
||||
}
|
||||
|
||||
if (m->input & INPUT_A_PRESSED) {
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ f32 find_floor_height_relative_polar(struct MarioState *m, s16 angleFromMario, f
|
||||
s16 find_floor_slope(struct MarioState *m, s16 yawOffset);
|
||||
void update_mario_sound_and_camera(struct MarioState *m);
|
||||
void set_steep_jump_action(struct MarioState *m);
|
||||
u32 set_mario_action(struct MarioState *, u32 action, u32 actionArg);
|
||||
u32 set_mario_action(struct MarioState *m, u32 action, u32 actionArg);
|
||||
s32 set_jump_from_landing(struct MarioState *m);
|
||||
s32 set_jumping_action(struct MarioState *m, u32 action, u32 actionArg);
|
||||
s32 drop_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg);
|
||||
|
||||
@@ -1787,7 +1787,7 @@ u32 common_landing_action(struct MarioState *m, s16 animation, u32 airAction) {
|
||||
}
|
||||
|
||||
s32 common_landing_cancels(struct MarioState *m, struct LandingAction *landingAction,
|
||||
s32 (*setAPressAction)(struct MarioState *, u32, u32)) {
|
||||
s32 (*setAPressAction)(struct MarioState *m, u32, u32)) {
|
||||
//! Everything here, including floor steepness, is checked before checking
|
||||
// if Mario is actually on the floor. This leads to e.g. remote sliding.
|
||||
|
||||
|
||||
@@ -1080,7 +1080,7 @@ s32 check_common_stationary_cancels(struct MarioState *m) {
|
||||
return drop_and_set_mario_action(m, ACT_SQUISHED, 0);
|
||||
}
|
||||
|
||||
if (m->action != ACT_UNKNOWN_0002020E) {
|
||||
if (m->action != ACT_NO_STANDING_DEATH) {
|
||||
if (m->health < 0x100) {
|
||||
update_mario_sound_and_camera(m);
|
||||
return drop_and_set_mario_action(m, ACT_STANDING_DEATH, 0);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
static s8 sBbhStairJiggleOffsets[] = { -8, 8, -4, 4 };
|
||||
static s8 sLevelsWithRooms[] = { LEVEL_BBH, LEVEL_CASTLE, LEVEL_HMC, -1 };
|
||||
|
||||
static s32 clear_move_flag(u32 *, s32);
|
||||
static s32 clear_move_flag(u32 * bitSet, s32 flag);
|
||||
|
||||
#define o gCurrentObject
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
s16 gMatStackIndex;
|
||||
Mat4 gMatStack[32];
|
||||
Mtx *gMatStackFixed[32];
|
||||
f32 aspect;
|
||||
f32 sAspectRatio;
|
||||
f32 gWorldScale = 1.0f;
|
||||
|
||||
/**
|
||||
@@ -402,15 +402,15 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
|
||||
if (node->fnNode.node.children != NULL) {
|
||||
u16 perspNorm;
|
||||
Mtx *mtx = alloc_display_list(sizeof(*mtx));
|
||||
#ifdef WIDE
|
||||
#ifdef WIDE
|
||||
if (gConfig.widescreen && (gCurrLevelNum != 0x01)){
|
||||
aspect = (16.0f / 9.0f); // 1.775f
|
||||
sAspectRatio = (16.0f / 9.0f); // 1.775f
|
||||
} else {
|
||||
aspect = (4.0f / 3.0f); // 1.33333f
|
||||
sAspectRatio = (4.0f / 3.0f); // 1.33333f
|
||||
}
|
||||
#else
|
||||
aspect = (4.0f / 3.0f); // 1.33333f
|
||||
#endif
|
||||
#else
|
||||
sAspectRatio = (4.0f / 3.0f); // 1.33333f
|
||||
#endif
|
||||
|
||||
if (gCamera) {
|
||||
gWorldScale = ((sqr(gCamera->pos[0]) + sqr(gCamera->pos[1]) + sqr(gCamera->pos[2])) / sqr(0x2000));
|
||||
@@ -419,7 +419,7 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
|
||||
gWorldScale = 1.0f;
|
||||
}
|
||||
|
||||
guPerspective(mtx, &perspNorm, node->fov, aspect, (node->far/300) / gWorldScale, node->far / gWorldScale, 1.0f);
|
||||
guPerspective(mtx, &perspNorm, node->fov, sAspectRatio, (node->far/300) / gWorldScale, node->far / gWorldScale, 1.0f);
|
||||
gSPPerspNormalize(gDisplayListHead++, perspNorm);
|
||||
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||
@@ -437,15 +437,10 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
|
||||
* range of this node.
|
||||
*/
|
||||
static void geo_process_level_of_detail(struct GraphNodeLevelOfDetail *node) {
|
||||
f32 distanceFromCam;
|
||||
#ifdef AUTO_LOD
|
||||
if (gIsConsole) {
|
||||
distanceFromCam = -gMatStack[gMatStackIndex][3][2];
|
||||
} else {
|
||||
distanceFromCam = 50;
|
||||
}
|
||||
f32 distanceFromCam = (gIsConsole ? -gMatStack[gMatStackIndex][3][2] : 50);
|
||||
#else
|
||||
distanceFromCam = -gMatStack[gMatStackIndex][3][2];
|
||||
f32 distanceFromCam = -gMatStack[gMatStackIndex][3][2];
|
||||
#endif
|
||||
|
||||
if ((f32)node->minDistance <= distanceFromCam && distanceFromCam < (f32)node->maxDistance) {
|
||||
@@ -477,7 +472,6 @@ static void geo_process_switch(struct GraphNodeSwitchCase *node) {
|
||||
|
||||
static void make_roll_matrix(Mtx *mtx, s32 angle) {
|
||||
Mat4 temp;
|
||||
|
||||
mtxf_identity(temp);
|
||||
temp[0][0] = coss(angle);
|
||||
temp[0][1] = sins(angle);
|
||||
@@ -992,7 +986,7 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
|
||||
|
||||
geo = node->sharedChild;
|
||||
|
||||
halfFov = ((gCurGraphNodeCamFrustum->fov * aspect) / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
|
||||
halfFov = ((gCurGraphNodeCamFrustum->fov * sAspectRatio) / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
|
||||
|
||||
hScreenEdge = -matrix[3][2] * sins(halfFov) / coss(halfFov);
|
||||
// -matrix[3][2] is the depth, which gets multiplied by tan(halfFov) to get
|
||||
@@ -1002,7 +996,7 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
|
||||
// This multiplication should really be performed on 4:3 as well,
|
||||
// but the issue will be more apparent on widescreen.
|
||||
// HackerSM64: This multiplication is done regardless of aspect ratio to fix object pop-in on the edges of the screen (which happens at 4:3 too)
|
||||
hScreenEdge *= GFX_DIMENSIONS_ASPECT_RATIO;
|
||||
// hScreenEdge *= GFX_DIMENSIONS_ASPECT_RATIO;
|
||||
|
||||
if (geo != NULL && geo->type == GRAPH_NODE_TYPE_CULLING_RADIUS) {
|
||||
cullingRadius = ((struct GraphNodeCullingRadius *) geo)->cullingRadius;
|
||||
@@ -1011,7 +1005,7 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
|
||||
}
|
||||
|
||||
// Don't render if the object is close to or behind the camera
|
||||
if (matrix[3][2] > -100.0f + cullingRadius) {
|
||||
if (matrix[3][2] > (-100.0f + cullingRadius)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1019,15 +1013,15 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
|
||||
// makes PU travel safe when the camera is locked on the main map.
|
||||
// If Mario were rendered with a depth over 65536 it would cause overflow
|
||||
// when converting the transformation matrix to a fixed point matrix.
|
||||
if (matrix[3][2] < -20000.0f - cullingRadius) {
|
||||
if (matrix[3][2] < (-20000.0f - cullingRadius)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Check whether the object is horizontally in view
|
||||
if (matrix[3][0] > hScreenEdge + cullingRadius) {
|
||||
if (matrix[3][0] > (hScreenEdge + cullingRadius)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (matrix[3][0] < -hScreenEdge - cullingRadius) {
|
||||
if (matrix[3][0] < (-hScreenEdge - cullingRadius)) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@@ -1052,8 +1046,7 @@ static void geo_process_object(struct Object *node) {
|
||||
mtxf_mul(gMatStack[gMatStackIndex + 1], mtxf, gMatStack[gMatStackIndex]);
|
||||
}
|
||||
|
||||
mtxf_scale_vec3f(gMatStack[gMatStackIndex + 1], gMatStack[gMatStackIndex + 1],
|
||||
node->header.gfx.scale);
|
||||
mtxf_scale_vec3f(gMatStack[gMatStackIndex + 1], gMatStack[gMatStackIndex + 1], node->header.gfx.scale);
|
||||
node->header.gfx.throwMatrix = &gMatStack[++gMatStackIndex];
|
||||
node->header.gfx.cameraToObject[0] = gMatStack[gMatStackIndex][3][0];
|
||||
node->header.gfx.cameraToObject[1] = gMatStack[gMatStackIndex][3][1];
|
||||
@@ -1070,14 +1063,11 @@ static void geo_process_object(struct Object *node) {
|
||||
gMatStackFixed[gMatStackIndex] = mtx;
|
||||
if (node->header.gfx.sharedChild != NULL) {
|
||||
#ifdef VISUAL_DEBUG
|
||||
if (hitboxView)
|
||||
{
|
||||
Vec3f bnds1;
|
||||
Vec3f bnds2;
|
||||
//This will create a cylinder that visualises their hitbox.
|
||||
//If they do not have a hitbox, it will be a small white cube instead.
|
||||
if (node->oIntangibleTimer != -1)
|
||||
{
|
||||
if (hitboxView) {
|
||||
Vec3f bnds1, bnds2;
|
||||
// This will create a cylinder that visualises their hitbox.
|
||||
// If they do not have a hitbox, it will be a small white cube instead.
|
||||
if (node->oIntangibleTimer != -1) {
|
||||
vec3f_set(bnds1, node->oPosX, node->oPosY - node->hitboxDownOffset, node->oPosZ);
|
||||
vec3f_set(bnds2, node->hitboxRadius, node->hitboxHeight-node->hitboxDownOffset, node->hitboxRadius);
|
||||
debug_box_color(0x800000FF);
|
||||
@@ -1086,13 +1076,11 @@ static void geo_process_object(struct Object *node) {
|
||||
vec3f_set(bnds2, node->hurtboxRadius, node->hurtboxHeight, node->hurtboxRadius);
|
||||
debug_box_color(0x8FF00000);
|
||||
debug_box(bnds1, bnds2, DEBUG_SHAPE_CYLINDER | DEBUG_UCODE_REJ);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
vec3f_set(bnds1, node->oPosX, node->oPosY - 15, node->oPosZ);
|
||||
vec3f_set(bnds2, 30, 30, 30);
|
||||
debug_box_color(0x80FFFFFF);
|
||||
debug_box(bnds1, bnds2, DEBUG_SHAPE_BOX | DEBUG_UCODE_REJ);
|
||||
debug_box(bnds1, bnds2, DEBUG_SHAPE_BOX | DEBUG_UCODE_REJ);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1270,8 +1258,7 @@ void geo_process_root(struct GraphNodeRoot *node, Vp *b, Vp *c, s32 clearColor)
|
||||
Mtx *initialMatrix;
|
||||
Vp *viewport = alloc_display_list(sizeof(*viewport));
|
||||
|
||||
gDisplayListHeap = alloc_only_pool_init(main_pool_available() - sizeof(struct AllocOnlyPool),
|
||||
MEMORY_POOL_LEFT);
|
||||
gDisplayListHeap = alloc_only_pool_init(main_pool_available() - sizeof(struct AllocOnlyPool), MEMORY_POOL_LEFT);
|
||||
initialMatrix = alloc_display_list(sizeof(*initialMatrix));
|
||||
gMatStackIndex = 0;
|
||||
gCurAnimType = 0;
|
||||
@@ -1300,8 +1287,7 @@ void geo_process_root(struct GraphNodeRoot *node, Vp *b, Vp *c, s32 clearColor)
|
||||
}
|
||||
gCurGraphNodeRoot = NULL;
|
||||
if (gShowDebugText) {
|
||||
print_text_fmt_int(180, 36, "MEM %d",
|
||||
gDisplayListHeap->totalSpace - gDisplayListHeap->usedSpace);
|
||||
print_text_fmt_int(180, 36, "MEM %d", gDisplayListHeap->totalSpace - gDisplayListHeap->usedSpace);
|
||||
}
|
||||
main_pool_free(gDisplayListHeap);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
*/
|
||||
|
||||
// forward declarations
|
||||
void func_80179B64(struct ObjGroup *);
|
||||
void update_shaders(struct ObjShape *, struct GdVec3f *);
|
||||
void draw_shape_faces(struct ObjShape *);
|
||||
void register_light(struct ObjLight *);
|
||||
void func_80179B64(struct ObjGroup *group);
|
||||
void update_shaders(struct ObjShape *shape, struct GdVec3f *offset);
|
||||
void draw_shape_faces(struct ObjShape *shape);
|
||||
void register_light(struct ObjLight *light);
|
||||
|
||||
// types
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ void register_light(struct ObjLight *);
|
||||
*/
|
||||
enum SceneType {
|
||||
RENDER_SCENE = 26, ///< render the primitives to screen
|
||||
FIND_PICKS = 27 ///< only check position of primitives relative to cursor click
|
||||
FIND_PICKS = 27 ///< only check position of primitives relative to cursor click
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+35
-35
@@ -85,41 +85,41 @@ static char sDynNetNameSuffix[0x20]; // @ 801B9F48
|
||||
static char sStashedDynNameSuffix[0x100]; // @ 801B9F68
|
||||
|
||||
// necessary foreward declarations
|
||||
void d_add_net_with_subgroup(s32, DynObjName);
|
||||
void d_end_net_with_subgroup(DynObjName);
|
||||
void d_attach_joint_to_net(s32, DynObjName);
|
||||
void d_addto_group(DynObjName);
|
||||
void d_link_with(DynObjName);
|
||||
void d_link_with_ptr(void *);
|
||||
void d_set_normal(f32, f32, f32);
|
||||
void d_make_vertex(struct GdVec3f *);
|
||||
void d_set_rotation(f32, f32, f32);
|
||||
void d_center_of_gravity(f32, f32, f32);
|
||||
void d_set_shape_offset(f32, f32, f32);
|
||||
void d_clear_flags(s32);
|
||||
void d_attach(DynObjName);
|
||||
void d_attach_to(s32, struct GdObj *);
|
||||
void d_attachto_dynid(s32, DynObjName);
|
||||
void d_set_att_offset(const struct GdVec3f *);
|
||||
void d_set_nodegroup(DynObjName);
|
||||
void d_set_matgroup(DynObjName);
|
||||
void d_set_skinshape(DynObjName);
|
||||
void d_set_planegroup(DynObjName);
|
||||
void d_set_shapeptr(DynObjName);
|
||||
void d_friction(f32, f32, f32);
|
||||
void d_set_spring(f32);
|
||||
void d_set_ambient(f32, f32, f32);
|
||||
void d_set_control_type(s32);
|
||||
void d_set_skin_weight(s32, f32);
|
||||
void d_set_id(s32);
|
||||
void d_set_material(void *, s32);
|
||||
void d_map_materials(DynObjName);
|
||||
void d_map_vertices(DynObjName);
|
||||
void d_set_texture_st(f32, f32);
|
||||
void d_use_texture(void *);
|
||||
void d_make_netfromshapeid(DynObjName);
|
||||
void d_make_netfromshape_ptrptr(struct ObjShape **);
|
||||
void add_to_dynobj_list(struct GdObj *, DynObjName);
|
||||
void d_add_net_with_subgroup(s32 a0, DynObjName name);
|
||||
void d_end_net_with_subgroup(DynObjName name);
|
||||
void d_attach_joint_to_net(s32 arg0, DynObjName name);
|
||||
void d_addto_group(DynObjName name);
|
||||
void d_link_with(DynObjName name);
|
||||
void d_link_with_ptr(void *ptr);
|
||||
void d_set_normal(f32 x, f32 y, f32 z);
|
||||
void d_make_vertex(struct GdVec3f *pos);
|
||||
void d_set_rotation(f32 x, f32 y, f32 z);
|
||||
void d_center_of_gravity(f32 x, f32 y, f32 z);
|
||||
void d_set_shape_offset(f32 x, f32 y, f32 z);
|
||||
void d_clear_flags(s32 flags);
|
||||
void d_attach(DynObjName name);
|
||||
void d_attach_to(s32 flag, struct GdObj *obj);
|
||||
void d_attachto_dynid(s32 flag, DynObjName name);
|
||||
void d_set_att_offset(const struct GdVec3f *off);
|
||||
void d_set_nodegroup(DynObjName name);
|
||||
void d_set_matgroup(DynObjName name);
|
||||
void d_set_skinshape(DynObjName name);
|
||||
void d_set_planegroup(DynObjName name);
|
||||
void d_set_shapeptr(DynObjName name);
|
||||
void d_friction(f32 x, f32 y, f32 z);
|
||||
void d_set_spring(f32 spring);
|
||||
void d_set_ambient(f32 r, f32 g, f32 b);
|
||||
void d_set_control_type(s32 ctrlType);
|
||||
void d_set_skin_weight(s32 vtxId, f32 percentWeight);
|
||||
void d_set_id(s32 id);
|
||||
void d_set_material(void *a0, s32 mtlId);
|
||||
void d_map_materials(DynObjName name);
|
||||
void d_map_vertices(DynObjName name);
|
||||
void d_set_texture_st(f32 s, f32 t);
|
||||
void d_use_texture(void *texture);
|
||||
void d_make_netfromshapeid(DynObjName name);
|
||||
void d_make_netfromshape_ptrptr(struct ObjShape **shapePtr);
|
||||
void add_to_dynobj_list(struct GdObj *newObj, DynObjName name);
|
||||
|
||||
/**
|
||||
* Store the active dynamic `GdObj` into a one object stash.
|
||||
|
||||
@@ -20,10 +20,10 @@ static struct GMemBlock *sUsedBlockListHead;
|
||||
static struct GMemBlock *sEmptyBlockListHead;
|
||||
|
||||
/* Forward Declarations */
|
||||
void empty_mem_block(struct GMemBlock *);
|
||||
struct GMemBlock *into_free_memblock(struct GMemBlock *);
|
||||
struct GMemBlock *make_mem_block(u32, u8);
|
||||
u32 print_list_stats(struct GMemBlock *, s32, s32);
|
||||
void empty_mem_block(struct GMemBlock *block);
|
||||
struct GMemBlock *into_free_memblock(struct GMemBlock *block);
|
||||
struct GMemBlock *make_mem_block(u32 blockType, u8 permFlag);
|
||||
u32 print_list_stats(struct GMemBlock *block, s32 printBlockInfo, s32 permanence);
|
||||
|
||||
/**
|
||||
* Empty a `GMemBlock` into a default state. This empty block
|
||||
|
||||
@@ -41,7 +41,7 @@ static struct GdVec3f D_801BAAD0;
|
||||
static struct GdVec3f D_801BAAE0;
|
||||
|
||||
// forward declarations
|
||||
void set_joint_vecs(struct ObjJoint *, f32, f32, f32);
|
||||
void set_joint_vecs(struct ObjJoint *j, f32 x, f32 y, f32 z);
|
||||
|
||||
/**
|
||||
* Controls movement of grabbable joints
|
||||
|
||||
@@ -41,15 +41,14 @@ static s32 D_801A8238[5] = {
|
||||
static struct ObjFace *D_801B9EF0;
|
||||
|
||||
// fn declarations
|
||||
struct Connection *make_connection(struct ObjVertex *, struct ObjVertex *);
|
||||
void Unknown80181D14(struct ObjFace *);
|
||||
void func_80181EB0(struct Connection *);
|
||||
void func_80182088(struct Connection *);
|
||||
void move_particle(struct ObjParticle *);
|
||||
struct Connection *make_connection(struct ObjVertex *, struct ObjVertex *);
|
||||
int func_80182778(struct ObjParticle *);
|
||||
void func_80182A08(struct ObjParticle *, struct GdVec3f *b);
|
||||
void func_801838D0(struct ObjParticle *);
|
||||
struct Connection *make_connection(struct ObjVertex *vtx1, struct ObjVertex *vtx2);
|
||||
void Unknown80181D14(struct ObjFace *face);
|
||||
void func_80181EB0(struct Connection *cxn);
|
||||
void func_80182088(struct Connection *cxn);
|
||||
void move_particle(struct ObjParticle *ptc);
|
||||
int func_80182778(struct ObjParticle *ptc);
|
||||
void func_80182A08(struct ObjParticle *ptc, struct GdVec3f *b);
|
||||
void func_801838D0(struct ObjParticle *ptc);
|
||||
void Unknown801835C8(struct ObjParticle *ptc);
|
||||
|
||||
static void connect_vertices(struct ObjVertex *vtx1, struct ObjVertex *vtx2) {
|
||||
|
||||
@@ -690,15 +690,15 @@ extern u8 _gd_dynlistsSegmentRomStart[];
|
||||
extern u8 _gd_dynlistsSegmentRomEnd[];
|
||||
|
||||
// forward declarations
|
||||
u32 new_gddl_from(Gfx *, s32);
|
||||
void gd_setup_cursor(struct ObjGroup *);
|
||||
u32 new_gddl_from(Gfx *dl, s32 arg1);
|
||||
void gd_setup_cursor(struct ObjGroup *parentgrp);
|
||||
void parse_p1_controller(void);
|
||||
void update_cursor(void);
|
||||
void update_view_and_dl(struct ObjView *);
|
||||
void update_view_and_dl(struct ObjView *view);
|
||||
static void update_render_mode(void);
|
||||
void gddl_is_loading_shine_dl(s32);
|
||||
void func_801A3370(f32, f32, f32);
|
||||
void gd_put_sprite(u16 *, s32, s32, s32, s32);
|
||||
void gddl_is_loading_shine_dl(s32 dlLoad);
|
||||
void func_801A3370(f32 x, f32 y, f32 z);
|
||||
void gd_put_sprite(u16 *sprite, s32 x, s32 y, s32 wx, s32 wy);
|
||||
void reset_cur_dl_indices(void);
|
||||
|
||||
// TODO: make a gddl_num_t?
|
||||
|
||||
@@ -90,7 +90,7 @@ void set_light_id(s32 index);
|
||||
void set_light_num(s32 n);
|
||||
s32 create_mtl_gddl(s32 mtlType);
|
||||
void branch_to_gddl(s32 dlNum);
|
||||
void gd_dl_hilite(s32, struct ObjCamera *, struct GdVec3f *, struct GdVec3f *, struct GdVec3f *, struct GdColour *);
|
||||
void gd_dl_hilite(s32, struct ObjCamera *cam, struct GdVec3f *arg2, struct GdVec3f *arg3, struct GdVec3f *arg4, struct GdColour *colour);
|
||||
void gd_dl_hilite(s32 idx, struct ObjCamera *cam, UNUSED struct GdVec3f *arg2, UNUSED struct GdVec3f *arg3,
|
||||
struct GdVec3f *arg4, struct GdColour *colour);
|
||||
s32 gd_dl_material_lighting(s32 id, struct GdColour *colour, s32 material);
|
||||
|
||||
@@ -104,7 +104,7 @@ static struct ObjGroup *D_801BAD08; // group of planes from make_netfromshape
|
||||
static struct GdVec3f sShapeCenter; // printed with "c="
|
||||
|
||||
// Forward Declarations
|
||||
struct ObjMaterial *find_or_add_new_mtl(struct ObjGroup *, s32, f32, f32, f32);
|
||||
struct ObjMaterial *find_or_add_new_mtl(struct ObjGroup *group, s32 a1, f32 r, f32 g, f32 b);
|
||||
|
||||
/* @ 245A50 for 0x40 */
|
||||
/* Something to do with shape list/group initialization? */
|
||||
|
||||
Reference in new issue
Block a user