static int pacman_nr = -1;
// various game engine delay counters
-static unsigned int rotate_delay = 0;
-static unsigned int pacman_delay = 0;
-static unsigned int energy_delay = 0;
-static unsigned int overload_delay = 0;
+static DelayCounter rotate_delay = { AUTO_ROTATE_DELAY };
+static DelayCounter pacman_delay = { PACMAN_MOVE_DELAY };
+static DelayCounter energy_delay = { ENERGY_DELAY };
+static DelayCounter overload_delay = { 0 };
// element masks for scanning pixels of MM elements
static const char mm_masks[10][16][16 + 1] =
}
}
-static void InitField(int x, int y, boolean init_game)
+static void InitField(int x, int y)
{
int element = Tile[x][y];
Tile[x][y] = next_element;
- DrawField_MM(x, y);
game_mm.cycle[i].steps -= step;
}
}
CT = Ct = 0;
- rotate_delay = 0;
- pacman_delay = 0;
- energy_delay = 0;
- overload_delay = 0;
+ rotate_delay.count = 0;
+ pacman_delay.count = 0;
+ energy_delay.count = 0;
+ overload_delay.count = 0;
ClickElement(-1, -1, -1);
Frame[x][y] = 0;
Stop[x][y] = FALSE;
- InitField(x, y, TRUE);
+ InitField(x, y);
}
}
cycle_steps_done++;
}
+ AdvanceFrameCounter();
+ AdvanceGfxFrame();
+
+ DrawLevel_MM();
+
BackToFront();
ColorCycling();
if (clx < -2 || cly < -2 || clx >= SXSIZE + 2 || cly >= SYSIZE + 2)
{
- Error(ERR_WARN, "AddLaserEdge: out of bounds: %d, %d", lx, ly);
+ Warn("AddLaserEdge: out of bounds: %d, %d", lx, ly);
return;
}
int hit_mask = 0;
#if 0
- printf("ScanPixel: start scanning at (%d, %d) [%d, %d] [%d, %d]\n",
- LX, LY, LX / TILEX, LY / TILEY, LX % TILEX, LY % TILEY);
+ Debug("game:mm:ScanPixel", "start scanning at (%d, %d) [%d, %d] [%d, %d]",
+ LX, LY, LX / TILEX, LY / TILEY, LX % TILEX, LY % TILEY);
#endif
// follow laser beam until it hits something (at least the screen border)
if (SX + LX < REAL_SX || SX + LX >= REAL_SX + FULL_SXSIZE ||
SY + LY < REAL_SY || SY + LY >= REAL_SY + FULL_SYSIZE)
{
- printf("ScanPixel: touched screen border!\n");
+ Debug("game:mm:ScanPixel", "touched screen border!");
return HIT_MASK_ALL;
}
DrawLaser(0, DL_LASER_ENABLED);
#if 0
- printf("Start scanning with LX == %d, LY == %d, XS == %d, YS == %d\n",
- LX, LY, XS, YS);
+ Debug("game:mm:ScanLaser",
+ "Start scanning with LX == %d, LY == %d, XS == %d, YS == %d",
+ LX, LY, XS, YS);
#endif
while (1)
hit_mask = ScanPixel();
#if 0
- printf("Hit something at LX == %d, LY == %d, XS == %d, YS == %d\n",
- LX, LY, XS, YS);
+ Debug("game:mm:ScanLaser",
+ "Hit something at LX == %d, LY == %d, XS == %d, YS == %d",
+ LX, LY, XS, YS);
#endif
// hit something -- check out what it was
ELY = (LY + YS) / TILEY;
#if 0
- printf("hit_mask (1) == '%x' (%d, %d) (%d, %d)\n",
- hit_mask, LX, LY, ELX, ELY);
+ Debug("game:mm:ScanLaser", "hit_mask (1) == '%x' (%d, %d) (%d, %d)",
+ hit_mask, LX, LY, ELX, ELY);
#endif
if (!IN_LEV_FIELD(ELX, ELY) || !IN_PIX_FIELD(LX, LY))
}
#if 0
- printf("hit_mask (2) == '%x' (%d, %d) (%d, %d)\n",
- hit_mask, LX, LY, ELX, ELY);
+ Debug("game:mm:ScanLaser", "hit_mask (2) == '%x' (%d, %d) (%d, %d)",
+ hit_mask, LX, LY, ELX, ELY);
#endif
element = Tile[ELX][ELY];
laser.dest_element = element;
#if 0
- printf("Hit element %d at (%d, %d) [%d, %d] [%d, %d] [%d]\n",
- element, ELX, ELY,
- LX, LY,
- LX % TILEX, LY % TILEY,
- hit_mask);
+ Debug("game:mm:ScanLaser",
+ "Hit element %d at (%d, %d) [%d, %d] [%d, %d] [%d]",
+ element, ELX, ELY,
+ LX, LY,
+ LX % TILEX, LY % TILEY,
+ hit_mask);
#endif
#if 0
if (!IN_LEV_FIELD(ELX, ELY))
- printf("WARNING! (1) %d, %d (%d)\n", ELX, ELY, element);
+ Debug("game:mm:ScanLaser", "WARNING! (1) %d, %d (%d)",
+ ELX, ELY, element);
#endif
if (element == EL_EMPTY)
{
- if (!HitOnlyAnEdge(element, hit_mask))
+ if (!HitOnlyAnEdge(hit_mask))
break;
}
else if (element == EL_FUSE_ON)
#if 0
if (laser.dest_element != Tile[ELX][ELY])
{
- printf("ALARM: laser.dest_element == %d, Tile[ELX][ELY] == %d\n",
- laser.dest_element, Tile[ELX][ELY]);
+ Debug("game:mm:ScanLaser",
+ "ALARM: laser.dest_element == %d, Tile[ELX][ELY] == %d",
+ laser.dest_element, Tile[ELX][ELY]);
}
#endif
if (!end && !laser.stops_inside_element && !StepBehind())
{
#if 0
- printf("ScanLaser: Go one step back\n");
+ Debug("game:mm:ScanLaser", "Go one step back");
#endif
LX -= XS;
#if 0
if (!IN_LEV_FIELD(ELX, ELY))
- printf("WARNING! (2) %d, %d\n", ELX, ELY);
+ Debug("game:mm:ScanLaser", "WARNING! (2) %d, %d", ELX, ELY);
#endif
}
int elx, ely;
#if 0
- printf("DrawLaserExt: start_edge, num_edges, mode == %d, %d, %d\n",
- start_edge, num_edges, mode);
+ Debug("game:mm:DrawLaserExt", "start_edge, num_edges, mode == %d, %d, %d",
+ start_edge, num_edges, mode);
#endif
if (start_edge < 0)
{
- Error(ERR_WARN, "DrawLaserExt: start_edge < 0");
+ Warn("DrawLaserExt: start_edge < 0");
return;
}
if (num_edges < 0)
{
- Error(ERR_WARN, "DrawLaserExt: num_edges < 0");
+ Warn("DrawLaserExt: num_edges < 0");
return;
}
#if 0
if (mode == DL_LASER_DISABLED)
{
- printf("DrawLaser: Delete laser from edge %d\n", start_edge);
+ Debug("game:mm:DrawLaserExt", "Delete laser from edge %d", start_edge);
}
#endif
int i;
for (i = 0; i < laser.num_beamers; i++)
- printf("-> %d\n", laser.beamer_edge[i]);
- printf("DrawLaserExt: IS_BEAMER: [%d]: Hit[%d][%d] == %d [%d]\n",
- mode, elx, ely, Hit[elx][ely], start_edge);
- printf("DrawLaserExt: IS_BEAMER: %d / %d\n",
- get_element_angle(element), laser.damage[damage_start].angle);
+ Debug("game:mm:DrawLaserExt", "-> %d", laser.beamer_edge[i]);
+
+ Debug("game:mm:DrawLaserExt", "IS_BEAMER: [%d]: Hit[%d][%d] == %d [%d]",
+ mode, elx, ely, Hit[elx][ely], start_edge);
+ Debug("game:mm:DrawLaserExt", "IS_BEAMER: %d / %d",
+ get_element_angle(element), laser.damage[damage_start].angle);
}
#endif
YS = 2 * Step[laser.current_angle].y;
#if 0
- printf("DrawLaser: Set (LX, LY) to (%d, %d) [%d]\n",
- LX, LY, element);
+ Debug("game:mm:DrawLaserExt", "Set (LX, LY) to (%d, %d) [%d]",
+ LX, LY, element);
#endif
if (start_edge > 0)
int step_size;
#if 0
- printf("element == %d\n", element);
+ Debug("game:mm:DrawLaserExt", "element == %d", element);
#endif
if (IS_22_5_ANGLE(laser.current_angle)) // neither 90° nor 45° angle
#if 0
if (IS_BEAMER(element))
- {
- printf("start_edge == %d, laser.beamer_edge == %d\n",
- start_edge, laser.beamer_edge);
- }
+ Debug("game:mm:DrawLaserExt",
+ "start_edge == %d, laser.beamer_edge == %d",
+ start_edge, laser.beamer_edge);
#endif
LX += step_size * XS;
}
#if 0
- printf("DrawLaser: Finally: (LX, LY) to (%d, %d) [%d]\n",
- LX, LY, element);
+ Debug("game:mm:DrawLaserExt", "Finally: (LX, LY) to (%d, %d) [%d]",
+ LX, LY, element);
#endif
}
{
if (laser.num_edges - start_edge < 0)
{
- Error(ERR_WARN, "DrawLaser: laser.num_edges - start_edge < 0");
+ Warn("DrawLaser: laser.num_edges - start_edge < 0");
return;
}
continue;
#if 0
- printf("DrawLaser: DL_LASER_ENABLED: i==%d: %d, %d\n",
- i, laser.beamer_edge[i], tmp_start_edge);
+ Debug("game:mm:DrawLaser", "DL_LASER_ENABLED: i==%d: %d, %d",
+ i, laser.beamer_edge[i], tmp_start_edge);
#endif
DrawLaserExt(tmp_start_edge, tmp_num_edges, DL_LASER_ENABLED);
#if 0
if (last_num_edges - start_edge <= 0)
- printf("DrawLaser: DL_LASER_DISABLED: %d, %d\n",
- last_num_edges, start_edge);
+ Debug("game:mm:DrawLaser", "DL_LASER_DISABLED: %d, %d",
+ last_num_edges, start_edge);
#endif
// special case when rotating first beamer: delete laser edge on beamer
boolean HitElement(int element, int hit_mask)
{
- if (HitOnlyAnEdge(element, hit_mask))
+ if (HitOnlyAnEdge(hit_mask))
return FALSE;
if (IS_MOVING(ELX, ELY) || IS_BLOCKED(ELX, ELY))
element = MovingOrBlocked2Element_MM(ELX, ELY);
#if 0
- printf("HitElement (1): element == %d\n", element);
+ Debug("game:mm:HitElement", "(1): element == %d", element);
#endif
#if 0
if ((ELX * TILEX + 14 - LX) * YS == (ELY * TILEY + 14 - LY) * XS)
- printf("HitElement (%d): EXACT MATCH @ (%d, %d)\n", element, ELX, ELY);
+ Debug("game:mm:HitElement", "(%d): EXACT MATCH @ (%d, %d)",
+ element, ELX, ELY);
else
- printf("HitElement (%d): FUZZY MATCH @ (%d, %d)\n", element, ELX, ELY);
+ Debug("game:mm:HitElement", "(%d): FUZZY MATCH @ (%d, %d)",
+ element, ELX, ELY);
#endif
AddDamagedField(ELX, ELY);
}
#if 0
- printf("HitElement (2): element == %d\n", element);
+ Debug("game:mm:HitElement", "(2): element == %d", element);
#endif
if (LX + 5 * XS < 0 ||
}
#if 0
- printf("HitElement (3): element == %d\n", element);
+ Debug("game:mm:HitElement", "(3): element == %d", element);
#endif
if (IS_POLAR(element) &&
{
#if 0
if ((ELX * TILEX + 14 - LX) * YS == (ELY * TILEY + 14 - LY) * XS)
- printf("EXACT MATCH @ (%d, %d)\n", ELX, ELY);
+ Debug("game:mm:HitElement", "EXACT MATCH @ (%d, %d)", ELX, ELY);
else
- printf("FUZZY MATCH @ (%d, %d)\n", ELX, ELY);
+ Debug("game:mm:HitElement", "FUZZY MATCH @ (%d, %d)", ELX, ELY);
#endif
LX = ELX * TILEX + 14;
LX += step_size * XS;
LY += step_size * YS;
-#if 0
// draw sparkles on mirror
- if ((IS_MIRROR(element) || IS_MIRROR_FIXED(element)) &&
+ if ((IS_MIRROR(element) ||
+ IS_MIRROR_FIXED(element) ||
+ element == EL_PRISM) &&
current_angle != laser.current_angle)
{
- MoveSprite(vp, &Pfeil[2], 4 + 16 * ELX, 5 + 16 * ELY + 1);
+ MovDelay[ELX][ELY] = 11; // start animation
}
-#endif
if ((!IS_POLAR(element) && !IS_POLAR_CROSS(element)) &&
current_angle != laser.current_angle)
}
#if 0
- printf("HitElement (4): element == %d\n", element);
+ Debug("game:mm:HitElement", "(4): element == %d", element);
#endif
if ((IS_BEAMER(element) || IS_FIBRE_OPTIC(element)) &&
int step_size;
#if 0
- printf("HitElement (BEAMER): element == %d\n", element);
+ Debug("game:mm:HitElement", "(BEAMER): element == %d", element);
#endif
laser.num_damages--;
return TRUE;
}
-boolean HitOnlyAnEdge(int element, int hit_mask)
+boolean HitOnlyAnEdge(int hit_mask)
{
// check if the laser hit only the edge of an element and, if so, go on
#if 0
- printf("LX, LY, hit_mask == %d, %d, %d\n", LX, LY, hit_mask);
+ Debug("game:mm:HitOnlyAnEdge", "LX, LY, hit_mask == %d, %d, %d",
+ LX, LY, hit_mask);
#endif
if ((hit_mask == HIT_MASK_TOPLEFT ||
LY += YS;
#if 0
- printf("[HitOnlyAnEdge() == TRUE]\n");
+ Debug("game:mm:HitOnlyAnEdge", "[HitOnlyAnEdge() == TRUE]");
#endif
return TRUE;
}
#if 0
- printf("[HitOnlyAnEdge() == FALSE]\n");
+ Debug("game:mm:HitOnlyAnEdge", "[HitOnlyAnEdge() == FALSE]");
#endif
return FALSE;
boolean HitPolarizer(int element, int hit_mask)
{
- if (HitOnlyAnEdge(element, hit_mask))
+ if (HitOnlyAnEdge(hit_mask))
return FALSE;
if (IS_DF_GRID(element))
int grid_angle = get_element_angle(element);
#if 0
- printf("HitPolarizer: angle: grid == %d, laser == %d\n",
- grid_angle, laser.current_angle);
+ Debug("game:mm:HitPolarizer", "angle: grid == %d, laser == %d",
+ grid_angle, laser.current_angle);
#endif
AddLaserEdge(LX, LY);
LY += YS;
#if 0
- printf("HitPolarizer: LX, LY == %d, %d [%d, %d] [%d, %d]\n",
- LX, LY,
- LX / TILEX, LY / TILEY,
- LX % TILEX, LY % TILEY);
+ Debug("game:mm:HitPolarizer", "LX, LY == %d, %d [%d, %d] [%d, %d]",
+ LX, LY,
+ LX / TILEX, LY / TILEY,
+ LX % TILEX, LY % TILEY);
#endif
return FALSE;
boolean HitLaserSource(int element, int hit_mask)
{
- if (HitOnlyAnEdge(element, hit_mask))
+ if (HitOnlyAnEdge(hit_mask))
return FALSE;
PlayLevelSound_MM(ELX, ELY, element, MM_ACTION_HITTING);
boolean HitLaserDestination(int element, int hit_mask)
{
- if (HitOnlyAnEdge(element, hit_mask))
+ if (HitOnlyAnEdge(hit_mask))
return FALSE;
if (element != EL_EXIT_OPEN &&
}
}
- if (!HitOnlyAnEdge(element, hit_mask))
+ if (!HitOnlyAnEdge(hit_mask))
{
laser.overloaded = TRUE;
boolean HitAbsorbingWalls(int element, int hit_mask)
{
- if (HitOnlyAnEdge(element, hit_mask))
+ if (HitOnlyAnEdge(hit_mask))
return FALSE;
if (ABS(XS) == 4 &&
}
}
+static void DrawFieldAnimated_MM(int x, int y)
+{
+ int element = Tile[x][y];
+
+ if (IS_BLOCKED(x, y))
+ return;
+
+ DrawField_MM(x, y);
+
+ if (IS_MIRROR(element) ||
+ IS_MIRROR_FIXED(element) ||
+ element == EL_PRISM)
+ {
+ if (MovDelay[x][y] != 0) // wait some time before next frame
+ {
+ MovDelay[x][y]--;
+
+ if (MovDelay[x][y] != 0)
+ {
+ int graphic = IMG_TWINKLE_WHITE;
+ int frame = getGraphicAnimationFrame(graphic, 10 - MovDelay[x][y]);
+
+ DrawGraphicThruMask_MM(SCREENX(x), SCREENY(y), graphic, frame);
+ }
+ }
+ }
+
+ laser.redraw = TRUE;
+}
+
static void Explode_MM(int x, int y, int phase, int mode)
{
int num_phase = 9, delay = 2;
Store[x][y] = Store2[x][y] = 0;
MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
- InitField(x, y, FALSE);
+ InitField(x, y);
DrawField_MM(x, y);
}
else if (!(phase % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
boolean ClickElement(int x, int y, int button)
{
- static unsigned int click_delay = 0;
- static int click_delay_value = CLICK_DELAY;
+ static DelayCounter click_delay = { CLICK_DELAY };
static boolean new_button = TRUE;
boolean element_clicked = FALSE;
int element;
if (button == -1)
{
// initialize static variables
- click_delay = 0;
- click_delay_value = CLICK_DELAY;
+ click_delay.count = 0;
+ click_delay.value = CLICK_DELAY;
new_button = TRUE;
return FALSE;
if (button == MB_RELEASED)
{
new_button = TRUE;
- click_delay_value = CLICK_DELAY;
+ click_delay.value = CLICK_DELAY;
// release eventually hold auto-rotating mirror
RotateMirror(x, y, MB_RELEASED);
return FALSE;
}
- if (!FrameReached(&click_delay, click_delay_value) && !new_button)
+ if (!FrameReached(&click_delay) && !new_button)
return FALSE;
if (button == MB_MIDDLEBUTTON) // middle button has no function
element_clicked = TRUE;
}
- click_delay_value = (new_button ? CLICK_DELAY_FIRST : CLICK_DELAY);
+ click_delay.value = (new_button ? CLICK_DELAY_FIRST : CLICK_DELAY);
new_button = FALSE;
return element_clicked;
if (edge == 0)
{
- Error(ERR_WARN, "RotateMirror: inconsistent field Hit[][]!\n");
+ Warn("RotateMirror: inconsistent field Hit[][]!\n");
+
edge = 1;
}
if (IS_BEAMER(Tile[x][y]))
{
#if 0
- printf("TEST (%d, %d) [%d] [%d]\n",
- LX, LY,
- laser.beamer_edge, laser.beamer[1].num);
+ Debug("game:mm:RotateMirror", "TEST (%d, %d) [%d] [%d]",
+ LX, LY, laser.beamer_edge, laser.beamer[1].num);
#endif
laser.num_edges--;
{
int x, y;
- if (!FrameReached(&rotate_delay, AUTO_ROTATE_DELAY))
+ if (!FrameReached(&rotate_delay))
return;
for (x = 0; x < lev_fieldx; x++)
}
}
-static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
+static void GameActions_MM_Ext(void)
{
int element;
int x, y, i;
MeltIce(x, y);
else if (IS_WALL_CHANGING(element) && Store[x][y] == EL_WALL_AMOEBA)
GrowAmoeba(x, y);
+ else
+ DrawFieldAnimated_MM(x, y);
}
AutoRotateMirrors();
CT = FrameCounter;
- if (game_mm.num_pacman && FrameReached(&pacman_delay, PACMAN_MOVE_DELAY))
+ if (game_mm.num_pacman && FrameReached(&pacman_delay))
{
MovePacMen();
}
}
- if (FrameReached(&energy_delay, ENERGY_DELAY))
+ if (FrameReached(&energy_delay))
{
if (game_mm.energy_left > 0)
{
redraw_mask |= REDRAW_DOOR_1;
}
- else if (setup.time_limit && !game_mm.game_over)
+ else if (game.time_limit && !game_mm.game_over)
{
int i;
game.restart_game_message = "Out of magic energy! Play it again?";
-#if 0
- if (Request("Out of magic energy! Play it again?",
- REQ_ASK | REQ_STAY_CLOSED))
- {
- InitGame();
- }
- else
- {
- game_status = MAINMENU;
- DrawMainMenu();
- }
-#endif
-
return;
}
}
#if 0
if (element != Tile[ELX][ELY])
{
- printf("element == %d, Tile[ELX][ELY] == %d\n",
- element, Tile[ELX][ELY]);
+ Debug("game:mm:GameActions_MM_Ext", "element == %d, Tile[ELX][ELY] == %d",
+ element, Tile[ELX][ELY]);
}
#endif
!IS_WALL_AMOEBA(element))
return;
+ overload_delay.value = HEALTH_DELAY(laser.overloaded);
+
if (((laser.overloaded && laser.overload_value < MAX_LASER_OVERLOAD) ||
(!laser.overloaded && laser.overload_value > 0)) &&
- FrameReached(&overload_delay, HEALTH_DELAY(laser.overloaded)))
+ FrameReached(&overload_delay))
{
if (laser.overloaded)
laser.overload_value++;
game.restart_game_message = "Magic spell hit Mc Duffin! Play it again?";
-#if 0
- if (Request("Magic spell hit Mc Duffin! Play it again?",
- REQ_ASK | REQ_STAY_CLOSED))
- {
- InitGame();
- }
- else
- {
- game_status = MAINMENU;
- DrawMainMenu();
- }
-#endif
-
return;
}
}
if (game_mm.cheat_no_explosion)
return;
-#if 0
- laser.num_damages--;
- DrawLaser(0, DL_LASER_DISABLED);
- laser.num_edges = 0;
-#endif
-
Bang_MM(ELX, ELY);
laser.dest_element = EL_EXPLODING_OPAQUE;
-#if 0
- Bang_MM(ELX, ELY);
- laser.num_damages--;
- DrawLaser(0, DL_LASER_DISABLED);
-
- laser.num_edges = 0;
- Bang_MM(laser.start_edge.x, laser.start_edge.y);
-
- if (Request("Bomb killed Mc Duffin! Play it again?",
- REQ_ASK | REQ_STAY_CLOSED))
- {
- InitGame();
- }
- else
- {
- game_status = MAINMENU;
- DrawMainMenu();
- }
-#endif
-
return;
}
DrawField_MM(ELX, ELY);
#if 0
- printf("NEW ELEMENT: (%d, %d)\n", ELX, ELY);
+ Debug("game:mm:GameActions_MM_Ext", "NEW ELEMENT: (%d, %d)", ELX, ELY);
#endif
// above stuff: GRAY BALL -> PRISM !!!
#endif
ScanLaser();
-
- /*
- printf("TEST ELEMENT: %d\n", Tile[0][0]);
- */
#endif
return;
return;
}
-void GameActions_MM(struct MouseActionInfo action, boolean warp_mode)
+void GameActions_MM(struct MouseActionInfo action)
{
boolean element_clicked = ClickElement(action.lx, action.ly, action.button);
boolean button_released = (action.button == MB_RELEASED);
- GameActions_MM_Ext(action, warp_mode);
+ GameActions_MM_Ext();
CheckSingleStepMode_MM(element_clicked, button_released);
}
}
}
-void GameWon_MM(void)
-{
- int hi_pos;
- boolean raise_level = FALSE;
-
-#if 0
- if (local_player->MovPos)
- return;
-
- local_player->LevelSolved = FALSE;
-#endif
-
- if (game_mm.energy_left)
- {
- if (setup.sound_loops)
- PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT,
- SND_CTRL_PLAY_LOOP);
-
- while (game_mm.energy_left > 0)
- {
- if (!setup.sound_loops)
- PlaySoundStereo(SND_SIRR, SOUND_MAX_RIGHT);
-
- /*
- if (game_mm.energy_left > 0 && !(game_mm.energy_left % 10))
- RaiseScore_MM(native_mm_level.score[SC_ZEITBONUS]);
- */
-
- RaiseScore_MM(5);
-
- game_mm.energy_left--;
- if (game_mm.energy_left >= 0)
- {
-#if 0
- BlitBitmap(pix[PIX_DOOR], drawto,
- DOOR_GFX_PAGEX5 + XX_ENERGY, DOOR_GFX_PAGEY1 + YY_ENERGY,
- ENERGY_XSIZE, ENERGY_YSIZE - game_mm.energy_left,
- DX_ENERGY, DY_ENERGY);
-#endif
- redraw_mask |= REDRAW_DOOR_1;
- }
-
- BackToFront();
- Delay_WithScreenUpdates(10);
- }
-
- if (setup.sound_loops)
- StopSound(SND_SIRR);
- }
- else if (native_mm_level.time == 0) // level without time limit
- {
- if (setup.sound_loops)
- PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT,
- SND_CTRL_PLAY_LOOP);
-
- while (TimePlayed < 999)
- {
- if (!setup.sound_loops)
- PlaySoundStereo(SND_SIRR, SOUND_MAX_RIGHT);
- if (TimePlayed < 999 && !(TimePlayed % 10))
- RaiseScore_MM(native_mm_level.score[SC_TIME_BONUS]);
- if (TimePlayed < 900 && !(TimePlayed % 10))
- TimePlayed += 10;
- else
- TimePlayed++;
-
- /*
- DrawText(DX_TIME, DY_TIME, int2str(TimePlayed, 3), FONT_TEXT_2);
- */
-
- BackToFront();
- Delay_WithScreenUpdates(10);
- }
-
- if (setup.sound_loops)
- StopSound(SND_SIRR);
- }
-
- CloseDoor(DOOR_CLOSE_1);
-
- Request("Level solved!", REQ_CONFIRM);
-
- if (level_nr == leveldir_current->handicap_level)
- {
- leveldir_current->handicap_level++;
- SaveLevelSetup_SeriesInfo();
- }
-
- if (level_editor_test_game)
- game_mm.score = -1; // no highscore when playing from editor
- else if (level_nr < leveldir_current->last_level)
- raise_level = TRUE; // advance to next level
-
- if ((hi_pos = NewHiScore_MM()) >= 0)
- {
- game_status = HALLOFFAME;
-
- // DrawHallOfFame(hi_pos);
-
- if (raise_level)
- level_nr++;
- }
- else
- {
- game_status = MAINMENU;
-
- if (raise_level)
- level_nr++;
-
- // DrawMainMenu();
- }
-
- BackToFront();
-}
-
-int NewHiScore_MM(void)
-{
- int k, l;
- int position = -1;
-
- // LoadScore(level_nr);
-
- if (strcmp(setup.player_name, EMPTY_PLAYER_NAME) == 0 ||
- game_mm.score < highscore[MAX_SCORE_ENTRIES - 1].Score)
- return -1;
-
- for (k = 0; k < MAX_SCORE_ENTRIES; k++)
- {
- if (game_mm.score > highscore[k].Score)
- {
- // player has made it to the hall of fame
-
- if (k < MAX_SCORE_ENTRIES - 1)
- {
- int m = MAX_SCORE_ENTRIES - 1;
-
-#ifdef ONE_PER_NAME
- for (l = k; l < MAX_SCORE_ENTRIES; l++)
- if (!strcmp(setup.player_name, highscore[l].Name))
- m = l;
- if (m == k) // player's new highscore overwrites his old one
- goto put_into_list;
-#endif
-
- for (l = m; l>k; l--)
- {
- strcpy(highscore[l].Name, highscore[l - 1].Name);
- highscore[l].Score = highscore[l - 1].Score;
- }
- }
-
-#ifdef ONE_PER_NAME
- put_into_list:
-#endif
- strncpy(highscore[k].Name, setup.player_name, MAX_PLAYER_NAME_LEN);
- highscore[k].Name[MAX_PLAYER_NAME_LEN] = '\0';
- highscore[k].Score = game_mm.score;
- position = k;
-
- break;
- }
-
-#ifdef ONE_PER_NAME
- else if (!strncmp(setup.player_name, highscore[k].Name,
- MAX_PLAYER_NAME_LEN))
- break; // player already there with a higher score
-#endif
-
- }
-
- // if (position >= 0)
- // SaveScore(level_nr);
-
- return position;
-}
-
static void InitMovingField_MM(int x, int y, int direction)
{
int newx = x + (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
// Mirror Magic game engine snapshot handling functions
// ----------------------------------------------------------------------------
-void SaveEngineSnapshotValues_MM(ListNode **buffers)
+void SaveEngineSnapshotValues_MM(void)
{
int x, y;