Merge pull request #18 from MelonSpeedruns/melon-randomizer

all warps now work + stones have their proper model
This commit is contained in:
briaguya 2022-05-30 14:06:56 -04:00 committed by GitHub
commit 94e7822554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 197 additions and 43 deletions

View file

@ -1081,31 +1081,36 @@ RandomizerCheck Randomizer::GetCheckFromActor(s16 sceneNum, s16 actorId, s16 act
switch (actorId) {
case 95:
return FOREST_TEMPLE_PHANTOM_GANON_HEART;
// todo PHANTOM_GANON
case 93:
return PHANTOM_GANON;
}
case 21:
switch (actorId) {
case 95:
return FIRE_TEMPLE_VOLVAGIA_HEART;
// todo VOLVAGIA
case 93:
return VOLVAGIA;
}
case 22:
switch (actorId) {
case 95:
return WATER_TEMPLE_MORPHA_HEART;
// todo MORPHA
case 93:
return MORPHA;
}
case 23:
switch (actorId) {
case 95:
return SPIRIT_TEMPLE_TWINROVA_HEART;
// todo TWINROVA
case 93:
return TWINROVA;
}
case 24:
switch (actorId) {
case 95:
return SHADOW_TEMPLE_BONGO_BONGO_HEART;
// todo BONGO_BONGO
case 93:
return BONGO_BONGO;
}
case 40:
switch(actorParams) {

View file

@ -105,6 +105,10 @@ void GetItem_DrawSmallRupee(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawScale(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawBulletBag(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawWallet(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawJewel(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawJewelKokiri(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawJewelGoron(GlobalContext* globalCtx, s16 drawId);
void GetItem_DrawJewelZora(GlobalContext* globalCtx, s16 drawId);
typedef struct {
/* 0x00 */ void (*drawFunc)(GlobalContext*, s16);
@ -368,11 +372,9 @@ DrawItemTableEntry sDrawItemTable[] = {
// gold skulltula token, OBJECT_ST
{ GetItem_DrawSkullToken, { object_st_DL_004DB0, object_st_DL_004EB8 } },
{ GetItem_DrawOpa0Xlu1, { gGiKokiriEmeraldGemDL, gGiKokiriEmeraldSettingDL } },
// fire medallion, OBJECT_GI_MEDAL
{ GetItem_DrawOpa0Xlu1, { gGiGoronRubySettingDL, gGiGoronRubyGemDL } },
// water medallion, OBJECT_GI_MEDAL
{ GetItem_DrawOpa0Xlu1, { gGiZoraSapphireSettingDL, gGiZoraSapphireGemDL, } },
{ GetItem_DrawJewelKokiri, { gGiKokiriEmeraldGemDL, gGiKokiriEmeraldSettingDL } },
{ GetItem_DrawJewelGoron, { gGiGoronRubyGemDL, gGiGoronRubySettingDL } },
{ GetItem_DrawJewelZora, { gGiZoraSapphireGemDL, gGiZoraSapphireSettingDL } },
};
/**
@ -385,6 +387,96 @@ void GetItem_Draw(GlobalContext* globalCtx, s16 drawId) {
// All remaining functions in this file are draw functions referenced in the table and called by the function above
/* 0x0178 */ u8 primXluColor[3];
/* 0x017B */ u8 envXluColor[3];
/* 0x017E */ u8 primOpaColor[3];
/* 0x0181 */ u8 envOpaColor[3];
void GetItem_DrawJewelKokiri(GlobalContext* globalCtx, s16 drawId) {
primXluColor[2] = 160;
primXluColor[0] = 255;
primXluColor[1] = 255;
envXluColor[0] = 0;
envXluColor[1] = 255;
envXluColor[2] = 0;
primOpaColor[2] = 170;
primOpaColor[0] = 255;
primOpaColor[1] = 255;
envOpaColor[1] = 120;
envOpaColor[0] = 150;
envOpaColor[2] = 0;
GetItem_DrawJewel(globalCtx, drawId);
}
void GetItem_DrawJewelGoron(GlobalContext* globalCtx, s16 drawId) {
primXluColor[1] = 170;
primXluColor[0] = 255;
primXluColor[2] = 255;
envXluColor[2] = 100;
envXluColor[0] = 255;
envXluColor[1] = 0;
primOpaColor[2] = 170;
primOpaColor[0] = 255;
primOpaColor[1] = 255;
envOpaColor[1] = 120;
envOpaColor[0] = 150;
envOpaColor[2] = 0;
GetItem_DrawJewel(globalCtx, drawId);
}
void GetItem_DrawJewelZora(GlobalContext* globalCtx, s16 drawId) {
primXluColor[0] = 50;
primXluColor[1] = 255;
primXluColor[2] = 255;
envXluColor[2] = 150;
envXluColor[0] = 50;
envXluColor[1] = 0;
primOpaColor[2] = 170;
primOpaColor[0] = 255;
primOpaColor[1] = 255;
envOpaColor[1] = 120;
envOpaColor[0] = 150;
envOpaColor[2] = 0;
GetItem_DrawJewel(globalCtx, drawId);
}
void GetItem_DrawJewel(GlobalContext* globalCtx, s16 drawId) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2543);
gSPSegment(POLY_XLU_DISP++, 9,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 % 256, (256 - (0 % 256)) - 1, 64, 64, 1, 0 % 256,
(256 - (0 % 256)) - 1, 16, 16));
gSPSegment(POLY_OPA_DISP++, 8, Gfx_TexScroll(globalCtx->state.gfxCtx, (u8)0, (u8)0, 16, 16));
Matrix_Push();
Matrix_RotateZYX(0, -0x4000, 0x4000, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2597),
G_MTX_NOPUSH | G_MTX_LOAD);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2599),
G_MTX_NOPUSH | G_MTX_LOAD);
func_80093D84(globalCtx->state.gfxCtx);
// func_8002ED80(&this->actor, globalCtx, 0);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primXluColor[0], primXluColor[1], primXluColor[2], 255);
gDPSetEnvColor(POLY_XLU_DISP++, envXluColor[0], envXluColor[1], envXluColor[2], 255);
gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]);
func_80093D18(globalCtx->state.gfxCtx);
// func_8002EBCC(&this->actor, globalCtx, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 128, primOpaColor[0], primOpaColor[1], primOpaColor[2], 255);
gDPSetEnvColor(POLY_OPA_DISP++, envOpaColor[0], envOpaColor[1], envOpaColor[2], 255);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_effect.c", 2620);
}
void GetItem_DrawMaskOrBombchu(GlobalContext* globalCtx, s16 drawId) {
s32 pad;

View file

@ -463,10 +463,24 @@ s32 DoorWarp1_PlayerInRange(DoorWarp1* this, GlobalContext* globalCtx) {
u8 success = 0;
void GivePlayerRandoReward(DoorWarp1* this, Player* player, GlobalContext* globalCtx) {
void GivePlayerRandoReward(DoorWarp1* this, Player* player, GlobalContext* globalCtx, u8 ruto, u8 adult) {
GetItemID getItemId = GetRandomizedItemId(GI_NONE, this->actor.id, this->actor.params, globalCtx->sceneNum);
if (success && !Player_InBlockingCsMode(globalCtx, GET_PLAYER(globalCtx))) {
if (adult) {
OnePointCutscene_Init(globalCtx, 0x25E8, 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 = 20;
DoorWarp1_SetupAction(this, func_8099A508);
} else {
if (ruto) {
this->rutoWarpState = WARP_BLUE_RUTO_STATE_ENTERED;
func_8002DF54(globalCtx, &this->actor, 10);
this->unk_1B2 = 1;
DoorWarp1_SetupAction(this, func_80999EE0);
} else {
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);
@ -475,7 +489,10 @@ void GivePlayerRandoReward(DoorWarp1* this, Player* player, GlobalContext* globa
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) {
@ -492,7 +509,7 @@ void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) {
player = GET_PLAYER(globalCtx);
if (gSaveContext.n64ddFlag) {
GivePlayerRandoReward(this, player, globalCtx);
GivePlayerRandoReward(this, player, globalCtx, 0, 0);
return;
}
@ -583,6 +600,12 @@ void DoorWarp1_RutoWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG);
if (this->rutoWarpState != WARP_BLUE_RUTO_STATE_INITIAL && DoorWarp1_PlayerInRange(this, globalCtx)) {
if (gSaveContext.n64ddFlag) {
GivePlayerRandoReward(this, GET_PLAYER(globalCtx), globalCtx, 1, 0);
return;
}
this->rutoWarpState = WARP_BLUE_RUTO_STATE_ENTERED;
func_8002DF54(globalCtx, &this->actor, 10);
this->unk_1B2 = 1;
@ -696,6 +719,11 @@ void DoorWarp1_AdultWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) {
if (DoorWarp1_PlayerInRange(this, globalCtx)) {
player = GET_PLAYER(globalCtx);
if (gSaveContext.n64ddFlag) {
GivePlayerRandoReward(this, player, globalCtx, 0, 1);
return;
}
OnePointCutscene_Init(globalCtx, 0x25E8, 999, &this->actor, MAIN_CAM);
func_8002DF54(globalCtx, &this->actor, 10);
player->unk_450.x = this->actor.world.pos.x;
@ -753,10 +781,16 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) {
if (globalCtx->sceneNum == SCENE_MORIBOSSROOM) {
if (!(gSaveContext.eventChkInf[4] & 0x100)) {
gSaveContext.eventChkInf[4] |= 0x100;
if (gSaveContext.n64ddFlag) {
globalCtx->nextEntranceIndex = 0x608;
gSaveContext.nextCutsceneIndex = 0;
} else {
Item_Give(globalCtx, ITEM_MEDALLION_FOREST);
globalCtx->nextEntranceIndex = 0x6B;
gSaveContext.nextCutsceneIndex = 0;
gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST;
}
} else {
if (!LINK_IS_ADULT) {
globalCtx->nextEntranceIndex = 0x600;
@ -768,9 +802,15 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) {
} else if (globalCtx->sceneNum == SCENE_FIRE_BS) {
if (!(gSaveContext.eventChkInf[4] & 0x200)) {
gSaveContext.eventChkInf[4] |= 0x200;
if (gSaveContext.n64ddFlag) {
globalCtx->nextEntranceIndex = 0x564;
gSaveContext.nextCutsceneIndex = 0;
} else {
Item_Give(globalCtx, ITEM_MEDALLION_FIRE);
globalCtx->nextEntranceIndex = 0xDB;
gSaveContext.nextCutsceneIndex = 0xFFF3;
}
} else {
if (!LINK_IS_ADULT) {
globalCtx->nextEntranceIndex = 0x4F6;
@ -782,10 +822,16 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) {
} else if (globalCtx->sceneNum == SCENE_MIZUSIN_BS) {
if (!(gSaveContext.eventChkInf[4] & 0x400)) {
gSaveContext.eventChkInf[4] |= 0x400;
if (gSaveContext.n64ddFlag) {
globalCtx->nextEntranceIndex = 0x60C;
gSaveContext.nextCutsceneIndex = 0;
} else {
Item_Give(globalCtx, ITEM_MEDALLION_WATER);
globalCtx->nextEntranceIndex = 0x6B;
gSaveContext.nextCutsceneIndex = 0;
gSaveContext.chamberCutsceneNum = CHAMBER_CS_WATER;
}
} else {
if (!LINK_IS_ADULT) {
globalCtx->nextEntranceIndex = 0x604;
@ -796,10 +842,16 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) {
}
} else if (globalCtx->sceneNum == SCENE_JYASINBOSS) {
if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) {
if (gSaveContext.n64ddFlag) {
globalCtx->nextEntranceIndex = 0x610;
gSaveContext.nextCutsceneIndex = 0;
} else {
Item_Give(globalCtx, ITEM_MEDALLION_SPIRIT);
globalCtx->nextEntranceIndex = 0x6B;
gSaveContext.nextCutsceneIndex = 0;
gSaveContext.chamberCutsceneNum = CHAMBER_CS_SPIRIT;
}
} else {
if (!LINK_IS_ADULT) {
globalCtx->nextEntranceIndex = 0x1F1;
@ -810,10 +862,15 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, GlobalContext* globalCtx) {
}
} else if (globalCtx->sceneNum == SCENE_HAKADAN_BS) {
if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) {
if (gSaveContext.n64ddFlag) {
globalCtx->nextEntranceIndex = 0x580;
gSaveContext.nextCutsceneIndex = 0;
} else {
Item_Give(globalCtx, ITEM_MEDALLION_SHADOW);
globalCtx->nextEntranceIndex = 0x6B;
gSaveContext.nextCutsceneIndex = 0;
gSaveContext.chamberCutsceneNum = CHAMBER_CS_SHADOW;
}
} else {
if (!LINK_IS_ADULT) {
globalCtx->nextEntranceIndex = 0x568;

View file

@ -627,9 +627,9 @@ static GetItemEntry sGetItemTable[] = {
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(ITEM_KOKIRI_EMERALD, OBJECT_GI_COIN, GID_NCOIN_GREEN, 0x80, 0x80, CHEST_ANIM_LONG),
GET_ITEM(ITEM_GORON_RUBY, OBJECT_GI_COIN, GID_NCOIN_RED, 0x81, 0x80, CHEST_ANIM_LONG),
GET_ITEM(ITEM_ZORA_SAPPHIRE, OBJECT_GI_COIN, GID_NCOIN_BLUE, 0x82, 0x80, CHEST_ANIM_LONG),
GET_ITEM(ITEM_KOKIRI_EMERALD, OBJECT_GI_JEWEL, GID_KOKIRI_EMERALD, 0x80, 0x80, CHEST_ANIM_LONG),
GET_ITEM(ITEM_GORON_RUBY, OBJECT_GI_JEWEL, GID_GORON_RUBY, 0x81, 0x80, CHEST_ANIM_LONG),
GET_ITEM(ITEM_ZORA_SAPPHIRE, OBJECT_GI_JEWEL, GID_ZORA_SAPPHIRE, 0x82, 0x80, CHEST_ANIM_LONG),
GET_ITEM_NONE,
GET_ITEM_NONE,
};