mirror of https://github.com/PrimeDecomp/prime.git
parent
11ffb47af0
commit
2638a5a81a
2
Makefile
2
Makefile
|
@ -119,7 +119,7 @@ DEFINES = -DPRIME1 -DVERSION=$(VERSION_NUM) -DNONMATCHING=$(NONMATCHING)
|
||||||
CFLAGS_BASE = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp hard -fp_contract on -O4,p -maxerrors 1 -enum int -inline auto -str reuse -nosyspath -MMD $(DEFINES) $(INCLUDES)
|
CFLAGS_BASE = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp hard -fp_contract on -O4,p -maxerrors 1 -enum int -inline auto -str reuse -nosyspath -MMD $(DEFINES) $(INCLUDES)
|
||||||
CFLAGS = $(CFLAGS_BASE) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,noauto -common on
|
CFLAGS = $(CFLAGS_BASE) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,noauto -common on
|
||||||
CFLAGS_RUNTIME = $(CFLAGS_BASE) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,auto
|
CFLAGS_RUNTIME = $(CFLAGS_BASE) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,auto
|
||||||
CFLAGS_MUSYX = $(CFLAGS_BASE) -str reuse,pool,readonly
|
CFLAGS_MUSYX = $(CFLAGS_BASE) -fp hard -fp_contract off -str reuse,pool,readonly
|
||||||
|
|
||||||
ifeq ($(VERBOSE),0)
|
ifeq ($(VERBOSE),0)
|
||||||
# this set of ASFLAGS generates no warnings.
|
# this set of ASFLAGS generates no warnings.
|
||||||
|
|
|
@ -158,6 +158,21 @@ private:
|
||||||
int x4_capacity;
|
int x4_capacity;
|
||||||
CPowerUp() : x0_amount(0), x4_capacity(0) {}
|
CPowerUp() : x0_amount(0), x4_capacity(0) {}
|
||||||
CPowerUp(int amount, int capacity);
|
CPowerUp(int amount, int capacity);
|
||||||
|
|
||||||
|
void Add(int amount) {
|
||||||
|
int capacity = x4_capacity;
|
||||||
|
x0_amount += amount;
|
||||||
|
if (x0_amount > capacity) {
|
||||||
|
x0_amount = capacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dec(int amount) {
|
||||||
|
x0_amount -= amount;
|
||||||
|
if (x0_amount < 0) {
|
||||||
|
x0_amount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool x0_24_alive : 1;
|
bool x0_24_alive : 1;
|
||||||
|
|
|
@ -27,6 +27,13 @@ static const float kComboAmmoPeriods[] = {
|
||||||
0.2f, 0.1f, 0.2f, 0.2f, 1.f,
|
0.2f, 0.1f, 0.2f, 0.2f, 1.f,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char* kVisorNames[] = {
|
||||||
|
"CombatVisor",
|
||||||
|
"XRayVisor",
|
||||||
|
"ScanVisor",
|
||||||
|
"ThermalVisor",
|
||||||
|
};
|
||||||
|
|
||||||
static const float kEnergyTankCapacity = 100.f;
|
static const float kEnergyTankCapacity = 100.f;
|
||||||
static const float kBaseHealthCapacity = 99.f;
|
static const float kBaseHealthCapacity = 99.f;
|
||||||
|
|
||||||
|
@ -151,11 +158,11 @@ void CPlayerState::ReInitializePowerUp(CPlayerState::EItemType type, int capacit
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayerState::InitializePowerUp(CPlayerState::EItemType type, int capacity) {
|
void CPlayerState::InitializePowerUp(CPlayerState::EItemType type, int capacity) {
|
||||||
if (type >= kIT_Max)
|
if (type < kIT_PowerBeam || type > kIT_Max - 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CPowerUp& pup = x24_powerups[u32(type)];
|
CPowerUp& pup = x24_powerups[u32(type)];
|
||||||
pup.x4_capacity = CMath::Clamp(0, pup.x4_capacity + capacity, kPowerUpMax[u32(type)]);
|
pup.x4_capacity = CMath::Clamp(0, capacity + pup.x4_capacity, kPowerUpMax[u32(type)]);
|
||||||
pup.x0_amount = rstl::min_val(pup.x0_amount, pup.x4_capacity);
|
pup.x0_amount = rstl::min_val(pup.x0_amount, pup.x4_capacity);
|
||||||
if (type >= kIT_PowerSuit && type <= kIT_PhazonSuit) {
|
if (type >= kIT_PowerSuit && type <= kIT_PhazonSuit) {
|
||||||
if (HasPowerUp(kIT_PhazonSuit))
|
if (HasPowerUp(kIT_PhazonSuit))
|
||||||
|
@ -202,11 +209,7 @@ void CPlayerState::IncrPickUp(EItemType type, int amount) {
|
||||||
case kIT_World:
|
case kIT_World:
|
||||||
case kIT_Spirit:
|
case kIT_Spirit:
|
||||||
case kIT_Newborn: {
|
case kIT_Newborn: {
|
||||||
int oldCapacity = x24_powerups[type].x4_capacity;
|
x24_powerups[type].Add(amount);
|
||||||
x24_powerups[type].x0_amount += amount;
|
|
||||||
if (oldCapacity < x24_powerups[type].x0_amount) {
|
|
||||||
x24_powerups[type].x0_amount = oldCapacity;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kIT_HealthRefill: {
|
case kIT_HealthRefill: {
|
||||||
|
@ -214,10 +217,10 @@ void CPlayerState::IncrPickUp(EItemType type, int amount) {
|
||||||
if (info != NULL) {
|
if (info != NULL) {
|
||||||
float newHealth = float(amount) + info->GetHP();
|
float newHealth = float(amount) + info->GetHP();
|
||||||
float maxHealth = CalculateHealth();
|
float maxHealth = CalculateHealth();
|
||||||
if (newHealth <= newHealth) {
|
if (newHealth > maxHealth) {
|
||||||
info->SetHP(newHealth);
|
|
||||||
} else {
|
|
||||||
info->SetHP(maxHealth);
|
info->SetHP(maxHealth);
|
||||||
|
} else {
|
||||||
|
info->SetHP(newHealth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,10 +239,7 @@ void CPlayerState::DecrPickUp(CPlayerState::EItemType type, int amount) {
|
||||||
case kIT_Missiles:
|
case kIT_Missiles:
|
||||||
case kIT_PowerBombs:
|
case kIT_PowerBombs:
|
||||||
case kIT_Flamethrower:
|
case kIT_Flamethrower:
|
||||||
x24_powerups[type].x0_amount -= amount;
|
x24_powerups[type].Dec(amount);
|
||||||
if (x24_powerups[type].x0_amount < 0) {
|
|
||||||
x24_powerups[type].x0_amount = 0;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ bool CPlayerState::HasPowerUp(CPlayerState::EItemType type) const {
|
||||||
if (type < 0 || kIT_Max - 1 < type) {
|
if (type < 0 || kIT_Max - 1 < type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return x24_powerups[u32(type)].x4_capacity != 0;
|
return x24_powerups[u32(type)].x4_capacity > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint CPlayerState::GetPowerUp(CPlayerState::EItemType type) {
|
uint CPlayerState::GetPowerUp(CPlayerState::EItemType type) {
|
||||||
|
@ -312,7 +312,7 @@ bool CPlayerState::ItemEnabled(CPlayerState::EItemType type) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayerState::ResetVisor() {
|
void CPlayerState::ResetVisor() {
|
||||||
x18_transitioningVisor = x14_currentVisor = kPV_Combat;
|
x14_currentVisor = x18_transitioningVisor = kPV_Combat;
|
||||||
x1c_visorTransitionFactor = 0.0f;
|
x1c_visorTransitionFactor = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,16 +327,13 @@ void CPlayerState::UpdateVisorTransition(float dt) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (x14_currentVisor == x18_transitioningVisor) {
|
if (x14_currentVisor == x18_transitioningVisor) {
|
||||||
x1c_visorTransitionFactor += dt;
|
x1c_visorTransitionFactor = rstl::min_val(0.2f, x1c_visorTransitionFactor + dt);
|
||||||
if (x1c_visorTransitionFactor > 0.2f)
|
|
||||||
x1c_visorTransitionFactor = 0.2f;
|
|
||||||
} else {
|
} else {
|
||||||
x1c_visorTransitionFactor -= dt;
|
x1c_visorTransitionFactor -= dt;
|
||||||
if (x1c_visorTransitionFactor < 0.f) {
|
if (x1c_visorTransitionFactor < 0.f) {
|
||||||
x14_currentVisor = x18_transitioningVisor;
|
x14_currentVisor = x18_transitioningVisor;
|
||||||
x1c_visorTransitionFactor = fabs(x1c_visorTransitionFactor);
|
x1c_visorTransitionFactor = fabs(x1c_visorTransitionFactor);
|
||||||
if (x1c_visorTransitionFactor > 0.19999f)
|
x1c_visorTransitionFactor = rstl::min_val(x1c_visorTransitionFactor, 0.19999f);
|
||||||
x1c_visorTransitionFactor = 0.19999f;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue