mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-23 06:35:33 -07:00
warps are fully working (chests broken)
This commit is contained in:
parent
f96cfee16d
commit
5906e71550
10 changed files with 89 additions and 10 deletions
|
@ -380,7 +380,13 @@ typedef enum {
|
||||||
/* 0x7B */ GI_BULLET_BAG_50,
|
/* 0x7B */ GI_BULLET_BAG_50,
|
||||||
/* 0x7C */ GI_ICE_TRAP, // freezes link when opened from a chest
|
/* 0x7C */ GI_ICE_TRAP, // freezes link when opened from a chest
|
||||||
/* 0x7D */ GI_TEXT_0, // no model appears over Link, shows text id 0 (pocket egg)
|
/* 0x7D */ GI_TEXT_0, // no model appears over Link, shows text id 0 (pocket egg)
|
||||||
/* 0x7E */ GI_MAX
|
/* 0x7E */ GI_MEDALLION_LIGHT,
|
||||||
|
/* 0x7F */ GI_MEDALLION_FOREST,
|
||||||
|
/* 0x80 */ GI_MEDALLION_FIRE,
|
||||||
|
/* 0x81 */ GI_MEDALLION_WATER,
|
||||||
|
/* 0x82 */ GI_MEDALLION_SHADOW,
|
||||||
|
/* 0x83 */ GI_MEDALLION_SPIRIT,
|
||||||
|
/* 0x84 */ GI_MAX
|
||||||
} GetItemID;
|
} GetItemID;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -481,7 +481,7 @@ typedef struct Player {
|
||||||
/* 0x042D */ s8 doorDirection;
|
/* 0x042D */ s8 doorDirection;
|
||||||
/* 0x042E */ s16 doorTimer;
|
/* 0x042E */ s16 doorTimer;
|
||||||
/* 0x0430 */ Actor* doorActor;
|
/* 0x0430 */ Actor* doorActor;
|
||||||
/* 0x0434 */ s8 getItemId;
|
/* 0x0434 */ u8 getItemId;
|
||||||
/* 0x0436 */ u16 getItemDirection;
|
/* 0x0436 */ u16 getItemDirection;
|
||||||
/* 0x0438 */ Actor* interactRangeActor;
|
/* 0x0438 */ Actor* interactRangeActor;
|
||||||
/* 0x043C */ s8 mountSide;
|
/* 0x043C */ s8 mountSide;
|
||||||
|
|
|
@ -782,8 +782,8 @@ void Randomizer::ParseItemLocations(const char* spoilerFileName) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Randomizer::GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum) {
|
GetItemID Randomizer::GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum) {
|
||||||
s32 itemId = GetItemFromActor(actorId, actorParams, sceneNum, ogId);
|
GetItemID itemId = GetItemFromActor(actorId, actorParams, sceneNum, ogId);
|
||||||
return itemId;
|
return itemId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,6 +791,17 @@ GetItemID Randomizer::GetItemFromActor(s16 actorId, s16 actorParams, s16 sceneNu
|
||||||
return GetItemFromGet(this->itemLocations[GetCheckFromActor(sceneNum, actorId, actorParams)], ogItemId);
|
return GetItemFromGet(this->itemLocations[GetCheckFromActor(sceneNum, actorId, actorParams)], ogItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ItemID Randomizer::GetItemIdFromGetItem(GetItemID getItemId) {
|
||||||
|
return GetItemFromGetItem(getItemId);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemID Randomizer::GetItemFromGetItem(GetItemID getItemId) {
|
||||||
|
switch (getItemId) {
|
||||||
|
case GI_MEDALLION_FIRE:
|
||||||
|
return ITEM_MEDALLION_FIRE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) {
|
GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) {
|
||||||
switch(randoGet) {
|
switch(randoGet) {
|
||||||
case UNKNOWN_GET:
|
case UNKNOWN_GET:
|
||||||
|
@ -984,6 +995,18 @@ GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId)
|
||||||
return GI_ARROWS_LARGE;
|
return GI_ARROWS_LARGE;
|
||||||
case DEKU_STICK_1:
|
case DEKU_STICK_1:
|
||||||
return GI_STICKS_1;
|
return GI_STICKS_1;
|
||||||
|
case LIGHT_MEDALLION:
|
||||||
|
return GI_MEDALLION_LIGHT;
|
||||||
|
case FOREST_MEDALLION:
|
||||||
|
return GI_MEDALLION_FOREST;
|
||||||
|
case FIRE_MEDALLION:
|
||||||
|
return GI_MEDALLION_FIRE;
|
||||||
|
case WATER_MEDALLION:
|
||||||
|
return GI_MEDALLION_WATER;
|
||||||
|
case SHADOW_MEDALLION:
|
||||||
|
return GI_MEDALLION_SHADOW;
|
||||||
|
case SPIRIT_MEDALLION:
|
||||||
|
return GI_MEDALLION_SPIRIT;
|
||||||
default:
|
default:
|
||||||
return ogItemId;
|
return ogItemId;
|
||||||
}
|
}
|
||||||
|
@ -1005,9 +1028,11 @@ RandomizerCheck Randomizer::GetCheckFromActor(s16 sceneNum, s16 actorId, s16 act
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 17:
|
case 17:
|
||||||
switch (actorParams) {
|
switch (actorId) {
|
||||||
case 0x1F:
|
case 95:
|
||||||
return DEKU_TREE_QUEEN_GOHMA_HEART;
|
return DEKU_TREE_QUEEN_GOHMA_HEART;
|
||||||
|
case 93:
|
||||||
|
return QUEEN_GOHMA;
|
||||||
}
|
}
|
||||||
case 40:
|
case 40:
|
||||||
switch(actorParams) {
|
switch(actorParams) {
|
||||||
|
|
|
@ -21,7 +21,9 @@ class Randomizer {
|
||||||
s16 GetItemModelFromId(s16 itemId);
|
s16 GetItemModelFromId(s16 itemId);
|
||||||
void LoadItemLocations(const char* spoilerFileName);
|
void LoadItemLocations(const char* spoilerFileName);
|
||||||
void ParseItemLocations(const char* spoilerFileName);
|
void ParseItemLocations(const char* spoilerFileName);
|
||||||
s32 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
|
ItemID GetItemIdFromGetItem(GetItemID getItemId);
|
||||||
|
ItemID GetItemFromGetItem(GetItemID getItemId);
|
||||||
|
GetItemID GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1039,3 +1039,11 @@ extern "C" void ParseItemLocations(const char* spoilerFileName) {
|
||||||
extern "C" s32 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum) {
|
extern "C" s32 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum) {
|
||||||
return OTRGlobals::Instance->gRandomizer->GetRandomizedItemId(ogId, actorId, actorParams, sceneNum);
|
return OTRGlobals::Instance->gRandomizer->GetRandomizedItemId(ogId, actorId, actorParams, sceneNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" ItemID GetItemIdFromGetItem(GetItemID getItemId) {
|
||||||
|
return OTRGlobals::Instance->gRandomizer->GetItemIdFromGetItem(getItemId);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" ItemID GetItemFromGetItem(GetItemID getItemId) {
|
||||||
|
return OTRGlobals::Instance->gRandomizer->GetItemFromGetItem(getItemId);
|
||||||
|
}
|
|
@ -76,6 +76,9 @@ void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
|
||||||
int Controller_ShouldRumble(size_t i);
|
int Controller_ShouldRumble(size_t i);
|
||||||
void LoadItemLocations(const char* spoilerFileName);
|
void LoadItemLocations(const char* spoilerFileName);
|
||||||
void ParseItemLocations(const char* spoilerfilename);
|
void ParseItemLocations(const char* spoilerfilename);
|
||||||
|
ItemID GetItemIdFromGetItem(GetItemID getItemId);
|
||||||
|
s16 GetItemModelFromId(s16 itemId);
|
||||||
|
ItemID GetItemFromGetItem(GetItemID getItemId);
|
||||||
s32 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
|
s32 GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -461,6 +461,28 @@ s32 DoorWarp1_PlayerInRange(DoorWarp1* this, GlobalContext* globalCtx) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u8 success = 0;
|
||||||
|
|
||||||
|
void GivePlayerRandoReward(DoorWarp1* this, Player* player, GlobalContext* globalCtx) {
|
||||||
|
GetItemID getItemId = GetRandomizedItemId(GI_NONE, this->actor.id, this->actor.params, globalCtx->sceneNum);
|
||||||
|
|
||||||
|
if (success && !Player_InBlockingCsMode(globalCtx, GET_PLAYER(globalCtx))) {
|
||||||
|
Audio_PlaySoundGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||||
|
&D_801333E8);
|
||||||
|
OnePointCutscene_Init(globalCtx, 0x25E7, 999, &this->actor, MAIN_CAM);
|
||||||
|
func_8002DF54(globalCtx, &this->actor, 10);
|
||||||
|
|
||||||
|
player->unk_450.x = this->actor.world.pos.x;
|
||||||
|
player->unk_450.z = this->actor.world.pos.z;
|
||||||
|
this->unk_1B2 = 1;
|
||||||
|
DoorWarp1_SetupAction(this, DoorWarp1_ChildWarpOut);
|
||||||
|
|
||||||
|
success = 0;
|
||||||
|
} else if (!success) {
|
||||||
|
success = func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 100.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) {
|
void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) {
|
||||||
Player* player;
|
Player* player;
|
||||||
|
|
||||||
|
@ -469,6 +491,11 @@ void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) {
|
||||||
if (DoorWarp1_PlayerInRange(this, globalCtx)) {
|
if (DoorWarp1_PlayerInRange(this, globalCtx)) {
|
||||||
player = GET_PLAYER(globalCtx);
|
player = GET_PLAYER(globalCtx);
|
||||||
|
|
||||||
|
if (gSaveContext.n64ddFlag) {
|
||||||
|
GivePlayerRandoReward(this, player, globalCtx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Audio_PlaySoundGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
Audio_PlaySoundGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||||
&D_801333E8);
|
&D_801333E8);
|
||||||
OnePointCutscene_Init(globalCtx, 0x25E7, 999, &this->actor, MAIN_CAM);
|
OnePointCutscene_Init(globalCtx, 0x25E7, 999, &this->actor, MAIN_CAM);
|
||||||
|
@ -514,11 +541,11 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, GlobalContext* globalCtx) {
|
||||||
if (!Flags_GetEventChkInf(7)) {
|
if (!Flags_GetEventChkInf(7)) {
|
||||||
Flags_SetEventChkInf(7);
|
Flags_SetEventChkInf(7);
|
||||||
Flags_SetEventChkInf(9);
|
Flags_SetEventChkInf(9);
|
||||||
Item_Give(globalCtx, ITEM_KOKIRI_EMERALD);
|
|
||||||
if (gSaveContext.n64ddFlag) {
|
if (gSaveContext.n64ddFlag) {
|
||||||
globalCtx->nextEntranceIndex = 0x0457;
|
globalCtx->nextEntranceIndex = 0x0457;
|
||||||
gSaveContext.nextCutsceneIndex = 0;
|
gSaveContext.nextCutsceneIndex = 0;
|
||||||
} else {
|
} else {
|
||||||
|
Item_Give(globalCtx, ITEM_KOKIRI_EMERALD);
|
||||||
globalCtx->nextEntranceIndex = 0xEE;
|
globalCtx->nextEntranceIndex = 0xEE;
|
||||||
gSaveContext.nextCutsceneIndex = 0xFFF1;
|
gSaveContext.nextCutsceneIndex = 0xFFF1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,7 @@ void func_809DF778(EnCow* this, GlobalContext* globalCtx) {
|
||||||
this->actor.parent = NULL;
|
this->actor.parent = NULL;
|
||||||
this->actionFunc = func_809DF730;
|
this->actionFunc = func_809DF730;
|
||||||
} else {
|
} else {
|
||||||
func_8002F434(&this->actor, globalCtx, GI_MILK, 10000.0f, 100.0f);
|
func_8002F434(&this->actor, globalCtx, GID_MEDALLION_FIRE, 10000.0f, 100.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ void ItemBHeart_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
Actor_Kill(&this->actor);
|
Actor_Kill(&this->actor);
|
||||||
} else {
|
} else {
|
||||||
if (gSaveContext.n64ddFlag) {
|
if (gSaveContext.n64ddFlag) {
|
||||||
s16 getItemId = GetRandomizedItemId(GI_HEART_CONTAINER_2, this->actor.id, this->actor.params, globalCtx->sceneNum);
|
s32 getItemId = GetRandomizedItemId(GI_HEART_CONTAINER_2, this->actor.id, this->actor.params, globalCtx->sceneNum);
|
||||||
func_8002F434(&this->actor, globalCtx, getItemId, 30.0f, 40.0f);
|
func_8002F434(&this->actor, globalCtx, getItemId, 30.0f, 40.0f);
|
||||||
} else {
|
} else {
|
||||||
func_8002F434(&this->actor, globalCtx, GI_HEART_CONTAINER_2, 30.0f, 40.0f);
|
func_8002F434(&this->actor, globalCtx, GI_HEART_CONTAINER_2, 30.0f, 40.0f);
|
||||||
|
|
|
@ -619,6 +619,14 @@ static GetItemEntry sGetItemTable[] = {
|
||||||
GET_ITEM(ITEM_NUT_UPGRADE_30, OBJECT_GI_NUTS, GID_NUTS, 0xA7, 0x80, CHEST_ANIM_SHORT),
|
GET_ITEM(ITEM_NUT_UPGRADE_30, OBJECT_GI_NUTS, GID_NUTS, 0xA7, 0x80, CHEST_ANIM_SHORT),
|
||||||
GET_ITEM(ITEM_NUT_UPGRADE_40, OBJECT_GI_NUTS, GID_NUTS, 0xA8, 0x80, CHEST_ANIM_SHORT),
|
GET_ITEM(ITEM_NUT_UPGRADE_40, OBJECT_GI_NUTS, GID_NUTS, 0xA8, 0x80, CHEST_ANIM_SHORT),
|
||||||
GET_ITEM(ITEM_BULLET_BAG_50, OBJECT_GI_DEKUPOUCH, GID_BULLET_BAG_50, 0x6C, 0x80, CHEST_ANIM_LONG),
|
GET_ITEM(ITEM_BULLET_BAG_50, OBJECT_GI_DEKUPOUCH, GID_BULLET_BAG_50, 0x6C, 0x80, CHEST_ANIM_LONG),
|
||||||
|
GET_ITEM(ITEM_ARROW_ICE, OBJECT_GI_M_ARROW, GID_ARROW_ICE, 0x3C, 0x80, CHEST_ANIM_LONG), // Ice Traps
|
||||||
|
GET_ITEM_NONE,
|
||||||
|
GET_ITEM(ITEM_MEDALLION_LIGHT, OBJECT_GI_MEDAL, GID_MEDALLION_LIGHT, 0x40, 0x80, CHEST_ANIM_LONG),
|
||||||
|
GET_ITEM(ITEM_MEDALLION_FOREST, OBJECT_GI_MEDAL, GID_MEDALLION_FOREST, 0x3E, 0x80, CHEST_ANIM_LONG),
|
||||||
|
GET_ITEM(ITEM_MEDALLION_FIRE, OBJECT_GI_MEDAL, GID_MEDALLION_FIRE, 0x3C, 0x80, CHEST_ANIM_LONG),
|
||||||
|
GET_ITEM(ITEM_MEDALLION_WATER, OBJECT_GI_MEDAL, GID_MEDALLION_WATER, 0x3D, 0x80, CHEST_ANIM_LONG),
|
||||||
|
GET_ITEM(ITEM_MEDALLION_SHADOW, OBJECT_GI_MEDAL, GID_MEDALLION_SHADOW, 0x41, 0x80, CHEST_ANIM_LONG),
|
||||||
|
GET_ITEM(ITEM_MEDALLION_SPIRIT, OBJECT_GI_MEDAL, GID_MEDALLION_SPIRIT, 0x3F, 0x80, CHEST_ANIM_LONG),
|
||||||
GET_ITEM_NONE,
|
GET_ITEM_NONE,
|
||||||
GET_ITEM_NONE,
|
GET_ITEM_NONE,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue