From: Dmitry D. Chernov Date: Mon, 10 Apr 2023 01:09:38 +0000 (+1000) Subject: Game: Fix missing sound from the bubble effect in liquids X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=6c45ab8eddd0887ecaa11ad3ed284dbdd3a3730c;p=d2df-sdl.git Game: Fix missing sound from the bubble effect in liquids --- diff --git a/src/game/g_monsters.pas b/src/game/g_monsters.pas index 3d9e43d..d8adad8 100644 --- a/src/game/g_monsters.pas +++ b/src/game/g_monsters.pas @@ -2468,7 +2468,7 @@ var a, b, sx, sy, wx, wy, oldvelx: Integer; st: Word; o, co: TObj; - fall: Boolean; + fall, bubbles: Boolean; mon: TMonster; mit: PMonster; it: TMonsterGrid.Iter; @@ -2476,6 +2476,7 @@ label _end; begin fall := True; + bubbles := True; // Ìîíñòð ñòàòè÷åí ïîêà èäåò warmup if (gLMSRespawn > LMS_RESPAWN_NONE) then exit; @@ -2574,23 +2575,23 @@ begin // Âîçìîæíî, ñîçäàåì ïóçûðüêè â âîäå: if WordBool(st and MOVE_INWATER) and (Random(32) = 0) then + begin case FMonsterType of MONSTER_FISH: - if Random(4) = 0 then + if Random(4) <> 0 then bubbles := False else g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width), FObj.Y+FObj.Rect.Y + Random(4), 1, 0, 0); MONSTER_ROBO, MONSTER_BARREL: g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width), FObj.Y+FObj.Rect.Y + Random(4), 1, 0, 0); - else begin + else g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width-4), FObj.Y+FObj.Rect.Y + Random(4), 5, 4, 4); - if Random(2) = 0 then - g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) - else - g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); - end; end; + if bubbles then if Random(2) = 0 + then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) + else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); + end; // Åñëè ïðîøåë ïåðâûé êàäð àíèìàöèè âçðûâà áî÷êè, òî âçðûâ: if FMonsterType = MONSTER_BARREL then @@ -3462,13 +3463,14 @@ var a, b, sx, sy, oldvelx: Integer; st: Word; o, co: TObj; - fall: Boolean; + fall, bubbles: Boolean; label _end; begin sx := 0; // SHUT UP COMPILER sy := 0; fall := True; + bubbles := True; // Ìîíñòð ñòàòè÷åí ïîêà èäåò warmup if (gLMSRespawn > LMS_RESPAWN_NONE) then exit; @@ -3535,23 +3537,23 @@ begin // Âîçìîæíî, ñîçäàåì ïóçûðüêè â âîäå: if WordBool(st and MOVE_INWATER) and (Random(32) = 0) then + begin case FMonsterType of MONSTER_FISH: - if Random(4) = 0 then + if Random(4) <> 0 then bubbles := False else g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width), FObj.Y+FObj.Rect.Y + Random(4), 1, 0, 0); MONSTER_ROBO, MONSTER_BARREL: g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width), FObj.Y+FObj.Rect.Y + Random(4), 1, 0, 0); - else begin + else g_GFX_Bubbles(FObj.X+FObj.Rect.X + Random(FObj.Rect.Width-4), FObj.Y+FObj.Rect.Y + Random(4), 5, 4, 4); - if Random(2) = 0 then - g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) - else - g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); - end; end; + if bubbles then if Random(2) = 0 + then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) + else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); + end; // Åñëè ïðîøåë ïåðâûé êàäð àíèìàöèè âçðûâà áî÷êè, òî âçðûâ: if FMonsterType = MONSTER_BARREL then diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 38bb86a..1021d36 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -2299,8 +2299,13 @@ begin end; if t = HIT_WATER then + begin g_GFX_Bubbles(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2), FObj.Y+PLAYER_RECT.Y-4, value div 2, 8, 4); + if Random(2) = 0 + then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) + else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); + end; end; // Áóôåð óðîíà: @@ -5373,10 +5378,9 @@ begin else if (FAir mod 31 = 0) and not blockmon then begin g_GFX_Bubbles(FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2), FObj.Y+PLAYER_RECT.Y-4, 5+Random(6), 8, 4); - if Random(2) = 0 then - g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) - else - g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); + if Random(2) = 0 + then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) + else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); end; end else if FAir < AIR_DEF then FAir := AIR_DEF; @@ -6477,10 +6481,9 @@ begin begin g_GFX_Bubbles(Obj.X+Obj.Rect.X+(Obj.Rect.Width div 2)+Random(3)-1, Obj.Y+Obj.Rect.Height+8, 1, 8, 4); - if Random(2) = 0 then - g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) - else - g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); + if Random(2) = 0 + then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', FObj.X, FObj.Y) + else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', FObj.X, FObj.Y); Exit; end; diff --git a/src/game/g_triggers.pas b/src/game/g_triggers.pas index 9afef5d..e9fa513 100644 --- a/src/game/g_triggers.pas +++ b/src/game/g_triggers.pas @@ -884,7 +884,13 @@ begin TRIGGER_EFFECT_DLIQUID: g_GFX_SimpleWater(X, Y, 1, VX, VY, 5, CR, CG, CB); TRIGGER_EFFECT_BLOOD: g_GFX_Blood(X, Y, 1, VX, VY, 0, 0, CR, CG, CB); TRIGGER_EFFECT_SPARK: g_GFX_Spark(X, Y, 1, GetAngle2(VX, VY), 0, 0); - TRIGGER_EFFECT_BUBBLE: g_GFX_Bubbles(X, Y, 1, 0, 0); + TRIGGER_EFFECT_BUBBLE: + begin + g_GFX_Bubbles(X, Y, 1, 0, 0); + if not Silent then if Random(2) = 0 + then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', X, Y) + else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', X, Y); + end; end; end; diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas index 6e65496..f0fe291 100644 --- a/src/game/g_weapons.pas +++ b/src/game/g_weapons.pas @@ -2277,19 +2277,20 @@ begin //  âîäå øëåéô - ïóçûðè, â âîçäóõå øëåéô - äûì: if WordBool(st and MOVE_INWATER) then - g_GFX_Bubbles(Obj.X+(Obj.Rect.Width div 2), - Obj.Y+(Obj.Rect.Height div 2), - 1+Random(3), 16, 16) - else - if g_Frames_Get(_id, 'FRAMES_SMOKE') then - begin - Anim := TAnimation.Create(_id, False, 3); - Anim.Alpha := 150; - g_GFX_OnceAnim(Obj.X-14+Random(9), - Obj.Y+(Obj.Rect.Height div 2)-20+Random(9), - Anim, ONCEANIM_SMOKE); - Anim.Free(); - end; + begin + g_GFX_Bubbles(cx, cy, 1+Random(3), 16, 16); + if Random(2) = 0 + then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', cx, cy) + else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', cx, cy); + end + else if g_Frames_Get(_id, 'FRAMES_SMOKE') then + begin + Anim := TAnimation.Create(_id, False, 3); + Anim.Alpha := 150; + g_GFX_OnceAnim(Obj.X-14+Random(9), cy-20+Random(9), + Anim, ONCEANIM_SMOKE); + Anim.Free(); + end; // Ïîïàëè â êîãî-òî èëè â ñòåíó: if WordBool(st and (MOVE_HITWALL or MOVE_HITLAND or MOVE_HITCEIL)) or @@ -2412,7 +2413,12 @@ begin end; end else + begin g_GFX_Bubbles(cx, cy, 1+Random(3), 16, 16); + if Random(2) = 0 + then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', cx, cy) + else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', cx, cy); + end; ShotType := 0; Continue; end;