Path: blob/master/SonicMania/Objects/TMZ/MonarchBG.c
338 views
// ---------------------------------------------------------------------1// RSDK Project: Sonic Mania2// Object Description: MonarchBG Object3// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges4// Decompiled by: Rubberduckycooly & RMGRich5// ---------------------------------------------------------------------67#include "Game.h"89ObjectMonarchBG *MonarchBG;1011void MonarchBG_Update(void)12{13RSDK_THIS(MonarchBG);1415StateMachine_Run(self->state);16}1718void MonarchBG_LateUpdate(void) {}1920void MonarchBG_StaticUpdate(void) {}2122void MonarchBG_Draw(void)23{24RSDK_THIS(MonarchBG);2526Vector2 drawPos;27drawPos.x = self->position.x - ((self->position.x - ((ScreenInfo->position.x + ScreenInfo->center.x) << 16)) >> 1);28drawPos.y = self->position.y - 208 * ((self->position.y - ((ScreenInfo->position.y + ScreenInfo->center.y) << 16)) >> 8);2930self->direction = FLIP_NONE;31RSDK.DrawSprite(&self->animatorTop, &drawPos, false);32RSDK.DrawSprite(&self->animatorBottom, &drawPos, false);3334self->direction = FLIP_X;35RSDK.DrawSprite(&self->animatorTop, &drawPos, false);36RSDK.DrawSprite(&self->animatorBottom, &drawPos, false);37}3839void MonarchBG_Create(void *data)40{41RSDK_THIS(MonarchBG);4243if (!SceneInfo->inEditor) {44self->visible = true;45self->drawFX = FX_FLIP;46self->drawGroup = 1;47self->scale.x = 0xE00;48self->active = ACTIVE_NORMAL;49self->updateRange.x = 0x800000;50self->updateRange.y = 0x800000;51self->position.x = 2048 << 16;52self->position.y = 3072 << 16;5354RSDK.SetSpriteAnimation(MonarchBG->aniFrames, 0, &self->animatorTop, true, 0);55RSDK.SetSpriteAnimation(MonarchBG->aniFrames, 1, &self->animatorBottom, true, 0);56}57}5859void MonarchBG_StageLoad(void)60{61MonarchBG->aniFrames = RSDK.LoadSpriteAnimation("TMZ1/MonarchBG.bin", SCOPE_STAGE);6263// Code for loading the MonarchBG mesh???64// Does this mean the mesh was intended to be in the BG instead of the sprite at one point?65MonarchBG->meshIndex = RSDK.LoadMesh("TMZ/MonarchBG.bin", SCOPE_STAGE);66MonarchBG->sceneIndex = RSDK.Create3DScene("View:Monarch", 0x2000, SCOPE_STAGE);6768RSDK.SetDiffuseColor(MonarchBG->sceneIndex, 0x40, 0x00, 0x40);69RSDK.SetDiffuseIntensity(MonarchBG->sceneIndex, 8, 8, 8);70RSDK.SetSpecularIntensity(MonarchBG->sceneIndex, 16, 16, 16);71}7273#if GAME_INCLUDE_EDITOR74void MonarchBG_EditorDraw(void)75{76RSDK_THIS(MonarchBG);7778self->position.x = 0x8000000;79self->position.y = 0xC000000;80self->drawFX = FX_FLIP;8182RSDK.SetSpriteAnimation(MonarchBG->aniFrames, 0, &self->animatorTop, true, 0);83RSDK.SetSpriteAnimation(MonarchBG->aniFrames, 1, &self->animatorBottom, true, 0);8485self->direction = FLIP_NONE;86RSDK.DrawSprite(&self->animatorTop, NULL, false);87RSDK.DrawSprite(&self->animatorBottom, NULL, false);8889self->direction = FLIP_X;90RSDK.DrawSprite(&self->animatorTop, NULL, false);91RSDK.DrawSprite(&self->animatorBottom, NULL, false);92}9394void MonarchBG_EditorLoad(void) { MonarchBG->aniFrames = RSDK.LoadSpriteAnimation("TMZ1/MonarchBG.bin", SCOPE_STAGE); }95#endif9697void MonarchBG_Serialize(void) {}9899100