From f32d3a2ba7f853182d2ccf5f231cf0fc84d2bb68 Mon Sep 17 00:00:00 2001 From: MysterD Date: Mon, 3 Aug 2020 17:59:44 -0700 Subject: [PATCH] Added Luigi to courtyard and BoB, fixed some crashing issues --- compile.sh | 2 +- debug.sh | 2 +- levels/bob/script.c | 1 + levels/castle_courtyard/script.c | 1 + network.sh | 2 +- src/engine/graph_node.c | 1 + src/game/skybox.c | 2 ++ src/pc/controller/controller_keyboard.c | 8 ++++++++ 8 files changed, 16 insertions(+), 3 deletions(-) diff --git a/compile.sh b/compile.sh index 03993da5c..d3177b88e 100644 --- a/compile.sh +++ b/compile.sh @@ -1 +1 @@ -make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'run' -ex 'quit' \ No newline at end of file +make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' -ex 'run' -ex 'quit' \ No newline at end of file diff --git a/debug.sh b/debug.sh index 82627c9f3..2c8e38766 100644 --- a/debug.sh +++ b/debug.sh @@ -1 +1 @@ -make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break render_pause_courses_and_castle' \ No newline at end of file +make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' \ No newline at end of file diff --git a/levels/bob/script.c b/levels/bob/script.c index ce7bf54c4..325805b4d 100644 --- a/levels/bob/script.c +++ b/levels/bob/script.c @@ -66,6 +66,7 @@ const LevelScript level_bob_entry[] = { LOAD_RAW( /*seg*/ 0x0F, _common0_geoSegmentRomStart, _common0_geoSegmentRomEnd), ALLOC_LEVEL_POOL(), MARIO(/*model*/ MODEL_MARIO, /*behParam*/ 0x00000001, /*beh*/ bhvMario), + LUIGI(/*model*/ MODEL_LUIGI, /*behParam*/ 0x00000002, /*beh*/ bhvLuigi), JUMP_LINK(script_func_global_1), JUMP_LINK(script_func_global_4), JUMP_LINK(script_func_global_15), diff --git a/levels/castle_courtyard/script.c b/levels/castle_courtyard/script.c index c17cc21a4..a875ded6c 100644 --- a/levels/castle_courtyard/script.c +++ b/levels/castle_courtyard/script.c @@ -40,6 +40,7 @@ const LevelScript level_castle_courtyard_entry[] = { LOAD_RAW( /*seg*/ 0x0F, _common0_geoSegmentRomStart, _common0_geoSegmentRomEnd), ALLOC_LEVEL_POOL(), MARIO(/*model*/ MODEL_MARIO, /*behParam*/ 0x00000001, /*beh*/ bhvMario), + LUIGI(/*model*/ MODEL_LUIGI, /*behParam*/ 0x00000002, /*beh*/ bhvLuigi), JUMP_LINK(script_func_global_1), JUMP_LINK(script_func_global_10), LOAD_MODEL_FROM_GEO(MODEL_COURTYARD_SPIKY_TREE, spiky_tree_geo), diff --git a/network.sh b/network.sh index 0dbb36fc9..756245586 100644 --- a/network.sh +++ b/network.sh @@ -2,4 +2,4 @@ set -e make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 ./build/us_pc/sm64.us.f3dex2e.exe --server --configfile sm64config_server.txt & #./build/us_pc/sm64.us.f3dex2e.exe --client --configfile sm64config_client.txt & -winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'run --client --configfile sm64config_client.txt' -ex 'quit' +winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' -ex 'run --client --configfile sm64config_client.txt' -ex 'quit' diff --git a/src/engine/graph_node.c b/src/engine/graph_node.c index 4a6495c08..62b6b331b 100644 --- a/src/engine/graph_node.c +++ b/src/engine/graph_node.c @@ -794,6 +794,7 @@ s16 geo_update_animation_frame(struct GraphNodeObject_sub *obj, s32 *accelAssist struct Animation *anim; anim = obj->curAnim; + if (anim == NULL) { return obj->animFrame; } if (obj->animTimer == gAreaUpdateCounter || anim->flags & ANIM_FLAG_2) { if (accelAssist != NULL) { diff --git a/src/game/skybox.c b/src/game/skybox.c index 09deeaf05..233a1aa7c 100644 --- a/src/game/skybox.c +++ b/src/game/skybox.c @@ -221,6 +221,8 @@ void draw_skybox_tile_grid(Gfx **dlist, s8 background, s8 player, s8 colorIndex) for (row = 0; row < 3; row++) { for (col = 0; col < 3; col++) { s32 tileIndex = sSkyBoxInfo[player].upperLeftTile + row * SKYBOX_COLS + col; + // UGLY HACK: if the camera moves weird after a level transition this can go too high + if (tileIndex > 79) { tileIndex = 79; } const u8 *const texture = (*(SkyboxTexture *) segmented_to_virtual(sSkyboxTextures[background]))[tileIndex]; Vtx *vertices = make_skybox_rect(tileIndex, colorIndex); diff --git a/src/pc/controller/controller_keyboard.c b/src/pc/controller/controller_keyboard.c index da597328f..a9cda5a6a 100644 --- a/src/pc/controller/controller_keyboard.c +++ b/src/pc/controller/controller_keyboard.c @@ -85,7 +85,15 @@ static void keyboard_init(void) { #endif } +static void debug_breakpoint_here(void) { + // create easy breakpoint position for debugging +} + static void keyboard_read(OSContPad *pad) { + // create easy breakpoint position for debugging + if (keyboard_buttons_down & L_TRIG) { + debug_breakpoint_here(); + } pad->button |= keyboard_buttons_down; const u32 xstick = keyboard_buttons_down & STICK_XMASK; const u32 ystick = keyboard_buttons_down & STICK_YMASK;