Add beginnings of vehicle importing

This commit is contained in:
Ted John 2017-01-06 12:24:40 +00:00
parent b6b981b826
commit 7a4ca989ba
2 changed files with 63 additions and 0 deletions

View File

@ -213,6 +213,40 @@ typedef struct rct1_unk_sprite {
uint8 var_71;
} rct1_unk_sprite;
typedef struct rct1_vehicle {
uint8 sprite_identifier; // 0x00
uint8 is_child; // 0x01
uint16 next_in_quadrant; // 0x02
uint16 next; // 0x04
uint16 previous; // 0x06
uint8 linked_list_type_offset; // 0x08 Valid values are SPRITE_LINKEDLIST_OFFSET_...
// Height from center of sprite to bottom
uint8 sprite_height_negative; // 0x09
uint16 sprite_index; // 0x0A
uint16 flags; // 0x0C
sint16 x; // 0x0E
sint16 y; // 0x10
sint16 z; // 0x12
// Width from center of sprite to edge
uint8 sprite_width; // 0x14
// Height from center of sprite to top
uint8 sprite_height_positive; // 0x15
sint16 sprite_left; // 0x16
sint16 sprite_top; // 0x18
sint16 sprite_right; // 0x1A
sint16 sprite_bottom; // 0x1C
uint8 sprite_direction; // 0x1E
uint8 vehicle_sprite_type; // 0x1F
uint8 bank_rotation; // 0x20
uint8 pad_21[3];
sint32 remaining_distance; // 0x24
sint32 velocity; // 0x28
sint32 acceleration; // 0x2C
uint8 ride; // 0x30
uint8 vehicle_type; // 0x31
rct_vehicle_colour colours; // 0x32
} rct1_vehicle;
typedef struct rct1_peep {
uint8 sprite_identifier; // 0x00
uint8 misc_identifier; // 0x01
@ -405,6 +439,7 @@ enum RCT1_PEEP_SPRITE_TYPE {
typedef union rct1_sprite {
uint8 pad_00[0x100];
rct1_unk_sprite unknown;
rct1_vehicle vehicle;
rct1_peep peep;
rct_litter litter;
rct_balloon balloon;

View File

@ -786,11 +786,39 @@ private:
void ImportSprites()
{
ImportVehicles();
ImportPeeps();
ImportLitter();
ImportMiscSprites();
}
void ImportVehicles()
{
for (int i = 0; i < RCT1_MAX_SPRITES; i++)
{
if (_s4.sprites[i].unknown.sprite_identifier == SPRITE_IDENTIFIER_VEHICLE)
{
rct1_vehicle * srcVehicle = &_s4.sprites[i].vehicle;
if (srcVehicle->x != (sint16)0x8000)
{
rct_vehicle * vehicle = (rct_vehicle *)create_sprite(SPRITE_IDENTIFIER_VEHICLE);
move_sprite_to_list((rct_sprite *)vehicle, SPRITE_LIST_VEHICLE * 2);
ImportVehicle(vehicle, srcVehicle);
}
}
}
}
void ImportVehicle(rct_vehicle * dst, rct1_vehicle * src)
{
dst->sprite_identifier = SPRITE_IDENTIFIER_VEHICLE;
dst->ride = src->ride;
sprite_move(src->x, src->y, src->z, (rct_sprite *)dst);
invalidate_sprite_2((rct_sprite *)dst);
}
void ImportPeeps()
{
for (size_t i = 0; i < RCT1_MAX_SPRITES; i++)