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 laser still growing amoeba after it was destroyed by bomb
[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 d282dfe110eccbb1db631072a13035ee07ce64c0..f89e23d80168367b31614bc36ff6c8335342c036 100644
(file)
--- a/
src/game_mm/mm_game.c
+++ b/
src/game_mm/mm_game.c
@@
-66,12
+66,17
@@
#define DL_LASER_ENABLED 1
/* values for 'click_delay_value' in ClickElement() */
#define DL_LASER_ENABLED 1
/* values for 'click_delay_value' in ClickElement() */
-#define CLICK_DELAY_
SHORT 125
-#define CLICK_DELAY
_LONG 250
+#define CLICK_DELAY_
FIRST 12 /* delay (frames) after first click */
+#define CLICK_DELAY
6 /* delay (frames) for pressed butten */
-#define AUTO_ROTATE_DELAY CLICK_DELAY
_SHORT
-#define INIT_GAME_ACTIONS_DELAY
ONE_SECOND_DELAY
+#define AUTO_ROTATE_DELAY CLICK_DELAY
+#define INIT_GAME_ACTIONS_DELAY
(ONE_SECOND_DELAY / GAME_FRAME_DELAY)
#define NUM_INIT_CYCLE_STEPS 16
#define NUM_INIT_CYCLE_STEPS 16
+#define PACMAN_MOVE_DELAY 12
+#define ENERGY_DELAY (4 * ONE_SECOND_DELAY / GAME_FRAME_DELAY)
+#define HEALTH_DEC_DELAY 3
+#define HEALTH_INC_DELAY 9
+#define HEALTH_DELAY(x) ((x) ? HEALTH_DEC_DELAY : HEALTH_INC_DELAY)
/* forward declaration for internal use */
static int MovingOrBlocked2Element_MM(int, int);
/* forward declaration for internal use */
static int MovingOrBlocked2Element_MM(int, int);
@@
-270,6
+275,9
@@
static void InitLaser()
laser.num_beamers = 0;
laser.beamer_edge[0] = 0;
laser.num_beamers = 0;
laser.beamer_edge[0] = 0;
+ laser.dest_element = EL_EMPTY;
+ laser.wall_mask = 0;
+
AddLaserEdge(LX, LY); /* set laser starting edge */
pen_ray = GetPixelFromRGB(window,
AddLaserEdge(LX, LY); /* set laser starting edge */
pen_ray = GetPixelFromRGB(window,
@@
-342,7
+350,7
@@
void InitGameEngine_MM()
void InitGameActions_MM()
{
void InitGameActions_MM()
{
- int num_init_game_frames = INIT_GAME_ACTIONS_DELAY
/ GAME_FRAME_DELAY
;
+ int num_init_game_frames = INIT_GAME_ACTIONS_DELAY;
int cycle_steps_done = 0;
int i;
int cycle_steps_done = 0;
int i;
@@
-733,7
+741,7
@@
void ScanLaser()
if (rf)
DrawLaser(rf - 1, DL_LASER_ENABLED);
if (rf)
DrawLaser(rf - 1, DL_LASER_ENABLED);
- Ct = CT =
Counter()
;
+ Ct = CT =
FrameCounter
;
#if 0
if (!IN_LEV_FIELD(ELX, ELY))
#if 0
if (!IN_LEV_FIELD(ELX, ELY))
@@
-2176,17
+2184,19
@@
static void Explode_MM(int x, int y, int phase, int mode)
{
if (Store[x][y] == EL_BOMB)
{
{
if (Store[x][y] == EL_BOMB)
{
- laser.num_damages--;
DrawLaser(0, DL_LASER_DISABLED);
DrawLaser(0, DL_LASER_DISABLED);
-
laser.num_edges = 0
;
+
InitLaser()
;
Bang_MM(laser.start_edge.x, laser.start_edge.y);
Store[x][y] = EL_EMPTY;
Bang_MM(laser.start_edge.x, laser.start_edge.y);
Store[x][y] = EL_EMPTY;
+
+ game_mm.game_over = TRUE;
+ game_mm.game_over_cause = GAME_OVER_BOMB;
+
+ laser.overloaded = FALSE;
}
else if (IS_MCDUFFIN(Store[x][y]))
{
}
else if (IS_MCDUFFIN(Store[x][y]))
{
- game_mm.game_over = TRUE;
- game_mm.game_over_cause = GAME_OVER_BOMB;
Store[x][y] = EL_EMPTY;
}
Store[x][y] = EL_EMPTY;
}
@@
-2434,7
+2444,7
@@
static void ContinueMoving_MM(int x, int y)
void ClickElement(int x, int y, int button)
{
static unsigned int click_delay = 0;
void ClickElement(int x, int y, int button)
{
static unsigned int click_delay = 0;
- static int click_delay_value = CLICK_DELAY
_SHORT
;
+ static int click_delay_value = CLICK_DELAY;
static boolean new_button = TRUE;
int element;
static boolean new_button = TRUE;
int element;
@@
-2445,7
+2455,7
@@
void ClickElement(int x, int y, int button)
if (button == MB_RELEASED)
{
new_button = TRUE;
if (button == MB_RELEASED)
{
new_button = TRUE;
- click_delay_value = CLICK_DELAY
_SHORT
;
+ click_delay_value = CLICK_DELAY;
/* release eventually hold auto-rotating mirror */
RotateMirror(x, y, MB_RELEASED);
/* release eventually hold auto-rotating mirror */
RotateMirror(x, y, MB_RELEASED);
@@
-2453,7
+2463,7
@@
void ClickElement(int x, int y, int button)
return;
}
return;
}
- if (!
Delay
Reached(&click_delay, click_delay_value) && !new_button)
+ if (!
Frame
Reached(&click_delay, click_delay_value) && !new_button)
return;
if (button == MB_MIDDLEBUTTON) /* middle button has no function */
return;
if (button == MB_MIDDLEBUTTON) /* middle button has no function */
@@
-2530,7
+2540,7
@@
void ClickElement(int x, int y, int button)
DrawLaser(0, DL_LASER_ENABLED);
}
DrawLaser(0, DL_LASER_ENABLED);
}
- click_delay_value = (new_button ? CLICK_DELAY_
LONG : CLICK_DELAY_SHORT
);
+ click_delay_value = (new_button ? CLICK_DELAY_
FIRST : CLICK_DELAY
);
new_button = FALSE;
}
new_button = FALSE;
}
@@
-2636,7
+2646,7
@@
void AutoRotateMirrors()
static unsigned int rotate_delay = 0;
int x, y;
static unsigned int rotate_delay = 0;
int x, y;
- if (!
Delay
Reached(&rotate_delay, AUTO_ROTATE_DELAY))
+ if (!
Frame
Reached(&rotate_delay, AUTO_ROTATE_DELAY))
return;
for (x = 0; x < lev_fieldx; x++)
return;
for (x = 0; x < lev_fieldx; x++)
@@
-2728,9
+2738,9
@@
void ColorCycling(void)
if (color_status == STATIC_COLORS)
return;
if (color_status == STATIC_COLORS)
return;
- CC =
Counter()
;
+ CC =
FrameCounter
;
- if (CC < Cc || CC > Cc +
50
)
+ if (CC < Cc || CC > Cc +
2
)
{
Cc = CC;
{
Cc = CC;
@@
-2764,7
+2774,6
@@
void ColorCycling(void)
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
{
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
{
- static unsigned int action_delay = 0;
static unsigned int pacman_delay = 0;
static unsigned int energy_delay = 0;
static unsigned int overload_delay = 0;
static unsigned int pacman_delay = 0;
static unsigned int energy_delay = 0;
static unsigned int overload_delay = 0;
@@
-2773,8
+2782,6
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
int r, d;
int r, d;
- WaitUntilDelayReached(&action_delay, GameFrameDelay);
-
for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
Stop[x][y] = FALSE;
for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
Stop[x][y] = FALSE;
@@
-2809,9
+2816,9
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
laser.redraw = FALSE;
#endif
laser.redraw = FALSE;
#endif
- CT =
Counter()
;
+ CT =
FrameCounter
;
- if (game_mm.num_pacman &&
DelayReached(&pacman_delay, 250
))
+ if (game_mm.num_pacman &&
FrameReached(&pacman_delay, PACMAN_MOVE_DELAY
))
{
MovePacMen();
{
MovePacMen();
@@
-2822,7
+2829,7
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
}
}
}
}
- if (
DelayReached(&energy_delay, 4000
))
+ if (
FrameReached(&energy_delay, ENERGY_DELAY
))
{
game_mm.energy_left--;
if (game_mm.energy_left >= 0)
{
game_mm.energy_left--;
if (game_mm.energy_left >= 0)
@@
-2902,7
+2909,7
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
if (((laser.overloaded && laser.overload_value < MAX_LASER_OVERLOAD) ||
(!laser.overloaded && laser.overload_value > 0)) &&
if (((laser.overloaded && laser.overload_value < MAX_LASER_OVERLOAD) ||
(!laser.overloaded && laser.overload_value > 0)) &&
-
DelayReached(&overload_delay, 60 + !laser.overloaded * 120
))
+
FrameReached(&overload_delay, HEALTH_DELAY(laser.overloaded)
))
{
if (laser.overloaded)
laser.overload_value++;
{
if (laser.overloaded)
laser.overload_value++;
@@
-2933,7
+2940,9
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
(native_mm_level.laser_blue ? color_down : 0x00));
DrawLaser(0, DL_LASER_ENABLED);
(native_mm_level.laser_blue ? color_down : 0x00));
DrawLaser(0, DL_LASER_ENABLED);
+#if 0
BackToFront();
BackToFront();
+#endif
}
if (!laser.overloaded)
}
if (!laser.overloaded)
@@
-3011,7
+3020,7
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
CT -= Ct;
CT -= Ct;
- if (element == EL_BOMB && CT >
1500
)
+ if (element == EL_BOMB && CT >
75
)
{
if (game_mm.cheat_no_explosion)
return;
{
if (game_mm.cheat_no_explosion)
return;
@@
-3049,7
+3058,7
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
return;
}
return;
}
- if (element == EL_FUSE_ON && CT >
500
)
+ if (element == EL_FUSE_ON && CT >
25
)
{
laser.fuse_off = TRUE;
laser.fuse_x = ELX;
{
laser.fuse_off = TRUE;
laser.fuse_x = ELX;
@@
-3059,7
+3068,7
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
DrawGraphic_MM(ELX, ELY, IMG_MM_FUSE);
}
DrawGraphic_MM(ELX, ELY, IMG_MM_FUSE);
}
- if (element == EL_BALL_GRAY && CT >
1500
)
+ if (element == EL_BALL_GRAY && CT >
75
)
{
static int new_elements[] =
{
{
static int new_elements[] =
{
@@
-3178,7
+3187,7
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
return;
}
return;
}
- if (IS_WALL_ICE(element) && CT >
100
0)
+ if (IS_WALL_ICE(element) && CT >
5
0)
{
PlayLevelSound_MM(ELX, ELY, element, MM_ACTION_SHRINKING);
{
PlayLevelSound_MM(ELX, ELY, element, MM_ACTION_SHRINKING);
@@
-3230,7
+3239,7
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
return;
}
return;
}
- if (IS_WALL_AMOEBA(element) && CT >
120
0)
+ if (IS_WALL_AMOEBA(element) && CT >
6
0)
{
int k1, k2, k3, dx, dy, de, dm;
int element2 = Feld[ELX][ELY];
{
int k1, k2, k3, dx, dy, de, dm;
int element2 = Feld[ELX][ELY];
@@
-3348,7
+3357,7
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
}
if ((element == EL_BLOCK_WOOD || element == EL_BLOCK_STONE) &&
}
if ((element == EL_BLOCK_WOOD || element == EL_BLOCK_STONE) &&
- laser.stops_inside_element && CT >
1500
)
+ laser.stops_inside_element && CT >
75
)
{
int x, y;
int k;
{
int x, y;
int k;
@@
-3405,7
+3414,7
@@
static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
return;
}
return;
}
- if (element == EL_FUEL_FULL && CT >
20
0)
+ if (element == EL_FUEL_FULL && CT >
1
0)
{
for (i = game_mm.energy_left; i <= MAX_LASER_ENERGY; i+=2)
{
{
for (i = game_mm.energy_left; i <= MAX_LASER_ENERGY; i+=2)
{
@@
-3507,7
+3516,7
@@
void MovePacMen()
getGraphicSource(graphic, 0, &bitmap, &src_x, &src_y);
getGraphicSource(graphic, 0, &bitmap, &src_x, &src_y);
- CT =
Counter()
;
+ CT =
FrameCounter
;
ox = SX + ox * TILEX;
oy = SY + oy * TILEY;
ox = SX + ox * TILEX;
oy = SY + oy * TILEY;
@@
-3515,7
+3524,7
@@
void MovePacMen()
BlitBitmap(bitmap, window,
src_x, src_y, TILEX, TILEY,
ox + i * mx, oy + i * my);
BlitBitmap(bitmap, window,
src_x, src_y, TILEX, TILEY,
ox + i * mx, oy + i * my);
- Ct = Ct +
Counter()
- CT;
+ Ct = Ct +
FrameCounter
- CT;
}
DrawField_MM(nx, ny);
}
DrawField_MM(nx, ny);