1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-23 15:47:45 +00:00

Remove Gridania hack, allow changing between any zone

This now properly translates territory types using the Excel sheet, making it
possible to move between any zone (you can walk through.)
This commit is contained in:
Joshua Goins 2025-03-15 21:41:39 -04:00
parent 3aaa8ae3eb
commit 1cbc5c72b9
2 changed files with 15 additions and 14 deletions

2
Cargo.lock generated
View file

@ -489,7 +489,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "physis"
version = "0.4.0"
source = "git+https://github.com/redstrate/physis#3273070cef2057b9fe6454d3038a2488484e22fa"
source = "git+https://github.com/redstrate/physis#d3918c13824f5cab6c7c41255437b69c4fb17ee2"
dependencies = [
"binrw",
"bitflags",

View file

@ -1,5 +1,5 @@
use physis::{
common::Platform,
common::{Language, Platform},
gamedata::GameData,
layer::{
ExitRangeInstanceObject, InstanceObject, LayerEntryData, LayerGroup, PopRangeInstanceObject,
@ -20,19 +20,20 @@ impl Zone {
let mut game_data =
GameData::from_existing(Platform::Win32, &config.game_location).unwrap();
let mdl;
println!("loading {id}");
if id == 133 {
mdl = game_data
.extract("bg/ffxiv/fst_f1/twn/f1t2/level/planmap.lgb")
.unwrap();
} else {
mdl = game_data
.extract("bg/ffxiv/fst_f1/twn/f1t1/level/planmap.lgb")
.unwrap();
}
let layer_group = LayerGroup::from_existing(&mdl).unwrap();
let exh = game_data.read_excel_sheet_header("TerritoryType").unwrap();
let exd = game_data.read_excel_sheet("TerritoryType", &exh, Language::None, 0).unwrap();
let territory_type_row = &exd.read_row(&exh, id as u32).unwrap()[0];
// e.g. ffxiv/fst_f1/fld/f1f3/level/f1f3
let physis::exd::ColumnData::String(bg_path) = &territory_type_row.data[1] else {
panic!("Unexpected type!");
};
let path = format!("bg/{}/level/planmap.lgb", &bg_path[..bg_path.find("/level/").unwrap()]);
let lgb = game_data.extract(&path).unwrap();
let layer_group = LayerGroup::from_existing(&lgb).unwrap();
Self { id, layer_group }
}