From 5b568f376c6ec991e5bf56e636b0f880f39ffc02 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sun, 25 May 2014 19:47:11 +0100 Subject: [PATCH] add peep_applause --- projects/openrct2.vcxproj | 1 + projects/openrct2.vcxproj.filters | 3 +++ src/peep.c | 45 +++++++++++++++++++++++++++++++ src/peep.h | 10 +++++-- src/scenario.c | 2 +- src/sprite.c | 31 +++++++++++++++++++++ src/sprite.h | 2 ++ 7 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 src/sprite.c diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 62c7dfb183..c67891ee19 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -81,6 +81,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index 1635ec4952..8000ad144c 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -320,6 +320,9 @@ Source Files + + Source Files + diff --git a/src/peep.c b/src/peep.c index c6f910fe13..0486eff68d 100644 --- a/src/peep.c +++ b/src/peep.c @@ -20,6 +20,7 @@ #include #include "addresses.h" +#include "audio.h" #include "news_item.h" #include "peep.h" #include "rct2.h" @@ -293,6 +294,50 @@ void peep_update_crowd_noise() } } +/** + * + * rct2: 0x0069BE9B + */ +void peep_applause() +{ + uint16 sprite_index; + rct_peep* peep; + + // For each guest + sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); + while (sprite_index != 0xFFFF) { + peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_index].peep); + sprite_index = peep->next; + + if (peep->type != PEEP_TYPE_GUEST) + continue; + if (peep->var_2A != 0) + continue; + + // Release balloon + if (peep->item_standard_flags & PEEP_ITEM_BALLOON) { + peep->item_standard_flags &= ~PEEP_ITEM_BALLOON; + if (peep->x != 0x8000) { + create_balloon(peep->x, peep->y, peep->z + 9, peep->balloon_colour); + peep->var_45 |= 8; + RCT2_CALLPROC_X(0x0069B8CC, 0, 0, 0, 0, (int)peep, 0, 0); + } + } + + // Clap + if ((peep->state == PEEP_STATE_WALKING || peep->state == PEEP_STATE_QUEUING) && peep->var_71 >= 254) { + peep->var_71 = 26; + peep->var_72 = 0; + peep->var_70 = 0; + RCT2_CALLPROC_X(0x00693B58, 0, 0, 0, 0, (int)peep, 0, 0); + RCT2_CALLPROC_X(0x006EC473, 0, 0, 0, 0, (int)peep, 0, 0); + } + } + + // Play applause noise + sound_play_panned(44, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2); +} + /** * * rct2: 0x0069A05D diff --git a/src/peep.h b/src/peep.h index 15c4c766d4..8bcf28de73 100644 --- a/src/peep.h +++ b/src/peep.h @@ -359,7 +359,7 @@ typedef struct { uint8 pad_41[0x2]; uint8 intensity; // 0x43 uint8 nausea_tolerance; // 0x44 - uint8 pad_45; + uint8 var_45; money16 paid_on_drink; // 0x46 uint8 pad_48[0x10]; uint32 item_extra_flags; // 0x58 @@ -372,8 +372,13 @@ typedef struct { uint8 current_train; // 0x6A uint8 current_car; // 0x6B uint8 current_seat; // 0x6C - uint8 pad_6D[0x09]; + uint8 pad_6D[3]; + uint8 var_70; + uint8 var_71; + uint8 var_72; + uint8 pad_73[3]; uint8 var_76; + uint8 pad_77; uint8 var_78; uint8 pad_79[0x03]; uint8 rides_been_on[32]; // 0x7C @@ -416,6 +421,7 @@ int peep_get_staff_count(); void peep_update_all(); void peep_problem_warnings_update(); void peep_update_crowd_noise(); +void peep_applause(); rct_peep *peep_generate(int x, int y, int z); #endif diff --git a/src/scenario.c b/src/scenario.c index b35584e0f8..a18407e6f8 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -336,7 +336,7 @@ void scenario_success() uint32 current_val = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, uint32); RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, uint32) = current_val; - RCT2_CALLPROC_EBPSAFE(0x0069BE9B); // celebration + peep_applause(); for (i = 0; i < gScenarioListCount; i++) { char *cur_scenario_name = RCT2_ADDRESS(0x135936C, char); diff --git a/src/sprite.c b/src/sprite.c new file mode 100644 index 0000000000..37157e98b6 --- /dev/null +++ b/src/sprite.c @@ -0,0 +1,31 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of OpenRCT2. + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + +#include "addresses.h" +#include "sprite.h" + +/** + * + * rct2: 0x006736C7 + */ +void create_balloon(int x, int y, int z, int colour) +{ + RCT2_CALLPROC_X(0x006736C7, x, colour << 8, y, z, 0, 0, 0); +} \ No newline at end of file diff --git a/src/sprite.h b/src/sprite.h index 40d905a3a9..3edb1d5e6f 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -59,4 +59,6 @@ typedef union { rct_vehicle vehicle; } rct_sprite; +void create_balloon(int x, int y, int z, int colour); + #endif