lev_fieldx = native_mm_level.fieldx = STD_LEV_FIELDX;
lev_fieldy = native_mm_level.fieldy = STD_LEV_FIELDY;
- for(x=0; x<MAX_LEV_FIELDX; x++)
- for(y=0; y<MAX_LEV_FIELDY; y++)
+ for (x = 0; x < MAX_LEV_FIELDX; x++)
+ for (y = 0; y < MAX_LEV_FIELDY; y++)
native_mm_level.field[x][y] = Feld[x][y] = Ur[x][y] = EL_EMPTY;
native_mm_level.time = 100;
native_mm_level.laser_green = FALSE;
native_mm_level.laser_blue = TRUE;
- for(i=0; i<MAX_LEVEL_NAME_LEN; i++)
+ for (i = 0; i < MAX_LEVEL_NAME_LEN; i++)
native_mm_level.name[i] = '\0';
- for(i=0; i<MAX_LEVEL_AUTHOR_LEN; i++)
+ for (i = 0; i < MAX_LEVEL_AUTHOR_LEN; i++)
native_mm_level.author[i] = '\0';
strcpy(native_mm_level.name, NAMELESS_LEVEL_NAME);
strcpy(native_mm_level.author, ANONYMOUS_NAME);
- for(i=0; i<LEVEL_SCORE_ELEMENTS; i++)
+ for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++)
native_mm_level.score[i] = 10;
native_mm_level.field[0][0] = Feld[0][0] = Ur[0][0] = EL_MCDUFFIN_RIGHT;
return element;
}
-static int LoadLevel_MM_VERS(File *file, int chunk_size, struct LevelInfo_MM *level)
+static int LoadLevel_MM_VERS(File *file, int chunk_size,
+ struct LevelInfo_MM *level)
{
- ReadChunk_MM_VERS(file, &(level->file_version), &(level->game_version));
+ ReadChunk_MM_VERS(file, &level->file_version, &level->game_version);
return chunk_size;
}
-static int LoadLevel_MM_HEAD(File *file, int chunk_size, struct LevelInfo_MM *level)
+static int LoadLevel_MM_HEAD(File *file, int chunk_size,
+ struct LevelInfo_MM *level)
{
int i;
int laser_color;
level->time = getFile16BitInteger(file, BYTE_ORDER_BIG_ENDIAN);
level->kettles_needed = getFile16BitInteger(file, BYTE_ORDER_BIG_ENDIAN);
- for(i=0; i<MAX_LEVEL_NAME_LEN; i++)
+ for (i = 0; i < MAX_LEVEL_NAME_LEN; i++)
level->name[i] = getFile8Bit(file);
level->name[MAX_LEVEL_NAME_LEN] = 0;
- for(i=0; i<LEVEL_SCORE_ELEMENTS; i++)
+ for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++)
level->score[i] = getFile8Bit(file);
level->auto_count_kettles = (getFile8Bit(file) == 1 ? TRUE : FALSE);
return chunk_size;
}
-static int LoadLevel_MM_AUTH(File *file, int chunk_size, struct LevelInfo_MM *level)
+static int LoadLevel_MM_AUTH(File *file, int chunk_size,
+ struct LevelInfo_MM *level)
{
int i;
- for(i=0; i<MAX_LEVEL_AUTHOR_LEN; i++)
+ for (i = 0; i < MAX_LEVEL_AUTHOR_LEN; i++)
level->author[i] = getFile8Bit(file);
level->author[MAX_LEVEL_NAME_LEN] = 0;
return chunk_size;
}
-static int LoadLevel_MM_BODY(File *file, int chunk_size, struct LevelInfo_MM *level)
+static int LoadLevel_MM_BODY(File *file, int chunk_size,
+ struct LevelInfo_MM *level)
{
int x, y;
int chunk_size_expected = level->fieldx * level->fieldy;
if (chunk_size_expected != chunk_size)
{
ReadUnusedBytesFromFile(file, chunk_size);
+
return chunk_size_expected;
}
- for(y=0; y<level->fieldy; y++)
- for(x=0; x<level->fieldx; x++)
+ for (y = 0; y < level->fieldy; y++)
+ for (x = 0; x < level->fieldx; x++)
native_mm_level.field[x][y] = Feld[x][y] = Ur[x][y] =
checkLevelElement(level->encoding_16bit_field ?
getFile16BitInteger(file, BYTE_ORDER_BIG_ENDIAN) :
if (strcmp(chunk_name, "CAVE") != 0)
{
Error(ERR_WARN, "unknown format of level file '%s'", filename);
+
closeFile(file);
return FALSE;
if (!checkCookieString(cookie, LEVEL_COOKIE_TMPL))
{
Error(ERR_WARN, "unknown format of level file '%s'", filename);
+
closeFile(file);
return FALSE;
}
- if ((native_mm_level.file_version = getFileVersionFromCookieString(cookie)) == -1)
+ if ((native_mm_level.file_version = getFileVersionFromCookieString(cookie))
+ == -1)
{
Error(ERR_WARN, "unsupported version of level file '%s'", filename);
+
closeFile(file);
return FALSE;
{
Error(ERR_WARN, "unknown chunk '%s' in level file '%s'",
chunk_name, filename);
+
ReadUnusedBytesFromFile(file, chunk_size);
}
else if (chunk_info[i].size != -1 &&
{
Error(ERR_WARN, "wrong size (%d) of chunk '%s' in level file '%s'",
chunk_size, chunk_name, filename);
+
ReadUnusedBytesFromFile(file, chunk_size);
}
else
chunks first (like "HEAD" and "BODY") that contain some header
information, so check them here */
if (chunk_size_expected != chunk_size)
- {
Error(ERR_WARN, "wrong size (%d) of chunk '%s' in level file '%s'",
chunk_size, chunk_name, filename);
- }
}
}
putFile16BitInteger(file, level->time, BYTE_ORDER_BIG_ENDIAN);
putFile16BitInteger(file, level->kettles_needed, BYTE_ORDER_BIG_ENDIAN);
- for(i=0; i<MAX_LEVEL_NAME_LEN; i++)
+ for (i = 0; i < MAX_LEVEL_NAME_LEN; i++)
fputc(level->name[i], file);
- for(i=0; i<LEVEL_SCORE_ELEMENTS; i++)
+ for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++)
fputc(level->score[i], file);
fputc((level->auto_count_kettles ? 1 : 0), file);
{
int i;
- for(i=0; i<MAX_LEVEL_AUTHOR_LEN; i++)
+ for (i = 0; i < MAX_LEVEL_AUTHOR_LEN; i++)
fputc(level->author[i], file);
}
{
int x, y;
- for(y=0; y<level->fieldy; y++)
- for(x=0; x<level->fieldx; x++)
+ for (y = 0; y < level->fieldy; y++)
+ for (x = 0; x < level->fieldx; x++)
if (level->encoding_16bit_field)
putFile16BitInteger(file, Ur[x][y], BYTE_ORDER_BIG_ENDIAN);
else
if (!(file = fopen(filename, MODE_WRITE)))
{
Error(ERR_WARN, "cannot save level file '%s'", filename);
+
return;
}
/* check level field for 16-bit elements */
native_mm_level.encoding_16bit_field = FALSE;
- for(y=0; y<native_mm_level.fieldy; y++)
- for(x=0; x<native_mm_level.fieldx; x++)
+
+ for (y = 0; y < native_mm_level.fieldy; y++)
+ for (x = 0; x < native_mm_level.fieldx; x++)
if (Ur[x][y] > 255)
native_mm_level.encoding_16bit_field = TRUE;
body_chunk_size =
- native_mm_level.fieldx * native_mm_level.fieldy * (native_mm_level.encoding_16bit_field ? 2 : 1);
+ native_mm_level.fieldx * native_mm_level.fieldy *
+ (native_mm_level.encoding_16bit_field ? 2 : 1);
putFileChunk(file, "MMII", CHUNK_SIZE_UNDEFINED, BYTE_ORDER_BIG_ENDIAN);
putFileChunk(file, "CAVE", CHUNK_SIZE_NONE, BYTE_ORDER_BIG_ENDIAN);
#define IS_MUSIC_SOUND(s) ((s) == SND_TYGER || (s) == SND_VOYAGER)
/* game button identifiers */
-#define GAME_CTRL_ID_LEFT 0
-#define GAME_CTRL_ID_MIDDLE 1
-#define GAME_CTRL_ID_RIGHT 2
+#define GAME_CTRL_ID_LEFT 0
+#define GAME_CTRL_ID_MIDDLE 1
+#define GAME_CTRL_ID_RIGHT 2
-#define NUM_GAME_BUTTONS 3
+#define NUM_GAME_BUTTONS 3
/* values for DrawLaser() */
-#define DL_LASER_DISABLED 0
-#define DL_LASER_ENABLED 1
+#define DL_LASER_DISABLED 0
+#define DL_LASER_ENABLED 1
/* values for 'click_delay_value' in ClickElement() */
#define CLICK_DELAY_SHORT 125
int element = Feld[x][y];
static int direction[3][4] =
{
- { MV_RIGHT, MV_UP, MV_LEFT, MV_DOWN },
- { MV_LEFT, MV_DOWN, MV_RIGHT, MV_UP },
- { MV_LEFT, MV_RIGHT, MV_UP, MV_DOWN }
+ { MV_RIGHT, MV_UP, MV_LEFT, MV_DOWN },
+ { MV_LEFT, MV_DOWN, MV_RIGHT, MV_UP },
+ { MV_LEFT, MV_RIGHT, MV_UP, MV_DOWN }
};
switch(element)
if (game_mm.num_cycle == 0) /* no elements to cycle */
return;
- for(i=0; i<16; i++)
+ for (i = 0; i < 16; i++)
{
- for(j=0; j<game_mm.num_cycle; j++)
+ for (j = 0; j < game_mm.num_cycle; j++)
{
int x = game_mm.cycle[j].x;
int y = game_mm.cycle[j].y;
laser.start_edge.y = 0;
laser.start_angle = 0;
- for (i=0; i<MAX_NUM_BEAMERS; i++)
+ for (i = 0; i < MAX_NUM_BEAMERS; i++)
laser.beamer[i][0].num = laser.beamer[i][1].num = 0;
laser.overloaded = FALSE;
CT = Ct = 0;
- for (x=0; x<lev_fieldx; x++)
+ for (x = 0; x < lev_fieldx; x++)
{
- for (y=0; y<lev_fieldy; y++)
+ for (y = 0; y < lev_fieldy; y++)
{
Feld[x][y] = Ur[x][y];
Hit[x][y] = Box[x][y] = 0;
PlaySoundExt(SND_FUEL, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, SND_CTRL_PLAY_LOOP);
#if 0 // !!! TEMPORARILY DISABLED !!!
- for(i=0; i<=game_mm.energy_left; i+=2)
+ for (i = 0; i <= game_mm.energy_left; i += 2)
{
if (!setup.sound_loops)
PlaySoundStereo(SND_FUEL, SOUND_MAX_RIGHT);
if (lx < -2 || ly < -2 || lx >= SXSIZE + 2 || ly >= SYSIZE + 2)
{
Error(ERR_WARN, "AddLaserEdge: out of bounds: %d, %d", lx, ly);
+
return;
}
return ((x - last_x) * XS < 0 || (y - last_y) * YS < 0);
}
- else
- return FALSE;
+
+ return FALSE;
}
static int getMaskFromElement(int element)
}
#endif
- for (i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
{
int px = LX + (i % 2) * 2;
int py = LY + (i / 2) * 2;
{
end = 1;
laser.overloaded = TRUE;
+
break;
}
if (HitBlock(element, hit_mask))
{
rf = 1;
+
break;
}
}
LX -= XS;
LY -= YS;
+
AddLaserEdge(LX, LY);
}
if (start_edge < 0)
{
Error(ERR_WARN, "DrawLaserExt: start_edge < 0");
+
return;
}
if (num_edges < 0)
{
Error(ERR_WARN, "DrawLaserExt: num_edges < 0");
+
return;
}
/* determine the starting edge, from which graphics need to be restored */
if (start_edge > 0)
{
- for(i=0; i<laser.num_damages; i++)
+ for (i = 0; i < laser.num_damages; i++)
{
if (laser.damage[i].edge == start_edge + 1)
{
damage_start = i;
+
break;
}
}
}
/* restore graphics from this starting edge to the end of damage list */
- for(i=damage_start; i<laser.num_damages; i++)
+ for (i = damage_start; i < laser.num_damages; i++)
{
int lx = laser.damage[i].x;
int ly = laser.damage[i].y;
{
int i;
- for (i=0; i<laser.num_beamers; 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);
{
/* element is outgoing beamer */
laser.num_damages = damage_start + 1;
+
if (IS_BEAMER(element))
laser.current_angle = get_element_angle(element);
}
laser.num_edges = start_edge + 1;
if (start_edge == 0)
laser.current_angle = laser.start_angle;
+
LX = laser.edge[start_edge].x - (SX + 2);
LY = laser.edge[start_edge].y - (SY + 2);
XS = 2 * Step[laser.current_angle].x;
if (laser.num_edges - start_edge < 0)
{
Error(ERR_WARN, "DrawLaser: laser.num_edges - start_edge < 0");
+
return;
}
int tmp_start_edge = start_edge;
/* draw laser segments forward from the start to the last beamer */
- for (i=0; i<laser.num_beamers; i++)
+ for (i = 0; i < laser.num_beamers; i++)
{
int tmp_num_edges = laser.beamer_edge[i] - tmp_start_edge;
#endif
DrawLaserExt(tmp_start_edge, tmp_num_edges, DL_LASER_ENABLED);
+
tmp_start_edge = laser.beamer_edge[i];
}
int num_beamers = laser.num_beamers;
/* delete laser segments backward from the end to the first beamer */
- for (i=num_beamers-1; i>=0; i--)
+ for (i = num_beamers-1; i >= 0; i--)
{
int tmp_num_edges = last_num_edges - laser.beamer_edge[i];
break;
DrawLaserExt(laser.beamer_edge[i], tmp_num_edges, DL_LASER_DISABLED);
+
last_num_edges = laser.beamer_edge[i];
laser.num_beamers--;
}
}
}
else
+ {
DrawLaserExt(start_edge, laser.num_edges - start_edge, mode);
+ }
}
boolean HitElement(int element, int hit_mask)
(element - EL_POLAR_START) / 2 != laser.current_angle % 8))
{
PlaySoundStereo(SND_KINK, ST(ELX));
+
laser.num_damages--;
return TRUE;
(element - EL_POLAR_CROSS_START) != laser.current_angle % 4)
{
PlaySoundStereo(SND_KINK, ST(ELX));
+
laser.num_damages--;
return TRUE;
LX = ELX * TILEX + 14;
LY = ELY * TILEY + 14;
+
AddLaserEdge(LX, LY);
}
int step_size;
laser.num_damages--;
+
AddDamagedField(ELX, ELY);
+
laser.damage[laser.num_damages - 1].is_mirror = TRUE;
if (!Hit[ELX][ELY])
PlaySoundStereo(SND_KLING, ST(ELX));
- for(y=0; y<lev_fieldy; y++)
+ for (y = 0; y < lev_fieldy; y++)
{
- for(x=0; x<lev_fieldx; x++)
+ for (x = 0; x < lev_fieldx; x++)
{
/* initiate opening animation of exit door */
if (Feld[x][y] == EL_EXIT_CLOSED)
if (IN_LEV_FIELD(blocking_x, blocking_y))
{
Feld[blocking_x][blocking_y] = EL_EMPTY;
+
DrawField_MM(blocking_x, blocking_y);
}
}
}
}
else if (element == EL_KEY)
+ {
game_mm.num_keys++;
+ }
else if (element == EL_LIGHTBALL)
+ {
RaiseScore_MM(10);
+ }
else if (IS_PACMAN(element))
{
DeletePacMan(ELX, ELY);
LX = ELX * TILEX + 14;
LY = ELY * TILEY + 14;
+
AddLaserEdge(LX, LY);
AddDamagedField(ELX, ELY);
+
laser.damage[laser.num_damages - 1].is_mirror = TRUE;
if (!Hit[ELX][ELY])
}
laser.beamer_edge[laser.num_beamers] = laser.num_edges;
+
AddLaserEdge(LX, LY);
AddDamagedField(ELX, ELY);
+
laser.damage[laser.num_damages - 1].is_mirror = TRUE;
if (!Hit[ELX][ELY])
}
AddDamagedField((LX + 2 * dx) / TILEX, (LY + 2 * dy) / TILEY);
+
LX += XS;
LY += YS;
return FALSE;
}
else if (IS_GRID_STEEL_FIXED(element) || IS_GRID_STEEL_AUTO(element))
+ {
return HitReflectingWalls(element, hit_mask);
+ }
else
+ {
return HitAbsorbingWalls(element, hit_mask);
+ }
}
else if (IS_GRID_STEEL(element))
+ {
return HitReflectingWalls(element, hit_mask);
+ }
else /* IS_GRID_WOOD */
+ {
return HitAbsorbingWalls(element, hit_mask);
+ }
return TRUE;
}
check = TRUE;
- for(i=1; i<32; i++)
+ for (i = 1; i < 32; i++)
{
x = LX + i * XS;
y = LY + i * YS;
(hit_mask & hit_mask_diagonal2) == hit_mask_diagonal2)
{
laser.overloaded = (element == EL_GATE_STONE);
+
return TRUE;
}
Bang_MM(ELX, ELY);
game_mm.num_keys--;
+
if (element == EL_GATE_STONE && Box[ELX][ELY])
{
DrawLaser(Box[ELX][ELY] - 1, DL_LASER_DISABLED);
LX = ELX * TILEX + 14;
LY = ELY * TILEY + 14;
+
AddLaserEdge(LX, LY);
laser.stops_inside_element = TRUE;
hit_mask == HIT_MASK_BOTTOM))
{
PlaySoundStereo(SND_HUI, ST(ELX));
+
LX -= XS;
LY -= YS;
+
if (!IS_DF_GRID(element))
AddLaserEdge(LX, LY);
}
AddLaserEdge(LX, LY);
+
XS = 2 * Step[laser.current_angle].x;
YS = 2 * Step[laser.current_angle].y;
ANG_MIRROR_135 : ANG_MIRROR_45);
PlaySoundStereo(SND_HUI, ST(ELX));
+
AddDamagedField(ELX, ELY);
AddLaserEdge(LX, LY);
LX += XS;
LY += YS;
+
AddLaserEdge(LX, LY);
return FALSE;
ANG_MIRROR_135 : ANG_MIRROR_45);
PlaySoundStereo(SND_HUI, ST(ELX));
+
/*
AddDamagedField(ELX, ELY);
*/
+
AddLaserEdge(LX - XS, LY - YS);
AddLaserEdge(LX - XS + (ABS(XS) == 4 ? XS/2 : 0),
LY - YS + (ABS(YS) == 4 ? YS/2 : 0));
LX += XS;
LY += YS;
+
AddLaserEdge(LX, LY);
return FALSE;
if (LX != last_LX || LY != last_LY || hit_mask == last_hit_mask)
{
AddDamagedField(ELX, ELY);
+
LX += 8 * XS;
LY += 8 * YS;
if (!HitOnlyAnEdge(element, hit_mask))
{
laser.overloaded = TRUE;
+
return TRUE;
}
(hit_mask == HIT_MASK_LEFT || hit_mask == HIT_MASK_RIGHT))
{
AddLaserEdge(LX - XS, LY - YS);
+
LX = LX + XS / 2;
LY = LY + YS;
}
(hit_mask == HIT_MASK_TOP || hit_mask == HIT_MASK_BOTTOM))
{
AddLaserEdge(LX - XS, LY - YS);
+
LX = LX + XS;
LY = LY + YS / 2;
}
element == EL_GATE_WOOD)
{
PlaySoundStereo(SND_HOLZ, ST(ELX));
+
return TRUE;
}
{
int i;
- for(i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
{
if (mask == (1 << i) && (XS > 0) == (i % 2) && (YS > 0) == (i / 2))
mask = 15 - (8 >> i);
if (element2 != EL_EMPTY && !IS_WALL_AMOEBA(element2))
{
laser.dest_element = EL_EMPTY;
+
return TRUE;
}
MovDelay[x][y]--;
phase = MovDelay[x][y] / delay;
+
if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(x, y))
DrawGraphicAnimation_MM(x, y, IMG_MM_EXIT_OPENING, 3 - phase);
if (MovDelay[x][y]) /* wait some time before next frame */
{
MovDelay[x][y]--;
+
if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(x, y))
{
Bitmap *bitmap;
int dx = RND(26), dy = RND(26);
getGraphicSource(graphic, 0, &bitmap, &gx, &gy);
+
BlitBitmap(bitmap, drawto, gx + dx, gy + dy, 6, 6,
SX + x * TILEX + dx, SY + y * TILEY + dy);
+
MarkTileDirty(x, y);
}
if (Feld[x][y] == EL_WALL_ICE)
Feld[x][y] = EL_EMPTY;
- for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i>=0; i--)
+ for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i >= 0; i--)
if (laser.damage[i].is_mirror)
break;
DrawLaser(0, DL_LASER_ENABLED);
}
else if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(x, y))
+ {
DrawWallsAnimation_MM(x, y, real_element, phase, wall_mask);
+ }
}
}
/* put moving element to center field (and let it explode there) */
center_element = MovingOrBlocked2Element_MM(x, y);
RemoveMovingField_MM(x, y);
+
Feld[x][y] = center_element;
}
Store[x][y] = center_element;
else
Store[x][y] = EL_EMPTY;
+
Store2[x][y] = mode;
Feld[x][y] = EL_EXPLODING_OPAQUE;
MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
Feld[x][y] = Store[x][y];
Store[x][y] = Store2[x][y] = 0;
MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
+
InitField(x, y, FALSE);
DrawField_MM(x, y);
}
if (Store2[x][y] == EX_KETTLE)
{
if (graphic_phase < 3)
+ {
graphic = IMG_MM_KETTLE_EXPLODING;
+ }
else if (graphic_phase < 5)
{
graphic_phase += 3;
else if (Store2[x][y] == EX_SHORT)
{
if (graphic_phase < 4)
+ {
graphic_phase += 4;
+ }
else
{
graphic = IMG_EMPTY;
BlitBitmap(bitmap, drawto_field, src_x, src_y, TILEX, TILEY,
FX + x * TILEX, FY + y * TILEY);
+
MarkTileDirty(x, y);
}
}
int right_dir = turn[old_move_dir].right;
int back_dir = turn[old_move_dir].back;
int right_dx = move_xy[right_dir].x, right_dy = move_xy[right_dir].y;
- int right_x = x+right_dx, right_y = y+right_dy;
+ int right_x = x + right_dx, right_y = y + right_dy;
if (element == EL_PACMAN)
{
{
Store[newx][newy] = Feld[newx][newy];
Feld[newx][newy] = EL_EMPTY;
+
DrawField_MM(newx, newy);
}
else if (!IN_LEV_FIELD(newx, newy) || !IS_FREE(newx, newy) ||
}
}
else /* still moving on */
+ {
DrawField_MM(x, y);
+ }
laser.redraw = TRUE;
}
if (!laser.fuse_off)
{
DrawLaser(0, DL_LASER_DISABLED);
+
/*
BackToFront();
*/
Feld[x][y] = element;
DrawField_MM(x, y);
+
/*
BackToFront();
*/
+
if (!laser.fuse_off)
ScanLaser();
}
hold_y = y;
}
else if (button == MB_RIGHTBUTTON && (hold_x != x || hold_y != y))
+ {
Feld[x][y] = get_rotated_element(Feld[x][y], ROTATE_RIGHT);
+ }
}
if (IS_GRID_STEEL_AUTO(Feld[x][y]) || IS_GRID_WOOD_AUTO(Feld[x][y]))
if (!DelayReached(&rotate_delay, AUTO_ROTATE_DELAY))
return;
- for (x=0; x<lev_fieldx; x++)
+ for (x = 0; x < lev_fieldx; x++)
{
- for (y=0; y<lev_fieldy; y++)
+ for (y = 0; y < lev_fieldy; y++)
{
int element = Feld[x][y];
if (bits & HIT_POS_EDGE)
{
- for(i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
if (ReadPixel(drawto,
SX + obx + 31 * (i % 2),
SY + oby + 31 * (i / 2)) == pen_ray)
if (bits & HIT_POS_BETWEEN)
{
- for(i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
if (ReadPixel(drawto,
SX + 4 + obx + 22 * (i % 2),
SY + 4 + oby + 22 * (i / 2)) == pen_ray)
return;
}
- for(i=0; i<game_mm.num_pacman; i++)
+ for (i = 0; i < game_mm.num_pacman; i++)
if (game_mm.pacman[i].x == px && game_mm.pacman[i].y == py)
break;
game_mm.num_pacman--;
- for(j=i; j<game_mm.num_pacman; j++)
+ for (j = i; j < game_mm.num_pacman; j++)
{
- game_mm.pacman[j].x = game_mm.pacman[j + 1].x;
- game_mm.pacman[j].y = game_mm.pacman[j + 1].y;
+ game_mm.pacman[j].x = game_mm.pacman[j + 1].x;
+ game_mm.pacman[j].y = game_mm.pacman[j + 1].y;
game_mm.pacman[j].dir = game_mm.pacman[j + 1].dir;
}
}
mult =- mult / 16;
old = color;
new = new << 4;
+
if (new > 0x100)
new = 0x001;
}
WaitUntilDelayReached(&action_delay, GameFrameDelay);
- for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
+ 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++)
+ for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
{
element = Feld[x][y];
{
int i;
- for(i=15; i>=0; i--)
+ for (i = 15; i >= 0; i--)
{
#if 0
SetRGB(pen_ray, 0x0000, 0x0000, i * color_scale);
native_mm_level.laser_red * 0x11 * i,
native_mm_level.laser_green * 0x11 * i,
native_mm_level.laser_blue * 0x11 * i);
+
DrawLaser(0, DL_LASER_ENABLED);
BackToFront();
Delay(50);
SetRGB(pen_ray, (laser.overload_value / 6) * color_scale, 0x0000,
(15 - (laser.overload_value / 6)) * color_scale);
#endif
- pen_ray = GetPixelFromRGB(window,
- (native_mm_level.laser_red ? 0xFF : color_up),
- (native_mm_level.laser_green ? color_down : 0x00),
- (native_mm_level.laser_blue ? color_down : 0x00));
+ pen_ray =
+ GetPixelFromRGB(window,
+ (native_mm_level.laser_red ? 0xFF : color_up),
+ (native_mm_level.laser_green ? color_down : 0x00),
+ (native_mm_level.laser_blue ? color_down : 0x00));
+
DrawLaser(0, DL_LASER_ENABLED);
BackToFront();
}
if (laser.overloaded)
{
if (setup.sound_loops)
- PlaySoundExt(SND_WARNTON, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, SND_CTRL_PLAY_LOOP);
+ PlaySoundExt(SND_WARNTON, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT,
+ SND_CTRL_PLAY_LOOP);
else
PlaySoundStereo(SND_WARNTON, SOUND_MAX_RIGHT);
}
{
int i;
- for(i=15; i>=0; i--)
+ for (i = 15; i >= 0; i--)
{
#if 0
SetRGB(pen_ray, i * color_scale, 0x0000, 0x0000);
#endif
pen_ray = GetPixelFromRGB(window, 0x11 * i, 0x00, 0x00);
+
DrawLaser(0, DL_LASER_ENABLED);
BackToFront();
Delay(50);
}
DrawLaser(0, DL_LASER_DISABLED);
+
game_mm.game_over = TRUE;
game_mm.game_over_cause = GAME_OVER_OVERLOADED;
laser.fuse_off = TRUE;
laser.fuse_x = ELX;
laser.fuse_y = ELY;
+
DrawLaser(0, DL_LASER_DISABLED);
DrawGraphic_MM(ELX, ELY, IMG_MM_FUSE);
}
graphic = el2gfx(element);
- for(i=0; i<50; i++)
+ for (i = 0; i < 50; i++)
{
int x = RND(26);
int y = RND(26);
{
PlaySoundStereo(SND_SLURP, ST(ELX));
-
-
{
Feld[ELX][ELY] = Feld[ELX][ELY] - EL_WALL_ICE + EL_WALL_CHANGING;
Store[ELX][ELY] = EL_WALL_ICE;
return;
}
-
-
-
- for(i=0; i<5; i++)
+ for (i = 0; i < 5; i++)
{
int phase = i + 1;
LY = laser.edge[laser.num_edges].y - (SY + 2);
*/
- for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i>=0; i--)
+ for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i >= 0; i--)
if (laser.damage[i].is_mirror)
break;
if (element2 != EL_EMPTY && !IS_WALL_AMOEBA(element))
return;
- for (i = laser.num_damages - 1; i>=0; i--)
+ for (i = laser.num_damages - 1; i >= 0; i--)
if (laser.damage[i].is_mirror)
break;
x = laser.damage[k1].x;
y = laser.damage[k1].y;
+
DrawField_MM(x, y);
}
- for(i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
{
if (laser.wall_mask & (1 << i))
{
k2 = i;
- for(i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
{
if (laser.wall_mask & (1 << i))
{
{
laser.num_edges = r;
laser.num_damages = d;
+
DrawLaser(0, DL_LASER_DISABLED);
}
Feld[ELX][ELY] = element | laser.wall_mask;
+
dx = ELX;
dy = ELY;
de = Feld[ELX][ELY];
dm = laser.wall_mask;
-
-
#if 1
{
int x = ELX, y = ELY;
int wall_mask = laser.wall_mask;
-
ScanLaser();
DrawLaser(0, DL_LASER_ENABLED);
PlaySoundStereo(SND_AMOEBE, ST(dx));
-
-
Feld[x][y] = Feld[x][y] - EL_WALL_AMOEBA + EL_WALL_CHANGING;
Store[x][y] = EL_WALL_AMOEBA;
Store2[x][y] = wall_mask;
}
#endif
-
-
DrawWallsAnimation_MM(dx, dy, de, 4, dm);
ScanLaser();
DrawLaser(0, DL_LASER_ENABLED);
PlaySoundStereo(SND_AMOEBE, ST(dx));
- for(i=4; i>=0; i--)
+ for (i = 4; i >= 0; i--)
{
DrawWallsAnimation_MM(dx, dy, de, i, dm);
+
BackToFront();
Delay(20);
}
if (XS < YS)
k += 2;
- for(i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
{
if (i)
k++;
if (k > 3)
- k=0;
+ k = 0;
x = ELX + Step[k * 4].x;
y = ELY + Step[k * 4].y;
if (i > 3)
{
laser.overloaded = (element == EL_BLOCK_STONE);
+
return;
}
if (element == EL_FUEL_FULL && CT > 200)
{
- for(i=game_mm.energy_left; i<=MAX_LASER_ENERGY; i+=2)
+ for (i = game_mm.energy_left; i <= MAX_LASER_ENERGY; i+=2)
{
#if 0
BlitBitmap(pix[PIX_DOOR], drawto,
if (++p >= game_mm.num_pacman)
p = 0;
+
game_mm.pacman[p].dir--;
- for(l=1; l<5; l++)
+ for (l = 1; l < 5; l++)
{
game_mm.pacman[p].dir++;
nx = ox + mx;
ny = oy + my;
element = Feld[nx][ny];
+
if (nx < 0 || nx > 15 || ny < 0 || ny > 11)
continue;
ox = SX + ox * TILEX;
oy = SY + oy * TILEY;
- for(i=1; i<33; i+=2)
+ for (i = 1; i < 33; i += 2)
BlitBitmap(bitmap, window,
src_x, src_y, TILEX, TILEY,
ox + i * mx, oy + i * my);
Ct = Ct + Counter() - CT;
}
+
DrawField_MM(nx, ny);
BackToFront();
if (ObjHit(nx, ny, HIT_POS_BETWEEN))
{
AddDamagedField(nx, ny);
+
laser.damage[laser.num_damages - 1].edge = 0;
}
}
if (element == EL_BOMB)
- {
DeletePacMan(nx, ny);
- }
if (IS_WALL_AMOEBA(element) &&
(LX + 2 * XS) / TILEX == nx &&
laser.num_edges--;
ScanLaser();
}
+
break;
}
}
if (game_mm.energy_left)
{
if (setup.sound_loops)
- PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, SND_CTRL_PLAY_LOOP);
+ PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT,
+ SND_CTRL_PLAY_LOOP);
- while(game_mm.energy_left > 0)
+ while (game_mm.energy_left > 0)
{
if (!setup.sound_loops)
PlaySoundStereo(SND_SIRR, SOUND_MAX_RIGHT);
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);
+ PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT,
+ SND_CTRL_PLAY_LOOP);
- while(TimePlayed < 999)
+ while (TimePlayed < 999)
{
if (!setup.sound_loops)
PlaySoundStereo(SND_SIRR, SOUND_MAX_RIGHT);
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();
}
game_mm.score < highscore[MAX_SCORE_ENTRIES - 1].Score)
return -1;
- for (k=0; k<MAX_SCORE_ENTRIES; k++)
+ for (k = 0; k < MAX_SCORE_ENTRIES; k++)
{
if (game_mm.score > highscore[k].Score)
{
int m = MAX_SCORE_ENTRIES - 1;
#ifdef ONE_PER_NAME
- for (l=k; l<MAX_SCORE_ENTRIES; l++)
+ 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--)
+ for (l = m; l>k; l--)
{
strcpy(highscore[l].Name, highscore[l - 1].Name);
highscore[l].Score = highscore[l - 1].Score;
highscore[k].Name[MAX_PLAYER_NAME_LEN] = '\0';
highscore[k].Score = game_mm.score;
position = k;
+
break;
}
MovDir[x][y] = direction;
MovDir[newx][newy] = direction;
+
if (Feld[newx][newy] == EL_EMPTY)
Feld[newx][newy] = EL_BLOCKED;
}
int oldx, oldy;
Blocked2Moving_MM(x, y, &oldx, &oldy);
+
return Feld[oldx][oldy];
}
- else
- return element;
+
+ return element;
}
#if 0
static void RaiseScore_MM(int value)
{
game_mm.score += value;
+
#if 0
DrawText(DX_SCORE, DY_SCORE, int2str(game_mm.score, 4),
FONT_TEXT_2);
case EL_PACMAN:
RaiseScore_MM(native_mm_level.score[SC_PACMAN]);
break;
+
case EL_KEY:
RaiseScore_MM(native_mm_level.score[SC_KEY]);
break;
+
default:
break;
}
EL_GRID_WOOD_02,
EL_GRID_WOOD_03,
};
- static int ep_grid_num = sizeof(ep_grid)/sizeof(int);
+ static int ep_grid_num = sizeof(ep_grid) / sizeof(int);
static int ep_mcduffin[] =
{
EL_MCDUFFIN_LEFT,
EL_MCDUFFIN_DOWN,
};
- static int ep_mcduffin_num = sizeof(ep_mcduffin)/sizeof(int);
+ static int ep_mcduffin_num = sizeof(ep_mcduffin) / sizeof(int);
static int ep_rectangle[] =
{
EL_GATE_STONE,
EL_GATE_WOOD
};
- static int ep_rectangle_num = sizeof(ep_rectangle)/sizeof(int);
+ static int ep_rectangle_num = sizeof(ep_rectangle) / sizeof(int);
static int ep_mirror[] =
{
EL_MIRROR_14,
EL_MIRROR_15,
};
- static int ep_mirror_num = sizeof(ep_mirror)/sizeof(int);
+ static int ep_mirror_num = sizeof(ep_mirror) / sizeof(int);
static int ep_mirror_fixed[] =
{
EL_MIRROR_FIXED_02,
EL_MIRROR_FIXED_03,
};
- static int ep_mirror_fixed_num = sizeof(ep_mirror_fixed)/sizeof(int);
+ static int ep_mirror_fixed_num = sizeof(ep_mirror_fixed) / sizeof(int);
static int ep_polar[] =
{
EL_POLAR_14,
EL_POLAR_15,
};
- static int ep_polar_num = sizeof(ep_polar)/sizeof(int);
+ static int ep_polar_num = sizeof(ep_polar) / sizeof(int);
static int ep_polar_cross[] =
{
EL_POLAR_CROSS_02,
EL_POLAR_CROSS_03,
};
- static int ep_polar_cross_num = sizeof(ep_polar_cross)/sizeof(int);
+ static int ep_polar_cross_num = sizeof(ep_polar_cross) / sizeof(int);
static int ep_beamer[] =
{
EL_BEAMER_14,
EL_BEAMER_15,
};
- static int ep_beamer_num = sizeof(ep_beamer)/sizeof(int);
+ static int ep_beamer_num = sizeof(ep_beamer) / sizeof(int);
static int ep_reflecting[] =
{
};
- static int ep_reflecting_num = sizeof(ep_reflecting)/sizeof(int);
+ static int ep_reflecting_num = sizeof(ep_reflecting) / sizeof(int);
static int ep_absorbing[] =
{
};
- static int ep_absorbing_num = sizeof(ep_absorbing)/sizeof(int);
+ static int ep_absorbing_num = sizeof(ep_absorbing) / sizeof(int);
static int ep_inactive[] =
{
};
- static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
+ static int ep_inactive_num = sizeof(ep_inactive) / sizeof(int);
static int ep_wall[] =
{
};
- static int ep_wall_num = sizeof(ep_wall)/sizeof(int);
+ static int ep_wall_num = sizeof(ep_wall) / sizeof(int);
static int ep_pacman[] =
{
EL_PACMAN_LEFT,
EL_PACMAN_DOWN,
};
- static int ep_pacman_num = sizeof(ep_pacman)/sizeof(int);
+ static int ep_pacman_num = sizeof(ep_pacman) / sizeof(int);
static long ep_bit[] =
{
&ep_wall_num,
&ep_pacman_num,
};
- static int num_properties = sizeof(ep_num)/sizeof(int *);
+ static int num_properties = sizeof(ep_num) / sizeof(int *);
- for(i=0; i<MAX_ELEMENTS; i++)
+ for(i = 0; i < MAX_ELEMENTS; i++)
Elementeigenschaften[i] = 0;
- for(i=0; i<num_properties; i++)
- for(j=0; j<*(ep_num[i]); j++)
+ for(i = 0; i < num_properties; i++)
+ for(j = 0; j < *(ep_num[i]); j++)
Elementeigenschaften[(ep_array[i])[j]] |= ep_bit[i];
- for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
+ for(i = EL_CHAR_START; i <= EL_CHAR_END; i++)
Elementeigenschaften[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
- for(i=EL_WALL_START; i<=EL_WALL_END; i++)
+ for(i = EL_WALL_START; i <= EL_WALL_END; i++)
Elementeigenschaften[i] |= EP_BIT_WALL;
}
short Sign[16] =
{
- 0xA,0xF,0xB,0xF,
- 0x3,0xF,0x7,0xF,
- 0x5,0xF,0xD,0xF,
- 0xC,0xF,0xE,0xF
+ 0xA, 0xF, 0xB, 0xF,
+ 0x3, 0xF, 0x7, 0xF,
+ 0x5, 0xF, 0xD, 0xF,
+ 0xC, 0xF, 0xE, 0xF
};
char *element_info_mm[] =
"-------------------------------",
*/
};
-int num_element_info_mm = sizeof(element_info_mm)/sizeof(char *);
+int num_element_info_mm = sizeof(element_info_mm) / sizeof(char *);
#define SCREENY(a) (a)
#define LEVELX(a) (a)
#define LEVELY(a) (a)
-#define IN_VIS_FIELD(x,y) ((x)>=0 && (x)<SCR_FIELDX && (y)>=0 &&(y)<SCR_FIELDY)
-#define IN_SCR_FIELD(x,y) ((x)>=BX1 && (x)<=BX2 && (y)>=BY1 &&(y)<=BY2)
-#define IN_LEV_FIELD(x,y) ((x)>=0 && (x)<lev_fieldx && (y)>=0 &&(y)<lev_fieldy)
-#define IN_PIX_FIELD(x,y) ((x)>=0 && (x)<SXSIZE && (y)>=0 && (y)<SYSIZE)
+
+#define IN_FIELD(x, y, xsize, ysize) ((x) >= 0 && (x) < (xsize) && \
+ (y) >= 0 && (y) < (ysize))
+#define IN_FIELD_MINMAX(x, y, xmin, ymin, xmax, ymax) \
+ ((x) >= (xmin) && (x) <= (xmax) && \
+ (y) >= (ymin) && (y) <= (ymax))
+
+#define IN_PIX_FIELD(x, y) IN_FIELD(x, y, SXSIZE, SYSIZE)
+#define IN_VIS_FIELD(x, y) IN_FIELD(x, y, SCR_FIELDX, SCR_FIELDY)
+#define IN_LEV_FIELD(x, y) IN_FIELD(x, y, lev_fieldx, lev_fieldy)
+#define IN_SCR_FIELD(x, y) IN_FIELD_MINMAX(x, y, BX1, BY1, BX2, BY2)
/* values for 'Elementeigenschaften' */
#define EP_BIT_GRID (1 << 0)
};
extern Bitmap *pix[];
-extern DrawBuffer *fieldbuffer;
-extern DrawBuffer *drawto_field;
+extern DrawBuffer *fieldbuffer;
+extern DrawBuffer *drawto_field;
extern int joystick_device;
extern char *joystick_device_name[];
extern unsigned int Elementeigenschaften[MAX_ELEMENTS];
extern int level_nr;
-extern int lev_fieldx,lev_fieldy, scroll_x,scroll_y;
+extern int lev_fieldx, lev_fieldy, scroll_x, scroll_y;
-extern int FX,FY, ScrollStepSize;
+extern int FX, FY, ScrollStepSize;
extern int ScreenMovDir, ScreenMovPos, ScreenGfxPos;
extern int GameFrameDelay;
extern int FfwdFrameDelay;
-extern int BX1,BY1, BX2,BY2;
+extern int BX1, BY1, BX2, BY2;
extern int SBX_Left, SBX_Right;
extern int SBY_Upper, SBY_Lower;
-extern int ZX,ZY, ExitX,ExitY;
+extern int ZX, ZY, ExitX, ExitY;
extern int AllPlayersGone;
extern int TimeFrames, TimePlayed, TimeLeft;
extern boolean SiebAktiv;
extern struct EditorInfo editor;
extern struct GlobalInfo global;
-extern short LX,LY, XS,YS, ELX,ELY;
-extern short CT,Ct;
+extern short LX, LY, XS, YS, ELX, ELY;
+extern short CT, Ct;
extern Pixel pen_fg, pen_bg, pen_ray, pen_magicolor[2];
extern int color_status;
extern struct XY Step[];
extern short Sign[16];
-extern char *sound_name[];
+extern char *sound_name[];
extern int background_loop[];
extern int num_bg_loops;
-extern char *element_info[];
+extern char *element_info[];
extern int num_element_info;
/* often used screen positions */
#define EL_MM_END_1 155
#define EL_CHAR_START 160
-#define EL_CHAR_ASCII0 (EL_CHAR_START-32)
-#define EL_CHAR_AUSRUF (EL_CHAR_ASCII0+33)
-#define EL_CHAR_ZOLL (EL_CHAR_ASCII0+34)
-#define EL_CHAR_RAUTE (EL_CHAR_ASCII0+35)
-#define EL_CHAR_DOLLAR (EL_CHAR_ASCII0+36)
-#define EL_CHAR_PROZ (EL_CHAR_ASCII0+37)
-#define EL_CHAR_AMPERSAND (EL_CHAR_ASCII0+38)
-#define EL_CHAR_APOSTR (EL_CHAR_ASCII0+39)
-#define EL_CHAR_KLAMM1 (EL_CHAR_ASCII0+40)
-#define EL_CHAR_KLAMM2 (EL_CHAR_ASCII0+41)
-#define EL_CHAR_MULT (EL_CHAR_ASCII0+42)
-#define EL_CHAR_PLUS (EL_CHAR_ASCII0+43)
-#define EL_CHAR_KOMMA (EL_CHAR_ASCII0+44)
-#define EL_CHAR_MINUS (EL_CHAR_ASCII0+45)
-#define EL_CHAR_PUNKT (EL_CHAR_ASCII0+46)
-#define EL_CHAR_SLASH (EL_CHAR_ASCII0+47)
-#define EL_CHAR_0 (EL_CHAR_ASCII0+48)
-#define EL_CHAR_9 (EL_CHAR_ASCII0+57)
-#define EL_CHAR_DOPPEL (EL_CHAR_ASCII0+58)
-#define EL_CHAR_SEMIKL (EL_CHAR_ASCII0+59)
-#define EL_CHAR_LT (EL_CHAR_ASCII0+60)
-#define EL_CHAR_GLEICH (EL_CHAR_ASCII0+61)
-#define EL_CHAR_GT (EL_CHAR_ASCII0+62)
-#define EL_CHAR_FRAGE (EL_CHAR_ASCII0+63)
-#define EL_CHAR_AT (EL_CHAR_ASCII0+64)
-#define EL_CHAR_A (EL_CHAR_ASCII0+65)
-#define EL_CHAR_Z (EL_CHAR_ASCII0+90)
-#define EL_CHAR_AE (EL_CHAR_ASCII0+91)
-#define EL_CHAR_OE (EL_CHAR_ASCII0+92)
-#define EL_CHAR_UE (EL_CHAR_ASCII0+93)
-#define EL_CHAR_COPY (EL_CHAR_ASCII0+94)
-#define EL_CHAR_END (EL_CHAR_START+79)
+#define EL_CHAR_ASCII0 (EL_CHAR_START - 32)
+#define EL_CHAR_AUSRUF (EL_CHAR_ASCII0 + 33)
+#define EL_CHAR_ZOLL (EL_CHAR_ASCII0 + 34)
+#define EL_CHAR_RAUTE (EL_CHAR_ASCII0 + 35)
+#define EL_CHAR_DOLLAR (EL_CHAR_ASCII0 + 36)
+#define EL_CHAR_PROZ (EL_CHAR_ASCII0 + 37)
+#define EL_CHAR_AMPERSAND (EL_CHAR_ASCII0 + 38)
+#define EL_CHAR_APOSTR (EL_CHAR_ASCII0 + 39)
+#define EL_CHAR_KLAMM1 (EL_CHAR_ASCII0 + 40)
+#define EL_CHAR_KLAMM2 (EL_CHAR_ASCII0 + 41)
+#define EL_CHAR_MULT (EL_CHAR_ASCII0 + 42)
+#define EL_CHAR_PLUS (EL_CHAR_ASCII0 + 43)
+#define EL_CHAR_KOMMA (EL_CHAR_ASCII0 + 44)
+#define EL_CHAR_MINUS (EL_CHAR_ASCII0 + 45)
+#define EL_CHAR_PUNKT (EL_CHAR_ASCII0 + 46)
+#define EL_CHAR_SLASH (EL_CHAR_ASCII0 + 47)
+#define EL_CHAR_0 (EL_CHAR_ASCII0 + 48)
+#define EL_CHAR_9 (EL_CHAR_ASCII0 + 57)
+#define EL_CHAR_DOPPEL (EL_CHAR_ASCII0 + 58)
+#define EL_CHAR_SEMIKL (EL_CHAR_ASCII0 + 59)
+#define EL_CHAR_LT (EL_CHAR_ASCII0 + 60)
+#define EL_CHAR_GLEICH (EL_CHAR_ASCII0 + 61)
+#define EL_CHAR_GT (EL_CHAR_ASCII0 + 62)
+#define EL_CHAR_FRAGE (EL_CHAR_ASCII0 + 63)
+#define EL_CHAR_AT (EL_CHAR_ASCII0 + 64)
+#define EL_CHAR_A (EL_CHAR_ASCII0 + 65)
+#define EL_CHAR_Z (EL_CHAR_ASCII0 + 90)
+#define EL_CHAR_AE (EL_CHAR_ASCII0 + 91)
+#define EL_CHAR_OE (EL_CHAR_ASCII0 + 92)
+#define EL_CHAR_UE (EL_CHAR_ASCII0 + 93)
+#define EL_CHAR_COPY (EL_CHAR_ASCII0 + 94)
+#define EL_CHAR_END (EL_CHAR_START + 79)
#define EL_CHAR(x) ((x) == CHAR_BYTE_UMLAUT_A ? EL_CHAR_AE : \
(x) == CHAR_BYTE_UMLAUT_O ? EL_CHAR_OE : \
#define SETUP 8
/* return values for GameActions */
-#define ACT_GO_ON 0
-#define ACT_GAME_OVER 1
-#define ACT_NEW_GAME 2
+#define ACT_GO_ON 0
+#define ACT_GAME_OVER 1
+#define ACT_NEW_GAME 2
/* values for color_status */
-#define STATIC_COLORS 0
-#define DYNAMIC_COLORS 1
+#define STATIC_COLORS 0
+#define DYNAMIC_COLORS 1
#define PROGRAM_VERSION_MAJOR 2
#define PROGRAM_VERSION_MINOR 0
/* sound control */
-#define ST(x) (((x)-8)*16)
+#define ST(x) (((x) - 8) * 16)
#endif /* MM_MAIN_H */
#endif
DrawGraphicExt_MM(drawto_field, FX + x*TILEX, FY + y*TILEY, graphic);
+
MarkTileDirty(x, y);
}
int src_x, src_y;
getGraphicSource(graphic, 0, &bitmap, &src_x, &src_y);
+
BlitBitmap(bitmap, d, src_x, src_y, TILEX, TILEY, x, y);
}
}
#endif
- DrawGraphicThruMaskExt_MM(drawto_field, FX + x*TILEX, FY + y*TILEY, graphic);
+ DrawGraphicThruMaskExt_MM(drawto_field, FX + x * TILEX, FY + y * TILEY,
+ graphic);
+
MarkTileDirty(x,y);
}
void DrawMiniGraphic_MM(int x, int y, int graphic)
{
- DrawMiniGraphicExt_MM(drawto, SX + x*MINI_TILEX, SY + y*MINI_TILEY, graphic);
- MarkTileDirty(x/2, y/2);
+ DrawMiniGraphicExt_MM(drawto, SX + x * MINI_TILEX, SY + y * MINI_TILEY,
+ graphic);
+
+ MarkTileDirty(x / 2, y / 2);
}
void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
int src_x, src_y;
getMiniGraphicSource(graphic, &bitmap, &src_x, &src_y);
+
BlitBitmap(bitmap, d, src_x, src_y, MINI_TILEX, MINI_TILEY, x, y);
}
if (graphic < 0)
{
DrawGraphic_MM(x, y, graphic);
+
return;
}
MarkTileDirty(x, y + 1);
} /* Element verläßt unten das Bild */
else if (dy > 0 && (y == BY2 || cut_mode == CUT_BELOW))
+ {
height -= dy;
+ }
else if (dy) /* allg. Bewegung in y-Richtung */
+ {
MarkTileDirty(x, y + SIGN(dy));
+ }
}
getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
#endif
if (mask_mode == USE_MASKING)
- {
BlitBitmapMasked(src_bitmap, drawto_field,
src_x, src_y, TILEX, TILEY, dest_x, dest_y);
- }
else
BlitBitmap(src_bitmap, drawto_field,
src_x, src_y, width, height, dest_x, dest_y);
void DrawGraphicShiftedThruMask_MM(int x,int y, int dx,int dy, int graphic,
int cut_mode)
{
- DrawGraphicShifted_MM(x,y, dx,dy, graphic, cut_mode, USE_MASKING);
+ DrawGraphicShifted_MM(x, y, dx, dy, graphic, cut_mode, USE_MASKING);
}
void DrawScreenElementExt_MM(int x, int y, int dx, int dy, int element,
int horiz_move;
Blocked2Moving(x, y, &oldx, &oldy);
+
sx = SCREENX(oldx);
sy = SCREENY(oldy);
horiz_move = (MovDir[oldx][oldy] == MV_LEFT ||
MovDir[oldx][oldy] == MV_RIGHT);
DrawScreenElement_MM(x, y, EL_EMPTY);
+
element = Feld[oldx][oldy];
if (horiz_move)
- DrawScreenElementShifted_MM(sx,sy, MovPos[oldx][oldy],0,element,NO_CUTTING);
+ DrawScreenElementShifted_MM(sx, sy, MovPos[oldx][oldy], 0, element,
+ NO_CUTTING);
else
- DrawScreenElementShifted_MM(sx,sy, 0,MovPos[oldx][oldy],element,NO_CUTTING);
+ DrawScreenElementShifted_MM(sx, sy, 0, MovPos[oldx][oldy], element,
+ NO_CUTTING);
}
else if (IS_DRAWABLE(element))
+ {
DrawScreenElement_MM(x, y, element);
+ }
else
+ {
DrawScreenElement_MM(x, y, EL_EMPTY);
+ }
}
void DrawLevelField_MM(int x, int y)
if (!element)
{
DrawMiniGraphic_MM(x, y, IMG_EMPTY);
+
return;
}
graphic = el2gfx(element);
+
DrawMiniGraphic_MM(x, y, graphic);
}
ClearWindow();
- for (x=0; x<lev_fieldx; x++)
- for (y=0; y<lev_fieldy; y++)
+ for (x = 0; x < lev_fieldx; x++)
+ for (y = 0; y < lev_fieldy; y++)
DrawField_MM(x, y);
redraw_mask |= REDRAW_FIELD;
gy += MINI_TILEY;
*/
- for(i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
{
int dest_x = SX + x * TILEX + MINI_TILEX * (i % 2);
int dest_y = SY + y * TILEY + MINI_TILEY * (i / 2);
getMicroGraphicSource(graphic, &bitmap, &gx, &gy);
- for (i=0; i<4; i++)
+ for (i = 0; i < 4; i++)
{
int xpos = MICROLEV_XPOS + x * MICRO_TILEX + MICRO_WALLX * (i % 2);
int ypos = MICROLEV_YPOS + y * MICRO_TILEY + MICRO_WALLY * (i / 2);
if (IS_WALL(element))
{
DrawMicroWalls_MM(x, y, element);
+
return;
}
void DrawMicroLevelExt_MM(int xpos, int ypos)
{
- int x,y;
+ int x, y;
ClearRectangle(drawto, xpos, ypos, MICROLEV_XSIZE, MICROLEV_YSIZE);
- for (x=0; x<STD_LEV_FIELDX; x++)
- for (y=0; y<STD_LEV_FIELDY; y++)
+ for (x = 0; x < STD_LEV_FIELDX; x++)
+ for (y = 0; y < STD_LEV_FIELDY; y++)
DrawMicroElement_MM(x, y, Ur[x][y]);
redraw_mask |= REDRAW_FIELD;
void DrawMiniLevel_MM(int size_x, int size_y, int scroll_x, int scroll_y)
{
- int x,y;
+ int x, y;
- for(x=0; x<size_x; x++)
- for(y=0; y<size_y; y++)
+ for(x = 0; x < size_x; x++)
+ for(y = 0; y < size_y; y++)
DrawMiniElementOrWall_MM(x, y, scroll_x, scroll_y);
redraw_mask |= REDRAW_FIELD;
int REQ_in_range(int x, int y)
{
- if (y > DY+249 && y < DY+278)
+ if (y > DY + 249 && y < DY + 278)
{
- if (x > DX+1 && x < DX+48)
+ if (x > DX + 1 && x < DX + 48)
return 1;
- else if (x > DX+51 && x < DX+98)
+ else if (x > DX + 51 && x < DX + 98)
return 2;
}
+
return 0;
}