mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 03:23:15 +01:00
implement balloon_update and money_effect_update
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../addresses.h"
|
||||
#include "../audio/audio.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../scenario.h"
|
||||
#include "fountain.h"
|
||||
@@ -43,7 +44,7 @@ void create_balloon(int x, int y, int z, int colour)
|
||||
sprite->balloon.misc_identifier = SPRITE_MISC_BALLOON;
|
||||
sprite->balloon.var_26 = 0;
|
||||
sprite->balloon.colour = colour;
|
||||
sprite->balloon.var_24 = 0;
|
||||
sprite->balloon.popped = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +54,31 @@ void create_balloon(int x, int y, int z, int colour)
|
||||
*/
|
||||
void balloon_update(rct_balloon *balloon)
|
||||
{
|
||||
RCT2_CALLPROC_X(0x0067342C, 0, 0, 0, 0, (int)balloon, 0, 0);
|
||||
invalidate_sprite((rct_sprite*)balloon);
|
||||
if (balloon->popped == 1) {
|
||||
balloon->var_26 += 256;
|
||||
if (balloon->var_26 >= 1280)
|
||||
sprite_remove((rct_sprite*)balloon);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int original_var26a = balloon->var_26a;
|
||||
balloon->var_26a += 85;
|
||||
if (original_var26a < 255 - 85)
|
||||
return;
|
||||
|
||||
balloon->var_26b++;
|
||||
sprite_move(balloon->x, balloon->y, balloon->z + 1, (rct_sprite*)balloon);
|
||||
|
||||
int maxZ = 1967 - ((balloon->x ^ balloon->y) & 31);
|
||||
if (balloon->z < maxZ)
|
||||
return;
|
||||
|
||||
balloon->popped = 1;
|
||||
balloon->var_26 = 0;
|
||||
|
||||
sound_play_panned(SOUND_BALLOON_POP, 0x8001, balloon->x, balloon->y, balloon->z);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,6 +140,41 @@ void duck_update(rct_duck *duck)
|
||||
RCT2_CALLPROC_X(0x006740E8, 0, 0, 0, 0, (int)duck, 0, 0);
|
||||
}
|
||||
|
||||
static const rct_xy16 _moneyEffectMoveOffset[] = {
|
||||
{ 1, -1 },
|
||||
{ 1, 1 },
|
||||
{ -1, 1 },
|
||||
{ -1, -1 }
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* rct: 0x00673232
|
||||
*/
|
||||
void money_effect_update(rct_money_effect *moneyEffect)
|
||||
{
|
||||
invalidate_sprite((rct_sprite*)moneyEffect);
|
||||
moneyEffect->wiggle++;
|
||||
if (moneyEffect->wiggle >= 22)
|
||||
moneyEffect->wiggle = 0;
|
||||
|
||||
moneyEffect->move_delay++;
|
||||
if (moneyEffect->move_delay < 2)
|
||||
return;
|
||||
|
||||
moneyEffect->move_delay = 0;
|
||||
int x = moneyEffect->x + _moneyEffectMoveOffset[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)].x;
|
||||
int y = moneyEffect->y + _moneyEffectMoveOffset[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)].y;
|
||||
int z = moneyEffect->z;
|
||||
sprite_move(x, y, z, (rct_sprite*)moneyEffect);
|
||||
|
||||
moneyEffect->num_movements++;
|
||||
if (moneyEffect->num_movements < 55)
|
||||
return;
|
||||
|
||||
sprite_remove((rct_sprite*)moneyEffect);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* rct2: 0x006EC473
|
||||
@@ -340,7 +400,7 @@ void sprite_misc_update(rct_sprite *sprite)
|
||||
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);
|
||||
money_effect_update(&sprite->money_effect);
|
||||
break;
|
||||
case SPRITE_MISC_2:
|
||||
RCT2_CALLPROC_X(0x00673298, 0, 0, 0, 0, (int)sprite, 0, 0);
|
||||
|
||||
@@ -93,13 +93,21 @@ typedef struct {
|
||||
uint16 previous; // 0x06
|
||||
uint8 linked_list_type_offset; // 0x08 Valid values are SPRITE_LINKEDLIST_OFFSET_...
|
||||
uint8 var_09; // 0x09
|
||||
uint8 pad_0A[0xA];
|
||||
uint8 pad_0A[0x4];
|
||||
sint16 x; // 0x0E
|
||||
sint16 y; // 0x10
|
||||
sint16 z; // 0x12
|
||||
uint8 var_14; // 0x14
|
||||
uint8 var_15; // 0x15
|
||||
uint8 pad_16[0xE];
|
||||
uint8 var_24; // 0x24
|
||||
uint8 pad_25;
|
||||
uint16 var_26; // 0x26
|
||||
uint16 popped; // 0x24
|
||||
union {
|
||||
uint16 var_26;
|
||||
struct {
|
||||
uint8 var_26a;
|
||||
uint8 var_26b;
|
||||
};
|
||||
};
|
||||
uint8 pad_28[4];
|
||||
uint8 colour; // 0x2C
|
||||
} rct_balloon;
|
||||
@@ -156,9 +164,28 @@ typedef struct {
|
||||
sint16 target_x; // 0x30
|
||||
sint16 target_y; // 0x32
|
||||
uint8 pad_34[0x12];
|
||||
uint16 iteration;
|
||||
uint16 iteration; // 0x46
|
||||
} rct_jumping_fountain;
|
||||
|
||||
typedef struct {
|
||||
uint8 sprite_identifier; // 0x00
|
||||
uint8 misc_identifier; // 0x01
|
||||
uint16 var_02; // 0x02
|
||||
uint16 next; // 0x04
|
||||
uint16 previous; // 0x06
|
||||
uint8 linked_list_type_offset; // 0x08 Valid values are SPRITE_LINKEDLIST_OFFSET_...
|
||||
uint8 var_09;
|
||||
uint8 pad_0A[0x4];
|
||||
sint16 x; // 0x0E
|
||||
sint16 y; // 0x10
|
||||
sint16 z; // 0x12
|
||||
uint8 pad_14[0x10];
|
||||
uint16 move_delay; // 0x24
|
||||
uint16 num_movements; // 0x26
|
||||
uint8 pad_28[0x1E];
|
||||
uint16 wiggle; // 0x46
|
||||
} rct_money_effect;
|
||||
|
||||
/**
|
||||
* Sprite structure.
|
||||
* size: 0x0100
|
||||
@@ -172,6 +199,7 @@ typedef union {
|
||||
rct_balloon balloon;
|
||||
rct_duck duck;
|
||||
rct_jumping_fountain jumping_fountain;
|
||||
rct_money_effect money_effect;
|
||||
} rct_sprite;
|
||||
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user