Path: blob/master/SonicMania/Objects/Menu/DAControl.c
338 views
// ---------------------------------------------------------------------1// RSDK Project: Sonic Mania2// Object Description: DAControl Object3// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges4// Decompiled by: Rubberduckycooly & RMGRich5// ---------------------------------------------------------------------67#include "Game.h"89ObjectDAControl *DAControl;1011void DAControl_Update(void)12{13RSDK_THIS(DAControl);14StateMachine_Run(self->state);15}1617void DAControl_LateUpdate(void) {}1819void DAControl_StaticUpdate(void) {}2021void DAControl_Draw(void)22{23RSDK_THIS(DAControl);24Vector2 drawPos;2526self->direction = FLIP_NONE;27for (int32 i = 0; i < 2; ++i) {28drawPos = self->position;29self->backPlateAnimator.frameID = 0;30RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);3132self->backPlateAnimator.frameID = 1;33RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);3435drawPos.y += 0x80000;36RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);3738drawPos.y += 0x80000;39RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);4041drawPos.y += 0x80000;42self->backPlateAnimator.frameID = 2;43RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);4445drawPos.y -= 0x170000;46self->backPlateAnimator.frameID = 3;47RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);48++self->direction;49}5051self->direction = FLIP_NONE;52drawPos.y -= 0x130000;53self->backPlateAnimator.frameID = 4;54RSDK.DrawSprite(&self->backPlateAnimator, &drawPos, false);5556drawPos.x = self->position.x - 0x700000;57drawPos.y = self->position.y + 0x1E0000;58for (int32 i = 0; i < 5; ++i) {59RSDK.DrawSprite(&self->buttonAnimator, &drawPos, false);60RSDK.DrawSprite(&self->optionsAnimator[i], &drawPos, false);61drawPos.x += 0x380000;62}6364drawPos.x = self->position.x - 0x800000;65drawPos.y = self->position.y;66if (!SceneInfo->inEditor)67RSDK.DrawText(&self->textAnimator, &drawPos, &self->text, 0, self->text.length, ALIGN_LEFT, 0, 0, 0, false);68}6970void DAControl_Create(void *data)71{72RSDK_THIS(DAControl);7374self->drawFX = FX_FLIP;75if (!SceneInfo->inEditor) {76self->visible = true;77self->drawGroup = 2;78self->active = ACTIVE_BOUNDS;79self->updateRange.x = 0x800000;80self->updateRange.y = 0x800000;81RSDK.SetSpriteAnimation(DAControl->aniFrames, 0, &self->backPlateAnimator, true, 0);82RSDK.SetSpriteAnimation(DAControl->aniFrames, 1, &self->buttonAnimator, true, 0);83RSDK.SetSpriteAnimation(DAControl->aniFrames, 4, &self->textAnimator, true, 0);84for (int32 i = 0; i < 5; ++i) RSDK.SetSpriteAnimation(DAControl->aniFrames, 2, &self->optionsAnimator[i], true, i);8586RSDK.InitString(&self->text, "SELECT A TRACK...", 0);87RSDK.SetSpriteAnimation(DAControl->aniFrames, 4, &self->textAnimator, true, 0);88RSDK.SetSpriteString(DAControl->aniFrames, 4, &self->text);89}90}9192void DAControl_StageLoad(void) { DAControl->aniFrames = RSDK.LoadSpriteAnimation("UI/DAGarden.bin", SCOPE_STAGE); }9394#if GAME_INCLUDE_EDITOR95void DAControl_EditorDraw(void)96{97RSDK_THIS(DAControl);9899self->visible = true;100self->drawGroup = 2;101self->active = ACTIVE_BOUNDS;102self->updateRange.x = 0x800000;103self->updateRange.y = 0x800000;104RSDK.SetSpriteAnimation(DAControl->aniFrames, 0, &self->backPlateAnimator, true, 0);105RSDK.SetSpriteAnimation(DAControl->aniFrames, 1, &self->buttonAnimator, true, 0);106RSDK.SetSpriteAnimation(DAControl->aniFrames, 4, &self->textAnimator, true, 0);107for (int32 i = 0; i < 5; ++i) RSDK.SetSpriteAnimation(DAControl->aniFrames, 2, &self->optionsAnimator[i], true, i);108109DAControl_Draw();110}111112void DAControl_EditorLoad(void) { DAControl->aniFrames = RSDK.LoadSpriteAnimation("UI/DAGarden.bin", SCOPE_STAGE); }113#endif114115void DAControl_Serialize(void) {}116117118