projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bug with wrong laser position for slope element check in MM engine
[rocksndiamonds.git]
/
src
/
game_mm
/
mm_game.c
diff --git
a/src/game_mm/mm_game.c
b/src/game_mm/mm_game.c
index 46f914de964302cd2f31fae73d811cdc1a99b7b2..58ae03db5ef0d351f7eb7a4546a7ff93946ae541 100644
(file)
--- a/
src/game_mm/mm_game.c
+++ b/
src/game_mm/mm_game.c
@@
-981,6
+981,11
@@
static int getMaskFromElement(int element)
return MM_MASK_CIRCLE;
}
return MM_MASK_CIRCLE;
}
+static int getPixelFromMask(int pos, int dx, int dy)
+{
+ return (mm_masks[pos][dy / 2][dx / 2] == 'X' ? 1 : 0);
+}
+
static int getLevelFromLaserX(int x)
{
return x / TILEX - (x < 0 ? 1 : 0); // correct negative values
static int getLevelFromLaserX(int x)
{
return x / TILEX - (x < 0 ? 1 : 0); // correct negative values
@@
-1064,7
+1069,7
@@
static int ScanPixel(void)
{
int pos = getMaskFromElement(element);
{
int pos = getMaskFromElement(element);
- pixel =
(mm_masks[pos][dy / 2][dx / 2] == 'X' ? 1 : 0
);
+ pixel =
getPixelFromMask(pos, dx, dy
);
}
}
else
}
}
else
@@
-1708,8
+1713,8
@@
static boolean HitElement(int element, int hit_mask)
int pos = getMaskFromElement(element);
// check if we are entering empty space area after hitting edge
int pos = getMaskFromElement(element);
// check if we are entering empty space area after hitting edge
- if (
mm_masks[pos][dx1 / 2][dy1 / 2] != 'X'
&&
-
mm_masks[pos][dx2 / 2][dy2 / 2] != 'X'
)
+ if (
!getPixelFromMask(pos, dx1, dy1)
&&
+
!getPixelFromMask(pos, dx2, dy2)
)
{
// we already know that we hit an edge, but use this function to go on
if (HitOnlyAnEdge(hit_mask))
{
// we already know that we hit an edge, but use this function to go on
if (HitOnlyAnEdge(hit_mask))
@@
-1951,8
+1956,8
@@
static boolean HitElement(int element, int hit_mask)
{
int elx, ely;
{
int elx, ely;
- elx = getLevelFromLaserX(LX);
- ely = getLevelFromLaserY(LY);
+ elx = getLevelFromLaserX(LX
+ XS
);
+ ely = getLevelFromLaserY(LY
+ YS
);
if (IN_LEV_FIELD(elx, ely))
{
if (IN_LEV_FIELD(elx, ely))
{
@@
-1965,8
+1970,8
@@
static boolean HitElement(int element, int hit_mask)
int nr = element - EL_DF_SLOPE_START;
int dx = (nr == 0 ? (XS > 0 ? TILEX - 1 : -1) :
int nr = element - EL_DF_SLOPE_START;
int dx = (nr == 0 ? (XS > 0 ? TILEX - 1 : -1) :
- nr == 1 ? (XS > 0 ? TILEX :
1
) :
- nr == 2 ? (XS > 0 ? TILEX :
1
) :
+ nr == 1 ? (XS > 0 ? TILEX :
0
) :
+ nr == 2 ? (XS > 0 ? TILEX :
0
) :
nr == 3 ? (XS > 0 ? TILEX - 1 : -1) : 0);
int dy = (nr == 0 ? (YS > 0 ? TILEY - 1 : -1) :
nr == 1 ? (YS > 0 ? TILEY - 1 : -1) :
nr == 3 ? (XS > 0 ? TILEX - 1 : -1) : 0);
int dy = (nr == 0 ? (YS > 0 ? TILEY - 1 : -1) :
nr == 1 ? (YS > 0 ? TILEY - 1 : -1) :
@@
-1998,7
+2003,7
@@
static boolean HitElement(int element, int hit_mask)
{
int pos = getMaskFromElement(element_side);
{
int pos = getMaskFromElement(element_side);
- if (
mm_masks[pos][dx / 2][dy / 2] == 'X'
)
+ if (
getPixelFromMask(pos, dx, dy)
)
laser.overloaded = TRUE;
}
}
laser.overloaded = TRUE;
}
}