diff --git a/src/game/behaviors/bowser.inc.c b/src/game/behaviors/bowser.inc.c index a90ae4c9..c8d37a92 100644 --- a/src/game/behaviors/bowser.inc.c +++ b/src/game/behaviors/bowser.inc.c @@ -97,9 +97,6 @@ void bhv_bowser_body_anchor_loop(void) { } s32 bowser_spawn_shockwave(void) { - o->oHealth = -1; - o->oAction = 4; - return 0; struct Object *wave; if (o->oBehParams2ndByte == 2) { wave = spawn_object(o, MODEL_BOWSER_WAVE, bhvBowserShockWave); diff --git a/src/moon/ui/interfaces/moon-screen.cpp b/src/moon/ui/interfaces/moon-screen.cpp index 19f43171..83ea3cb2 100644 --- a/src/moon/ui/interfaces/moon-screen.cpp +++ b/src/moon/ui/interfaces/moon-screen.cpp @@ -1,6 +1,7 @@ #include "moon-screen.h" #include #include +#include extern "C" { #include "engine/math_util.h" @@ -41,25 +42,28 @@ void MoonScreen::Mount(){ void MoonScreen::Draw(){ if(this->enabledWidgets){ - for(int i = 0; i < widgets.size(); i++) - widgets[i]->Draw(); - //int widgetAmount = widgets.size(); - //int maxWidgets = 8; - //int iMod = scrollWidgetModifier; - //for(int i = 0; i < min(widgetAmount, maxWidgets); i++){ - // int index = i + iMod; + int widgetsAmount = this->widgets.size(); + int maxWidgets = 8; + int iMod = scrollModifier; - // if(index > widgetAmount - 1){ - // this->scrollIndex = 0; - // scrollWidgetModifier = 0; - // return; - // } + for(int i = 0; i < min(widgetsAmount, maxWidgets); i++){ + int index = i + iMod; - // widgets[index]->parent = this; - // widgets[index]->Draw(); - // widgets[index]->mY = 15 * iMod; - //} + if(index > widgetsAmount - 1){ + this->scrollIndex = 0; + scrollModifier = 0; + return; + } + + auto &widget = this->widgets[index]; + + if(widget == NULL) return; + + widget->parent = this; + widget->y = 57 + (i * 17); + widget->Draw(); + } } } @@ -67,25 +71,25 @@ bool stickExecuted; void MoonScreen::changeScroll(int idx){ + int size = this->widgets.size(); if(idx < 0){ if(this->scrollIndex > 0){ - if(scrollWidgetModifier > 0 && this->scrollIndex == scrollWidgetModifier) - scrollWidgetModifier--; + if(scrollModifier > 0 && this->scrollIndex == scrollModifier) + scrollModifier--; this->scrollIndex--; return; } - this->scrollIndex = this->widgets.size() - 1; - scrollWidgetModifier = this->scrollIndex - 4; + this->scrollIndex = size - 1; + scrollModifier = this->scrollIndex - min(7, size - 1); return; } - if(this->scrollIndex < this->widgets.size() - 1){ - if(this->scrollIndex > 3 && !((this->scrollIndex - scrollWidgetModifier) % 4)) scrollWidgetModifier++; + if(this->scrollIndex < size - 1){ + if(this->scrollIndex > 5 && !((this->scrollIndex - scrollModifier) % 7)) scrollModifier++; this->scrollIndex++; return; } - this->scrollIndex = 0; - scrollWidgetModifier = 0; + scrollModifier = 0; } void MoonScreen::Update(){ diff --git a/src/moon/ui/interfaces/moon-screen.h b/src/moon/ui/interfaces/moon-screen.h index 05b21a1e..5e6dd7d9 100644 --- a/src/moon/ui/interfaces/moon-screen.h +++ b/src/moon/ui/interfaces/moon-screen.h @@ -18,6 +18,7 @@ class MoonScreen { protected: bool enabledWidgets = true; bool useMouseInstead = false; // unused + int scrollModifier = 0; public: std::vector widgets; MoonWidget* selected; diff --git a/src/moon/ui/widgets/mw-value.cpp b/src/moon/ui/widgets/mw-value.cpp index 763089d7..ab6b17e3 100644 --- a/src/moon/ui/widgets/mw-value.cpp +++ b/src/moon/ui/widgets/mw-value.cpp @@ -11,7 +11,6 @@ bool mwvStickExecuted; MWValue::MWValue(float x, float y, std::wstring title, MWValueBind bind){ this->x = x; - this->y = y; this->bind = bind; this->title = title; this->titleKey = false; @@ -19,7 +18,6 @@ MWValue::MWValue(float x, float y, std::wstring title, MWValueBind bind){ MWValue::MWValue(float x, float y, std::wstring title, MWValueBind bind, bool titleKey){ this->x = x; - this->y = y; this->bind = bind; this->title = title; this->titleKey = titleKey; @@ -27,7 +25,6 @@ MWValue::MWValue(float x, float y, std::wstring title, MWValueBind bind, bool ti MWValue::MWValue(float x, float y, std::string title, MWValueBind bind){ this->x = x; - this->y = y; this->bind = bind; this->title = wide(title); this->titleKey = false; @@ -35,7 +32,6 @@ MWValue::MWValue(float x, float y, std::string title, MWValueBind bind){ MWValue::MWValue(float x, float y, std::string title, MWValueBind bind, bool titleKey){ this->x = x; - this->y = y; this->bind = bind; this->title = wide(title); this->titleKey = titleKey;