X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=e339e9d3f2b6e8bb6dc4035436720d459e30c331;hb=29014045f4de045f8452fdf7ab32622c94b37eef;hp=b785616403af98b17add1109e1b1cf49ac448726;hpb=7b31a77eec53ed2b96d5924a743b0706c9e4b11c;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index b7856164..e339e9d3 100644 --- a/src/game.c +++ b/src/game.c @@ -1,13 +1,12 @@ /*********************************************************** * Rocks'n'Diamonds -- McDuffin Strikes Back! * *----------------------------------------------------------* -* ©1995 Artsoft Development * -* Holger Schemel * -* 33659 Bielefeld-Senne * -* Telefon: (0521) 493245 * -* eMail: aeglos@valinor.owl.de * -* aeglos@uni-paderborn.de * -* q99492@pbhrzx.uni-paderborn.de * +* (c) 1995-98 Artsoft Entertainment * +* Holger Schemel * +* Oststrasse 11a * +* 33604 Bielefeld * +* phone: ++49 +521 290471 * +* email: aeglos@valinor.owl.de * *----------------------------------------------------------* * game.c * ***********************************************************/ @@ -114,7 +113,11 @@ void InitGame() /* TEST TEST TEST */ + + /* stored_player[i].active = TRUE; + */ + /* TEST TEST TEST */ player->LevelSolved = FALSE; @@ -171,6 +174,8 @@ void InitGame() if (StorePlayer[jx][jy] == Feld[x][y]) StorePlayer[jx][jy] = 0; + player->active = TRUE; + StorePlayer[x][y] = Feld[x][y]; Feld[x][y] = EL_LEERRAUM; player->jx = player->last_jx = x; @@ -984,6 +989,9 @@ void Impact(int x, int y) /* Element darunter berührt? */ if (!lastline) { + if (Feld[x][y+1] == EL_PLAYER_IS_LEAVING) + return; + object_hit = (!IS_FREE(x,y+1) && (!IS_MOVING(x,y+1) || MovDir[x][y+1]!=MV_DOWN || MovPos[x][y+1]<=TILEY/2)); @@ -2704,6 +2712,8 @@ void CheckForDragon(int x, int y) void PlayerActions(struct PlayerInfo *player, int player_action) { + static int stored_player_action[MAX_PLAYERS]; + static int num_stored_actions = 0; BOOL moved = FALSE, snapped = FALSE, bombed = FALSE; int jx = player->jx, jy = player->jy; int left = player_action & JOY_LEFT; @@ -2715,6 +2725,9 @@ void PlayerActions(struct PlayerInfo *player, int player_action) int dx = (left ? -1 : right ? 1 : 0); int dy = (up ? -1 : down ? 1 : 0); + stored_player_action[player->nr] = 0; + num_stored_actions++; + if (!player->active || player->gone) return; @@ -2735,7 +2748,15 @@ void PlayerActions(struct PlayerInfo *player, int player_action) { if (bombed && !moved) player_action &= JOY_BUTTON; - TapeRecordAction(player_action); + + stored_player_action[player->nr] = player_action; + + /* this allows cycled sequences of PlayerActions() */ + if (num_stored_actions >= MAX_PLAYERS) + { + TapeRecordAction(stored_player_action); + num_stored_actions = 0; + } } else if (tape.playing && snapped) SnapField(player, 0,0); /* stop snapping */ @@ -2751,7 +2772,8 @@ void PlayerActions(struct PlayerInfo *player, int player_action) if (tape.playing && !tape.pausing && !player_action && tape.counter < tape.length) { - int next_joy = tape.pos[tape.counter].joystickdata & (JOY_LEFT|JOY_RIGHT); + int next_joy = + tape.pos[tape.counter].joystickdata[player->nr] & (JOY_LEFT|JOY_RIGHT); if (next_joy == JOY_LEFT || next_joy == JOY_RIGHT) { @@ -2779,6 +2801,7 @@ void GameActions(int player_action) long action_delay_value; int sieb_x = 0, sieb_y = 0; int i, x,y, element; + int *recorded_player_action; if (game_status != PLAYING) return; @@ -2794,16 +2817,25 @@ void GameActions(int player_action) /* main game synchronization point */ WaitUntilDelayReached(&action_delay, action_delay_value); + if (tape.playing) + recorded_player_action = TapePlayAction(); + else + recorded_player_action = NULL; + for(i=0; i