summaryrefslogtreecommitdiff
path: root/src/code/z_lifemeter.c
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2022-03-27 12:37:02 -0300
committerGitHub <noreply@github.com>2022-03-27 12:37:02 -0300
commitb08880f7a7fdc49ca104fb86f5ffd4fd4a2aa221 (patch)
tree3df6602257885241d98926363a3076b797744fb3 /src/code/z_lifemeter.c
parent95c6ddbcc89992b527f270e80d1e2397b146a2ff (diff)
`z_sram_NES` with 2 NON_MATCHINGs and 1 NON_EQUIVALENTs (#531)
* Rename Sram_InitDebugSave * Sram_InitDebugSave * err * Sram_IncrementDay * non_matchings * func_80146F5C and protos * func_80146EE8 * func_80145698 * func_80143A54 * Split SaveContext * problems with bss * Fix bss * more * a small bunch * Fix warnings * almost everything * two attempts * at least compiles * import data * bss * format * stuff? * Progress? * More progress * clean up data a little * More progress * disaster * re split data * A bit less of a disaster * Fix renamed stuff * data stuff * fix conflicts * format * CycleSceneFlags * some enums * cleanup * Fix merge issues * format * some changes * format * Lots of progress on z_sram_NES, but no matches yet * SaveContent Documentation * Oops * Oops2 * Document more SaveContext * Oops, don't need that anymore * add small comment * Another comment * dekuPlaygroundPlayerName * Fix merge issues * format * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * remove magic number * format * fix merge issues * bss * format * macro cleanup * review * merge issues * review * cleanup * UNK_TYPE1 * Fix * Remove comment * small change * conflicts * review * fix * fixes * format * Update actorCtx renames part * Match func_80143B0C thanks to Petrie and Anon * minor cleaning pass * format * cleanup * more minor cleanups * Macros for accessing gSaveContext.save.stolenItems * Introduce STOLEN_ITEM_NONE and remove CLEAR_STOLEN_ITEM_ * format * Update include/macros.h Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Update src/code/z_sram_NES.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * @hensldm review * Update include/functions.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update include/functions.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Rename QUEST_SONG_NEW_WAVE * Add scene name comments to D_801C5FC0 * rename horseData.yaw * Update include/functions.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_sram_NES.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * // = CUR_UPG_VALUE(UPG_WALLET); * run actorfixer and format * fix bss * Fix merge problems and run format * Some improvements to func_801457CC by anon * bss * format * run actorfixer * actorfixer, bss and format * Use original names for the RESPAWN_MODE enum because the current ones are bad * QUEST_SONG_BOSSA_NOVA * some minor fixes on the SaveContext struct according to the debug rom * Merge Inventory.items and Inventory.masks * a * simplify saveBuf accesses * A few func renames * actorfixer * bss * fixes * bss * actorfixer * actorfixer and format * actorfixer * whoops * whops * bss Co-authored-by: engineer124 <engineer124engineer124@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
Diffstat (limited to 'src/code/z_lifemeter.c')
-rw-r--r--src/code/z_lifemeter.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c
index 703b966de..d89b427e9 100644
--- a/src/code/z_lifemeter.c
+++ b/src/code/z_lifemeter.c
@@ -38,7 +38,7 @@ void LifeMeter_Init(GlobalContext* globalCtx) {
interfaceCtx->unkTimer = 320;
- interfaceCtx->health = gSaveContext.health;
+ interfaceCtx->health = gSaveContext.save.playerData.health;
interfaceCtx->lifeColorChange = 0;
interfaceCtx->lifeColorChangeDirection = 0;
@@ -168,7 +168,7 @@ void LifeMeter_UpdateColors(GlobalContext* globalCtx) {
}
s32 LifeMeter_SaveInterfaceHealth(GlobalContext* globalCtx) {
- gSaveContext.health = globalCtx->interfaceCtx.health;
+ gSaveContext.save.playerData.health = globalCtx->interfaceCtx.health;
return 1;
}
@@ -178,8 +178,8 @@ s32 LifeMeter_IncreaseInterfaceHealth(GlobalContext* globalCtx) {
interfaceCtx->unkTimer = 320;
interfaceCtx->health += 0x10;
- if (globalCtx->interfaceCtx.health >= gSaveContext.health) {
- globalCtx->interfaceCtx.health = gSaveContext.health;
+ if (globalCtx->interfaceCtx.health >= gSaveContext.save.playerData.health) {
+ globalCtx->interfaceCtx.health = gSaveContext.save.playerData.health;
return 1;
}
return 0;
@@ -195,7 +195,7 @@ s32 LifeMeter_DecreaseInterfaceHealth(GlobalContext* globalCtx) {
interfaceCtx->health -= 0x10;
if (interfaceCtx->health <= 0) {
interfaceCtx->health = 0;
- globalCtx->damagePlayer(globalCtx, -(((void)0, gSaveContext.health) + 1));
+ globalCtx->damagePlayer(globalCtx, -(((void)0, gSaveContext.save.playerData.health) + 1));
return 1;
}
}
@@ -216,18 +216,18 @@ void LifeMeter_Draw(GlobalContext* globalCtx) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
Vtx* beatingHeartVtx = interfaceCtx->beatingHeartVtx;
- s32 fractionHeartCount = gSaveContext.health % 0x10;
- s16 healthCapacity = gSaveContext.healthCapacity / 0x10;
- s16 fullHeartCount = gSaveContext.health / 0x10;
+ s32 fractionHeartCount = gSaveContext.save.playerData.health % 0x10;
+ s16 healthCapacity = gSaveContext.save.playerData.healthCapacity / 0x10;
+ s16 fullHeartCount = gSaveContext.save.playerData.health / 0x10;
s32 pad2;
f32 lifesize = interfaceCtx->lifeSizeChange * 0.1f;
u32 curCombineModeSet = 0;
TexturePtr temp = NULL;
- s32 ddCount = gSaveContext.inventory.dungeonKeys[9] - 1;
+ s32 ddCount = gSaveContext.save.inventory.dungeonKeys[9] - 1;
OPEN_DISPS(gfxCtx);
- if ((gSaveContext.health % 0x10) == 0) {
+ if ((gSaveContext.save.playerData.health % 0x10) == 0) {
fullHeartCount--;
}
offsetY = 0.0f;
@@ -417,19 +417,19 @@ void LifeMeter_UpdateSizeAndBeep(GlobalContext* globalCtx) {
u32 LifeMeter_IsCritical(void) {
s16 criticalThreshold;
- if (gSaveContext.healthCapacity <= 80) { // healthCapacity <= 5 hearts?
+ if (gSaveContext.save.playerData.healthCapacity <= 80) { // healthCapacity <= 5 hearts?
criticalThreshold = 16;
- } else if (gSaveContext.healthCapacity <= 160) { // healthCapacity <= 10 hearts?
+ } else if (gSaveContext.save.playerData.healthCapacity <= 160) { // healthCapacity <= 10 hearts?
criticalThreshold = 24;
- } else if (gSaveContext.healthCapacity <= 240) { // healthCapacity <= 15 hearts?
+ } else if (gSaveContext.save.playerData.healthCapacity <= 240) { // healthCapacity <= 15 hearts?
criticalThreshold = 32;
} else {
criticalThreshold = 44;
}
- if ((criticalThreshold >= gSaveContext.health) && (gSaveContext.health > 0)) {
+ if ((criticalThreshold >= gSaveContext.save.playerData.health) && (gSaveContext.save.playerData.health > 0)) {
return true;
}
return false;