Skip to content

p_doors: route locked-door messages through DEH_String#138

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-locked-door-messages
Open

p_doors: route locked-door messages through DEH_String#138
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-locked-door-messages

Conversation

Copy link
Copy Markdown

Copilot AI commented May 21, 2026

EV_DoLockedDoor and EV_VerticalDoor were still assigning hardcoded English lock messages, so Dehacked string replacements for key-required prompts were ignored. This aligns the Rust port with the C behavior by restoring the DEH_String(PD_*) indirection for all locked-door/object cases.

  • What changed

    • Added canonical PD_BLUEO, PD_REDO, PD_YELLOWO, PD_BLUEK, PD_REDK, and PD_YELLOWK constants in room/src/doom/p_doors.rs
    • Routed both locked-object and locked-door failure messages through the local DEH_String shim instead of embedding literals at the call sites
  • Call-site cleanup

    • Centralized special-to-message mapping in small helpers for:
      • object-activation locks (99/133, 134/135, 136/137)
      • use-key door locks (26/32, 27/34, 28/33)
    • Removed duplicated message literals from the door logic branches
  • Regression coverage

    • Added focused p_doors tests asserting that each locked special maps to the expected DEH_String(PD_*) message
match special {
    26 | 32 => DEH_String(PD_BLUEK),
    27 | 34 => DEH_String(PD_YELLOWK),
    28 | 33 => DEH_String(PD_REDK),
    _ => unreachable!("unexpected locked door special: {special}"),
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https relro -o /home/REDACTED/work/room/room/target/debug/build/khronos-egl-70a2b76c9628275f/build_script_build-70a2b76c9628275f lib/�� 0779cc9eccb950/r/home/REDACTED/work/room/room/target/debug/build/naga-f2cede7214b0b354/build_scrip/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/rustc 0779cc9eccb950/b-Wl,--as-needed lib/rustlib/x86_64-REDACTED-linux-gnu/bin/gcc-ld/ld.lld (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI and others added 2 commits May 21, 2026 21:57
Agent-Logs-Url: https://github.com/sunsided/room/sessions/0f360341-019e-4a59-a339-87ac4be21cff

Co-authored-by: sunsided <495335+sunsided@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix hardcoded messages in EV_DoLockedDoor and EV_VerticalDoor p_doors: route locked-door messages through DEH_String May 21, 2026
Copilot AI requested a review from sunsided May 21, 2026 22:04
@sunsided sunsided marked this pull request as ready for review May 21, 2026 22:04
Copilot AI review requested due to automatic review settings May 21, 2026 22:04
@github-actions github-actions Bot added the area-p_doors Area: p_doors label May 21, 2026
Copy link
Copy Markdown

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 restores the original Doom/Chocolate Doom behavior for key-locked door/object failure prompts by routing all lock messages through DEH_String(PD_*) indirection (instead of embedding hardcoded English literals at each call site). This ensures DeHackEd-style string replacement can be applied consistently in the Rust port, matching the C implementation’s string-table pattern.

Changes:

  • Added PD_* lock-message constants for locked objects and locked doors in p_doors.rs.
  • Centralized special-to-message selection via locked_object_message() / locked_door_message() and used them in EV_DoLockedDoor and EV_VerticalDoor.
  • Added unit tests validating that each locked special maps to the expected DEH_String(PD_*) message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread room/src/doom/p_doors.rs
Comment on lines 324 to +330
match (*line).special as c_int {
99 | 133 => {
if p.is_null() {
return 0;
}
if (*p).cards[it_bluecard] == 0 && (*p).cards[it_blueskull] == 0 {
// FIXME: C uses DEH_String(PD_BLUEO) here; Dehacked blue-object message is not patchable.
(*p).message = cstr!("You need a blue key to activate this object");
(*p).message = locked_object_message((*line).special as c_int);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-p_doors Area: p_doors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

p_doors: EV_DoLockedDoor and EV_VerticalDoor use hardcoded key messages instead of DEH_String

3 participants