Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Global/Camera.h
338 views
1
#ifndef OBJ_CAMERA_H
2
#define OBJ_CAMERA_H
3
4
#include "Game.h"
5
6
typedef enum {
7
CAMERA_LERP_NORMAL,
8
CAMERA_LERP_SIN1024,
9
CAMERA_LERP_SIN1024_2,
10
CAMERA_LERP_SIN512,
11
} CameraLerpType;
12
13
// Object Class
14
struct ObjectCamera {
15
RSDK_OBJECT
16
Vector2 centerBounds;
17
};
18
19
// Entity Class
20
struct EntityCamera {
21
RSDK_ENTITY
22
StateMachine(state);
23
Entity *target;
24
int32 screenID;
25
Vector2 center;
26
Vector2 targetMoveVel;
27
Vector2 lastPos;
28
Vector2 shakePos;
29
Vector2 lookPos;
30
Vector2 offset;
31
bool32 disableYOffset;
32
int32 centerY;
33
int32 adjustY;
34
int32 lerpPercent;
35
int32 lerpSpeed;
36
int32 lerpType;
37
Vector2 endLerpPos;
38
Vector2 startLerpPos;
39
Vector2 boundsOffset;
40
int32 boundsL;
41
int32 boundsR;
42
int32 boundsT;
43
int32 boundsB;
44
};
45
46
// Object Struct
47
extern ObjectCamera *Camera;
48
49
// Standard Entity Events
50
void Camera_Update(void);
51
void Camera_LateUpdate(void);
52
void Camera_StaticUpdate(void);
53
void Camera_Draw(void);
54
void Camera_Create(void *data);
55
void Camera_StageLoad(void);
56
#if GAME_INCLUDE_EDITOR
57
void Camera_EditorDraw(void);
58
void Camera_EditorLoad(void);
59
#endif
60
void Camera_Serialize(void);
61
62
// Extra Entity Functions
63
void Camera_SetCameraBounds(EntityCamera *entity);
64
EntityCamera *Camera_SetTargetEntity(int32 screen, void *t);
65
void Camera_ShakeScreen(int32 screen, int32 shakeX, int32 shakeY);
66
void Camera_HandleHBounds(void);
67
void Camera_HandleVBounds(void);
68
void Camera_SetupLerp(int32 type, int32 screen, int32 x, int32 y, int32 speed);
69
70
// States
71
void Camera_State_MapView(void);
72
void Camera_State_FollowXY(void);
73
void Camera_State_FollowX(void);
74
void Camera_State_FollowY(void);
75
void Camera_State_HandleLerp(void);
76
77
#endif //! OBJ_CAMERA_H
78
79