Skip to content

animations and sounds and more tools#7

Merged
dawc17 merged 8 commits into
masterfrom
dev
Feb 15, 2026
Merged

animations and sounds and more tools#7
dawc17 merged 8 commits into
masterfrom
dev

Conversation

@dawc17

@dawc17 dawc17 commented Feb 15, 2026

Copy link
Copy Markdown
Owner

This pull request introduces a new audio engine to the project, enabling sound effects for player actions such as footsteps, block breaking, and block placing. It also adds support for multiple pickaxe types, updates the rendering logic for held items to allow for more dynamic animations, and embeds additional assets for these features. The most important changes are summarized below:

Audio Engine Integration:

  • Added a new AudioEngine class with support for initializing, updating, and shutting down audio, as well as playing sounds for footsteps, block breaking, and block placing. Integrated the engine into the main game loop and player actions. (src/audio/AudioEngine.h, src/audio/AudioEngine.cpp, src/core/MainGlobals.cpp, src/core/MainGlobals.h, src/core/main.cpp, [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]
  • Introduced SurfaceType and a helper function to map block IDs to surface types for context-sensitive footstep sounds. (src/audio/AudioTypes.h, src/audio/AudioTypes.hR1-R36)
  • Added a C translation unit for stb_vorbis to support audio decoding. (src/audio/stb_vorbis_impl.c, src/audio/stb_vorbis_impl.cR1-R3)
  • Updated CMake configuration to include new audio sources and link with additional Windows libraries for audio support. (src/CMakeLists.txt, [1] [2]

Gameplay and Animation Enhancements:

  • Added new player state fields and logic for swinging and placing animations, including timers and progress tracking for smoother visual feedback. (src/gameplay/Player.h, src/gameplay/Player.cpp, src/core/main.cpp, [1] [2] [3]
  • Updated held item rendering to use new animation parameters and allow for tuning of swing and place motions. (src/core/Renderer.cpp, [1] [2]

Asset and Inventory Updates:

  • Embedded additional pickaxe textures and added them to the creative inventory, supporting diamond, wood, stone, gold, and iron pickaxes. (src/CMakeLists.txt, src/gameplay/Inventory.cpp, [1] [2] [3]
  • Updated the asset embedding system in CMake to organize tools, blocks, and shaders more clearly. (src/CMakeLists.txt, [1] [2] [3]

These changes collectively enhance the game's immersion with audio feedback, expand the available tools, and improve the visual and interactive experience.

Add wood/stone/gold/iron pickaxe textures and embed them in the build; register new tool IDs and include the textures in the tool model loader. Expose the tools in the creative inventory. Implement player swing state (isSwinging, swingProgress), set swinging on mouse actions, advance swing progress each frame (with a loop mode while holding the mine button in survival), and apply a sinusoidal transform when rendering the held item to show a swing animation.
Introduce a separate block placement animation and runtime tuning UI. Added Player fields (isPlacing, placeProgress) and update logic in main loop to advance/place timing. Renderer was updated to support placing animations and configurable block transforms/tuning (g_blockTransform, g_blockSwingTuning, g_blockPlaceTuning) and to apply easing for place animation; swing logic was slightly adjusted and made use of tuning values. Debug UI now exposes controls to edit/reset block transform, swing and place tuning values. Also minor ImGui window position tweak (imgui.ini).
Introduce a new audio subsystem using miniaudio: add AudioEngine (cpp/h) and AudioTypes, plus bundled thirdparty/miniaudio.h. Add numerous .ogg sound assets under assets/sounds (footsteps, block dig, damage, liquid). Integrate audio into the app: compile AudioEngine via CMake, add extra Windows link deps (ole32, avrt), expose g_audioEngine global, initialize audio in main, update listener and engine each frame, and trigger footstep/block place/break sounds. Implementation includes spatialized one-shot playback, ambient streaming loops, and simple volume fading.
Embed stb_vorbis decoder and compile it as a separate C translation unit to avoid C/C++ header conflicts; added src/thirdparty/stb_vorbis.c and a small wrapper src/audio/stb_vorbis_impl.c, and updated src/CMakeLists.txt to include the new audio translation unit. Refactor AudioEngine::Impl ActiveOneShot to use std::unique_ptr<ma_sound> with proper zero-initialization and updated all ma_sound_* calls to use the pointer API (.get()). Include necessary headers (<cstring>, <memory>) and pull in a header-only declaration of stb_vorbis within AudioEngine.cpp to expose the API without conflicting definitions. Also updated imgui.ini to adjust several ImGui window positions/sizes.
@dawc17
dawc17 merged commit 4d0d383 into master Feb 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant