Temporarily undo photon reflection fix (causes inaccuracies).

This commit is contained in:
jacksonmj 2011-01-15 15:36:42 +00:00
parent 42d7b56602
commit c7213127e5

View File

@ -261,31 +261,30 @@ int try_move(int i, int x, int y, int nx, int ny)
static unsigned direction_to_map(float dx, float dy, int t) static unsigned direction_to_map(float dx, float dy, int t)
{ {
// TODO: // TODO:
// adding extra directions causes some inaccuracies // Adding extra directions causes some inaccuracies.
// not adding them causes problems with some diagonal surfaces // Not adding them causes problems with some diagonal surfaces (photons absorbed instead of reflected).
// solution may involve more intelligent setting of initial i0 value in find_next_boundary? // For now, don't add them.
// Solution may involve more intelligent setting of initial i0 value in find_next_boundary?
// or rewriting normal/boundary finding code // or rewriting normal/boundary finding code
if (t & REFRACT) {
// extra directions cause noticeable inaccuracy for refraction (potentially breaking existing saves), so don't add them here return (dx >= 0) |
return (dx >= 0) | (((dx + dy) >= 0) << 1) | /* 567 */
(((dx + dy) >= 0) << 1) | /* 567 */ ((dy >= 0) << 2) | /* 4+0 */
((dy >= 0) << 2) | /* 4+0 */ (((dy - dx) >= 0) << 3) | /* 321 */
(((dy - dx) >= 0) << 3) | /* 321 */ ((dx <= 0) << 4) |
((dx <= 0) << 4) | (((dx + dy) <= 0) << 5) |
(((dx + dy) <= 0) << 5) | ((dy <= 0) << 6) |
((dy <= 0) << 6) | (((dy - dx) <= 0) << 7);
(((dy - dx) <= 0) << 7); /*
} else { return (dx >= -0.001) |
// TODO: reflection still not perfect. See TODO note above. (((dx + dy) >= -0.001) << 1) | // 567
return (dx >= -0.001) | ((dy >= -0.001) << 2) | // 4+0
(((dx + dy) >= -0.001) << 1) | /* 567 */ (((dy - dx) >= -0.001) << 3) | // 321
((dy >= -0.001) << 2) | /* 4+0 */ ((dx <= 0.001) << 4) |
(((dy - dx) >= -0.001) << 3) | /* 321 */ (((dx + dy) <= 0.001) << 5) |
((dx <= 0.001) << 4) | ((dy <= 0.001) << 6) |
(((dx + dy) <= 0.001) << 5) | (((dy - dx) <= 0.001) << 7);
((dy <= 0.001) << 6) | }*/
(((dy - dx) <= 0.001) << 7);
}
} }
static int is_blocking(int t, int x, int y) static int is_blocking(int t, int x, int y)