Path: blob/master/SonicMania/Objects/PGZ/PSZEggman.c
338 views
// ---------------------------------------------------------------------1// RSDK Project: Sonic Mania2// Object Description: PSZEggman Object3// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges4// Decompiled by: Rubberduckycooly & RMGRich5// ---------------------------------------------------------------------67#include "Game.h"89ObjectPSZEggman *PSZEggman;1011void PSZEggman_Update(void)12{13RSDK_THIS(PSZEggman);1415StateMachine_Run(self->state);1617RSDK.ProcessAnimation(&self->eggmanAnimator);18RSDK.ProcessAnimation(&self->displayAnimator);19RSDK.ProcessAnimation(&self->scanlinesAnimator);20}2122void PSZEggman_LateUpdate(void) {}2324void PSZEggman_StaticUpdate(void) {}2526void PSZEggman_Draw(void)27{28RSDK_THIS(PSZEggman);2930RSDK.DrawSprite(&self->terminalAnimator, NULL, false);31RSDK.DrawSprite(&self->displayAnimator, NULL, false);3233self->inkEffect = INK_ALPHA;34RSDK.DrawSprite(&self->scanlinesAnimator, NULL, false);3536self->inkEffect = INK_NONE;37RSDK.DrawSprite(&self->eggmanAnimator, &self->eggmanPos, false);38}3940void PSZEggman_Create(void *data)41{42RSDK_THIS(PSZEggman);4344if (!SceneInfo->inEditor) {45self->visible = true;46self->drawGroup = Zone->objectDrawGroup[0];47self->eggmanPos.x = self->position.x - 0x180000;48self->eggmanPos.y = self->position.y + 0x10000;4950self->alpha = 64;51self->active = ACTIVE_BOUNDS;52self->updateRange.x = 0x800000;53self->updateRange.y = 0x800000;5455RSDK.SetSpriteAnimation(PSZEggman->controlFrames, 0, &self->terminalAnimator, true, 0);56RSDK.SetSpriteAnimation(PSZEggman->controlFrames, 1, &self->displayAnimator, true, 0);57RSDK.SetSpriteAnimation(PSZEggman->controlFrames, 2, &self->scanlinesAnimator, true, 0);58RSDK.SetSpriteAnimation(PSZEggman->aniFrames, 0, &self->eggmanAnimator, true, 0);59}60}6162void PSZEggman_StageLoad(void)63{64PSZEggman->controlFrames = RSDK.LoadSpriteAnimation("PSZ2/ControlPanel.bin", SCOPE_STAGE);65PSZEggman->aniFrames = RSDK.LoadSpriteAnimation("Eggman/EggmanPSZ.bin", SCOPE_STAGE);66}6768void PSZEggman_State_TurnRound(void)69{70RSDK_THIS(PSZEggman);7172if (self->eggmanAnimator.timer == 1) {73if (self->ruby) {74self->ruby->position.x += 0x10000;75++self->timer;76}77else if (self->eggmanAnimator.frameID == 7) {78self->ruby = CREATE_ENTITY(PhantomRuby, NULL, self->eggmanPos.x - 0x100000, self->eggmanPos.y - 0x20000);79}80}8182if (self->timer == 6) {83self->ruby->startPos.x = self->ruby->position.x;84self->ruby->startPos.y = self->ruby->position.y;85self->ruby->state = PhantomRuby_State_Oscillate;86self->state = StateMachine_None;87}88}8990#if GAME_INCLUDE_EDITOR91void PSZEggman_EditorDraw(void)92{93RSDK_THIS(PSZEggman);9495self->visible = true;96self->drawGroup = Zone->objectDrawGroup[0];97self->eggmanPos.x = self->position.x - 0x180000;98self->eggmanPos.y = self->position.y + 0x10000;99self->alpha = 0x40;100self->active = ACTIVE_BOUNDS;101self->updateRange.x = 0x800000;102self->updateRange.y = 0x800000;103104RSDK.SetSpriteAnimation(PSZEggman->controlFrames, 0, &self->terminalAnimator, true, 0);105RSDK.SetSpriteAnimation(PSZEggman->controlFrames, 1, &self->displayAnimator, true, 0);106RSDK.SetSpriteAnimation(PSZEggman->controlFrames, 2, &self->scanlinesAnimator, true, 0);107RSDK.SetSpriteAnimation(PSZEggman->aniFrames, 0, &self->eggmanAnimator, true, 0);108109PSZEggman_Draw();110}111112void PSZEggman_EditorLoad(void)113{114PSZEggman->controlFrames = RSDK.LoadSpriteAnimation("PSZ2/ControlPanel.bin", SCOPE_STAGE);115PSZEggman->aniFrames = RSDK.LoadSpriteAnimation("Eggman/EggmanPSZ.bin", SCOPE_STAGE);116}117#endif118119void PSZEggman_Serialize(void) {}120121122