Path: blob/master/SonicMania/Objects/Cutscene/CutsceneRules.c
338 views
// ---------------------------------------------------------------------1// RSDK Project: Sonic Mania2// Object Description: CutsceneRules Object3// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges4// Decompiled by: Rubberduckycooly & RMGRich5// ---------------------------------------------------------------------67#include "Game.h"89ObjectCutsceneRules *CutsceneRules = NULL;1011// NOTE:12// I'm not actually sure *what* this object was for13// CutsceneRules_SetupEntity was always inlined so I can't say for sure that it was a real func14// CutsceneRules_DrawCutsceneBounds is a func I added for editor drawing help15// I've never seen definitive proof of any funcs this object may have once had so be it what you will1617void CutsceneRules_Update(void) {}1819void CutsceneRules_LateUpdate(void) {}2021void CutsceneRules_StaticUpdate(void) {}2223void CutsceneRules_Draw(void) {}2425void CutsceneRules_Create(void *data) {}2627void CutsceneRules_StageLoad(void) {}2829bool32 CutsceneRules_IsAct1(void)30{31if ((RSDK.CheckSceneFolder("GHZ") && !Zone->actID) || (RSDK.CheckSceneFolder("CPZ") && !Zone->actID) || RSDK.CheckSceneFolder("SPZ1")32|| (RSDK.CheckSceneFolder("FBZ") && !Zone->actID) || RSDK.CheckSceneFolder("PSZ1") || RSDK.CheckSceneFolder("SSZ1")33|| (RSDK.CheckSceneFolder("HCZ") && !Zone->actID) || (RSDK.CheckSceneFolder("MSZ") && !Zone->actID)34|| (RSDK.CheckSceneFolder("OOZ") && !Zone->actID) || RSDK.CheckSceneFolder("LRZ1") || (RSDK.CheckSceneFolder("MMZ") && !Zone->actID)35|| RSDK.CheckSceneFolder("TMZ1")) {36return true;37}3839return false;40}41bool32 CutsceneRules_IsAct2(void)42{43if ((RSDK.CheckSceneFolder("GHZ") && Zone->actID == 1) || (RSDK.CheckSceneFolder("CPZ") && Zone->actID == 1) || RSDK.CheckSceneFolder("SPZ2")44|| (RSDK.CheckSceneFolder("FBZ") && Zone->actID == 1) || RSDK.CheckSceneFolder("PSZ2") || RSDK.CheckSceneFolder("SSZ2")45|| (RSDK.CheckSceneFolder("HCZ") && Zone->actID == 1) || (RSDK.CheckSceneFolder("MSZ") && Zone->actID == 1) || RSDK.CheckSceneFolder("OOZ2")46|| RSDK.CheckSceneFolder("LRZ3") || (RSDK.CheckSceneFolder("MMZ") && Zone->actID == 1) || RSDK.CheckSceneFolder("TMZ2")) {47return true;48}4950return false;51}5253bool32 CutsceneRules_IsIntroEnabled(void) { return isMainGameMode() && globals->enableIntro && !CutsceneRules_CheckStageReload(); }5455bool32 CutsceneRules_IsAct1Regular(void) { return isMainGameMode() && CutsceneRules_IsAct1(); }5657bool32 CutsceneRules_CheckStageReload(void)58{59if (StarPost) {60for (int32 p = 0; p < Player->playerCount; ++p) {61if (StarPost->postIDs[p])62return true;63}64}6566if (SpecialRing && globals->specialRingID > 0) {67foreach_all(SpecialRing, specialRing)68{69if (specialRing->id > 0 && globals->specialRingID == specialRing->id)70return true;71}72}7374return false;75}76bool32 CutsceneRules_CheckPlayerPos(int32 x1, int32 y1, int32 x2, int32 y2)77{78Vector2 playerPos;7980if (Player) {81foreach_all(Player, player)82{83if (CHECK_CHARACTER_ID(player->characterID, 1)) {84playerPos = player->position;85}86}87}8889return playerPos.x >= x1 && playerPos.y >= y1 && playerPos.x <= x2 && playerPos.y <= y2;90}9192// Extra Helpers93void CutsceneRules_SetupEntity(void *e, Vector2 *size, Hitbox *hitbox)94{95EntityCutsceneRules *entity = (EntityCutsceneRules *)e;9697if (!size->x)98size->x = WIDE_SCR_XSIZE << 16;99100if (!size->y)101size->y = SCREEN_YSIZE << 16;102103entity->updateRange.x = TO_FIXED(128) + size->x;104entity->updateRange.y = TO_FIXED(128) + size->y;105106hitbox->left = -size->x >> 17;107hitbox->top = -size->y >> 17;108hitbox->right = size->x >> 17;109hitbox->bottom = size->y >> 17;110}111112void CutsceneRules_DrawCutsceneBounds(void *e, Vector2 *size)113{114EntityCutsceneRules *entity = (EntityCutsceneRules *)e;115DrawHelpers_DrawRectOutline(entity->position.x, entity->position.y, size->x, size->y, 0xFFFF00);116}117118#if GAME_INCLUDE_EDITOR119void CutsceneRules_EditorDraw(void) {}120121void CutsceneRules_EditorLoad(void) {}122#endif123124void CutsceneRules_Serialize(void) {}125126127