Skip to content

Conversation

@finger563
Copy link
Contributor

@finger563 finger563 commented May 1, 2025

Description

  • Update doom to have callbacks for when the player
    • Fires a weapon
    • Picks up a weapon
    • Interacts with something (switch, door, etc.)
    • Gets damaged (depending on amount of damage and armor)
    • Gets health / armor (depending on amount and type)
    • Picks up a power up
    • Picks up a key / card
  • Update doom implementation to trigger the various haptic effects using the callbacks

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 main on 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

* 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.
@github-actions
Copy link

github-actions bot commented May 1, 2025

✅Static analysis result - no issues found! ✅

@finger563 finger563 self-assigned this May 1, 2025
@finger563 finger563 requested a review from Copilot May 1, 2025 21:28
@finger563 finger563 added enhancement New feature or request doom haptics labels May 1, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@finger563 finger563 changed the title feat(doom): Add haptic support to doom feat(doom): Add haptic feedback to doom May 2, 2025
@finger563 finger563 requested a review from Copilot May 2, 2025 15:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@finger563 finger563 merged commit 84a317b into main May 2, 2025
1 check passed
@finger563 finger563 deleted the feat/doom-haptics branch May 2, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doom enhancement New feature or request haptics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants