mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-01 09:18:00 +03:00
Improve collision vectors
This commit is contained in:
parent
e46a000190
commit
73b17c40b4
2 changed files with 11 additions and 2 deletions
|
@ -1033,6 +1033,7 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
|
||||||
coll->shift.y = 0;
|
coll->shift.y = 0;
|
||||||
coll->shift.z = 0;
|
coll->shift.z = 0;
|
||||||
coll->quadrant = (unsigned short) (coll->facing + ANGLE(45)) / ANGLE(90);
|
coll->quadrant = (unsigned short) (coll->facing + ANGLE(45)) / ANGLE(90);
|
||||||
|
coll->octant = (unsigned short) (coll->facing + ANGLE(22.5)) / ANGLE(45);
|
||||||
|
|
||||||
int x = xPos;
|
int x = xPos;
|
||||||
int y = yPos - objectHeight;
|
int y = yPos - objectHeight;
|
||||||
|
@ -1063,7 +1064,7 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
|
||||||
|
|
||||||
int xright, xleft, zright, zleft;
|
int xright, xleft, zright, zleft;
|
||||||
|
|
||||||
switch (coll->quadrant)
|
/*switch (coll->quadrant)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
XFront = (phd_sin(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
XFront = (phd_sin(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
||||||
|
@ -1106,7 +1107,14 @@ void GetCollisionInfo(COLL_INFO* coll, int xPos, int yPos, int zPos, int roomNum
|
||||||
xright = zright = 0;
|
xright = zright = 0;
|
||||||
XFront = ZFront = 0;
|
XFront = ZFront = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
XFront = (phd_sin(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
||||||
|
ZFront = (phd_cos(coll->facing) * coll->radius) >> (W2V_SHIFT);
|
||||||
|
xleft = ZFront;
|
||||||
|
zleft = -XFront;
|
||||||
|
xright = -ZFront;
|
||||||
|
zright = XFront;
|
||||||
|
|
||||||
x = XFront + xPos;
|
x = XFront + xPos;
|
||||||
z = ZFront + zPos;
|
z = ZFront + zPos;
|
||||||
|
|
|
@ -72,6 +72,7 @@ struct COLL_INFO
|
||||||
short oldFrameNumber;
|
short oldFrameNumber;
|
||||||
short facing;
|
short facing;
|
||||||
short quadrant;
|
short quadrant;
|
||||||
|
short octant;
|
||||||
short collType; // CT_enum
|
short collType; // CT_enum
|
||||||
short* trigger;
|
short* trigger;
|
||||||
signed char tiltX;
|
signed char tiltX;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue