From 54f2b3f4d557fa4ad09133987bf1485575dd771d Mon Sep 17 00:00:00 2001 From: Llennpie <44985633+Llennpie@users.noreply.github.com> Date: Mon, 27 Dec 2021 02:37:37 -0500 Subject: [PATCH] Added chroma key stage, animation player (with looping) --- levels/course_defines.h | 50 +++---- levels/level_defines.h | 76 +++++----- levels/sa/area_1/collision.inc.c | 27 ++++ levels/sa/area_1/geo.inc.c | 33 +++++ levels/sa/area_1/macro.inc.c | 4 + levels/sa/area_1/spline.inc.c | 0 levels/sa/geo.c | 2 + levels/sa/geo.inc.c | 1 + levels/sa/header.h | 3 + levels/sa/header.inc.h | 5 + levels/sa/leveldata.c | 2 + levels/sa/leveldata.inc.c | 4 + levels/sa/model.inc.c | 11 ++ levels/sa/script.c | 84 +++++------ src/.vscode/settings.json | 3 +- src/game/camera.c | 43 +++--- src/game/level_update.c | 1 + src/game/mario.c | 2 + src/game/mario_actions_stationary.c | 30 ++-- src/game/skybox.c | 12 ++ src/game/skybox.h | 2 + src/moon/imgui/imgui_impl.cpp | 54 +++++-- src/moon/saturn/saturn.cpp | 54 ++++++- src/moon/saturn/saturn.h | 7 + src/moon/saturn/saturn_animations.h | 216 ++++++++++++++++++++++++++++ src/moon/saturn/saturn_colors.cpp | 4 + src/moon/saturn/saturn_textures.cpp | 26 +--- src/moon/saturn/saturn_textures.h | 2 +- src/moon/saturn/saturn_types.h | 7 + src/pc/discord/discordrpc.cpp | 5 + 30 files changed, 600 insertions(+), 170 deletions(-) create mode 100644 levels/sa/area_1/collision.inc.c create mode 100644 levels/sa/area_1/geo.inc.c create mode 100644 levels/sa/area_1/macro.inc.c create mode 100644 levels/sa/area_1/spline.inc.c create mode 100644 levels/sa/geo.inc.c create mode 100644 levels/sa/header.inc.h create mode 100644 levels/sa/leveldata.inc.c create mode 100644 levels/sa/model.inc.c create mode 100644 src/moon/saturn/saturn_animations.h diff --git a/levels/course_defines.h b/levels/course_defines.h index 600cead4..08e09b35 100644 --- a/levels/course_defines.h +++ b/levels/course_defines.h @@ -10,30 +10,30 @@ * 3: Bowser keys and the grand star * 4: Default, used for 100 coin stars, 8 red coin stars in bowser levels, and secret stars */ -DEFINE_COURSE(COURSE_NONE, 0x44444440) // (0) Course Hub (Castle Grounds) -DEFINE_COURSE(COURSE_BOB, 0x00022240) // (1) Bob Omb Battlefield -DEFINE_COURSE(COURSE_WF, 0x00002040) // (2) Whomp's Fortress -DEFINE_COURSE(COURSE_JRB, 0x22222240) // (3) Jolly Rodger's Bay -DEFINE_COURSE(COURSE_CCM, 0x00220040) // (4) Cool Cool Mountain -DEFINE_COURSE(COURSE_BBH, 0x22222240) // (5) Big Boo's Haunt -DEFINE_COURSE(COURSE_HMC, 0x22222240) // (6) Hazy Maze Cave -DEFINE_COURSE(COURSE_LLL, 0x21212140) // (7) Lethal Lava Land -DEFINE_COURSE(COURSE_SSL, 0x20222240) // (8) Shifting Sand Land -DEFINE_COURSE(COURSE_DDD, 0x22222240) // (9) Dire Dire Docks -DEFINE_COURSE(COURSE_SL, 0x02020240) // (10) Snowman's Land -DEFINE_COURSE(COURSE_WDW, 0x22102240) // (11) Wet Dry World -DEFINE_COURSE(COURSE_TTM, 0x00000040) // (12) Tall Tall Mountain -DEFINE_COURSE(COURSE_THI, 0x11112140) // (13) Tiny Huge Island -DEFINE_COURSE(COURSE_TTC, 0x22222240) // (14) Tick Tock Clock -DEFINE_COURSE(COURSE_RR, 0x00000040) // (15) Rainbow Ride +DEFINE_COURSE(COURSE_NONE, 0x44444440) // (0) Course Hub (Castle Grounds) +DEFINE_COURSE(COURSE_BOB, 0x00022240) // (1) Bob Omb Battlefield +DEFINE_COURSE(COURSE_WF, 0x00002040) // (2) Whomp's Fortress +DEFINE_COURSE(COURSE_JRB, 0x22222240) // (3) Jolly Rodger's Bay +DEFINE_COURSE(COURSE_CCM, 0x00220040) // (4) Cool Cool Mountain +DEFINE_COURSE(COURSE_BBH, 0x22222240) // (5) Big Boo's Haunt +DEFINE_COURSE(COURSE_HMC, 0x22222240) // (6) Hazy Maze Cave +DEFINE_COURSE(COURSE_LLL, 0x21212140) // (7) Lethal Lava Land +DEFINE_COURSE(COURSE_SSL, 0x20222240) // (8) Shifting Sand Land +DEFINE_COURSE(COURSE_DDD, 0x22222240) // (9) Dire Dire Docks +DEFINE_COURSE(COURSE_SL, 0x02020240) // (10) Snowman's Land +DEFINE_COURSE(COURSE_WDW, 0x22102240) // (11) Wet Dry World +DEFINE_COURSE(COURSE_TTM, 0x00000040) // (12) Tall Tall Mountain +DEFINE_COURSE(COURSE_THI, 0x11112140) // (13) Tiny Huge Island +DEFINE_COURSE(COURSE_TTC, 0x22222240) // (14) Tick Tock Clock +DEFINE_COURSE(COURSE_RR, 0x00000040) // (15) Rainbow Ride DEFINE_COURSES_END() -DEFINE_BONUS_COURSE(COURSE_BITDW, 0x34444440) // (16) Bowser in the Dark World -DEFINE_BONUS_COURSE(COURSE_BITFS, 0x34444440) // (17) Bowser in the Fire Sea -DEFINE_BONUS_COURSE(COURSE_BITS, 0x34444440) // (18) Bowser in the Sky -DEFINE_BONUS_COURSE(COURSE_PSS, 0x24444440) // (19) Princess's Secret Slide -DEFINE_BONUS_COURSE(COURSE_COTMC, 0x44444440) // (20) Cavern of the Metal Cap -DEFINE_BONUS_COURSE(COURSE_TOTWC, 0x04444440) // (21) Tower of the Wing Cap -DEFINE_BONUS_COURSE(COURSE_VCUTM, 0x24444440) // (22) Vanish Cap Under the Moat -DEFINE_BONUS_COURSE(COURSE_WMOTR, 0x04444440) // (23) Winged Mario over the Rainbow -DEFINE_BONUS_COURSE(COURSE_SA, 0x24444440) // (24) Secret Aquarium +DEFINE_BONUS_COURSE(COURSE_BITDW, 0x34444440) // (16) Bowser in the Dark World +DEFINE_BONUS_COURSE(COURSE_BITFS, 0x34444440) // (17) Bowser in the Fire Sea +DEFINE_BONUS_COURSE(COURSE_BITS, 0x34444440) // (18) Bowser in the Sky +DEFINE_BONUS_COURSE(COURSE_PSS, 0x24444440) // (19) Princess's Secret Slide +DEFINE_BONUS_COURSE(COURSE_COTMC, 0x44444440) // (20) Cavern of the Metal Cap +DEFINE_BONUS_COURSE(COURSE_TOTWC, 0x04444440) // (21) Tower of the Wing Cap +DEFINE_BONUS_COURSE(COURSE_VCUTM, 0x24444440) // (22) Vanish Cap Under the Moat +DEFINE_BONUS_COURSE(COURSE_WMOTR, 0x04444440) // (23) Winged Mario over the Rainbow +DEFINE_BONUS_COURSE(COURSE_SA, 0x44444440) // (24) Secret Aquarium DEFINE_BONUS_COURSE(COURSE_CAKE_END, 0x44444440) // (25) The End (Cake Scene) diff --git a/levels/level_defines.h b/levels/level_defines.h index 8600717c..e96690cb 100644 --- a/levels/level_defines.h +++ b/levels/level_defines.h @@ -13,41 +13,41 @@ // NOTE: Be sure to edit sZoomOutAreaMasks in camera.c, as there isnt a good way to macro those right now. // TODO: Figure something out for sZoomOutAreaMasks? -STUB_LEVEL ("UNKNOWN", LEVEL_UNKNOWN_1, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _) -STUB_LEVEL ("UNKNOWN", LEVEL_UNKNOWN_2, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _) -STUB_LEVEL ("UNKNOWN", LEVEL_UNKNOWN_3, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _) -DEFINE_LEVEL("BIG BOO HAUNT", LEVEL_BBH, COURSE_BBH, bbh, spooky, 28000, 0x28, 0x28, 0x28, sDynBbh, sCamBBH) -DEFINE_LEVEL("COOL COOL MOUNTAIN", LEVEL_CCM, COURSE_CCM, ccm, snow, 17000, 0x10, 0x38, 0x38, _, sCamCCM) -DEFINE_LEVEL("CASTLE INSIDE", LEVEL_CASTLE, COURSE_NONE, castle_inside, inside, 20000, 0x20, 0x20, 0x30, _, sCamCastle) -DEFINE_LEVEL("HAZY MAZE CAVE", LEVEL_HMC, COURSE_HMC, hmc, cave, 16000, 0x28, 0x28, 0x28, sDynHmc, sCamHMC) -DEFINE_LEVEL("SHIFTING SAND LAND", LEVEL_SSL, COURSE_SSL, ssl, generic, 15000, 0x08, 0x30, 0x30, _, sCamSSL) -DEFINE_LEVEL("BOB OMB BATTLEFIELD", LEVEL_BOB, COURSE_BOB, bob, generic, 15000, 0x08, 0x08, 0x08, _, _) -DEFINE_LEVEL("SNOWMAN LAND", LEVEL_SL, COURSE_SL, sl, snow, 14000, 0x10, 0x28, 0x28, _, sCamSL) -DEFINE_LEVEL("WET DRY WORLD", LEVEL_WDW, COURSE_WDW, wdw, grass, 17000, 0x10, 0x18, 0x18, sDynWdw, _) -DEFINE_LEVEL("JOLLY ROGER BAY", LEVEL_JRB, COURSE_JRB, jrb, water, 20000, 0x10, 0x18, 0x18, sDynJrb, _) -DEFINE_LEVEL("TINY HUGE ISLAND", LEVEL_THI, COURSE_THI, thi, grass, 20000, 0x0c, 0x0c, 0x20, _, sCamTHI) -DEFINE_LEVEL("TICK TOCK CLOCK", LEVEL_TTC, COURSE_TTC, ttc, machine, 18000, 0x18, 0x18, 0x18, _, _) -DEFINE_LEVEL("RAINBOW RIDE", LEVEL_RR, COURSE_RR, rr, sky, 20000, 0x20, 0x20, 0x20, _, sCamRR) -DEFINE_LEVEL("CASTLE GROUNDS", LEVEL_CASTLE_GROUNDS, COURSE_NONE, castle_grounds, outside, 25000, 0x08, 0x08, 0x08, _, _) -DEFINE_LEVEL("BOWSER IN THE DARK WORLD", LEVEL_BITDW, COURSE_BITDW, bitdw, sky, 16000, 0x28, 0x28, 0x28, _, _) -DEFINE_LEVEL("VANISH CAP", LEVEL_VCUTM, COURSE_VCUTM, vcutm, outside, 30000, 0x28, 0x28, 0x28, _, _) -DEFINE_LEVEL("BOWSER IN THE FIRE SEA", LEVEL_BITFS, COURSE_BITFS, bitfs, sky, 16000, 0x28, 0x28, 0x28, _, _) -DEFINE_LEVEL("SECRET ACUARIUM", LEVEL_SA, COURSE_SA, sa, inside, 20000, 0x10, 0x10, 0x10, _, _) -DEFINE_LEVEL("BOWSER IN THE SKY", LEVEL_BITS, COURSE_BITS, bits, sky, 16000, 0x28, 0x28, 0x28, _, _) -DEFINE_LEVEL("LETHAL LAVA LAND", LEVEL_LLL, COURSE_LLL, lll, fire, 22000, 0x08, 0x30, 0x30, _, _) -DEFINE_LEVEL("DIRE DIRE DOCKS", LEVEL_DDD, COURSE_DDD, ddd, water, 17000, 0x10, 0x20, 0x20, sDynDdd, _) -DEFINE_LEVEL("WHOMP FORTRESS", LEVEL_WF, COURSE_WF, wf, grass, 13000, 0x08, 0x08, 0x08, _, _) -DEFINE_LEVEL("ENDING", LEVEL_ENDING, COURSE_CAKE_END, ending, generic, 20000, 0x00, 0x00, 0x00, _, _) -DEFINE_LEVEL("CASTLE COURTYARD", LEVEL_CASTLE_COURTYARD, COURSE_NONE, castle_courtyard, outside, 20000, 0x08, 0x08, 0x08, _, _) -DEFINE_LEVEL("PRINCESS SECRET SLIDE", LEVEL_PSS, COURSE_PSS, pss, mountain, 20000, 0x28, 0x28, 0x28, _, _) -DEFINE_LEVEL("IN THE FALL", LEVEL_COTMC, COURSE_COTMC, cotmc, cave, 18000, 0x28, 0x28, 0x28, _, sCamCotMC) -DEFINE_LEVEL("WING CAP", LEVEL_TOTWC, COURSE_TOTWC, totwc, sky, 20000, 0x20, 0x20, 0x20, _, _) -DEFINE_LEVEL("BITDW BOWSER", LEVEL_BOWSER_1, COURSE_BITDW, bowser_1, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _) -DEFINE_LEVEL("WING MARIO", LEVEL_WMOTR, COURSE_WMOTR, wmotr, generic, 20000, 0x28, 0x28, 0x28, _, _) -STUB_LEVEL ("UNKNOWN", LEVEL_UNKNOWN_32, COURSE_NONE, 20000, 0x70, 0x00, 0x00, _, _) -DEFINE_LEVEL("BITFS BOWSER", LEVEL_BOWSER_2, COURSE_BITFS, bowser_2, fire, VAL_DIFF, 0x40, 0x40, 0x40, _, _) -DEFINE_LEVEL("BITS BOWSER", LEVEL_BOWSER_3, COURSE_BITS, bowser_3, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _) -STUB_LEVEL ("UNKNOWN", LEVEL_UNKNOWN_35, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _) -DEFINE_LEVEL("TALL TALL MOUNTAIN", LEVEL_TTM, COURSE_TTM, ttm, mountain, 15000, 0x08, 0x08, 0x08, _, _) -STUB_LEVEL ("UNKNOWN", LEVEL_UNKNOWN_37, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _) -STUB_LEVEL ("UNKNOWN", LEVEL_UNKNOWN_38, COURSE_NONE, 20000, 0x00, 0x00, 0x00, sDynUnk38, _) +STUB_LEVEL("UNKNOWN", LEVEL_UNKNOWN_1, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _) +STUB_LEVEL("UNKNOWN", LEVEL_UNKNOWN_2, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _) +STUB_LEVEL("UNKNOWN", LEVEL_UNKNOWN_3, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _) +DEFINE_LEVEL("BIG BOO HAUNT", LEVEL_BBH, COURSE_BBH, bbh, spooky, 28000, 0x28, 0x28, 0x28, sDynBbh, sCamBBH) +DEFINE_LEVEL("COOL COOL MOUNTAIN", LEVEL_CCM, COURSE_CCM, ccm, snow, 17000, 0x10, 0x38, 0x38, _, sCamCCM) +DEFINE_LEVEL("CASTLE INSIDE", LEVEL_CASTLE, COURSE_NONE, castle_inside, inside, 20000, 0x20, 0x20, 0x30, _, sCamCastle) +DEFINE_LEVEL("HAZY MAZE CAVE", LEVEL_HMC, COURSE_HMC, hmc, cave, 16000, 0x28, 0x28, 0x28, sDynHmc, sCamHMC) +DEFINE_LEVEL("SHIFTING SAND LAND", LEVEL_SSL, COURSE_SSL, ssl, generic, 15000, 0x08, 0x30, 0x30, _, sCamSSL) +DEFINE_LEVEL("BOB OMB BATTLEFIELD", LEVEL_BOB, COURSE_BOB, bob, generic, 15000, 0x08, 0x08, 0x08, _, _) +DEFINE_LEVEL("SNOWMAN LAND", LEVEL_SL, COURSE_SL, sl, snow, 14000, 0x10, 0x28, 0x28, _, sCamSL) +DEFINE_LEVEL("WET DRY WORLD", LEVEL_WDW, COURSE_WDW, wdw, grass, 17000, 0x10, 0x18, 0x18, sDynWdw, _) +DEFINE_LEVEL("JOLLY ROGER BAY", LEVEL_JRB, COURSE_JRB, jrb, water, 20000, 0x10, 0x18, 0x18, sDynJrb, _) +DEFINE_LEVEL("TINY HUGE ISLAND", LEVEL_THI, COURSE_THI, thi, grass, 20000, 0x0c, 0x0c, 0x20, _, sCamTHI) +DEFINE_LEVEL("TICK TOCK CLOCK", LEVEL_TTC, COURSE_TTC, ttc, machine, 18000, 0x18, 0x18, 0x18, _, _) +DEFINE_LEVEL("RAINBOW RIDE", LEVEL_RR, COURSE_RR, rr, sky, 20000, 0x20, 0x20, 0x20, _, sCamRR) +DEFINE_LEVEL("CASTLE GROUNDS", LEVEL_CASTLE_GROUNDS, COURSE_NONE, castle_grounds, outside, 25000, 0x08, 0x08, 0x08, _, _) +DEFINE_LEVEL("BOWSER IN THE DARK WORLD", LEVEL_BITDW, COURSE_BITDW, bitdw, sky, 16000, 0x28, 0x28, 0x28, _, _) +DEFINE_LEVEL("VANISH CAP", LEVEL_VCUTM, COURSE_VCUTM, vcutm, outside, 30000, 0x28, 0x28, 0x28, _, _) +DEFINE_LEVEL("BOWSER IN THE FIRE SEA", LEVEL_BITFS, COURSE_BITFS, bitfs, sky, 16000, 0x28, 0x28, 0x28, _, _) +DEFINE_LEVEL("SECRET ACUARIUM", LEVEL_SA, COURSE_SA, sa, inside, 20000, 0x00, 0x00, 0x00, _, sCamSA) +DEFINE_LEVEL("BOWSER IN THE SKY", LEVEL_BITS, COURSE_BITS, bits, sky, 16000, 0x28, 0x28, 0x28, _, _) +DEFINE_LEVEL("LETHAL LAVA LAND", LEVEL_LLL, COURSE_LLL, lll, fire, 22000, 0x08, 0x30, 0x30, _, _) +DEFINE_LEVEL("DIRE DIRE DOCKS", LEVEL_DDD, COURSE_DDD, ddd, water, 17000, 0x10, 0x20, 0x20, sDynDdd, _) +DEFINE_LEVEL("WHOMP FORTRESS", LEVEL_WF, COURSE_WF, wf, grass, 13000, 0x08, 0x08, 0x08, _, _) +DEFINE_LEVEL("ENDING", LEVEL_ENDING, COURSE_CAKE_END, ending, generic, 20000, 0x00, 0x00, 0x00, _, _) +DEFINE_LEVEL("CASTLE COURTYARD", LEVEL_CASTLE_COURTYARD, COURSE_NONE, castle_courtyard, outside, 20000, 0x08, 0x08, 0x08, _, _) +DEFINE_LEVEL("PRINCESS SECRET SLIDE", LEVEL_PSS, COURSE_PSS, pss, mountain, 20000, 0x28, 0x28, 0x28, _, _) +DEFINE_LEVEL("IN THE FALL", LEVEL_COTMC, COURSE_COTMC, cotmc, cave, 18000, 0x28, 0x28, 0x28, _, sCamCotMC) +DEFINE_LEVEL("WING CAP", LEVEL_TOTWC, COURSE_TOTWC, totwc, sky, 20000, 0x20, 0x20, 0x20, _, _) +DEFINE_LEVEL("BITDW BOWSER", LEVEL_BOWSER_1, COURSE_BITDW, bowser_1, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _) +DEFINE_LEVEL("WING MARIO", LEVEL_WMOTR, COURSE_WMOTR, wmotr, generic, 20000, 0x28, 0x28, 0x28, _, _) +STUB_LEVEL("UNKNOWN", LEVEL_UNKNOWN_32, COURSE_NONE, 20000, 0x70, 0x00, 0x00, _, _) +DEFINE_LEVEL("BITFS BOWSER", LEVEL_BOWSER_2, COURSE_BITFS, bowser_2, fire, VAL_DIFF, 0x40, 0x40, 0x40, _, _) +DEFINE_LEVEL("BITS BOWSER", LEVEL_BOWSER_3, COURSE_BITS, bowser_3, generic, VAL_DIFF, 0x40, 0x40, 0x40, _, _) +STUB_LEVEL("UNKNOWN", LEVEL_UNKNOWN_35, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _) +DEFINE_LEVEL("TALL TALL MOUNTAIN", LEVEL_TTM, COURSE_TTM, ttm, mountain, 15000, 0x08, 0x08, 0x08, _, _) +STUB_LEVEL("UNKNOWN", LEVEL_UNKNOWN_37, COURSE_NONE, 20000, 0x00, 0x00, 0x00, _, _) +STUB_LEVEL("UNKNOWN", LEVEL_UNKNOWN_38, COURSE_NONE, 20000, 0x00, 0x00, 0x00, sDynUnk38, _) diff --git a/levels/sa/area_1/collision.inc.c b/levels/sa/area_1/collision.inc.c new file mode 100644 index 00000000..89c55842 --- /dev/null +++ b/levels/sa/area_1/collision.inc.c @@ -0,0 +1,27 @@ +const Collision sa_area_1_collision[] = { + COL_INIT(), + COL_VERTEX_INIT(8), + COL_VERTEX(6400, 100, -6400), + COL_VERTEX(-6400, 100, -6400), + COL_VERTEX(-6400, 100, 6400), + COL_VERTEX(6400, 100, 6400), + COL_VERTEX(6400, -100, 6400), + COL_VERTEX(-6400, -100, 6400), + COL_VERTEX(-6400, -100, -6400), + COL_VERTEX(6400, -100, -6400), + COL_TRI_INIT(SURFACE_DEFAULT, 12), + COL_TRI(0, 1, 2), + COL_TRI(0, 2, 3), + COL_TRI(4, 3, 2), + COL_TRI(4, 2, 5), + COL_TRI(5, 2, 1), + COL_TRI(5, 1, 6), + COL_TRI(6, 7, 4), + COL_TRI(6, 4, 5), + COL_TRI(7, 0, 3), + COL_TRI(7, 3, 4), + COL_TRI(6, 1, 0), + COL_TRI(6, 0, 7), + COL_TRI_STOP(), + COL_END() +}; diff --git a/levels/sa/area_1/geo.inc.c b/levels/sa/area_1/geo.inc.c new file mode 100644 index 00000000..3dc6136a --- /dev/null +++ b/levels/sa/area_1/geo.inc.c @@ -0,0 +1,33 @@ +#include "src/game/envfx_snow.h" + +const GeoLayout sa_area_1_geo[] = { + GEO_NODE_START(), + GEO_OPEN_NODE(), + GEO_CLOSE_NODE(), + GEO_RETURN(), +}; +const GeoLayout sa_area_1[] = { + GEO_NODE_SCREEN_AREA(10, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2), + GEO_OPEN_NODE(), + GEO_ZBUFFER(0), + GEO_OPEN_NODE(), + GEO_NODE_ORTHO(100.0000), + GEO_OPEN_NODE(), + GEO_BACKGROUND(BACKGROUND_ABOVE_CLOUDS, geo_skybox_main), + GEO_CLOSE_NODE(), + GEO_CLOSE_NODE(), + GEO_ZBUFFER(1), + GEO_OPEN_NODE(), + GEO_CAMERA_FRUSTUM_WITH_FUNC(45.0000, 100, 30000, geo_camera_fov), + GEO_OPEN_NODE(), + GEO_CAMERA(CAMERA_MODE_CLOSE, 0, 0, 0, 0, -100, 0, geo_camera_main), + GEO_OPEN_NODE(), + GEO_BRANCH(1, sa_area_1_geo), + GEO_RENDER_OBJ(), + GEO_ASM(ENVFX_MODE_NONE, geo_envfx_main), + GEO_CLOSE_NODE(), + GEO_CLOSE_NODE(), + GEO_CLOSE_NODE(), + GEO_CLOSE_NODE(), + GEO_END(), +}; diff --git a/levels/sa/area_1/macro.inc.c b/levels/sa/area_1/macro.inc.c new file mode 100644 index 00000000..acd1d92e --- /dev/null +++ b/levels/sa/area_1/macro.inc.c @@ -0,0 +1,4 @@ +const MacroObject sa_area_1_macro_objs[] = { + MACRO_OBJECT_END(), +}; + diff --git a/levels/sa/area_1/spline.inc.c b/levels/sa/area_1/spline.inc.c new file mode 100644 index 00000000..e69de29b diff --git a/levels/sa/geo.c b/levels/sa/geo.c index bcf1e782..cb36208d 100644 --- a/levels/sa/geo.c +++ b/levels/sa/geo.c @@ -14,3 +14,5 @@ #include "levels/sa/header.h" #include "levels/sa/areas/1/geo.inc.c" + +#include "levels/sa/geo.inc.c" diff --git a/levels/sa/geo.inc.c b/levels/sa/geo.inc.c new file mode 100644 index 00000000..72180f93 --- /dev/null +++ b/levels/sa/geo.inc.c @@ -0,0 +1 @@ +#include "levels/sa/area_1/geo.inc.c" diff --git a/levels/sa/header.h b/levels/sa/header.h index e8c5cf47..7c26f6f0 100644 --- a/levels/sa/header.h +++ b/levels/sa/header.h @@ -15,4 +15,7 @@ extern const MacroObject sa_seg7_macro_objs[]; // script extern const LevelScript level_sa_entry[]; + +#include "levels/sa/header.inc.h" + #endif diff --git a/levels/sa/header.inc.h b/levels/sa/header.inc.h new file mode 100644 index 00000000..d96de4ce --- /dev/null +++ b/levels/sa/header.inc.h @@ -0,0 +1,5 @@ +extern const GeoLayout sa_area_1_geo[]; +extern const GeoLayout sa_area_1[]; +extern const Collision sa_area_1_collision[]; +extern const MacroObject sa_area_1_macro_objs[]; +extern Gfx sa_dl_material_revert_render_settings[]; diff --git a/levels/sa/leveldata.c b/levels/sa/leveldata.c index a36715ee..07021abc 100644 --- a/levels/sa/leveldata.c +++ b/levels/sa/leveldata.c @@ -13,3 +13,5 @@ #include "levels/sa/areas/1/2/model.inc.c" #include "levels/sa/areas/1/collision.inc.c" #include "levels/sa/areas/1/macro.inc.c" + +#include "levels/sa/leveldata.inc.c" diff --git a/levels/sa/leveldata.inc.c b/levels/sa/leveldata.inc.c new file mode 100644 index 00000000..ecbdb5e5 --- /dev/null +++ b/levels/sa/leveldata.inc.c @@ -0,0 +1,4 @@ +#include "levels/sa/area_1/collision.inc.c" +#include "levels/sa/area_1/macro.inc.c" +#include "levels/sa/area_1/spline.inc.c" +#include "levels/sa/model.inc.c" diff --git a/levels/sa/model.inc.c b/levels/sa/model.inc.c new file mode 100644 index 00000000..22ffa41e --- /dev/null +++ b/levels/sa/model.inc.c @@ -0,0 +1,11 @@ +Gfx sa_dl_material_revert_render_settings[] = { + gsDPPipeSync(), + gsSPSetGeometryMode(G_LIGHTING), + gsSPClearGeometryMode(G_TEXTURE_GEN), + gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), + gsSPTexture(65535, 65535, 0, 0, 0), + gsDPSetEnvColor(255, 255, 255, 255), + gsDPSetAlphaCompare(G_AC_NONE), + gsSPEndDisplayList(), +}; + diff --git a/levels/sa/script.c b/levels/sa/script.c index 57dd3014..21879f13 100644 --- a/levels/sa/script.c +++ b/levels/sa/script.c @@ -3,6 +3,7 @@ #include "behavior_data.h" #include "model_ids.h" #include "seq_ids.h" +#include "dialog_ids.h" #include "segment_symbols.h" #include "level_commands.h" @@ -12,53 +13,52 @@ #include "actors/common1.h" +/* Fast64 begin persistent block [includes] */ +/* Fast64 end persistent block [includes] */ + #include "make_const_nonconst.h" #include "levels/sa/header.h" -static const LevelScript script_func_local_1[] = { - OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, -1000, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvLargeFishGroup), - OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, -1000, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00020000, /*beh*/ bhvLargeFishGroup), - RETURN(), -}; - -static const LevelScript script_func_local_2[] = { - OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, -4250, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvHiddenRedCoinStar), - RETURN(), -}; +/* Fast64 begin persistent block [scripts] */ +/* Fast64 end persistent block [scripts] */ const LevelScript level_sa_entry[] = { - INIT_LEVEL(), - LOAD_MIO0( /*seg*/ 0x07, _sa_segment_7SegmentRomStart, _sa_segment_7SegmentRomEnd), - LOAD_MIO0_TEXTURE(/*seg*/ 0x09, _inside_mio0SegmentRomStart, _inside_mio0SegmentRomEnd), - LOAD_MIO0( /*seg*/ 0x0A, _cloud_floor_skybox_mio0SegmentRomStart, _cloud_floor_skybox_mio0SegmentRomEnd), - LOAD_MIO0( /*seg*/ 0x0B, _effect_mio0SegmentRomStart, _effect_mio0SegmentRomEnd), - LOAD_MIO0( /*seg*/ 0x05, _group4_mio0SegmentRomStart, _group4_mio0SegmentRomEnd), - LOAD_RAW( /*seg*/ 0x0C, _group4_geoSegmentRomStart, _group4_geoSegmentRomEnd), - LOAD_MIO0( /*seg*/ 0x06, _group13_mio0SegmentRomStart, _group13_mio0SegmentRomEnd), - LOAD_RAW( /*seg*/ 0x0D, _group13_geoSegmentRomStart, _group13_geoSegmentRomEnd), - ALLOC_LEVEL_POOL(), - MARIO(/*model*/ MODEL_MARIO, /*behParam*/ 0x00000001, /*beh*/ bhvMario), - JUMP_LINK(script_func_global_5), - JUMP_LINK(script_func_global_14), + INIT_LEVEL(), + LOAD_MIO0(0x07, _sa_segment_7SegmentRomStart, _sa_segment_7SegmentRomEnd), + LOAD_MIO0_TEXTURE(0x09, _inside_mio0SegmentRomStart, _inside_mio0SegmentRomEnd), + LOAD_MIO0(0x0A, _clouds_skybox_mio0SegmentRomStart, _clouds_skybox_mio0SegmentRomEnd), + LOAD_MIO0(0x0B, _effect_mio0SegmentRomStart, _effect_mio0SegmentRomEnd), + LOAD_MIO0(0x05, _group4_mio0SegmentRomStart, _group4_mio0SegmentRomEnd), + LOAD_RAW(0x0C, _group4_geoSegmentRomStart, _group4_geoSegmentRomEnd), + LOAD_MIO0(0x06, _group13_mio0SegmentRomStart, _group13_mio0SegmentRomEnd), + LOAD_RAW(0x0D, _group13_geoSegmentRomStart, _group13_geoSegmentRomEnd), + ALLOC_LEVEL_POOL(), + MARIO(MODEL_MARIO, 0x00000001, bhvMario), + JUMP_LINK(script_func_global_5), + JUMP_LINK(script_func_global_14), - AREA(/*index*/ 1, sa_geo_000170), - OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, -1535, 0, /*angle*/ 0, 90, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvSwimmingWarp), - WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_SA, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT), - WARP_NODE(/*id*/ 0xF0, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x27, /*flags*/ WARP_NO_CHECKPOINT), - WARP_NODE(/*id*/ 0xF1, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x28, /*flags*/ WARP_NO_CHECKPOINT), - JUMP_LINK(script_func_local_1), - JUMP_LINK(script_func_local_2), - TERRAIN(/*terrainData*/ sa_seg7_collision), - MACRO_OBJECTS(/*objList*/ sa_seg7_macro_objs), - SET_BACKGROUND_MUSIC(/*settingsPreset*/ 0x0003, /*seq*/ (SEQ_LEVEL_WATER | SEQ_VARIATION)), - TERRAIN_TYPE(/*terrainType*/ TERRAIN_WATER), - END_AREA(), + /* Fast64 begin persistent block [level commands] */ + /* Fast64 end persistent block [level commands] */ - FREE_LEVEL_POOL(), - MARIO_POS(/*area*/ 1, /*yaw*/ 90, /*pos*/ 0, -1535, 0), - CALL(/*arg*/ 0, /*func*/ lvl_init_or_update), - CALL_LOOP(/*arg*/ 1, /*func*/ lvl_init_or_update), - CLEAR_LEVEL(), - SLEEP_BEFORE_EXIT(/*frames*/ 1), - EXIT(), + AREA(1, sa_area_1), + WARP_NODE(0x0A, LEVEL_BOB, 0x01, 0x0A, WARP_NO_CHECKPOINT), + WARP_NODE(0xF0, LEVEL_BOB, 0x01, 0x0A, WARP_NO_CHECKPOINT), + WARP_NODE(0xF1, LEVEL_BOB, 0x01, 0x0A, WARP_NO_CHECKPOINT), + OBJECT(MODEL_NONE, 0, 200, 0, 0, 0, 0, 0x000A0000, bhvSpinAirborneWarp), + MARIO_POS(0x01, 0, 0, 200, 0), + TERRAIN(sa_area_1_collision), + MACRO_OBJECTS(sa_area_1_macro_objs), + STOP_MUSIC(0), + TERRAIN_TYPE(TERRAIN_GRASS), + /* Fast64 begin persistent block [area commands] */ + /* Fast64 end persistent block [area commands] */ + END_AREA(), + + FREE_LEVEL_POOL(), + MARIO_POS(0x01, 0, 0, 200, 0), + CALL(0, lvl_init_or_update), + CALL_LOOP(1, lvl_init_or_update), + CLEAR_LEVEL(), + SLEEP_BEFORE_EXIT(1), + EXIT(), }; diff --git a/src/.vscode/settings.json b/src/.vscode/settings.json index b4426a9d..bbb6252d 100644 --- a/src/.vscode/settings.json +++ b/src/.vscode/settings.json @@ -70,6 +70,7 @@ "ranges": "cpp", "surface_collision.h": "c", "math_util.h": "c", - "controller_keyboard.h": "c" + "controller_keyboard.h": "c", + "saturn_animations.h": "c" } } \ No newline at end of file diff --git a/src/game/camera.c b/src/game/camera.c index 0448c868..75d35be3 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -6496,6 +6496,9 @@ struct CameraTrigger sCamBBH[] = { * * Each table is terminated with NULL_TRIGGER */ +struct CameraTrigger sCamSA[] = { + NULL_TRIGGER +}; struct CameraTrigger *sCameraTriggers[LEVEL_COUNT + 1] = { NULL, #include "levels/level_defines.h" @@ -10957,26 +10960,26 @@ u8 sDanceCutsceneIndexTable[][4] = { * and if the result is non-zero, the camera will zoom out. */ u8 sZoomOutAreaMasks[] = { - ZOOMOUT_AREA_MASK(0,0,0,0, 0,0,0,0), // Unused | Unused - ZOOMOUT_AREA_MASK(0,0,0,0, 0,0,0,0), // Unused | Unused - ZOOMOUT_AREA_MASK(0,0,0,0, 1,0,0,0), // BBH | CCM - ZOOMOUT_AREA_MASK(0,0,0,0, 0,0,0,0), // CASTLE_INSIDE | HMC - ZOOMOUT_AREA_MASK(1,0,0,0, 1,0,0,0), // SSL | BOB - ZOOMOUT_AREA_MASK(1,0,0,0, 1,0,0,0), // SL | WDW - ZOOMOUT_AREA_MASK(0,0,0,0, 1,1,0,0), // JRB | THI - ZOOMOUT_AREA_MASK(0,0,0,0, 1,0,0,0), // TTC | RR - ZOOMOUT_AREA_MASK(1,0,0,0, 1,0,0,0), // CASTLE_GROUNDS | BITDW - ZOOMOUT_AREA_MASK(0,0,0,0, 1,0,0,0), // VCUTM | BITFS - ZOOMOUT_AREA_MASK(0,0,0,0, 1,0,0,0), // SA | BITS - ZOOMOUT_AREA_MASK(1,0,0,0, 0,0,0,0), // LLL | DDD - ZOOMOUT_AREA_MASK(1,0,0,0, 0,0,0,0), // WF | ENDING - ZOOMOUT_AREA_MASK(0,0,0,0, 0,0,0,0), // COURTYARD | PSS - ZOOMOUT_AREA_MASK(0,0,0,0, 1,0,0,0), // COTMC | TOTWC - ZOOMOUT_AREA_MASK(1,0,0,0, 1,0,0,0), // BOWSER_1 | WMOTR - ZOOMOUT_AREA_MASK(0,0,0,0, 1,0,0,0), // Unused | BOWSER_2 - ZOOMOUT_AREA_MASK(1,0,0,0, 0,0,0,0), // BOWSER_3 | Unused - ZOOMOUT_AREA_MASK(1,0,0,0, 0,0,0,0), // TTM | Unused - ZOOMOUT_AREA_MASK(0,0,0,0, 0,0,0,0), // Unused | Unused + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 0, 0, 0, 0), // Unused | Unused + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 0, 0, 0, 0), // Unused | Unused + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 1, 0, 0, 0), // BBH | CCM + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 0, 0, 0, 0), // CASTLE_INSIDE | HMC + ZOOMOUT_AREA_MASK(1, 0, 0, 0, 1, 0, 0, 0), // SSL | BOB + ZOOMOUT_AREA_MASK(1, 0, 0, 0, 1, 0, 0, 0), // SL | WDW + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 1, 1, 0, 0), // JRB | THI + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 1, 0, 0, 0), // TTC | RR + ZOOMOUT_AREA_MASK(1, 0, 0, 0, 1, 0, 0, 0), // CASTLE_GROUNDS | BITDW + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 1, 0, 0, 0), // VCUTM | BITFS + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 1, 0, 0, 0), // SA | BITS + ZOOMOUT_AREA_MASK(1, 0, 0, 0, 0, 0, 0, 0), // LLL | DDD + ZOOMOUT_AREA_MASK(1, 0, 0, 0, 0, 0, 0, 0), // WF | ENDING + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 0, 0, 0, 0), // COURTYARD | PSS + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 1, 0, 0, 0), // COTMC | TOTWC + ZOOMOUT_AREA_MASK(1, 0, 0, 0, 1, 0, 0, 0), // BOWSER_1 | WMOTR + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 1, 0, 0, 0), // Unused | BOWSER_2 + ZOOMOUT_AREA_MASK(1, 0, 0, 0, 0, 0, 0, 0), // BOWSER_3 | Unused + ZOOMOUT_AREA_MASK(1, 0, 0, 0, 0, 0, 0, 0), // TTM | Unused + ZOOMOUT_AREA_MASK(0, 0, 0, 0, 0, 0, 0, 0), // Unused | Unused }; STATIC_ASSERT(ARRAY_COUNT(sZoomOutAreaMasks) - 1 == LEVEL_MAX / 2, "Make sure you edit sZoomOutAreaMasks when adding / removing courses."); diff --git a/src/game/level_update.c b/src/game/level_update.c index e464145c..99e10861 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -1272,6 +1272,7 @@ s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) { D_8032C9E0 = 0; gCurrLevelNum = levelNum; gCurrCourseNum = gLevelToCourseNumTable[levelNum - 1]; + if (gCurrLevelNum == LEVEL_SA) return 0; if (gCurrDemoInput != NULL || gCurrCreditsEntry != NULL || gCurrCourseNum == COURSE_NONE) { return 0; diff --git a/src/game/mario.c b/src/game/mario.c index c7dac42c..7c3d1f4c 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -69,6 +69,8 @@ s32 is_anim_past_end(struct MarioState *m) { * Sets Mario's animation without any acceleration, running at its default rate. */ s16 set_mario_animation(struct MarioState *m, s32 targetAnimID) { + if (is_anim_playing) return; + struct Object *o = m->marioObj; struct Animation *targetAnim = m->animation->targetAnim; diff --git a/src/game/mario_actions_stationary.c b/src/game/mario_actions_stationary.c index d2bfba1d..0126990e 100644 --- a/src/game/mario_actions_stationary.c +++ b/src/game/mario_actions_stationary.c @@ -134,26 +134,32 @@ s32 act_idle(struct MarioState *m) { } else { switch (m->actionState) { case 0: - if (enable_head_rotations) { - set_mario_animation(m, MARIO_ANIM_IDLE_HEAD_LEFT); - } else { - set_mario_animation(m, MARIO_ANIM_FIRST_PERSON); + if (!is_anim_playing) { + if (enable_head_rotations) { + set_mario_animation(m, MARIO_ANIM_IDLE_HEAD_LEFT); + } else { + set_mario_animation(m, MARIO_ANIM_FIRST_PERSON); + } } break; case 1: - if (enable_head_rotations) { - set_mario_animation(m, MARIO_ANIM_IDLE_HEAD_RIGHT); - } else { - set_mario_animation(m, MARIO_ANIM_FIRST_PERSON); + if (!is_anim_playing) { + if (enable_head_rotations) { + set_mario_animation(m, MARIO_ANIM_IDLE_HEAD_RIGHT); + } else { + set_mario_animation(m, MARIO_ANIM_FIRST_PERSON); + } } break; case 2: - if (enable_head_rotations) { - set_mario_animation(m, MARIO_ANIM_IDLE_HEAD_CENTER); - } else { - set_mario_animation(m, MARIO_ANIM_FIRST_PERSON); + if (!is_anim_playing) { + if (enable_head_rotations) { + set_mario_animation(m, MARIO_ANIM_IDLE_HEAD_CENTER); + } else { + set_mario_animation(m, MARIO_ANIM_FIRST_PERSON); + } } break; } diff --git a/src/game/skybox.c b/src/game/skybox.c index 6bcf3ec7..1eb7657a 100644 --- a/src/game/skybox.c +++ b/src/game/skybox.c @@ -10,6 +10,8 @@ #include "segment2.h" #include "sm64.h" +#include "moon/saturn/saturn_types.h" + /** * @file skybox.c @@ -190,6 +192,16 @@ Vtx *make_skybox_rect(s32 tileIndex, s8 colorIndex) { } s16 ty = ((tileIndex / SKYBOX_COLS) * h) % SKYBOX_IMAGE_SIZE; + //if (gCurrLevelNum == LEVEL_SA) { + sSkyboxColors[colorIndex][0] = defaultColorChromaKeyR; + sSkyboxColors[colorIndex][1] = defaultColorChromaKeyG; + sSkyboxColors[colorIndex][2] = defaultColorChromaKeyB; + //} else { + // sSkyboxColors[colorIndex][0] = 255; + // sSkyboxColors[colorIndex][0] = 255; + // sSkyboxColors[colorIndex][0] = 255; + //} + if (verts != NULL) { make_vertex(verts, 0, x, y, -1, tx << 5, ty << 5, sSkyboxColors[colorIndex][0], sSkyboxColors[colorIndex][1], sSkyboxColors[colorIndex][2], 255); make_vertex(verts, 1, x, y - SKYBOX_TILE_HEIGHT, -1, tx << 5, (ty + w) << 5, sSkyboxColors[colorIndex][0], sSkyboxColors[colorIndex][1], sSkyboxColors[colorIndex][2], 255); diff --git a/src/game/skybox.h b/src/game/skybox.h index 39220447..f2eed43f 100644 --- a/src/game/skybox.h +++ b/src/game/skybox.h @@ -4,6 +4,8 @@ #include #include +#include "moon/saturn/saturn_types.h" + Gfx *create_skybox_facing_camera(s8 player, s8 background, f32 fov, f32 posX, f32 posY, f32 posZ, f32 focX, f32 focY, f32 focZ); diff --git a/src/moon/imgui/imgui_impl.cpp b/src/moon/imgui/imgui_impl.cpp index fc51e006..9e2ed33c 100644 --- a/src/moon/imgui/imgui_impl.cpp +++ b/src/moon/imgui/imgui_impl.cpp @@ -17,6 +17,7 @@ #include "moon/saturn/saturn_colors.h" #include "moon/saturn/saturn_textures.h" #include "moon/saturn/saturn_types.h" +#include "moon/saturn/saturn_animations.h" #include "icons/IconsForkAwesome.h" #include "icons/IconsMaterialDesign.h" #include "moon/utils/moon-env.h" @@ -73,6 +74,7 @@ extern "C" { #include "pc/pc_main.h" #include "game/camera.h" #include "game/mario.h" +#include "game/area.h" #include "game/level_update.h" #include "engine/level_script.h" #include "level_table.h" @@ -183,6 +185,7 @@ namespace MoonInternal { static ImVec4 uiSkinShadeColor = ImVec4(127.0f / 255.0f, 96.0f / 255.0f, 60.0f / 255.0f, 255.0f / 255.0f); static ImVec4 uiHairColor = ImVec4(115.0f / 255.0f, 6.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f); static ImVec4 uiHairShadeColor = ImVec4(57.0f / 255.0f, 3.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f); + static ImVec4 uiChromaKeyColor = ImVec4(0.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f); string cc_name; static char cc_gameshark[1024 * 16] = ""; @@ -192,6 +195,8 @@ namespace MoonInternal { int tempXRes; int tempYRes; + int anim_index = 113; + int selected_eye_item = 0; int selected_emblem_item = 1; @@ -496,9 +501,9 @@ namespace MoonInternal { ImGui::Dummy(ImVec2(0, 5)); const char* levelList[] = { - "Castle Grounds", "Castle Inside", "Bob-omb Battlefield", + "Castle Grounds", "Castle Inside", "Chroma Key Stage", "Bob-omb Battlefield", "Whomp's Fortress", "Princess's Secret Slide", "Tower of the Wing Cap", - "Jolly Roger Bay", "Secret Aquarium", "Cool, Cool Mountain", + "Jolly Roger Bay", "Cool, Cool Mountain", "Bowser in the Dark World", "Big Boo's Haunt", "Hazy Maze Cave", "Cavern of the Metal Cap", "Lethal Lava Land", "Shifting Sand Land", "Vanish Cap under the Moat", "Dire, Dire Docks", "Bowser in the Fire Sea", @@ -517,22 +522,22 @@ namespace MoonInternal { warp_to(LEVEL_CASTLE, 0x01, 0x01); break; case 2: - warp_to(LEVEL_BOB); + warp_to(LEVEL_SA); break; case 3: - warp_to(LEVEL_WF); + warp_to(LEVEL_BOB); break; case 4: - warp_to(LEVEL_PSS); + warp_to(LEVEL_WF); break; case 5: - warp_to(LEVEL_TOTWC); + warp_to(LEVEL_PSS); break; case 6: - warp_to(LEVEL_JRB); + warp_to(LEVEL_TOTWC); break; case 7: - warp_to(LEVEL_SA); + warp_to(LEVEL_JRB); break; case 8: warp_to(LEVEL_CCM); @@ -895,10 +900,20 @@ namespace MoonInternal { custom_sideburn_name = "saturn/sideburns/" + sideburn_array[current_sideburn_id]; saturn_sideburn_swap(); } - ImGui::Dummy(ImVec2(0, 5)); } } + ImGui::Dummy(ImVec2(0, 10)); + + ImGui::Text("Play Animation"); + ImGui::Combo("###animation_combo", &anim_index, saturn_animations, IM_ARRAYSIZE(saturn_animations)); + selected_animation = (MarioAnimID)anim_index; + if (ImGui::Button("Play###play_animation_button")) { + MoonInternal::saturn_play_animation(selected_animation); + } + ImGui::SameLine(); + ImGui::Checkbox("Loop###loop_animation", &loop_animation); + ImGui::End(); ImGui::PopStyleColor(); } @@ -1133,6 +1148,26 @@ namespace MoonInternal { ImGui::PopStyleColor(); } + if (gCurrLevelNum == LEVEL_SA && show_menu_bar) { + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + ImGui::Begin("Chroma Key Stage", NULL, ImGuiWindowFlags_None); + + ImGui::Text("Background Color"); + ImGui::ColorEdit4("Chroma Key Color", (float*)&uiChromaKeyColor, ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_NoLabel); + if (ImGui::IsItemActivated()) accept_input = false; + if (ImGui::IsItemDeactivated()) accept_input = true; + + if (ImGui::Button("Set###set_background_color")) { + defaultColorChromaKeyR = (int)(uiChromaKeyColor.x * 255); + defaultColorChromaKeyG = (int)(uiChromaKeyColor.y * 255); + defaultColorChromaKeyB = (int)(uiChromaKeyColor.z * 255); + } + + ImGui::End(); + ImGui::PopStyleColor(); + } + + /* if(configImGui.texture_debug && show_menu_bar) { ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); ImGui::Begin("Loaded textures", NULL, ImGuiWindowFlags_None); @@ -1173,6 +1208,7 @@ namespace MoonInternal { ImGui::End(); ImGui::PopStyleColor(); } + */ ImGui::Render(); GLint last_program; diff --git a/src/moon/saturn/saturn.cpp b/src/moon/saturn/saturn.cpp index 3ce3efa6..6d9ac127 100644 --- a/src/moon/saturn/saturn.cpp +++ b/src/moon/saturn/saturn.cpp @@ -27,10 +27,12 @@ extern "C" { #include "game/camera.h" #include "game/level_update.h" #include "game/mario.h" +#include "game/area.h" #include "sm64.h" #include "game/behavior_actions.h" #include "game/behaviors/yoshi.inc.h" #include "pc/cheats.h" +#include } bool camera_frozen; @@ -45,10 +47,15 @@ float camera_speed = 0.8f; bool enable_night_skybox; bool enable_yoshi; +enum MarioAnimID selected_animation = MARIO_ANIM_BREAKDANCE; +bool is_anim_playing; +bool loop_animation; + // Second Check -bool has_changed_night_skybox; +bool has_changed_chroma_sky; bool has_changed_yoshi; +int every_other; namespace MoonInternal { @@ -62,6 +69,13 @@ namespace MoonInternal { current_eye_state += cycle; } + // Play Animation + + void saturn_play_animation(MarioAnimID anim) { + set_mario_animation(gMarioState, anim); + is_anim_playing = true; + } + // Setup Module void setupSaturnModule(string status){ @@ -114,6 +128,10 @@ namespace MoonInternal { if (accept_input) freeze_camera(); } + if(ev->key.keysym.sym == SDLK_g){ + if (accept_input) + saturn_play_animation(selected_animation); + } if(ev->key.keysym.sym == SDLK_F1){ show_menu_bar = !show_menu_bar; } @@ -121,9 +139,13 @@ namespace MoonInternal { if (ev->cbutton.button == SDL_CONTROLLER_BUTTON_DPAD_UP) { freeze_camera(); } + if(ev->cbutton.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT){ + saturn_play_animation(selected_animation); + } if(ev->cbutton.button == SDL_CONTROLLER_BUTTON_BACK){ show_menu_bar = !show_menu_bar; } + break; } }}); @@ -149,6 +171,36 @@ namespace MoonInternal { } */ + // Animations + + if (is_anim_playing && is_anim_at_end(gMarioState)) { + if (loop_animation) { + gMarioState->marioObj->header.gfx.unk38.animFrame = 0; + } else { + is_anim_playing = false; + } + } + if (is_anim_playing && selected_animation != gMarioState->marioObj->header.gfx.unk38.animID) { + is_anim_playing = false; + } + + // Chroma Key + + if (gCurrLevelNum == LEVEL_SA && !has_changed_chroma_sky) { + has_changed_chroma_sky = true; + saturn_chroma_sky_swap(); + defaultColorChromaKeyR = 0; + defaultColorChromaKeyG = 255; + defaultColorChromaKeyB = 0; + } + if (gCurrLevelNum != LEVEL_SA && has_changed_chroma_sky) { + has_changed_chroma_sky = false; + saturn_chroma_sky_swap(); + defaultColorChromaKeyR = 255; + defaultColorChromaKeyG = 255; + defaultColorChromaKeyB = 255; + } + // Yoshi enableYoshi = (enable_yoshi) ? 1 : 0; diff --git a/src/moon/saturn/saturn.h b/src/moon/saturn/saturn.h index d8926a74..67fd0297 100644 --- a/src/moon/saturn/saturn.h +++ b/src/moon/saturn/saturn.h @@ -4,9 +4,14 @@ #include #include +#include + +extern enum MarioAnimID selected_animation; + namespace MoonInternal { void setupSaturnModule(std::string status); void freeze_camera(); + void saturn_play_animation(MarioAnimID); } extern bool camera_frozen; @@ -18,4 +23,6 @@ extern float camera_speed; extern bool enable_night_skybox; extern bool enable_yoshi; +extern bool has_changed_chroma_sky; + #endif \ No newline at end of file diff --git a/src/moon/saturn/saturn_animations.h b/src/moon/saturn/saturn_animations.h new file mode 100644 index 00000000..d100bc11 --- /dev/null +++ b/src/moon/saturn/saturn_animations.h @@ -0,0 +1,216 @@ +#ifndef SaturnAnimations +#define SaturnAnimations + +extern const char* saturn_animations[] = { + "SLOW_LEDGE_GRAB", + "FALL_OVER_BACKWARDS", + "BACKWARD_AIR_KB", + "DYING_ON_BACK", + "BACKFLIP", + "CLIMB_UP_POLE", + "GRAB_POLE_SHORT", + "GRAB_POLE_SWING_PART1", + "GRAB_POLE_SWING_PART2", + "HANDSTAND_IDLE", + "HANDSTAND_JUMP", + "START_HANDSTAND", + "RETURN_FROM_HANDSTAND", + "IDLE_ON_POLE", + "A_POSE", + "SKID_ON_GROUND", + "STOP_SKID", + "CROUCH_FROM_FAST_LONGJUMP", + "CROUCH_FROM_SLOW_LONGJUMP", + "FAST_LONGJUMP", + "SLOW_LONGJUMP", + "AIRBORNE_ON_STOMACH", + "WALK_WITH_LIGHT_OBJ", + "RUN_WITH_LIGHT_OBJ", + "SLOW_WALK_WITH_LIGHT_OBJ", + "SHIVERING_WARMING_HAND", + "SHIVERING_RETURN_TO_IDLE", + "SHIVERING", + "CLIMB_DOWN_LEDGE", + "CREDITS_WAVING", + "CREDITS_LOOK_UP", + "CREDITS_RETURN_FROM_LOOK_UP", + "CREDITS_RAISE_HAND", + "CREDITS_LOWER_HAND", + "CREDITS_TAKE_OFF_CAP", + "CREDITS_START_WALK_LOOK_UP", + "CREDITS_LOOK_BACK_THEN_RUN", + "FINAL_BOWSER_RAISE_HAND_SPIN", + "FINAL_BOWSER_WING_CAP_TAKE_OFF", + "CREDITS_PEACE_SIGN", + "STAND_UP_FROM_LAVA_BOOST", + "FIRE_LAVA_BURN", + "WING_CAP_FLY", + "HANG_ON_OWL", + "LAND_ON_STOMACH", + "AIR_FORWARD_KB", + "DYING_ON_STOMACH", + "SUFFOCATING", + "COUGHING", + "THROW_CATCH_KEY", + "DYING_FALL_OVER", + "IDLE_ON_LEDGE", + "FAST_LEDGE_GRAB", + "HANG_ON_CEILING", + "PUT_CAP_ON", + "TAKE_CAP_OFF_THEN_ON", + "QUICKLY_PUT_CAP_ON", // unused + "HEAD_STUCK_IN_GROUND", + "GROUND_POUND_LANDING", + "TRIPLE_JUMP_GROUND_POUND", + "START_GROUND_POUND", + "GROUND_POUND", + "BOTTOM_STUCK_IN_GROUND", + "IDLE_WITH_LIGHT_OBJ", + "JUMP_LAND_WITH_LIGHT_OBJ", + "JUMP_WITH_LIGHT_OBJ", + "FALL_LAND_WITH_LIGHT_OBJ", + "FALL_WITH_LIGHT_OBJ", + "FALL_FROM_SLIDING_WITH_LIGHT_OBJ", + "SLIDING_ON_BOTTOM_WITH_LIGHT_OBJ", + "STAND_UP_FROM_SLIDING_WITH_LIGHT_OBJ", + "RIDING_SHELL", + "WALKING", + "FORWARD_FLIP", // unused + "JUMP_RIDING_SHELL", + "LAND_FROM_DOUBLE_JUMP", + "DOUBLE_JUMP_FALL", + "SINGLE_JUMP", + "LAND_FROM_SINGLE_JUMP", + "AIR_KICK", + "DOUBLE_JUMP_RISE", + "START_FORWARD_SPINNING", // unused + "THROW_LIGHT_OBJECT", + "FALL_FROM_SLIDE_KICK", + "BEND_KNESS_RIDING_SHELL", // unused + "LEGS_STUCK_IN_GROUND", + "GENERAL_FALL", + "GENERAL_LAND", + "BEING_GRABBED", + "GRAB_HEAVY_OBJECT", + "SLOW_LAND_FROM_DIVE", + "FLY_FROM_CANNON", + "MOVE_ON_WIRE_NET_RIGHT", + "MOVE_ON_WIRE_NET_LEFT", + "MISSING_CAP", + "PULL_DOOR_WALK_IN", + "PUSH_DOOR_WALK_IN", + "UNLOCK_DOOR", + "START_REACH_POCKET", // unused", reaching keys maybe? + "REACH_POCKET", // unused + "STOP_REACH_POCKET", // unused + "GROUND_THROW", + "GROUND_KICK", + "FIRST_PUNCH", + "SECOND_PUNCH", + "FIRST_PUNCH_FAST", + "SECOND_PUNCH_FAST", + "PICK_UP_LIGHT_OBJ", + "PUSHING", + "START_RIDING_SHELL", + "PLACE_LIGHT_OBJ", + "FORWARD_SPINNING", + "BACKWARD_SPINNING", + "BREAKDANCE", + "RUNNING", + "RUNNING_UNUSED", // unused duplicate", originally part 2? + "SOFT_BACK_KB", + "SOFT_FRONT_KB", + "DYING_IN_QUICKSAND", + "IDLE_IN_QUICKSAND", + "MOVE_IN_QUICKSAND", + "ELECTROCUTION", + "SHOCKED", + "BACKWARD_KB", + "FORWARD_KB", + "IDLE_HEAVY_OBJ", + "STAND_AGAINST_WALL", + "SIDESTEP_LEFT", + "SIDESTEP_RIGHT", + "START_SLEEP_IDLE", + "START_SLEEP_SCRATCH", + "START_SLEEP_YAWN", + "START_SLEEP_SITTING", + "SLEEP_IDLE", + "SLEEP_START_LYING", + "SLEEP_LYING", + "DIVE", + "SLIDE_DIVE", + "GROUND_BONK", + "STOP_SLIDE_LIGHT_OBJ", + "SLIDE_KICK", + "CROUCH_FROM_SLIDE_KICK", + "SLIDE_MOTIONLESS", // unused + "STOP_SLIDE", + "FALL_FROM_SLIDE", + "SLIDE", + "TIPTOE", + "TWIRL_LAND", + "TWIRL", + "START_TWIRL", + "STOP_CROUCHING", + "START_CROUCHING", + "CROUCHING", + "CRAWLING", + "STOP_CRAWLING", + "START_CRAWLING", + "SUMMON_STAR", + "RETURN_STAR_APPROACH_DOOR", + "BACKWARDS_WATER_KB", + "SWIM_WITH_OBJ_PART1", + "SWIM_WITH_OBJ_PART2", + "FLUTTERKICK_WITH_OBJ", + "WATER_ACTION_END_WITH_OBJ", // either swimming or flutterkicking + "STOP_GRAB_OBJ_WATER", + "WATER_IDLE_WITH_OBJ", + "DROWNING_PART1", + "DROWNING_PART2", + "WATER_DYING", + "WATER_FORWARD_KB", + "FALL_FROM_WATER", + "SWIM_PART1", + "SWIM_PART2", + "FLUTTERKICK", + "WATER_ACTION_END", // either swimming or flutterkicking + "WATER_PICK_UP_OBJ", + "WATER_GRAB_OBJ_PART2", + "WATER_GRAB_OBJ_PART1", + "WATER_THROW_OBJ", + "WATER_IDLE", + "WATER_STAR_DANCE", + "RETURN_FROM_WATER_STAR_DANCE", + "GRAB_BOWSER", + "SWINGING_BOWSER", + "RELEASE_BOWSER", + "HOLDING_BOWSER", + "HEAVY_THROW", + "WALK_PANTING", + "WALK_WITH_HEAVY_OBJ", + "TURNING_PART1", + "TURNING_PART2", + "SLIDEFLIP_LAND", + "SLIDEFLIP", + "TRIPLE_JUMP_LAND", + "TRIPLE_JUMP", + "FIRST_PERSON", + "IDLE_HEAD_LEFT", + "IDLE_HEAD_RIGHT", + "IDLE_HEAD_CENTER", + "HANDSTAND_LEFT", + "HANDSTAND_RIGHT", + "WAKE_FROM_SLEEP", + "WAKE_FROM_LYING", + "START_TIPTOE", + "SLIDEJUMP", // pole jump and wall kick + "START_WALLKICK", + "STAR_DANCE", + "RETURN_FROM_STAR_DANCE", + "FORWARD_SPINNING_FLIP", + "TRIPLE_JUMP_FLY" +}; + +#endif \ No newline at end of file diff --git a/src/moon/saturn/saturn_colors.cpp b/src/moon/saturn/saturn_colors.cpp index 9fb5449f..aa3a9461 100644 --- a/src/moon/saturn/saturn_colors.cpp +++ b/src/moon/saturn/saturn_colors.cpp @@ -69,6 +69,10 @@ unsigned int defaultColorHairGDark = 3; unsigned int defaultColorHairBLight = 0; unsigned int defaultColorHairBDark = 0; +unsigned int defaultColorChromaKeyR = 255; +unsigned int defaultColorChromaKeyG = 255; +unsigned int defaultColorChromaKeyB = 255; + // Color Codes namespace MoonInternal { diff --git a/src/moon/saturn/saturn_textures.cpp b/src/moon/saturn/saturn_textures.cpp index e5699fcc..ca7740df 100644 --- a/src/moon/saturn/saturn_textures.cpp +++ b/src/moon/saturn/saturn_textures.cpp @@ -193,32 +193,16 @@ void saturn_load_sideburn_array() { } } -void saturn_sky_swap() { +void saturn_chroma_sky_swap() { Moon::registerHookListener({.hookName = TEXTURE_BIND, .callback = [](HookCall call) { char* *hookTexture = reinterpret_cast(call.baseArgs["texture"]); string texName = string(*hookTexture); - if(texName.find("textures/skyboxes/") != string::npos) { - if (custom_sky_name != "default") { - (*hookTexture) = const_cast(custom_sky_name.c_str()); + if(texName == "textures/skyboxes/clouds.rgba16") { + if (has_changed_chroma_sky) { + (*hookTexture) = const_cast("saturn/white"); } else { (*hookTexture) = const_cast(texName.c_str()); } } }}); -} - -/* -void saturn_toggle_night_skybox() { - Moon::registerHookListener({.hookName = TEXTURE_BIND, .callback = [](HookCall call) { - char* *hookTexture = reinterpret_cast(call.baseArgs["texture"]); - string texName = string(*hookTexture); - if(texName.find("textures/skyboxes/") != string::npos) { - if (enable_night_skybox) { - (*hookTexture) = const_cast("night_skybox"); - } else { - (*hookTexture) = const_cast(texName.c_str()); - } - } - }}); -} -*/ \ No newline at end of file +} \ No newline at end of file diff --git a/src/moon/saturn/saturn_textures.h b/src/moon/saturn/saturn_textures.h index 1a9782f8..3f8fc33d 100644 --- a/src/moon/saturn/saturn_textures.h +++ b/src/moon/saturn/saturn_textures.h @@ -29,7 +29,7 @@ void saturn_sideburn_swap(void); void saturn_load_sideburn_array(void); void saturn_toggle_m_cap(void); void saturn_toggle_m_buttons(void); -void saturn_sky_swap(void); +void saturn_chroma_sky_swap(void); //void saturn_toggle_night_skybox(void); #endif \ No newline at end of file diff --git a/src/moon/saturn/saturn_types.h b/src/moon/saturn/saturn_types.h index 08244fdd..0dd5d537 100644 --- a/src/moon/saturn/saturn_types.h +++ b/src/moon/saturn/saturn_types.h @@ -3,6 +3,9 @@ #include +extern bool is_anim_playing; +extern bool loop_animation; + extern bool enable_head_rotations; extern bool enable_shadows; extern bool enable_god; @@ -52,4 +55,8 @@ extern unsigned int defaultColorHairGDark; extern unsigned int defaultColorHairBLight; extern unsigned int defaultColorHairBDark; +extern unsigned int defaultColorChromaKeyR; +extern unsigned int defaultColorChromaKeyG; +extern unsigned int defaultColorChromaKeyB; + #endif \ No newline at end of file diff --git a/src/pc/discord/discordrpc.cpp b/src/pc/discord/discordrpc.cpp index 86311440..55753cce 100644 --- a/src/pc/discord/discordrpc.cpp +++ b/src/pc/discord/discordrpc.cpp @@ -19,6 +19,7 @@ extern "C" { #include "pc/platform.h" #include "game/level_update.h" +#include "game/area.h" } #define DISCORDLIBFILE "libdiscord-rpc" @@ -175,6 +176,10 @@ static void set_time(void){ } static void set_details(void) { + if (gCurrLevelNum == LEVEL_SA) { + strcpy(stage, "Chroma Keying"); + return; + } if (lastCourseNum != gCurrCourseNum || reloadRPC) { // If we are in in Course 0 we are in the castle which doesn't have a string if (gCurrCourseNum) {