Skip to content

[WIP] Add tactical help screen and command entry in combat#2

Draft
Copilot wants to merge 1 commit into
mainfrom
copilot/add-tactical-help-functionality
Draft

[WIP] Add tactical help screen and command entry in combat#2
Copilot wants to merge 1 commit into
mainfrom
copilot/add-tactical-help-functionality

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 27, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Problem: In Games/starship_sim the in-combat (tactical) help (F1) and entering commands while in combat do not work. The code has forward declarations for PrintHelpTactical, ShipComputerTerminal, GetNextInput and others, but there is no working tactical help implementation or F1 handling in the combat input loop. This causes user input of F1 to be ignored in combat and prevents entering commands via the ship computer while in combat.

Goal: Modify the starship_sim source so that pressing F1 during a tactical/combat encounter shows a tactical help screen, and provide a way to enter ship/computer commands while in combat (for example pressing 'c' to open the ship computer input). Ensure the help display and command entry do not disrupt the tactical UI: after help or command entry, the arena/tactical frame should be redrawn.

Files to change:

  • Games/starship_sim/src/starship_sim.pb

Required changes (detailed, actionable):

  1. Add a PrintHelpTactical() procedure implementation in Games/starship_sim/src/starship_sim.pb. The procedure should print a concise tactical help text describing combat keys (movement, phasers, torpedoes, tractor beam, power allocation, 'c' for computer/commands, F1 for help) using existing PrintN/Print functions or the same console/print mechanism used by the tactical UI. The help routine should leave the console in a usable state for the calling code (i.e., include blank lines before/after and not alter global state). If a shared PrintHelp() or other help-printing helper already exists, PrintHelpTactical should call or reuse it where appropriate.

  2. Modify the tactical/combat input loop so that RawKey() is checked for F1 (raw code 112) and when detected it calls PrintHelpTactical(), then redraws the tactical arena (by calling PrintArenaTactical or PrintArenaFrame or whatever redraw routine is used in that combat loop). The same input loop should also support opening the ship computer input when the user presses 'c' or 'C' (or another single-key binding), by calling ShipComputerTerminal(*p.Ship) or, if ShipComputerTerminal is not yet implemented, by calling GetNextInput() / InputLineHdl to get a command string and send it to existing command parsing logic.

  3. If ShipComputerTerminal or GetNextInput are declared but not implemented, add a minimal ShipComputerTerminal implementation that calls InputLineHdl(prompt) (or GetNextInput) to read a line with F1 help support, and processes the returned command string through the game's existing command parser (or by returning the command to the caller). The minimal implementation should at least allow entering commands like power allocations or help requests without crashing.

  4. After calling help or the ship computer, ensure any temporary engine sound loops or UI state is restored (for example re-print the tactical arena and re-enable any input polls). In practice this means the combat loop should call the same redraw function(s) it uses after normal player actions.

Notes for the patch author (coding agent):

  • The repository and file use PureBasic. Keep style consistent with existing code and use the existing PrintN/PrintArenaTactical/PrintArenaFrame functions for output and redraw where appropriate.
  • Search for the combat input loop (functions: EnterCombat, PlayerMove, PrintArenaTactical, PrintArenaFrame, etc.) and add RawKey() checks for F1 and for 'c'. If there are multiple places handling raw keys during combat (fleet support, autopilot, AI turns), add the F1 handling to the primary player input location so F1 works in all standard player-controlled combat turns.
  • If there are multiple codepaths for console vs GUI modes, ensure the help and command entry are implemented for the console/tactical path used by the current build.
  • Keep the change minimal and low-risk: prefer adding a small PrintHelpTactical and a couple checks in the input loop over refactoring.

Deliverable: Create a branch, apply the changes, and open a pull request in the repository 'zonemaster60/PureBasic' with a concise title and a description summarizing the edits. The PR should include unit-test-like manual test instructions in the description showing how to reproduce the previous bug and how the patch fixes it (e.g., run the game, engage an enemy, press F1 during combat, press 'c' to open the ship computer). Also include any implementation notes and mention if any behaviors were intentionally left as minimal stubs for future enhancement.

Do not change unrelated files. If you cannot find the combat loop or the right place to insert the RawKey checks, attempt to add PrintHelpTactical and ShipComputerTerminal implementations first and then add a clear TODO comment in the tactical input area indicating where to call them; document this in the PR description so a reviewer can finish wiring the handler if needed.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

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.

2 participants