Path: blob/master/SonicMania/Objects/BSS/BSS_Setup.h
338 views
#ifndef OBJ_BSS_SETUP_H1#define OBJ_BSS_SETUP_H23#include "Game.h"45#define BSS_PLAYFIELD_W (0x20)6#define BSS_PLAYFIELD_H (0x20)78// Object Class9struct ObjectBSS_Setup {10RSDK_OBJECT11uint8 randomNumbers[4]; // used to calculate the map (& colours) for Random BSS mode12int32 sphereCount;13int32 pinkSphereCount;14int32 rings;15int32 ringPan;16int32 ringCount;17int32 ringID; // updated in BSS_Collected, but aside from that it goes pretty much unused it seems18uint16 bgLayer;19uint16 globeLayer;20uint16 frustum1Layer;21uint16 frustum2Layer;22uint16 playFieldLayer;23uint16 ringCountLayer;24uint16 globeFrames;25TABLE(int32 globeFrameTable[0xF], { 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0 });26TABLE(int32 globeDirTableL[0xF], { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 });27TABLE(int32 globeDirTableR[0xF], { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 });28TABLE(int32 screenYTable[0x70],29{ 280, 270, 260, 251, 243, 235, 228, 221, 215, 208, 202, 197, 191, 185, 180, 175, 170, 165, 160, 155, 151, 147, 143,30139, 135, 131, 127, 124, 121, 117, 114, 111, 108, 105, 103, 100, 97, 95, 92, 90, 88, 86, 83, 81, 79, 77,3176, 74, 72, 70, 69, 67, 66, 64, 63, 62, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48,3247, 47, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 40, 40, 40, 40, 40, 40, 40, 40, 39, 39, 39,3339, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38 });34TABLE(int32 divisorTable[0x70],35{ 4096, 4032, 3968, 3904, 3840, 3776, 3712, 3648, 3584, 3520, 3456, 3392, 3328, 3264, 3200, 3136, 3072, 2995, 2920, 2847, 2775, 2706, 2639,362572, 2508, 2446, 2384, 2324, 2266, 2210, 2154, 2100, 2048, 2012, 1976, 1940, 1906, 1872, 1838, 1806, 1774, 1742, 1711, 1680, 1650, 1621,371592, 1564, 1536, 1509, 1482, 1455, 1429, 1404, 1379, 1354, 1330, 1307, 1283, 1260, 1238, 1216, 1194, 1173, 1152, 1134, 1116, 1099, 1082,381065, 1048, 1032, 1016, 1000, 985, 969, 954, 939, 925, 910, 896, 892, 888, 884, 880, 875, 871, 867, 863, 859, 855, 851,39848, 844, 840, 836, 832, 830, 828, 826, 824, 822, 820, 818, 816, 814, 812, 810, 808, 806, 804, 802 });40TABLE(int32 xMultiplierTable[0x70],41{ 134, 131, 128, 125, 123, 121, 119, 117, 115, 114, 112, 111, 109, 108, 106, 104, 104, 102, 100, 98, 97, 96, 94, 93, 92, 90, 89, 88,4286, 84, 83, 82, 80, 80, 79, 78, 77, 76, 74, 73, 72, 71, 70, 70, 68, 68, 67, 66, 65, 64, 63, 62, 61, 60, 60, 59,4358, 57, 57, 56, 55, 54, 53, 53, 52, 51, 51, 50, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 44, 43, 43, 43,4442, 42, 42, 41, 41, 41, 41, 40, 40, 40, 40, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 37, 37, 37, 37, 37, 36, 36 });45TABLE(int32 frameTable[0x80],46{ 31, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 28, 28, 28, 28, 27, 27, 27, 26, 26, 26, 26, 25, 25, 25,4724, 24, 24, 24, 23, 23, 23, 23, 22, 22, 22, 22, 21, 21, 21, 21, 20, 20, 20, 20, 19, 19, 19, 19, 18, 18, 18, 18, 17, 17, 17, 17,4816, 16, 16, 15, 15, 14, 14, 14, 13, 13, 13, 12, 12, 12, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7,496, 6, 6, 6, 5, 5, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });50Vector2 offsetTable[0x100];51int32 offsetRadiusTable[0x100];52int32 frustumCount[2];53int32 frustumOffset[2];54int32 unused1;55uint16 playField[0x400]; // Active Spheres & Collectables (0x400 == 0x20 * 0x20 == BSS_PLAYFIELD_W * BSS_PLAYFIELD_H)56uint16 sphereChainTable[0x400]; // Currently chained spheres (0x400 == 0x20 * 0x20 == BSS_PLAYFIELD_W * BSS_PLAYFIELD_H)57uint16 sphereCollectedTable[0x400]; // Spheres to turn into rings (0x400 == 0x20 * 0x20 == BSS_PLAYFIELD_W * BSS_PLAYFIELD_H)58uint16 sfxBlueSphere;59uint16 sfxSSExit;60uint16 sfxBumper;61uint16 sfxSpring;62uint16 sfxRing;63uint16 sfxLoseRings;64uint16 sfxSSJettison;65uint16 sfxEmerald;66uint16 sfxEvent;67uint16 sfxMedal;68uint16 sfxMedalCaught;69uint16 sfxTeleport;70};7172// Entity Class73struct EntityBSS_Setup {74RSDK_ENTITY75StateMachine(state);76int32 spinTimer;77int32 speedupTimer;78int32 speedupInterval;79int32 timer;80int32 spinState;81int32 palettePage;82int32 unused1;83int32 xMultiplier;84int32 divisor;85int32 speedupLevel;86int32 globeSpeed;87bool32 playerWasBumped;88int32 globeSpeedInc;89bool32 disableBumpers;90int32 globeTimer;91int32 paletteLine;92int32 offsetDir;93int32 unused2;94Vector2 offset;95Vector2 playerPos;96Vector2 lastSpherePos;97int32 unused3;98bool32 completedRingLoop;99int32 paletteID;100int32 stopMovement;101Animator globeSpinAnimator;102Animator shadowAnimator;103};104105// Object Struct106extern ObjectBSS_Setup *BSS_Setup;107108// Standard Entity Events109void BSS_Setup_Update(void);110void BSS_Setup_LateUpdate(void);111void BSS_Setup_StaticUpdate(void);112void BSS_Setup_Draw(void);113void BSS_Setup_Create(void *data);114void BSS_Setup_StageLoad(void);115#if GAME_INCLUDE_EDITOR116void BSS_Setup_EditorDraw(void);117void BSS_Setup_EditorLoad(void);118#endif119void BSS_Setup_Serialize(void);120121// Extra Entity Functions122int32 BSS_Setup_GetStageID(void);123void BSS_Setup_SetupPalette(void);124void BSS_Setup_SetupFrustum(void);125void BSS_Setup_CollectRing(void);126void BSS_Setup_GetStartupInfo(void);127void BSS_Setup_State_GlobeJettison(void);128void BSS_Setup_HandleSteppedObjects(void);129void BSS_Setup_HandleCollectableMovement(void);130void BSS_Setup_State_GlobeEmerald(void);131void BSS_Setup_State_StartGlobeTeleport(void);132void BSS_Setup_State_GlobeExit(void);133void BSS_Setup_State_GlobeMoveZ(void);134void BSS_Setup_State_GlobeTurnLeft(void);135void BSS_Setup_State_GlobeTurnRight(void);136void BSS_Setup_State_FinishGlobeTeleport(void);137bool32 BSS_Setup_CheckSphereValid(int32 x, int32 y);138void BSS_Setup_LaunchSpheres(void);139void BSS_Setup_SetupFinishSequence(void);140bool32 BSS_Setup_ScanSphereChain_Up(uint8 x, uint8 y);141bool32 BSS_Setup_ScanSphereChain_Down(uint8 x, uint8 y);142bool32 BSS_Setup_ScanSphereChain_Left(uint8 x, uint8 y);143bool32 BSS_Setup_ScanSphereChain_Right(uint8 x, uint8 y);144bool32 BSS_Setup_GetChainedSphereCount(uint8 x, uint8 y);145void BSS_Setup_ProcessChain(void);146147#endif //! OBJ_BSS_SETUP_H148149150