mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-09 05:43:18 -04:00
z_parameter: Items & Import Data (#799)
* Import Data * More functions * cleanup * Add Enum * Many changes, PR and add-ons * Fix bss * Better data * Extra space * DoubleDefense is boolean * Missed a macro * More enums missed * macro -> enum * More item cleanup... * missing/wrong quest items * Next PR Review * Revert Interface_AddMagic to Parameter_AddMagic * Remove QUEST_HEART_CONTAINER * Fix bss * Move Color_RGB16 up + fix incorrect numbers * Add texture pointers * Add comment * EQUIP_SLOT_A * rm redundant comment * Fix merge * PR Suggestions * fix bss
This commit is contained in:
@@ -495,7 +495,7 @@ s32 Inventory_GetBtnBItem(PlayState* play) {
|
||||
* Only changes shield
|
||||
*/
|
||||
void Inventory_ChangeEquipment(s16 value) {
|
||||
SET_EQUIP_VALUE(EQUIP_SHIELD, value);
|
||||
SET_EQUIP_VALUE(EQUIP_TYPE_SHIELD, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -504,8 +504,8 @@ void Inventory_ChangeEquipment(s16 value) {
|
||||
u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) {
|
||||
SET_EQUIP_VALUE(EQUIP_SHIELD, 0);
|
||||
if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) != EQUIP_VALUE_SHIELD_NONE) {
|
||||
SET_EQUIP_VALUE(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_NONE);
|
||||
Player_SetEquipmentData(play, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
|
||||
#define RSP_DONE_MSG 667
|
||||
|
||||
@@ -224,7 +224,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
|
||||
break;
|
||||
case ITEM00_FLEXIBLE:
|
||||
case ITEM00_BIG_FAIRY:
|
||||
func_80115908(play, 0x70);
|
||||
Health_ChangeBy(play, 0x70);
|
||||
break;
|
||||
case ITEM00_BOMBS_A:
|
||||
case ITEM00_BOMBS_B:
|
||||
@@ -537,7 +537,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
|
||||
break;
|
||||
case ITEM00_FLEXIBLE:
|
||||
case ITEM00_BIG_FAIRY:
|
||||
func_80115908(play, 0x70);
|
||||
Health_ChangeBy(play, 0x70);
|
||||
break;
|
||||
case ITEM00_BOMBS_A:
|
||||
case ITEM00_BOMBS_B:
|
||||
|
||||
@@ -36,8 +36,8 @@ void GameOver_Update(PlayState* play) {
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_GILDED &&
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_DEITY) {
|
||||
|
||||
if (gSaveContext.buttonStatus[0] != BTN_ENABLED) {
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) = gSaveContext.buttonStatus[0];
|
||||
if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_ENABLED) {
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B];
|
||||
} else {
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE;
|
||||
}
|
||||
@@ -52,11 +52,11 @@ void GameOver_Update(PlayState* play) {
|
||||
gSaveContext.eventInf[1] = 0;
|
||||
gSaveContext.eventInf[2] = 0;
|
||||
gSaveContext.eventInf[3] = 0;
|
||||
gSaveContext.buttonStatus[0] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[1] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[2] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[3] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[4] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED;
|
||||
gSaveContext.unk_3F1E = 0;
|
||||
gSaveContext.unk_3F20 = 0;
|
||||
gSaveContext.unk_3F22 = 0;
|
||||
@@ -73,7 +73,7 @@ void GameOver_Update(PlayState* play) {
|
||||
gSaveContext.respawnFlag = -6;
|
||||
}
|
||||
gSaveContext.nextTransition = 2;
|
||||
gSaveContext.save.playerData.health = 48;
|
||||
gSaveContext.save.playerData.health = 0x30;
|
||||
gameOverCtx->state++;
|
||||
if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) {
|
||||
gSaveContext.save.playerForm = PLAYER_FORM_HUMAN;
|
||||
|
||||
@@ -124,10 +124,10 @@ void KaleidoSetup_Init(PlayState* play) {
|
||||
pauseCtx->unk_258 = 11;
|
||||
pauseCtx->unk_25A = 0;
|
||||
|
||||
pauseCtx->unk_25E[PAUSE_0] = 999;
|
||||
pauseCtx->unk_25E[PAUSE_1] = XREG(94) + 3;
|
||||
pauseCtx->unk_25E[PAUSE_2] = 999;
|
||||
pauseCtx->unk_25E[PAUSE_3] = 999;
|
||||
pauseCtx->cursorItem[PAUSE_0] = 999;
|
||||
pauseCtx->cursorItem[PAUSE_1] = XREG(94) + 3;
|
||||
pauseCtx->cursorItem[PAUSE_2] = 999;
|
||||
pauseCtx->cursorItem[PAUSE_3] = 999;
|
||||
|
||||
pauseCtx->unk_268[PAUSE_0] = 0;
|
||||
pauseCtx->unk_268[PAUSE_1] = XREG(94) + 3;
|
||||
|
||||
@@ -415,16 +415,16 @@ void LifeMeter_UpdateSizeAndBeep(PlayState* play) {
|
||||
u32 LifeMeter_IsCritical(void) {
|
||||
s16 criticalThreshold;
|
||||
|
||||
if (gSaveContext.save.playerData.healthCapacity <= 80) { // healthCapacity <= 5 hearts?
|
||||
criticalThreshold = 16;
|
||||
if (gSaveContext.save.playerData.healthCapacity <= 0x50) {
|
||||
criticalThreshold = 0x10;
|
||||
|
||||
} else if (gSaveContext.save.playerData.healthCapacity <= 160) { // healthCapacity <= 10 hearts?
|
||||
criticalThreshold = 24;
|
||||
} else if (gSaveContext.save.playerData.healthCapacity <= 0xA0) {
|
||||
criticalThreshold = 0x18;
|
||||
|
||||
} else if (gSaveContext.save.playerData.healthCapacity <= 240) { // healthCapacity <= 15 hearts?
|
||||
criticalThreshold = 32;
|
||||
} else if (gSaveContext.save.playerData.healthCapacity <= 0xF0) {
|
||||
criticalThreshold = 0x20;
|
||||
} else {
|
||||
criticalThreshold = 44;
|
||||
criticalThreshold = 0x2C;
|
||||
}
|
||||
|
||||
if ((criticalThreshold >= gSaveContext.save.playerData.health) && (gSaveContext.save.playerData.health > 0)) {
|
||||
|
||||
+1226
-18
File diff suppressed because it is too large
Load Diff
@@ -653,7 +653,7 @@ void func_80123C58(Player* player) {
|
||||
|
||||
void Player_SetEquipmentData(PlayState* play, Player* player) {
|
||||
if (player->csMode != 0x86) {
|
||||
player->currentShield = GET_CUR_EQUIP_VALUE(EQUIP_SHIELD);
|
||||
player->currentShield = GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD);
|
||||
if ((player->transformation != PLAYER_FORM_ZORA) || (((player->currentBoots != PLAYER_BOOTS_ZORA_LAND)) &&
|
||||
(player->currentBoots != PLAYER_BOOTS_ZORA_UNDERWATER))) {
|
||||
player->currentBoots = D_801BFF90[player->transformation];
|
||||
@@ -667,7 +667,7 @@ void Player_SetEquipmentData(PlayState* play, Player* player) {
|
||||
}
|
||||
|
||||
void func_80123D50(PlayState* play, Player* player, s32 itemId, s32 actionParam) {
|
||||
func_80114FD0(play, itemId, player->heldItemButton);
|
||||
Inventory_UpdateBottleItem(play, itemId, player->heldItemButton);
|
||||
|
||||
if (itemId != ITEM_BOTTLE) {
|
||||
player->heldItemId = itemId;
|
||||
|
||||
+35
-36
@@ -230,8 +230,8 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
||||
s16 sceneNum;
|
||||
s32 j;
|
||||
s32 i;
|
||||
u8 temp;
|
||||
u8 temp2;
|
||||
u8 slot;
|
||||
u8 item;
|
||||
|
||||
gSaveContext.save.daySpeed = 0;
|
||||
gSaveContext.save.daysElapsed = 0;
|
||||
@@ -276,7 +276,7 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
||||
}
|
||||
|
||||
if (gSaveContext.save.weekEventReg[84] & 0x20) {
|
||||
func_801149A0(ITEM_MASK_FIERCE_DEITY, SLOT(ITEM_MASK_FIERCE_DEITY));
|
||||
Inventory_DeleteItem(ITEM_MASK_FIERCE_DEITY, SLOT(ITEM_MASK_FIERCE_DEITY));
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_801C66D0); i++) {
|
||||
@@ -306,26 +306,26 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
||||
}
|
||||
|
||||
if (INV_CONTENT(ITEM_BOMB) == ITEM_BOMB) {
|
||||
temp2 = INV_CONTENT(ITEM_BOMB);
|
||||
if (AMMO(temp2) != 0) {
|
||||
item = INV_CONTENT(ITEM_BOMB);
|
||||
if (AMMO(item) != 0) {
|
||||
gSaveContext.eventInf[7] |= 2;
|
||||
}
|
||||
}
|
||||
if (INV_CONTENT(ITEM_NUT) == ITEM_NUT) {
|
||||
temp2 = INV_CONTENT(ITEM_NUT);
|
||||
if (AMMO(temp2) != 0) {
|
||||
item = INV_CONTENT(ITEM_NUT);
|
||||
if (AMMO(item) != 0) {
|
||||
gSaveContext.eventInf[7] |= 4;
|
||||
}
|
||||
}
|
||||
if (INV_CONTENT(ITEM_STICK) == ITEM_STICK) {
|
||||
temp2 = INV_CONTENT(ITEM_STICK);
|
||||
if (AMMO(temp2) != 0) {
|
||||
item = INV_CONTENT(ITEM_STICK);
|
||||
if (AMMO(item) != 0) {
|
||||
gSaveContext.eventInf[7] |= 8;
|
||||
}
|
||||
}
|
||||
if (INV_CONTENT(ITEM_BOW) == ITEM_BOW) {
|
||||
temp2 = INV_CONTENT(ITEM_BOW);
|
||||
if (AMMO(temp2) != 0) {
|
||||
item = INV_CONTENT(ITEM_BOW);
|
||||
if (AMMO(item) != 0) {
|
||||
gSaveContext.eventInf[7] |= 0x10;
|
||||
}
|
||||
}
|
||||
@@ -333,8 +333,8 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
||||
for (i = 0; i < ARRAY_COUNT(D_801C67B0); i++) {
|
||||
if (D_801C67B0[i] != ITEM_NONE) {
|
||||
if ((gSaveContext.save.inventory.items[i] != ITEM_NONE) && (i != SLOT_PICTO_BOX)) {
|
||||
temp2 = gSaveContext.save.inventory.items[i];
|
||||
AMMO(temp2) = 0;
|
||||
item = gSaveContext.save.inventory.items[i];
|
||||
AMMO(item) = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,10 +343,10 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
||||
// Check for all bottled items
|
||||
if (gSaveContext.save.inventory.items[i] >= ITEM_POTION_RED) {
|
||||
if (gSaveContext.save.inventory.items[i] <= ITEM_OBABA_DRINK) {
|
||||
for (j = 1; j < 4; j++) {
|
||||
for (j = EQUIP_SLOT_C_LEFT; j <= EQUIP_SLOT_C_RIGHT; j++) {
|
||||
if (GET_CUR_FORM_BTN_ITEM(j) == gSaveContext.save.inventory.items[i]) {
|
||||
SET_CUR_FORM_BTN_ITEM(j, ITEM_BOTTLE);
|
||||
func_80112B40(play, j);
|
||||
Interface_LoadItemIconImpl(play, j);
|
||||
}
|
||||
}
|
||||
gSaveContext.save.inventory.items[i] = ITEM_BOTTLE;
|
||||
@@ -354,26 +354,26 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
REMOVE_QUEST_ITEM(QUEST_UNK_19);
|
||||
REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH);
|
||||
|
||||
if (gSaveContext.save.playerData.health < 0x30) {
|
||||
gSaveContext.save.playerData.health = 0x30;
|
||||
}
|
||||
|
||||
if (GET_CUR_EQUIP_VALUE(EQUIP_SWORD) < 3) {
|
||||
SET_EQUIP_VALUE(EQUIP_SWORD, 1);
|
||||
if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) <= EQUIP_VALUE_SWORD_RAZOR) {
|
||||
SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_KOKIRI);
|
||||
|
||||
if (CUR_FORM == 0) {
|
||||
if ((STOLEN_ITEM_1 >= ITEM_SWORD_GILDED) || (STOLEN_ITEM_2 >= ITEM_SWORD_GILDED)) {
|
||||
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_GILDED;
|
||||
SET_EQUIP_VALUE(EQUIP_SWORD, 3);
|
||||
SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_GILDED);
|
||||
} else {
|
||||
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI;
|
||||
}
|
||||
} else {
|
||||
if ((STOLEN_ITEM_1 >= ITEM_SWORD_GILDED) || (STOLEN_ITEM_2 >= ITEM_SWORD_GILDED)) {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_B) = ITEM_SWORD_GILDED;
|
||||
SET_EQUIP_VALUE(EQUIP_SWORD, 3);
|
||||
SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_GILDED);
|
||||
} else {
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI;
|
||||
}
|
||||
@@ -385,20 +385,20 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
||||
}
|
||||
|
||||
if (STOLEN_ITEM_1 == ITEM_BOTTLE) {
|
||||
temp = SLOT(ITEM_BOTTLE);
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (gSaveContext.save.inventory.items[temp + i] == ITEM_NONE) {
|
||||
gSaveContext.save.inventory.items[temp + i] = ITEM_BOTTLE;
|
||||
slot = SLOT(ITEM_BOTTLE);
|
||||
for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) {
|
||||
if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) {
|
||||
gSaveContext.save.inventory.items[slot + i] = ITEM_BOTTLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (STOLEN_ITEM_2 == ITEM_BOTTLE) {
|
||||
temp = SLOT(ITEM_BOTTLE);
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (gSaveContext.save.inventory.items[temp + i] == ITEM_NONE) {
|
||||
gSaveContext.save.inventory.items[temp + i] = ITEM_BOTTLE;
|
||||
slot = SLOT(ITEM_BOTTLE);
|
||||
for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) {
|
||||
if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) {
|
||||
gSaveContext.save.inventory.items[slot + i] = ITEM_BOTTLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -407,15 +407,14 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
||||
SET_STOLEN_ITEM_1(STOLEN_ITEM_NONE);
|
||||
SET_STOLEN_ITEM_2(STOLEN_ITEM_NONE);
|
||||
|
||||
// ??
|
||||
func_801149A0(ITEM_OCARINA_FAIRY, SLOT_TRADE_DEED);
|
||||
func_801149A0(ITEM_SLINGSHOT, SLOT_TRADE_KEY_MAMA);
|
||||
func_801149A0(ITEM_LONGSHOT, SLOT_TRADE_COUPLE);
|
||||
Inventory_DeleteItem(ITEM_OCARINA_FAIRY, SLOT_TRADE_DEED);
|
||||
Inventory_DeleteItem(ITEM_SLINGSHOT, SLOT_TRADE_KEY_MAMA);
|
||||
Inventory_DeleteItem(ITEM_LONGSHOT, SLOT_TRADE_COUPLE);
|
||||
|
||||
for (j = 1; j < 4; j++) {
|
||||
for (j = EQUIP_SLOT_C_LEFT; j <= EQUIP_SLOT_C_RIGHT; j++) {
|
||||
if (GET_CUR_FORM_BTN_ITEM(j) >= ITEM_MOON_TEAR && GET_CUR_FORM_BTN_ITEM(j) <= ITEM_PENDANT_MEMORIES) {
|
||||
SET_CUR_FORM_BTN_ITEM(j, ITEM_NONE);
|
||||
func_80112B40(play, j);
|
||||
Interface_LoadItemIconImpl(play, j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,8 +808,8 @@ void Sram_InitDebugSave(void) {
|
||||
Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDebugChecksum, sizeof(gSaveContext.save.checksum));
|
||||
|
||||
if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) {
|
||||
BUTTON_ITEM_EQUIP(0, 2) = D_801C6A48[((void)0, gSaveContext.save.playerForm & 0xFF)];
|
||||
C_SLOT_EQUIP(0, 2) = D_801C6A50[((void)0, gSaveContext.save.playerForm & 0xFF)];
|
||||
BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A48[((void)0, gSaveContext.save.playerForm & 0xFF)];
|
||||
C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A50[((void)0, gSaveContext.save.playerForm & 0xFF)];
|
||||
}
|
||||
|
||||
gSaveContext.save.hasTatl = true;
|
||||
|
||||
Reference in New Issue
Block a user