Skip to content

Commit

Permalink
Custom item support
Browse files Browse the repository at this point in the history
Required mains supported for Missiles/PB
Unlimited Missiles/PBs are supported now
Spring Ball has its own item now
  • Loading branch information
UltiNaruto committed Aug 15, 2024
1 parent 93ed235 commit e4bb8c3
Show file tree
Hide file tree
Showing 10 changed files with 534 additions and 186 deletions.
4 changes: 4 additions & 0 deletions ppcasm/ppcasm_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ decl_instrs! {
addc[o][.], (r:d), (r:a), (r:b) => (6;31) | d | a | b | (?o) | (9;10) | (?.);
addi, (r:d), (r:a), (i:imm) => (6;14) | d | a | (16;imm);
addic[.], (r:d), (r:a), (i:imm) => (5;6) | (?.) | d | a | (16;imm);
and[.], (r:d), (r:a), (r:b) => (6;31) | d | a | b | (10;28) | (?.);
andi, (r:d), (r:a), (i:imm) => (6;28) | d | a | (16;imm);
andis, (r:d), (r:a), (i:imm) => (6;29) | d | a | (16;imm);
b[l][a], (l:li) => (6;18) | (24;li) | (?a) | (?l);
Expand Down Expand Up @@ -409,11 +410,14 @@ decl_instrs! {
mr, (r:a), (r:s) => (6;31) | s | a | s | (10;444) | (1;0);
mtlr, (r:d) => (6;31) | d | (10;0x100) | (10;467) | (1;0);
mullw[o][.],(r:d), (r:a), (r:b) => (6;31) | d | a | b | (?o) | (9;235) | (?.);
neg, (r:d), (r:a) => (6;31) | d | a | (16;208);
nop => (32;0x60000000);
or[.], (r:d), (r:a), (r:b) => (6;31) | d | a | b | (10;444) | (?.);
ori, (r:d), (r:a), (i:imm) => (6;24) | d | a | (16;imm);
oris, (r:d), (r:a), (i:imm) => (6;25) | d | a | (16;imm);
slw[.], (r:d), (r:a), (r:b) => (6;31) | d | a | b | (10;24) | (?.);
slwi, (r:a), (r:s), (i:n) => (6;21) | s | a | (5;{#n}) | (5;0) |(5;{31 - #n}) | (1;0);
srw[.], (r:d), (r:a), (r:b) => (6;31) | d | a | b | (10;536) | (?.);
srwi, (r:a), (r:s), (i:n) => (6;21) | s | a | (5;{32 - #n}) | (5;n) |(5;31) | (1;0);
rlwimi[.], (r:a), (r:s), (i:sh), (i:mb), (i:me) =>
(6;20) | s | a | (5;sh) | (5;mb) |(5;me) | (?.);
Expand Down
70 changes: 64 additions & 6 deletions schema/randomprime.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,10 @@
"default": false
},
"enableIceTraps": {
"description": "Set to true if Ice Traps items are used in this layout.",
"description": "[Deprecated] Does not do anything anymore",
"type": "boolean",
"default": false
"default": false,
"deprecated": true
},
"missileStationPbRefill": {
"description": "If enabled, Missile Stations also refill Power Bomb ammunition.",
Expand Down Expand Up @@ -2492,6 +2493,12 @@
"type": "boolean",
"default": false
},
"powerSuit": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295,
"default": 0
},
"variaSuit": {
"type": "boolean",
"default": false
Expand Down Expand Up @@ -2535,6 +2542,32 @@
"flamethrower": {
"type": "boolean",
"default": false
},
"unknownItem1": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295,
"default": 0
},
"unlimitedMissiles": {
"type": "boolean",
"default": false
},
"unlimitedPowerBombs": {
"type": "boolean",
"default": false
},
"missileLauncher": {
"type": "boolean",
"default": false
},
"powerBombLauncher": {
"type": "boolean",
"default": false
},
"springBall": {
"type": "boolean",
"default": false
}
},
"required": [
Expand All @@ -2552,6 +2585,7 @@
"bombs",
"spiderBall",
"boostBall",
"powerSuit",
"variaSuit",
"gravitySuit",
"phazonSuit",
Expand All @@ -2562,7 +2596,13 @@
"superMissile",
"wavebuster",
"iceSpreader",
"flamethrower"
"flamethrower",
"unknownItem1",
"unlimitedMissiles",
"unlimitedPowerBombs",
"missileLauncher",
"powerBombLauncher",
"springBall"
],
"default": {
"combatVisor": true,
Expand All @@ -2579,6 +2619,7 @@
"bombs": false,
"spiderBall": false,
"boostBall": false,
"powerSuit": 0,
"variaSuit": false,
"gravitySuit": false,
"phazonSuit": false,
Expand All @@ -2589,7 +2630,13 @@
"superMissile": false,
"wavebuster": false,
"iceSpreader": false,
"flamethrower": false
"flamethrower": false,
"unknownItem1": 0,
"unlimitedMissiles": false,
"unlimitedPowerBombs": false,
"missileLauncher": false,
"powerBombLauncher": false,
"springBall": false
},
"additionalProperties": false
},
Expand Down Expand Up @@ -2738,7 +2785,12 @@
"Artifact of Newborn",
"Nothing",
"Floaty Jump",
"Ice Trap"
"Ice Trap",
"Unlimited Missiles",
"Unlimited Power Bombs",
"Missile Launcher",
"Main Power Bomb",
"Spring Ball"
],
"default": "Nothing"
},
Expand Down Expand Up @@ -3918,6 +3970,7 @@
"default": 0
},
"itemId": {
"description": "Any custom items will be stored in UnknownItem2",
"type": "string",
"enum": [
"PowerBeam",
Expand Down Expand Up @@ -3960,7 +4013,12 @@
"ArtifactOfSun",
"ArtifactOfWorld",
"ArtifactOfSpirit",
"ArtifactOfNewborn"
"ArtifactOfNewborn",
"UnlimitedMissiles",
"UnlimitedPowerBombs",
"MissileLauncher",
"PowerBombLauncher",
"SpringBall"
],
"default": "PowerBeam"
},
Expand Down
4 changes: 2 additions & 2 deletions src/add_modify_obj_patches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,9 @@ pub fn patch_add_spawn_point(
varia_suit: 0,
phazon_suit: 0,
energy_tanks: 0,
unknown0: 0,
unknown_item_1: 0,
health_refill: 0,
unknown1: 0,
unknown_item_2: 0,
wavebuster: 0,
default_spawn: config.default_spawn.unwrap_or(false) as u8,
active: config.active.unwrap_or(true) as u8,
Expand Down
18 changes: 8 additions & 10 deletions src/custom_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1367,16 +1367,14 @@ pub fn collect_game_resources<'r>(
];
looking_for.extend(custom_scan_point_deps);

