Skip to main content

dotzuki_engine/overworld/
mod.rs

1//! Overworld systems, in **two tiers** — pick the one that matches the game:
2//!
3//! - **[`actor`] — simple, render- & map-agnostic.** `OverworldActor` + the tiny
4//!   `OverworldCollision` trait (`is_blocked(i32, i32)`): held-direction → tile step
5//!   → walk animation, and nothing else. For lightweight, non-Game-Boy games whose
6//!   maps aren't block/tileset based — e.g. the wuxia game and the minimon example,
7//!   which plug in their own render backend (GB tiles vs a full-colour sprite sheet).
8//!   The actor returns frame *indices*, never pixels.
9//!
10//! - **[`player_movement`] + [`collision`] + [`map_transitions`] + [`sprites`] —
11//!   rich, Game-Boy-faithful.** `try_move`/`advance_step` over `MapTrait` +
12//!   `TilesetTrait` with `u8` / 4×4-block coordinates, modelling the *full* classic JRPG
13//!   overworld: ledge jumps, warps, map-edge connections, tileset-aware collision,
14//!   OAM sprites, NPC movement scripts, wild encounters. Used by pokered (the
15//!   flagship), which drives it directly (`pokered-core::overworld` just re-exports).
16//!
17//! Both tiers share [`types::Direction`]. They are intentionally **separate**: the
18//! rich tier is a strict superset of behaviour, so collapsing the flagship onto the
19//! simple actor would *lose* fidelity for no gain. New simple games use `actor`;
20//! JRPG-grade games use the rich tier.
21
22pub mod actor;
23pub mod collision;
24pub mod encounter;
25pub mod event_flags;
26pub mod map_transitions;
27pub mod npc_interaction;
28pub mod npc_movement;
29pub mod player_movement;
30pub mod sprites;
31pub mod types;
32
33pub use collision::{
34    check_movement_collision, check_sprite_collision, check_warp_at_position,
35    direction_to_pad_input, direction_to_sprite_facing, get_block_at, get_target_coords,
36    is_facing_map_edge, CollisionProvider, CollisionResult, SpritePosition,
37    PAD_DOWN, PAD_LEFT, PAD_RIGHT, PAD_UP,
38    SPRITE_FACING_DOWN, SPRITE_FACING_LEFT, SPRITE_FACING_RIGHT, SPRITE_FACING_UP,
39};
40pub use encounter::{EncounterEngine, EncounterMode, EncounterProvider, EncounterStep};
41pub use npc_interaction::{
42    check_line_of_sight, check_sign_interaction, mark_defeated, try_interact, InteractionResult,
43    LineOfSightResult,
44};
45pub use npc_movement::{
46    direction_toward, get_npc_positions, is_scripted_move_done, npc_at_position,
47    npc_at_position_mut, npc_in_front_of_player, start_scripted_move, update_npc_movement,
48    NpcRuntimeState, NPC_MAX_DELAY, NPC_WALK_FRAMES,
49};
50pub use player_movement::{
51    advance_step, direction_delta, frames_per_step, get_tile_at_position, opposite_direction,
52    process_frame, try_move, InputState, MoveResult, WALK_COUNTER_INIT,
53};
54pub use types::{
55    Direction, MapConnection, MapConnections, MapData, MovementState, NpcDefinition,
56    NpcMovementType, OverworldInput, OverworldState, PlayerState, Sign, TransportMode, WarpPoint,
57};