From: Holger Schemel Date: Sat, 13 Mar 2010 14:54:03 +0000 (+0100) Subject: rnd-20100313-1-src X-Git-Tag: 3.3.0.0^2~24 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=949580a3bafe5c8abd1fac99202411b65900b883;p=rocksndiamonds.git rnd-20100313-1-src * integrated playing sound effects into native Supaplex game engine --- diff --git a/ChangeLog b/ChangeLog index 60f21939..777cbb85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2010-03-13 + * integrated playing sound effects into native Supaplex game engine + 2010-03-10 * added configurable key shortcuts for the tape recorder buttons diff --git a/src/conf_gfx.c b/src/conf_gfx.c index fdb49e30..4c924e42 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5415,6 +5415,8 @@ struct ConfigInfo image_config[] = { "menu.draw_yoffset.SETUP[SHORTCUTS_2]", "0" }, { "menu.draw_xoffset.SETUP[SHORTCUTS_3]", "0" }, { "menu.draw_yoffset.SETUP[SHORTCUTS_3]", "0" }, + { "menu.draw_xoffset.SETUP[SHORTCUTS_4]", "0" }, + { "menu.draw_yoffset.SETUP[SHORTCUTS_4]", "0" }, { "menu.draw_xoffset.SETUP[CHOOSE_ARTWORK]", "0" }, { "menu.draw_yoffset.SETUP[CHOOSE_ARTWORK]", "0" }, { "menu.draw_xoffset.SETUP[CHOOSE_OTHER]", "0" }, diff --git a/src/conf_var.c b/src/conf_var.c index 90ed0b13..13fa8959 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -1320,6 +1320,14 @@ struct TokenIntPtrInfo image_config_vars[] = "menu.draw_yoffset.SETUP[SHORTCUTS_3]", &menu.draw_yoffset_setup[GFX_SPECIAL_ARG_SETUP_SHORTCUTS_3] }, + { + "menu.draw_xoffset.SETUP[SHORTCUTS_4]", + &menu.draw_xoffset_setup[GFX_SPECIAL_ARG_SETUP_SHORTCUTS_4] + }, + { + "menu.draw_yoffset.SETUP[SHORTCUTS_4]", + &menu.draw_yoffset_setup[GFX_SPECIAL_ARG_SETUP_SHORTCUTS_4] + }, { "menu.draw_xoffset.SETUP[CHOOSE_ARTWORK]", &menu.draw_xoffset_setup[GFX_SPECIAL_ARG_SETUP_CHOOSE_ARTWORK] diff --git a/src/conftime.h b/src/conftime.h index 6467aafc..78990a15 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-03-10 14:11" +#define COMPILE_DATE_STRING "2010-03-13 15:52" diff --git a/src/events.c b/src/events.c index b9b5b862..3284723c 100644 --- a/src/events.c +++ b/src/events.c @@ -764,6 +764,7 @@ void HandleKey(Key key, int key_status) TapeTogglePause(TAPE_TOGGLE_MANUAL); HandleTapeButtonKeys(key); + HandleSoundButtonKeys(key); } if (game_status == GAME_MODE_PLAYING && !network_playing) diff --git a/src/files.c b/src/files.c index 205c371a..2e58ad30 100644 --- a/src/files.c +++ b/src/files.c @@ -4282,25 +4282,8 @@ void CopyNativeLevel_RND_to_SP(struct LevelInfo *level) level_sp->height = level->fieldy; for (x = 0; x < level->fieldx; x++) - { for (y = 0; y < level->fieldy; y++) - { - int element_old = level->field[x][y]; - int element_new; - - if (element_old >= EL_SP_START && - element_old <= EL_SP_END) - element_new = element_old - EL_SP_START; - else if (element_old == EL_EMPTY_SPACE) - element_new = 0x00; - else if (element_old == EL_INVISIBLE_WALL) - element_new = 0x28; - else - element_new = 0x20; /* map unknown elements to yellow "hardware" */ - - level_sp->playfield[x][y] = element_new; - } - } + level_sp->playfield[x][y] = map_element_RND_to_SP(level->field[x][y]); header->InitialGravity = (level->initial_player_gravity[0] ? 1 : 0); @@ -4387,20 +4370,12 @@ void CopyNativeLevel_SP_to_RND(struct LevelInfo *level) for (y = 0; y < level->fieldy; y++) { int element_old = level_sp->playfield[x][y]; - int element_new; + int element_new = getMappedElement(map_element_SP_to_RND(element_old)); - if (element_old <= 0x27) - element_new = getMappedElement(EL_SP_START + element_old); - else if (element_old == 0x28) - element_new = EL_INVISIBLE_WALL; - else - { + if (element_new == EL_UNKNOWN) Error(ERR_WARN, "invalid element %d at position %d, %d", element_old, x, y); - element_new = EL_UNKNOWN; - } - level->field[x][y] = element_new; } } @@ -9008,8 +8983,11 @@ void SaveScore(int nr) #define SETUP_TOKEN_SHORTCUT_TAPE_PAUSE 10 #define SETUP_TOKEN_SHORTCUT_TAPE_RECORD 11 #define SETUP_TOKEN_SHORTCUT_TAPE_PLAY 12 +#define SETUP_TOKEN_SHORTCUT_SOUND_SIMPLE 13 +#define SETUP_TOKEN_SHORTCUT_SOUND_LOOPS 14 +#define SETUP_TOKEN_SHORTCUT_SOUND_MUSIC 15 -#define NUM_SHORTCUT_SETUP_TOKENS 13 +#define NUM_SHORTCUT_SETUP_TOKENS 16 /* player setup */ #define SETUP_TOKEN_PLAYER_USE_JOYSTICK 0 @@ -9159,6 +9137,9 @@ static struct TokenInfo shortcut_setup_tokens[] = { TYPE_KEY_X11, &ssi.tape_pause, "shortcut.tape_pause" }, { TYPE_KEY_X11, &ssi.tape_record, "shortcut.tape_record" }, { TYPE_KEY_X11, &ssi.tape_play, "shortcut.tape_play" }, + { TYPE_KEY_X11, &ssi.sound_simple, "shortcut.sound_simple" }, + { TYPE_KEY_X11, &ssi.sound_loops, "shortcut.sound_loops" }, + { TYPE_KEY_X11, &ssi.sound_music, "shortcut.sound_music" }, }; static struct TokenInfo player_setup_tokens[] = @@ -9281,6 +9262,10 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->shortcut.tape_record = DEFAULT_KEY_TAPE_RECORD; si->shortcut.tape_play = DEFAULT_KEY_TAPE_PLAY; + si->shortcut.sound_simple = DEFAULT_KEY_SOUND_SIMPLE; + si->shortcut.sound_loops = DEFAULT_KEY_SOUND_LOOPS; + si->shortcut.sound_music = DEFAULT_KEY_SOUND_MUSIC; + for (i = 0; i < MAX_PLAYERS; i++) { si->input[i].use_joystick = FALSE; diff --git a/src/game.c b/src/game.c index d1983175..4874b346 100644 --- a/src/game.c +++ b/src/game.c @@ -16208,6 +16208,21 @@ void PlayLevelSound_EM(int xx, int yy, int element_em, int sample) } } +void PlayLevelSound_SP(int xx, int yy, int element_sp, int action_sp) +{ + int element = map_element_SP_to_RND(element_sp); + int action = map_action_SP_to_RND(action_sp); + int offset = (setup.sp_show_border_elements ? 0 : 1); + int x = xx - offset; + int y = yy - offset; + +#if 0 + printf("::: %d -> %d\n", element_sp, action_sp); +#endif + + PlayLevelSoundElementAction(x, y, element, action); +} + #if 0 void ChangeTime(int value) { @@ -16863,10 +16878,8 @@ void RedrawGameButtons() RedrawGadget(game_gadget[i]); } -static void HandleGameButtons(struct GadgetInfo *gi) +static void HandleGameButtonsExt(int id) { - int id = gi->custom_id; - if (game_status != GAME_MODE_PLAYING) return; @@ -16912,6 +16925,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) if (setup.sound_music) { setup.sound_music = FALSE; + FadeMusic(); } else if (audio.music_available) @@ -16930,6 +16944,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) else if (audio.loops_available) { setup.sound = setup.sound_loops = TRUE; + SetAudioMode(setup.sound); } break; @@ -16940,6 +16955,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) else if (audio.sound_available) { setup.sound = setup.sound_simple = TRUE; + SetAudioMode(setup.sound); } break; @@ -16948,3 +16964,27 @@ static void HandleGameButtons(struct GadgetInfo *gi) break; } } + +static void HandleGameButtons(struct GadgetInfo *gi) +{ + HandleGameButtonsExt(gi->custom_id); +} + +void HandleSoundButtonKeys(Key key) +{ +#if 1 + if (key == setup.shortcut.sound_simple) + ClickOnGadget(game_gadget[SOUND_CTRL_ID_SIMPLE], MB_LEFTBUTTON); + else if (key == setup.shortcut.sound_loops) + ClickOnGadget(game_gadget[SOUND_CTRL_ID_LOOPS], MB_LEFTBUTTON); + else if (key == setup.shortcut.sound_music) + ClickOnGadget(game_gadget[SOUND_CTRL_ID_MUSIC], MB_LEFTBUTTON); +#else + if (key == setup.shortcut.sound_simple) + HandleGameButtonsExt(SOUND_CTRL_ID_SIMPLE); + else if (key == setup.shortcut.sound_loops) + HandleGameButtonsExt(SOUND_CTRL_ID_LOOPS); + else if (key == setup.shortcut.sound_music) + HandleGameButtonsExt(SOUND_CTRL_ID_MUSIC); +#endif +} diff --git a/src/game.h b/src/game.h index f6c93315..f5bf7bbf 100644 --- a/src/game.h +++ b/src/game.h @@ -340,6 +340,7 @@ void ScrollLevel(int, int); void InitPlayLevelSound(); void PlayLevelSound_EM(int, int, int, int); +void PlayLevelSound_SP(int, int, int, int); void RaiseScore(int); void RaiseScoreElement(int); @@ -360,4 +361,6 @@ void FreeGameButtons(); void UnmapGameButtons(); void RedrawGameButtons(); +void HandleSoundButtonKeys(Key); + #endif diff --git a/src/game_sp/BugsTerminals.c b/src/game_sp/BugsTerminals.c index 17fc9a0f..b7f7862d 100644 --- a/src/game_sp/BugsTerminals.c +++ b/src/game_sp/BugsTerminals.c @@ -75,34 +75,38 @@ int subAnimateBugs(int si) #endif // now the bug is active! Beware Murphy! - if ((ByteMask && PlayField16[si - FieldWidth - 1]) == fiMurphy) + if ((ByteMask & PlayField16[si - FieldWidth - 1]) == fiMurphy) goto markPlaySound; - if ((ByteMask && PlayField16[si - FieldWidth]) == fiMurphy) + if ((ByteMask & PlayField16[si - FieldWidth]) == fiMurphy) goto markPlaySound; - if ((ByteMask && PlayField16[si - FieldWidth + 1]) == fiMurphy) + if ((ByteMask & PlayField16[si - FieldWidth + 1]) == fiMurphy) goto markPlaySound; - if ((ByteMask && PlayField16[si - 1]) == fiMurphy) + if ((ByteMask & PlayField16[si - 1]) == fiMurphy) goto markPlaySound; - if ((ByteMask && PlayField16[si + 1]) == fiMurphy) + if ((ByteMask & PlayField16[si + 1]) == fiMurphy) goto markPlaySound; - if ((ByteMask && PlayField16[si + FieldWidth - 1]) == fiMurphy) + if ((ByteMask & PlayField16[si + FieldWidth - 1]) == fiMurphy) goto markPlaySound; - if ((ByteMask && PlayField16[si + FieldWidth]) == fiMurphy) + if ((ByteMask & PlayField16[si + FieldWidth]) == fiMurphy) goto markPlaySound; - if ((ByteMask && PlayField16[si + FieldWidth + 1]) == fiMurphy) + if ((ByteMask & PlayField16[si + FieldWidth + 1]) == fiMurphy) goto markPlaySound; goto markDisplay; markPlaySound: +#if 1 + subSoundFX(si, fiBug, actActive); // play dangerous sound +#else subSoundFXBug(); // play dangerous sound +#endif markDisplay: // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/src/game_sp/Explosions.c b/src/game_sp/Explosions.c index 8983a378..0d2ec1a0 100644 --- a/src/game_sp/Explosions.c +++ b/src/game_sp/Explosions.c @@ -154,7 +154,11 @@ void ExplodeFieldSP(int si) GfxGraphic[GetX(si)][GetY(si)] = -1; // restart for chain-explosions // loc_g_2C3B: +#if 1 + subSoundFX(si, ax, actExploding); +#else subSoundFXExplosion(); +#endif } // ExplodeFieldSP static void LetExplodeFieldSP(int tsi, int cx, int dh) diff --git a/src/game_sp/Infotrons.c b/src/game_sp/Infotrons.c index aae2d00e..49d23c5c 100644 --- a/src/game_sp/Infotrons.c +++ b/src/game_sp/Infotrons.c @@ -173,7 +173,19 @@ loc_g_1242: // infotron comes falling from above if (ax == fiOrangeDisk) // orange disk hit goto loc_g_1386; +#if 1 + +#if 1 + // play the infotron sound, 'cause infotron hits something "hard" + subSoundFX(si, fiInfotron, actImpact); +#else + // play the zonk sound, 'cause zonk hits something "hard" + subSoundFX(si, fiZonk, actImpact); +#endif + +#else subSoundFXZonk(); // play the zonk sound,'cause zonk hits something "hard" +#endif if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM)) return subAnimateInfotrons; diff --git a/src/game_sp/Murphy.c b/src/game_sp/Murphy.c index 849e685c..ae4fd764 100644 --- a/src/game_sp/Murphy.c +++ b/src/game_sp/Murphy.c @@ -755,7 +755,12 @@ loc_g_63C2: // ========================================================================== loc_g_63D3: +#if 1 + subSoundFX(*si, fiBase, actDigging); +#else subSoundFXBase(); +#endif + dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft); dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft); PlayField16[*si - FieldWidth] = 0x503; @@ -781,7 +786,12 @@ loc_g_640B: // ========================================================================== loc_g_641C: +#if 1 + subSoundFX(*si, fiBase, actDigging); +#else subSoundFXBase(); +#endif + dx = aniFramesMurphyEatLeft; dx1 = aniMurphyDigLeft; PlayField16[*si - 1] = 0x203; @@ -807,7 +817,12 @@ loc_g_6448: // ========================================================================== loc_g_6459: +#if 1 + subSoundFX(*si, fiBase, actDigging); +#else subSoundFXBase(); +#endif + dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft); dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft); PlayField16[*si + FieldWidth] = 0x703; @@ -833,7 +848,12 @@ loc_g_6491: // ========================================================================== loc_g_64A2: +#if 1 + subSoundFX(*si, fiBase, actDigging); +#else subSoundFXBase(); +#endif + dx = aniFramesMurphyEatRight; dx1 = aniMurphyDigRight; PlayField16[*si + 1] = 0x803; @@ -860,7 +880,12 @@ loc_g_64CE: loc_g_64DF: subCopyImageToScreen(*si, aniMurphyTouchUp); +#if 1 + subSoundFX(*si, fiBase, actDigging); +#else subSoundFXBase(); +#endif + dx = aniFramesTouchBase; dx1 = aniTouchBase; dxPos = *si - FieldWidth; @@ -886,7 +911,12 @@ loc_g_650C: loc_g_651D: subCopyImageToScreen(*si, aniMurphyTouchLeft); +#if 1 + subSoundFX(*si, fiBase, actDigging); +#else subSoundFXBase(); +#endif + dx = aniFramesTouchBase; dx1 = aniTouchBase; dxPos = *si - 1; @@ -912,7 +942,12 @@ loc_g_654A: loc_g_655B: subCopyImageToScreen(*si, aniMurphyTouchDown); +#if 1 + subSoundFX(*si, fiBase, actDigging); +#else subSoundFXBase(); +#endif + dx = aniFramesTouchBase; dx1 = aniTouchBase; dxPos = *si + FieldWidth; @@ -938,7 +973,12 @@ loc_g_6588: loc_g_6599: subCopyImageToScreen(*si, aniMurphyTouchRight); +#if 1 + subSoundFX(*si, fiBase, actDigging); +#else subSoundFXBase(); +#endif + dx = aniFramesTouchBase; dx1 = aniTouchBase; dxPos = *si + 1; @@ -950,7 +990,12 @@ loc_g_6599: // ========================================================================== loc_g_65C6: +#if 1 + subSoundFX(*si, fiInfotron, actCollecting); +#else subSoundFXInfotron(); +#endif + dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft); dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft); PlayField16[*si - FieldWidth] = 0x903; @@ -963,7 +1008,12 @@ loc_g_65C6: // ========================================================================== loc_g_65FE: +#if 1 + subSoundFX(*si, fiInfotron, actCollecting); +#else subSoundFXInfotron(); +#endif + dx = aniFramesEatInfotronLeft; dx1 = aniEatInfotronLeft; #if 0 @@ -981,7 +1031,12 @@ loc_g_65FE: // ========================================================================== loc_g_662A: +#if 1 + subSoundFX(*si, fiInfotron, actCollecting); +#else subSoundFXInfotron(); +#endif + dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft); dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft); PlayField16[*si + FieldWidth] = 0xB03; @@ -994,7 +1049,12 @@ loc_g_662A: // ========================================================================== loc_g_6662: +#if 1 + subSoundFX(*si, fiInfotron, actCollecting); +#else subSoundFXInfotron(); +#endif + dx = aniFramesEatInfotronRight; dx1 = aniEatInfotronRight; #if 0 @@ -1013,7 +1073,12 @@ loc_g_6662: loc_g_668E: subCopyImageToScreen(*si, aniMurphyTouchUp); +#if 1 + subSoundFX(*si, fiInfotron, actCollecting); +#else subSoundFXInfotron(); +#endif + dx = aniFramesTouchInfotron; dx1 = aniTouchInfotron; MovHighByte(&PlayField16[*si], 0x14); @@ -1026,7 +1091,12 @@ loc_g_668E: loc_g_66C0: subCopyImageToScreen(*si, aniMurphyTouchLeft); +#if 1 + subSoundFX(*si, fiInfotron, actCollecting); +#else subSoundFXInfotron(); +#endif + dx = aniFramesTouchInfotron; dx1 = aniTouchInfotron; MovHighByte(&PlayField16[*si], 0x15); @@ -1039,7 +1109,12 @@ loc_g_66C0: loc_g_66F2: subCopyImageToScreen(*si, aniMurphyTouchDown); +#if 1 + subSoundFX(*si, fiInfotron, actCollecting); +#else subSoundFXInfotron(); +#endif + dx = aniFramesTouchInfotron; dx1 = aniTouchInfotron; MovHighByte(&PlayField16[*si], 0x16); @@ -1052,7 +1127,12 @@ loc_g_66F2: loc_g_6724: subCopyImageToScreen(*si, aniMurphyTouchRight); +#if 1 + subSoundFX(*si, fiInfotron, actCollecting); +#else subSoundFXInfotron(); +#endif + dx = aniFramesTouchInfotron; dx1 = aniTouchInfotron; MovHighByte(&PlayField16[*si], 0x17); @@ -1081,7 +1161,12 @@ loc_g_6756: game_sp.LevelSolved = TRUE; #endif +#if 1 + subSoundFX(*si, fiExit, actPassing); +#else subSoundFXExit(); +#endif + data_h_DemoDone = 1; // EP set level success bytes LevelStatus = 1; // set Level Status DONE EP_GameDemoVar0DAA = 0; // force demo for lead-out @@ -1597,8 +1682,36 @@ locProceedMovingMurphy: // proceed moving murphy ax = ax - 1; // next picture of sequence MovingPictureSequencePhase = ax; // store for later + if (ax == 0) // Sound effects +#if 1 + { + switch (HighByte(PlayField16[*si])) + { + case 0xE: + case 0xF: + subSoundFX(*si, fiZonk, actPushing); + break; + + case 0x28: + case 0x29: + subSoundFX(*si, fiOrangeDisk, actPushing); + break; + + case 0x24: + case 0x25: + case 0x26: + case 0x27: + subSoundFX(*si, fiYellowDisk, actPushing); + break; + + default: + break; + } + } +#else subSoundFXPush(); +#endif bl = HighByte(PlayField16[*si]); if (bl == 0xE) // Push Zonk to left @@ -2531,7 +2644,12 @@ loc_g_747F: RedDiskReleasePhase = 2; RedDiskCount = RedDiskCount - 1; subDisplayRedDiskCount(); + +#if 1 + subSoundFX(*si, fiRedDisk, actDropping); +#else subSoundFXPush(); // Sound effects +#endif } // subAnimateMurphy // ========================================================================== diff --git a/src/game_sp/Sound.c b/src/game_sp/Sound.c index b17c4193..1284e58c 100644 --- a/src/game_sp/Sound.c +++ b/src/game_sp/Sound.c @@ -208,6 +208,14 @@ void subSoundFXExit() #endif } +void subSoundFX(int si, int element, int action) +{ + int x = GetX(si); + int y = GetY(si); + + PlayLevelSound_SP(x, y, element, action); +} + void subMusicInit() { } diff --git a/src/game_sp/Sound.h b/src/game_sp/Sound.h index 30baa6c4..445a4348 100644 --- a/src/game_sp/Sound.h +++ b/src/game_sp/Sound.h @@ -22,6 +22,8 @@ extern void subSoundFXInfotron(); extern void subSoundFXPush(); extern void subSoundFXZonk(); +extern void subSoundFX(int, int, int); + extern int FXOnFlag; extern int MusicOnFlag; diff --git a/src/game_sp/Zonk.c b/src/game_sp/Zonk.c index b19c0033..f047a610 100644 --- a/src/game_sp/Zonk.c +++ b/src/game_sp/Zonk.c @@ -183,7 +183,12 @@ loc_g_0DE8: // zonk comes falling from above if (ax == fiOrangeDisk) // OrangeDisk explodes 'loc_g_0E95: goto loc_g_0F75; +#if 1 + // play the zonk sound, 'cause zonk hits something "hard" + subSoundFX(si, fiZonk, actImpact); +#else subSoundFXZonk(); // play the zonk sound,'cause zonk hits something "hard" +#endif if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM)) return subAnimateZonks; diff --git a/src/game_sp/export.h b/src/game_sp/export.h index 9e374dc5..ca5912b6 100644 --- a/src/game_sp/export.h +++ b/src/game_sp/export.h @@ -35,6 +35,19 @@ #define SP_MAX_TAPE_LEN 64010 /* (see "spfix63.doc") */ +/* sound actions */ + +#define actActive 0 +#define actImpact 1 +#define actExploding 2 +#define actDigging 3 +#define actSnapping 4 +#define actCollecting 5 +#define actPassing 6 +#define actPushing 7 +#define actDropping 8 + + /* ------------------------------------------------------------------------- */ /* data structure definitions */ /* ------------------------------------------------------------------------- */ diff --git a/src/game_sp/main.c b/src/game_sp/main.c index b73da64f..299a63b5 100644 --- a/src/game_sp/main.c +++ b/src/game_sp/main.c @@ -109,6 +109,8 @@ void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode) byte single_player_action = action[0]; int x, y; + UpdateEngineValues(mScrollX / TILEX, mScrollY / TILEY); + subMainGameLoop_Main(single_player_action, warp_mode); RedrawPlayfield_SP(FALSE); diff --git a/src/libgame/system.h b/src/libgame/system.h index aeab9c23..3d011718 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -77,6 +77,9 @@ #define DEFAULT_KEY_TAPE_PAUSE KSYM_UNDEFINED #define DEFAULT_KEY_TAPE_RECORD KSYM_UNDEFINED #define DEFAULT_KEY_TAPE_PLAY KSYM_UNDEFINED +#define DEFAULT_KEY_SOUND_SIMPLE KSYM_UNDEFINED +#define DEFAULT_KEY_SOUND_LOOPS KSYM_UNDEFINED +#define DEFAULT_KEY_SOUND_MUSIC KSYM_UNDEFINED /* values for key_status */ #define KEY_NOT_PRESSED FALSE @@ -845,6 +848,10 @@ struct SetupShortcutInfo Key tape_pause; Key tape_record; Key tape_play; + + Key sound_simple; + Key sound_loops; + Key sound_music; }; struct SetupSystemInfo diff --git a/src/main.h b/src/main.h index 56ecbd16..739d5be2 100644 --- a/src/main.h +++ b/src/main.h @@ -1852,10 +1852,11 @@ #define GFX_SPECIAL_ARG_SETUP_SHORTCUTS_1 8 #define GFX_SPECIAL_ARG_SETUP_SHORTCUTS_2 9 #define GFX_SPECIAL_ARG_SETUP_SHORTCUTS_3 10 -#define GFX_SPECIAL_ARG_SETUP_CHOOSE_ARTWORK 11 -#define GFX_SPECIAL_ARG_SETUP_CHOOSE_OTHER 12 +#define GFX_SPECIAL_ARG_SETUP_SHORTCUTS_4 11 +#define GFX_SPECIAL_ARG_SETUP_CHOOSE_ARTWORK 12 +#define GFX_SPECIAL_ARG_SETUP_CHOOSE_OTHER 13 -#define NUM_SPECIAL_GFX_SETUP_ARGS 13 +#define NUM_SPECIAL_GFX_SETUP_ARGS 14 /* values for image configuration suffixes */ diff --git a/src/screens.c b/src/screens.c index 74690d7f..87f4a3e0 100644 --- a/src/screens.c +++ b/src/screens.c @@ -49,20 +49,21 @@ #define SETUP_MODE_SHORTCUTS_1 8 #define SETUP_MODE_SHORTCUTS_2 9 #define SETUP_MODE_SHORTCUTS_3 10 +#define SETUP_MODE_SHORTCUTS_4 11 /* sub-screens on the setup screen (generic) */ -#define SETUP_MODE_CHOOSE_ARTWORK 11 -#define SETUP_MODE_CHOOSE_OTHER 12 +#define SETUP_MODE_CHOOSE_ARTWORK 12 +#define SETUP_MODE_CHOOSE_OTHER 13 /* sub-screens on the setup screen (specific) */ -#define SETUP_MODE_CHOOSE_GAME_SPEED 13 -#define SETUP_MODE_CHOOSE_SCREEN_MODE 14 -#define SETUP_MODE_CHOOSE_SCROLL_DELAY 15 -#define SETUP_MODE_CHOOSE_GRAPHICS 16 -#define SETUP_MODE_CHOOSE_SOUNDS 17 -#define SETUP_MODE_CHOOSE_MUSIC 18 +#define SETUP_MODE_CHOOSE_GAME_SPEED 14 +#define SETUP_MODE_CHOOSE_SCREEN_MODE 15 +#define SETUP_MODE_CHOOSE_SCROLL_DELAY 16 +#define SETUP_MODE_CHOOSE_GRAPHICS 17 +#define SETUP_MODE_CHOOSE_SOUNDS 18 +#define SETUP_MODE_CHOOSE_MUSIC 19 -#define MAX_SETUP_MODES 19 +#define MAX_SETUP_MODES 20 /* for input setup functions */ #define SETUPINPUT_SCREEN_POS_START 0 @@ -234,7 +235,7 @@ static struct INFO_MODE_MAIN) #define DRAW_MODE_SETUP(i) ((i) >= SETUP_MODE_MAIN && \ - (i) <= SETUP_MODE_SHORTCUTS_3 ? (i) : \ + (i) <= SETUP_MODE_SHORTCUTS_4 ? (i) : \ (i) >= SETUP_MODE_CHOOSE_GRAPHICS && \ (i) <= SETUP_MODE_CHOOSE_MUSIC ? \ SETUP_MODE_CHOOSE_ARTWORK : \ @@ -4111,6 +4112,13 @@ static void execSetupShortcuts3() DrawSetupScreen(); } +static void execSetupShortcuts4() +{ + setup_mode = SETUP_MODE_SHORTCUTS_4; + + DrawSetupScreen(); +} + static void execExitSetup() { game_status = GAME_MODE_MAIN; @@ -4283,6 +4291,7 @@ static struct TokenInfo setup_info_shortcuts[] = { TYPE_ENTER_MENU, execSetupShortcuts1, "Various Keys" }, { TYPE_ENTER_MENU, execSetupShortcuts2, "Player Focus" }, { TYPE_ENTER_MENU, execSetupShortcuts3, "Tape Buttons" }, + { TYPE_ENTER_MENU, execSetupShortcuts4, "Sound & Music" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, @@ -4326,15 +4335,15 @@ static struct TokenInfo setup_info_shortcuts_2[] = static struct TokenInfo setup_info_shortcuts_3[] = { - { TYPE_KEYTEXT, NULL, "Tape Eject:", }, + { TYPE_KEYTEXT, NULL, "Tape Eject:", }, { TYPE_KEY, &setup.shortcut.tape_eject, "" }, - { TYPE_KEYTEXT, NULL, "Tape Stop:", }, + { TYPE_KEYTEXT, NULL, "Tape Stop:", }, { TYPE_KEY, &setup.shortcut.tape_stop, "" }, - { TYPE_KEYTEXT, NULL, "Tape Pause:", }, + { TYPE_KEYTEXT, NULL, "Tape Pause:", }, { TYPE_KEY, &setup.shortcut.tape_pause, "" }, - { TYPE_KEYTEXT, NULL, "Tape Record:", }, + { TYPE_KEYTEXT, NULL, "Tape Record:", }, { TYPE_KEY, &setup.shortcut.tape_record, "" }, - { TYPE_KEYTEXT, NULL, "Tape Play:", }, + { TYPE_KEYTEXT, NULL, "Tape Play:", }, { TYPE_KEY, &setup.shortcut.tape_play, "" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupShortcuts, "Back" }, @@ -4342,6 +4351,20 @@ static struct TokenInfo setup_info_shortcuts_3[] = { 0, NULL, NULL } }; +static struct TokenInfo setup_info_shortcuts_4[] = +{ + { TYPE_KEYTEXT, NULL, "Sound Effects (Normal):", }, + { TYPE_KEY, &setup.shortcut.sound_simple, "" }, + { TYPE_KEYTEXT, NULL, "Sound Effects (Looping):", }, + { TYPE_KEY, &setup.shortcut.sound_loops, "" }, + { TYPE_KEYTEXT, NULL, "Music:", }, + { TYPE_KEY, &setup.shortcut.sound_music, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_LEAVE_MENU, execSetupShortcuts, "Back" }, + + { 0, NULL, NULL } +}; + static Key getSetupKey() { Key key = KSYM_UNDEFINED; @@ -4640,6 +4663,11 @@ static void DrawSetupScreen_Generic() setup_info = setup_info_shortcuts_3; title_string = "Setup Shortcuts"; } + else if (setup_mode == SETUP_MODE_SHORTCUTS_4) + { + setup_info = setup_info_shortcuts_4; + title_string = "Setup Shortcuts"; + } DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, title_string); diff --git a/src/tools.c b/src/tools.c index 773a59db..c6cd967a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -5900,6 +5900,52 @@ int map_direction_EM_to_RND(int direction) MV_NONE); } +int map_element_RND_to_SP(int element_rnd) +{ + int element_sp = 0x20; /* map unknown elements to yellow "hardware" */ + + if (element_rnd >= EL_SP_START && + element_rnd <= EL_SP_END) + element_sp = element_rnd - EL_SP_START; + else if (element_rnd == EL_EMPTY_SPACE) + element_sp = 0x00; + else if (element_rnd == EL_INVISIBLE_WALL) + element_sp = 0x28; + + return element_sp; +} + +int map_element_SP_to_RND(int element_sp) +{ + int element_rnd = EL_UNKNOWN; + + if (element_sp >= 0x00 && + element_sp <= 0x27) + element_rnd = EL_SP_START + element_sp; + else if (element_sp == 0x28) + element_rnd = EL_INVISIBLE_WALL; + + return element_rnd; +} + +int map_action_SP_to_RND(int action_sp) +{ + switch (action_sp) + { + case actActive: return ACTION_ACTIVE; + case actImpact: return ACTION_IMPACT; + case actExploding: return ACTION_EXPLODING; + case actDigging: return ACTION_DIGGING; + case actSnapping: return ACTION_SNAPPING; + case actCollecting: return ACTION_COLLECTING; + case actPassing: return ACTION_PASSING; + case actPushing: return ACTION_PUSHING; + case actDropping: return ACTION_DROPPING; + + default: return ACTION_DEFAULT; + } +} + int get_next_element(int element) { switch (element) diff --git a/src/tools.h b/src/tools.h index 136a305c..e16b4eae 100644 --- a/src/tools.h +++ b/src/tools.h @@ -174,6 +174,10 @@ int map_direction_EM_to_RND(int); void map_android_clone_elements_RND_to_EM(struct LevelInfo *); void map_android_clone_elements_EM_to_RND(struct LevelInfo *); +int map_element_RND_to_SP(int); +int map_element_SP_to_RND(int); +int map_action_SP_to_RND(int); + int get_next_element(int); int el_act_dir2img(int, int, int); int el_act2img(int, int);