summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-05-09 21:31:37 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-05-14 12:39:14 (GMT)
commit882a8392058aa7a6487069dddd0f565c54ca342d (patch)
tree0c32533f878a17d7a14e36d786a36167b51b761b /src
parentfa54c005b298befb065a8aa4134836b0460b75b7 (diff)
downloadpowder-882a8392058aa7a6487069dddd0f565c54ca342d.zip
powder-882a8392058aa7a6487069dddd0f565c54ca342d.tar.gz
Fix high speed photons when reflecting near glass
Diffstat (limited to 'src')
-rw-r--r--src/powder.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/powder.c b/src/powder.c
index 63dcee0..af819bd 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1883,6 +1883,13 @@ killed:
fin_x = (int)(parts[i].x + parts[i].vx + 0.5f);
fin_y = (int)(parts[i].y + parts[i].vy + 0.5f);
// cast as int then back to float for compatibility with existing saves
+ if (t==PT_PHOT) {
+ s = eval_move(PT_PHOT, fin_x, fin_y, &r);
+ if ((((r&0xFF)==PT_GLAS && lt!=PT_GLAS) || ((r&0xFF)!=PT_GLAS && lt==PT_GLAS)) && s) {
+ // if movement will involve refraction, leave it until next frame so that refraction happens correctly
+ goto movedone;
+ }
+ }
if (try_move(i, x, y, fin_x, fin_y)) {
parts[i].x = (float)fin_x;
parts[i].y = (float)fin_y;