Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-2-2013-Decompilation
Path: blob/main/RSDKv4/Collision.hpp
817 views
1
#ifndef COLLISION_H
2
#define COLLISION_H
3
4
enum CollisionSides {
5
CSIDE_FLOOR = 0,
6
CSIDE_LWALL = 1,
7
CSIDE_RWALL = 2,
8
CSIDE_ROOF = 3,
9
#if RETRO_REV03
10
CSIDE_LENTITY = 4, // Added in Origins Plus
11
CSIDE_RENTITY = 5, // Added in Origins Plus
12
#endif
13
};
14
15
enum CollisionModes {
16
CMODE_FLOOR = 0,
17
CMODE_LWALL = 1,
18
CMODE_ROOF = 2,
19
CMODE_RWALL = 3,
20
};
21
22
enum CollisionSolidity {
23
SOLID_ALL = 0,
24
SOLID_TOP = 1,
25
SOLID_LRB = 2,
26
SOLID_NONE = 3,
27
SOLID_TOP_NOGRIP = 4,
28
};
29
30
enum ObjectCollisionTypes {
31
C_TOUCH = 0,
32
C_SOLID = 1,
33
C_SOLID2 = 2,
34
C_PLATFORM = 3,
35
};
36
37
enum ObjectCollisionFlags {
38
C_BOX = 0x10000,
39
};
40
41
struct CollisionSensor {
42
int xpos;
43
int ypos;
44
int angle;
45
bool collided;
46
};
47
48
#if !RETRO_USE_ORIGINAL_CODE
49
#define DEBUG_HITBOX_COUNT (0x400)
50
51
struct DebugHitboxInfo {
52
byte type;
53
byte collision;
54
short left;
55
short top;
56
short right;
57
short bottom;
58
int xpos;
59
int ypos;
60
Entity *entity;
61
};
62
63
enum DebugHitboxTypes { H_TYPE_TOUCH, H_TYPE_BOX, H_TYPE_PLAT, H_TYPE_FINGER };
64
65
extern byte showHitboxes;
66
extern int debugHitboxCount;
67
extern DebugHitboxInfo debugHitboxList[DEBUG_HITBOX_COUNT];
68
69
int AddDebugHitbox(byte type, Entity *entity, int left, int top, int right, int bottom);
70
#endif
71
72
extern int collisionLeft;
73
extern int collisionTop;
74
extern int collisionRight;
75
extern int collisionBottom;
76
77
extern int collisionTolerance;
78
79
extern CollisionSensor sensors[RETRO_REV00 ? 6 : 7];
80
81
void FindFloorPosition(Entity *player, CollisionSensor *sensor, int startYPos);
82
void FindLWallPosition(Entity *player, CollisionSensor *sensor, int startXPos);
83
void FindRoofPosition(Entity *player, CollisionSensor *sensor, int startYPos);
84
void FindRWallPosition(Entity *player, CollisionSensor *sensor, int startXPos);
85
86
void FloorCollision(Entity *player, CollisionSensor *sensor);
87
void LWallCollision(Entity *player, CollisionSensor *sensor);
88
void RoofCollision(Entity *player, CollisionSensor *sensor);
89
void RWallCollision(Entity *player, CollisionSensor *sensor);
90
91
void SetPathGripSensors(Entity *player);
92
void ProcessPathGrip(Entity *player);
93
void ProcessAirCollision(Entity *player);
94
95
void ProcessTileCollisions(Entity *player);
96
97
void TouchCollision(Entity *thisEntity, int thisLeft, int thisTop, int thisRight, int thisBottom, Entity *otherEntity, int otherLeft, int otherTop,
98
int otherRight, int otherBottom);
99
void BoxCollision(Entity *thisEntity, int thisLeft, int thisTop, int thisRight, int thisBottom, Entity *otherEntity, int otherLeft, int otherTop,
100
int otherRight, int otherBottom); // Standard
101
void BoxCollision2(Entity *thisEntity, int thisLeft, int thisTop, int thisRight, int thisBottom, Entity *otherEntity, int otherLeft, int otherTop,
102
int otherRight, int otherBottom); // Updated (?)
103
void PlatformCollision(Entity *thisEntity, int thisLeft, int thisTop, int thisRight, int thisBottom, Entity *otherEntity, int otherLeft, int otherTop,
104
int otherRight, int otherBottom);
105
106
void ObjectFloorCollision(int xOffset, int yOffset, int cPath);
107
void ObjectLWallCollision(int xOffset, int yOffset, int cPath);
108
void ObjectRoofCollision(int xOffset, int yOffset, int cPath);
109
void ObjectRWallCollision(int xOffset, int yOffset, int cPath);
110
111
void ObjectFloorGrip(int xOffset, int yOffset, int cPath);
112
void ObjectLWallGrip(int xOffset, int yOffset, int cPath);
113
void ObjectRoofGrip(int xOffset, int yOffset, int cPath);
114
void ObjectRWallGrip(int xOffset, int yOffset, int cPath);
115
#if RETRO_REV03
116
void ObjectLEntityGrip(int xOffset, int yOffset, int cPath); // Added in Origins Plus
117
void ObjectREntityGrip(int xOffset, int yOffset, int cPath); // Added in Origins Plus
118
#endif
119
120
#endif // !COLLISION_H
121
122