mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-20 14:47:45 +00:00
Initialize the weather correctly, add test for InitZone packet
This makes the lighting not a horrible dark mess!
This commit is contained in:
parent
ff3305b3e0
commit
dbe1ef208c
3 changed files with 30 additions and 1 deletions
BIN
resources/tests/init_zone.bin
Normal file
BIN
resources/tests/init_zone.bin
Normal file
Binary file not shown.
|
@ -435,6 +435,7 @@ async fn main() {
|
||||||
data: IPCStructData::InitZone(InitZone {
|
data: IPCStructData::InitZone(InitZone {
|
||||||
server_id: WORLD_ID,
|
server_id: WORLD_ID,
|
||||||
zone_id: ZONE_ID,
|
zone_id: ZONE_ID,
|
||||||
|
weather_id: 1,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,7 +11,9 @@ pub struct InitZone {
|
||||||
pub content_finder_condition_id: u16,
|
pub content_finder_condition_id: u16,
|
||||||
pub layer_set_id: u32,
|
pub layer_set_id: u32,
|
||||||
pub layout_id: u32,
|
pub layout_id: u32,
|
||||||
pub weather_id: u32,
|
#[br(dbg)]
|
||||||
|
pub weather_id: u16,
|
||||||
|
pub unk_really: u16,
|
||||||
pub unk_bitmask1: u8,
|
pub unk_bitmask1: u8,
|
||||||
pub unk_bitmask2: u8,
|
pub unk_bitmask2: u8,
|
||||||
pub unk1: u8,
|
pub unk1: u8,
|
||||||
|
@ -23,7 +25,33 @@ pub struct InitZone {
|
||||||
pub unk5: u32,
|
pub unk5: u32,
|
||||||
pub unk6: [u32; 4],
|
pub unk6: [u32; 4],
|
||||||
pub unk7: [u32; 3],
|
pub unk7: [u32; 3],
|
||||||
|
pub unk8_9: [u8; 9],
|
||||||
pub position: Position,
|
pub position: Position,
|
||||||
pub unk8: [u32; 4],
|
pub unk8: [u32; 4],
|
||||||
pub unk9: u32,
|
pub unk9: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use std::{fs::read, io::Cursor, path::PathBuf};
|
||||||
|
|
||||||
|
use binrw::BinRead;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn read_init_zone() {
|
||||||
|
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||||
|
d.push("resources/tests/init_zone.bin");
|
||||||
|
|
||||||
|
let buffer = read(d).unwrap();
|
||||||
|
let mut buffer = Cursor::new(&buffer);
|
||||||
|
|
||||||
|
let init_zone = InitZone::read_le(&mut buffer).unwrap();
|
||||||
|
assert_eq!(init_zone.zone_id, 182);
|
||||||
|
assert_eq!(init_zone.weather_id, 2);
|
||||||
|
assert_eq!(init_zone.position.x, 40.519722);
|
||||||
|
assert_eq!(init_zone.position.y, 4.0);
|
||||||
|
assert_eq!(init_zone.position.z, -150.33124);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue