projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20030726-1-src
[rocksndiamonds.git]
/
src
/
game.c
diff --git
a/src/game.c
b/src/game.c
index 2a63d3cea336b8d82d9a92d23525ad97cf5055a1..5b22dcbd4f7d511af5972303033fe20a6f5bae44 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-1906,6
+1906,8
@@
void Explode(int ex, int ey, int phase, int mode)
for (y = ey - 1; y <= ey + 1; y++) for(x = ex - 1; x <= ex + 1; x++)
{
for (y = ey - 1; y <= ey + 1; y++) for(x = ex - 1; x <= ex + 1; x++)
{
+ int xx = x - ex + 1;
+ int yy = y - ey + 1;
int element;
if (!IN_LEV_FIELD(x, y) ||
int element;
if (!IN_LEV_FIELD(x, y) ||
@@
-1923,9
+1925,18
@@
void Explode(int ex, int ey, int phase, int mode)
RemoveMovingField(x, y);
}
RemoveMovingField(x, y);
}
+#if 1
+
#if 1
if (IS_EXPLOSION_PROOF(element))
continue;
#if 1
if (IS_EXPLOSION_PROOF(element))
continue;
+#else
+ /* indestructible elements can only explode in center (but not flames) */
+ if ((IS_EXPLOSION_PROOF(element) && (x != ex || y != ey)) ||
+ element == EL_FLAMES)
+ continue;
+#endif
+
#else
if ((IS_INDESTRUCTIBLE(element) &&
(game.engine_version < VERSION_IDENT(2,2,0) ||
#else
if ((IS_INDESTRUCTIBLE(element) &&
(game.engine_version < VERSION_IDENT(2,2,0) ||
@@
-1947,8
+1958,13
@@
void Explode(int ex, int ey, int phase, int mode)
}
/* save walkable background elements while explosion on same tile */
}
/* save walkable background elements while explosion on same tile */
+#if 1
if (IS_INDESTRUCTIBLE(element))
Back[x][y] = element;
if (IS_INDESTRUCTIBLE(element))
Back[x][y] = element;
+#else
+ if (IS_INDESTRUCTIBLE(element) && IS_WALKABLE(element))
+ Back[x][y] = element;
+#endif
/* ignite explodable elements reached by other explosion */
if (element == EL_EXPLOSION)
/* ignite explodable elements reached by other explosion */
if (element == EL_EXPLOSION)
@@
-2002,11
+2018,10
@@
void Explode(int ex, int ey, int phase, int mode)
else if (center_element == EL_AMOEBA_TO_DIAMOND)
Store[x][y] = level.amoeba_content;
else if (center_element == EL_YAMYAM)
else if (center_element == EL_AMOEBA_TO_DIAMOND)
Store[x][y] = level.amoeba_content;
else if (center_element == EL_YAMYAM)
- Store[x][y] =
- level.yamyam_content[game.yamyam_content_nr][x - ex + 1][y - ey + 1];
- else if (IS_CUSTOM_ELEMENT(center_element))
- Store[x][y] =
- element_info[center_element].content[x - ex + 1][y - ey + 1];
+ Store[x][y] = level.yamyam_content[game.yamyam_content_nr][xx][yy];
+ else if (IS_CUSTOM_ELEMENT(center_element) &&
+ element_info[center_element].content[xx][yy] != EL_EMPTY)
+ Store[x][y] = element_info[center_element].content[xx][yy];
else if (element == EL_WALL_EMERALD)
Store[x][y] = EL_EMERALD;
else if (element == EL_WALL_DIAMOND)
else if (element == EL_WALL_EMERALD)
Store[x][y] = EL_EMERALD;
else if (element == EL_WALL_DIAMOND)
@@
-2023,6
+2038,8
@@
void Explode(int ex, int ey, int phase, int mode)
Store[x][y] = EL_PEARL;
else if (element == EL_WALL_CRYSTAL)
Store[x][y] = EL_CRYSTAL;
Store[x][y] = EL_PEARL;
else if (element == EL_WALL_CRYSTAL)
Store[x][y] = EL_CRYSTAL;
+ else if (IS_CUSTOM_ELEMENT(element))
+ Store[x][y] = element_info[element].content[1][1];
else
Store[x][y] = EL_EMPTY;
else
Store[x][y] = EL_EMPTY;
@@
-3426,7
+3443,9
@@
void StartMoving(int x, int y)
if (Stop[x][y])
return;
if (Stop[x][y])
return;
- GfxAction[x][y] = ACTION_DEFAULT;
+ /* !!! this should be handled more generic (not only for mole) !!! */
+ if (element != EL_MOLE && GfxAction[x][y] != ACTION_DIGGING)
+ GfxAction[x][y] = ACTION_DEFAULT;
if (CAN_FALL(element) && y < lev_fieldy - 1)
{
if (CAN_FALL(element) && y < lev_fieldy - 1)
{
@@
-4005,6
+4024,11
@@
void StartMoving(int x, int y)
{
Feld[newx][newy] = EL_AMOEBA_SHRINKING;
PlaySoundLevel(x, y, SND_MOLE_DIGGING);
{
Feld[newx][newy] = EL_AMOEBA_SHRINKING;
PlaySoundLevel(x, y, SND_MOLE_DIGGING);
+
+ ResetGfxAnimation(x, y);
+ GfxAction[x][y] = ACTION_DIGGING;
+ DrawLevelField(x, y);
+
MovDelay[newx][newy] = 0; /* start amoeba shrinking delay */
return; /* wait for shrinking amoeba */
}
MovDelay[newx][newy] = 0; /* start amoeba shrinking delay */
return; /* wait for shrinking amoeba */
}
@@
-5203,7
+5227,7
@@
static void ChangeElementNow(int x, int y, int element)
if (!change->only_complete || complete_change)
{
if (change->only_complete && change->use_random_change &&
if (!change->only_complete || complete_change)
{
if (change->only_complete && change->use_random_change &&
- RND(
change->random) != 0
)
+ RND(
100) < change->random
)
return;
for (yy = 0; yy < 3; yy++) for(xx = 0; xx < 3 ; xx++)
return;
for (yy = 0; yy < 3; yy++) for(xx = 0; xx < 3 ; xx++)
@@
-5212,7
+5236,7
@@
static void ChangeElementNow(int x, int y, int element)
int ey = y + yy - 1;
if (can_change[xx][yy] && (!change->use_random_change ||
int ey = y + yy - 1;
if (can_change[xx][yy] && (!change->use_random_change ||
- RND(
change->random) == 0
))
+ RND(
100) < change->random
))
{
if (IS_MOVING(ex, ey) || IS_BLOCKED(ex, ey))
RemoveMovingField(ex, ey);
{
if (IS_MOVING(ex, ey) || IS_BLOCKED(ex, ey))
RemoveMovingField(ex, ey);
@@
-5562,6
+5586,16
@@
void GameActions()
GfxFrame[x][y]++;
GfxFrame[x][y]++;
+#if 1
+ /* reset finished pushing action (not done in ContinueMoving() to allow
+ continous pushing animation for elements without push delay) */
+ if (GfxAction[x][y] == ACTION_PUSHING && !IS_MOVING(x, y))
+ {
+ ResetGfxAnimation(x, y);
+ DrawLevelField(x, y);
+ }
+#endif
+
#if DEBUG
if (IS_BLOCKED(x, y))
{
#if DEBUG
if (IS_BLOCKED(x, y))
{
@@
-5635,9
+5669,10
@@
void GameActions()
#if 1
graphic = el_act_dir2img(element, GfxAction[x][y], MovDir[x][y]);
#if 0
#if 1
graphic = el_act_dir2img(element, GfxAction[x][y], MovDir[x][y]);
#if 0
- if (element == EL_PACMAN)
- printf("::: %d, %d, %d\n",
- IS_ANIMATED(graphic), IS_MOVING(x, y), Stop[x][y]);
+ if (element == EL_MOLE)
+ printf("::: %d, %d, %d [%d]\n",
+ IS_ANIMATED(graphic), IS_MOVING(x, y), Stop[x][y],
+ GfxAction[x][y]);
#endif
#if 0
if (element == EL_YAMYAM)
#endif
#if 0
if (element == EL_YAMYAM)
@@
-5653,7
+5688,7
@@
void GameActions()
DrawLevelGraphicAnimationIfNeeded(x, y, graphic);
#if 0
DrawLevelGraphicAnimationIfNeeded(x, y, graphic);
#if 0
- if (element == EL_
YAMYAM
)
+ if (element == EL_
MOLE
)
printf("::: %d, %d\n", graphic, GfxFrame[x][y]);
#endif
}
printf("::: %d, %d\n", graphic, GfxFrame[x][y]);
#endif
}
@@
-6317,7
+6352,9
@@
void ScrollFigure(struct PlayerInfo *player, int mode)
if (Feld[last_jx][last_jy] == EL_EMPTY)
Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING;
if (Feld[last_jx][last_jy] == EL_EMPTY)
Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING;
+#if 0
DrawPlayer(player);
DrawPlayer(player);
+#endif
return;
}
else if (!FrameReached(&player->actual_frame_counter, 1))
return;
}
else if (!FrameReached(&player->actual_frame_counter, 1))
@@
-6333,7
+6370,9
@@
void ScrollFigure(struct PlayerInfo *player, int mode)
if (player->MovPos == 0)
CheckGravityMovement(player);
if (player->MovPos == 0)
CheckGravityMovement(player);
- DrawPlayer(player);
+#if 0
+ DrawPlayer(player); /* needed here only to cleanup last field */
+#endif
if (player->MovPos == 0)
{
if (player->MovPos == 0)
{
@@
-6395,6
+6434,7
@@
void ScrollScreen(struct PlayerInfo *player, int mode)
void TestIfPlayerTouchesCustomElement(int x, int y)
{
void TestIfPlayerTouchesCustomElement(int x, int y)
{
+ static boolean check_changing = FALSE;
static int xy[4][2] =
{
{ 0, -1 },
static int xy[4][2] =
{
{ 0, -1 },
@@
-6405,6
+6445,12
@@
void TestIfPlayerTouchesCustomElement(int x, int y)
boolean center_is_player = (IS_PLAYER(x, y));
int i;
boolean center_is_player = (IS_PLAYER(x, y));
int i;
+ /* prevent TestIfPlayerTouchesCustomElement() from looping */
+ if (check_changing)
+ return;
+
+ check_changing = TRUE;
+
for (i=0; i<4; i++)
{
int xx = x + xy[i][0];
for (i=0; i<4; i++)
{
int xx = x + xy[i][0];
@@
-6426,10
+6472,13
@@
void TestIfPlayerTouchesCustomElement(int x, int y)
break;
}
}
break;
}
}
+
+ check_changing = FALSE;
}
void TestIfElementTouchesCustomElement(int x, int y)
{
}
void TestIfElementTouchesCustomElement(int x, int y)
{
+ static boolean check_changing = FALSE;
static int xy[4][2] =
{
{ 0, -1 },
static int xy[4][2] =
{
{ 0, -1 },
@@
-6440,6
+6489,12
@@
void TestIfElementTouchesCustomElement(int x, int y)
boolean center_is_custom = (IS_CUSTOM_ELEMENT(Feld[x][y]));
int i;
boolean center_is_custom = (IS_CUSTOM_ELEMENT(Feld[x][y]));
int i;
+ /* prevent TestIfElementTouchesCustomElement() from looping */
+ if (check_changing)
+ return;
+
+ check_changing = TRUE;
+
for (i=0; i<4; i++)
{
int xx = x + xy[i][0];
for (i=0; i<4; i++)
{
int xx = x + xy[i][0];
@@
-6460,6
+6515,8
@@
void TestIfElementTouchesCustomElement(int x, int y)
CheckElementChange(xx, yy, Feld[xx][yy], CE_OTHER_IS_TOUCHING);
}
}
CheckElementChange(xx, yy, Feld[xx][yy], CE_OTHER_IS_TOUCHING);
}
}
+
+ check_changing = FALSE;
}
void TestIfGoodThingHitsBadThing(int good_x, int good_y, int good_move_dir)
}
void TestIfGoodThingHitsBadThing(int good_x, int good_y, int good_move_dir)
@@
-7287,6
+7344,7
@@
int DigField(struct PlayerInfo *player,
PlaySoundLevelElementAction(x, y, element, ACTION_PUSHING);
InitMovingField(x, y, move_direction);
PlaySoundLevelElementAction(x, y, element, ACTION_PUSHING);
InitMovingField(x, y, move_direction);
+ GfxAction[x][y] = ACTION_PUSHING;
if (mode == DF_SNAP)
ContinueMoving(x, y);
if (mode == DF_SNAP)
ContinueMoving(x, y);
@@
-7845,6
+7903,8
@@
static void HandleGameButtons(struct GadgetInfo *gi)
else if (audio.music_available)
{
setup.sound = setup.sound_music = TRUE;
else if (audio.music_available)
{
setup.sound = setup.sound_music = TRUE;
+
+ SetAudioMode(setup.sound);
PlayMusic(level_nr);
}
break;
PlayMusic(level_nr);
}
break;
@@
-7853,14
+7913,20
@@
static void HandleGameButtons(struct GadgetInfo *gi)
if (setup.sound_loops)
setup.sound_loops = FALSE;
else if (audio.loops_available)
if (setup.sound_loops)
setup.sound_loops = FALSE;
else if (audio.loops_available)
+ {
setup.sound = setup.sound_loops = TRUE;
setup.sound = setup.sound_loops = TRUE;
+ SetAudioMode(setup.sound);
+ }
break;
case SOUND_CTRL_ID_SIMPLE:
if (setup.sound_simple)
setup.sound_simple = FALSE;
else if (audio.sound_available)
break;
case SOUND_CTRL_ID_SIMPLE:
if (setup.sound_simple)
setup.sound_simple = FALSE;
else if (audio.sound_available)
+ {
setup.sound = setup.sound_simple = TRUE;
setup.sound = setup.sound_simple = TRUE;
+ SetAudioMode(setup.sound);
+ }
break;
default:
break;
default: