Fixes for double spiders & ice traps

getItemId should've been set earlier to make sure double spiders didn't screw up ice traps.

Additionally Item_Give() was still being called with skultulla tokens as the default value so it granted a token when picking up an ice trap.

Skulltula freeze was also happening on ice traps which it shouldn't do, so that's fixed now too.
This commit is contained in:
aMannus 2022-07-20 22:47:25 +02:00
parent 0cc59a9370
commit a7936942b1

View File

@ -98,18 +98,20 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) {
if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) {
this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER;
if (gSaveContext.n64ddFlag) {
getItemId = Randomizer_GetRandomizedItemId(GI_SKULL_TOKEN, this->actor.id, this->actor.params, globalCtx->sceneNum);
if (getItemId == GI_ICE_TRAP) {
player->getItemId = GI_ICE_TRAP;
player->iceTrapped = 1;
textId = 0xF8;
} else {
getItemId = Randomizer_GetRandomizedItemId(GI_SKULL_TOKEN, this->actor.id, this->actor.params, globalCtx->sceneNum);
textId = sGetItemTable[getItemId - 1].textId;
giveItemId = sGetItemTable[getItemId - 1].itemId;
Item_Give(globalCtx, giveItemId);
}
} else {
Item_Give(globalCtx, giveItemId);
}
Item_Give(globalCtx, giveItemId);
if (CVar_GetS32("gSkulltulaFreeze", 0) != 1 || giveItemId != ITEM_SKULL_TOKEN) {
if ((CVar_GetS32("gSkulltulaFreeze", 0) != 1 || giveItemId != ITEM_SKULL_TOKEN) && getItemId != GI_ICE_TRAP) {
player->actor.freezeTimer = 20;
}
Message_StartTextbox(globalCtx, textId, NULL);
@ -133,16 +135,18 @@ void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) {
if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) {
if (gSaveContext.n64ddFlag) {
getItemId = Randomizer_GetRandomizedItemId(GI_SKULL_TOKEN, this->actor.id, this->actor.params, globalCtx->sceneNum);
if (getItemId == GI_ICE_TRAP) {
GiveItemWithoutActor(globalCtx, GI_ICE_TRAP);
textId = 0xF8;
} else {
getItemId = Randomizer_GetRandomizedItemId(GI_SKULL_TOKEN, this->actor.id, this->actor.params, globalCtx->sceneNum);
textId = sGetItemTable[getItemId - 1].textId;
giveItemId = sGetItemTable[getItemId - 1].itemId;
Item_Give(globalCtx, giveItemId);
}
} else {
Item_Give(globalCtx, giveItemId);
}
Item_Give(globalCtx, giveItemId);
Message_StartTextbox(globalCtx, textId, NULL);
Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET);
this->actionFunc = func_80AFB950;
@ -152,7 +156,8 @@ void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) {
void func_80AFB950(EnSi* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_CLOSING && (CVar_GetS32("gSkulltulaFreeze", 0) != 1 || giveItemId != ITEM_SKULL_TOKEN)) {
if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_CLOSING &&
((CVar_GetS32("gSkulltulaFreeze", 0) != 1 || giveItemId != ITEM_SKULL_TOKEN) && getItemId != GI_ICE_TRAP)) {
player->actor.freezeTimer = 10;
} else {
SET_GS_FLAGS((this->actor.params & 0x1F00) >> 8, this->actor.params & 0xFF);