projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20040303-B-src
[rocksndiamonds.git]
/
src
/
game.c
diff --git
a/src/game.c
b/src/game.c
index bffde89cb0b6f69f790264f74a299cfeab42de01..d3ac230748cb7b01f3bb4d65969f7789fbd378fd 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-7382,6
+7382,12
@@
void GameActions()
recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
+#if 1
+ if (recorded_player_action != NULL)
+ for (i = 0; i < MAX_PLAYERS; i++)
+ stored_player[i].action = recorded_player_action[i];
+#endif
+
for (i = 0; i < MAX_PLAYERS; i++)
{
summarized_player_action |= stored_player[i].action;
for (i = 0; i < MAX_PLAYERS; i++)
{
summarized_player_action |= stored_player[i].action;
@@
-7413,11
+7419,13
@@
void GameActions()
#if 0
if (stored_player[i].programmed_action &&
stored_player[i].programmed_action != recorded_player_action[i])
#if 0
if (stored_player[i].programmed_action &&
stored_player[i].programmed_action != recorded_player_action[i])
- printf("::: %d
<-> %d\n"
,
+ printf("::: %d
: %d <-> %d\n", i
,
stored_player[i].programmed_action, recorded_player_action[i]);
#endif
stored_player[i].programmed_action, recorded_player_action[i]);
#endif
+#if 0
actual_player_action = recorded_player_action[i];
actual_player_action = recorded_player_action[i];
+#endif
}
#if 0
}
#if 0
@@
-8065,20
+8073,25
@@
static void CheckGravityMovement(struct PlayerInfo *player)
{
if (game.gravity && !player->programmed_action)
{
{
if (game.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_
horizontal = player->action & MV_HORIZONTAL
;
+ int move_dir_
vertical = player->action & MV_VERTICAL
;
int move_dir =
int move_dir =
- (player->last_move_dir &
(MV_LEFT | MV_RIGHT)
?
+ (player->last_move_dir &
MV_HORIZONTAL
?
(move_dir_vertical ? move_dir_vertical : move_dir_horizontal) :
(move_dir_horizontal ? move_dir_horizontal : move_dir_vertical));
int jx = player->jx, jy = player->jy;
int dx = (move_dir & MV_LEFT ? -1 : move_dir & MV_RIGHT ? +1 : 0);
int dy = (move_dir & MV_UP ? -1 : move_dir & MV_DOWN ? +1 : 0);
int new_jx = jx + dx, new_jy = jy + dy;
(move_dir_vertical ? move_dir_vertical : move_dir_horizontal) :
(move_dir_horizontal ? move_dir_horizontal : move_dir_vertical));
int jx = player->jx, jy = player->jy;
int dx = (move_dir & MV_LEFT ? -1 : move_dir & MV_RIGHT ? +1 : 0);
int dy = (move_dir & MV_UP ? -1 : move_dir & MV_DOWN ? +1 : 0);
int new_jx = jx + dx, new_jy = jy + dy;
+ boolean player_is_snapping = player->action & JOY_BUTTON_1;
boolean field_under_player_is_free =
(IN_LEV_FIELD(jx, jy + 1) && IS_FREE(jx, jy + 1));
boolean player_is_moving_to_valid_field =
boolean field_under_player_is_free =
(IN_LEV_FIELD(jx, jy + 1) && IS_FREE(jx, jy + 1));
boolean player_is_moving_to_valid_field =
- (IN_LEV_FIELD(new_jx, new_jy) &&
+ (
+#if 1
+ !player_is_snapping &&
+#endif
+ IN_LEV_FIELD(new_jx, new_jy) &&
(Feld[new_jx][new_jy] == EL_SP_BASE ||
Feld[new_jx][new_jy] == EL_SAND ||
(IS_SP_PORT(Feld[new_jx][new_jy]) &&
(Feld[new_jx][new_jy] == EL_SP_BASE ||
Feld[new_jx][new_jy] == EL_SAND ||
(IS_SP_PORT(Feld[new_jx][new_jy]) &&
@@
-8090,10
+8103,24
@@
static void CheckGravityMovement(struct PlayerInfo *player)
(IS_WALKABLE(Feld[jx][jy]) &&
!(element_info[Feld[jx][jy]].access_direction & MV_DOWN)));
(IS_WALKABLE(Feld[jx][jy]) &&
!(element_info[Feld[jx][jy]].access_direction & MV_DOWN)));
+#if 0
+ printf("::: checking gravity NOW [%d, %d, %d] [%d] ...\n",
+ field_under_player_is_free,
+ player_is_standing_on_valid_field,
+ player_is_moving_to_valid_field,
+ (player_is_moving_to_valid_field ? Feld[new_jx][new_jy] : -1));
+#endif
+
if (field_under_player_is_free &&
!player_is_standing_on_valid_field &&
!player_is_moving_to_valid_field)
if (field_under_player_is_free &&
!player_is_standing_on_valid_field &&
!player_is_moving_to_valid_field)
+ {
+#if 0
+ printf("::: setting programmed_action to MV_DOWN ...\n");
+#endif
+
player->programmed_action = MV_DOWN;
player->programmed_action = MV_DOWN;
+ }
}
}
}
}
@@
-8307,7
+8334,7
@@
boolean MovePlayer(struct PlayerInfo *player, int dx, int dy)
player->move_delay_value = original_move_delay_value;
}
player->move_delay_value = original_move_delay_value;
}
- if (player->last_move_dir &
(MV_LEFT | MV_RIGHT)
)
+ if (player->last_move_dir &
MV_HORIZONTAL
)
{
if (!(moved |= MovePlayerOneStep(player, 0, dy, dx, dy)))
moved |= MovePlayerOneStep(player, dx, 0, dx, dy);
{
if (!(moved |= MovePlayerOneStep(player, 0, dy, dx, dy)))
moved |= MovePlayerOneStep(player, dx, 0, dx, dy);