if config.enable_ice_traps {
let player_freeze_deps: Vec<(u32, FourCC)> = vec![
resource_info!("breakFreezeVisor.PART").into(),
resource_info!("Frost1TXTR.TXTR").into(),
resource_info!("75DAC95C.PART").into(),
resource_info!("zorch1_snow3.TXTR").into(),
resource_info!("C28C7348.PART").into(),
];
looking_for.extend(player_freeze_deps);
}
let player_freeze_deps: Vec<(u32, FourCC)> = vec![
resource_info!("breakFreezeVisor.PART").into(),
resource_info!("Frost1TXTR.TXTR").into(),
resource_info!("75DAC95C.PART").into(),
resource_info!("zorch1_snow3.TXTR").into(),
resource_info!("C28C7348.PART").into(),
];
looking_for.extend(player_freeze_deps);

// Dependencies read from paks and custom assets will go here //
let mut found = HashMap::with_capacity(looking_for.len());
Expand Down
11 changes: 8 additions & 3 deletions src/patch_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ pub struct PatchConfig {
pub starting_visor: Visor,
pub starting_beam: Beam,
pub escape_sequence_counts_up: bool,
pub enable_ice_traps: bool,
pub enable_ice_traps: bool, // deprecated
pub missile_station_pb_refill: bool,
pub door_open_mode: DoorOpenMode,

Expand Down Expand Up @@ -2336,7 +2336,12 @@ impl PatchConfigPrivate {
item_max_capacity.insert(PickupType::EnergyTank, 200);
}

if item_max_capacity.contains_key(&PickupType::Nothing)
if item_max_capacity.contains_key(&PickupType::UnlimitedMissiles)
|| item_max_capacity.contains_key(&PickupType::UnlimitedPowerBombs)
|| item_max_capacity.contains_key(&PickupType::MissileLauncher)
|| item_max_capacity.contains_key(&PickupType::PowerBombLauncher)
|| item_max_capacity.contains_key(&PickupType::SpringBall)
|| item_max_capacity.contains_key(&PickupType::Nothing)
|| item_max_capacity.contains_key(&PickupType::FloatyJump)
|| item_max_capacity.contains_key(&PickupType::IceTrap)
{
Expand Down Expand Up @@ -2674,7 +2679,7 @@ impl PatchConfigPrivate {
.unwrap_or_else(|| StartingItems::from_u64(1)),
disable_item_loss: self.game_config.disable_item_loss.unwrap_or(true),
escape_sequence_counts_up: self.game_config.escape_sequence_counts_up.unwrap_or(false),
enable_ice_traps: self.game_config.enable_ice_traps.unwrap_or(false),
enable_ice_traps: self.game_config.enable_ice_traps.unwrap_or(true),
missile_station_pb_refill: self.game_config.missile_station_pb_refill.unwrap_or(false),
door_open_mode: self
.game_config
Expand Down
Loading

0 comments on commit e4bb8c3

Please sign in to comment.