X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=d780d3529f9bf753468323a044770cd1c0e8244a;hb=82b1f76754f039e4ee151c7da7c49819c7310546;hp=23fcc2d4f6819093b0a003964f7ec4fe4a517e7e;hpb=8cef2a63b6c56ba086183693d3f73f02862cbd8f;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 23fcc2d4..d780d352 100644 --- a/src/game.c +++ b/src/game.c @@ -25,36 +25,21 @@ void GetPlayerConfig() { - int old_joystick_nr = setup.joy_input[0].joystick_nr; + int old_joystick_nr = setup.input[0].joystick_nr; + + if (sound_status == SOUND_OFF) + setup.sound_on = FALSE; - if (sound_status==SOUND_OFF) - local_player->setup &= ~SETUP_SOUND; if (!sound_loops_allowed) { - local_player->setup &= ~SETUP_SOUND_LOOPS; - local_player->setup &= ~SETUP_SOUND_MUSIC; + setup.sound_loops_on = FALSE; + setup.sound_music_on = FALSE; } - setup.sound_on = setup.sound_simple_on = SETUP_SOUND_ON(local_player->setup); - setup.sound_loops_on = SETUP_SOUND_LOOPS_ON(local_player->setup); - setup.sound_music_on = SETUP_SOUND_MUSIC_ON(local_player->setup); - setup.toons_on = SETUP_TOONS_ON(local_player->setup); - setup.direct_draw_on = SETUP_DIRECT_DRAW_ON(local_player->setup); - setup.fading_on = SETUP_FADING_ON(local_player->setup); - setup.autorecord_on = SETUP_AUTO_RECORD_ON(local_player->setup); - -#if 0 - setup.joystick_nr = SETUP_2ND_JOYSTICK_ON(local_player->setup); -#endif - - setup.joy_input[0].joystick_nr = SETUP_2ND_JOYSTICK_ON(local_player->setup); - - setup.quick_doors = SETUP_QUICK_DOORS_ON(local_player->setup); - setup.scroll_delay_on = SETUP_SCROLL_DELAY_ON(local_player->setup); - setup.soft_scrolling_on = SETUP_SOFT_SCROLL_ON(local_player->setup); + setup.sound_simple_on = setup.sound_on; #ifndef MSDOS - if (setup.joy_input[0].joystick_nr != old_joystick_nr) + if (setup.input[0].joystick_nr != old_joystick_nr) { if (joystick_device) close(joystick_device); @@ -82,9 +67,7 @@ void InitGame() player->present = FALSE; player->active = FALSE; - /* - player->local = FALSE; - */ + player->action = 0; player->score = 0; player->gems_still_needed = level.edelsteine; @@ -127,24 +110,10 @@ void InitGame() DigField(player, 0,0,0,0,DF_NO_PUSH); SnapField(player, 0,0); - - /* TEST TEST TEST */ - - /* - stored_player[i].active = TRUE; - */ - - /* TEST TEST TEST */ - player->LevelSolved = FALSE; player->GameOver = FALSE; } - /* - local_player->active = TRUE; - local_player->local = TRUE; - */ - network_player_action_received = FALSE; /* initial null action */ @@ -194,12 +163,8 @@ void InitGame() struct PlayerInfo *player = &stored_player[Feld[x][y] - EL_SPIELER1]; int jx = player->jx, jy = player->jy; - /* - player->active = TRUE; - */ - player->present = TRUE; - if (player->connected) + if (!network_playing || player->connected) { player->active = TRUE; @@ -215,14 +180,6 @@ void InitGame() local_player->active ? "active" : "not active"); } -#if 0 - /* remove potentially duplicate players */ - if (StorePlayer[jx][jy] == Feld[x][y]) - StorePlayer[jx][jy] = 0; - - StorePlayer[x][y] = Feld[x][y]; -#endif - Feld[x][y] = EL_LEERRAUM; player->jx = player->last_jx = x; player->jy = player->last_jy = y; @@ -336,6 +293,7 @@ void InitGame() } } + for(i=0; ihandicap && - level_nr < leveldir[leveldir_nr].levels-1) - { - local_player->handicap++; - bumplevel = TRUE; - SavePlayerInfo(PLAYER_LEVEL); - } - if ((hi_pos=NewHiScore()) >= 0) { game_status = HALLOFFAME; @@ -2881,7 +2831,7 @@ void PlayerActions(struct PlayerInfo *player, byte player_action) stored_player_action[player->index_nr] = 0; num_stored_actions++; - if (!player->active || player->gone) + if (!player->active || player->gone || tape.pausing) return; if (player_action) @@ -2948,7 +2898,7 @@ void PlayerActions(struct PlayerInfo *player, byte player_action) } } -void GameActions(byte player_action) +void GameActions() { static long action_delay = 0; long action_delay_value; @@ -2999,34 +2949,17 @@ void GameActions(byte player_action) recorded_player_action = (tape.playing ? TapePlayAction() : NULL); if (network_playing) - SendToServer_MovePlayer(player_action); + SendToServer_MovePlayer(local_player->action); for(i=0; i jx-MIDPOSX+offset) && jx >= MIDPOSX-1-offset && jx <= lev_fieldx-(MIDPOSX-offset)) - scroll_x = jx-MIDPOSX + (scroll_x < jx-MIDPOSX ? -offset : offset); + scroll_x = jx-MIDPOSX + (scroll_x < jx-MIDPOSX ? -offset : +offset); + */ + + if ((player->MovDir == MV_LEFT && scroll_x > jx-MIDPOSX+offset) || + (player->MovDir == MV_RIGHT && scroll_x < jx-MIDPOSX-offset)) + scroll_x = jx-MIDPOSX + (scroll_x < jx-MIDPOSX ? -offset : +offset); + + /* don't scroll over playfield boundaries */ + if (scroll_x < -1 || scroll_x > lev_fieldx - SCR_FIELDX + 2) + scroll_x = (scroll_x < -1 ? -1 : lev_fieldx - SCR_FIELDX + 2); /* don't scroll more than one field at a time */ scroll_x = old_scroll_x + SIGN(scroll_x - old_scroll_x); @@ -3390,9 +3327,19 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) } else /* player has moved vertically */ { + /* if ((scroll_y < jy-MIDPOSY-offset || scroll_y > jy-MIDPOSY+offset) && jy >= MIDPOSY-1-offset && jy <= lev_fieldy-(MIDPOSY-offset)) - scroll_y = jy-MIDPOSY + (scroll_y < jy-MIDPOSY ? -offset : offset); + scroll_y = jy-MIDPOSY + (scroll_y < jy-MIDPOSY ? -offset : +offset); + */ + + if ((player->MovDir == MV_UP && scroll_y > jy-MIDPOSY+offset) || + (player->MovDir == MV_DOWN && scroll_y < jy-MIDPOSY-offset)) + scroll_y = jy-MIDPOSY + (scroll_y < jy-MIDPOSY ? -offset : +offset); + + /* don't scroll over playfield boundaries */ + if (scroll_y < -1 || scroll_y > lev_fieldy - SCR_FIELDY + 2) + scroll_y = (scroll_y < -1 ? -1 : lev_fieldy - SCR_FIELDY + 2); /* don't scroll more than one field at a time */ scroll_y = old_scroll_y + SIGN(scroll_y - old_scroll_y);