From c8d2b0bf1e772793f52767992cd52309a715a803 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Wed, 9 Apr 2014 11:16:35 +0100 Subject: [PATCH] add climate and date --- projects/openrct2.vcxproj | 4 +++ projects/openrct2.vcxproj.filters | 12 +++++++++ src/addresses.h | 9 +++++++ src/climate.c | 45 +++++++++++++++++++++++++++++++ src/climate.h | 33 +++++++++++++++++++++++ src/date.c | 44 ++++++++++++++++++++++++++++++ src/date.h | 39 +++++++++++++++++++++++++++ src/game.c | 20 +++++--------- src/map.c | 7 +++-- src/scenario.h | 15 +++++++++++ src/sprites.h | 5 ++++ 11 files changed, 218 insertions(+), 15 deletions(-) create mode 100644 src/climate.c create mode 100644 src/climate.h create mode 100644 src/date.c create mode 100644 src/date.h diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 56ab9fdb86..047ba6b438 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -17,7 +17,9 @@ + + @@ -40,7 +42,9 @@ + + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index eee61d36e7..b9925fc1a7 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -84,6 +84,12 @@ Header Files + + Header Files + + + Header Files + @@ -155,6 +161,12 @@ Source Files + + Source Files + + + Source Files + diff --git a/src/addresses.h b/src/addresses.h index a2f3791117..1aa5613b20 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -83,6 +83,9 @@ #define RCT2_ADDRESS_G1_ELEMENTS 0x009EBD28 +#define RCT2_ADDRESS_CURRENT_MONTH_YEAR 0x00F663A8 +#define RCT2_ADDRESS_CURRENT_DAY 0x00F663AA + #define RCT2_ADDRESS_MAP_ELEMENTS 0x00F663B8 #define RCT2_ADDRESS_SPRITE_LIST 0x010E63BC @@ -99,9 +102,15 @@ #define RCT2_ADDRESS_MAP_SIZE 0x01358834 +#define RCT2_ADDRESS_CURRENT_TICKS 0x013628F4 #define RCT2_ADDRESS_RIDE_LIST 0x013628F8 #define RCT2_ADDRESS_RIDE_MEASUREMENTS 0x0138B60C +#define RCT2_ADDRESS_CLIMATE 0x013CA746 +#define RCT2_ADDRESS_CURRENT_WEATHER 0x013CA74A +#define RCT2_ADDRESS_NEXT_WEATHER 0x013CA74B +#define RCT2_ADDRESS_CURRENT_TEMPERATURE 0x013CA74C + #define RCT2_ADDRESS_NEWS_ITEM_LIST 0x013CA754 #define RCT2_ADDRESS_SCENARIO_NAME 0x0141F5B8 diff --git a/src/climate.c b/src/climate.c new file mode 100644 index 0000000000..e4fe9896bb --- /dev/null +++ b/src/climate.c @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of OpenRCT2. + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + +#include "addresses.h" +#include "date.h" +#include "rct2.h" + +/** + * + * rct2: 0x006C45ED + */ +void climate_reset(int climate) +{ + int eax, ebx, ecx, edx, esi, edi, ebp; + + RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE, sint8) = climate; + + eax = 1; + RCT2_CALLFUNC_X(0x006C4672, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); + + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_WEATHER, sint8) = eax & 0xFF; + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TEMPERATURE, sint8) = ebx & 0xFF; + + RCT2_GLOBAL(0x013CA74E, sint8) = (ebx >> 8) & 0xFF; + RCT2_GLOBAL(0x013CA750, sint8) = ecx & 0xFF; + RCT2_GLOBAL(0x013CA752, sint8) = (ecx >> 8) & 0xFF; + RCT2_CALLPROC_X(0x6C461C, 0, 0, 0, 0, 0, 0, 0); +} \ No newline at end of file diff --git a/src/climate.h b/src/climate.h new file mode 100644 index 0000000000..8d00c71f40 --- /dev/null +++ b/src/climate.h @@ -0,0 +1,33 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of OpenRCT2. + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + +#ifndef _CLIMATE_H_ +#define _CLIMATE_H_ + +enum { + CLIMATE_COOL_AND_WET, + CLIMATE_WARM, + CLIMATE_HOT_AND_DRY, + CLIMATE_COLD +}; + +void climate_reset(int climate); + +#endif \ No newline at end of file diff --git a/src/date.c b/src/date.c new file mode 100644 index 0000000000..4ad43362d9 --- /dev/null +++ b/src/date.c @@ -0,0 +1,44 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of OpenRCT2. + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + +#include "addresses.h" +#include "date.h" +#include "rct2.h" + +int date_get_month(int months) +{ + return months % MONTH_COUNT; +} + +int date_get_year(int months) +{ + return months / MONTH_COUNT; +} + +/** + * + * rct2: 0x006C4494 + */ +void date_reset() +{ + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) = MONTH_MARCH; + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_DAY, sint16) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, sint32) = 0; +} \ No newline at end of file diff --git a/src/date.h b/src/date.h new file mode 100644 index 0000000000..e50d74ffaa --- /dev/null +++ b/src/date.h @@ -0,0 +1,39 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of OpenRCT2. + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + +#ifndef _DATE_H_ +#define _DATE_H_ + +enum { + MONTH_MARCH, + MONTH_APRIL, + MONTH_MAY, + MONTH_JUNE, + MONTH_JULY, + MONTH_AUGUST, + MONTH_SEPTEMBER, + MONTH_OCTOBER, + + MONTH_COUNT +}; + +void date_reset(); + +#endif \ No newline at end of file diff --git a/src/game.c b/src/game.c index 10344b06ed..4e9f8e78b7 100644 --- a/src/game.c +++ b/src/game.c @@ -109,29 +109,23 @@ void game_logic_update() RCT2_GLOBAL(0x009DEA66, sint16)--; RCT2_CALLPROC_EBPSAFE(0x0068B089); - RCT2_CALLPROC_EBPSAFE(0x006C44B1); - RCT2_CALLPROC_EBPSAFE(0x006C46B1); + RCT2_CALLPROC_EBPSAFE(0x006C44B1); // update_objective + RCT2_CALLPROC_EBPSAFE(0x006C46B1); // update_climate RCT2_CALLPROC_EBPSAFE(0x006646E1); RCT2_CALLPROC_EBPSAFE(0x006A876D); - peep_update_all(); - - // update ride - RCT2_CALLPROC_EBPSAFE(0x006D4204); - - // update text effects - RCT2_CALLPROC_EBPSAFE(0x00672AA4); - RCT2_CALLPROC_EBPSAFE(0x006ABE4C); - RCT2_CALLPROC_EBPSAFE(0x006674F7); + RCT2_CALLPROC_EBPSAFE(0x006D4204); // update vehicles + RCT2_CALLPROC_EBPSAFE(0x00672AA4); // update text effects + RCT2_CALLPROC_EBPSAFE(0x006ABE4C); // update rides + RCT2_CALLPROC_EBPSAFE(0x006674F7); // update park RCT2_CALLPROC_EBPSAFE(0x00684C7A); RCT2_CALLPROC_EBPSAFE(0x006B5A2A); - RCT2_CALLPROC_EBPSAFE(0x006B6456); + RCT2_CALLPROC_EBPSAFE(0x006B6456); // update ride measurements RCT2_CALLPROC_EBPSAFE(0x0068AFAD); RCT2_CALLPROC_EBPSAFE(0x006BBC6B); RCT2_CALLPROC_EBPSAFE(0x006BD18A); RCT2_CALLPROC_EBPSAFE(0x006BCB91); RCT2_CALLPROC_EBPSAFE(0x006BD0F8); - news_item_update_current(); RCT2_CALLPROC_EBPSAFE(0x0067009A); diff --git a/src/map.c b/src/map.c index 4eb36b1da8..276a770162 100644 --- a/src/map.c +++ b/src/map.c @@ -19,6 +19,8 @@ *****************************************************************************/ #include "addresses.h" +#include "climate.h" +#include "date.h" #include "map.h" #define GET_MAP_ELEMENT(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element)[x])) @@ -32,7 +34,7 @@ void map_init() int i; rct_map_element *map_element; - RCT2_CALLPROC_EBPSAFE(0x006C4494); // date_init(); + date_reset(); RCT2_GLOBAL(0x0138B580, sint16) = 0; RCT2_GLOBAL(0x010E63B8, sint32) = 0; @@ -58,5 +60,6 @@ void map_init() RCT2_GLOBAL(0x01359208, sint16) = 7; RCT2_CALLPROC_EBPSAFE(0x0068AFFD); RCT2_CALLPROC_EBPSAFE(0x0068ADBC); - RCT2_CALLPROC_X(0x006C45ED, 1, 0, 0, 0, 0, 0, 0); // init_climate_and_date + + climate_reset(CLIMATE_WARM); } \ No newline at end of file diff --git a/src/scenario.h b/src/scenario.h index 185dab89f0..e1006cd768 100644 --- a/src/scenario.h +++ b/src/scenario.h @@ -42,6 +42,21 @@ typedef struct { sint8 var_0270[64]; } rct_scenario_basic; +enum { + OBJECTIVE_NONE, + OBJECTIVE_GUESTS_BY, + OBJECTIVE_PARK_VALUE_BY, + OBJECTIVE_HAVE_FUN, + OBJECTIVE_BUILD_THE_BEST, + OBJECTIVE_10_ROLLERCOASTERS, + OBJECTIVE_GUESTS_AND_RATING, + OBJECTIVE_MONTHLY_RIDE_INCOME, + OBJECTIVE_10_ROLLERCOASTERS_LENGTH, + OBJECTIVE_FINISH_5_ROLLERCOASTERS, + OBJECTIVE_REPLAY_LOAN_AND_PARK_VALUE, + OBJECTIVE_MONTHLY_FOOD_INCOME +}; + void scenario_load_list(); #endif \ No newline at end of file diff --git a/src/sprites.h b/src/sprites.h index c04072bb17..52b199bd5d 100644 --- a/src/sprites.h +++ b/src/sprites.h @@ -24,6 +24,11 @@ enum { SPR_NONE = -1, + SPR_COOL_AND_WET = 3290, + SPR_WARM = 3291, + SPR_HOT_AND_DRY = 3292, + SPR_COLD = 3293, + SPR_RESIZE = 5058, SPR_HEARING_VIEWPORT = 5166,