mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 14:23:44 -07:00
Add mod logic
This commit is contained in:
parent
95da124497
commit
ec66987365
1 changed files with 71 additions and 7 deletions
|
@ -317,6 +317,32 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
|
|||
|
||||
OPEN_DISPS(gfxCtx, "../z_lifemeter.c", 353);
|
||||
|
||||
if (CVar_GetS32("gForceMaxHeartCount", 0)) {
|
||||
MaxHeartsCount = CVar_GetS32("gMaxHeartCount", gSaveContext.healthCapacity)*16; //16 is what a full heart is
|
||||
if (MaxHeartsCount < 4) { //1/4 of an heart.
|
||||
MaxHeartsCount = 16; //prevent some glitch like infinite breath.
|
||||
HealthNow = 4;
|
||||
}
|
||||
if (MaxHeartsCount > gSaveContext.healthCapacity) {
|
||||
MaxHeartsCount = gSaveContext.healthCapacity;
|
||||
}
|
||||
if (HealthNow > MaxHeartsCount) {
|
||||
HealthNow = MaxHeartsCount;
|
||||
gSaveContext.health = HealthNow;
|
||||
}
|
||||
curHeartFraction = HealthNow % 0x10;
|
||||
totalHeartCount = MaxHeartsCount / 0x10;
|
||||
fullHeartCount = HealthNow / 0x10;
|
||||
} else {
|
||||
MaxHeartsCount = gSaveContext.healthCapacity;
|
||||
if (HealthNow > MaxHeartsCount) {
|
||||
HealthNow = MaxHeartsCount;
|
||||
}
|
||||
curHeartFraction = HealthNow % 0x10;
|
||||
totalHeartCount = MaxHeartsCount / 0x10;
|
||||
fullHeartCount = HealthNow / 0x10;
|
||||
}
|
||||
|
||||
if (!(gSaveContext.health % 0x10)) {
|
||||
fullHeartCount--;
|
||||
}
|
||||
|
@ -514,16 +540,54 @@ void HealthMeter_HandleCriticalAlarm(GlobalContext* globalCtx) {
|
|||
|
||||
u32 HealthMeter_IsCritical(void) {
|
||||
s32 var;
|
||||
s16 MaxHeartsCount = gSaveContext.healthCapacity;
|
||||
s16 HealthNow = gSaveContext.health;
|
||||
|
||||
if (gSaveContext.healthCapacity <= 0x50) {
|
||||
if (CVar_GetS32("gForceMaxHeartCount", 0)) {
|
||||
MaxHeartsCount = CVar_GetS32("gMaxHeartCount", gSaveContext.healthCapacity)*16; //16 is what a full heart is
|
||||
if (MaxHeartsCount < 4) { //1/4 of an heart.
|
||||
MaxHeartsCount = 16; //prevent some glitch like infinite breath.
|
||||
HealthNow = 4;
|
||||
}
|
||||
if (MaxHeartsCount > gSaveContext.healthCapacity) {
|
||||
MaxHeartsCount = gSaveContext.healthCapacity;
|
||||
}
|
||||
if (HealthNow > MaxHeartsCount) {
|
||||
HealthNow = MaxHeartsCount;
|
||||
gSaveContext.health = HealthNow;
|
||||
}
|
||||
} else {
|
||||
MaxHeartsCount = gSaveContext.healthCapacity;
|
||||
if (HealthNow > MaxHeartsCount) {
|
||||
HealthNow = MaxHeartsCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (MaxHeartsCount <= 0x50) {
|
||||
if (CVar_GetS32("gForceMaxHeartCount", 0)) {
|
||||
var = 0;
|
||||
} else {
|
||||
var = 0x10;
|
||||
} else if (gSaveContext.healthCapacity <= 0xA0) {
|
||||
}
|
||||
} else if (MaxHeartsCount <= 0xA0) {
|
||||
if (CVar_GetS32("gForceMaxHeartCount", 0)) {
|
||||
var = 0;
|
||||
} else {
|
||||
var = 0x18;
|
||||
} else if (gSaveContext.healthCapacity <= 0xF0) {
|
||||
}
|
||||
} else if (MaxHeartsCount <= 0xF0) {
|
||||
if (CVar_GetS32("gForceMaxHeartCount", 0)) {
|
||||
var = 0;
|
||||
} else {
|
||||
var = 0x20;
|
||||
}
|
||||
} else {
|
||||
if (CVar_GetS32("gForceMaxHeartCount", 0)) {
|
||||
var = 0;
|
||||
} else {
|
||||
var = 0x2C;
|
||||
}
|
||||
}
|
||||
|
||||
if ((var >= gSaveContext.health) && (gSaveContext.health > 0)) {
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue