From b0fa4d9a044ec7c0bb05c45ac75d97a0d2ff1dce Mon Sep 17 00:00:00 2001 From: Gregory Heskett Date: Sun, 4 Feb 2024 01:26:40 -0500 Subject: [PATCH] Make previewable blue coins semi-transparent --- actors/coin/geo.inc.c | 344 ++++++++++++++--------------- actors/coin/model.inc.c | 4 +- src/game/behavior_actions.h | 6 + src/game/behaviors/blue_coin.inc.c | 46 ++++ 4 files changed, 214 insertions(+), 186 deletions(-) diff --git a/actors/coin/geo.inc.c b/actors/coin/geo.inc.c index 43599bd463..5e700fbaf4 100644 --- a/actors/coin/geo.inc.c +++ b/actors/coin/geo.inc.c @@ -1,268 +1,244 @@ #ifdef IA8_30FPS_COINS -// 0x1600013C -const GeoLayout yellow_coin_geo[] = { - GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0xB4, 50), + +const GeoLayout yellow_coin_normal_switch_geo[] = { + GEO_SWITCH_CASE(8, geo_switch_anim_state), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_0), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_22_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_45), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_67_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_90), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_67_5_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_45_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_22_5_r), - GEO_CLOSE_NODE(), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_0), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_22_5), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_45), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_67_5), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_90), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_67_5_r), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_45_r), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_22_5_r), GEO_CLOSE_NODE(), - GEO_END(), + GEO_RETURN(), }; -// 0x160001A0 -const GeoLayout yellow_coin_no_shadow_geo[] = { - GEO_NODE_START(), +const GeoLayout blue_coin_normal_switch_geo[] = { + GEO_SWITCH_CASE(8, geo_switch_anim_state), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_0), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_22_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_45), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_67_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_90), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_67_5_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_45_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_22_5_r), - GEO_CLOSE_NODE(), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_0), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_22_5), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_45), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_67_5), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_90), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_67_5_r), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_45_r), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_22_5_r), GEO_CLOSE_NODE(), - GEO_END(), + GEO_RETURN(), }; -// 0x16000200 -const GeoLayout blue_coin_geo[] = { - GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0xB4, 80), +#ifdef BLUE_COIN_SWITCH_PREVIEW +const GeoLayout blue_coin_transparent_switch_geo[] = { + GEO_NODE_START(), GEO_OPEN_NODE(), + GEO_ASM(0, geo_update_blue_coin_transparency), GEO_SWITCH_CASE(8, geo_switch_anim_state), GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_0), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_22_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_45), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_67_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_90), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_67_5_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_45_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_22_5_r), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_0), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_22_5), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_45), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_67_5), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_90), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_67_5_r), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_45_r), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_22_5_r), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_END(), + GEO_RETURN(), }; +#endif // BLUE_COIN_SWITCH_PREVIEW -// 0x16000264 -const GeoLayout blue_coin_no_shadow_geo[] = { - GEO_NODE_START(), +const GeoLayout red_coin_normal_switch_geo[] = { + GEO_SWITCH_CASE(8, geo_switch_anim_state), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_0), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_22_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_45), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_67_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_90), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_67_5_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_45_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_22_5_r), - GEO_CLOSE_NODE(), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_0), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_22_5), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_45), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_67_5), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_90), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_67_5_r), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_45_r), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_22_5_r), GEO_CLOSE_NODE(), - GEO_END(), + GEO_RETURN(), }; -// 0x160002C4 -const GeoLayout red_coin_geo[] = { - GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0xB4, 80), +const GeoLayout silver_coin_normal_switch_geo[] = { + GEO_SWITCH_CASE(8, geo_switch_anim_state), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_0), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_22_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_45), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_67_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_90), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_67_5_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_45_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_22_5_r), - GEO_CLOSE_NODE(), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_0), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_22_5), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_45), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_67_5), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_90), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_67_5_r), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_45_r), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_22_5_r), GEO_CLOSE_NODE(), - GEO_END(), + GEO_RETURN(), }; -// 0x16000328 -const GeoLayout red_coin_no_shadow_geo[] = { - GEO_NODE_START(), +#else // IA8_30FPS_COINS + +const GeoLayout yellow_coin_normal_switch_geo[] = { + GEO_SWITCH_CASE(8, geo_switch_anim_state), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_0), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_22_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_45), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_67_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_90), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_67_5_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_45_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_22_5_r), - GEO_CLOSE_NODE(), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_front), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_front), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_right), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_right), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_side), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_side), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_left), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_left), GEO_CLOSE_NODE(), - GEO_END(), + GEO_RETURN(), }; -// 0x160002C4 -const GeoLayout silver_coin_geo[] = { - GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0xB4, 80), +const GeoLayout blue_coin_normal_switch_geo[] = { + GEO_SWITCH_CASE(8, geo_switch_anim_state), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_0), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_22_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_45), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_67_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_90), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_67_5_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_45_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_22_5_r), - GEO_CLOSE_NODE(), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_front), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_front), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_right), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_right), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_side), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_side), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_left), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_left), GEO_CLOSE_NODE(), - GEO_END(), + GEO_RETURN(), }; -// 0x16000328 -const GeoLayout silver_coin_no_shadow_geo[] = { +#ifdef BLUE_COIN_SWITCH_PREVIEW +const GeoLayout blue_coin_transparent_switch_geo[] = { GEO_NODE_START(), GEO_OPEN_NODE(), + GEO_ASM(0, geo_update_blue_coin_transparency), GEO_SWITCH_CASE(8, geo_switch_anim_state), GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_0), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_22_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_45), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_67_5), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_90), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_67_5_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_45_r), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_secret_22_5_r), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_front), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_front), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_tilt_right), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_tilt_right), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_side), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_side), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_tilt_left), + GEO_DISPLAY_LIST(LAYER_TRANSPARENT, coin_seg3_dl_blue_tilt_left), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), - GEO_END(), + GEO_RETURN(), }; +#endif // BLUE_COIN_SWITCH_PREVIEW + +const GeoLayout red_coin_normal_switch_geo[] = { + GEO_SWITCH_CASE(8, geo_switch_anim_state), + GEO_OPEN_NODE(), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_front), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_front), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_right), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_right), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_side), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_side), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_left), + GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_left), + GEO_CLOSE_NODE(), + GEO_RETURN(), +}; + +#endif // IA8_30FPS_COINS -#else // 0x1600013C const GeoLayout yellow_coin_geo[] = { GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0xB4, 50), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_left), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_left), - GEO_CLOSE_NODE(), + GEO_BRANCH(1, yellow_coin_normal_switch_geo), GEO_CLOSE_NODE(), GEO_END(), }; // 0x160001A0 const GeoLayout yellow_coin_no_shadow_geo[] = { - GEO_NODE_START(), + GEO_BRANCH(1, yellow_coin_normal_switch_geo), + GEO_END(), +}; + +#ifdef BLUE_COIN_SWITCH_PREVIEW +// 0x16000200 +const GeoLayout blue_coin_geo[] = { + GEO_SWITCH_CASE(2, geo_switch_blue_coin_transparency), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), + GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0xB4, 80), + GEO_OPEN_NODE(), + GEO_BRANCH(1, blue_coin_normal_switch_geo), + GEO_CLOSE_NODE(), + GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0x70, 80), GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_left), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_yellow_tilt_left), + GEO_BRANCH(1, blue_coin_transparent_switch_geo), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_END(), }; +// 0x16000264 +const GeoLayout blue_coin_no_shadow_geo[] = { + GEO_SWITCH_CASE(2, geo_switch_blue_coin_transparency), + GEO_OPEN_NODE(), + GEO_BRANCH(1, blue_coin_normal_switch_geo), + GEO_BRANCH(1, blue_coin_transparent_switch_geo), + GEO_CLOSE_NODE(), + GEO_END(), +}; + +#else // BLUE_COIN_SWITCH_PREVIEW + // 0x16000200 const GeoLayout blue_coin_geo[] = { GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0xB4, 80), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_left), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_left), - GEO_CLOSE_NODE(), + GEO_BRANCH(1, blue_coin_normal_switch_geo), GEO_CLOSE_NODE(), GEO_END(), }; // 0x16000264 const GeoLayout blue_coin_no_shadow_geo[] = { - GEO_NODE_START(), - GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_left), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_blue_tilt_left), - GEO_CLOSE_NODE(), - GEO_CLOSE_NODE(), + GEO_BRANCH(1, blue_coin_normal_switch_geo), GEO_END(), }; +#endif // BLUE_COIN_SWITCH_PREVIEW // 0x160002C4 const GeoLayout red_coin_geo[] = { GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0xB4, 80), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_left), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_left), - GEO_CLOSE_NODE(), + GEO_BRANCH(1, red_coin_normal_switch_geo), GEO_CLOSE_NODE(), GEO_END(), }; // 0x16000328 const GeoLayout red_coin_no_shadow_geo[] = { - GEO_NODE_START(), + GEO_BRANCH(1, red_coin_normal_switch_geo), + GEO_END(), +}; + +#ifdef IA8_30FPS_COINS +// 0x160002C4 +const GeoLayout silver_coin_geo[] = { + GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0xB4, 80), GEO_OPEN_NODE(), - GEO_SWITCH_CASE(8, geo_switch_anim_state), - GEO_OPEN_NODE(), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_front), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_right), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_side), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_left), - GEO_DISPLAY_LIST(LAYER_OCCLUDE_SILHOUETTE_ALPHA, coin_seg3_dl_red_tilt_left), - GEO_CLOSE_NODE(), + GEO_BRANCH(1, silver_coin_normal_switch_geo), GEO_CLOSE_NODE(), GEO_END(), }; -#endif + +// 0x16000328 +const GeoLayout silver_coin_no_shadow_geo[] = { + GEO_BRANCH(1, silver_coin_normal_switch_geo), + GEO_END(), +}; +#endif // IA8_30FPS_COINS diff --git a/actors/coin/model.inc.c b/actors/coin/model.inc.c index 146f9c1625..7a37e7acb8 100644 --- a/actors/coin/model.inc.c +++ b/actors/coin/model.inc.c @@ -106,7 +106,7 @@ ALIGNED8 static const Texture coin_seg3_texture_90_ia8[] = { const Gfx coin_seg3_dl_start[] = { gsDPPipeSync(), gsSPClearGeometryMode(G_LIGHTING), - gsDPSetCombineMode(G_CC_MODULATEIA, G_CC_MODULATEIA), + gsDPSetCombineMode(G_CC_MODULATEIFADEA, G_CC_MODULATEIFADEA), gsSPTexture(32767, 32767, 0, G_TX_RENDERTILE, G_ON), gsDPTileSync(), gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_8b, 8, 0, G_TX_LOADTILE, 0, (G_TX_CLAMP | G_TX_NOMIRROR), 6, G_TX_NOLOD, (G_TX_CLAMP | G_TX_NOMIRROR), 6, G_TX_NOLOD), @@ -482,7 +482,7 @@ ALIGNED8 static const Texture coin_seg3_texture_tilt_left[] = { const Gfx coin_seg3_sub_dl_begin[] = { gsDPPipeSync(), gsSPClearGeometryMode(G_LIGHTING), - gsDPSetCombineMode(G_CC_MODULATEIA, G_CC_MODULATEIA), + gsDPSetCombineMode(G_CC_MODULATEIFADEA, G_CC_MODULATEIFADEA), gsSPTexture(0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON), #ifdef IA8_COINS gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_CLAMP, 6, G_TX_NOLOD, G_TX_CLAMP, 6, G_TX_NOLOD), diff --git a/src/game/behavior_actions.h b/src/game/behavior_actions.h index 1bf0d9c413..032feb6083 100644 --- a/src/game/behavior_actions.h +++ b/src/game/behavior_actions.h @@ -571,6 +571,12 @@ Gfx *geo_snufit_scale_body(s32 callContext, struct GraphNode *node, UNUSED Mat4 // Bowser key cutscene Gfx *geo_scale_bowser_key(s32 callContext, struct GraphNode *node, UNUSED Mat4 mtx); +// Coin +#ifdef BLUE_COIN_SWITCH_PREVIEW +Gfx *geo_switch_blue_coin_transparency(s32 callContext, struct GraphNode *node, UNUSED void *context); +Gfx *geo_update_blue_coin_transparency(s32 callContext, struct GraphNode *node, UNUSED void *context); +#endif + // Water splash extern struct WaterDropletParams gShallowWaterSplashDropletParams; extern struct WaterDropletParams gShallowWaterWaveDropletParams; diff --git a/src/game/behaviors/blue_coin.inc.c b/src/game/behaviors/blue_coin.inc.c index 189cd2d8fb..c235d535db 100644 --- a/src/game/behaviors/blue_coin.inc.c +++ b/src/game/behaviors/blue_coin.inc.c @@ -37,6 +37,7 @@ void bhv_hidden_blue_coin_loop(void) { #ifdef BLUE_COIN_SWITCH_PREVIEW if (gMarioObject->platform == blueCoinSwitch) { cur_obj_enable_rendering(); + o->oOpacity = 159; } else { cur_obj_disable_rendering(); } @@ -48,6 +49,7 @@ void bhv_hidden_blue_coin_loop(void) { // Become tangible cur_obj_enable_rendering(); cur_obj_become_tangible(); + o->oOpacity = 255; // Delete the coin once collected if (o->oInteractStatus & INT_STATUS_INTERACTED) { @@ -177,3 +179,47 @@ void bhv_blue_coin_switch_loop(void) { break; } } + +#ifdef BLUE_COIN_SWITCH_PREVIEW +Gfx *geo_switch_blue_coin_transparency(s32 callContext, struct GraphNode *node, UNUSED void *context) { + if (callContext == GEO_CONTEXT_RENDER) { + struct Object *obj = gCurGraphNodeObjectNode; + struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node; + if (gCurGraphNodeHeldObject != NULL) { + obj = gCurGraphNodeHeldObject->objNode; + } + + // Only allow transparency for hidden blue coins, since other behaviors don't set oOpacity to 255 + if (obj->behavior == segmented_to_virtual(bhvHiddenBlueCoin) && obj->oOpacity != 255) { + switchCase->selectedCase = 1; // transparent + } else { + switchCase->selectedCase = 0; // alpha + } + } + + return NULL; +} + +Gfx *geo_update_blue_coin_transparency(s32 callContext, struct GraphNode *node, UNUSED void *context) { + Gfx *dlStart = NULL; + + if (callContext == GEO_CONTEXT_RENDER) { + struct Object *obj = gCurGraphNodeObjectNode; + struct GraphNodeGenerated *currentGraphNode = (struct GraphNodeGenerated *) node; + if (gCurGraphNodeHeldObject != NULL) { + obj = gCurGraphNodeHeldObject->objNode; + } + + SET_GRAPH_NODE_LAYER(currentGraphNode->fnNode.node.flags, LAYER_TRANSPARENT); + + dlStart = alloc_display_list(sizeof(Gfx) * 2); + if (dlStart) { + Gfx *dlHead = dlStart; + gDPSetEnvColor(dlHead++, 255, 255, 255, obj->oOpacity); + gSPEndDisplayList(dlHead); + } + } + + return dlStart; +} +#endif