mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-26 08:14:38 +01:00
Crude start of a decompiled update_climate()
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "addresses.h"
|
||||
#include "date.h"
|
||||
#include "gfx.h"
|
||||
#include "rct2.h"
|
||||
|
||||
int climate_celcius_to_fahrenheit(int celcius)
|
||||
@@ -48,3 +49,66 @@ void climate_reset(int climate)
|
||||
RCT2_GLOBAL(0x013CA752, sint8) = (ecx >> 8) & 0xFF;
|
||||
RCT2_CALLPROC_X(0x6C461C, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006C46B1
|
||||
**/
|
||||
void update_climate()
|
||||
{
|
||||
uint8 screen_flags = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8);
|
||||
if (screen_flags & (~SCREEN_FLAGS_PLAYING)) // only normal play mode gets climate
|
||||
return;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE_UPDATE_TIMER, sint16)) {
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE_UPDATE_TIMER, sint16) == 960)
|
||||
RCT2_GLOBAL(0x009A9804, uint32) |= 8; // XXX climate dirty flag?
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE_UPDATE_TIMER, sint16)--;
|
||||
|
||||
} else if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, sint32) & 0x7F)) {
|
||||
sint8 temperature = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TEMPERATURE, sint8);
|
||||
sint8 target_temperature = RCT2_GLOBAL(0x013CA74D, sint8);
|
||||
|
||||
if (temperature == target_temperature) {
|
||||
if (RCT2_GLOBAL(0x013CA750, sint8) == RCT2_GLOBAL(0x013CA751, sint8)) {
|
||||
|
||||
RCT2_GLOBAL(0x013CA74E, sint8) = RCT2_GLOBAL(0x013CA74F, sint8);
|
||||
|
||||
if (RCT2_GLOBAL(0x013CA752, sint8) == RCT2_GLOBAL(0x013CA753, sint8)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_WEATHER, sint8) = RCT2_GLOBAL(RCT2_ADDRESS_NEXT_WEATHER, sint8);
|
||||
RCT2_CALLPROC(0x006C461C);
|
||||
RCT2_GLOBAL(0x009A9804, uint32) |= 8; // XXX climate dirty flag?
|
||||
}
|
||||
else {
|
||||
if (RCT2_GLOBAL(0x013CA753, sint8) == 3)
|
||||
RCT2_GLOBAL(0x013CA752, sint8) = 3;
|
||||
else {
|
||||
sint8 next = RCT2_GLOBAL(0x013CA752, sint8) + 1;
|
||||
|
||||
if (RCT2_GLOBAL(0x013CA752, sint8) > RCT2_GLOBAL(0x013CA753, sint8))
|
||||
next = RCT2_GLOBAL(0x013CA752, sint8) - 1;
|
||||
RCT2_GLOBAL(0x013CA752, sint8) = next;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sint8 next = RCT2_GLOBAL(0x013CA750, sint8) + 1;
|
||||
|
||||
if (RCT2_GLOBAL(0x013CA750, sint8) > RCT2_GLOBAL(0x013CA751, sint8))
|
||||
next = RCT2_GLOBAL(0x013CA750, sint8) - 1;
|
||||
RCT2_GLOBAL(0x013CA750, sint8) = next;
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
|
||||
} else {
|
||||
sint8 newtemp = temperature + 1;
|
||||
if (temperature > target_temperature)
|
||||
newtemp = temperature - 1;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TEMPERATURE, sint8) = newtemp;
|
||||
RCT2_GLOBAL(0x009A9804, uint32) |= 8; // XXX climate dirty flag?
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user