Path: blob/main/RSDKv4/Collision.hpp
817 views
#ifndef COLLISION_H1#define COLLISION_H23enum CollisionSides {4CSIDE_FLOOR = 0,5CSIDE_LWALL = 1,6CSIDE_RWALL = 2,7CSIDE_ROOF = 3,8#if RETRO_REV039CSIDE_LENTITY = 4, // Added in Origins Plus10CSIDE_RENTITY = 5, // Added in Origins Plus11#endif12};1314enum CollisionModes {15CMODE_FLOOR = 0,16CMODE_LWALL = 1,17CMODE_ROOF = 2,18CMODE_RWALL = 3,19};2021enum CollisionSolidity {22SOLID_ALL = 0,23SOLID_TOP = 1,24SOLID_LRB = 2,25SOLID_NONE = 3,26SOLID_TOP_NOGRIP = 4,27};2829enum ObjectCollisionTypes {30C_TOUCH = 0,31C_SOLID = 1,32C_SOLID2 = 2,33C_PLATFORM = 3,34};3536enum ObjectCollisionFlags {37C_BOX = 0x10000,38};3940struct CollisionSensor {41int xpos;42int ypos;43int angle;44bool collided;45};4647#if !RETRO_USE_ORIGINAL_CODE48#define DEBUG_HITBOX_COUNT (0x400)4950struct DebugHitboxInfo {51byte type;52byte collision;53short left;54short top;55short right;56short bottom;57int xpos;58int ypos;59Entity *entity;60};6162enum DebugHitboxTypes { H_TYPE_TOUCH, H_TYPE_BOX, H_TYPE_PLAT, H_TYPE_FINGER };6364extern byte showHitboxes;65extern int debugHitboxCount;66extern DebugHitboxInfo debugHitboxList[DEBUG_HITBOX_COUNT];6768int AddDebugHitbox(byte type, Entity *entity, int left, int top, int right, int bottom);69#endif7071extern int collisionLeft;72extern int collisionTop;73extern int collisionRight;74extern int collisionBottom;7576extern int collisionTolerance;7778extern CollisionSensor sensors[RETRO_REV00 ? 6 : 7];7980void FindFloorPosition(Entity *player, CollisionSensor *sensor, int startYPos);81void FindLWallPosition(Entity *player, CollisionSensor *sensor, int startXPos);82void FindRoofPosition(Entity *player, CollisionSensor *sensor, int startYPos);83void FindRWallPosition(Entity *player, CollisionSensor *sensor, int startXPos);8485void FloorCollision(Entity *player, CollisionSensor *sensor);86void LWallCollision(Entity *player, CollisionSensor *sensor);87void RoofCollision(Entity *player, CollisionSensor *sensor);88void RWallCollision(Entity *player, CollisionSensor *sensor);8990void SetPathGripSensors(Entity *player);91void ProcessPathGrip(Entity *player);92void ProcessAirCollision(Entity *player);9394void ProcessTileCollisions(Entity *player);9596void TouchCollision(Entity *thisEntity, int thisLeft, int thisTop, int thisRight, int thisBottom, Entity *otherEntity, int otherLeft, int otherTop,97int otherRight, int otherBottom);98void BoxCollision(Entity *thisEntity, int thisLeft, int thisTop, int thisRight, int thisBottom, Entity *otherEntity, int otherLeft, int otherTop,99int otherRight, int otherBottom); // Standard100void BoxCollision2(Entity *thisEntity, int thisLeft, int thisTop, int thisRight, int thisBottom, Entity *otherEntity, int otherLeft, int otherTop,101int otherRight, int otherBottom); // Updated (?)102void PlatformCollision(Entity *thisEntity, int thisLeft, int thisTop, int thisRight, int thisBottom, Entity *otherEntity, int otherLeft, int otherTop,103int otherRight, int otherBottom);104105void ObjectFloorCollision(int xOffset, int yOffset, int cPath);106void ObjectLWallCollision(int xOffset, int yOffset, int cPath);107void ObjectRoofCollision(int xOffset, int yOffset, int cPath);108void ObjectRWallCollision(int xOffset, int yOffset, int cPath);109110void ObjectFloorGrip(int xOffset, int yOffset, int cPath);111void ObjectLWallGrip(int xOffset, int yOffset, int cPath);112void ObjectRoofGrip(int xOffset, int yOffset, int cPath);113void ObjectRWallGrip(int xOffset, int yOffset, int cPath);114#if RETRO_REV03115void ObjectLEntityGrip(int xOffset, int yOffset, int cPath); // Added in Origins Plus116void ObjectREntityGrip(int xOffset, int yOffset, int cPath); // Added in Origins Plus117#endif118119#endif // !COLLISION_H120121122