From 38fda5debfea85dfef8bf084b818fc5b04e0078f Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Tue, 16 Feb 2016 20:23:32 +0000 Subject: [PATCH] remove old redundant RCT2 platform code --- src/game.c | 4 +- src/management/news_item.c | 33 ------------ src/openrct2.c | 1 - src/rct2.c | 100 ------------------------------------- src/rct2.h | 3 -- src/scenario.c | 1 - 6 files changed, 1 insertion(+), 141 deletions(-) diff --git a/src/game.c b/src/game.c index 9237270043..43f9bed012 100644 --- a/src/game.c +++ b/src/game.c @@ -246,9 +246,7 @@ void update_palette_effects() } } if (RCT2_GLOBAL(0x009E2C4C, uint32) == 2 || RCT2_GLOBAL(0x009E2C4C, uint32) == 1) { - if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_BPP, uint32) != 8) { - RCT2_GLOBAL(0x009E2C78, int) = 1; - } + RCT2_GLOBAL(0x009E2C78, int) = 1; } } diff --git a/src/management/news_item.c b/src/management/news_item.c index 18accd4783..17a588f174 100644 --- a/src/management/news_item.c +++ b/src/management/news_item.c @@ -110,39 +110,6 @@ static bool news_item_is_current_old() */ void news_item_update_current() { - short ax, bx; - - get_system_time(); - - ax = RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_DAY, sint16); - bx = RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_MONTH, sint16); - - // Cheat detection - if (bx != RCT2_GLOBAL(0x009DEA6B, sint16)) { - bx--; - if (bx == 0) - bx = 12; - if (bx != RCT2_GLOBAL(0x009DEA6B, sint16) || ax != 1) { - // loc_66E2AE - RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, sint32) -= 10000; - if (RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, sint32) >= 0) - RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, sint32) = -RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, sint32); - } - } else { - if (ax != RCT2_GLOBAL(0x009DEA69, sint16)) { - ax--; - if (ax != RCT2_GLOBAL(0x009DEA69, sint16)) { - // loc_66E2AE - RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, sint32) -= 10000; - if (RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, sint32) >= 0) - RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, sint32) = -RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, sint32); - } - } - } - - RCT2_GLOBAL(0x009DEA69, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_DAY, sint16); - RCT2_GLOBAL(0x009DEA6B, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_MONTH, sint16); - // Check if there is a current news item if (news_item_is_queue_empty()) return; diff --git a/src/openrct2.c b/src/openrct2.c index 89eabed98d..940c4b8f99 100644 --- a/src/openrct2.c +++ b/src/openrct2.c @@ -215,7 +215,6 @@ bool openrct2_initialise() // return false; // } - get_system_info(); if (!gOpenRCT2Headless) { audio_init(); audio_populate_devices(); diff --git a/src/rct2.c b/src/rct2.c index f1f20faa33..e3071f4a27 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -139,10 +139,7 @@ int rct2_init() RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) = 0; RCT2_GLOBAL(0x009AC310, char*) = RCT2_GLOBAL(RCT2_ADDRESS_CMDLINE, char*); - get_system_time(); util_srand((unsigned int)time(0)); - RCT2_GLOBAL(0x009DEA69, short) = RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_DAY, short); - RCT2_GLOBAL(0x009DEA6B, short) = RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_MONTH, short); if (!rct2_init_directories()) return 0; @@ -169,7 +166,6 @@ int rct2_init() } viewport_init_all(); news_item_init_queue(); - get_local_time(); reset_park_entrances(); user_string_clear_all(); reset_sprite_list(); @@ -498,99 +494,3 @@ const utf8 *get_file_path(int pathId) return path; } - -/** - * Obtains basic system versions and capabilities. - * rct2: 0x004076B1 - */ -void get_system_info() -{ -#ifdef __WINDOWS__ - OSVERSIONINFO versionInfo; - SYSTEM_INFO sysInfo; - MEMORYSTATUS memInfo; - - versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (GetVersionEx(&versionInfo)) { - RCT2_GLOBAL(RCT2_ADDRESS_OS_PLATFORM_ID, uint32) = versionInfo.dwPlatformId; - RCT2_GLOBAL(RCT2_ADDRESS_OS_MAJOR_VERSION, uint32) = versionInfo.dwMajorVersion; - RCT2_GLOBAL(RCT2_ADDRESS_OS_MINOR_VERSION, uint32) = versionInfo.dwMinorVersion; - RCT2_GLOBAL(RCT2_ADDRESS_OS_BUILD_NUMBER, uint32) = versionInfo.dwBuildNumber; - } else { -#endif // __WINDOWS__ - RCT2_GLOBAL(RCT2_ADDRESS_OS_PLATFORM_ID, uint32) = -1; - RCT2_GLOBAL(RCT2_ADDRESS_OS_MAJOR_VERSION, uint32) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_OS_MINOR_VERSION, uint32) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_OS_BUILD_NUMBER, uint32) = 0; -#ifdef __WINDOWS__ - } - - GetSystemInfo(&sysInfo); - // RCT2 only has 2 bytes reserved for OEM_ID even though it should be a DWORD - RCT2_GLOBAL(RCT2_ADDRESS_SYS_OEM_ID, uint16) = (uint16)sysInfo.dwOemId; - RCT2_GLOBAL(RCT2_ADDRESS_SYS_CPU_LEVEL, uint16) = sysInfo.wProcessorLevel; - RCT2_GLOBAL(RCT2_ADDRESS_SYS_CPU_REVISION, uint16) = sysInfo.wProcessorRevision; - RCT2_GLOBAL(RCT2_ADDRESS_SYS_CPU_NUMBER, uint32) = sysInfo.dwNumberOfProcessors; - - GlobalMemoryStatus(&memInfo); - RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PHYSICAL, uint32) = memInfo.dwTotalPhys; - RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PAGEFILE, uint32) = memInfo.dwTotalPageFile; - RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_VIRTUAL, uint32) = memInfo.dwTotalVirtual; - - DWORD size = 80; - GetUserName((char*)RCT2_ADDRESS_OS_USER_NAME, &size); - size = 80; - GetComputerName((char*)RCT2_ADDRESS_OS_COMPUTER_NAME, &size); - - // Screen Display Width/Height but RCT_ADDRESS_SCREEN_HEIGHT/WIDTH already taken? - RCT2_GLOBAL(0x01423C08, sint32) = GetSystemMetrics(SM_CXSCREEN); - RCT2_GLOBAL(0x01423C0C, sint32) = GetSystemMetrics(SM_CYSCREEN); - - HDC screenHandle = GetDC(NULL); - if (screenHandle) { - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_BPP, sint32) = GetDeviceCaps(screenHandle, BITSPIXEL); - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_RASTER_STRETCH, sint32) = GetDeviceCaps(screenHandle, RASTERCAPS) >> 8; - ReleaseDC(NULL, screenHandle); - } else { - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_BPP, sint32) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_RASTER_STRETCH, sint32) = 0; - } - - RCT2_GLOBAL(0x01423C1C, uint32) = (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_BPP, sint32) >= 8); - if (RCT2_GLOBAL(RCT2_ADDRESS_OS_MAJOR_VERSION, uint32) < 4 || RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_BPP, sint32) < 4) - RCT2_GLOBAL(0x1423C18, sint32) = 0; - else - RCT2_GLOBAL(0x1423C18, sint32) = 1; - - RCT2_GLOBAL(0x01423C20, uint32) = (SDL_HasMMX() == SDL_TRUE); -#else - STUB(); -#endif // __WINDOWS__ -} - - -/** - * Obtains os system time (day, month, year and day of the week). - * rct2: 0x00407671 - */ -void get_system_time() -{ - rct2_date date; - platform_get_date(&date); - RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_DAY, sint16) = date.day; - RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_MONTH, sint16) = date.month; - RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_YEAR, sint16) = date.year; - RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_DAYOFWEEK, sint16) = date.day_of_week; -} - -/** - * Obtains os local time (hour and minute) - * rct2: 0x006C45E7; - */ -void get_local_time() -{ - rct2_time t; - platform_get_time(&t); - RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_HOUR, sint16) = t.hour; - RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_MINUTE, sint16) = t.minute; -} diff --git a/src/rct2.h b/src/rct2.h index 7c84aaeab0..a7b40d25e8 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -273,9 +273,6 @@ int check_file_paths(); int check_file_path(int pathId); int check_files_integrity(); const char *get_file_path(int pathId); -void get_system_info(); -void get_system_time(); -void get_local_time(); void rct2_quit(); int rct2_open_file(const char *path); diff --git a/src/scenario.c b/src/scenario.c index 41e7709486..2615039b2c 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -517,7 +517,6 @@ static void scenario_day_update() { finance_update_daily_profit(); peep_update_days_in_queue(); - get_local_time(); switch (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)) { case OBJECTIVE_10_ROLLERCOASTERS: case OBJECTIVE_GUESTS_AND_RATING: