projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20030807-1-src
[rocksndiamonds.git]
/
src
/
game.c
diff --git
a/src/game.c
b/src/game.c
index 54d678499801233dd497952ba799c00004722253..f5b3ab7b883d783c088bd11a20379611c4fc3a75 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-1032,6
+1032,7
@@
void InitGame()
game.switchgate_pos = 0;
game.balloon_dir = MV_NO_MOVING;
game.explosions_delayed = TRUE;
game.switchgate_pos = 0;
game.balloon_dir = MV_NO_MOVING;
game.explosions_delayed = TRUE;
+ game.current_gravity = level.initial_gravity;
for (i=0; i<4; i++)
{
for (i=0; i<4; i++)
{
@@
-1893,7
+1894,7
@@
void Explode(int ex, int ey, int phase, int mode)
PlaySoundLevelAction(ex, ey, ACTION_EXPLODING);
/* remove things displayed in background while burning dynamite */
PlaySoundLevelAction(ex, ey, ACTION_EXPLODING);
/* remove things displayed in background while burning dynamite */
- if (!IS_INDESTRUCTIBLE(Back[ex][ey]))
+ if (
Back[ex][ey] != EL_EMPTY &&
!IS_INDESTRUCTIBLE(Back[ex][ey]))
Back[ex][ey] = 0;
if (IS_MOVING(ex, ey) || IS_BLOCKED(ex, ey))
Back[ex][ey] = 0;
if (IS_MOVING(ex, ey) || IS_BLOCKED(ex, ey))
@@
-1927,7
+1928,7
@@
void Explode(int ex, int ey, int phase, int mode)
#if 1
#if 1
-#if
1
+#if
0
if (IS_EXPLOSION_PROOF(element))
continue;
#else
if (IS_EXPLOSION_PROOF(element))
continue;
#else
@@
-1958,11
+1959,11
@@
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
0
if (IS_INDESTRUCTIBLE(element))
Back[x][y] = element;
#else
if (IS_INDESTRUCTIBLE(element))
Back[x][y] = element;
#else
- if (IS_
INDESTRUCTIBLE(element) && IS_WALKA
BLE(element))
+ if (IS_
WALKABLE(element) && IS_INDESTRUCTI
BLE(element))
Back[x][y] = element;
#endif
Back[x][y] = element;
#endif
@@
-2136,6
+2137,9
@@
void Explode(int ex, int ey, int phase, int mode)
InitMovDir(x, y);
DrawLevelField(x, y);
InitMovDir(x, y);
DrawLevelField(x, y);
+ if (CAN_BE_CRUMBLED(element))
+ DrawLevelFieldCrumbledSandNeighbours(x, y);
+
if (IS_PLAYER(x, y) && !PLAYERINFO(x,y)->present)
StorePlayer[x][y] = 0;
}
if (IS_PLAYER(x, y) && !PLAYERINFO(x,y)->present)
StorePlayer[x][y] = 0;
}
@@
-2212,6
+2216,7
@@
void DynaExplode(int ex, int ey)
Explode(x, y, EX_PHASE_START, EX_BORDER);
Explode(x, y, EX_PHASE_START, EX_BORDER);
+ /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */
if (element != EL_EMPTY &&
element != EL_SAND &&
element != EL_EXPLOSION &&
if (element != EL_EMPTY &&
element != EL_SAND &&
element != EL_EXPLOSION &&
@@
-2522,14
+2527,16
@@
static int getInvisibleActiveFromInvisibleElement(int element)
{
return (element == EL_INVISIBLE_STEELWALL ? EL_INVISIBLE_STEELWALL_ACTIVE :
element == EL_INVISIBLE_WALL ? EL_INVISIBLE_WALL_ACTIVE :
{
return (element == EL_INVISIBLE_STEELWALL ? EL_INVISIBLE_STEELWALL_ACTIVE :
element == EL_INVISIBLE_WALL ? EL_INVISIBLE_WALL_ACTIVE :
- EL_INVISIBLE_SAND_ACTIVE);
+ element == EL_INVISIBLE_SAND ? EL_INVISIBLE_SAND_ACTIVE :
+ element);
}
static int getInvisibleFromInvisibleActiveElement(int element)
{
return (element == EL_INVISIBLE_STEELWALL_ACTIVE ? EL_INVISIBLE_STEELWALL :
element == EL_INVISIBLE_WALL_ACTIVE ? EL_INVISIBLE_WALL :
}
static int getInvisibleFromInvisibleActiveElement(int element)
{
return (element == EL_INVISIBLE_STEELWALL_ACTIVE ? EL_INVISIBLE_STEELWALL :
element == EL_INVISIBLE_WALL_ACTIVE ? EL_INVISIBLE_WALL :
- EL_INVISIBLE_SAND);
+ element == EL_INVISIBLE_SAND_ACTIVE ? EL_INVISIBLE_SAND :
+ element);
}
static void RedrawAllLightSwitchesAndInvisibleElements()
}
static void RedrawAllLightSwitchesAndInvisibleElements()
@@
-3840,9
+3847,10
@@
void StartMoving(int x, int y)
return;
}
return;
}
-#if 0
- GfxAction[x][y] = ACTION_MOVING;
-#endif
+ /* special case of "moving" animation of waiting elements (FIX THIS !!!);
+ for all other elements GfxAction will be set by InitMovingField() */
+ if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY)
+ GfxAction[x][y] = ACTION_MOVING;
}
/* now make next step */
}
/* now make next step */
@@
-4055,7
+4063,8
@@
void StartMoving(int x, int y)
TurnRound(x, y);
#if 1
TurnRound(x, y);
#if 1
- DrawLevelElementAnimation(x, y, element);
+ if (GFX_ELEMENT(element) != EL_SAND) /* !!! FIX THIS (crumble) !!! */
+ DrawLevelElementAnimation(x, y, element);
#else
if (element == EL_BUG ||
element == EL_SPACESHIP ||
#else
if (element == EL_BUG ||
element == EL_SPACESHIP ||
@@
-4549,6
+4558,7
@@
void AmoebeAbleger(int ax, int ay)
if (!IN_LEV_FIELD(x, y))
return;
if (!IN_LEV_FIELD(x, y))
return;
+ /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */
if (IS_FREE(x, y) ||
Feld[x][y] == EL_SAND || Feld[x][y] == EL_QUICKSAND_EMPTY)
{
if (IS_FREE(x, y) ||
Feld[x][y] == EL_SAND || Feld[x][y] == EL_QUICKSAND_EMPTY)
{
@@
-4573,6
+4583,7
@@
void AmoebeAbleger(int ax, int ay)
if (!IN_LEV_FIELD(x, y))
continue;
if (!IN_LEV_FIELD(x, y))
continue;
+ /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */
if (IS_FREE(x, y) ||
Feld[x][y] == EL_SAND || Feld[x][y] == EL_QUICKSAND_EMPTY)
{
if (IS_FREE(x, y) ||
Feld[x][y] == EL_SAND || Feld[x][y] == EL_QUICKSAND_EMPTY)
{
@@
-4717,6
+4728,7
@@
void Life(int ax, int ay)
changed = TRUE;
}
}
changed = TRUE;
}
}
+ /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */
else if (IS_FREE(xx, yy) || Feld[xx][yy] == EL_SAND)
{ /* free border field */
if (nachbarn >= life[2] && nachbarn <= life[3])
else if (IS_FREE(xx, yy) || Feld[xx][yy] == EL_SAND)
{ /* free border field */
if (nachbarn >= life[2] && nachbarn <= life[3])
@@
-5806,6
+5818,7
@@
void GameActions()
#endif
element = Feld[x][y];
#endif
element = Feld[x][y];
+ /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */
if (!IS_PLAYER(x,y) &&
(element == EL_EMPTY ||
element == EL_SAND ||
if (!IS_PLAYER(x,y) &&
(element == EL_EMPTY ||
element == EL_SAND ||
@@
-6075,7
+6088,7
@@
void ScrollLevel(int dx, int dy)
static void CheckGravityMovement(struct PlayerInfo *player)
{
static void CheckGravityMovement(struct PlayerInfo *player)
{
- if (
level.
gravity && !player->programmed_action)
+ if (
game.current_
gravity && !player->programmed_action)
{
int move_dir_vertical = player->action & (MV_UP | MV_DOWN);
int move_dir_horizontal = player->action & (MV_LEFT | MV_RIGHT);
{
int move_dir_vertical = player->action & (MV_UP | MV_DOWN);
int move_dir_horizontal = player->action & (MV_LEFT | MV_RIGHT);
@@
-6093,6
+6106,7
@@
static void CheckGravityMovement(struct PlayerInfo *player)
(IN_LEV_FIELD(new_jx, new_jy) &&
(Feld[new_jx][new_jy] == EL_SP_BASE ||
Feld[new_jx][new_jy] == EL_SAND));
(IN_LEV_FIELD(new_jx, new_jy) &&
(Feld[new_jx][new_jy] == EL_SP_BASE ||
Feld[new_jx][new_jy] == EL_SAND));
+ /* !!! extend EL_SAND to anything diggable !!! */
if (field_under_player_is_free &&
!player_is_moving_to_valid_field &&
if (field_under_player_is_free &&
!player_is_moving_to_valid_field &&
@@
-7068,6
+7082,12
@@
int DigField(struct PlayerInfo *player,
!IS_FREE(nextx, nexty))
return MF_NO_ACTION;
!IS_FREE(nextx, nexty))
return MF_NO_ACTION;
+ if (element == EL_SP_GRAVITY_PORT_LEFT ||
+ element == EL_SP_GRAVITY_PORT_RIGHT ||
+ element == EL_SP_GRAVITY_PORT_UP ||
+ element == EL_SP_GRAVITY_PORT_DOWN)
+ game.current_gravity = !game.current_gravity;
+
/* automatically move to the next field with double speed */
player->programmed_action = move_direction;
DOUBLE_PLAYER_SPEED(player);
/* automatically move to the next field with double speed */
player->programmed_action = move_direction;
DOUBLE_PLAYER_SPEED(player);
@@
-7198,8
+7218,12
@@
int DigField(struct PlayerInfo *player,
if (mode != DF_SNAP)
{
if (mode != DF_SNAP)
{
+#if 1
+ GfxElement[x][y] = GFX_ELEMENT(element);
+#else
GfxElement[x][y] =
(CAN_BE_CRUMBLED(element) ? EL_SAND : GFX_ELEMENT(element));
GfxElement[x][y] =
(CAN_BE_CRUMBLED(element) ? EL_SAND : GFX_ELEMENT(element));
+#endif
player->is_digging = TRUE;
}
player->is_digging = TRUE;
}