From 83aae61e34ed3ccc76052ebb1ee251eda3fcf04c Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Tue, 24 Mar 2015 16:48:38 +0000 Subject: [PATCH] implement sprite_misc_update --- src/world/fountain.c | 17 ++++++++++ src/world/fountain.h | 2 ++ src/world/sprite.c | 78 ++++++++++++++++++++++++++++++++++++-------- src/world/sprite.h | 10 ++++-- 4 files changed, 91 insertions(+), 16 deletions(-) diff --git a/src/world/fountain.c b/src/world/fountain.c index 89c024075c..e7583f9a6b 100644 --- a/src/world/fountain.c +++ b/src/world/fountain.c @@ -145,4 +145,21 @@ void jumping_fountain_create(int type, int x, int y, int z, uint16 bl, uint16 bh SPRITE_MISC_JUMPING_FOUNTAIN_SNOW : SPRITE_MISC_JUMPING_FOUNTAIN_WATER; jumpingFountain->var_26 = 0; +} + +/** + * + * rct: 0x006733CB (water) + * rct: 0x00673407 (snow) + */ +void jumping_fountain_update(rct_jumping_fountain *jumpingFountain) +{ + switch (jumpingFountain->misc_identifier) { + case SPRITE_MISC_JUMPING_FOUNTAIN_WATER: + RCT2_CALLPROC_X(0x006733CB, 0, 0, 0, 0, (int)jumpingFountain, 0, 0); + break; + case SPRITE_MISC_JUMPING_FOUNTAIN_SNOW: + RCT2_CALLPROC_X(0x00673407, 0, 0, 0, 0, (int)jumpingFountain, 0, 0); + break; + } } \ No newline at end of file diff --git a/src/world/fountain.h b/src/world/fountain.h index d47f1d78a5..9703d6e4f1 100644 --- a/src/world/fountain.h +++ b/src/world/fountain.h @@ -23,6 +23,7 @@ #include "../common.h" #include "map.h" +#include "sprite.h" enum { JUMPING_FOUNTAIN_TYPE_WATER, @@ -31,5 +32,6 @@ enum { void jumping_fountain_begin(int type, int x, int y, rct_map_element *mapElement); void jumping_fountain_create(int type, int x, int y, int z, uint16 bl, uint16 bh, uint16 bp); +void jumping_fountain_update(rct_jumping_fountain *jumpingFountain); #endif diff --git a/src/world/sprite.c b/src/world/sprite.c index f71a89667e..4016b0716b 100644 --- a/src/world/sprite.c +++ b/src/world/sprite.c @@ -20,8 +20,9 @@ #include "../addresses.h" #include "../interface/viewport.h" -#include "sprite.h" #include "../scenario.h" +#include "fountain.h" +#include "sprite.h" rct_sprite* g_sprite_list = RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite); @@ -46,6 +47,24 @@ void create_balloon(int x, int y, int z, int colour) } } +/** + * + * rct: 0x0067342C + */ +void balloon_update(rct_balloon *balloon) +{ + RCT2_CALLPROC_X(0x0067342C, 0, 0, 0, 0, (int)balloon, 0, 0); +} + +/** + * + * rct2: 0x006E88D7 + */ +void balloon_pop(rct_sprite *sprite) +{ + RCT2_CALLPROC_X(0x006E88D7, 0, 0, 0, (int)sprite, 0, 0, 0); +} + /** * * rct2: 0x0067440F @@ -53,8 +72,7 @@ void create_balloon(int x, int y, int z, int colour) void create_duck(int targetX, int targetY) { rct_sprite* sprite = create_sprite(2); - if (sprite != NULL) - { + if (sprite != NULL) { sprite->duck.sprite_identifier = SPRITE_IDENTIFIER_MISC; sprite->duck.misc_identifier = SPRITE_MISC_DUCK; sprite->duck.var_14 = 9; @@ -88,7 +106,19 @@ void create_duck(int targetX, int targetY) } } -/* rct2: 0x006EC473 */ +/** + * + * rct: 0x006740E8 + */ +void duck_update(rct_duck *duck) +{ + RCT2_CALLPROC_X(0x006740E8, 0, 0, 0, 0, (int)duck, 0, 0); +} + +/* + * + * rct2: 0x006EC473 + */ void invalidate_sprite(rct_sprite* sprite){ if (sprite->unknown.sprite_left == (sint16)0x8000) return; @@ -305,7 +335,36 @@ void move_sprite_to_list(rct_sprite *sprite, uint8 cl) */ void sprite_misc_update(rct_sprite *sprite) { - RCT2_CALLPROC_X(0x006731CD, 0, 0, 0, 0, (int)sprite, 0, 0); + switch (sprite->unknown.misc_identifier) { + case SPRITE_MISC_0: + RCT2_CALLPROC_X(0x00673200, 0, 0, 0, 0, (int)sprite, 0, 0); + break; + case SPRITE_MISC_MONEY_EFFECT: + RCT2_CALLPROC_X(0x00673232, 0, 0, 0, 0, (int)sprite, 0, 0); + break; + case SPRITE_MISC_2: + RCT2_CALLPROC_X(0x00673298, 0, 0, 0, 0, (int)sprite, 0, 0); + break; + case SPRITE_MISC_3: + RCT2_CALLPROC_X(0x00673385, 0, 0, 0, 0, (int)sprite, 0, 0); + break; + case SPRITE_MISC_4: + RCT2_CALLPROC_X(0x0067339D, 0, 0, 0, 0, (int)sprite, 0, 0); + break; + case SPRITE_MISC_5: + RCT2_CALLPROC_X(0x006733B4, 0, 0, 0, 0, (int)sprite, 0, 0); + break; + case SPRITE_MISC_JUMPING_FOUNTAIN_WATER: + case SPRITE_MISC_JUMPING_FOUNTAIN_SNOW: + jumping_fountain_update(&sprite->jumping_fountain); + break; + case SPRITE_MISC_BALLOON: + balloon_update(&sprite->balloon); + break; + case SPRITE_MISC_DUCK: + duck_update(&sprite->duck); + break; + } } /** @@ -397,15 +456,6 @@ void sprite_move(int x, int y, int z, rct_sprite* sprite){ sprite->unknown.z = z; } -/** - * - * rct2: 0x006E88D7 - */ -void balloon_pop(rct_sprite *sprite) -{ - RCT2_CALLPROC_X(0x006E88D7, 0, 0, 0, (int)sprite, 0, 0, 0); -} - /** * * rct2: 0x0069EDB6 diff --git a/src/world/sprite.h b/src/world/sprite.h index cbf5d5752f..b478e5c508 100644 --- a/src/world/sprite.h +++ b/src/world/sprite.h @@ -46,7 +46,7 @@ typedef enum { typedef struct { uint8 sprite_identifier; // 0x00 - uint8 pad_01; + uint8 misc_identifier; // 0x01 uint16 var_02; uint16 next; // 0x04 uint16 previous; // 0x06 @@ -165,7 +165,13 @@ typedef union { } rct_sprite; enum { - SPRITE_MISC_JUMPING_FOUNTAIN_WATER = 6, + SPRITE_MISC_0, + SPRITE_MISC_MONEY_EFFECT, + SPRITE_MISC_2, // (related to vehicle crash, probably crash particles) + SPRITE_MISC_3, // (related to vehicle crash, probably crash particles) + SPRITE_MISC_4, // (related to vehicle crash, probably crash particles) + SPRITE_MISC_5, // (related to vehicle crash, probably crash particles) + SPRITE_MISC_JUMPING_FOUNTAIN_WATER, SPRITE_MISC_BALLOON, SPRITE_MISC_DUCK, SPRITE_MISC_JUMPING_FOUNTAIN_SNOW