1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 00:34:46 +01:00

implement steam_particle_create

This commit is contained in:
IntelOrca
2015-12-20 12:50:33 +00:00
parent 09ac928fd6
commit c2c41ec118
3 changed files with 115 additions and 69 deletions

View File

@@ -101,6 +101,57 @@ const uint8 DoorCloseSoundIds[] = {
SOUND_62
};
static const struct { sint8 x, y, z; } SteamParticleOffsets[] = {
{ -11, 0, 22 },
{ -10, 4, 22 },
{ -8, 8, 22 },
{ -4, 10, 22 },
{ 0, 11, 22 },
{ 4, 10, 22 },
{ 8, 8, 22 },
{ 10, 4, 22 },
{ 11, 0, 22 },
{ 10, -4, 22 },
{ 8, -8, 22 },
{ 4, -10, 22 },
{ 0, -11, 22 },
{ -4, -10, 22 },
{ -8, -8, 22 },
{ -10, -4, 22 },
{ -9, 0, 27 },
{ -8, 4, 27 },
{ -6, 6, 27 },
{ -4, 8, 27 },
{ 0, 9, 27 },
{ 4, 8, 27 },
{ 6, 6, 27 },
{ 8, 4, 27 },
{ 9, 0, 27 },
{ 8, -4, 27 },
{ 6, -6, 27 },
{ 4, -8, 27 },
{ 0, -9, 27 },
{ -4, -8, 27 },
{ -6, -6, 27 },
{ -8, -4, 27 },
{ -13, 0, 18 },
{ -12, 4, 17 },
{ -9, 9, 17 },
{ -4, 8, 17 },
{ 0, 13, 18 },
{ 4, 8, 17 },
{ 6, 6, 17 },
{ 8, 4, 17 },
{ 13, 0, 18 },
{ 8, -4, 17 },
{ 6, -6, 17 },
{ 4, -8, 17 },
{ 0, -13, 18 },
{ -4, -8, 17 },
{ -6, -6, 17 },
{ -8, -4, 17 }
};
void vehicle_invalidate(rct_vehicle *vehicle)
{
invalidate_sprite_2((rct_sprite*)vehicle);
@@ -5214,62 +5265,22 @@ static void vehicle_update_spinning_car(rct_vehicle *vehicle)
*
* rct2: 0x006734B2
*/
static void sub_6734B2(sint16 x, sint16 y, sint16 z)
static void steam_particle_create(sint16 x, sint16 y, sint16 z)
{
RCT2_CALLPROC_X(0x006734B2, x, 0, y, z, 0, 0, 0);
rct_map_element *mapElement = map_get_surface_element_at(x >> 5, y >> 5);
if (mapElement != NULL && z > mapElement->base_height * 8) {
rct_steam_particle *steam = (rct_steam_particle*)create_sprite(2);
steam->sprite_width = 20;
steam->sprite_height_negative = 18;
steam->sprite_height_positive = 16;
steam->sprite_identifier = SPRITE_IDENTIFIER_MISC;
steam->misc_identifier = SPRITE_MISC_STEAM_PARTICLE;
steam->var_26 = 256;
steam->var_24 = 0;
sprite_move(x, y, z, (rct_sprite*)steam);
}
}
static const struct { sint8 x, y, z; } byte_9A3A20[] = {
{ -11, 0, 22 },
{ -10, 4, 22 },
{ -8, 8, 22 },
{ -4, 10, 22 },
{ 0, 11, 22 },
{ 4, 10, 22 },
{ 8, 8, 22 },
{ 10, 4, 22 },
{ 11, 0, 22 },
{ 10, -4, 22 },
{ 8, -8, 22 },
{ 4, -10, 22 },
{ 0, -11, 22 },
{ -4, -10, 22 },
{ -8, -8, 22 },
{ -10, -4, 22 },
{ -9, 0, 27 },
{ -8, 4, 27 },
{ -6, 6, 27 },
{ -4, 8, 27 },
{ 0, 9, 27 },
{ 4, 8, 27 },
{ 6, 6, 27 },
{ 8, 4, 27 },
{ 9, 0, 27 },
{ 8, -4, 27 },
{ 6, -6, 27 },
{ 4, -8, 27 },
{ 0, -9, 27 },
{ -4, -8, 27 },
{ -6, -6, 27 },
{ -8, -4, 27 },
{ -13, 0, 18 },
{ -12, 4, 17 },
{ -9, 9, 17 },
{ -4, 8, 17 },
{ 0, 13, 18 },
{ 4, 8, 17 },
{ 6, 6, 17 },
{ 8, 4, 17 },
{ 13, 0, 18 },
{ 8, -4, 17 },
{ 6, -6, 17 },
{ 4, -8, 17 },
{ 0, -13, 18 },
{ -4, -8, 17 },
{ -6, -6, 17 },
{ -8, -4, 17 }
};
/**
*
* rct2: 0x006D63D4
@@ -5304,10 +5315,10 @@ static void sub_6D63D4(rct_vehicle *vehicle)
if (vehicle->var_1F == 6) {
index += 32;
}
sub_6734B2(
vehicle->x + byte_9A3A20[index].x,
vehicle->y + byte_9A3A20[index].y,
vehicle->z + byte_9A3A20[index].z
steam_particle_create(
vehicle->x + SteamParticleOffsets[index].x,
vehicle->y + SteamParticleOffsets[index].y,
vehicle->z + SteamParticleOffsets[index].z
);
}
}

View File

@@ -273,18 +273,23 @@ void move_sprite_to_list(rct_sprite *sprite, uint8 cl)
*
* rct2: 0x00673200
*/
static void sprite_misc_0_update(rct_sprite *sprite)
static void sprite_steam_particle_update(rct_steam_particle *steam)
{
invalidate_sprite_2(sprite);
invalidate_sprite_2((rct_sprite*)steam);
int original_var24 = sprite->unknown.var_24;
sprite->unknown.var_24 += 0x5555;
if (sprite->unknown.var_24 < 0x5555) {
sprite_move(sprite->unknown.x, sprite->unknown.y, sprite->unknown.z + 1, sprite);
int original_var24 = steam->var_24;
steam->var_24 += 0x5555;
if (steam->var_24 < 0x5555) {
sprite_move(
steam->x,
steam->y,
steam->z + 1,
(rct_sprite*)steam
);
}
sprite->unknown.var_26 += 64;
if (sprite->unknown.var_26 >= (56 * 64)) {
sprite_remove(sprite);
steam->var_26 += 64;
if (steam->var_26 >= (56 * 64)) {
sprite_remove((rct_sprite*)steam);
}
}
@@ -357,8 +362,8 @@ static void sprite_misc_5_update(rct_sprite *sprite)
void sprite_misc_update(rct_sprite *sprite)
{
switch (sprite->unknown.misc_identifier) {
case SPRITE_MISC_0:
sprite_misc_0_update(sprite);
case SPRITE_MISC_STEAM_PARTICLE:
sprite_steam_particle_update((rct_steam_particle*)sprite);
break;
case SPRITE_MISC_MONEY_EFFECT:
money_effect_update(&sprite->money_effect);

View File

@@ -282,6 +282,35 @@ typedef struct {
uint16 var_26;
} rct_crash_splash;
typedef struct {
uint8 sprite_identifier; // 0x00
uint8 misc_identifier; // 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 var_0C;
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 pad_1F[3]; // 0x1F
uint16 name_string_idx; // 0x22
uint16 var_24;
uint16 var_26;
} rct_steam_particle;
/**
* Sprite structure.
* size: 0x0100
@@ -298,10 +327,11 @@ typedef union {
rct_money_effect money_effect;
rct_crashed_vehicle_particle crashed_vehicle_particle;
rct_crash_splash crash_splash;
rct_steam_particle steam_particle;
} rct_sprite;
enum {
SPRITE_MISC_0,
SPRITE_MISC_STEAM_PARTICLE,
SPRITE_MISC_MONEY_EFFECT,
SPRITE_MISC_CRASHED_VEHICLE_PARTICLE,
SPRITE_MISC_3, // (related to vehicle crash, probably crash particles)