Merge pull request #3951 from janisozaur/revert-3897

Revert #3897
This commit is contained in:
Ted John 2016-06-24 23:40:25 +01:00 committed by GitHub
commit 2e3500ee6b
13 changed files with 265 additions and 1205 deletions

View File

@ -144,7 +144,7 @@ void load_palette(){
uint32 palette = 0x5FC;
if ((uintptr_t)water_type != (uint32)-1){
if ((sint32)water_type != -1){
palette = water_type->image_id;
}

View File

@ -24,9 +24,8 @@
#ifndef NO_RCT2
#pragma pack(push, 1)
#endif
// Size: 0x10 or more
typedef struct {
// Size: 0x10
typedef struct rct_g1_element {
uint8* offset; // 0x00
sint16 width; // 0x04
sint16 height; // 0x06
@ -60,17 +59,18 @@ assert_struct_size(rct_drawpixelinfo, 0x10);
// Size: 0x10
typedef struct rct_g1_element_32bit {
uint32 offset; // 0x00 note: uint32 always!
sint16 width; // 0x04
sint16 height; // 0x06
sint16 x_offset; // 0x08
sint16 y_offset; // 0x0A
uint16 flags; // 0x0C
uint16 zoomed_offset; // 0x0E
uint32 offset; // 0x00 note: uint32 always!
sint16 width; // 0x04
sint16 height; // 0x06
sint16 x_offset; // 0x08
sint16 y_offset; // 0x0A
uint16 flags; // 0x0C
uint16 zoomed_offset; // 0x0E
} rct_g1_element_32bit;
assert_struct_size(rct_g1_element_32bit, 0x10);
enum{
enum {
G1_FLAG_BMP = (1 << 0), //No invisible sections
G1_FLAG_RLE_COMPRESSION = (1<<2),
};

View File

@ -71,6 +71,20 @@ int gfx_load_g1()
* pointers to however long our machine wants them.
*/
#pragma pack(push, 1)
// Size: 0x10
typedef struct {
uint32 offset; // 0x00 note: uint32 always!
sint16 width; // 0x04
sint16 height; // 0x06
sint16 x_offset; // 0x08
sint16 y_offset; // 0x0A
uint16 flags; // 0x0C
uint16 zoomed_offset; // 0x0E
} rct_g1_element_32bit;
assert_struct_size(rct_g1_element_32bit, 0x10);
#pragma pack(pop)
/* number of elements is stored in g1.dat, but because the entry
* headers are static, this can't be variable until made into a
* dynamic array.
@ -91,9 +105,8 @@ int gfx_load_g1()
SDL_RWclose(file);
// Fix entry data offsets
for (i = 0; i < header.num_entries; i++) {
for (i = 0; i < header.num_entries; i++)
g1Elements[i].offset += (uintptr_t)_g1Buffer;
}
// Successful
return 1;

File diff suppressed because it is too large Load Diff

View File

@ -140,11 +140,10 @@ char *object_get_name(rct_object_entry *entry);
rct_object_filters *get_object_filter(int index);
uint8* object_load(int type, void *objectEntry, uint32 entryIndex, int *chunkSize);
bool object_load(int type, void *objectEntry, uint32 entryIndex);
void object_unload(int type, void *objectEntry);
bool object_test(int type, void *objectEntry);
void object_paint(int type, void *objectEntry, rct_drawpixelinfo *dpi, sint32 x, sint32 y);
rct_string_id object_desc(int type, void *objectEntry);
void object_reset(int type, void *objectEntry, uint32 entryIndex);
#endif

View File

@ -30,7 +30,7 @@
#include "world/scenery.h"
#include "world/water.h"
#define PLUGIN_VERSION 5
#define PLUGIN_VERSION 4
#define FILTER_VERSION 1
typedef struct rct_plugin_header {
@ -236,7 +236,7 @@ void reset_loaded_objects()
for (int j = 0; j < object_entry_group_counts[type]; j++){
uint8* chunk = object_entry_groups[type].chunks[j];
if (chunk != (uint8*)-1)
object_reset(type, chunk, j);
object_load(type, chunk, j);
}
}
}

View File

@ -571,7 +571,7 @@ bool openrct2_setup_rct2_segment()
}
#endif // defined(__unix__)
#if !defined(NO_RCT2) && !defined(__WINDOWS__)
#if !defined(NO_RCT2) || !defined(__WINDOWS__)
// Check that the expected data is at various addresses.
// Start at 0x9a6000, which is start of .data, to skip the region containing addresses to DLL
// calls, which can be changed by windows/wine loader.

View File

@ -78,11 +78,7 @@ bool rct1_read_sv4(const char *path, rct1_s4 *s4)
return success;
}
/**
* Only to be used when loading 32 bit items from files, otherwise use
* rideTypeShouldLoseSeparateFlag.
*/
bool rideTypeShouldLoseSeparateFlagByRideType(uint8 ride_type[3])
bool rideTypeShouldLoseSeparateFlag(rct_ride_entry *rideEntry)
{
if (!gConfigInterface.select_by_track_type) {
return false;
@ -90,21 +86,16 @@ bool rideTypeShouldLoseSeparateFlagByRideType(uint8 ride_type[3])
bool remove_flag = true;
for (int j = 0; j < 3; j++) {
if (ride_type_has_flag(ride_type[j], RIDE_TYPE_FLAG_FLAT_RIDE)) {
if (ride_type_has_flag(rideEntry->ride_type[j], RIDE_TYPE_FLAG_FLAT_RIDE)) {
remove_flag = false;
}
if (ride_type[j] == RIDE_TYPE_MAZE || ride_type[j] == RIDE_TYPE_MINI_GOLF) {
if (rideEntry->ride_type[j] == RIDE_TYPE_MAZE || rideEntry->ride_type[j] == RIDE_TYPE_MINI_GOLF) {
remove_flag = false;
}
}
return remove_flag;
}
bool rideTypeShouldLoseSeparateFlag(rct_ride_entry *rideEntry)
{
return rideTypeShouldLoseSeparateFlagByRideType(rideEntry->ride_type);
}
const uint8 gRideCategories[] = {
2, // Spiral Roller coaster
2, // Stand Up Coaster

View File

@ -746,7 +746,6 @@ void rct1_import_s4(rct1_s4 *s4);
void rct1_fix_landscape();
int vehicle_preference_compare(uint8 rideType, const char * a, const char * b);
bool rideTypeShouldLoseSeparateFlag(rct_ride_entry *rideEntry);
bool rideTypeShouldLoseSeparateFlagByRideType(uint8 ride_type[3]);
bool rct1_load_saved_game(const char *path);
bool rct1_load_scenario(const char *path);

View File

@ -31,7 +31,6 @@
#include "../management/news_item.h"
#include "../network/network.h"
#include "../object_list.h"
#include "../openrct2.h"
#include "../peep/peep.h"
#include "../peep/staff.h"
#include "../rct1.h"
@ -6923,10 +6922,8 @@ void set_vehicle_type_image_max_sizes(rct_ride_entry_vehicle* vehicle_type, int
.zoom_level = 0
};
if (!gOpenRCT2Headless) {
for (int i = 0; i < num_images; ++i){
gfx_draw_sprite_software(&dpi, vehicle_type->base_image_id + i, 0, 0, 0);
}
for (int i = 0; i < num_images; ++i){
gfx_draw_sprite_software(&dpi, vehicle_type->base_image_id + i, 0, 0, 0);
}
int al = -1;
for (int i = 99; i != 0; --i){

View File

@ -122,7 +122,9 @@ typedef struct rct_ride_entry {
uint8 shop_item; // 0x1C0
uint8 shop_item_secondary; // 0x1C1
} rct_ride_entry;
// FIXME: unpack
#ifdef PLATFORM_32BIT
assert_struct_size(rct_ride_entry, 0x1c2);
#endif
/**
* Ride structure.

View File

@ -77,7 +77,9 @@ typedef struct rct_ride_entry_vehicle {
uint8 special_frames; // 0x60 , 0x7A
sint8* peep_loading_positions; // 0x61 , 0x7B
} rct_ride_entry_vehicle;
// FIXME: unpack
#ifdef PLATFORM_32BIT
assert_struct_size(rct_ride_entry_vehicle, 0x65);
#endif
typedef struct rct_vehicle {
uint8 sprite_identifier; // 0x00

View File

@ -21,18 +21,20 @@
#include "../object.h"
#include "../world/map.h"
#pragma pack(push, 1)
typedef struct rct_small_scenery_entry {
uint32 flags; // 0x06
uint8 height; // 0x0A
uint8 tool_id; // 0x0B
sint16 price; // 0x0C
sint16 removal_price; // 0x0E
uintptr_t var_10;
uint32 var_10;
uint16 var_14;
uint16 var_16;
uint16 var_18;
uint8 scenery_tab_id; // 0x1A
} rct_small_scenery_entry;
assert_struct_size(rct_small_scenery_entry, 21);
typedef enum {
SMALL_SCENERY_FLAG_FULL_TILE = (1 << 0), // 0x1
@ -65,7 +67,6 @@ typedef enum {
SMALL_SCENERY_FLAG27 = (1 << 27), // 0x8000000
} SMALL_SCENERY_FLAGS;
#pragma pack(push, 1)
typedef struct rct_large_scenery_tile {
sint16 x_offset;
sint16 y_offset;
@ -103,7 +104,9 @@ typedef struct rct_large_scenery_entry {
rct_large_scenery_text* text; // 0x12
uint32 text_image; // 0x16
} rct_large_scenery_entry;
// FIXME: unpack
#ifdef PLATFORM_32BIT
assert_struct_size(rct_large_scenery_entry, 20);
#endif
typedef struct rct_wall_scenery_entry {
uint8 tool_id; // 0x06
@ -159,7 +162,9 @@ typedef struct rct_scenery_entry {
rct_banner_scenery_entry banner;
};
} rct_scenery_entry;
// FIXME: unpack?
#ifdef PLATFORM_32BIT
assert_struct_size(rct_scenery_entry, 6 + 21);
#endif
typedef struct rct_scenery_set_entry {
rct_string_id name; // 0x00