From 737e429cb109446ec008c4dcf91d4f04faccd64a Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sun, 18 Oct 2026 08:55:47 +0400 Subject: feat(fx): evaluate native Op7 particle pools --- crates/fparkan-fx/src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'crates/fparkan-fx/src/lib.rs') diff --git a/crates/fparkan-fx/src/lib.rs b/crates/fparkan-fx/src/lib.rs index 1772d1c..04e54ad 100644 --- a/crates/fparkan-fx/src/lib.rs +++ b/crates/fparkan-fx/src/lib.rs @@ -10,9 +10,23 @@ pub mod ambient_op3; pub mod atmosphere; pub mod environment; pub mod fx_visual; +pub mod op7; pub mod shadow; pub mod sky; +/// Advances the native FX 16-bit-pair random state and returns its new high half. +/// +/// Native helpers store `low' = low * 2 ^ high` and `high' = high >> 1 ^ low'`. +#[must_use] +pub fn advance_native_fx_random_state(state: &mut u32) -> u16 { + let low = *state as u16; + let high = (*state >> 16) as u16; + let next_low = low.wrapping_shl(1) ^ high; + let next_high = (high >> 1) ^ next_low; + *state = u32::from(next_low) | (u32::from(next_high) << 16); + next_high +} + use fparkan_binary::{Cursor, DecodeError}; use std::sync::Arc; -- cgit v1.2.3