mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-31 01:15:20 -04:00
z_parameter: Main (#1157)
* main docs * formatting and bss issues * PR Suggestions * missed enums * better macros/enums * restrictions improvement, still wip * fix name, more common restriction patterns * more restrictions cleanup * rm comment
This commit is contained in:
+18
-16
@@ -7,12 +7,13 @@ void Setup_SetRegs(void) {
|
||||
XREG(11) = 0x14;
|
||||
XREG(12) = 0xE;
|
||||
XREG(13) = 0;
|
||||
XREG(31) = 0;
|
||||
R_A_BTN_Y_OFFSET = 0;
|
||||
R_MAGIC_CONSUME_TIMER_GIANTS_MASK = 80;
|
||||
XREG(43) = 0xFC54;
|
||||
|
||||
XREG(44) = 0xD7;
|
||||
XREG(45) = 0xDA;
|
||||
R_THREE_DAY_CLOCK_Y_POS = 64596;
|
||||
R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF = 215;
|
||||
R_THREE_DAY_CLOCK_HOUR_DIGIT_CUTOFF = 218;
|
||||
|
||||
XREG(68) = 0x61;
|
||||
XREG(69) = 0x93;
|
||||
XREG(70) = 0x28;
|
||||
@@ -27,22 +28,23 @@ void Setup_SetRegs(void) {
|
||||
XREG(88) = 0x56;
|
||||
XREG(89) = 0x258;
|
||||
XREG(90) = 0x1C2;
|
||||
|
||||
R_STORY_FILL_SCREEN_ALPHA = 0;
|
||||
R_REVERSE_FLOOR_INDEX = 0;
|
||||
R_MINIMAP_DISABLED = false;
|
||||
|
||||
YREG(32) = 0x50;
|
||||
YREG(33) = 0x3C;
|
||||
YREG(34) = 0xDC;
|
||||
YREG(35) = 0x3C;
|
||||
YREG(36) = 0x50;
|
||||
YREG(37) = 0xA0;
|
||||
YREG(38) = 0xDC;
|
||||
YREG(39) = 0xA0;
|
||||
YREG(40) = 0x8E;
|
||||
YREG(41) = 0x6C;
|
||||
YREG(42) = 0xCC;
|
||||
YREG(43) = 0xB1;
|
||||
R_PICTO_FOCUS_BORDER_TOPLEFT_X = 80;
|
||||
R_PICTO_FOCUS_BORDER_TOPLEFT_Y = 60;
|
||||
R_PICTO_FOCUS_BORDER_TOPRIGHT_X = 220;
|
||||
R_PICTO_FOCUS_BORDER_TOPRIGHT_Y = 60;
|
||||
R_PICTO_FOCUS_BORDER_BOTTOMLEFT_X = 80;
|
||||
R_PICTO_FOCUS_BORDER_BOTTOMLEFT_Y = 160;
|
||||
R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_X = 220;
|
||||
R_PICTO_FOCUS_BORDER_BOTTOMRIGHT_Y = 160;
|
||||
R_PICTO_FOCUS_ICON_X = 142;
|
||||
R_PICTO_FOCUS_ICON_Y = 108;
|
||||
R_PICTO_FOCUS_TEXT_X = 204;
|
||||
R_PICTO_FOCUS_TEXT_Y = 177;
|
||||
}
|
||||
|
||||
void Setup_InitImpl(SetupState* this) {
|
||||
|
||||
@@ -98,7 +98,7 @@ void KaleidoSetup_Update(PlayState* play) {
|
||||
(gSaveContext.magicState != MAGIC_STATE_FILL)) {
|
||||
if (!CHECK_EVENTINF(EVENTINF_17) && !(player->stateFlags1 & PLAYER_STATE1_20)) {
|
||||
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
|
||||
!(play->actorCtx.flags & ACTORCTX_FLAG_2)) {
|
||||
!(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) {
|
||||
if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) {
|
||||
gSaveContext.prevHudVisibility = gSaveContext.hudVisibility;
|
||||
pauseCtx->itemDescriptionOn = false;
|
||||
|
||||
+15
-10
@@ -36,7 +36,7 @@ TexturePtr HeartDDTextures[] = {
|
||||
void LifeMeter_Init(PlayState* play) {
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
|
||||
interfaceCtx->unkTimer = 320;
|
||||
interfaceCtx->healthTimer = 320;
|
||||
|
||||
interfaceCtx->health = gSaveContext.save.playerData.health;
|
||||
|
||||
@@ -167,39 +167,44 @@ void LifeMeter_UpdateColors(PlayState* play) {
|
||||
sBeatingHeartsDDEnv[2] = (u8)(bFactor + 0) & 0xFF;
|
||||
}
|
||||
|
||||
// Unused
|
||||
s32 LifeMeter_SaveInterfaceHealth(PlayState* play) {
|
||||
gSaveContext.save.playerData.health = play->interfaceCtx.health;
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
|
||||
gSaveContext.save.playerData.health = interfaceCtx->health;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Unused
|
||||
s32 LifeMeter_IncreaseInterfaceHealth(PlayState* play) {
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
|
||||
interfaceCtx->unkTimer = 320;
|
||||
interfaceCtx->healthTimer = 320;
|
||||
interfaceCtx->health += 0x10;
|
||||
if (play->interfaceCtx.health >= gSaveContext.save.playerData.health) {
|
||||
play->interfaceCtx.health = gSaveContext.save.playerData.health;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Unused
|
||||
s32 LifeMeter_DecreaseInterfaceHealth(PlayState* play) {
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
|
||||
if (interfaceCtx->unkTimer != 0) {
|
||||
interfaceCtx->unkTimer--;
|
||||
if (interfaceCtx->healthTimer != 0) {
|
||||
interfaceCtx->healthTimer--;
|
||||
} else {
|
||||
interfaceCtx->unkTimer = 320;
|
||||
interfaceCtx->healthTimer = 320;
|
||||
interfaceCtx->health -= 0x10;
|
||||
if (interfaceCtx->health <= 0) {
|
||||
interfaceCtx->health = 0;
|
||||
play->damagePlayer(play, -(((void)0, gSaveContext.save.playerData.health) + 1));
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
void LifeMeter_Draw(PlayState* play) {
|
||||
|
||||
@@ -322,9 +322,9 @@ void func_80151938(PlayState* play, u16 textId) {
|
||||
|
||||
if (interfaceCtx->unk_222 == 0) {
|
||||
if (textId != 0x1B93) {
|
||||
func_8011552C(play, 0x10);
|
||||
func_8011552C(play, DO_ACTION_NEXT);
|
||||
} else if (textId != 0xF8) {
|
||||
func_8011552C(play, 6);
|
||||
func_8011552C(play, DO_ACTION_DECIDE);
|
||||
}
|
||||
}
|
||||
msgCtx->unk1203C = msgCtx->unk1203A;
|
||||
|
||||
+1282
-185
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -39,9 +39,9 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Destroy.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801663C4.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CompressI8ToI5.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80166644.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_DecompressI5ToI8.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801668B4.s")
|
||||
|
||||
|
||||
+24
-26
@@ -1,4 +1,3 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
@@ -543,15 +542,15 @@ ItemId func_8012364C(PlayState* play, Player* player, s32 arg2) {
|
||||
return item;
|
||||
}
|
||||
|
||||
if ((player->currentMask == PLAYER_MASK_BLAST) && (play->interfaceCtx.bButtonDoAction == 0x18)) {
|
||||
if ((player->currentMask == PLAYER_MASK_BLAST) && (play->interfaceCtx.bButtonDoAction == DO_ACTION_EXPLODE)) {
|
||||
return ITEM_F0;
|
||||
}
|
||||
|
||||
if ((player->currentMask == PLAYER_MASK_BREMEN) && (play->interfaceCtx.bButtonDoAction == 0x1A)) {
|
||||
if ((player->currentMask == PLAYER_MASK_BREMEN) && (play->interfaceCtx.bButtonDoAction == DO_ACTION_MARCH)) {
|
||||
return ITEM_F1;
|
||||
}
|
||||
|
||||
if ((player->currentMask == PLAYER_MASK_KAMARO) && (play->interfaceCtx.bButtonDoAction == 0x19)) {
|
||||
if ((player->currentMask == PLAYER_MASK_KAMARO) && (play->interfaceCtx.bButtonDoAction == DO_ACTION_DANCE)) {
|
||||
return ITEM_F2;
|
||||
}
|
||||
|
||||
@@ -725,17 +724,17 @@ u8 sPlayerStrengths[PLAYER_FORM_MAX] = {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 flag;
|
||||
/* 0x02 */ u16 textId;
|
||||
} TextTriggerEntry; // size = 0x04
|
||||
/* 0x0 */ u8 flag;
|
||||
/* 0x2 */ u16 textId;
|
||||
} EnvHazardTextTriggerEntry; // size = 0x4
|
||||
|
||||
// These textIds are OoT remnants. The corresponding text entries are not present in this game, and so these don't point
|
||||
// to anything relevant.
|
||||
TextTriggerEntry sEnvironmentTextTriggers[] = {
|
||||
{ 1, 0x26FC },
|
||||
{ 2, 0x26FD },
|
||||
{ 0, 0 },
|
||||
{ 2, 0x26FD },
|
||||
EnvHazardTextTriggerEntry sEnvHazardTextTriggers[] = {
|
||||
{ ENV_HAZARD_TEXT_TRIGGER_HOTROOM, 0x26FC }, // PLAYER_ENV_HAZARD_HOTROOM - 1
|
||||
{ ENV_HAZARD_TEXT_TRIGGER_UNDERWATER, 0x26FD }, // PLAYER_ENV_HAZARD_UNDERWATER_FLOOR - 1
|
||||
{ 0, 0 }, // PLAYER_ENV_HAZARD_SWIMMING - 1
|
||||
{ ENV_HAZARD_TEXT_TRIGGER_UNDERWATER, 0x26FD }, // PLAYER_ENV_HAZARD_UNDERWATER_FREE - 1
|
||||
};
|
||||
|
||||
PlayerModelIndices gPlayerModelTypes[PLAYER_MODELGROUP_MAX] = {
|
||||
@@ -1451,37 +1450,36 @@ s32 func_801242B4(Player* player) {
|
||||
return (player->stateFlags1 & PLAYER_STATE1_8000000) && (player->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER);
|
||||
}
|
||||
|
||||
s32 Player_GetEnvTimerType(PlayState* play) {
|
||||
s32 Player_GetEnvironmentalHazard(PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
TextTriggerEntry* triggerEntry;
|
||||
s32 envTimerType;
|
||||
EnvHazardTextTriggerEntry* triggerEntry;
|
||||
s32 envHazard;
|
||||
|
||||
if (play->roomCtx.curRoom.unk2 == 3) { // Room is hot
|
||||
envTimerType = PLAYER_ENV_TIMER_HOTROOM - 1;
|
||||
envHazard = PLAYER_ENV_HAZARD_HOTROOM - 1;
|
||||
} else if ((player->transformation != PLAYER_FORM_ZORA) && (player->underwaterTimer > 80)) {
|
||||
envTimerType = PLAYER_ENV_TIMER_UNDERWATER_FREE - 1;
|
||||
envHazard = PLAYER_ENV_HAZARD_UNDERWATER_FREE - 1;
|
||||
} else if (player->stateFlags1 & PLAYER_STATE1_8000000) {
|
||||
if ((player->transformation == PLAYER_FORM_ZORA) && (player->currentBoots >= PLAYER_BOOTS_ZORA_UNDERWATER) &&
|
||||
(player->actor.bgCheckFlags & 1)) {
|
||||
envTimerType = PLAYER_ENV_TIMER_UNDERWATER_FLOOR - 1;
|
||||
envHazard = PLAYER_ENV_HAZARD_UNDERWATER_FLOOR - 1;
|
||||
} else {
|
||||
envTimerType = PLAYER_ENV_TIMER_SWIMMING - 1;
|
||||
envHazard = PLAYER_ENV_HAZARD_SWIMMING - 1;
|
||||
}
|
||||
} else {
|
||||
return PLAYER_ENV_TIMER_NONE;
|
||||
return PLAYER_ENV_HAZARD_NONE;
|
||||
}
|
||||
|
||||
// Trigger general textboxes under certain conditions, like "It's so hot in here!". Unused in MM
|
||||
triggerEntry = &sEnvironmentTextTriggers[envTimerType];
|
||||
triggerEntry = &sEnvHazardTextTriggers[envHazard];
|
||||
if (!Player_InCsMode(play)) {
|
||||
if ((triggerEntry->flag) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) &&
|
||||
(envTimerType == (PLAYER_ENV_TIMER_HOTROOM - 1))) {
|
||||
if ((triggerEntry->flag) && !(gSaveContext.envHazardTextTriggerFlags & triggerEntry->flag) &&
|
||||
(envHazard == (PLAYER_ENV_HAZARD_HOTROOM - 1))) {
|
||||
Message_StartTextbox(play, triggerEntry->textId, NULL);
|
||||
gSaveContext.textTriggerFlags |= triggerEntry->flag;
|
||||
gSaveContext.envHazardTextTriggerFlags |= triggerEntry->flag;
|
||||
}
|
||||
}
|
||||
|
||||
return envTimerType + 1;
|
||||
return envHazard + 1;
|
||||
}
|
||||
|
||||
void func_80124420(Player* player);
|
||||
|
||||
@@ -468,10 +468,10 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
||||
|
||||
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;
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_GILDED;
|
||||
SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_GILDED);
|
||||
} else {
|
||||
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI;
|
||||
CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI;
|
||||
}
|
||||
} else {
|
||||
if ((STOLEN_ITEM_1 >= ITEM_SWORD_GILDED) || (STOLEN_ITEM_2 >= ITEM_SWORD_GILDED)) {
|
||||
|
||||
Reference in New Issue
Block a user