From ff12c2b3266bfa1527e39b6b7b507801f36852d5 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 20 Aug 2016 22:38:50 +0100 Subject: [PATCH] Integrate animation objects --- src/addresses.h | 2 +- src/rct2/S6Exporter.cpp | 1 - src/rct2/S6Importer.cpp | 1 - src/scenario.h | 3 +-- src/world/map_animation.c | 5 +++-- src/world/map_animation.h | 5 +++-- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 0913d78a5a..8d11c8338c 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -250,7 +250,6 @@ #define RCT2_ADDRESS_SAVED_VIEW_ZOOM 0x0138869E #define RCT2_ADDRESS_SAVED_VIEW_ROTATION 0x0138869F #define RCT2_ADDRESS_SCENARIO_COMPLETED_BY 0x013587D8 -#define RCT2_ADDRESS_NUM_MAP_ANIMATIONS 0x0138B580 #define RCT2_ADDRESS_RIDE_MEASUREMENTS 0x0138B60C #define RCT2_ADDRESS_GRASS_SCENERY_TILEPOS 0x013B0E70 @@ -589,6 +588,7 @@ #define RCT2_ADDRESS_PARK_SIZE 0x013580EA #define RCT2_ADDRESS_LAND_COST 0x01358770 #define RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST 0x01358772 +#define RCT2_ADDRESS_NUM_MAP_ANIMATIONS 0x0138B580 #define RCT2_ADDRESS_CLIMATE 0x013CA746 #define RCT2_ADDRESS_CURRENT_WEATHER 0x013CA74A diff --git a/src/rct2/S6Exporter.cpp b/src/rct2/S6Exporter.cpp index d2e8ffacc5..17c246eaf5 100644 --- a/src/rct2/S6Exporter.cpp +++ b/src/rct2/S6Exporter.cpp @@ -393,7 +393,6 @@ void S6Exporter::Export() _s6.saved_view_zoom = gSavedViewZoom; _s6.saved_view_rotation = gSavedViewRotation; memcpy(_s6.map_animations, gAnimatedObjects, sizeof(_s6.map_animations)); - // rct1_map_animations _s6.num_map_animations = gNumMapAnimations; // pad_0138B582 diff --git a/src/rct2/S6Importer.cpp b/src/rct2/S6Importer.cpp index 62446487fa..b116930db9 100644 --- a/src/rct2/S6Importer.cpp +++ b/src/rct2/S6Importer.cpp @@ -311,7 +311,6 @@ void S6Importer::Import() gSavedViewZoom = _s6.saved_view_zoom; gSavedViewRotation = _s6.saved_view_rotation; memcpy(gAnimatedObjects, _s6.map_animations, sizeof(_s6.map_animations)); - // rct1_map_animations gNumMapAnimations = _s6.num_map_animations; // pad_0138B582 diff --git a/src/scenario.h b/src/scenario.h index 1b62b5133a..f336e1af89 100644 --- a/src/scenario.h +++ b/src/scenario.h @@ -293,8 +293,7 @@ typedef struct rct_s6_data { uint16 saved_view_y; uint8 saved_view_zoom; uint8 saved_view_rotation; - rct_map_animation map_animations[1000]; - rct_map_animation rct1_map_animations[1000]; + rct_map_animation map_animations[2000]; uint16 num_map_animations; uint8 pad_0138B582[2]; rct_ride_rating_calc_data ride_ratings_calc_data; diff --git a/src/world/map_animation.c b/src/world/map_animation.c index 81c7a49f7f..072f9ba677 100644 --- a/src/world/map_animation.c +++ b/src/world/map_animation.c @@ -31,7 +31,8 @@ static bool map_animation_invalidate(rct_map_animation *obj); static const map_animation_invalidate_event_handler _animatedObjectEventHandlers[MAP_ANIMATION_TYPE_COUNT]; -rct_map_animation *gAnimatedObjects = RCT2_ADDRESS(0x013886A0, rct_map_animation); +uint16 gNumMapAnimations; +rct_map_animation gAnimatedObjects[MAX_ANIMATED_OBJECTS]; /** * @@ -46,7 +47,7 @@ void map_animation_create(int type, int x, int y, int z) { rct_map_animation *aobj = &gAnimatedObjects[0]; int numAnimatedObjects = gNumMapAnimations; - if (numAnimatedObjects >= 2000) { + if (numAnimatedObjects >= MAX_ANIMATED_OBJECTS) { log_error("Exceeded the maximum number of animations"); return; } diff --git a/src/world/map_animation.h b/src/world/map_animation.h index 6f1a2f0353..d0d7e8253d 100644 --- a/src/world/map_animation.h +++ b/src/world/map_animation.h @@ -51,9 +51,10 @@ enum { MAP_ANIMATION_TYPE_COUNT }; -#define gNumMapAnimations RCT2_GLOBAL(RCT2_ADDRESS_NUM_MAP_ANIMATIONS, uint16) +#define MAX_ANIMATED_OBJECTS 2000 -extern rct_map_animation *gAnimatedObjects; +extern uint16 gNumMapAnimations; +extern rct_map_animation gAnimatedObjects[MAX_ANIMATED_OBJECTS]; void map_animation_create(int type, int x, int y, int z); void map_animation_invalidate_all();