mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed kick attack not updating properly on game load with unarmed.ini
This commit is contained in:
+12
-17
@@ -79,7 +79,7 @@ private:
|
|||||||
HitsData hit[Hits::count];
|
HitsData hit[Hits::count];
|
||||||
|
|
||||||
long skillLevel; // SKILL_UNARMED_COMBAT
|
long skillLevel; // SKILL_UNARMED_COMBAT
|
||||||
long psStat[fo::Stat::STAT_base_count];
|
long pcStat[fo::Stat::STAT_base_count];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Types{
|
class Types{
|
||||||
@@ -231,12 +231,12 @@ public:
|
|||||||
void GetDudeStats(long sLevel) {
|
void GetDudeStats(long sLevel) {
|
||||||
skillLevel = sLevel;
|
skillLevel = sLevel;
|
||||||
for (size_t stat = 0; stat < fo::Stat::STAT_base_count; stat++) {
|
for (size_t stat = 0; stat < fo::Stat::STAT_base_count; stat++) {
|
||||||
psStat[stat] = fo::func::stat_level(*fo::ptr::obj_dude, stat);
|
pcStat[stat] = fo::func::stat_level(*fo::ptr::obj_dude, stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long SkillLevel() { return skillLevel; }
|
long SkillLevel() { return skillLevel; }
|
||||||
long DudeStat(long stat) { return psStat[stat]; }
|
long DudeStat(long stat) { return pcStat[stat]; }
|
||||||
};
|
};
|
||||||
|
|
||||||
Hits unarmed;
|
Hits unarmed;
|
||||||
@@ -273,6 +273,7 @@ static void __fastcall check_unarmed_left_slot(long skillLevel) {
|
|||||||
static __declspec(naked) void intface_update_items_hack_punch() {
|
static __declspec(naked) void intface_update_items_hack_punch() {
|
||||||
__asm {
|
__asm {
|
||||||
push 0x45F1D7;
|
push 0x45F1D7;
|
||||||
|
mov ecx, eax; // unarmed skill level
|
||||||
jmp check_unarmed_left_slot;
|
jmp check_unarmed_left_slot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,7 +287,9 @@ static fo::AttackType GetKickingHit(bool isPrimary) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Kick hits
|
// Kick hits
|
||||||
static void check_unarmed_right_slot() {
|
static void __fastcall check_unarmed_right_slot(long skillLevel) {
|
||||||
|
unarmed.GetDudeStats(skillLevel);
|
||||||
|
|
||||||
fo::ptr::itemButtonItems[fo::HandSlot::Right].primaryAttack = GetKickingHit(true);
|
fo::ptr::itemButtonItems[fo::HandSlot::Right].primaryAttack = GetKickingHit(true);
|
||||||
fo::ptr::itemButtonItems[fo::HandSlot::Right].secondaryAttack = GetKickingHit(false);
|
fo::ptr::itemButtonItems[fo::HandSlot::Right].secondaryAttack = GetKickingHit(false);
|
||||||
}
|
}
|
||||||
@@ -294,6 +297,7 @@ static void check_unarmed_right_slot() {
|
|||||||
static __declspec(naked) void intface_update_items_hack_kick() {
|
static __declspec(naked) void intface_update_items_hack_kick() {
|
||||||
__asm {
|
__asm {
|
||||||
push 0x45F380;
|
push 0x45F380;
|
||||||
|
mov ecx, eax; // unarmed skill level
|
||||||
jmp check_unarmed_right_slot;
|
jmp check_unarmed_right_slot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -365,16 +369,6 @@ const char* Unarmed::GetName(fo::AttackType hit) {
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static fo::AttackType GetPunchingHit() {
|
|
||||||
unarmed.GetDudeStats(fo::func::skill_level(*fo::ptr::obj_dude, fo::Skill::SKILL_UNARMED_COMBAT));
|
|
||||||
return GetPunchingHit(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static fo::AttackType GetKickingHit() {
|
|
||||||
//unarmed.GetDudeStats(fo::func::skill_level(*fo::ptr::obj_dude, fo::Skill::SKILL_UNARMED_COMBAT));
|
|
||||||
return GetKickingHit(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SlotsStoreCurrentHitMode() {
|
static void SlotsStoreCurrentHitMode() {
|
||||||
slotHitData[fo::HandSlot::Left].primaryHit = fo::util::GetHandSlotPrimaryAttack(fo::HandSlot::Left);
|
slotHitData[fo::HandSlot::Left].primaryHit = fo::util::GetHandSlotPrimaryAttack(fo::HandSlot::Left);
|
||||||
slotHitData[fo::HandSlot::Left].secondaryHit = fo::util::GetHandSlotSecondaryAttack(fo::HandSlot::Left);
|
slotHitData[fo::HandSlot::Left].secondaryHit = fo::util::GetHandSlotSecondaryAttack(fo::HandSlot::Left);
|
||||||
@@ -400,7 +394,8 @@ fo::AttackType Unarmed::GetStoredHitMode(fo::HandSlot slot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hit < fo::AttackType::ATKTYPE_STRONGPUNCH && hit != fo::AttackType::ATKTYPE_PUNCH && hit != fo::AttackType::ATKTYPE_KICK) {
|
if (hit < fo::AttackType::ATKTYPE_STRONGPUNCH && hit != fo::AttackType::ATKTYPE_PUNCH && hit != fo::AttackType::ATKTYPE_KICK) {
|
||||||
hit = (slot == fo::HandSlot::Left) ? GetPunchingHit() : GetKickingHit(); // get Primary
|
unarmed.GetDudeStats(fo::func::skill_level(*fo::ptr::obj_dude, fo::Skill::SKILL_UNARMED_COMBAT));
|
||||||
|
hit = (slot == fo::HandSlot::Left) ? GetPunchingHit(true) : GetKickingHit(true); // get Primary
|
||||||
|
|
||||||
slotHitData[slot].primaryHit = hit;
|
slotHitData[slot].primaryHit = hit;
|
||||||
slotHitData[slot].mode = fo::HandSlotMode::Primary;
|
slotHitData[slot].mode = fo::HandSlotMode::Primary;
|
||||||
@@ -483,8 +478,8 @@ void Unarmed::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only if a custom file is used, otherwise use the engine function code
|
// Only if a custom file is used, otherwise use the engine function code
|
||||||
MakeJump(0x45F0DF, intface_update_items_hack_punch);
|
MakeJump(0x45F0D8, intface_update_items_hack_punch);
|
||||||
MakeJump(0x45F278, intface_update_items_hack_kick);
|
MakeJump(0x45F27D, intface_update_items_hack_kick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unarmed.Sort();
|
unarmed.Sort();
|
||||||
|
|||||||
Reference in New Issue
Block a user