Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
toasterparty authored Jul 23, 2024
2 parents dca7525 + c7e596f commit fd55d54
Show file tree
Hide file tree
Showing 13 changed files with 1,174 additions and 487 deletions.
Binary file added extra_assets/cog.CMDL
Binary file not shown.
Binary file added extra_assets/zoomer.CMDL
Binary file not shown.
2 changes: 2 additions & 0 deletions generated/json_data/qol.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -5899,12 +5899,14 @@
{
"id": 524657, // [CameraFilterKeyframe] Camera Filter Keyframe WideScreen
"color": [0, 0, 0, 1],
"filterIndex": 1,
"filterType": "Multiply",
"filterShape": "CinemaBars"
},
{
"id": 524816, // [CameraFilterKeyframe] Camera Filter Keyframe
"color": [0, 0, 0, 1],
"filterIndex": 1,
"filterType": "Multiply",
"filterShape": "CinemaBars"
}
Expand Down
134 changes: 72 additions & 62 deletions generated/json_data/skippable_cutscenes.jsonc

Large diffs are not rendered by default.

40 changes: 39 additions & 1 deletion schema/randomprime.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2804,6 +2804,8 @@
"Artifact of Nature",
"Artifact of Strength",
"Nothing",
"Zoomer",
"Cog",
"Gamecube",
"Health Refill",
"Missile Refill",
Expand Down Expand Up @@ -2861,7 +2863,7 @@
"default": false
},
"liquids": {
"description": "Add liquid volumes to this room.",
"description": "Add liquid volumes to this room. The bigger their size, the bigger the `tileSize` and `tileSubdivisions` values must be in order for the liquid to render properly.",
"type": "array",
"items": {
"type": "object",
Expand Down Expand Up @@ -2894,6 +2896,42 @@
"scale": {
"description": "The extent of the liquid volume.",
"$ref": "#/$defs/vector3Positive"
},
"morphInTime": {
"description": "Duration in which the water will be traveling to it's destination.",
"type": "number",
"minimum": 0.0,
"default": 3.0
},
"morphOutTime": {
"description": "Duration in which the water will be traveling back to it's source position.",
"type": "number",
"minimum": 0.0,
"default": 3.0
},
"tileSize": {
"description": "Specify the size of the water tiles.",
"type": "number",
"minimum": 0.0,
"default": 2.4
},
"tileSubdivisions": {
"description": "Specify the amount of tile subdivisions on the liquid.",
"type": "integer",
"minimum": 0,
"default": 6
},
"alphaInTime": {
"description": "Duration in which the water will be fading back in view.",
"type": "number",
"minimum": 0.0,
"default": 3.0
},
"alphaOutTime": {
"description": "Duration in which the water will be fading out of view.",
"type": "number",
"minimum": 0.0,
"default": 3.0
}
},
"required": [
Expand Down
26 changes: 26 additions & 0 deletions src/add_modify_obj_patches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,32 @@ pub fn patch_add_liquid<'r>(
.as_mut_vec();
water_obj.property_data.as_water_mut().unwrap().active =
config.active.unwrap_or(true) as u8;
water_obj
.property_data
.as_water_mut()
.unwrap()
.morph_in_time = config.morph_in_time.unwrap_or(1.0);
water_obj
.property_data
.as_water_mut()
.unwrap()
.morph_out_time = config.morph_out_time.unwrap_or(1.0);
water_obj.property_data.as_water_mut().unwrap().tile_size = config.tile_size.unwrap_or(2.4);
water_obj
.property_data
.as_water_mut()
.unwrap()
.tile_subdivisions = config.tile_subdivisions.unwrap_or(6);
water_obj
.property_data
.as_water_mut()
.unwrap()
.alpha_in_time = config.alpha_in_time.unwrap_or(3.0);
water_obj
.property_data
.as_water_mut()
.unwrap()
.alpha_out_time = config.alpha_out_time.unwrap_or(3.0);
let property_data: structs::SclyProperty = water_obj.property_data;

assert!(property_data.object_type() == structs::Water::OBJECT_TYPE);
Expand Down
96 changes: 94 additions & 2 deletions src/bin/resource_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,6 @@ fn create_nothing(pickup_table: &mut HashMap<PickupModel, PickupData>) {
ResourceKey::from(custom_asset_ids::NOTHING_CMDL),
ResourceKey::from(custom_asset_ids::NOTHING_ANCS),
ResourceKey::from(custom_asset_ids::NOTHING_TXTR),
ResourceKey::from(ResId::<res_id::CMDL>::new(0x2f976e86)), // Metroid
ResourceKey::from(ResId::<res_id::TXTR>::new(0xBE4CD99D)), // white door
]);
assert!(pickup_table
.insert(
Expand All @@ -752,6 +750,84 @@ fn create_nothing(pickup_table: &mut HashMap<PickupModel, PickupData>) {
.is_none());
}

fn create_zoomer(pickup_table: &mut HashMap<PickupModel, PickupData>) {
let mut bytes = Vec::new();
{
let mut pickup: structs::Pickup =
Reader::new(&pickup_table[&PickupModel::PhazonSuit].bytes)
.read::<Pickup>(())
.clone();
pickup.name = Cow::Borrowed(CStr::from_bytes_with_nul(b"Zoomer\0").unwrap());
pickup.kind = PickupType::Missile.kind();
pickup.max_increase = 0;
pickup.curr_increase = 0;
pickup.cmdl = custom_asset_ids::ZOOMER_CMDL;
pickup.ancs.file_id = custom_asset_ids::ZOOMER_ANCS;
pickup.part = ResId::<res_id::PART>::invalid();
pickup.write_to(&mut bytes).unwrap();
}
let mut deps: HashSet<_> = pickup_table[&PickupModel::PhazonSuit]
.deps
.iter()
.filter(|i| ![b"SCAN".into(), b"STRG".into(), b"CMDL".into()].contains(&i.fourcc))
.cloned()
.collect();
deps.extend(&[
ResourceKey::from(custom_asset_ids::ZOOMER_CMDL),
ResourceKey::from(custom_asset_ids::ZOOMER_ANCS),
ResourceKey::from(custom_asset_ids::NOTHING_TXTR),
]);
assert!(pickup_table
.insert(
PickupModel::Zoomer,
PickupData {
bytes,
deps,
attainment_audio_file_name: b"/audio/itm_x_short_02.dsp\0".to_vec(),
}
)
.is_none());
}

fn create_cog(pickup_table: &mut HashMap<PickupModel, PickupData>) {
let mut bytes = Vec::new();
{
let mut pickup: structs::Pickup =
Reader::new(&pickup_table[&PickupModel::PhazonSuit].bytes)
.read::<Pickup>(())
.clone();
pickup.name = Cow::Borrowed(CStr::from_bytes_with_nul(b"Cog\0").unwrap());
pickup.kind = PickupType::Missile.kind();
pickup.max_increase = 0;
pickup.curr_increase = 0;
pickup.cmdl = custom_asset_ids::COG_CMDL;
pickup.ancs.file_id = custom_asset_ids::COG_ANCS;
pickup.part = ResId::<res_id::PART>::invalid();
pickup.write_to(&mut bytes).unwrap();
}
let mut deps: HashSet<_> = pickup_table[&PickupModel::PhazonSuit]
.deps
.iter()
.filter(|i| ![b"SCAN".into(), b"STRG".into(), b"CMDL".into()].contains(&i.fourcc))
.cloned()
.collect();
deps.extend(&[
ResourceKey::from(custom_asset_ids::COG_CMDL),
ResourceKey::from(custom_asset_ids::COG_ANCS),
ResourceKey::new(0x50DF3CAD, b"TXTR".into()),
]);
assert!(pickup_table
.insert(
PickupModel::Cog,
PickupData {
bytes,
deps,
attainment_audio_file_name: b"/audio/itm_x_short_02.dsp\0".to_vec(),
}
)
.is_none());
}

fn create_gamecube(pickup_table: &mut HashMap<PickupModel, PickupData>) {
let mut bytes = Vec::new();
{
Expand Down Expand Up @@ -1458,6 +1534,20 @@ fn main() {
assert!(cmdl_aabbs
.insert(custom_asset_ids::NOTHING_CMDL, suit_aabb)
.is_none());
assert!(cmdl_aabbs
.insert(custom_asset_ids::ZOOMER_CMDL, suit_aabb)
.is_none());
let cog_aabb = [
suit_aabb[0],
suit_aabb[1],
suit_aabb[2] + 0.5,
suit_aabb[3],
suit_aabb[4],
suit_aabb[5] + 0.5,
];
assert!(cmdl_aabbs
.insert(custom_asset_ids::COG_CMDL, cog_aabb)
.is_none());

let missile_aabb = *cmdl_aabbs
.get(&ResId::<res_id::CMDL>::new(
Expand Down Expand Up @@ -1485,6 +1575,8 @@ fn main() {

create_gamecube(&mut pickup_table);
create_nothing(&mut pickup_table);
create_zoomer(&mut pickup_table);
create_cog(&mut pickup_table);
create_shiny_missile(&mut pickup_table);
create_thermal_visor(&mut pickup_table);
create_xray_visor(&mut pickup_table);
Expand Down
97 changes: 94 additions & 3 deletions src/custom_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ pub mod custom_asset_ids {
NOTHING_TXTR: TXTR,
NOTHING_CMDL: CMDL,
NOTHING_ANCS: ANCS,
ZOOMER_CMDL: CMDL,
ZOOMER_ANCS: ANCS,
COG_CMDL: CMDL,
COG_ANCS: ANCS,
THERMAL_CMDL: CMDL,
THERMAL_ANCS: ANCS,
XRAY_CMDL: CMDL,
Expand Down Expand Up @@ -650,6 +654,17 @@ pub fn custom_assets<'r>(
custom_asset_ids::NOTHING_TXTR,
ResId::<res_id::TXTR>::new(0xF68DF7F1),
));
assets.extend_from_slice(&create_zoomer_cmdl_and_ancs(
resources,
custom_asset_ids::ZOOMER_CMDL,
custom_asset_ids::ZOOMER_ANCS,
custom_asset_ids::NOTHING_TXTR,
));
assets.extend_from_slice(&create_cog_cmdl_and_ancs(
resources,
custom_asset_ids::COG_CMDL,
custom_asset_ids::COG_ANCS,
));
assets.extend_from_slice(&create_randovania_gamecube_cmdl_and_ancs(
resources,
custom_asset_ids::RANDOVANIA_GAMECUBE_CMDL,
Expand Down Expand Up @@ -705,7 +720,7 @@ pub fn custom_assets<'r>(
vec![
"Toaster's Champions: Awp82, DiggleWrath, Yeti2000, freak532486, AlphaRage, Csabi,\0".to_string(),
"\0".to_string(),
"BajaBlood, hammergoboom, Firemetroid, Lokir, MeriKatt, Cosmonawt, Haldadrin, RXM, Schwartz, Samuel, Miguel, chliu\0".to_string(),
"BajaBlood, hammergoboom, Firemetroid, Lokir, MeriKatt, Cosmonawt, Haldadrin, RXM, Schwartz, Samuel, Miguel, chliu, JeffGainsNGames\0".to_string(),
],
1,
0,
Expand Down Expand Up @@ -1312,8 +1327,12 @@ pub fn collect_game_resources<'r>(
let orange_light: Vec<(u32, FourCC)> = vec![(0xB4A658C3, FourCC::from_bytes(b"PART"))];
looking_for.extend(orange_light);

let gamecube: Vec<(u32, FourCC)> = vec![(0x770939c0, FourCC::from_bytes(b"CMDL"))];
looking_for.extend(gamecube);
let pickup_model_assets: Vec<(u32, FourCC)> = vec![
(0x770939C0, FourCC::from_bytes(b"CMDL")),
(0x663E4DEB, FourCC::from_bytes(b"CMDL")),
(0x2F976E86, FourCC::from_bytes(b"CMDL")),
];
looking_for.extend(pickup_model_assets);

let ghost_ball: Vec<(u32, FourCC)> = vec![
// used for lock on point model
Expand Down Expand Up @@ -1643,6 +1662,78 @@ fn create_randovania_gamecube_cmdl_and_ancs<'r>(
[new_cmdl, new_ancs]
}

fn create_zoomer_cmdl_and_ancs<'r>(
resources: &HashMap<(u32, FourCC), structs::Resource<'r>>,
new_cmdl_id: ResId<res_id::CMDL>,
new_ancs_id: ResId<res_id::ANCS>,
new_txtr1: ResId<res_id::TXTR>,
) -> [structs::Resource<'r>; 2] {
let cmdl = {
let cmdl = include_bytes!("../extra_assets/zoomer.CMDL");
let mut cmdl = Reader::new(&cmdl[..]).read::<structs::Cmdl>(());

cmdl.material_sets.as_mut_vec()[0].texture_ids.as_mut_vec()[0] = new_txtr1;

let mut new_cmdl_bytes = vec![];
cmdl.write_to(&mut new_cmdl_bytes).unwrap();

build_resource(
new_cmdl_id,
structs::ResourceKind::External(new_cmdl_bytes, b"CMDL".into()),
)
};
let ancs = {
let ancs = ResourceData::new(&resources[&resource_info!("Node1_11.ANCS").into()]);
let ancs_bytes = ancs.decompress().into_owned();
let mut ancs = Reader::new(&ancs_bytes[..]).read::<structs::Ancs>(());

ancs.char_set.char_info.as_mut_vec()[0].cmdl = new_cmdl_id;

let mut new_ancs_bytes = vec![];
ancs.write_to(&mut new_ancs_bytes).unwrap();

build_resource(
new_ancs_id,
structs::ResourceKind::External(new_ancs_bytes, b"ANCS".into()),
)
};
[cmdl, ancs]
}

fn create_cog_cmdl_and_ancs<'r>(
resources: &HashMap<(u32, FourCC), structs::Resource<'r>>,
new_cmdl_id: ResId<res_id::CMDL>,
new_ancs_id: ResId<res_id::ANCS>,
) -> [structs::Resource<'r>; 2] {
let cmdl = {
let cmdl = include_bytes!("../extra_assets/cog.CMDL");
let cmdl = Reader::new(&cmdl[..]).read::<structs::Cmdl>(());
let mut bytes = vec![];
cmdl.write_to(&mut bytes).unwrap();

build_resource(
new_cmdl_id,
structs::ResourceKind::External(bytes, b"CMDL".into()),
)
};
let ancs = {
let ancs = ResourceData::new(&resources[&resource_info!("Node1_11.ANCS").into()]);
let bytes = ancs.decompress().into_owned();
let mut ancs = Reader::new(&bytes[..]).read::<structs::Ancs>(());

ancs.char_set.char_info.as_mut_vec()[0].cmdl = new_cmdl_id;

let mut bytes = vec![];
ancs.write_to(&mut bytes).unwrap();

build_resource(
new_ancs_id,
structs::ResourceKind::External(bytes, b"ANCS".into()),
)
};
[cmdl, ancs]
}

fn create_visor_cmdl_and_ancs<'r>(
resources: &HashMap<(u32, FourCC), structs::Resource<'r>>,
new_cmdl_id: ResId<res_id::CMDL>,
Expand Down
8 changes: 8 additions & 0 deletions src/patch_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ pub struct WaterConfig {
pub liquid_type: String,
pub position: [f32; 3],
pub scale: [f32; 3],
pub morph_in_time: Option<f32>,
pub morph_out_time: Option<f32>,
pub tile_size: Option<f32>,
pub tile_subdivisions: Option<u32>,
pub alpha_in_time: Option<f32>,
pub alpha_out_time: Option<f32>,
}

#[derive(PartialEq, Debug, Serialize, Deserialize, Copy, Clone)]
Expand Down Expand Up @@ -1370,7 +1376,9 @@ pub struct PatchConfig {
pub comment: String,
pub main_menu_message: String,

#[serde(skip_serializing)] // skipped for competitive integrity reasons
pub credits_string: Option<String>,

pub results_string: Option<String>,
pub artifact_hints: Option<HashMap<String, String>>, // e.g. "Strength":"This item can be found in Ruined Fountain"
pub required_artifact_count: Option<u32>,
Expand Down
Loading

0 comments on commit fd55d54

Please sign in to comment.