projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed decrementing counter for kettles (removed by accident) (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 bc96959f179e1470e8477ff507e7379691a7671b..0cb2e094f9ebe6c7f6e727af5e70d03ead65bf11 100644
(file)
--- a/
src/game_mm/mm_game.c
+++ b/
src/game_mm/mm_game.c
@@
-344,9
+344,15
@@
void InitGameEngine_MM()
}
}
}
}
+#if 0
CloseDoor(DOOR_CLOSE_1);
CloseDoor(DOOR_CLOSE_1);
+#endif
DrawLevel_MM();
DrawLevel_MM();
+}
+
+void InitGameEngine_MM_AfterFadingIn()
+{
InitCycleElements();
InitLaser();
InitCycleElements();
InitLaser();
@@
-365,8
+371,10
@@
void InitGameEngine_MM()
int2str(game_mm.score, 4), FONT_TEXT_2);
#endif
int2str(game_mm.score, 4), FONT_TEXT_2);
#endif
+#if 0
UnmapGameButtons();
MapGameButtons();
UnmapGameButtons();
MapGameButtons();
+#endif
#if 0
/* copy actual game door content to door double buffer for OpenDoor() */
#if 0
/* copy actual game door content to door double buffer for OpenDoor() */
@@
-374,7
+382,9
@@
void InitGameEngine_MM()
DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
#endif
DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
#endif
+#if 0
OpenDoor(DOOR_OPEN_ALL);
OpenDoor(DOOR_OPEN_ALL);
+#endif
if (setup.sound_loops)
PlaySoundExt(SND_FUEL, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, SND_CTRL_PLAY_LOOP);
if (setup.sound_loops)
PlaySoundExt(SND_FUEL, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, SND_CTRL_PLAY_LOOP);
@@
-461,13
+471,13
@@
boolean StepBehind()
static int getMaskFromElement(int element)
{
if (IS_GRID(element))
static int getMaskFromElement(int element)
{
if (IS_GRID(element))
- return
GFX_MASK_GRID_00
+ get_element_phase(element);
+ return
IMG_MM_MASK_GRID_1
+ get_element_phase(element);
else if (IS_MCDUFFIN(element))
else if (IS_MCDUFFIN(element))
- return
GFX_MASK_MCDUFFIN_00
+ get_element_phase(element);
+ return
IMG_MM_MASK_MCDUFFIN_RIGHT
+ get_element_phase(element);
else if (IS_RECTANGLE(element) || IS_DF_GRID(element))
else if (IS_RECTANGLE(element) || IS_DF_GRID(element))
- return
GFX
_MASK_RECTANGLE;
+ return
IMG_MM
_MASK_RECTANGLE;
else
else
- return
GFX
_MASK_CIRCLE;
+ return
IMG_MM
_MASK_CIRCLE;
}
int ScanPixel()
}
int ScanPixel()
@@
-497,53
+507,47
@@
int ScanPixel()
for (i=0; i<4; i++)
{
for (i=0; i<4; i++)
{
+ int px = LX + (i % 2) * 2;
+ int py = LY + (i / 2) * 2;
+ int dx = px % TILEX;
+ int dy = py % TILEY;
+ int lx = (px + TILEX) / TILEX - 1; /* ...+TILEX...-1 to get correct */
+ int ly = (py + TILEY) / TILEY - 1; /* negative values! */
Pixel pixel;
Pixel pixel;
- int px, py, lx, ly;
-
- px = SX + LX + (i % 2) * 2;
- py = SY + LY + (i / 2) * 2;
- lx = (px - SX + TILEX) / TILEX - 1; /* ...+TILEX...-1 to get correct */
- ly = (py - SY + TILEY) / TILEY - 1; /* negative values! */
if (IN_LEV_FIELD(lx, ly))
{
int element = Feld[lx][ly];
if (element == EL_EMPTY || element == EL_EXPLODING_TRANSP)
if (IN_LEV_FIELD(lx, ly))
{
int element = Feld[lx][ly];
if (element == EL_EMPTY || element == EL_EXPLODING_TRANSP)
+ {
pixel = 0;
pixel = 0;
+ }
else if (IS_WALL(element) || IS_WALL_CHANGING(element))
{
else if (IS_WALL(element) || IS_WALL_CHANGING(element))
{
- int pos =
- ((py - SY - ly * TILEY) / MINI_TILEX) * 2 +
- (px - SX - lx * TILEX) / MINI_TILEY;
+ int pos = dy / MINI_TILEY * 2 + dx / MINI_TILEX;
pixel = ((element & (1 << pos)) ? 1 : 0);
}
else
{
int graphic_mask = getMaskFromElement(element);
pixel = ((element & (1 << pos)) ? 1 : 0);
}
else
{
int graphic_mask = getMaskFromElement(element);
+ Bitmap *bitmap;
+ int src_x, src_y;
int mask_x, mask_y;
int mask_x, mask_y;
- int dx = px - lx * TILEX;
- int dy = py - ly * TILEY;
- mask_x = (graphic_mask % GFX_PER_LINE) * TILEX + dx;
- mask_y = (graphic_mask / GFX_PER_LINE) * TILEY + dy;
+ getGraphicSource(graphic_mask, 0, &bitmap, &src_x, &src_y);
-#if 1
- // !!! temporary fix to compile -- change to game graphics !!!
- pixel = (ReadPixel(drawto, mask_x, mask_y) ? 1 : 0);
-#else
- pixel = (ReadPixel(pix[PIX_BACK], mask_x, mask_y) ? 1 : 0);
-#endif
+ mask_x = src_x + dx;
+ mask_y = src_y + dy;
+
+ pixel = (ReadPixel(bitmap, mask_x, mask_y) ? 1 : 0);
}
}
else
{
}
}
else
{
- if (px < REAL_SX || px >= REAL_SX + FULL_SXSIZE ||
- py < REAL_SY || py >= REAL_SY + FULL_SYSIZE)
- pixel = 1;
- else
- pixel = 0;
+ pixel = (SX + px < REAL_SX || SX + px >= REAL_SX + FULL_SXSIZE ||
+ SY + py < REAL_SY || SY + py >= REAL_SY + FULL_SYSIZE);
}
if ((Sign[laser.current_angle] & (1 << i)) && pixel)
}
if ((Sign[laser.current_angle] & (1 << i)) && pixel)
@@
-1187,6
+1191,9
@@
boolean HitElement(int element, int hit_mask)
if (element == EL_KETTLE || element == EL_CELL)
{
if (element == EL_KETTLE || element == EL_CELL)
{
+ if (game_mm.kettles_still_needed > 0)
+ game_mm.kettles_still_needed--;
+
RaiseScore_MM(10);
if (game_mm.kettles_still_needed == 0)
RaiseScore_MM(10);
if (game_mm.kettles_still_needed == 0)
@@
-2126,6
+2133,7
@@
static void Explode_MM(int x, int y, int phase, int mode)
Store[x][y] = EL_EMPTY;
}
Store[x][y] = EL_EMPTY;
}
+ 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);
Store[x][y] = Store2[x][y] = 0;
MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
InitField(x, y, FALSE);
@@
-2133,36
+2141,41
@@
static void Explode_MM(int x, int y, int phase, int mode)
}
else if (!(phase % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
{
}
else if (!(phase % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
{
- int graphic =
GFX_EXPLOSION_START
;
+ int graphic =
IMG_MM_DEFAULT_EXPLODING
;
int graphic_phase = (phase / delay - 1);
int graphic_phase = (phase / delay - 1);
+ Bitmap *bitmap;
+ int src_x, src_y;
if (Store2[x][y] == EX_KETTLE)
{
if (graphic_phase < 3)
if (Store2[x][y] == EX_KETTLE)
{
if (graphic_phase < 3)
- graphic =
GFX_EXPLOSION_KETTLE
;
+ graphic =
IMG_MM_KETTLE_EXPLODING
;
else if (graphic_phase < 5)
{
else if (graphic_phase < 5)
{
- graphic = GFX_EXPLOSION_LAST;
- graphic_phase -= graphic_phase;
+ graphic_phase += 3;
}
else
{
}
else
{
- graphic =
GFX
_EMPTY;
+ graphic =
IMG
_EMPTY;
graphic_phase = 0;
}
}
else if (Store2[x][y] == EX_SHORT)
{
if (graphic_phase < 4)
graphic_phase = 0;
}
}
else if (Store2[x][y] == EX_SHORT)
{
if (graphic_phase < 4)
- graphic
= GFX_EXPLOSION_SHORT
;
+ graphic
_phase += 4
;
else
{
else
{
- graphic =
GFX
_EMPTY;
+ graphic =
IMG
_EMPTY;
graphic_phase = 0;
}
}
graphic_phase = 0;
}
}
- DrawGraphic_MM(x, y, graphic + graphic_phase);
+ getGraphicSource(graphic, graphic_phase, &bitmap, &src_x, &src_y);
+
+ BlitBitmap(bitmap, drawto_field, src_x, src_y, TILEX, TILEY,
+ FX + x * TILEX, FY + y * TILEY);
+ MarkTileDirty(x, y);
}
}
}
}
@@
-2425,7
+2438,7
@@
void ClickElement(int mx, int my, int button)
laser.fuse_off = FALSE;
laser.fuse_x = laser.fuse_y = -1;
laser.fuse_off = FALSE;
laser.fuse_x = laser.fuse_y = -1;
- DrawGraphic_MM(x, y,
GFX_FUSE_ON
);
+ DrawGraphic_MM(x, y,
IMG_MM_FUSE_ACTIVE
);
ScanLaser();
}
else if (element == EL_FUSE_ON && !laser.fuse_off && new_button)
ScanLaser();
}
else if (element == EL_FUSE_ON && !laser.fuse_off && new_button)
@@
-2436,7
+2449,7
@@
void ClickElement(int mx, int my, int button)
laser.overloaded = FALSE;
DrawLaser(0, DL_LASER_DISABLED);
laser.overloaded = FALSE;
DrawLaser(0, DL_LASER_DISABLED);
- DrawGraphic_MM(x, y,
GFX_FUSE_OFF
);
+ DrawGraphic_MM(x, y,
IMG_MM_FUSE
);
}
else if (element == EL_LIGHTBALL)
{
}
else if (element == EL_LIGHTBALL)
{
@@
-2670,7
+2683,7
@@
void ColorCycling(void)
}
}
}
}
-
void GameActions_MM
(byte action[MAX_PLAYERS], boolean warp_mode)
+
static void GameActions_MM_Ext
(byte action[MAX_PLAYERS], boolean warp_mode)
{
static unsigned int action_delay = 0;
static unsigned int pacman_delay = 0;
{
static unsigned int action_delay = 0;
static unsigned int pacman_delay = 0;
@@
-2960,7
+2973,7
@@
void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode)
laser.fuse_x = ELX;
laser.fuse_y = ELY;
DrawLaser(0, DL_LASER_DISABLED);
laser.fuse_x = ELX;
laser.fuse_y = ELY;
DrawLaser(0, DL_LASER_DISABLED);
- DrawGraphic_MM(ELX, ELY,
GFX_FUSE_OFF
);
+ DrawGraphic_MM(ELX, ELY,
IMG_MM_FUSE
);
}
if (element == EL_BALL_GRAY && CT > 1500)
}
if (element == EL_BALL_GRAY && CT > 1500)
@@
-3302,7
+3315,7
@@
void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode)
Feld[ELX][ELY] = 0;
Feld[x][y] = element;
Feld[ELX][ELY] = 0;
Feld[x][y] = element;
- DrawGraphic_MM(ELX, ELY,
-1
);
+ DrawGraphic_MM(ELX, ELY,
IMG_EMPTY
);
DrawField_MM(x, y);
if (element == EL_BLOCK_STONE && Box[ELX][ELY])
DrawField_MM(x, y);
if (element == EL_BLOCK_STONE && Box[ELX][ELY])
@@
-3346,11
+3359,19
@@
void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode)
return;
}
return;
}
+void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode)
+{
+ if (!button_status)
+ ClickElement(0, 0, MB_NOT_PRESSED);
+
+ GameActions_MM_Ext(action, warp_mode);
+}
+
void MovePacMen()
{
static int p = -1;
int mx, my, ox, oy, nx, ny;
void MovePacMen()
{
static int p = -1;
int mx, my, ox, oy, nx, ny;
- int
g,
element;
+ int element;
int l;
if (++p >= game_mm.num_pacman)
int l;
if (++p >= game_mm.num_pacman)
@@
-3397,30
+3418,26
@@
void MovePacMen()
game_mm.pacman[p].x = nx;
game_mm.pacman[p].y = ny;
game_mm.pacman[p].x = nx;
game_mm.pacman[p].y = ny;
- g = Feld[nx][ny] - EL_PACMAN_RIGHT;
- DrawGraphic_MM(ox, oy,
GFX
_EMPTY);
+
+ DrawGraphic_MM(ox, oy,
IMG
_EMPTY);
if (element != EL_EMPTY)
{
if (element != EL_EMPTY)
{
+ int graphic = el2gfx(Feld[nx][ny]);
+ Bitmap *bitmap;
+ int src_x, src_y;
int i;
int i;
+ getGraphicSource(graphic, 0, &bitmap, &src_x, &src_y);
+
CT = Counter();
ox = SX + ox * TILEX;
oy = SY + oy * TILEY;
for(i=1; i<33; i+=2)
CT = Counter();
ox = SX + ox * TILEX;
oy = SY + oy * TILEY;
for(i=1; i<33; i+=2)
- {
-#if 1
- // !!! temporary fix to compile -- change to game graphics !!!
- BlitBitmap(drawto, window,
- SX + g * TILEX, SY + 4 * TILEY, TILEX, TILEY,
+ BlitBitmap(bitmap, window,
+ src_x, src_y, TILEX, TILEY,
ox + i * mx, oy + i * my);
ox + i * mx, oy + i * my);
-#else
- BlitBitmap(pix[PIX_BACK], window,
- SX + g * TILEX, SY + 4 * TILEY, TILEX, TILEY,
- ox + i * mx, oy + i * my);
-#endif
- }
Ct = Ct + Counter() - CT;
}
DrawField_MM(nx, ny);
Ct = Ct + Counter() - CT;
}
DrawField_MM(nx, ny);