summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-15 15:36:42 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-15 15:36:42 (GMT)
commitc7213127e52b0484b9b4b87fd57877ff0c523a59 (patch)
treec796e9d2d325cb13a0ea8c2ded5999e9f5833db1 /src
parent42d7b56602fcc77a87237cb0c74449a65297f3d3 (diff)
downloadpowder-c7213127e52b0484b9b4b87fd57877ff0c523a59.zip
powder-c7213127e52b0484b9b4b87fd57877ff0c523a59.tar.gz
Temporarily undo photon reflection fix (causes inaccuracies).
Diffstat (limited to 'src')
-rw-r--r--src/powder.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/src/powder.c b/src/powder.c
index 2ac2324..09c21ff 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -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)
{
// TODO:
- // adding extra directions causes some inaccuracies
- // not adding them causes problems with some diagonal surfaces
- // solution may involve more intelligent setting of initial i0 value in find_next_boundary?
+ // Adding extra directions causes some inaccuracies.
+ // Not adding them causes problems with some diagonal surfaces (photons absorbed instead of reflected).
+ // 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
- if (t & REFRACT) {
- // extra directions cause noticeable inaccuracy for refraction (potentially breaking existing saves), so don't add them here
- return (dx >= 0) |
- (((dx + dy) >= 0) << 1) | /* 567 */
- ((dy >= 0) << 2) | /* 4+0 */
- (((dy - dx) >= 0) << 3) | /* 321 */
- ((dx <= 0) << 4) |
- (((dx + dy) <= 0) << 5) |
- ((dy <= 0) << 6) |
- (((dy - dx) <= 0) << 7);
- } else {
- // TODO: reflection still not perfect. See TODO note above.
- return (dx >= -0.001) |
- (((dx + dy) >= -0.001) << 1) | /* 567 */
- ((dy >= -0.001) << 2) | /* 4+0 */
- (((dy - dx) >= -0.001) << 3) | /* 321 */
- ((dx <= 0.001) << 4) |
- (((dx + dy) <= 0.001) << 5) |
- ((dy <= 0.001) << 6) |
- (((dy - dx) <= 0.001) << 7);
- }
+
+ return (dx >= 0) |
+ (((dx + dy) >= 0) << 1) | /* 567 */
+ ((dy >= 0) << 2) | /* 4+0 */
+ (((dy - dx) >= 0) << 3) | /* 321 */
+ ((dx <= 0) << 4) |
+ (((dx + dy) <= 0) << 5) |
+ ((dy <= 0) << 6) |
+ (((dy - dx) <= 0) << 7);
+ /*
+ return (dx >= -0.001) |
+ (((dx + dy) >= -0.001) << 1) | // 567
+ ((dy >= -0.001) << 2) | // 4+0
+ (((dy - dx) >= -0.001) << 3) | // 321
+ ((dx <= 0.001) << 4) |
+ (((dx + dy) <= 0.001) << 5) |
+ ((dy <= 0.001) << 6) |
+ (((dy - dx) <= 0.001) << 7);
+ }*/
}
static int is_blocking(int t, int x, int y)