mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-26 03:51:46 +00:00
Still too obvious... last one
This commit is contained in:
parent
e019d3ec43
commit
fd9168760f
1 changed files with 46 additions and 22 deletions
|
|
@ -6,14 +6,17 @@
|
|||
#include "djui_panel_menu.h"
|
||||
#include "djui_panel_confirm.h"
|
||||
#include "pc/controller/controller_sdl.h"
|
||||
#include "pc/controller/controller_mouse.h"
|
||||
#include "pc/pc_main.h"
|
||||
#include "pc/update_checker.h"
|
||||
#include "sounds.h"
|
||||
#include "audio/external.h"
|
||||
#include "game/area.h"
|
||||
|
||||
extern ALIGNED8 u8 texture_coopdx_logo[];
|
||||
|
||||
bool gDjuiPanelMainCreated = false;
|
||||
struct DjuiThreePanel* panel = NULL;
|
||||
|
||||
static void djui_panel_main_quit_yes(UNUSED struct DjuiBase* caller) {
|
||||
game_exit();
|
||||
|
|
@ -27,33 +30,54 @@ static void djui_panel_main_quit(struct DjuiBase* caller) {
|
|||
}
|
||||
|
||||
static int sEggCounter;
|
||||
static void djui_panel_main_increment_egg_counter(UNUSED struct DjuiBase *base) {
|
||||
play_sound(SOUND_MENU_COLLECT_RED_COIN + ((8 - sEggCounter) << 16), gGlobalSoundSource);
|
||||
static u32 sEggLastFired;
|
||||
static f32 sEggLastY;
|
||||
static bool sEggHovered = false;
|
||||
static bool sEggClicked = false;
|
||||
|
||||
if (!--sEggCounter) {
|
||||
configExCoopTheme = !configExCoopTheme;
|
||||
game_exit();
|
||||
}
|
||||
static void djui_panel_main_egg_end(struct DjuiBase *base, UNUSED bool *noRender) {
|
||||
panel->base.x.value -= gGlobalTimer - sEggLastFired + 60;
|
||||
base->color.a = MAX(255.f - ((gGlobalTimer - sEggLastFired + 60) << 3), 0);
|
||||
if (gGlobalTimer == sEggLastFired) { game_exit(); }
|
||||
}
|
||||
|
||||
static u32 sEggHintLastFired;
|
||||
static void djui_panel_main_egg_hint(UNUSED struct DjuiBase *base) {
|
||||
if (sEggHintLastFired < gGlobalTimer) {
|
||||
play_sound(SOUND_GENERAL_COIN, gGlobalSoundSource);
|
||||
}
|
||||
sEggHintLastFired = gGlobalTimer + 1;
|
||||
}
|
||||
static void djui_panel_main_egg(struct DjuiBase *base, UNUSED bool *noRender) {
|
||||
if (sEggCounter && sEggLastY == base->clip.y) {
|
||||
bool hovering = djui_cursor_inside_base(base);
|
||||
bool clicking = (gInteractablePad.button & PAD_BUTTON_A || mouse_buttons & L_MOUSE_BUTTON);
|
||||
|
||||
if (hovering) {
|
||||
if (!sEggHovered && sEggLastFired + 20 < gGlobalTimer) {
|
||||
play_sound(SOUND_GENERAL_COIN, gGlobalSoundSource);
|
||||
}
|
||||
sEggLastFired = gGlobalTimer;
|
||||
|
||||
if (!sEggClicked && clicking) {
|
||||
play_sound(SOUND_MENU_COLLECT_SECRET + ((5 - sEggCounter) << 16), gGlobalSoundSource);
|
||||
|
||||
if (!--sEggCounter) {
|
||||
configExCoopTheme = !configExCoopTheme;
|
||||
play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x1E, 0xFF, 0xFF, 0xFF);
|
||||
fade_volume_scale(SEQ_PLAYER_LEVEL, 0, 40);
|
||||
sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL & ~(1 << SOUND_BANK_MENU));
|
||||
sEggLastFired = gGlobalTimer + 60;
|
||||
|
||||
static void djui_panel_main_setup_egg_interactable(struct DjuiBase *base) {
|
||||
djui_interactable_create(base, NULL);
|
||||
djui_interactable_hook_click(base, djui_panel_main_increment_egg_counter);
|
||||
djui_interactable_hook_hover(base, djui_panel_main_egg_hint, NULL);
|
||||
base->interactable->enabled = false;
|
||||
extern struct DjuiImage* sMouseCursor;
|
||||
sMouseCursor->base.on_render_pre = djui_panel_main_egg_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sEggHovered = hovering;
|
||||
sEggClicked = clicking;
|
||||
return;
|
||||
}
|
||||
sEggLastY = base->clip.y;
|
||||
}
|
||||
|
||||
void djui_panel_main_create(struct DjuiBase* caller) {
|
||||
struct DjuiThreePanel* panel = djui_panel_menu_create(configExCoopTheme ? "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP" : "", false);
|
||||
if (configExCoopTheme) { djui_panel_main_setup_egg_interactable(djui_three_panel_get_header(panel)); }
|
||||
panel = djui_panel_menu_create(configExCoopTheme ? "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\n\\#ffef00\\COOP" : "", false);
|
||||
if (configExCoopTheme) { djui_three_panel_get_header(panel)->on_render_pre = djui_panel_main_egg; }
|
||||
|
||||
{
|
||||
struct DjuiBase* body = djui_three_panel_get_body(panel);
|
||||
|
|
@ -68,7 +92,7 @@ void djui_panel_main_create(struct DjuiBase* caller) {
|
|||
djui_base_set_alignment(&logo->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_TOP);
|
||||
djui_base_set_location_type(&logo->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_location(&logo->base, 0, -30);
|
||||
djui_panel_main_setup_egg_interactable(&logo->base);
|
||||
logo->base.on_render_pre = djui_panel_main_egg;
|
||||
}
|
||||
|
||||
struct DjuiButton* button1 = djui_button_create(body, DLANG(MAIN, HOST), DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_create);
|
||||
|
|
@ -109,5 +133,5 @@ void djui_panel_main_create(struct DjuiBase* caller) {
|
|||
djui_panel_add(caller, panel, NULL);
|
||||
gInteractableOverridePad = true;
|
||||
gDjuiPanelMainCreated = true;
|
||||
sEggCounter = 8;
|
||||
sEggCounter = 5;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue