diff options
author | Treeki <treeki@gmail.com> | 2012-12-02 02:33:34 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-12-02 02:33:34 +0100 |
commit | 15af665eac26f9a29b864617d571ef539a6c42b0 (patch) | |
tree | 51505a63f6160cde691b3b9df15303d8b98fa0a1 /include | |
parent | 25bb4867ecfde3ec489b891b182cc0fdd2711ad3 (diff) | |
download | kamek-15af665eac26f9a29b864617d571ef539a6c42b0.tar.gz kamek-15af665eac26f9a29b864617d571ef539a6c42b0.zip |
collisionMgr_c updated
Diffstat (limited to 'include')
-rwxr-xr-x | include/game.h | 302 |
1 files changed, 237 insertions, 65 deletions
diff --git a/include/game.h b/include/game.h index 8afb80b..f907004 100755 --- a/include/game.h +++ b/include/game.h @@ -1635,72 +1635,244 @@ public: class dStageActor_c; // forward declaration
+
+enum SensorFlags {
+ SENSOR_POINT = 0,
+ SENSOR_LINE = 1,
+
+ SENSOR_TYPE_MASK = 1,
+ SENSOR_2 = 2, // has not shown up yet...?
+ SENSOR_IGNORE_SIMPLE_COLL = 4,
+ SENSOR_8 = 8, // can enter pipe?
+ SENSOR_10 = 0x10, // Related to ice
+ SENSOR_20 = 0x20, // related to ice, too
+ SENSOR_40 = 0x40, // checked by simplecollider
+ SENSOR_80 = 0x80, // checked by simplecollider
+ SENSOR_100 = 0x100, // checked by simplecollider
+ SENSOR_200 = 0x200, // checked by simplecollider
+ SENSOR_400 = 0x400, // checked by simplecollider
+ SENSOR_800 = 0x800, // checked by simplecollider
+ SENSOR_NO_QUICKSAND = 0x1000,
+ SENSOR_2000 = 0x2000, // something to do with fences maybe?
+ SENSOR_BREAK_BLOCK = 0x4000,
+ SENSOR_8000 = 0x8000, // used
+ SENSOR_10000 = 0x10000, // used
+ SENSOR_COIN_1 = 0x20000,
+ SENSOR_COIN_2 = 0x40000,
+ SENSOR_COIN_OUTLINE = 0x80000,
+ SENSOR_ACTIVATE_QUESTION = 0x100000,
+ SENSOR_ACTIVATE_DONUTS = 0x200000,
+ SENSOR_HIT_BRICK = 0x400000,
+ SENSOR_BREAK_BRICK = 0x800000,
+ SENSOR_HIT_OR_BREAK_BRICK = 0xC00000,
+ SENSOR_1000000 = 0x1000000, // has not shown up yet...?
+ SENSOR_2000000 = 0x2000000, // corresponds to SCF_400?
+ SENSOR_4000000 = 0x4000000, // something related to hitting blocks
+ SENSOR_8000000 = 0x8000000, // corresponds to SCF_20?
+ SENSOR_10000000 = 0x10000000, // used
+ SENSOR_20000000 = 0x20000000, // used
+ SENSOR_40000000 = 0x40000000, // used
+ SENSOR_80000000 = 0x80000000, // used
+};
+
+// Output is split into...
+// Above :
+// FC000000: 11111100000000000000000000000000
+// Below :
+// 3FFE000: 11111111111110000000000000
+// 1FE000: 111111110000000000000
+// 18000: 11000000000000000
+// Adjacent:
+// 1FFF: 1111111111111
+
+enum SensorOutputFlags {
+ CSOUT_ABOVE_ALL = 0xFC000000,
+ CSOUT_BELOW_ALL = 0x3FFE000,
+ CSOUT_ADJACENT_ALL = 0x1FFF,
+};
+
+// 0x8000 : Has object from Class 2DC?
+// 0x4000 : Has slope from Class 2DC?
+
+struct hLine_s {
+ float x1, x2, y;
+};
+struct vLine_s {
+ float x, y1, y2;
+};
+
+struct pointSensor_s;
+struct lineSensor_s;
+struct sensorBase_s {
+ u32 flags;
+ inline pointSensor_s *asPoint() const {
+ return (pointSensor_s*)this;
+ }
+ inline lineSensor_s *asLine() const {
+ return (lineSensor_s*)this;
+ }
+};
+struct pointSensor_s : sensorBase_s {
+ inline pointSensor_s() { }
+ inline pointSensor_s(s32 _x, s32 _y) {
+ x = _x; y = _y;
+ }
+ inline pointSensor_s(u32 _flags, s32 _x, s32 _y) {
+ flags = _flags | SENSOR_POINT;
+ x = _x; y = _y;
+ }
+ s32 x, y;
+};
+struct lineSensor_s : sensorBase_s {
+ inline lineSensor_s() { }
+ inline lineSensor_s(s32 _a, s32 _b, s32 _d) {
+ flags = SENSOR_LINE;
+ lineA = _a; lineB = _b;
+ distanceFromCenter = _d;
+ }
+ inline lineSensor_s(u32 _flags, s32 _a, s32 _b, s32 _d) {
+ flags = _flags | SENSOR_LINE;
+ lineA = _a; lineB = _b;
+ distanceFromCenter = _d;
+ }
+ s32 lineA, lineB, distanceFromCenter;
+};
+
class collisionMgr_c {
-public:
- collisionMgr_c();
- virtual ~collisionMgr_c();
-
- //FIXME params and returns and add more
- void Clear1();
- void Clear2();
- void Init(dStageActor_c*,const u8*,const u8*,const u8*);
-
- void Clear3();
- bool CollidedWithTile();
- int SomethingSemiImportant(u32);
- u32 execute();
-
- u32 s_8006FA40(void *);
- u32 s_80070760();
- bool s_800707E0();
-
- dStageActor_c* owner;
- void* struct1_ptr;
- void* struct2_ptr;
- void* some_ptr;
- Vec3* parent_pos_ptr;
- Vec3* parent_last_pos_ptr;
- Vec3* parent_speed_ptr;
- Vec3 someVelocityThing;
- float xDeltaMaybe;
- float yDeltaMaybe;
- u8 _34[24]; //FIXME
- float someFloat;
- void* class2DC_ptr; //FIXME
- void* another_ptr;
- void* ptr_to_ptr_to_underneath_actor;
- u8 _5C[44]; //FIXME
- u32 bitfield_for_checks;
- u32 bitfield_backup;
- u32 _90, _94;
- u8 which_player_of_parent;
- u8 which_controller;
- u16 _9A, _9C;
- u8 _9E[2]; //FIXME
- u32 another_bitfield;
- u8 _A4;
- u8 _A5[3]; //FIXME
- u32 yet_another_bitfield;
- u8 _AC;
- u8 _AD[3]; //FIXME
- u32 directional_bitfields[2]; // left right
- u8 flagsB8;
- u8 flagsB9;
- u8 _BA[2]; //FIXME
- u8 _BC, _BD;
- u16 _BE;
- u8 _C0, _C1;
- u16 _C2;
- u8 _C4[4]; //FIXME
- u16 _C8;
- u8 _CA[22]; //FIXME
- u8 _E0, _E1, _E2;
- u8 _E3; //FIXME
- u8 _E4, _E5;
- u8 _E6[2]; //FIXME
- u32 current_layer_ptr;
- u8 current_layer;
- u8 _ED[3]; //FIXME
+ public:
+ collisionMgr_c();
+ virtual ~collisionMgr_c();
+
+ dStageActor_c *owner;
+ sensorBase_s *pBelowInfo, *pAboveInfo, *pAdjacentInfo;
+
+ VEC3 *pPos, *pLastPos, *pSpeed;
+ VEC3 specialSpeedOffset;
+ float xDeltaMaybe, yDeltaMaybe;
+ float _34, _38;
+ u32 _3C, _40, _44, _48;
+ float initialXAsSetByJumpDai;
+ /*dClass2DC_c*/void *pClass2DC;
+ u32 _54;
+ Physics *sCollBelow;
+ Physics *sCollAbove;
+ Physics *sCollAdjacentLast, *sCollAdjacent[2];
+ collisionMgr_c *_6C, *_70, *_74;
+ collisionMgr_c *_78[2];
+ Physics *_80[2];
+ u32 outputMaybe;
+ u32 _8C;
+ u32 someStoredBehaviourFlags, someStoredProps;
+ char whichPlayerOfParent____;
+ char whichController____;
+ u16 _9A, _9C;
+ u32 tileBelowProps;
+ u8 tileBelowSubType, lastTileBelowSubType;
+ u32 tileAboveProps;
+ u8 tileAboveSubType, lastTileAboveSubType;
+ u32 adjacentTileProps[2];
+ u8 adjacentTileSubType[2];
+ u8 _BA, _BB;
+ u8 _BC; // &8 makes able to enter mini pipes?
+ u8 currentSlopeType;
+ s16 currentSlopeAngle;
+ u8 currentFlippedSlopeType;
+ s16 currentFlippedSlopeAngle;
+ u32 _C4;
+ u16 currentAdjacentSlopeAngle;
+ u32 currentFenceType; // 0=null 1=ladder 2=fence
+ Physics *_D0;
+ float _D4;
+ float _D8;
+ float _DC;
+ u8 touchedSpikeFlag;
+ s8 maxTouchedSpikeType;
+ u8 currentSlopeDirection, _E3, onGround_maybe, chainlinkMode;
+ u8 *pLayerID;
+ u8 layer;
+ bool enteredPipeIsMini;
+
+ // Setup
+ void clear1();
+ void clear2();
+ void init(dStageActor_c *owner, const sensorBase_s *belowInfo, const sensorBase_s *aboveInfo, const sensorBase_s *adjacentInfo);
+
+ u32 calculateBelowCollision();
+ u32 calculateAboveCollision(u32 value);
+ u32 calculateAdjacentCollision(float *pFloat=0);
+
+ bool setBelowSubType(u32 magic); // maybe not public?
+
+ u8 getBelowSubType();
+ u8 getAboveSubType();
+ u8 getAdjacentSubType(int direction);
+
+ int returnSomethingBasedOnSlopeAngle();
+ bool doesSlopeGoUp();
+
+ int getSlopeYDirectionForXDirection(int direction);
+ int getSlopeYDirectionForXDirection(int direction, int slopeType);
+ s16 getAngleOfSlopeInDirection(int direction);
+ s16 getAngleOfSlopeWithXSpeed(float xSpeed);
+ s16 getAngleOfSlopeInDirection2(int thing);
+ s16 getAngleOfFlippedSlopeInDirection(int thing);
+ s16 getAngleOfFlippedSlopeInDirection2(int thing);
+
+ static bool checkPositionForTileOrSColl(float x, float y, u8 layer, u32 unk, u32 mask);
+ static int getPartialBlockExistenceAtPos(float x, float y, u8 layer);
+ static bool isPartialBlockOrBlockSolidAtPos(float x, float y, u8 layer);
+ static u32 getTileBehaviour1At(float x, float y, u8 layer);
+ static u32 getTileBehaviour2At(float x, float y, u8 layer);
+ static u32 getTileBehaviour1At(u16 x, u16 y, u8 layer);
+ static u32 getTileBehaviour2At(u16 x, u16 y, u8 layer);
+
+ u8 getOwnerStageActorType() const;
+ u32 returnOutputAnd18000() const;
+ bool isOnTopOfTile() const;
+
+ u32 s_80071210(dStageActor_c *player);
+ bool tryToEnterPipeBelow(VEC3 *pOutVec, int *pOutEntranceID);
+ bool tryToEnterPipeAbove(VEC3 *pOutVec, int *pOutEntranceID);
+ bool tryToEnterAdjacentPipe(VEC3 *pOutVec, int unk, int *pOutEntranceID, float fp1, float fp2);
+ u32 detectFence(lineSensor_s *info);
+ bool detectClimbingPole(lineSensor_s *info);
+
+ bool s_80072440(VEC2 *v2one, VEC2 *v2two, float *pOutFloat);
+ bool s_800728C0(VEC2 *vecParam, float *pOutFloat);
+
+ u32 calculateBelowCollisionWithSmokeEffect();
+
+ u32 calculateAdjacentCollisionAlternate(float *pFloat=0);
+
+ static void setupEverything(int wrapType);
+
+ bool getBelowSensorHLine(hLine_s *outLine);
+ bool getAboveSensorHLine(hLine_s *outLine);
+ bool getAdjacentSensorVLine(vLine_s *outLine, int direction);
+
+ void s_800731E0(Physics *sColl, VEC3 *somePos);
+
+ void clearStoredSColls();
+ void s_80075090();
+ bool s_800751C0(Physics *sColl, collisionMgr_c *what);
+ collisionMgr_c *s_80075230(Physics *sColl);
+
+ static int checkPositionForLiquids(float x, float y, int layer, float *unkDestFloat = 0);
+ static int s_80075560(float x, float y, int layer, float *destFloat);
+ static bool s_80075750(VEC2 *pVec);
+ static bool s_80075780(s16 *pAngle);
+
+ enum SlopeTypes {
+ SLOPE_EDGE = 10,
+ SLOPE_TYPE_COUNT = 19
+ };
+ struct slopeParams_s {
+ float basePos, colHeight;
+ };
+ static const slopeParams_s slopeParams[SLOPE_TYPE_COUNT];
+ static const slopeParams_s flippedSlopeParams[SLOPE_TYPE_COUNT];
+ static const u8 slopeKinds[SLOPE_TYPE_COUNT];
+ static const u8 slopeDirections[SLOPE_TYPE_COUNT];
};
class BasicCollider {
|