mirror of https://github.com/OpenRCT2/OpenRCT2.git
Crude start of a decompiled update_climate()
This commit is contained in:
parent
f50c2a4445
commit
035fa16fc3
|
@ -168,6 +168,7 @@
|
|||
#define RCT2_ADDRESS_CURRENT_WEATHER 0x013CA74A
|
||||
#define RCT2_ADDRESS_NEXT_WEATHER 0x013CA74B
|
||||
#define RCT2_ADDRESS_CURRENT_TEMPERATURE 0x013CA74C
|
||||
#define RCT2_ADDRESS_CLIMATE_UPDATE_TIMER 0x013CA748
|
||||
|
||||
#define RCT2_ADDRESS_NEWS_ITEM_LIST 0x013CA754
|
||||
|
||||
|
|
|
@ -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?
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,5 +30,6 @@ enum {
|
|||
|
||||
int climate_celcius_to_fahrenheit(int celcius);
|
||||
void climate_reset(int climate);
|
||||
void update_climate();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "addresses.h"
|
||||
#include "audio.h"
|
||||
#include "climate.h"
|
||||
#include "config.h"
|
||||
#include "rct2.h"
|
||||
#include "game.h"
|
||||
|
@ -136,7 +137,8 @@ void game_logic_update()
|
|||
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068B089);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006C44B1); // update_objective
|
||||
RCT2_CALLPROC_EBPSAFE(0x006C46B1); // update_climate
|
||||
//RCT2_CALLPROC_EBPSAFE(0x006C46B1); // update_climate
|
||||
update_climate();
|
||||
RCT2_CALLPROC_EBPSAFE(0x006646E1);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006A876D);
|
||||
peep_update_all();
|
||||
|
|
|
@ -484,7 +484,7 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi,
|
|||
|
||||
// Next weather
|
||||
if (((int*)0x00993C98)[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_WEATHER, sint8) * 2] != ((int*)0x00993C98)[RCT2_GLOBAL(RCT2_ADDRESS_NEXT_WEATHER, sint8) * 2]) {
|
||||
if (RCT2_GLOBAL(0x013CA748, sint16) < 960) {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE_UPDATE_TIMER, sint16) < 960) {
|
||||
gfx_draw_sprite(dpi, SPR_NEXT_WEATHER, x + 27, y + 5);
|
||||
gfx_draw_sprite(dpi, ((int*)0x00993C98)[RCT2_GLOBAL(RCT2_ADDRESS_NEXT_WEATHER, sint8) * 2], x + 40, y);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue