From 4d81eb578edd2ec8001960cc876663bc09b9caf5 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 12 Aug 2015 20:25:21 +0200 Subject: [PATCH 1/4] Remove long-disabled config code --- src/config.c | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/src/config.c b/src/config.c index 26f9f401a6..4070555e04 100644 --- a/src/config.c +++ b/src/config.c @@ -879,47 +879,19 @@ void config_dat_load() RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = 2; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, sint8) = 1; - // Line below is temporaraly disabled until all config is in the new format. + // Line below is temporarily disabled until all config is in the new format. //if (RCT2_GLOBAL(0x009AB4C6, sint8) == 1) // return; - - + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG, sint8) = 1; // Marks config as first time loaded RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 2) * 256; if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS)) RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256; - // No longer used (controls first time object load) - //RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS, sint8) = 0; } } - /* TODO: CLEANUP - - if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG, sint8) == 1) - return; - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG, sint8) = 1; - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, sint8) = 1; - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CURRENCY, sint8) = 1; - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 0; - if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS)) - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256; - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS, sint8) = 1; - } - - } - - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = 0; - if (RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PHYSICAL, uint32) > 0x4000000) { - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = 1; - if (RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PHYSICAL, uint32) > 0x8000000) - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = 2; - } - */ - - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MAX_VEHICLE_SOUNDS, sint8) = RCT2_ADDRESS(0x009AF601, sint8)[RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8)]; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MAX_NO_SOUNDS, sint8) = RCT2_ADDRESS(0x009AF604, sint8)[RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8)]; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 0; From fcb74d13b2f1a79b5091fd27898ebc0a693f385a Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 12 Aug 2015 22:05:13 +0200 Subject: [PATCH 2/4] Get rid of unused file references, comment out unused obsolete config file code --- src/audio/audio.c | 3 ++- src/config.c | 8 ++++---- src/rct2.h | 22 ---------------------- src/ride/ride.c | 4 ++-- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/src/audio/audio.c b/src/audio/audio.c index 6b265acedf..b01894cc30 100644 --- a/src/audio/audio.c +++ b/src/audio/audio.c @@ -1714,7 +1714,8 @@ void audio_init1() } } m++; - } while(m + 1 < 0x2E); + // 46 is the number of files in ride_music_info_list + } while(m + 1 < 46); } /** diff --git a/src/config.c b/src/config.c index 4070555e04..507556313d 100644 --- a/src/config.c +++ b/src/config.c @@ -820,7 +820,7 @@ void config_apply_to_old_addresses() * Reads the config file data/config.cfg * rct2: 0x006752D5 */ -void config_dat_load() +/*void config_dat_load() { FILE *fp=NULL; @@ -898,13 +898,13 @@ void config_dat_load() if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS)) RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS, sint8) = 1; -} +}*/ /** * Save configuration to the data/config.cfg file * rct2: 0x00675487 */ -void config_dat_save() +/*void config_dat_save() { FILE *fp = fopen(get_file_path(PATH_ID_GAMECFG), "wb"); if (fp != NULL){ @@ -912,7 +912,7 @@ void config_dat_save() fwrite((void*)0x009AAC5C, 2155, 1, fp); fclose(fp); } -} +}*/ #pragma endregion diff --git a/src/rct2.h b/src/rct2.h index 3fed27792a..d391e0d239 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -150,7 +150,6 @@ enum { enum { PATH_ID_G1, - PATH_ID_PLUGIN, PATH_ID_CSS1, PATH_ID_CSS2, PATH_ID_CSS4, @@ -159,22 +158,12 @@ enum { PATH_ID_CSS7, PATH_ID_CSS8, PATH_ID_CSS9, - PATH_ID_CSS10, PATH_ID_CSS11, PATH_ID_CSS12, PATH_ID_CSS13, PATH_ID_CSS14, PATH_ID_CSS15, - PATH_ID_CSS16, PATH_ID_CSS3, - PATH_ID_GAMECFG, - PATH_ID_TUT640A, - PATH_ID_TUT640B, - PATH_ID_TUT640C, - PATH_ID_TUT800A, - PATH_ID_TUT800B, - PATH_ID_TUT800C, - PATH_ID_KANJI, PATH_ID_CSS17, PATH_ID_CSS18, PATH_ID_CSS19, @@ -219,7 +208,6 @@ enum { static const char * const file_paths[] = { "Data\\G1.DAT", - "Data\\PLUGIN.DAT", "Data\\CSS1.DAT", "Data\\CSS2.DAT", "Data\\CSS4.DAT", @@ -228,22 +216,12 @@ static const char * const file_paths[] = "Data\\CSS7.DAT", "Data\\CSS8.DAT", "Data\\CSS9.DAT", - "Data\\CSS10.DAT", "Data\\CSS11.DAT", "Data\\CSS12.DAT", "Data\\CSS13.DAT", "Data\\CSS14.DAT", "Data\\CSS15.DAT", - "Data\\CSS16.DAT", "Data\\CSS3.DAT", - "Data\\GAME.CFG", - "Data\\TUT640A.DAT", - "Data\\TUT640B.DAT", - "Data\\TUT640C.DAT", - "Data\\TUT800A.DAT", - "Data\\TUT800B.DAT", - "Data\\TUT800C.DAT", - "Data\\KANJI.DAT", "Data\\CSS17.DAT", "Data\\CSS18.DAT", "Data\\CSS19.DAT", diff --git a/src/ride/ride.c b/src/ride/ride.c index 7f37e4be6b..0ab877bd53 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -3320,13 +3320,13 @@ rct_ride_music_info* ride_music_info_list[] = { INIT_MUSIC_INFO(PATH_ID_CSS7, 1378, 15331658, 0), INIT_MUSIC_INFO(PATH_ID_CSS8, 1378, 17503414, 0), INIT_MUSIC_INFO(PATH_ID_CSS9, 1378, 7005802, 0), - INIT_MUSIC_INFO(PATH_ID_CSS10, 1378, 0, 0), + INIT_MUSIC_INFO(0, 1378, 0, 0), // Referred to the nearly empty CSS10.DAT file INIT_MUSIC_INFO(PATH_ID_CSS11, 1378, 7023288, 0), INIT_MUSIC_INFO(PATH_ID_CSS12, 1378, 2767948, 0), INIT_MUSIC_INFO(PATH_ID_CSS13, 1378, 3373390, 0), INIT_MUSIC_INFO(PATH_ID_CSS14, 1378, 20783042, 0), INIT_MUSIC_INFO(PATH_ID_CSS15, 1378, 10009312, 0), - INIT_MUSIC_INFO(PATH_ID_CSS16, 1378, 0, 0), + INIT_MUSIC_INFO(0, 1378, 0, 0), // Referred to the nearly empty CSS16.DAT file INIT_MUSIC_INFO(PATH_ID_CSS3, 689, 1244886, 1), INIT_MUSIC_INFO(PATH_ID_CSS17, 2756, -1, 0), INIT_MUSIC_INFO(PATH_ID_CSS18, 2756, 8429568, 1), From 6a23e28670e1dcf73f036cdeb6d1bd88b357dc32 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 16 Aug 2015 21:29:10 +0200 Subject: [PATCH 3/4] Refactored music file list, removed some extra unused code, clear up some comments --- src/audio/audio.c | 8 +++----- src/audio/audio.h | 2 +- src/rct2.c | 2 +- src/rct2.h | 4 ---- src/ride/ride.c | 4 ++-- src/ride/ride.h | 2 +- 6 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/audio/audio.c b/src/audio/audio.c index b01894cc30..803ffd5fcb 100644 --- a/src/audio/audio.c +++ b/src/audio/audio.c @@ -1700,8 +1700,8 @@ void audio_init1() } } audio_init2(devicenum); - int m = 0; - do { + + for(int m = 0; m < countof(ride_music_info_list); m++) { rct_ride_music_info* ride_music_info = ride_music_info_list[m]; const char* path = get_file_path(ride_music_info->pathid); FILE *file = fopen(path, "rb"); @@ -1713,9 +1713,7 @@ void audio_init1() ride_music_info->length = 0; } } - m++; - // 46 is the number of files in ride_music_info_list - } while(m + 1 < 46); + } } /** diff --git a/src/audio/audio.h b/src/audio/audio.h index ef41f56601..d7205407a6 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -147,7 +147,7 @@ typedef struct { uint8 var_9; } rct_ride_music_info; -extern rct_ride_music_info* ride_music_info_list[]; +extern rct_ride_music_info* ride_music_info_list[46]; extern rct_vehicle_sound gVehicleSoundList[AUDIO_MAX_VEHICLE_SOUNDS]; extern rct_vehicle_sound_params gVehicleSoundParamsList[AUDIO_MAX_VEHICLE_SOUNDS]; extern rct_vehicle_sound_params *gVehicleSoundParamsListEnd; diff --git a/src/rct2.c b/src/rct2.c index 61af055adf..8fdf68811a 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -299,7 +299,7 @@ int check_file_path(int pathId) // A data file is missing from the installation directory. The original implementation // asks for a CD-ROM path at this point and stores it in cdrom_path @ 0x9AA318. // The file_on_cdrom[pathId] @ 0x009AA0B flag is set to 1 as well. - // For PATH_ID_SIXFLAGS_MAGICMOUNTAIN and PATH_ID_SIXFLAGS_BUILDYOUROWN, + // For PATH_ID_SIXFLAGS_MAGICMOUNTAIN (and the now removed PATH_ID_SIXFLAGS_BUILDYOUROWN), // the original implementation always assumes they are stored on CD-ROM. // This has been removed for now for the sake of simplicity and could be added // later in a more convenient way using the INI file. diff --git a/src/rct2.h b/src/rct2.h index d391e0d239..f6a6533dac 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -191,10 +191,8 @@ enum { PATH_ID_CUSTOM2, PATH_ID_CSS39, PATH_ID_CSS40, - PATH_ID_TRACKSIDX, PATH_ID_CSS41, PATH_ID_SIXFLAGS_MAGICMOUNTAIN, - PATH_ID_SIXFLAGS_BUILDYOUROWN, PATH_ID_CSS42, PATH_ID_CSS43, PATH_ID_CSS44, @@ -249,10 +247,8 @@ static const char * const file_paths[] = "Data\\CUSTOM2.WAV", "Data\\CSS39.DAT", "Data\\CSS40.DAT", - "Tracks\\Tracks.IDX", "Data\\CSS41.DAT", "Scenarios\\Six Flags Magic Mountain.SC6", - "Scenarios\\Build your own Six Flags Park.SC6", "Data\\CSS42.DAT", "Data\\CSS43.DAT", "Data\\CSS44.DAT", diff --git a/src/ride/ride.c b/src/ride/ride.c index 0ab877bd53..8f11aad916 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -2509,7 +2509,7 @@ uint8 *ride_music_style_tuneids[] = { MAKE_TUNEID_LIST(18), // MUSIC_STYLE_JUNGLE_DRUMS MAKE_TUNEID_LIST(19), // MUSIC_STYLE_EGYPTIAN MAKE_TUNEID_LIST(20), // MUSIC_STYLE_TOYLAND - MAKE_TUNEID_LIST(21), // MUSIC_STYLE_8 + MAKE_TUNEID_LIST(21), // MUSIC_STYLE_CIRCUS_SHOW MAKE_TUNEID_LIST(22), // MUSIC_STYLE_SPACE MAKE_TUNEID_LIST(23), // MUSIC_STYLE_HORROR MAKE_TUNEID_LIST(24), // MUSIC_STYLE_TECHNO @@ -3313,7 +3313,7 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint #define INIT_MUSIC_INFO(pathid, offset, length, unknown) (rct_ride_music_info[]){length, offset, pathid, unknown} //0x009AF1C8 -rct_ride_music_info* ride_music_info_list[] = { +rct_ride_music_info* ride_music_info_list[46] = { INIT_MUSIC_INFO(PATH_ID_CSS4, 1378, 8139054, 0), INIT_MUSIC_INFO(PATH_ID_CSS5, 1378, 7796656, 0), INIT_MUSIC_INFO(PATH_ID_CSS6, 1378, 15787850, 0), diff --git a/src/ride/ride.h b/src/ride/ride.h index 0bdc574eb6..a87a168d64 100644 --- a/src/ride/ride.h +++ b/src/ride/ride.h @@ -598,7 +598,7 @@ enum { MUSIC_STYLE_JUNGLE_DRUMS, MUSIC_STYLE_EGYPTIAN, MUSIC_STYLE_TOYLAND, - MUSIC_STYLE_8, + MUSIC_STYLE_CIRCUS_SHOW, MUSIC_STYLE_SPACE, MUSIC_STYLE_HORROR, MUSIC_STYLE_TECHNO, From 99dd05176f7c93bd4ee5579b137b3df415b16d8f Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 16 Aug 2015 22:26:17 +0200 Subject: [PATCH 4/4] Use a define the number of default music tracks --- src/audio/audio.c | 1 + src/audio/audio.h | 3 ++- src/ride/ride.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/audio/audio.c b/src/audio/audio.c index 803ffd5fcb..e16613cf7e 100644 --- a/src/audio/audio.c +++ b/src/audio/audio.c @@ -23,6 +23,7 @@ #include "../interface/viewport.h" #include "../interface/window.h" #include "../platform/platform.h" +#include "../ride/ride.h" #include "../world/map.h" #include "../world/sprite.h" #include "audio.h" diff --git a/src/audio/audio.h b/src/audio/audio.h index d7205407a6..aee7f80f00 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -147,7 +147,8 @@ typedef struct { uint8 var_9; } rct_ride_music_info; -extern rct_ride_music_info* ride_music_info_list[46]; +#define NUM_DEFAULT_MUSIC_TRACKS 46 +extern rct_ride_music_info* ride_music_info_list[NUM_DEFAULT_MUSIC_TRACKS]; extern rct_vehicle_sound gVehicleSoundList[AUDIO_MAX_VEHICLE_SOUNDS]; extern rct_vehicle_sound_params gVehicleSoundParamsList[AUDIO_MAX_VEHICLE_SOUNDS]; extern rct_vehicle_sound_params *gVehicleSoundParamsListEnd; diff --git a/src/ride/ride.c b/src/ride/ride.c index 8f11aad916..2cd47c25a6 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -3313,7 +3313,7 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint #define INIT_MUSIC_INFO(pathid, offset, length, unknown) (rct_ride_music_info[]){length, offset, pathid, unknown} //0x009AF1C8 -rct_ride_music_info* ride_music_info_list[46] = { +rct_ride_music_info* ride_music_info_list[NUM_DEFAULT_MUSIC_TRACKS] = { INIT_MUSIC_INFO(PATH_ID_CSS4, 1378, 8139054, 0), INIT_MUSIC_INFO(PATH_ID_CSS5, 1378, 7796656, 0), INIT_MUSIC_INFO(PATH_ID_CSS6, 1378, 15787850, 0),