From de7ee5ef022a8ccaece0ea5f5402adedeafe36b4 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 12 Mar 2022 09:05:21 -0500 Subject: added back bump sound (and assets for fuller music) --- res/fmod/.cache/fsbcache/Desktop/3019A628.fobj | Bin 0 -> 1421014 bytes res/fmod/.cache/fsbcache/Desktop/C8D72C41.fobj | Bin 0 -> 1387706 bytes .../{598d696a-a866-4860-8a80-85745ab8b7ef}.pdc | Bin 0 -> 846768 bytes .../{b81d31bd-fdcd-4402-a741-3947adc1b7dc}.pdc | Bin 0 -> 846768 bytes .../{e4ee2376-d790-4e2c-8a64-9c08953d0f04}.pdc | Bin 1024 -> 1024 bytes ...{45d68279-4042-4001-9cc3-fe7741328d02}.user.xml | 49 ++++ ...{e332d959-1f13-4c62-91ca-53b5a142c233}.user.xml | 3 - ...{edb92230-b495-405d-96ce-a8d7283112ef}.user.xml | 3 - res/fmod/.user/Metadata/Workspace.user.xml | 4 + res/fmod/Assets/level3.wav | Bin 0 -> 31753724 bytes res/fmod/Assets/level4.wav | Bin 0 -> 31753724 bytes .../{598d696a-a866-4860-8a80-85745ab8b7ef}.xml | 23 ++ .../{b81d31bd-fdcd-4402-a741-3947adc1b7dc}.xml | 23 ++ .../{45d68279-4042-4001-9cc3-fe7741328d02}.xml | 286 +++++++++++++++++++++ .../{b2b95b3f-95bc-4633-814f-61ea539b893d}.xml | 2 +- .../{e332d959-1f13-4c62-91ca-53b5a142c233}.xml | 3 + .../{4bacb865-6588-42b7-9c72-e3ace10a31ef}.xml | 22 ++ src/game.h | 11 + src/main.cpp | 16 +- src/timer.h | 32 +++ 20 files changed, 468 insertions(+), 9 deletions(-) create mode 100644 res/fmod/.cache/fsbcache/Desktop/3019A628.fobj create mode 100644 res/fmod/.cache/fsbcache/Desktop/C8D72C41.fobj create mode 100644 res/fmod/.cache/{598d696a-a866-4860-8a80-85745ab8b7ef}.pdc create mode 100644 res/fmod/.cache/{b81d31bd-fdcd-4402-a741-3947adc1b7dc}.pdc create mode 100644 res/fmod/.user/Metadata/Event/{45d68279-4042-4001-9cc3-fe7741328d02}.user.xml create mode 100644 res/fmod/Assets/level3.wav create mode 100644 res/fmod/Assets/level4.wav create mode 100644 res/fmod/Metadata/AudioFile/{598d696a-a866-4860-8a80-85745ab8b7ef}.xml create mode 100644 res/fmod/Metadata/AudioFile/{b81d31bd-fdcd-4402-a741-3947adc1b7dc}.xml create mode 100644 res/fmod/Metadata/Event/{45d68279-4042-4001-9cc3-fe7741328d02}.xml create mode 100644 res/fmod/Metadata/ParameterPreset/{4bacb865-6588-42b7-9c72-e3ace10a31ef}.xml create mode 100644 src/timer.h diff --git a/res/fmod/.cache/fsbcache/Desktop/3019A628.fobj b/res/fmod/.cache/fsbcache/Desktop/3019A628.fobj new file mode 100644 index 0000000..d7c5f5b Binary files /dev/null and b/res/fmod/.cache/fsbcache/Desktop/3019A628.fobj differ diff --git a/res/fmod/.cache/fsbcache/Desktop/C8D72C41.fobj b/res/fmod/.cache/fsbcache/Desktop/C8D72C41.fobj new file mode 100644 index 0000000..a5764cd Binary files /dev/null and b/res/fmod/.cache/fsbcache/Desktop/C8D72C41.fobj differ diff --git a/res/fmod/.cache/{598d696a-a866-4860-8a80-85745ab8b7ef}.pdc b/res/fmod/.cache/{598d696a-a866-4860-8a80-85745ab8b7ef}.pdc new file mode 100644 index 0000000..587c693 Binary files /dev/null and b/res/fmod/.cache/{598d696a-a866-4860-8a80-85745ab8b7ef}.pdc differ diff --git a/res/fmod/.cache/{b81d31bd-fdcd-4402-a741-3947adc1b7dc}.pdc b/res/fmod/.cache/{b81d31bd-fdcd-4402-a741-3947adc1b7dc}.pdc new file mode 100644 index 0000000..f63429f Binary files /dev/null and b/res/fmod/.cache/{b81d31bd-fdcd-4402-a741-3947adc1b7dc}.pdc differ diff --git a/res/fmod/.cache/{e4ee2376-d790-4e2c-8a64-9c08953d0f04}.pdc b/res/fmod/.cache/{e4ee2376-d790-4e2c-8a64-9c08953d0f04}.pdc index fceba51..7db9f39 100644 Binary files a/res/fmod/.cache/{e4ee2376-d790-4e2c-8a64-9c08953d0f04}.pdc and b/res/fmod/.cache/{e4ee2376-d790-4e2c-8a64-9c08953d0f04}.pdc differ diff --git a/res/fmod/.user/Metadata/Event/{45d68279-4042-4001-9cc3-fe7741328d02}.user.xml b/res/fmod/.user/Metadata/Event/{45d68279-4042-4001-9cc3-fe7741328d02}.user.xml new file mode 100644 index 0000000..eb068de --- /dev/null +++ b/res/fmod/.user/Metadata/Event/{45d68279-4042-4001-9cc3-fe7741328d02}.user.xml @@ -0,0 +1,49 @@ + + + + + {c99172d0-fd62-4927-a5bf-7a212358b77a} + + + + + + + + + + + 0.068265670980603113 + + + + + 0.00053792361484669173 + + + + + {50ed937c-e980-445f-9825-0f1a34208655} + {46fce461-1c11-49c1-93c1-3ebeb917fb68} + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/fmod/.user/Metadata/Event/{e332d959-1f13-4c62-91ca-53b5a142c233}.user.xml b/res/fmod/.user/Metadata/Event/{e332d959-1f13-4c62-91ca-53b5a142c233}.user.xml index 5133b63..122b1b5 100644 --- a/res/fmod/.user/Metadata/Event/{e332d959-1f13-4c62-91ca-53b5a142c233}.user.xml +++ b/res/fmod/.user/Metadata/Event/{e332d959-1f13-4c62-91ca-53b5a142c233}.user.xml @@ -1,9 +1,6 @@ - - {aca51545-9374-4735-a7ab-56bd7f41d5af} - {e4b252fb-cdeb-45e4-9b46-af6905e2f962} diff --git a/res/fmod/.user/Metadata/Event/{edb92230-b495-405d-96ce-a8d7283112ef}.user.xml b/res/fmod/.user/Metadata/Event/{edb92230-b495-405d-96ce-a8d7283112ef}.user.xml index d341df8..34ec01b 100644 --- a/res/fmod/.user/Metadata/Event/{edb92230-b495-405d-96ce-a8d7283112ef}.user.xml +++ b/res/fmod/.user/Metadata/Event/{edb92230-b495-405d-96ce-a8d7283112ef}.user.xml @@ -1,9 +1,6 @@ - - {342405c4-d0d2-478c-8d02-f89f916bfd68} - {ddaaf6dd-11ac-4ac7-b861-a83988d8dac9} diff --git a/res/fmod/.user/Metadata/Workspace.user.xml b/res/fmod/.user/Metadata/Workspace.user.xml index 0a7da77..fd50812 100644 --- a/res/fmod/.user/Metadata/Workspace.user.xml +++ b/res/fmod/.user/Metadata/Workspace.user.xml @@ -4,6 +4,9 @@ {c76f5b33-a2b7-4c49-a955-93b595d4abe7} + + {3133d1ab-1d28-4a2b-a6f3-7c47e550eb70} + {990c0635-d9d1-4f92-8a62-1274cb83b5d3} @@ -13,4 +16,5 @@ {240c4f07-7af4-492b-98c5-0b43851e8b4f} + diff --git a/res/fmod/Assets/level3.wav b/res/fmod/Assets/level3.wav new file mode 100644 index 0000000..6584fd9 Binary files /dev/null and b/res/fmod/Assets/level3.wav differ diff --git a/res/fmod/Assets/level4.wav b/res/fmod/Assets/level4.wav new file mode 100644 index 0000000..1677c5a Binary files /dev/null and b/res/fmod/Assets/level4.wav differ diff --git a/res/fmod/Metadata/AudioFile/{598d696a-a866-4860-8a80-85745ab8b7ef}.xml b/res/fmod/Metadata/AudioFile/{598d696a-a866-4860-8a80-85745ab8b7ef}.xml new file mode 100644 index 0000000..e714abf --- /dev/null +++ b/res/fmod/Metadata/AudioFile/{598d696a-a866-4860-8a80-85745ab8b7ef}.xml @@ -0,0 +1,23 @@ + + + + + level3.wav + + + true + + + 44.0999985 + + + 2 + + + 120 + + + {4c4e21c6-cc51-4a2c-b05e-fb67da4f7ed1} + + + diff --git a/res/fmod/Metadata/AudioFile/{b81d31bd-fdcd-4402-a741-3947adc1b7dc}.xml b/res/fmod/Metadata/AudioFile/{b81d31bd-fdcd-4402-a741-3947adc1b7dc}.xml new file mode 100644 index 0000000..c47d043 --- /dev/null +++ b/res/fmod/Metadata/AudioFile/{b81d31bd-fdcd-4402-a741-3947adc1b7dc}.xml @@ -0,0 +1,23 @@ + + + + + level4.wav + + + true + + + 44.0999985 + + + 2 + + + 120 + + + {4c4e21c6-cc51-4a2c-b05e-fb67da4f7ed1} + + + diff --git a/res/fmod/Metadata/Event/{45d68279-4042-4001-9cc3-fe7741328d02}.xml b/res/fmod/Metadata/Event/{45d68279-4042-4001-9cc3-fe7741328d02}.xml new file mode 100644 index 0000000..f1fb334 --- /dev/null +++ b/res/fmod/Metadata/Event/{45d68279-4042-4001-9cc3-fe7741328d02}.xml @@ -0,0 +1,286 @@ + + + + + the_world + + + 1 + + + {b10a4c1b-72f0-4676-bbef-b450aaa46cb6} + + + {225af6d2-0ec3-42cd-8708-435d59e13db9} + + + {364d6d0e-10ca-43eb-8ddc-1feaef1f0b1e} + + + {dc10ec51-31eb-4b49-97a3-0d3e32ccdc4e} + + + {70b0f6cf-fa54-43d9-823b-cffb2baa0a07} + + + {07e04557-2cf3-4129-81e4-b053182f1e64} + + + {55125026-1cc6-4dfd-82ad-1484ecd7227b} + {24b7ea8a-515c-4577-9061-3eced06c8a66} + + + {c99172d0-fd62-4927-a5bf-7a212358b77a} + + + {584c4412-6e00-4a8f-8ffd-9e1e86db46e7} + + + {a23d2b1c-914e-48d4-8df9-80f6edad6c28} + + + + + {11988232-27c1-46ce-a702-72f0ebca0568} + + + + + {11988232-27c1-46ce-a702-72f0ebca0568} + + + + + {75c692d0-2466-4067-99dd-770141a9c101} + + + {49fd5113-41cd-450c-947f-43bcc164aba4} + + + {a028aeaa-4166-48ea-881f-bb967c81e6f1} + + + + + + + {d2659ede-f7fd-415b-9f82-c7ebeffce7f1} + + + {5f0554d2-ba88-4c23-9723-a816bf4d8947} + + + {50ed937c-e980-445f-9825-0f1a34208655} + + + + + {c4addb73-a8c2-4076-a4b4-fee6a447e83c} + + + {2e1aae44-3e34-4f3c-b7ea-219fc2f610cb} + + + {46fce461-1c11-49c1-93c1-3ebeb917fb68} + + + + + {5f0554d2-ba88-4c23-9723-a816bf4d8947} + {2e1aae44-3e34-4f3c-b7ea-219fc2f610cb} + + + {04eb3e5e-90d1-4bd6-8ab8-19cee8511d55} + + + + + {42d91edf-b8cf-42e1-b8e6-2303925a5f74} + + + + + {f14bc47b-e50f-4aee-9792-59f5919a7848} + + + {fd195a95-1360-427b-955e-4582768889b4} + + + {225af6d2-0ec3-42cd-8708-435d59e13db9} + + + + + {78e09892-0e07-4c72-98ee-132122892837} + + + + + + {5c13a4cc-164c-49cb-a1db-a6e20e822ccf} + + + + + 120 + + + {598d696a-a866-4860-8a80-85745ab8b7ef} + + + + + Audio 1 + + + {5c13a4cc-164c-49cb-a1db-a6e20e822ccf} + + + {e47a2e09-d7e6-4780-a397-dfd5c543c401} + + + {89f17956-3af7-416e-96c3-e729a44529e0} + + + {11988232-27c1-46ce-a702-72f0ebca0568} + + + + + {bf1c5ce7-89a6-4de7-a300-ece1e53f376d} + + + + + 120 + + + {b81d31bd-fdcd-4402-a741-3947adc1b7dc} + + + + + Audio 2 + + + {bf1c5ce7-89a6-4de7-a300-ece1e53f376d} + + + {60823b6b-68ee-40df-a288-e95fe1c389b1} + + + {4a31b89f-42a4-4c3e-a5b9-7fb4c9830206} + + + {11988232-27c1-46ce-a702-72f0ebca0568} + + + + + 6 + + + 96 + + + {c99172d0-fd62-4927-a5bf-7a212358b77a} + + + {07e04557-2cf3-4129-81e4-b053182f1e64} + + + + + {467c1d30-2bc6-4dbc-a22c-c5a90e4f0efd} + + + + + + + volume + + + {371830a9-2ede-4b1a-8669-54a649f3b7b5} + + + + + {858df639-4f88-4e19-b097-a7c2ab24f34d} + + + + + + volume + + + {e38ff8e4-0ab4-408f-9a32-63d29f05a350} + + + + + {a8356f3f-e4ad-420f-a4f8-df891fb54211} + + + + + + + {42d91edf-b8cf-42e1-b8e6-2303925a5f74} + + + {b0e93299-7935-428c-8064-e85590b5b6a1} + {cd17390c-6f19-4bb2-a123-406d60c7f1f6} + + + + + + {42d91edf-b8cf-42e1-b8e6-2303925a5f74} + + + {b59b1d93-f7f2-4c75-8721-285eeb22e2c3} + {cb9884cc-19f9-47bd-8e88-e15b7f4d97e5} + + + + + + 0 + + + 0 + + + 1 + + + + + 1 + + + -80 + + + + + 0 + + + -80 + + + -1 + + + + + 1 + + + 0 + + + diff --git a/res/fmod/Metadata/Event/{b2b95b3f-95bc-4633-814f-61ea539b893d}.xml b/res/fmod/Metadata/Event/{b2b95b3f-95bc-4633-814f-61ea539b893d}.xml index 9af04e2..d447f23 100644 --- a/res/fmod/Metadata/Event/{b2b95b3f-95bc-4633-814f-61ea539b893d}.xml +++ b/res/fmod/Metadata/Event/{b2b95b3f-95bc-4633-814f-61ea539b893d}.xml @@ -127,7 +127,7 @@ - 500 + 75 diff --git a/res/fmod/Metadata/Event/{e332d959-1f13-4c62-91ca-53b5a142c233}.xml b/res/fmod/Metadata/Event/{e332d959-1f13-4c62-91ca-53b5a142c233}.xml index c1edbd9..c035bb2 100644 --- a/res/fmod/Metadata/Event/{e332d959-1f13-4c62-91ca-53b5a142c233}.xml +++ b/res/fmod/Metadata/Event/{e332d959-1f13-4c62-91ca-53b5a142c233}.xml @@ -97,6 +97,9 @@ + + -14.5 + Audio 1 diff --git a/res/fmod/Metadata/ParameterPreset/{4bacb865-6588-42b7-9c72-e3ace10a31ef}.xml b/res/fmod/Metadata/ParameterPreset/{4bacb865-6588-42b7-9c72-e3ace10a31ef}.xml new file mode 100644 index 0000000..acc3dc7 --- /dev/null +++ b/res/fmod/Metadata/ParameterPreset/{4bacb865-6588-42b7-9c72-e3ace10a31ef}.xml @@ -0,0 +1,22 @@ + + + + + level_full + + + {14f9ed74-677a-4f62-a034-1edaa3ce3f77} + + + {42d91edf-b8cf-42e1-b8e6-2303925a5f74} + + + + + 0 + + + 0.25 + + + diff --git a/src/game.h b/src/game.h index f0385ee..c489afc 100644 --- a/src/game.h +++ b/src/game.h @@ -7,6 +7,7 @@ #include #include "map.h" #include "muxer.h" +#include "timer.h" const int GAME_WIDTH = 640*2; const int GAME_HEIGHT = 480*2; @@ -43,6 +44,14 @@ struct Input { bool right = false; bool up = false; bool down = false; + + bool operator==(const Input& rhs) const { + return std::tie(left, right, up, down) == std::tie(rhs.left, rhs.right, rhs.up, rhs.down); + } + + bool operator!=(const Input& rhs) const { + return !(*this == rhs); + } }; using coord = std::tuple; @@ -110,6 +119,8 @@ public: bool firstInput = false; Input lastInput; + bool alreadyBumped = false; + Timer bumpCooldown = {500}; }; diff --git a/src/main.cpp b/src/main.cpp index 25da94f..cd1a8c2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,7 +106,11 @@ bool movePlayer(Game& game, int x, int y) return true; } else { - //game.muxer.playSoundAtPosition("bump", game.player_x, game.player_y); + if (!game.alreadyBumped) { + game.muxer.playSoundAtPosition("bump", x, y); + game.alreadyBumped = true; + game.bumpCooldown.reset(); + } return false; } @@ -409,7 +413,7 @@ void setZoom(Game& game, size_t zoom) { game.curBoundY = game.map.getBottom() - zoom * ZOOM_Y_FACTOR; } - + int zoomLevel = getZoomLevel(game); if (zoomLevel == 0) { game.muxer.setMusicLevel(0); @@ -538,6 +542,7 @@ int main(int, char**) game.numLamps++; game.dirtyLighting = true; kickUpDust(game, game.player_x, game.player_y, 0); + game.muxer.playSoundAtPosition("drop", game.player_x, game.player_y); if (game.firstInput) { @@ -576,6 +581,8 @@ int main(int, char**) std::get<0>(moveTo), std::get<1>(moveTo)); } + + //game.muxer.playSoundAtPosition("dash", game.player_x, game.player_y); } } } @@ -592,6 +599,11 @@ int main(int, char**) keystate.up = state[SDL_SCANCODE_UP]; keystate.down = state[SDL_SCANCODE_DOWN]; + game.bumpCooldown.accumulate(frameTime); + if (game.alreadyBumped && keystate != game.lastInput && game.bumpCooldown.step()) { + game.alreadyBumped = false; + } + if (keystate.left || keystate.right || keystate.up || keystate.down) { game.firstInput = true; diff --git a/src/timer.h b/src/timer.h new file mode 100644 index 0000000..ec34f3e --- /dev/null +++ b/src/timer.h @@ -0,0 +1,32 @@ +#ifndef TIMER_H_45E2F1F9 +#define TIMER_H_45E2F1F9 + +class Timer { +public: + + Timer(int dt) : dt_(dt) {} + + void accumulate(int t) { + acc_ += t; + } + + bool step() { + if (acc_ > dt_) { + acc_ -= dt_; + return true; + } else { + return false; + } + } + + void reset() { + acc_ = 0; + } + +private: + + int dt_; + int acc_ = 0; +}; + +#endif /* end of include guard: TIMER_H_45E2F1F9 */ -- cgit 1.4.1