diff --git a/src/openrct2/rct1.h b/src/openrct2/rct1.h index 7f5cea7803..744f17e57d 100644 --- a/src/openrct2/rct1.h +++ b/src/openrct2/rct1.h @@ -25,6 +25,7 @@ #include "world/banner.h" #include "world/map.h" #include "world/sprite.h" +#include "world/map_animation.h" #define RCT1_MAX_MAP_ELEMENTS 0xC000 #define RCT1_MAX_SPRITES 5000 @@ -33,6 +34,7 @@ #define RCT1_MAX_RIDES_IN_PARK 128 #define RCT1_MAX_STAFF 116 #define RCT1_RESEARCH_FLAGS_SEPARATOR 0xFF +#define RCT1_MAX_ANIMATED_OBJECTS 1000 typedef struct ParkLoadResult ParkLoadResult; @@ -712,7 +714,7 @@ typedef struct rct1_s4 { uint16 view_y; uint8 view_zoom; uint8 view_rotation; - uint8 map_animations[6000]; + rct_map_animation map_animations[RCT1_MAX_ANIMATED_OBJECTS]; uint32 num_map_animations; uint8 unk_1CADBC[12]; uint16 scrolling_text_step; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index e13b5a55a3..dce8ba53e0 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1702,8 +1702,8 @@ private: void ImportMapAnimations() { // This is sketchy, ideally we should try to re-create them - rct_map_animation * s4Animations = (rct_map_animation*)_s4.map_animations; - for (size_t i = 0; i < 1000; i++) + rct_map_animation * s4Animations = _s4.map_animations; + for (size_t i = 0; i < RCT1_MAX_ANIMATED_OBJECTS; i++) { gAnimatedObjects[i] = s4Animations[i]; gAnimatedObjects[i].baseZ /= 2; diff --git a/src/openrct2/rct2.h b/src/openrct2/rct2.h index 42ff524605..7af9ab7a2d 100644 --- a/src/openrct2/rct2.h +++ b/src/openrct2/rct2.h @@ -34,6 +34,7 @@ #define RCT2_CUSTOMER_HISTORY_SIZE 10 #define RCT2_MAX_SPRITES 10000 #define RCT2_MAX_MAP_ELEMENTS 0x30000 +#define RCT2_MAX_ANIMATED_OBJECTS 2000 typedef struct rct2_install_info { diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index c85816f78d..610fc1ccf0 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -358,7 +358,11 @@ public: gSavedViewY = _s6.saved_view_y; gSavedViewZoom = _s6.saved_view_zoom; gSavedViewRotation = _s6.saved_view_rotation; - memcpy(gAnimatedObjects, _s6.map_animations, sizeof(_s6.map_animations)); + + for (size_t i = 0; i < RCT2_MAX_ANIMATED_OBJECTS; i++) + { + gAnimatedObjects[i] = _s6.map_animations[i]; + } gNumMapAnimations = _s6.num_map_animations; // pad_0138B582 diff --git a/src/openrct2/scenario/scenario.h b/src/openrct2/scenario/scenario.h index 7d8d104994..f95b90af2a 100644 --- a/src/openrct2/scenario/scenario.h +++ b/src/openrct2/scenario/scenario.h @@ -262,7 +262,7 @@ typedef struct rct_s6_data { uint16 saved_view_y; uint8 saved_view_zoom; uint8 saved_view_rotation; - rct_map_animation map_animations[2000]; + rct_map_animation map_animations[RCT2_MAX_ANIMATED_OBJECTS]; uint16 num_map_animations; uint8 pad_0138B582[2]; rct_ride_rating_calc_data ride_ratings_calc_data;