refactor: move bitgrid module from display to crate root
Browse filesBitGrid is a core engine type used for both rendering (display layers)
and simulation (collision masks, terrain geometry). Move it from
display::bitgrid to crate::bitgrid to reflect its fundamental role.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- crates/openwa-core/src/address.rs +2 -2
- crates/openwa-core/src/{display/bitgrid.rs → bitgrid.rs} +0 -0
- crates/openwa-core/src/display/dd_display.rs +1 -1
- crates/openwa-core/src/display/gfx.rs +1 -1
- crates/openwa-core/src/display/gradient.rs +1 -1
- crates/openwa-core/src/display/mod.rs +0 -5
- crates/openwa-core/src/engine/ddgame.rs +1 -1
- crates/openwa-core/src/engine/ddgame_constructor.rs +1 -1
- crates/openwa-core/src/lib.rs +1 -0
- crates/openwa-dll/src/replacements/ddgame_init.rs +1 -1
- crates/openwa-dll/src/replacements/display.rs +10 -10
crates/openwa-core/src/address.rs
CHANGED
|
@@ -70,12 +70,12 @@ pub mod va {
|
|
| 70 |
STREAMING_AUDIO_OPEN, STREAMING_AUDIO_OPEN_WAV, STREAMING_AUDIO_READ_CHUNK,
|
| 71 |
STREAMING_AUDIO_RESET, STREAMING_AUDIO_STOP, STREAMING_AUDIO_TIMER_CALLBACK,
|
| 72 |
};
|
| 73 |
-
pub use crate::
|
| 74 |
-
pub use crate::display::bitgrid::{
|
| 75 |
BitGridBaseVtable, BitGridCollisionVtable, BitGridDisplayVtable, BIT_GRID_BASE_VTABLE,
|
| 76 |
BIT_GRID_COLLISION_VTABLE, BIT_GRID_DISPLAY_VTABLE, BIT_GRID_INIT, BLIT_SPRITE_RECT,
|
| 77 |
DRAW_LINE_CLIPPED, DRAW_LINE_TWO_COLOR,
|
| 78 |
};
|
|
|
|
| 79 |
pub use crate::display::compat_renderer::{
|
| 80 |
CompatRendererVtable, COMPAT_RENDERER_VTABLE, DDRAW8_RENDERER_VTABLE,
|
| 81 |
};
|
|
|
|
| 70 |
STREAMING_AUDIO_OPEN, STREAMING_AUDIO_OPEN_WAV, STREAMING_AUDIO_READ_CHUNK,
|
| 71 |
STREAMING_AUDIO_RESET, STREAMING_AUDIO_STOP, STREAMING_AUDIO_TIMER_CALLBACK,
|
| 72 |
};
|
| 73 |
+
pub use crate::bitgrid::{
|
|
|
|
| 74 |
BitGridBaseVtable, BitGridCollisionVtable, BitGridDisplayVtable, BIT_GRID_BASE_VTABLE,
|
| 75 |
BIT_GRID_COLLISION_VTABLE, BIT_GRID_DISPLAY_VTABLE, BIT_GRID_INIT, BLIT_SPRITE_RECT,
|
| 76 |
DRAW_LINE_CLIPPED, DRAW_LINE_TWO_COLOR,
|
| 77 |
};
|
| 78 |
+
pub use crate::display::base::DISPLAY_BASE_VTABLE;
|
| 79 |
pub use crate::display::compat_renderer::{
|
| 80 |
CompatRendererVtable, COMPAT_RENDERER_VTABLE, DDRAW8_RENDERER_VTABLE,
|
| 81 |
};
|
crates/openwa-core/src/{display/bitgrid.rs → bitgrid.rs}
RENAMED
|
File without changes
|
crates/openwa-core/src/display/dd_display.rs
CHANGED
|
@@ -275,9 +275,9 @@ bind_DDDisplayVtable!(DDDisplay, vtable);
|
|
| 275 |
// Ported DDDisplay vtable methods
|
| 276 |
// =========================================================================
|
| 277 |
|
| 278 |
-
use super::bitgrid::DisplayBitGrid;
|
| 279 |
use super::gfx::DisplayGfx;
|
| 280 |
use super::line_draw;
|
|
|
|
| 281 |
|
| 282 |
/// Port of DDDisplay::GetDimensions (vtable slot 1, 0x56A460).
|
| 283 |
///
|
|
|
|
| 275 |
// Ported DDDisplay vtable methods
|
| 276 |
// =========================================================================
|
| 277 |
|
|
|
|
| 278 |
use super::gfx::DisplayGfx;
|
| 279 |
use super::line_draw;
|
| 280 |
+
use crate::bitgrid::DisplayBitGrid;
|
| 281 |
|
| 282 |
/// Port of DDDisplay::GetDimensions (vtable slot 1, 0x56A460).
|
| 283 |
///
|
crates/openwa-core/src/display/gfx.rs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
use super::base::DisplayBase;
|
| 2 |
-
use
|
| 3 |
use core::ffi::c_void;
|
| 4 |
|
| 5 |
/// DisplayGfx — full display/graphics subsystem (derived from DisplayBase).
|
|
|
|
| 1 |
use super::base::DisplayBase;
|
| 2 |
+
use crate::bitgrid::DisplayBitGrid;
|
| 3 |
use core::ffi::c_void;
|
| 4 |
|
| 5 |
/// DisplayGfx — full display/graphics subsystem (derived from DisplayBase).
|
crates/openwa-core/src/display/gradient.rs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
//! may have subtle color differences due to the tangled decompiler output.
|
| 7 |
|
| 8 |
use crate::address::va;
|
| 9 |
-
use crate::
|
| 10 |
use crate::engine::ddgame::DDGame;
|
| 11 |
use crate::rebase::rb;
|
| 12 |
use crate::render::gfx_dir::call_gfx_find_and_load;
|
|
|
|
| 6 |
//! may have subtle color differences due to the tangled decompiler output.
|
| 7 |
|
| 8 |
use crate::address::va;
|
| 9 |
+
use crate::bitgrid::{BitGrid, BitGridBaseVtable};
|
| 10 |
use crate::engine::ddgame::DDGame;
|
| 11 |
use crate::rebase::rb;
|
| 12 |
use crate::render::gfx_dir::call_gfx_find_and_load;
|
crates/openwa-core/src/display/mod.rs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
pub mod base;
|
| 2 |
-
pub mod bitgrid;
|
| 3 |
pub mod compat_renderer;
|
| 4 |
pub mod dd_display;
|
| 5 |
pub mod display_wrapper;
|
|
@@ -11,10 +10,6 @@ pub mod palette;
|
|
| 11 |
pub mod sprite_blit;
|
| 12 |
|
| 13 |
pub use base::{DisplayBase, DisplayBaseVtable, SpriteBufferCtrl, SpriteCacheWrapper};
|
| 14 |
-
pub use bitgrid::{
|
| 15 |
-
BitGrid, BitGridBaseVtable, BitGridCollisionVtable, BitGridDisplayVtable, CollisionBitGrid,
|
| 16 |
-
DisplayBitGrid,
|
| 17 |
-
};
|
| 18 |
pub use compat_renderer::CompatRenderer;
|
| 19 |
pub use dd_display::DDDisplay;
|
| 20 |
pub use display_wrapper::{DDDisplayWrapper, FastcallResult};
|
|
|
|
| 1 |
pub mod base;
|
|
|
|
| 2 |
pub mod compat_renderer;
|
| 3 |
pub mod dd_display;
|
| 4 |
pub mod display_wrapper;
|
|
|
|
| 10 |
pub mod sprite_blit;
|
| 11 |
|
| 12 |
pub use base::{DisplayBase, DisplayBaseVtable, SpriteBufferCtrl, SpriteCacheWrapper};
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
pub use compat_renderer::CompatRenderer;
|
| 14 |
pub use dd_display::DDDisplay;
|
| 15 |
pub use display_wrapper::{DDDisplayWrapper, FastcallResult};
|
crates/openwa-core/src/engine/ddgame.rs
CHANGED
|
@@ -2,9 +2,9 @@ use crate::audio::active_sound::ActiveSoundTable;
|
|
| 2 |
use crate::audio::dssound::DSSound;
|
| 3 |
use crate::audio::music::Music;
|
| 4 |
use crate::audio::speech::SpeechSlotTable;
|
|
|
|
| 5 |
use crate::display::dd_display::DDDisplay;
|
| 6 |
use crate::display::palette::Palette;
|
| 7 |
-
use crate::display::{CollisionBitGrid, DisplayBitGrid};
|
| 8 |
use crate::engine::game_info::GameInfo;
|
| 9 |
use crate::engine::{
|
| 10 |
CoordEntry, CoordList, RenderEntry, SoundQueueEntry, TeamArenaState, TeamIndexMap,
|
|
|
|
| 2 |
use crate::audio::dssound::DSSound;
|
| 3 |
use crate::audio::music::Music;
|
| 4 |
use crate::audio::speech::SpeechSlotTable;
|
| 5 |
+
use crate::bitgrid::{CollisionBitGrid, DisplayBitGrid};
|
| 6 |
use crate::display::dd_display::DDDisplay;
|
| 7 |
use crate::display::palette::Palette;
|
|
|
|
| 8 |
use crate::engine::game_info::GameInfo;
|
| 9 |
use crate::engine::{
|
| 10 |
CoordEntry, CoordList, RenderEntry, SoundQueueEntry, TeamArenaState, TeamIndexMap,
|
crates/openwa-core/src/engine/ddgame_constructor.rs
CHANGED
|
@@ -12,7 +12,7 @@ use crate::address::va;
|
|
| 12 |
use crate::audio::active_sound::ActiveSoundTable;
|
| 13 |
use crate::audio::dssound::DSSound;
|
| 14 |
use crate::audio::music::Music;
|
| 15 |
-
use crate::
|
| 16 |
use crate::display::dd_display::DDDisplay;
|
| 17 |
use crate::display::gradient::compute_complex_gradient;
|
| 18 |
use crate::display::palette::Palette;
|
|
|
|
| 12 |
use crate::audio::active_sound::ActiveSoundTable;
|
| 13 |
use crate::audio::dssound::DSSound;
|
| 14 |
use crate::audio::music::Music;
|
| 15 |
+
use crate::bitgrid::{BitGrid, BitGridBaseVtable, CollisionBitGrid, DisplayBitGrid};
|
| 16 |
use crate::display::dd_display::DDDisplay;
|
| 17 |
use crate::display::gradient::compute_complex_gradient;
|
| 18 |
use crate::display::palette::Palette;
|
crates/openwa-core/src/lib.rs
CHANGED
|
@@ -29,6 +29,7 @@ pub use openwa_derive::FieldRegistry;
|
|
| 29 |
pub mod macros;
|
| 30 |
|
| 31 |
pub mod audio;
|
|
|
|
| 32 |
pub mod display;
|
| 33 |
pub mod engine;
|
| 34 |
pub mod frontend;
|
|
|
|
| 29 |
pub mod macros;
|
| 30 |
|
| 31 |
pub mod audio;
|
| 32 |
+
pub mod bitgrid;
|
| 33 |
pub mod display;
|
| 34 |
pub mod engine;
|
| 35 |
pub mod frontend;
|
crates/openwa-dll/src/replacements/ddgame_init.rs
CHANGED
|
@@ -14,7 +14,7 @@
|
|
| 14 |
use crate::hook;
|
| 15 |
use core::ffi::c_char;
|
| 16 |
use openwa_core::address::va;
|
| 17 |
-
use openwa_core::
|
| 18 |
use openwa_core::engine::game_state_init::{
|
| 19 |
check_weapon_avail, init_alliance_data, init_landscape_flags, init_team_scoring,
|
| 20 |
init_turn_state, is_super_weapon, ring_buffer_init, sprite_gfx_table_init,
|
|
|
|
| 14 |
use crate::hook;
|
| 15 |
use core::ffi::c_char;
|
| 16 |
use openwa_core::address::va;
|
| 17 |
+
use openwa_core::bitgrid::BitGrid;
|
| 18 |
use openwa_core::engine::game_state_init::{
|
| 19 |
check_weapon_avail, init_alliance_data, init_landscape_flags, init_team_scoring,
|
| 20 |
init_turn_state, is_super_weapon, ring_buffer_init, sprite_gfx_table_init,
|
crates/openwa-dll/src/replacements/display.rs
CHANGED
|
@@ -54,7 +54,7 @@ unsafe extern "thiscall" fn headless_destructor(
|
|
| 54 |
/// saves pixel data to `testdata/snapshots/`. Activated by
|
| 55 |
/// `OPENWA_CAPTURE_LINE_SNAPSHOTS=1`.
|
| 56 |
pub unsafe fn capture_line_snapshots() {
|
| 57 |
-
use openwa_core::
|
| 58 |
use std::fs;
|
| 59 |
use std::io::Write;
|
| 60 |
|
|
@@ -273,7 +273,7 @@ pub unsafe fn capture_line_snapshots() {
|
|
| 273 |
/// saves pixel output to `testdata/snapshots/`. Activated by
|
| 274 |
/// `OPENWA_CAPTURE_BLIT_SNAPSHOTS=1`.
|
| 275 |
pub unsafe fn capture_blit_snapshots() {
|
| 276 |
-
use openwa_core::
|
| 277 |
use std::fs;
|
| 278 |
use std::io::Write;
|
| 279 |
|
|
@@ -497,12 +497,12 @@ fn decode_gif_indexed(data: &[u8]) -> Option<IndexedImage> {
|
|
| 497 |
/// `target` is the rebased runtime address of FUN_004f6910.
|
| 498 |
#[unsafe(naked)]
|
| 499 |
unsafe extern "cdecl" fn wa_blit_sprite_rect(
|
| 500 |
-
dst: *mut openwa_core::
|
| 501 |
dst_x: i32,
|
| 502 |
dst_y: i32,
|
| 503 |
width: i32,
|
| 504 |
height: i32,
|
| 505 |
-
src: *mut openwa_core::
|
| 506 |
src_x: i32,
|
| 507 |
src_y: i32,
|
| 508 |
color_table: u32,
|
|
@@ -584,12 +584,12 @@ unsafe extern "C" fn blit_hook_trampoline() {
|
|
| 584 |
/// Handles 8bpp blend modes 0 (copy) and 1 (color table / transparency).
|
| 585 |
/// Falls through to the original WA function for unsupported modes.
|
| 586 |
unsafe extern "cdecl" fn blit_impl(
|
| 587 |
-
dst: *mut openwa_core::
|
| 588 |
dst_x: i32,
|
| 589 |
dst_y: i32,
|
| 590 |
width: i32,
|
| 591 |
height: i32,
|
| 592 |
-
src: *mut openwa_core::
|
| 593 |
src_x: i32,
|
| 594 |
src_y: i32,
|
| 595 |
color_table: u32,
|
|
@@ -699,12 +699,12 @@ unsafe extern "cdecl" fn blit_impl(
|
|
| 699 |
///
|
| 700 |
/// The trampoline expects: ESI=dst, 9 stdcall params.
|
| 701 |
unsafe fn call_original_blit(
|
| 702 |
-
dst: *mut openwa_core::
|
| 703 |
dst_x: i32,
|
| 704 |
dst_y: i32,
|
| 705 |
width: i32,
|
| 706 |
height: i32,
|
| 707 |
-
src: *mut openwa_core::
|
| 708 |
src_x: i32,
|
| 709 |
src_y: i32,
|
| 710 |
color_table: u32,
|
|
@@ -729,12 +729,12 @@ unsafe fn call_original_blit(
|
|
| 729 |
/// Naked asm to call the original blit with ESI set correctly.
|
| 730 |
#[unsafe(naked)]
|
| 731 |
unsafe extern "cdecl" fn call_original_blit_asm(
|
| 732 |
-
_dst: *mut openwa_core::
|
| 733 |
_dst_x: i32,
|
| 734 |
_dst_y: i32,
|
| 735 |
_width: i32,
|
| 736 |
_height: i32,
|
| 737 |
-
_src: *mut openwa_core::
|
| 738 |
_src_x: i32,
|
| 739 |
_src_y: i32,
|
| 740 |
_color_table: u32,
|
|
|
|
| 54 |
/// saves pixel data to `testdata/snapshots/`. Activated by
|
| 55 |
/// `OPENWA_CAPTURE_LINE_SNAPSHOTS=1`.
|
| 56 |
pub unsafe fn capture_line_snapshots() {
|
| 57 |
+
use openwa_core::bitgrid::DisplayBitGrid;
|
| 58 |
use std::fs;
|
| 59 |
use std::io::Write;
|
| 60 |
|
|
|
|
| 273 |
/// saves pixel output to `testdata/snapshots/`. Activated by
|
| 274 |
/// `OPENWA_CAPTURE_BLIT_SNAPSHOTS=1`.
|
| 275 |
pub unsafe fn capture_blit_snapshots() {
|
| 276 |
+
use openwa_core::bitgrid::DisplayBitGrid;
|
| 277 |
use std::fs;
|
| 278 |
use std::io::Write;
|
| 279 |
|
|
|
|
| 497 |
/// `target` is the rebased runtime address of FUN_004f6910.
|
| 498 |
#[unsafe(naked)]
|
| 499 |
unsafe extern "cdecl" fn wa_blit_sprite_rect(
|
| 500 |
+
dst: *mut openwa_core::bitgrid::DisplayBitGrid,
|
| 501 |
dst_x: i32,
|
| 502 |
dst_y: i32,
|
| 503 |
width: i32,
|
| 504 |
height: i32,
|
| 505 |
+
src: *mut openwa_core::bitgrid::DisplayBitGrid,
|
| 506 |
src_x: i32,
|
| 507 |
src_y: i32,
|
| 508 |
color_table: u32,
|
|
|
|
| 584 |
/// Handles 8bpp blend modes 0 (copy) and 1 (color table / transparency).
|
| 585 |
/// Falls through to the original WA function for unsupported modes.
|
| 586 |
unsafe extern "cdecl" fn blit_impl(
|
| 587 |
+
dst: *mut openwa_core::bitgrid::DisplayBitGrid,
|
| 588 |
dst_x: i32,
|
| 589 |
dst_y: i32,
|
| 590 |
width: i32,
|
| 591 |
height: i32,
|
| 592 |
+
src: *mut openwa_core::bitgrid::DisplayBitGrid,
|
| 593 |
src_x: i32,
|
| 594 |
src_y: i32,
|
| 595 |
color_table: u32,
|
|
|
|
| 699 |
///
|
| 700 |
/// The trampoline expects: ESI=dst, 9 stdcall params.
|
| 701 |
unsafe fn call_original_blit(
|
| 702 |
+
dst: *mut openwa_core::bitgrid::DisplayBitGrid,
|
| 703 |
dst_x: i32,
|
| 704 |
dst_y: i32,
|
| 705 |
width: i32,
|
| 706 |
height: i32,
|
| 707 |
+
src: *mut openwa_core::bitgrid::DisplayBitGrid,
|
| 708 |
src_x: i32,
|
| 709 |
src_y: i32,
|
| 710 |
color_table: u32,
|
|
|
|
| 729 |
/// Naked asm to call the original blit with ESI set correctly.
|
| 730 |
#[unsafe(naked)]
|
| 731 |
unsafe extern "cdecl" fn call_original_blit_asm(
|
| 732 |
+
_dst: *mut openwa_core::bitgrid::DisplayBitGrid,
|
| 733 |
_dst_x: i32,
|
| 734 |
_dst_y: i32,
|
| 735 |
_width: i32,
|
| 736 |
_height: i32,
|
| 737 |
+
_src: *mut openwa_core::bitgrid::DisplayBitGrid,
|
| 738 |
_src_x: i32,
|
| 739 |
_src_y: i32,
|
| 740 |
_color_table: u32,
|