Fix photon reflection.
In cases such as photons travelling horizontally left towards a line with a shallow slope downwards from left to right. Direction map now includes directions parallel to photon velocity in these cases.
This commit is contained in:
parent
7f83cb1061
commit
56a3ad373c
16
src/powder.c
16
src/powder.c
@ -260,14 +260,14 @@ int try_move(int i, int x, int y, int nx, int ny)
|
|||||||
|
|
||||||
static unsigned direction_to_map(float dx, float dy)
|
static unsigned direction_to_map(float dx, float dy)
|
||||||
{
|
{
|
||||||
return (dx >= 0) |
|
return (dx >= -0.1) |
|
||||||
(((dx + dy) >= 0) << 1) | /* 567 */
|
(((dx + dy) >= -0.1) << 1) | /* 567 */
|
||||||
((dy >= 0) << 2) | /* 4+0 */
|
((dy >= -0.1) << 2) | /* 4+0 */
|
||||||
(((dy - dx) >= 0) << 3) | /* 321 */
|
(((dy - dx) >= -0.1) << 3) | /* 321 */
|
||||||
((dx <= 0) << 4) |
|
((dx <= 0.1) << 4) |
|
||||||
(((dx + dy) <= 0) << 5) |
|
(((dx + dy) <= 0.1) << 5) |
|
||||||
((dy <= 0) << 6) |
|
((dy <= 0.1) << 6) |
|
||||||
(((dy - dx) <= 0) << 7);
|
(((dy - dx) <= 0.1) << 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int is_blocking(int t, int x, int y)
|
static int is_blocking(int t, int x, int y)
|
||||||
|
Reference in New Issue
Block a user