mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Add a couple more checks to the 3d collision detection, without
which a click miles above the invisible RH surface of a tower would sometimes select that tower. [originally from svn r8833]
This commit is contained in:
3
towers.c
3
towers.c
@ -1290,10 +1290,11 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
|
|||||||
(x - ox >= 0 && x - ox < TILESIZE &&
|
(x - ox >= 0 && x - ox < TILESIZE &&
|
||||||
y - oy >= 0 && y - oy < TILESIZE) ||
|
y - oy >= 0 && y - oy < TILESIZE) ||
|
||||||
/* in triangle between top-left corners? */
|
/* in triangle between top-left corners? */
|
||||||
(ox > bx && x >= bx && x <= ox &&
|
(ox > bx && x >= bx && x <= ox && y <= by &&
|
||||||
(by-y) * (ox-bx) <= (by-oy) * (x-bx)) ||
|
(by-y) * (ox-bx) <= (by-oy) * (x-bx)) ||
|
||||||
/* in triangle between bottom-right corners? */
|
/* in triangle between bottom-right corners? */
|
||||||
(ox > bx && x >= bx+TILESIZE && x <= ox+TILESIZE &&
|
(ox > bx && x >= bx+TILESIZE && x <= ox+TILESIZE &&
|
||||||
|
y >= oy+TILESIZE &&
|
||||||
(by-y+TILESIZE)*(ox-bx) >= (by-oy)*(x-bx-TILESIZE))) {
|
(by-y+TILESIZE)*(ox-bx) >= (by-oy)*(x-bx-TILESIZE))) {
|
||||||
tx = cx;
|
tx = cx;
|
||||||
ty = cy;
|
ty = cy;
|
||||||
|
Reference in New Issue
Block a user