mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-12-22 07:18:49 -05:00
Improve element collisions
This commit is contained in:
parent
1f9feb0d71
commit
6c57ef314a
@ -79,7 +79,7 @@
|
|||||||
Distance at which level elements (sprites) collide, in RCL_Unit (1024 per
|
Distance at which level elements (sprites) collide, in RCL_Unit (1024 per
|
||||||
square).
|
square).
|
||||||
*/
|
*/
|
||||||
#define SFG_ELEMENT_COLLISION_DISTANCE 2048
|
#define SFG_ELEMENT_COLLISION_DISTANCE 2500
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Height, in RCL_Units, at which collisions happen with level elements
|
Height, in RCL_Units, at which collisions happen with level elements
|
||||||
|
24
main.c
24
main.c
@ -1774,14 +1774,12 @@ static inline uint8_t SFG_elementCollides(
|
|||||||
RCL_Unit pointZ,
|
RCL_Unit pointZ,
|
||||||
RCL_Unit elementX,
|
RCL_Unit elementX,
|
||||||
RCL_Unit elementY,
|
RCL_Unit elementY,
|
||||||
RCL_Unit elementHeight,
|
RCL_Unit elementHeight
|
||||||
RCL_Unit heightMargin,
|
|
||||||
RCL_Unit widthMargin
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
SFG_taxicabDistance(pointX,pointY,pointZ,elementX,elementY,elementHeight)
|
SFG_taxicabDistance(pointX,pointY,pointZ,elementX,elementY,elementHeight)
|
||||||
<= (SFG_ELEMENT_COLLISION_DISTANCE + widthMargin);
|
<= SFG_ELEMENT_COLLISION_DISTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2153,8 +2151,7 @@ void SFG_gameStep()
|
|||||||
mPos.y,
|
mPos.y,
|
||||||
SFG_floorHeightAt(
|
SFG_floorHeightAt(
|
||||||
SFG_MONSTER_COORD_TO_SQUARES(m->coords[0]),
|
SFG_MONSTER_COORD_TO_SQUARES(m->coords[0]),
|
||||||
SFG_MONSTER_COORD_TO_SQUARES(m->coords[1])),
|
SFG_MONSTER_COORD_TO_SQUARES(m->coords[1]))
|
||||||
0,0
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -2186,8 +2183,7 @@ void SFG_gameStep()
|
|||||||
SFG_player.camera.height,
|
SFG_player.camera.height,
|
||||||
ePos.x,
|
ePos.x,
|
||||||
ePos.y,
|
ePos.y,
|
||||||
SFG_floorHeightAt(e->coords[0],e->coords[1]),
|
SFG_floorHeightAt(e->coords[0],e->coords[1])
|
||||||
0,0
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -2308,9 +2304,8 @@ void SFG_gameStep()
|
|||||||
SFG_player.camera.height,
|
SFG_player.camera.height,
|
||||||
p->position[0],
|
p->position[0],
|
||||||
p->position[1],
|
p->position[1],
|
||||||
p->position[2],
|
p->position[2]
|
||||||
0,
|
))
|
||||||
0))
|
|
||||||
{
|
{
|
||||||
eliminate = 1;
|
eliminate = 1;
|
||||||
|
|
||||||
@ -2349,9 +2344,8 @@ void SFG_gameStep()
|
|||||||
SFG_MONSTER_COORD_TO_RCL_UNITS(m->coords[1]),
|
SFG_MONSTER_COORD_TO_RCL_UNITS(m->coords[1]),
|
||||||
SFG_floorHeightAt(
|
SFG_floorHeightAt(
|
||||||
SFG_MONSTER_COORD_TO_SQUARES(m->coords[0]),
|
SFG_MONSTER_COORD_TO_SQUARES(m->coords[0]),
|
||||||
SFG_MONSTER_COORD_TO_SQUARES(m->coords[1])),
|
SFG_MONSTER_COORD_TO_SQUARES(m->coords[1]))
|
||||||
0,
|
)
|
||||||
0)
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
eliminate = 1;
|
eliminate = 1;
|
||||||
@ -2374,7 +2368,7 @@ void SFG_gameStep()
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
SFG_elementCollides(p->position[0],p->position[1],p->position[2],
|
SFG_elementCollides(p->position[0],p->position[1],p->position[2],
|
||||||
x,y,z,0,0)
|
x,y,z)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user