forked from AmazingAmpharos/OoT-Randomizer
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Item : Bronze scale #2224
Draft
GSKirox
wants to merge
3
commits into
OoTRandomizer:Dev
Choose a base branch
from
GSKirox:bronze_scale
base: Dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
New Item : Bronze scale #2224
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#include "item_upgrades.h" | ||
|
||
#include "get_items.h" | ||
#include "save.h" | ||
#include "z64.h" | ||
|
||
extern uint32_t FREE_BOMBCHU_DROPS; | ||
|
@@ -15,7 +16,7 @@ typedef struct { | |
uint8_t magic : 2; // 0 = no magic, 1 = single magic, 2 = double magic | ||
uint8_t sticks : 2; // 0 = no sticks, 1 = 10, 2 = 20, 3 = 30 | ||
uint8_t nuts : 2; // 0 = no nuts, 1 = 20, 2 = 30, 3 = 40 | ||
uint8_t scale : 2; // 0 = no scale, 1 = silver scale, 2 = gold scale | ||
uint8_t scale : 3; // 0 = no scale, 1 = bronze_scale, 2 = silver scale, 3 = gold scale | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a co-op context version bump. |
||
uint8_t wallet : 2; // 0 = 99, 1 = 200, 2 = 500, 3 = 999 | ||
uint8_t slingshot : 2; // 0 = no slingshot, 1 = 30, 2 = 40, 3 = 50 | ||
uint8_t bow : 2; // 0 = no bow, 1 = 30, 2 = 40, 3 = 50 | ||
|
@@ -82,8 +83,9 @@ uint16_t wallet_upgrade(z64_file_t* save, override_t override) { | |
} | ||
|
||
uint16_t scale_upgrade(z64_file_t* save, override_t override) { | ||
switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? save->diving_upgrade : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].scale) { | ||
case 0: return 0x37; // Silver Scale | ||
switch ((override.value.base.player == PLAYER_ID || !MW_PROGRESSIVE_ITEMS_ENABLE) ? extended_savectx.extended_scale : MW_PROGRESSIVE_ITEMS_STATE[override.value.base.player].scale) { | ||
case 0: return 0x130; // Bronze Scale | ||
case 1: return 0x37; // Silver Scale | ||
default: return 0x38; // Gold Scale | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#include "swim.h" | ||
|
||
RespawnByScene respawnsByScene[] = { | ||
{ 0x1D9, { { -1455, -20, 1384 }, 28761 }}, // Hyrule Field to Zora River (in water) | ||
{ 0x311, { { 5852, -20, 3725 }, -20025 }}, // Zora River to Hyrule Field (in water) | ||
{ 0x4DA, { { 1978, -36, -855 }, -16384 }}, // Zora River to Lost Woods | ||
{ 0x1DD, { { 4082, 860, -1018 }, -32768 }}, // Lost Woods to Zora River | ||
{ 0x219, { { -3276, -1033, 2908 }, 11228 }}, // Gerudo Valley to Lake Hylia | ||
{ 0x3D4, { { -2361, 0, 610 }, 32768 }}, // Ice Cavern to Zora Fountain | ||
{ 0x21D, { { -955, -1306, 6768 }, -32768 }}, // Water Temple to Lake Hylia | ||
{ 0x328, { { -109, 11, -9 }, -29131 }}, // Lake Hylia to Zora Domain | ||
{ 0x560, { { -912, -1326, 3391 }, 0 }}, // Zora Domain to Lake Hylia | ||
{ 0x10E, { { -1500, 150, 1600 }, 32768}}, // Sapphire cutscene to Zora Fountain | ||
}; | ||
|
||
void set_new_respawn() { | ||
|
||
uint8_t newRespawnTrue = 0; | ||
int32_t currentEntranceIndex = z64_game.entrance_index; | ||
for (uint8_t i = 0; i < 10; i++) { | ||
// Ensure we always respawn at a safe location. | ||
if (currentEntranceIndex == respawnsByScene[i].scene_index) { | ||
z64_Play_SetupRespawnPoint(&z64_game, 0x01, 0xDFF); | ||
z64_file.respawn[RESPAWN_MODE_RETURN].pos = respawnsByScene[i].respawnInfo.pos; | ||
z64_file.respawn[RESPAWN_MODE_RETURN].yaw = respawnsByScene[i].respawnInfo.yaw; | ||
z64_file.respawn_flag = 2; | ||
z64_game.scene_load_flag = 0x14; | ||
newRespawnTrue = 1; | ||
break; | ||
} | ||
} | ||
|
||
// Special case for Water Temple river area, so that player respawns at the start of the room. | ||
if (z64_game.scene_index == 5 && z64_game.room_index == 21) { | ||
z64_Play_SetupRespawnPoint(&z64_game, 0x01, 0xDFF); | ||
z64_xyzf_t riverPos = {-3063, 380, -4066}; | ||
z64_file.respawn[RESPAWN_MODE_RETURN].pos = riverPos; | ||
z64_file.respawn[RESPAWN_MODE_RETURN].yaw = 9010; | ||
z64_file.respawn_flag = 2; | ||
z64_game.scene_load_flag = 0x14; | ||
return; | ||
} | ||
|
||
if (newRespawnTrue == 0) { | ||
z64_game.entrance_index = z64_file.entrance_index; | ||
z64_game.fadeout_transition = 0x02; | ||
z64_file.respawn_flag = -2; | ||
z64_game.scene_load_flag = 0x14; | ||
} | ||
} | ||
|
||
void manage_swim() { | ||
|
||
// We found the first scale. | ||
if (extended_savectx.extended_scale > 0) { | ||
return; | ||
} | ||
|
||
// Iron boots are equipped. | ||
if (z64_file.equip_boots == 2) { | ||
return; | ||
} | ||
|
||
// Always allow to swim out of water temple to avoid softlocks. | ||
if (z64_game.scene_index == 5 && | ||
z64_game.room_index == 0 && | ||
z64_link.common.pos_world.z > 700.0) { | ||
return; | ||
} | ||
|
||
if (z64_link.state_flags_1 & 0x08000000) { // Swimming state flag. | ||
PlaySFX(0x28CD); // NA_SE_EV_WATER_CONVECTION | ||
set_new_respawn(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef SWIM_H | ||
#define SWIM_H | ||
|
||
#include "z64.h" | ||
#include "save.h" | ||
|
||
typedef struct { | ||
/* 0x00 */ z64_xyzf_t pos; | ||
/* 0x0C */ uint16_t yaw; | ||
} SpecialRespawnInfo; // size = 0x10 | ||
|
||
typedef struct { | ||
int32_t scene_index; | ||
SpecialRespawnInfo respawnInfo; | ||
} RespawnByScene; | ||
|
||
void manage_swim(); | ||
|
||
#endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be a bool