projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
685cf50
)
fixed advancing laser position on slopes from non-center position
author
Holger Schemel
<info@artsoft.org>
Wed, 17 May 2023 14:13:40 +0000
(16:13 +0200)
committer
Holger Schemel
<info@artsoft.org>
Wed, 17 May 2023 14:16:23 +0000
(16:16 +0200)
src/game_mm/mm_game.c
patch
|
blob
|
history
diff --git
a/src/game_mm/mm_game.c
b/src/game_mm/mm_game.c
index 5c5619d0e8e54fc12f51f7ffa9342420323686aa..b21f119727e415b455afcdf9f477d23220c53949 100644
(file)
--- a/
src/game_mm/mm_game.c
+++ b/
src/game_mm/mm_game.c
@@
-1901,13
+1901,27
@@
static boolean HitElement(int element, int hit_mask)
XS = 2 * Step[laser.current_angle].x;
YS = 2 * Step[laser.current_angle].y;
XS = 2 * Step[laser.current_angle].x;
YS = 2 * Step[laser.current_angle].y;
- if (!IS_22_5_ANGLE(laser.current_angle)) // 90° or 45° angle
- step_size = 8;
- else
- step_size = 4;
+ if (through_center)
+ {
+ // start from center position for all game elements but slope
+ if (!IS_22_5_ANGLE(laser.current_angle)) // 90° or 45° angle
+ step_size = 8;
+ else
+ step_size = 4;
- LX += step_size * XS;
- LY += step_size * YS;
+ LX += step_size * XS;
+ LY += step_size * YS;
+ }
+ else
+ {
+ // advance laser position until reaching the next tile (slopes)
+ while (LX / TILEX == ELX && (LX + 2) / TILEX == ELX &&
+ LY / TILEY == ELY && (LY + 2) / TILEY == ELY)
+ {
+ LX += XS;
+ LY += YS;
+ }
+ }
// draw sparkles on mirror
if ((IS_MIRROR(element) ||
// draw sparkles on mirror
if ((IS_MIRROR(element) ||