From: Holger Schemel Date: Thu, 11 Feb 1999 00:51:14 +0000 (+0100) Subject: rnd-19990211-2 X-Git-Tag: 1.4.0^2~49 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=3cf6686708e1beac2444181feab16cd88f20fad7;p=rocksndiamonds.git rnd-19990211-2 --- diff --git a/src/game.c b/src/game.c index fada15db..4b533ca4 100644 --- a/src/game.c +++ b/src/game.c @@ -339,6 +339,7 @@ void InitGame() player->action = 0; player->effective_action = 0; + player->programmed_action = 0; player->score = 0; player->gems_still_needed = level.edelsteine; @@ -3514,6 +3515,18 @@ void GameActions() { int actual_player_action = stored_player[i].effective_action; + if (stored_player[i].programmed_action) + { + /* this is very bad and need to be fixed!!! */ + unsigned long move_delay = stored_player[i].move_delay; + + if (FrameReached(&move_delay, MoveSpeed)) + { + actual_player_action = stored_player[i].programmed_action; + stored_player[i].programmed_action = 0; + } + } + if (recorded_player_action) actual_player_action = recorded_player_action[i]; @@ -4039,6 +4052,33 @@ void ScrollFigure(struct PlayerInfo *player, int mode) if (!player->MovPos) { + switch (Feld[last_jx][last_jy]) + { + case EL_SP_PORT1_LEFT: + case EL_SP_PORT2_LEFT: + case EL_SP_PORT1_RIGHT: + case EL_SP_PORT2_RIGHT: + case EL_SP_PORT1_UP: + case EL_SP_PORT2_UP: + case EL_SP_PORT1_DOWN: + case EL_SP_PORT2_DOWN: + case EL_SP_PORT_X: + case EL_SP_PORT_Y: + case EL_SP_PORT_XY: + /* continue with normal speed after moving through port */ + /* FIX THIS: what about player already having eaten a speed pill? */ + MoveSpeed = 8; + ScrollStepSize = TILEX / MoveSpeed; + + /* don't wait for the next move -- the whole move delay stuff + is worse at the moment; FIX THIS! ;-) */ + player->move_delay = 0; + break; + + default: + break; + } + player->last_jx = jx; player->last_jy = jy; @@ -4344,7 +4384,7 @@ int DigField(struct PlayerInfo *player, case EL_SPEED_PILL: RemoveField(x, y); MoveSpeed = 4; - ScrollStepSize = TILEX/4; + ScrollStepSize = TILEX / MoveSpeed; PlaySoundLevel(x, y, SND_PONG); break; @@ -4531,6 +4571,15 @@ int DigField(struct PlayerInfo *player, !IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy)) return MF_NO_ACTION; + + /* automatically move to field behind the port */ + player->programmed_action = (dx == -1 ? MV_LEFT : + dx == +1 ? MV_RIGHT : + dy == -1 ? MV_UP : + dy == +1 ? MV_DOWN : MV_NO_MOVING); + /* move through port with double speed */ + MoveSpeed = 4; + ScrollStepSize = TILEX / MoveSpeed; break; case EL_AUSGANG_ZU: diff --git a/src/main.h b/src/main.h index d9ff3664..b4c3834c 100644 --- a/src/main.h +++ b/src/main.h @@ -298,6 +298,14 @@ struct PlayerInfo byte effective_action; /* action aknowledged from network server or summarized over all configured input devices when in single player mode */ + byte programmed_action; /* action forced by game itself (like moving + through doors); overrides other actions */ + + +#if 0 + byte programmed_speed; /* speed (for only one move) forced by game */ +#endif + int joystick_fd; /* file descriptor of player's joystick */