projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed crash bug when running in headless mode
[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 45c65634a9985556c75420f04edc463ead080198..316c891edea811616016ef637d49bde1764c50ed 100644
(file)
--- a/
src/game_mm/mm_game.c
+++ b/
src/game_mm/mm_game.c
@@
-958,7
+958,8
@@
static void DeactivateLaserTargetElement(void)
void ScanLaser(void)
{
void ScanLaser(void)
{
- int element;
+ int element = EL_EMPTY;
+ int last_element = EL_EMPTY;
int end = 0, rf = laser.num_edges;
// do not scan laser again after the game was lost for whatever reason
int end = 0, rf = laser.num_edges;
// do not scan laser again after the game was lost for whatever reason
@@
-1044,6
+1045,8
@@
void ScanLaser(void)
hit_mask, LX, LY, ELX, ELY);
#endif
hit_mask, LX, LY, ELX, ELY);
#endif
+ last_element = element;
+
element = Tile[ELX][ELY];
laser.dest_element = element;
element = Tile[ELX][ELY];
laser.dest_element = element;
@@
-1062,6
+1065,12
@@
void ScanLaser(void)
ELX, ELY, element);
#endif
ELX, ELY, element);
#endif
+ // special case: leaving fixed MM steel grid (upwards) with non-90° angle
+ if (element == EL_EMPTY &&
+ IS_GRID_STEEL(last_element) &&
+ laser.current_angle % 4) // angle is not 90°
+ element = last_element;
+
if (element == EL_EMPTY)
{
if (!HitOnlyAnEdge(hit_mask))
if (element == EL_EMPTY)
{
if (!HitOnlyAnEdge(hit_mask))
@@
-1120,6
+1129,14
@@
void ScanLaser(void)
if (rf)
DrawLaser(rf - 1, DL_LASER_ENABLED);
rf = laser.num_edges;
if (rf)
DrawLaser(rf - 1, DL_LASER_ENABLED);
rf = laser.num_edges;
+
+ if (!IS_DF_WALL_STEEL(element))
+ {
+ // only used for scanning DF steel walls; reset for all other elements
+ last_LX = 0;
+ last_LY = 0;
+ last_hit_mask = 0;
+ }
}
#if 0
}
#if 0
@@
-1465,6
+1482,10
@@
boolean HitElement(int element, int hit_mask)
// this is more precise: check if laser would go through the center
if ((ELX * TILEX + 14 - LX) * YS != (ELY * TILEY + 14 - LY) * XS)
{
// this is more precise: check if laser would go through the center
if ((ELX * TILEX + 14 - LX) * YS != (ELY * TILEY + 14 - LY) * XS)
{
+ // prevent cutting through laser emitter with laser beam
+ if (IS_LASER(element))
+ return TRUE;
+
// skip the whole element before continuing the scan
do
{
// skip the whole element before continuing the scan
do
{