feat(doom): Add haptic feedback to doom#102
Merged
Conversation
* Update doom to have callbacks for when the player is damaged and when they fire a weapon * Update doom implementation to trigger different haptic effects depending on the weapon fired and the amount of damage taken Haptics are awesome, and with doom we have the actual source code so we can do some fun stuff :) Build and run `main` on Box-Emu v0 which has haptics and ensure it feels good.
|
✅Static analysis result - no issues found! ✅ |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR integrates haptic feedback within Doom by triggering different haptic effects when the player fires a weapon or takes damage.
- Added a call in the main loop to set and play a haptic effect using the GUI's waveform.
- Implemented two new functions (R_PlayerFire and R_PlayerHurt) in doom.cpp that determine the appropriate haptic effect based on the weapon fired and damage received.
- Updated relevant header and source files to declare and invoke haptic callbacks in the prboom module.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| main/main.cpp | Added haptic effect setup and trigger call in the main loop. |
| components/gui/include/gui.hpp | Added a getter for retrieving the haptic waveform value. |
| components/doom/src/doom.cpp | Introduced functions to trigger haptic feedback on player actions. |
| components/doom/prboom/r_main.h | Declared new haptic functions; note missing implementation for one. |
| components/doom/prboom/p_pspr.c | Updated weapon fire function to trigger haptic feedback. |
| components/doom/prboom/p_inter.c | Updated damage processing to trigger haptic effects on injury. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces haptic feedback functionality to the Doom engine by adding several callbacks for various in‐game events (such as firing weapons, taking damage, and item pickups) and updating relevant documentation. Key changes include:
- Adding new haptic callback functions and integrating them with player actions in Doom (e.g. firing, getting hurt, interacting with switches).
- Minor code improvements and cleanup in shared memory, pool allocator functions, and GUI components.
- Updating the README to document the new haptic feedback features.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| main/main.cpp | Added a haptic effect trigger using the current GUI waveform setting. |
| main/cart.hpp | Removed redundant virtual specifiers on getter functions. |
| components/shared_memory/src/shared_memory.c | Fixed printf cast for current_offset_. |
| components/pool_allocator/* | Changed pool_contains function signature to take a const pointer. |
| components/msx/src/msx.cpp | Cleaned commented code and simplified control flow in key waiting logic. |
| components/gui/include/gui.hpp | Added a simple getter for the haptic waveform. |
| components/doom/src/doom.cpp | Added new enum values and functions for triggering haptic effects. |
| components/doom/prboom/* | Integrated haptic callbacks into various event handlers (weapon fire, item pickups, damage, switch usage). |
| README.md | Updated documentation to include descriptions of the new haptic feedback feature. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Motivation and Context
Haptics are awesome, and with doom we have the actual source code so we can do some fun stuff :)
How has this been tested?
Build and run
mainon Box-Emu v0 which has haptics and ensure it feels good.Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):
Types of changes
Checklist:
Software
.github/workflows/build.ymlfile to add my new test to the automated cloud build github action.