1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

remove old redundant RCT2 platform code

This commit is contained in:
IntelOrca
2016-02-16 20:23:32 +00:00
parent 5cf0c4bd07
commit 38fda5debf
6 changed files with 1 additions and 141 deletions

View File

@@ -246,9 +246,7 @@ void update_palette_effects()
} }
} }
if (RCT2_GLOBAL(0x009E2C4C, uint32) == 2 || RCT2_GLOBAL(0x009E2C4C, uint32) == 1) { 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;
}
} }
} }

View File

@@ -110,39 +110,6 @@ static bool news_item_is_current_old()
*/ */
void news_item_update_current() 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 // Check if there is a current news item
if (news_item_is_queue_empty()) if (news_item_is_queue_empty())
return; return;

View File

@@ -215,7 +215,6 @@ bool openrct2_initialise()
// return false; // return false;
// } // }
get_system_info();
if (!gOpenRCT2Headless) { if (!gOpenRCT2Headless) {
audio_init(); audio_init();
audio_populate_devices(); audio_populate_devices();

View File

@@ -139,10 +139,7 @@ int rct2_init()
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) = 0; RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) = 0;
RCT2_GLOBAL(0x009AC310, char*) = RCT2_GLOBAL(RCT2_ADDRESS_CMDLINE, char*); RCT2_GLOBAL(0x009AC310, char*) = RCT2_GLOBAL(RCT2_ADDRESS_CMDLINE, char*);
get_system_time();
util_srand((unsigned int)time(0)); 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()) if (!rct2_init_directories())
return 0; return 0;
@@ -169,7 +166,6 @@ int rct2_init()
} }
viewport_init_all(); viewport_init_all();
news_item_init_queue(); news_item_init_queue();
get_local_time();
reset_park_entrances(); reset_park_entrances();
user_string_clear_all(); user_string_clear_all();
reset_sprite_list(); reset_sprite_list();
@@ -498,99 +494,3 @@ const utf8 *get_file_path(int pathId)
return path; 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;
}

View File

@@ -273,9 +273,6 @@ int check_file_paths();
int check_file_path(int pathId); int check_file_path(int pathId);
int check_files_integrity(); int check_files_integrity();
const char *get_file_path(int pathId); const char *get_file_path(int pathId);
void get_system_info();
void get_system_time();
void get_local_time();
void rct2_quit(); void rct2_quit();
int rct2_open_file(const char *path); int rct2_open_file(const char *path);

View File

@@ -517,7 +517,6 @@ static void scenario_day_update()
{ {
finance_update_daily_profit(); finance_update_daily_profit();
peep_update_days_in_queue(); peep_update_days_in_queue();
get_local_time();
switch (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)) { switch (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)) {
case OBJECTIVE_10_ROLLERCOASTERS: case OBJECTIVE_10_ROLLERCOASTERS:
case OBJECTIVE_GUESTS_AND_RATING: case OBJECTIVE_GUESTS_AND_RATING: