X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=6d4c3da63f690c1609a5312b8785d0f0ff949774;hb=2357c391b4a587709627cc30316734b3c83c8134;hp=d198a32ef27ab69a87c683aca3674456b18962b9;hpb=d7d97176a88ee47f893055480c76b9c05a253d05;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index d198a32e..6d4c3da6 100644 --- a/src/game.c +++ b/src/game.c @@ -25,42 +25,18 @@ void GetPlayerConfig() { - int old_joystick_nr = setup.input[0].joystick_nr; + if (sound_status == SOUND_OFF) + setup.sound = 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 = FALSE; + setup.sound_music = 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); + setup.sound_simple = setup.sound; -#if 0 - setup.joystick_nr = SETUP_2ND_JOYSTICK_ON(local_player->setup); -#endif - - setup.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); - -#ifndef MSDOS - if (setup.input[0].joystick_nr != old_joystick_nr) - { - if (joystick_device) - close(joystick_device); - InitJoystick(); - } -#endif + InitJoysticks(); } void InitGame() @@ -83,10 +59,7 @@ void InitGame() player->active = FALSE; player->action = 0; - - /* - player->local = FALSE; - */ + player->potential_action = 0; player->score = 0; player->gems_still_needed = level.edelsteine; @@ -129,24 +102,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 */ @@ -196,10 +155,6 @@ 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 (!network_playing || player->connected) { @@ -217,14 +172,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; @@ -338,6 +285,7 @@ void InitGame() } } + for(i=0; i 0) { - if (!setup.sound_loops_on) + if (!setup.sound_loops) PlaySoundStereo(SND_SIRR, PSND_MAX_RIGHT); if (TimeLeft && !(TimeLeft % 10)) RaiseScore(level.score[SC_ZEITBONUS]); @@ -551,7 +499,7 @@ void GameWon() Delay(10); } - if (setup.sound_loops_on) + if (setup.sound_loops) StopSound(SND_SIRR); } @@ -572,14 +520,6 @@ void GameWon() SaveLevelTape(tape.level_nr); /* Ask to save tape */ } - if (level_nr == local_player->handicap && - level_nr < leveldir[leveldir_nr].levels-1) - { - local_player->handicap++; - bumplevel = TRUE; - SavePlayerInfo(PLAYER_LEVEL); - } - if ((hi_pos=NewHiScore()) >= 0) { game_status = HALLOFFAME; @@ -605,7 +545,7 @@ boolean NewHiScore() LoadScore(level_nr); - if (!strcmp(local_player->alias_name,EMPTY_ALIAS) || + if (!strcmp(setup.alias_name,EMPTY_ALIAS) || local_player->score < highscore[MAX_SCORE_ENTRIES-1].Score) return(-1); @@ -621,7 +561,7 @@ boolean NewHiScore() #ifdef ONE_PER_NAME for(l=k;lalias_name,highscore[l].Name)) + if (!strcmp(setup.alias_name,highscore[l].Name)) m = l; if (m==k) /* Spieler überschreibt seine alte Position */ goto put_into_list; @@ -637,14 +577,14 @@ boolean NewHiScore() #ifdef ONE_PER_NAME put_into_list: #endif - sprintf(highscore[k].Name,local_player->alias_name); + sprintf(highscore[k].Name,setup.alias_name); highscore[k].Score = local_player->score; position = k; break; } #ifdef ONE_PER_NAME - else if (!strcmp(local_player->alias_name,highscore[k].Name)) + else if (!strcmp(setup.alias_name,highscore[k].Name)) break; /* Spieler schon mit besserer Punktzahl in der Liste */ #endif @@ -2648,7 +2588,7 @@ void EdelsteinFunkeln(int x, int y) { MovDelay[x][y]--; - if (setup.direct_draw_on && MovDelay[x][y]) + if (setup.direct_draw && MovDelay[x][y]) SetDrawtoField(DRAW_BUFFERED); DrawGraphic(SCREENX(x),SCREENY(y), el2gfx(Feld[x][y])); @@ -2662,7 +2602,7 @@ void EdelsteinFunkeln(int x, int y) DrawGraphicThruMask(SCREENX(x),SCREENY(y), GFX_FUNKELN_WEISS + phase); - if (setup.direct_draw_on) + if (setup.direct_draw) { int dest_x,dest_y; @@ -3001,37 +2941,17 @@ void GameActions() recorded_player_action = (tape.playing ? TapePlayAction() : NULL); if (network_playing) - SendToServer_MovePlayer(local_player->action); + SendToServer_MovePlayer(local_player->potential_action); for(i=0; iGfxPos; - */ - XCopyArea(display,drawto_field,drawto_field,gc, FX + TILEX*(dx==-1) - softscroll_offset, FY + TILEY*(dy==-1) - softscroll_offset, @@ -3350,24 +3260,11 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) jx = player->jx; jy = player->jy; - - - /* - if (moved & MF_MOVING && player == local_player) - */ - if (moved & MF_MOVING && !ScreenMovPos && (player == local_player || !options.network)) { int old_scroll_x = scroll_x, old_scroll_y = scroll_y; - int offset = (setup.scroll_delay_on ? 3 : 0); - - /* - if (player == local_player) - { - printf("MOVING LOCAL PLAYER && SCROLLING\n"); - } - */ + int offset = (setup.scroll_delay ? 3 : 0); if (!IN_VIS_FIELD(SCREENX(jx),SCREENY(jy))) { @@ -3381,12 +3278,6 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) { if (jx != old_jx) /* player has moved horizontally */ { - /* - if ((scroll_x < jx-MIDPOSX-offset || scroll_x > jx-MIDPOSX+offset) && - jx >= MIDPOSX-1-offset && jx <= lev_fieldx-(MIDPOSX-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); @@ -3405,12 +3296,6 @@ 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); - */ - 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); @@ -3429,22 +3314,6 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy) } } -#if 0 - if (player == local_player) - { - if ((scroll_x < jx-MIDPOSX-offset || scroll_x > jx-MIDPOSX+offset) && - jx >= MIDPOSX-1-offset && jx <= lev_fieldx-(MIDPOSX-offset)) - scroll_x = jx-MIDPOSX + (scroll_x < jx-MIDPOSX ? -offset : offset); - 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); - - /* don't scroll more than one field at a time */ - scroll_x = old_scroll_x + SIGN(scroll_x - old_scroll_x); - scroll_y = old_scroll_y + SIGN(scroll_y - old_scroll_y); - } -#endif - if (scroll_x != old_scroll_x || scroll_y != old_scroll_y) { if (!options.network && !AllPlayersInVisibleScreen()) @@ -3668,10 +3537,6 @@ void TestIfHeroHitsBadThing(int x, int y) void TestIfBadThingHitsHero(int x, int y) { - /* - TestIfGoodThingHitsBadThing(JX,JY); - */ - TestIfBadThingHitsGoodThing(x,y); } @@ -4139,8 +4004,8 @@ void PlaySoundLevel(int x, int y, int sound_nr) int volume, stereo; int silence_distance = 8; - if ((!setup.sound_simple_on && !IS_LOOP_SOUND(sound_nr)) || - (!setup.sound_loops_on && IS_LOOP_SOUND(sound_nr))) + if ((!setup.sound_simple && !IS_LOOP_SOUND(sound_nr)) || + (!setup.sound_loops && IS_LOOP_SOUND(sound_nr))) return; if (!IN_LEV_FIELD(x,y) || @@ -4149,6 +4014,7 @@ void PlaySoundLevel(int x, int y, int sound_nr) return; volume = PSND_MAX_VOLUME; + #ifndef MSDOS stereo = (sx-SCR_FIELDX/2)*12; #else