paavohtl Claude Opus 4.6 (1M context) commited on
Commit
a87e5b4
·
1 Parent(s): 9ff76f4

feat: add Cheats menu to debug UI with "Unlock all weapons"

Browse files

Add a menu bar to the debug UI toolbar with a Cheats dropdown.
"Unlock all weapons" sets ammo to -1 (unlimited) and delays to 0
for all 6 alliances across all 71 weapons, using the new typed
WeaponSlots/TeamWeaponSlots structs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. crates/openwa-debugui/src/app.rs +27 -0
crates/openwa-debugui/src/app.rs CHANGED
@@ -84,6 +84,25 @@ unsafe fn get_ddgame() -> Option<*const DDGame> {
84
  Some(ddgame_ptr)
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  /// Read child task pointers from a CTask's children array.
88
  ///
89
  /// The array is **sparse**: slots are nulled when a child is removed rather than
@@ -221,6 +240,14 @@ impl eframe::App for DebugApp {
221
  self.nav_history.retain(|a| live_addrs.contains(a));
222
 
223
  egui::TopBottomPanel::top("toolbar").show(ctx, |ui| {
 
 
 
 
 
 
 
 
224
  ui.horizontal(|ui| {
225
  ui.checkbox(&mut self.show_transient, "Show transient");
226
  });
 
84
  Some(ddgame_ptr)
85
  }
86
 
87
+ /// Unlock all weapons: set ammo to unlimited (-1) and delays to 0 for all teams.
88
+ unsafe fn cheat_unlock_all_weapons() {
89
+ let Some(ddgame) = get_ddgame() else {
90
+ log::push("[Cheats] Not in game");
91
+ return;
92
+ };
93
+ let ddgame = ddgame as *mut DDGame;
94
+ let arena = &mut (*ddgame).team_arena;
95
+ for team in &mut arena.weapon_slots.teams {
96
+ for ammo in &mut team.ammo {
97
+ *ammo = -1; // unlimited
98
+ }
99
+ for delay in &mut team.delay {
100
+ *delay = 0; // no delay
101
+ }
102
+ }
103
+ log::push("[Cheats] All weapons unlocked (infinite ammo, no delays)");
104
+ }
105
+
106
  /// Read child task pointers from a CTask's children array.
107
  ///
108
  /// The array is **sparse**: slots are nulled when a child is removed rather than
 
240
  self.nav_history.retain(|a| live_addrs.contains(a));
241
 
242
  egui::TopBottomPanel::top("toolbar").show(ctx, |ui| {
243
+ egui::menu::bar(ui, |ui| {
244
+ ui.menu_button("Cheats", |ui| {
245
+ if ui.button("Unlock all weapons").clicked() {
246
+ unsafe { cheat_unlock_all_weapons() };
247
+ ui.close_menu();
248
+ }
249
+ });
250
+ });
251
  ui.horizontal(|ui| {
252
  ui.checkbox(&mut self.show_transient, "Show transient");
253
  });