Path: blob/master/SonicMania/Objects/Puyo/PuyoIndicator.c
338 views
// ---------------------------------------------------------------------1// RSDK Project: Sonic Mania2// Object Description: PuyoIndicator Object3// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges4// Decompiled by: Rubberduckycooly & RMGRich5// ---------------------------------------------------------------------67#include "Game.h"89ObjectPuyoIndicator *PuyoIndicator;1011void PuyoIndicator_Update(void)12{13RSDK_THIS(PuyoIndicator);1415self->visible = false;1617if (self->state) {18StateMachine_Run(self->state);1920RSDK.ProcessAnimation(&self->animator);21}22}2324void PuyoIndicator_LateUpdate(void) {}2526void PuyoIndicator_StaticUpdate(void) {}2728void PuyoIndicator_Draw(void)29{30RSDK_THIS(PuyoIndicator);3132RSDK.DrawSprite(&self->animator, NULL, false);33}3435void PuyoIndicator_Create(void *data)36{37RSDK_THIS(PuyoIndicator);3839self->active = ACTIVE_NORMAL;40self->drawGroup = Zone->objectDrawGroup[1];41self->startPos = self->position;42self->visible = true;43self->drawFX = FX_SCALE | FX_FLIP;44self->scale.x = 0x200;45self->scale.y = 0x200;46}4748void PuyoIndicator_StageLoad(void) { PuyoIndicator->aniFrames = RSDK.LoadSpriteAnimation("Puyo/PuyoIndicator.bin", SCOPE_STAGE); }4950void PuyoIndicator_ShowWinner(void)51{52RSDK_THIS(PuyoIndicator);5354self->scale.x = 0x200;55self->scale.y = 0x200;56self->visible = true;5758RSDK.SetSpriteAnimation(PuyoIndicator->aniFrames, 0, &self->animator, false, 0);5960self->position = self->startPos;61self->scale.x = 0x200;62self->scale.y = 0x200;63self->scale.x += (RSDK.Sin512(8 * Zone->timer) >> 3) + 0x20;64self->scale.y += (RSDK.Sin512(8 * Zone->timer) >> 3) + 0x20;65}6667void PuyoIndicator_ShowLoser(void)68{69RSDK_THIS(PuyoIndicator);7071self->scale.x = 0x200;72self->scale.y = 0x200;73self->visible = true;7475RSDK.SetSpriteAnimation(PuyoIndicator->aniFrames, 1, &self->animator, false, 0);7677self->position.x = self->startPos.x;78self->position.y = self->startPos.y + 0x20000;79self->position.y += RSDK.Sin256(4 * Zone->timer) << 10;80}8182void PuyoIndicator_ShowReady(void)83{84RSDK_THIS(PuyoIndicator);8586self->scale.x = 0x200;87self->scale.y = 0x200;88self->visible = true;8990RSDK.SetSpriteAnimation(PuyoIndicator->aniFrames, 2, &self->animator, false, 0);9192self->position.x = self->startPos.x;93self->position.y = self->startPos.y;94}9596#if GAME_INCLUDE_EDITOR97void PuyoIndicator_EditorDraw(void)98{99RSDK_THIS(PuyoIndicator);100101self->drawFX = FX_FLIP;102self->startPos = self->position;103self->playerID ? PuyoIndicator_ShowLoser() : PuyoIndicator_ShowWinner();104self->scale.x = 0x200;105self->scale.y = 0x200;106107PuyoIndicator_Draw();108109self->position = self->startPos;110}111112void PuyoIndicator_EditorLoad(void)113{114PuyoIndicator->aniFrames = RSDK.LoadSpriteAnimation("Puyo/PuyoIndicator.bin", SCOPE_STAGE);115116RSDK_ACTIVE_VAR(PuyoIndicator, playerID);117RSDK_ENUM_VAR("Player 1", PUYOGAME_PLAYER1);118RSDK_ENUM_VAR("Player 2", PUYOGAME_PLAYER2);119}120#endif121122void PuyoIndicator_Serialize(void) { RSDK_EDITABLE_VAR(PuyoIndicator, VAR_UINT8, playerID); }123124125