feat: add #[derive(FieldRegistry)] to all task entity structs
Browse filesApply FieldRegistry to every #[repr(C)] struct under task/:
CTaskMine, CTaskOilDrum, CTaskCrate, CTaskCloud, CTaskFilter,
CTaskFire, CTaskTeam, CTaskTurnGame, TurnGameCtx, BitGrid,
BungeeTrailTask, WeaponAimTask.
All entity types now have auto-generated field maps available in the
global registry, so the debug UI's raw memory view labels every known
field automatically.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- crates/openwa-core/src/task/bit_grid.rs +2 -0
- crates/openwa-core/src/task/cloud.rs +2 -0
- crates/openwa-core/src/task/filter.rs +2 -0
- crates/openwa-core/src/task/fire.rs +2 -0
- crates/openwa-core/src/task/mine_oil_drum.rs +3 -0
- crates/openwa-core/src/task/overlays.rs +3 -0
- crates/openwa-core/src/task/supply_crate.rs +2 -0
- crates/openwa-core/src/task/team.rs +2 -0
- crates/openwa-core/src/task/turn_game.rs +3 -0
crates/openwa-core/src/task/bit_grid.rs
CHANGED
|
@@ -2,10 +2,12 @@
|
|
| 2 |
|
| 3 |
use crate::rebase::rb;
|
| 4 |
use crate::wa_alloc::wa_malloc;
|
|
|
|
| 5 |
|
| 6 |
/// Bitfield grid buffer used for spatial collision/visibility queries.
|
| 7 |
/// Vtable at 0x6640EC (shared with DisplayGfx base).
|
| 8 |
/// Size: 0x2C bytes (11 u32 fields).
|
|
|
|
| 9 |
#[repr(C)]
|
| 10 |
pub struct BitGrid {
|
| 11 |
pub vtable: u32,
|
|
|
|
| 2 |
|
| 3 |
use crate::rebase::rb;
|
| 4 |
use crate::wa_alloc::wa_malloc;
|
| 5 |
+
use crate::FieldRegistry;
|
| 6 |
|
| 7 |
/// Bitfield grid buffer used for spatial collision/visibility queries.
|
| 8 |
/// Vtable at 0x6640EC (shared with DisplayGfx base).
|
| 9 |
/// Size: 0x2C bytes (11 u32 fields).
|
| 10 |
+
#[derive(FieldRegistry)]
|
| 11 |
#[repr(C)]
|
| 12 |
pub struct BitGrid {
|
| 13 |
pub vtable: u32,
|
crates/openwa-core/src/task/cloud.rs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
use super::base::CTask;
|
| 2 |
use crate::fixed::Fixed;
|
|
|
|
| 3 |
|
| 4 |
/// Airstrike / weather cloud task.
|
| 5 |
///
|
|
@@ -17,6 +18,7 @@ use crate::fixed::Fixed;
|
|
| 17 |
///
|
| 18 |
/// Source: Ghidra decompilation of 0x5482E0 (constructor) and
|
| 19 |
/// 0x5484C0 (HandleMessage update + render branches).
|
|
|
|
| 20 |
#[repr(C)]
|
| 21 |
pub struct CTaskCloud {
|
| 22 |
/// 0x00β0x2F: CTask base
|
|
|
|
| 1 |
use super::base::CTask;
|
| 2 |
use crate::fixed::Fixed;
|
| 3 |
+
use crate::FieldRegistry;
|
| 4 |
|
| 5 |
/// Airstrike / weather cloud task.
|
| 6 |
///
|
|
|
|
| 18 |
///
|
| 19 |
/// Source: Ghidra decompilation of 0x5482E0 (constructor) and
|
| 20 |
/// 0x5484C0 (HandleMessage update + render branches).
|
| 21 |
+
#[derive(FieldRegistry)]
|
| 22 |
#[repr(C)]
|
| 23 |
pub struct CTaskCloud {
|
| 24 |
/// 0x00β0x2F: CTask base
|
crates/openwa-core/src/task/filter.rs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
use super::base::CTask;
|
|
|
|
| 2 |
|
| 3 |
/// Message-subscription filter task β routes messages selectively to child tasks.
|
| 4 |
///
|
|
@@ -31,6 +32,7 @@ use super::base::CTask;
|
|
| 31 |
/// and optionally 0x0E (if `GameInfo+0xD778 < -1`)
|
| 32 |
/// - `CTaskTeam__CreateWeatherFilter` (0x552960): subscribes to 1, 2, 3, 0x54, then
|
| 33 |
/// spawns `CTaskCloud` children using randomised positions (only if `DDGame+0x777C == 0`)
|
|
|
|
| 34 |
#[repr(C)]
|
| 35 |
pub struct CTaskFilter {
|
| 36 |
/// 0x00β0x2F: CTask base.
|
|
|
|
| 1 |
use super::base::CTask;
|
| 2 |
+
use crate::FieldRegistry;
|
| 3 |
|
| 4 |
/// Message-subscription filter task β routes messages selectively to child tasks.
|
| 5 |
///
|
|
|
|
| 32 |
/// and optionally 0x0E (if `GameInfo+0xD778 < -1`)
|
| 33 |
/// - `CTaskTeam__CreateWeatherFilter` (0x552960): subscribes to 1, 2, 3, 0x54, then
|
| 34 |
/// spawns `CTaskCloud` children using randomised positions (only if `DDGame+0x777C == 0`)
|
| 35 |
+
#[derive(FieldRegistry)]
|
| 36 |
#[repr(C)]
|
| 37 |
pub struct CTaskFilter {
|
| 38 |
/// 0x00β0x2F: CTask base.
|
crates/openwa-core/src/task/fire.rs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
use super::base::CTask;
|
|
|
|
| 2 |
|
| 3 |
/// Fire/flame entity task.
|
| 4 |
///
|
|
@@ -11,6 +12,7 @@ use super::base::CTask;
|
|
| 11 |
/// at 0xFFFF and counts down each frame; when it reaches zero the fire
|
| 12 |
/// dies. `lifetime` at +0xB1 is a signed byte: 0xFF (= -1i8) means alive,
|
| 13 |
/// 0 means the task is being destroyed.
|
|
|
|
| 14 |
#[repr(C)]
|
| 15 |
pub struct CTaskFire {
|
| 16 |
/// 0x00-0x2F: CTask base
|
|
|
|
| 1 |
use super::base::CTask;
|
| 2 |
+
use crate::FieldRegistry;
|
| 3 |
|
| 4 |
/// Fire/flame entity task.
|
| 5 |
///
|
|
|
|
| 12 |
/// at 0xFFFF and counts down each frame; when it reaches zero the fire
|
| 13 |
/// dies. `lifetime` at +0xB1 is a signed byte: 0xFF (= -1i8) means alive,
|
| 14 |
/// 0 means the task is being destroyed.
|
| 15 |
+
#[derive(FieldRegistry)]
|
| 16 |
#[repr(C)]
|
| 17 |
pub struct CTaskFire {
|
| 18 |
/// 0x00-0x2F: CTask base
|
crates/openwa-core/src/task/mine_oil_drum.rs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
use super::game_task::CGameTask;
|
|
|
|
| 2 |
|
| 3 |
/// Land mine entity task.
|
| 4 |
///
|
|
@@ -10,6 +11,7 @@ use super::game_task::CGameTask;
|
|
| 10 |
///
|
| 11 |
/// Source: Ghidra decompilation of 0x506660 (constructor) and
|
| 12 |
/// 0x5072E0 (HandleMessage, msg 2/0x15/0x1C/0x4B branches).
|
|
|
|
| 13 |
#[repr(C)]
|
| 14 |
pub struct CTaskMine {
|
| 15 |
/// 0x00β0xFB: CGameTask base (pos at 0x84/0x88, speed at 0x90/0x94)
|
|
@@ -45,6 +47,7 @@ const _: () = assert!(core::mem::size_of::<CTaskMine>() == 0x128);
|
|
| 45 |
///
|
| 46 |
/// Source: Ghidra decompilation of 0x504AF0 (constructor) and
|
| 47 |
/// 0x5050B0 (HandleMessage, msg 2/0x1C branches).
|
|
|
|
| 48 |
#[repr(C)]
|
| 49 |
pub struct CTaskOilDrum {
|
| 50 |
/// 0x00β0xFB: CGameTask base (pos at 0x84/0x88, speed at 0x90/0x94)
|
|
|
|
| 1 |
use super::game_task::CGameTask;
|
| 2 |
+
use crate::FieldRegistry;
|
| 3 |
|
| 4 |
/// Land mine entity task.
|
| 5 |
///
|
|
|
|
| 11 |
///
|
| 12 |
/// Source: Ghidra decompilation of 0x506660 (constructor) and
|
| 13 |
/// 0x5072E0 (HandleMessage, msg 2/0x15/0x1C/0x4B branches).
|
| 14 |
+
#[derive(FieldRegistry)]
|
| 15 |
#[repr(C)]
|
| 16 |
pub struct CTaskMine {
|
| 17 |
/// 0x00β0xFB: CGameTask base (pos at 0x84/0x88, speed at 0x90/0x94)
|
|
|
|
| 47 |
///
|
| 48 |
/// Source: Ghidra decompilation of 0x504AF0 (constructor) and
|
| 49 |
/// 0x5050B0 (HandleMessage, msg 2/0x1C branches).
|
| 50 |
+
#[derive(FieldRegistry)]
|
| 51 |
#[repr(C)]
|
| 52 |
pub struct CTaskOilDrum {
|
| 53 |
/// 0x00β0xFB: CGameTask base (pos at 0x84/0x88, speed at 0x90/0x94)
|
crates/openwa-core/src/task/overlays.rs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
use super::base::CTask;
|
| 2 |
use super::game_task::{CGameTask, SoundEmitter};
|
| 3 |
use crate::fixed::Fixed;
|
|
|
|
| 4 |
|
| 5 |
/// Bungee trail rendering task fields.
|
| 6 |
///
|
|
@@ -9,6 +10,7 @@ use crate::fixed::Fixed;
|
|
| 9 |
/// offsets for different purposes.
|
| 10 |
///
|
| 11 |
/// Cast a task pointer to this type when you know it's a bungee trail task.
|
|
|
|
| 12 |
#[repr(C)]
|
| 13 |
pub struct BungeeTrailTask {
|
| 14 |
/// 0x00-0x2F: CTask base
|
|
@@ -47,6 +49,7 @@ const _: () = assert!(core::mem::size_of::<BungeeTrailTask>() == 0xFC);
|
|
| 47 |
/// class region beyond CGameTask (0xFC). The exact class name is unknown.
|
| 48 |
///
|
| 49 |
/// Cast a task pointer to this type when you know it's a worm/weapon aiming task.
|
|
|
|
| 50 |
#[repr(C)]
|
| 51 |
pub struct WeaponAimTask {
|
| 52 |
/// 0x00-0xFB: CGameTask base
|
|
|
|
| 1 |
use super::base::CTask;
|
| 2 |
use super::game_task::{CGameTask, SoundEmitter};
|
| 3 |
use crate::fixed::Fixed;
|
| 4 |
+
use crate::FieldRegistry;
|
| 5 |
|
| 6 |
/// Bungee trail rendering task fields.
|
| 7 |
///
|
|
|
|
| 10 |
/// offsets for different purposes.
|
| 11 |
///
|
| 12 |
/// Cast a task pointer to this type when you know it's a bungee trail task.
|
| 13 |
+
#[derive(FieldRegistry)]
|
| 14 |
#[repr(C)]
|
| 15 |
pub struct BungeeTrailTask {
|
| 16 |
/// 0x00-0x2F: CTask base
|
|
|
|
| 49 |
/// class region beyond CGameTask (0xFC). The exact class name is unknown.
|
| 50 |
///
|
| 51 |
/// Cast a task pointer to this type when you know it's a worm/weapon aiming task.
|
| 52 |
+
#[derive(FieldRegistry)]
|
| 53 |
#[repr(C)]
|
| 54 |
pub struct WeaponAimTask {
|
| 55 |
/// 0x00-0xFB: CGameTask base
|
crates/openwa-core/src/task/supply_crate.rs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
use super::game_task::CGameTask;
|
|
|
|
| 2 |
|
| 3 |
/// Weapon/health/utility crate entity task.
|
| 4 |
///
|
|
@@ -13,6 +14,7 @@ use super::game_task::CGameTask;
|
|
| 13 |
/// param_3 into offset 0x110, making the crate carry its full configuration.
|
| 14 |
///
|
| 15 |
/// Source: Ghidra decompilation of 0x502490, wkJellyWorm CTaskCrate.h
|
|
|
|
| 16 |
#[repr(C)]
|
| 17 |
pub struct CTaskCrate {
|
| 18 |
/// 0x00β0xFB: CGameTask base (pos at 0x84/0x88, speed at 0x90/0x94)
|
|
|
|
| 1 |
use super::game_task::CGameTask;
|
| 2 |
+
use crate::FieldRegistry;
|
| 3 |
|
| 4 |
/// Weapon/health/utility crate entity task.
|
| 5 |
///
|
|
|
|
| 14 |
/// param_3 into offset 0x110, making the crate carry its full configuration.
|
| 15 |
///
|
| 16 |
/// Source: Ghidra decompilation of 0x502490, wkJellyWorm CTaskCrate.h
|
| 17 |
+
#[derive(FieldRegistry)]
|
| 18 |
#[repr(C)]
|
| 19 |
pub struct CTaskCrate {
|
| 20 |
/// 0x00β0xFB: CGameTask base (pos at 0x84/0x88, speed at 0x90/0x94)
|
crates/openwa-core/src/task/team.rs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
use super::base::CTask;
|
| 2 |
use crate::fixed::Fixed;
|
|
|
|
| 3 |
|
| 4 |
/// Per-team state-tracker task β one instance per team, child of CTaskTurnGame.
|
| 5 |
///
|
|
@@ -18,6 +19,7 @@ use crate::fixed::Fixed;
|
|
| 18 |
/// - `_item_slots[0..99]` at +0x88: up to 100 weapon/item IDs loaded from scheme
|
| 19 |
/// - `worm_count` at +0x218: number of CTaskWorm children constructed (1-indexed)
|
| 20 |
/// - SharedData node (0x30 bytes) registered with key = (team_index, type=0x15)
|
|
|
|
| 21 |
#[repr(C)]
|
| 22 |
pub struct CTaskTeam {
|
| 23 |
/// 0x00β0x2F: CTask base (vtable, parent, children, shared_data, ddgame, β¦)
|
|
|
|
| 1 |
use super::base::CTask;
|
| 2 |
use crate::fixed::Fixed;
|
| 3 |
+
use crate::FieldRegistry;
|
| 4 |
|
| 5 |
/// Per-team state-tracker task β one instance per team, child of CTaskTurnGame.
|
| 6 |
///
|
|
|
|
| 19 |
/// - `_item_slots[0..99]` at +0x88: up to 100 weapon/item IDs loaded from scheme
|
| 20 |
/// - `worm_count` at +0x218: number of CTaskWorm children constructed (1-indexed)
|
| 21 |
/// - SharedData node (0x30 bytes) registered with key = (team_index, type=0x15)
|
| 22 |
+
#[derive(FieldRegistry)]
|
| 23 |
#[repr(C)]
|
| 24 |
pub struct CTaskTeam {
|
| 25 |
/// 0x00β0x2F: CTask base (vtable, parent, children, shared_data, ddgame, β¦)
|
crates/openwa-core/src/task/turn_game.rs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
use super::base::CTask;
|
| 2 |
use crate::fixed::Fixed;
|
|
|
|
| 3 |
|
| 4 |
/// Embedded intermediate game-context sub-object within `CTaskTurnGame`.
|
| 5 |
///
|
|
@@ -25,6 +26,7 @@ use crate::fixed::Fixed;
|
|
| 25 |
/// either constructor; they appear to be set by `FUN_005514d0` or similar
|
| 26 |
/// helpers called later. Observed runtime values: +0xA0 = 15, +0xA4/+0xA8
|
| 27 |
/// are heap pointers.
|
|
|
|
| 28 |
#[repr(C)]
|
| 29 |
pub struct TurnGameCtx {
|
| 30 |
/// +0x00 (= CTaskTurnGame+0x30): Secondary interface vtable pointer.
|
|
@@ -91,6 +93,7 @@ const _: () = assert!(core::mem::size_of::<TurnGameCtx>() == 0xAC);
|
|
| 91 |
/// [3] 0x5612E0 β HUD data query (responds to msg 0x7D3)
|
| 92 |
///
|
| 93 |
/// All timers decrement by 20 ms per frame (= 1000 ms / 50 fps).
|
|
|
|
| 94 |
#[repr(C)]
|
| 95 |
pub struct CTaskTurnGame {
|
| 96 |
/// 0x00-0x2F: CTask base (vtable, parent, children, shared_data, ddgame, β¦)
|
|
|
|
| 1 |
use super::base::CTask;
|
| 2 |
use crate::fixed::Fixed;
|
| 3 |
+
use crate::FieldRegistry;
|
| 4 |
|
| 5 |
/// Embedded intermediate game-context sub-object within `CTaskTurnGame`.
|
| 6 |
///
|
|
|
|
| 26 |
/// either constructor; they appear to be set by `FUN_005514d0` or similar
|
| 27 |
/// helpers called later. Observed runtime values: +0xA0 = 15, +0xA4/+0xA8
|
| 28 |
/// are heap pointers.
|
| 29 |
+
#[derive(FieldRegistry)]
|
| 30 |
#[repr(C)]
|
| 31 |
pub struct TurnGameCtx {
|
| 32 |
/// +0x00 (= CTaskTurnGame+0x30): Secondary interface vtable pointer.
|
|
|
|
| 93 |
/// [3] 0x5612E0 β HUD data query (responds to msg 0x7D3)
|
| 94 |
///
|
| 95 |
/// All timers decrement by 20 ms per frame (= 1000 ms / 50 fps).
|
| 96 |
+
#[derive(FieldRegistry)]
|
| 97 |
#[repr(C)]
|
| 98 |
pub struct CTaskTurnGame {
|
| 99 |
/// 0x00-0x2F: CTask base (vtable, parent, children, shared_data, ddgame, β¦)
|