mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add balloon popping as game command
This commit is contained in:
parent
d74efb23fe
commit
db3aa2b656
|
@ -311,7 +311,6 @@ void game_update()
|
|||
// Always perform autosave check, even when paused
|
||||
scenario_autosave_check();
|
||||
|
||||
network_update();
|
||||
window_dispatch_update_all();
|
||||
|
||||
gGameCommandNestLevel = 0;
|
||||
|
@ -1100,7 +1099,7 @@ void game_load_or_quit_no_save_prompt()
|
|||
}
|
||||
}
|
||||
|
||||
GAME_COMMAND_POINTER* new_game_command_table[69] = {
|
||||
GAME_COMMAND_POINTER* new_game_command_table[70] = {
|
||||
game_command_set_ride_appearance,
|
||||
game_command_set_land_height,
|
||||
game_pause_toggle,
|
||||
|
@ -1170,4 +1169,5 @@ GAME_COMMAND_POINTER* new_game_command_table[69] = {
|
|||
game_command_cheat,
|
||||
game_command_pickup_guest,
|
||||
game_command_pickup_staff,
|
||||
game_command_balloon_press,
|
||||
};
|
||||
|
|
|
@ -92,6 +92,7 @@ enum GAME_COMMAND {
|
|||
GAME_COMMAND_CHEAT,
|
||||
GAME_COMMAND_PICKUP_GUEST,
|
||||
GAME_COMMAND_PICKUP_STAFF,
|
||||
GAME_COMMAND_BALLOON_PRESS,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -131,7 +132,7 @@ extern rct_string_id gGameCommandErrorText;
|
|||
extern uint8 gErrorType;
|
||||
extern rct_string_id gErrorStringId;
|
||||
|
||||
extern GAME_COMMAND_POINTER* new_game_command_table[69];
|
||||
extern GAME_COMMAND_POINTER* new_game_command_table[70];
|
||||
|
||||
#ifndef NO_RCT2
|
||||
#define gCurrentTicks RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32)
|
||||
|
|
|
@ -135,7 +135,7 @@ int viewport_interaction_left_click(int x, int y)
|
|||
if (game_is_not_paused()) {
|
||||
switch (info.sprite->unknown.misc_identifier) {
|
||||
case SPRITE_MISC_BALLOON:
|
||||
balloon_press(&info.sprite->balloon);
|
||||
game_do_command(info.sprite->balloon.sprite_index, GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_BALLOON_PRESS, 0, 0);
|
||||
break;
|
||||
case SPRITE_MISC_DUCK:
|
||||
duck_press(&info.sprite->duck);
|
||||
|
|
|
@ -159,7 +159,8 @@ const std::vector<NetworkAction> NetworkActions::Actions =
|
|||
STR_ACTION_GUEST, "PERMISSION_GUEST",
|
||||
{
|
||||
GAME_COMMAND_SET_GUEST_NAME,
|
||||
GAME_COMMAND_PICKUP_GUEST
|
||||
GAME_COMMAND_PICKUP_GUEST,
|
||||
GAME_COMMAND_BALLOON_PRESS
|
||||
}
|
||||
}, {
|
||||
STR_ACTION_STAFF, "PERMISSION_STAFF",
|
||||
|
|
|
@ -23,6 +23,7 @@ extern "C"
|
|||
{
|
||||
#include "../peep/peep.h"
|
||||
#include "../world/map.h"
|
||||
#include "../world/sprite.h"
|
||||
}
|
||||
|
||||
class NetworkPacket;
|
||||
|
|
|
@ -83,13 +83,10 @@ void balloon_update(rct_balloon *balloon)
|
|||
*/
|
||||
void balloon_press(rct_balloon *balloon)
|
||||
{
|
||||
if (network_get_mode() != NETWORK_MODE_NONE) {
|
||||
return;
|
||||
}
|
||||
if (balloon->popped == 1)
|
||||
return;
|
||||
|
||||
uint32 random = util_rand();
|
||||
uint32 random = scenario_rand();
|
||||
if ((balloon->sprite_index & 7) || (random & 0xFFFF) < 0x2000) {
|
||||
balloon_pop(balloon);
|
||||
return;
|
||||
|
@ -102,3 +99,20 @@ void balloon_press(rct_balloon *balloon)
|
|||
(rct_sprite*)balloon
|
||||
);
|
||||
}
|
||||
|
||||
void game_command_balloon_press(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp)
|
||||
{
|
||||
int balloon_num = *eax;
|
||||
int flags = *ebx;
|
||||
*ebx = 0;
|
||||
if (!(flags & GAME_COMMAND_FLAG_APPLY)) {
|
||||
return;
|
||||
}
|
||||
rct_sprite* sprite = get_sprite(balloon_num);
|
||||
if (!sprite) {
|
||||
return;
|
||||
}
|
||||
if (sprite->balloon.sprite_identifier == SPRITE_IDENTIFIER_MISC && sprite->balloon.misc_identifier == SPRITE_MISC_BALLOON) {
|
||||
balloon_press(&sprite->balloon);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -438,7 +438,7 @@ uint16 sprite_get_first_in_quadrant(int x, int y);
|
|||
///////////////////////////////////////////////////////////////
|
||||
void create_balloon(int x, int y, int z, int colour, uint8 bl);
|
||||
void balloon_update(rct_balloon *balloon);
|
||||
void balloon_press(rct_balloon *balloon);
|
||||
void game_command_balloon_press(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Duck
|
||||
|
|
Loading…
Reference in New Issue