From 7a051411ba56f285197e047229586865931b748c Mon Sep 17 00:00:00 2001 From: Wolfgang Becker Date: Tue, 18 Jul 2006 19:37:09 +0000 Subject: [PATCH] Splash sound on entering water SVN-Revision: 4046 --- data/sounds/splash.ogg | Bin 0 -> 9220 bytes src/object/player.cpp | 25 +++++++++++++++++++++++++ src/object/player.hpp | 1 + 3 files changed, 26 insertions(+) create mode 100644 data/sounds/splash.ogg diff --git a/data/sounds/splash.ogg b/data/sounds/splash.ogg new file mode 100644 index 0000000000000000000000000000000000000000..60c2492fa8fdb6786300b65f51dbfa9e62d2eb86 GIT binary patch literal 9220 zcmaiZ2Ut_h(*Fs)gY+f_1SJU4h0vr5gdPZ0M0!VhQGqC3X+r2AH3&!$=|urSdXe5l z0Z~8!MXHFv{{-Im-uHjM@44STo6Vk`-I?8)-^`g!^c)=x0RrH!GR*4>$9Ge1{rLsq zg81L@wsH2s4?tAQ@n2vGfSi6cK=kk{|5flS@szwx$`U%ElmD;u5}q+S57JGYJ)N%V zc{@VgoNbIx*+Vsq1qt{y`$J~C=EVgS^Hq6T*aBNE@(L~}>7f=v{scMtcoY;OvI zlDvl$Vm;6>ZLzOK$+|LMOA6y z?nRk|&5ll)49`9qR-En)vN}5!6hMQ=1k|4}YQALbf5|yG!mGC>Xuu#jBCcj=q=N#B zpQVYv{gl7olz*^UdW1zouvtTd#dL(_euOn^vz{9bP3+@+2NuQlVzCgG+^TR-M!HI`{r6!Tu_$(Pq3$Em?IQg0 zss#(qj7Lu^Z+En$5b zop~9KT~IKQ6Fqp_m{(*xy}5P-#G+G9NxWuBmx59qV=_xKo_;MYp!g5ZaeDMD{n4}NM=R0s{4uG{ zF_~qJ1#W#6Yfb-W{g>ycd-H-7^c*#B-hX&bn<%FW=uK6EI@@Pwlpg^V>Z```PXhoz zTOyU#X&f;?3QZs-Cy+uYBl-XCF(7q9LT5|@RBQ?WumQkD(8%F*kGvC=J>*TvM3;Gq z^Wh}EvxsCW^bPAkSKW$rU!l*n>?xs6G~+j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Bq%`9>O{a@SsR^M8YuZb zokw_yT6n&@Y3QU=V4hakO{HUkwfiZa=%V^bAXJKHTE>~Ts zk^J6*p1MbbrTm}mw&h0pKR563 zeDO5efu%H>_a`Q})v;oO%0uDO3s7!*DE*Z`@~JE}*T+cv{uC!}ol_49s991G5|RhX z4_0T!cC~kYJtdo_ZsY4`q5FErA44_seXi4ZywQ`-^=)!ol!%hg3t2K?;GiU~F~DU4 z6;9PhvOv=3*yi_y%Tjis=o@`Pqp8Tid2?a*0O2ZdCZ& z@!y*T<7ixhkyHkHRGEDkZj|zz{%a=GG_7_?O!bhwDZj5gPFw| z?}jH+tF_rF{_q*vx3;fsRb~34qiOaCS~#!CrSrSnT`8H#%E82h9k2v!%6AH>+d$;# z?MZsyc+KgtXmm>-RL2>ue>D?S4S5=n&Lu~-DxLFCul@aZ?)w5irARL)r5qC$?e0tz yZw~8K$)aVA2`e`nE#i|3f+{w@hz;y6v2vAfCxqq(-yklY(2sF${N2XL0sKF`crwla literal 0 HcmV?d00001 diff --git a/src/object/player.cpp b/src/object/player.cpp index bfdd2010d..d0ee80674 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -79,6 +79,9 @@ TuxBodyParts* big_tux = 0; TuxBodyParts* fire_tux = 0; TuxBodyParts* ice_tux = 0; +namespace{ + bool no_water = true; +} void TuxBodyParts::set_action(std::string action, int loops) { @@ -119,6 +122,8 @@ Player::Player(PlayerStatus* _player_status) sound_manager->preload("sounds/skid.wav"); sound_manager->preload("sounds/flip.wav"); sound_manager->preload("sounds/invincible.wav"); + sound_manager->preload("sounds/splash.ogg"); + init(); } @@ -154,6 +159,7 @@ Player::init() backflipping = false; backflip_direction = 0; visible = true; + swimming = false; on_ground_flag = false; grabbed_object = NULL; @@ -199,6 +205,11 @@ Player::adjust_height(float new_height) void Player::update(float elapsed_time) { + if( no_water ){ + swimming = false; + } + no_water = true; + if(dying && dying_timer.check()) { dead = true; return; @@ -902,6 +913,20 @@ Player::collision_tile(uint32_t tile_attributes) { if(tile_attributes & Tile::HURTS) kill(false); + + if( swimming ){ + if( tile_attributes & Tile::WATER ){ + no_water = false; + } else { + swimming = false; + } + } else { + if( tile_attributes & Tile::WATER ){ + swimming = true; + no_water = false; + sound_manager->play( "sounds/splash.ogg" ); + } + } } void diff --git a/src/object/player.hpp b/src/object/player.hpp index bab2bc544..885d41ed2 100644 --- a/src/object/player.hpp +++ b/src/object/player.hpp @@ -96,6 +96,7 @@ private: bool backflipping; int backflip_direction; Direction peeking; + bool swimming; public: Direction dir; -- 2.11.0