Path: blob/master/SonicMania/Objects/Menu/UIBackground.c
338 views
// ---------------------------------------------------------------------1// RSDK Project: Sonic Mania2// Object Description: UIBackground Object3// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges4// Decompiled by: Rubberduckycooly & RMGRich5// ---------------------------------------------------------------------67#include "Game.h"89ObjectUIBackground *UIBackground;1011void UIBackground_Update(void)12{13RSDK_THIS(UIBackground);1415++self->timer;16}1718void UIBackground_LateUpdate(void) {}1920void UIBackground_StaticUpdate(void) {}2122void UIBackground_Draw(void)23{24RSDK_THIS(UIBackground);2526StateMachine_Run(self->stateDraw);27}2829void UIBackground_Create(void *data)30{31RSDK_THIS(UIBackground);3233if (!SceneInfo->inEditor) {34self->active = ACTIVE_NORMAL;35self->visible = true;36self->drawGroup = 0;37self->stateDraw = UIBackground_DrawNormal;38}39}4041void UIBackground_StageLoad(void) { UIBackground->activeColors = UIBackground->bgColors; }4243void UIBackground_DrawNormal(void)44{45RSDK_THIS(UIBackground);4647color *colorPtrs = UIBackground->activeColors;4849Vector2 drawPos;50RSDK.FillScreen(colorPtrs[0], 0xFF, 0xFF, 0xFF);5152drawPos.x = ((RSDK.Sin512(self->timer) >> 3) + 112) * RSDK.Sin256(self->timer) >> 8;53drawPos.y = ((RSDK.Sin512(self->timer) >> 3) + 112) * RSDK.Cos256(self->timer) >> 8;54RSDK.DrawCircleOutline(ScreenInfo->center.x, ScreenInfo->center.y, (RSDK.Sin512(self->timer) >> 3) + 108, (RSDK.Sin512(self->timer) >> 3) + 116,55colorPtrs[1], 0xFF, INK_NONE, true);5657RSDK.DrawCircle(drawPos.x + ScreenInfo->center.x, drawPos.y + ScreenInfo->center.y, 32, colorPtrs[1], 0xFF, INK_NONE, true);58RSDK.DrawCircle(ScreenInfo->center.x - drawPos.x, ScreenInfo->center.y - drawPos.y, 16, colorPtrs[1], 0xFF, INK_NONE, true);59RSDK.DrawCircle(drawPos.x + ScreenInfo->center.x, drawPos.y + ScreenInfo->center.y, 26, colorPtrs[1], 0xFF, INK_NONE, true);6061drawPos.x = ((RSDK.Cos512(self->timer) >> 3) + 144) * RSDK.Cos256(self->timer) >> 8;62drawPos.y = ((RSDK.Cos512(self->timer) >> 3) + 144) * RSDK.Sin256(self->timer) >> 8;63RSDK.DrawCircleOutline(ScreenInfo->center.x, ScreenInfo->center.y, (RSDK.Cos512(self->timer) >> 3) + 140, (RSDK.Cos512(self->timer) >> 3) + 148,64colorPtrs[2], 0xFF, INK_NONE, true);6566RSDK.DrawCircle(drawPos.x + ScreenInfo->center.x, drawPos.y + ScreenInfo->center.y, 32, colorPtrs[2], 0xFF, INK_NONE, true);67RSDK.DrawCircle(ScreenInfo->center.x - drawPos.x, ScreenInfo->center.y - drawPos.y, 16, colorPtrs[2], 0xFF, INK_NONE, true);68RSDK.DrawCircle(drawPos.x + ScreenInfo->center.x, drawPos.y + ScreenInfo->center.y, 26, colorPtrs[0], 0xFF, INK_NONE, true);69}7071#if GAME_INCLUDE_EDITOR72void UIBackground_EditorDraw(void)73{74RSDK_THIS(UIBackground);7576RSDK.SetSpriteAnimation(UIBackground->aniFrames, 0, &self->animator, true, 0);7778RSDK.DrawSprite(&self->animator, NULL, false);79}8081void UIBackground_EditorLoad(void)82{83UIBackground->aniFrames = RSDK.LoadSpriteAnimation("Editor/EditorIcons.bin", SCOPE_STAGE);8485RSDK_ACTIVE_VAR(UIBackground, type);86RSDK_ENUM_VAR("(Unused)", UIBACKGROUND_UNUSED);87}88#endif8990void UIBackground_Serialize(void) { RSDK_EDITABLE_VAR(UIBackground, VAR_ENUM, type); }919293