Path: blob/master/SonicMania/Objects/Puyo/PuyoBean.h
338 views
#ifndef OBJ_PUYOBEAN_H1#define OBJ_PUYOBEAN_H23#include "Game.h"45#define PUYO_PLAYFIELD_W (6)6#define PUYO_PLAYFIELD_H (14)78typedef enum {9PUYOBEAN_BLUE = 0,10PUYOBEAN_GREEN = 6,11PUYOBEAN_PURPLE = 12,12PUYOBEAN_RED = 18,13PUYOBEAN_YELLOW = 24,14PUYOBEAN_JUNK = 30,15} PuyoBeanTypes;1617typedef enum {18PUYOBEAN_ANI_FLASH,19PUYOBEAN_ANI_IDLE,20PUYOBEAN_ANI_BOUNCE,21PUYOBEAN_ANI_CONNECT,22PUYOBEAN_ANI_POP,23PUYOBEAN_ANI_DEBRIS,24} PuyoBeanAniIDs;2526// Object Class27struct ObjectPuyoBean {28RSDK_OBJECT29TABLE(int32 fallDelays[5], { 16, 12, 8, 4, 2 });30Hitbox hitboxBean;31int32 comboChainCount[2];32int32 disableBeanLink[2];33EntityPuyoBean *playfield[256];34int32 beanLinkCount;35Vector2 beanLinkPositions[256];36bool32 beanLinkTable[84]; // PUYO_PLAYFIELD_W * PUYO_PLAYFIELD_H37int32 shinkDelay;38Animator junkBeanAnimator;39uint16 aniFrames;40uint16 sfxLand;41uint16 sfxRotate;42uint16 chainFrames[6];43uint16 sfxJunk;44uint16 sfxFall;45};4647// Entity Class48struct EntityPuyoBean {49RSDK_ENTITY50StateMachine(state);51int32 playerID;52int32 type;53int32 linkSides;54int32 linkCount;55EntityPuyoBean *linkBeans[4];56int32 timer;57int32 popTimer;58int32 moveTimer;59int32 fallTimer;60int32 fallDelay;61int32 rotateSpeed;62int32 unused1;63int32 rotationDir;64int32 idleTimer;65int32 connectTimer;66int32 selectedLevel;67Vector2 stillPos;68Vector2 unused2;69Vector2 origin;70int32 targetAngle;71bool32 forceRotationActive;72bool32 isJunk;73EntityPuyoBean *partner;74StateMachine(stateInput);75int32 controllerID;76bool32 down;77bool32 left;78bool32 right;79bool32 rotateRight;80bool32 rotateLeft;81bool32 forceRotateLeft;82bool32 forceRotateRight;83Animator beanAnimator;84};8586// Object Struct87extern ObjectPuyoBean *PuyoBean;8889// Standard Entity Events90void PuyoBean_Update(void);91void PuyoBean_LateUpdate(void);92void PuyoBean_StaticUpdate(void);93void PuyoBean_Draw(void);94void PuyoBean_Create(void *data);95void PuyoBean_StageLoad(void);96#if GAME_INCLUDE_EDITOR97void PuyoBean_EditorDraw(void);98void PuyoBean_EditorLoad(void);99#endif100void PuyoBean_Serialize(void);101102// Extra Entity Functions103EntityPuyoBean *PuyoBean_GetPuyoBean(int32 playerID, int32 x, int32 y);104void PuyoBean_Input_Player(void);105void PuyoBean_DestroyPuyoBeans(void);106void PuyoBean_HandleBeanLinks(void);107void PuyoBean_CheckBeanLinks(EntityPuyoBean *bean, EntityPuyoBean *curLink);108void PuyoBean_HandleMoveBounds(void);109bool32 PuyoBean_CheckAIRotationDisabled(EntityPuyoBean *bean);110void PuyoBean_CheckCollisions(void);111int32 PuyoBean_GetBeanChainRemovalCount(int32 playerID, EntityPuyoBean *bean, int32 x, int32 y);112int32 PuyoBean_GetAvailableLinks(int32 playerID, EntityPuyoBean *bean, int32 x, int32 y);113bool32 PuyoBean_CheckLinkPosAvailable(int32 playerID, int32 x, int32 y);114void PuyoBean_SetupBeanLinkTable(int32 playerID, int32 x, int32 y, bool32 useTempTable);115uint8 PuyoBean_GetColumnHeight(int32 playerID, int32 column, EntityPuyoBean *bean, EntityPuyoBean *partner);116void PuyoBean_CalculateStillPos(EntityPuyoBean *bean);117118// States119void PuyoBean_State_PartnerControlled(void);120void PuyoBean_State_Controlled(void);121void PuyoBean_State_BeanIdle(void);122void PuyoBean_State_Falling(void);123void PuyoBean_State_BeanLand(void);124void PuyoBean_State_JunkLand(void);125void PuyoBean_State_JunkIdle(void);126void PuyoBean_State_JunkPopped(void);127void PuyoBean_State_BeginBeanPop(void);128void PuyoBean_State_BeanPop(void);129void PuyoBean_State_MatchLoseFall(void);130131#endif //! OBJ_PUYOBEAN_H132133134