From 44a48624669c78eb322442ae709f79948d28e948 Mon Sep 17 00:00:00 2001 From: Duncan Date: Mon, 29 Sep 2014 12:58:48 +0100 Subject: [PATCH] Small refactoring of load packed --- src/object_list.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/object_list.c b/src/object_list.c index b84c6757c2..0c759b6d87 100644 --- a/src/object_list.c +++ b/src/object_list.c @@ -34,6 +34,7 @@ typedef struct { uint32 var_10; } rct_plugin_header; +// 98DA00 int object_entry_group_counts[] = { 128, // rides 252, // small scenery @@ -235,21 +236,23 @@ int object_load_packed(FILE *file) } int type = entry->flags & 0x0F; - int ecx = 0; + + // ecx + int entryGroupIndex = 0; - for (; ecx < RCT2_ADDRESS(0x98DA00, uint16)[type]; ecx++){ - if (RCT2_ADDRESS(0x98D97C, uint32*)[type * 2][ecx] == -1){ + for (; entryGroupIndex < object_entry_group_counts[type]; entryGroupIndex++){ + if (RCT2_ADDRESS(0x98D97C, uint32*)[type * 2][entryGroupIndex] == -1){ break; } } - if (ecx == RCT2_ADDRESS(0x98DA00, uint16)[type]){ + if (entryGroupIndex == object_entry_group_counts[type]){ rct2_free(chunk); return 0; } - RCT2_ADDRESS(0x98D97C, uint8**)[type * 2][ecx] = chunk; - int* edx = (int*)(ecx * 20 + RCT2_ADDRESS(0x98D980, uint32)[type * 2]); + RCT2_ADDRESS(0x98D97C, uint8**)[type * 2][entryGroupIndex] = chunk; + int* edx = (int*)(entryGroupIndex * 20 + RCT2_ADDRESS(0x98D980, uint32)[type * 2]); memcpy(edx, (int*)entry, 20); //6aa429 int eax = 1;//, ebx = 0, ecx = 0, edx = 0, esi = 0, edi = 0, ebp = 0;