Added the ability to set custom names for unarmed attacks

Updated Translations.ini template.
Commented out empty exit() in some modules.
This commit is contained in:
NovaRain
2021-09-27 10:37:28 +08:00
parent 2fe3ccd01d
commit debbda0b3b
12 changed files with 81 additions and 15 deletions
+18 -1
View File
@@ -4,7 +4,7 @@ KarmaGain=You gained %d karma.
KarmaLoss=You lost %d karma. KarmaLoss=You lost %d karma.
HighlightFail1=You aren't carrying a motion sensor. HighlightFail1=You aren't carrying a motion sensor.
HighlightFail2=Your motion sensor is out of charge. HighlightFail2=Your motion sensor is out of charge.
SuperStimExploitMsg=You cannot use a super stim on someone who is not injured! SuperStimExploitMsg=You cannot use this item on someone who is not injured!
BlockedCombat=You cannot enter combat at this time. BlockedCombat=You cannot enter combat at this time.
SaveSfallDataFail=ERROR saving extended savegame information! Check if other programs interfere with savegame files/folders and try again. SaveSfallDataFail=ERROR saving extended savegame information! Check if other programs interfere with savegame files/folders and try again.
PartyLvlMsg=Lvl: PartyLvlMsg=Lvl:
@@ -20,3 +20,20 @@ PartyOrderAttackRobot=::Beep::
RaceText=Race RaceText=Race
StyleText=Style StyleText=Style
DoneBtn=Done DoneBtn=Done
;Custom names for player's unarmed attacks (max 16 characters)
[Unarmed]
;Punch=Punch:
;Kick=Kick:
;StrongPunch=Strong Punch:
;HammerPunch=Hammer Punch:
;Haymaker=Haymaker:
;Jab=Jab:
;PalmStrike=Palm Strike:
;PiercingStrike=Piercing Strike:
;StrongKick=Strong Kick:
;SnapKick=Snap Kick:
;PowerKick=Power Kick:
;HipKick=Hip Kick:
;HookKick=Hook Kick:
;PiercingKick=Piercing kick:
+2 -2
View File
@@ -597,7 +597,7 @@ void Animations::init() {
MakeCall(0x419A17, art_alias_fid_hack); MakeCall(0x419A17, art_alias_fid_hack);
} }
void Animations::exit() { //void Animations::exit() {
} //}
} }
+1 -1
View File
@@ -27,7 +27,7 @@ class Animations : public Module {
public: public:
const char* name() { return "Animations"; } const char* name() { return "Animations"; }
void init(); void init();
void exit() override; //void exit() override;
}; };
} }
+15 -2
View File
@@ -384,7 +384,8 @@ static void __declspec(naked) DisplayBonusHtHDmg1_hook() {
jmp fo::funcoffs::sprintf_; jmp fo::funcoffs::sprintf_;
} }
} }
static bool bonusHtHDamageFix = false;
static bool bonusHtHDamageFix = true;
static bool displayBonusDamage = false; static bool displayBonusDamage = false;
static long __fastcall GetHtHDamage(fo::GameObject* source, long &meleeDmg, long handOffset) { static long __fastcall GetHtHDamage(fo::GameObject* source, long &meleeDmg, long handOffset) {
@@ -396,13 +397,19 @@ static long __fastcall GetHtHDamage(fo::GameObject* source, long &meleeDmg, long
long perkBonus = game::Stats::perk_level(source, fo::Perk::PERK_bonus_hth_damage) << 1; long perkBonus = game::Stats::perk_level(source, fo::Perk::PERK_bonus_hth_damage) << 1;
if (!displayBonusDamage) meleeDmg -= perkBonus; if (!displayBonusDamage) meleeDmg -= perkBonus;
if (bonusHtHDamageFix && displayBonusDamage) min += perkBonus; if (displayBonusDamage && bonusHtHDamageFix) min += perkBonus;
return min + bonus; return min + bonus;
} }
static const char* __fastcall GetHtHName(long handOffset) {
fo::AttackType hit = Unarmed::GetStoredHitMode((handOffset == 0) ? fo::HandSlot::Left : fo::HandSlot::Right);
return Unarmed::GetName(hit);
}
static void __declspec(naked) DisplayBonusHtHDmg2_hack() { static void __declspec(naked) DisplayBonusHtHDmg2_hack() {
static const DWORD DisplayBonusHtHDmg2Exit = 0x47254F; static const DWORD DisplayBonusHtHDmg2Exit = 0x47254F;
static const DWORD DisplayBonusHtHDmg2Exit2 = 0x472556;
__asm { __asm {
mov ecx, eax; mov ecx, eax;
call fo::funcoffs::stat_level_; // get STAT_melee_dmg call fo::funcoffs::stat_level_; // get STAT_melee_dmg
@@ -411,7 +418,13 @@ static void __declspec(naked) DisplayBonusHtHDmg2_hack() {
push edi; // handOffset push edi; // handOffset
call GetHtHDamage; call GetHtHDamage;
push eax; // min dmg push eax; // min dmg
mov ecx, edi;
call GetHtHName;
test eax, eax;
jnz customName;
jmp DisplayBonusHtHDmg2Exit; jmp DisplayBonusHtHDmg2Exit;
customName:
jmp DisplayBonusHtHDmg2Exit2;
} }
} }
+2 -2
View File
@@ -37,7 +37,7 @@ void EngineTweaks::init() {
} }
} }
void EngineTweaks::exit() { //void EngineTweaks::exit() {
} //}
} }
+1 -1
View File
@@ -27,7 +27,7 @@ class EngineTweaks : public Module {
public: public:
const char* name() { return "EngineTweaks"; } const char* name() { return "EngineTweaks"; }
void init(); void init();
void exit() override; //void exit() override;
}; };
} }
+2 -2
View File
@@ -249,8 +249,8 @@ void Message::init() {
LoadGameHook::OnGameReset() += ClearScriptAddedExtraGameMsg; LoadGameHook::OnGameReset() += ClearScriptAddedExtraGameMsg;
} }
void Message::exit() { //void Message::exit() {
//gExtraGameMsgLists.clear(); //gExtraGameMsgLists.clear();
} //}
} }
+1 -1
View File
@@ -56,7 +56,7 @@ class Message : public Module {
public: public:
const char* name() { return "Message"; } const char* name() { return "Message"; }
void init(); void init();
void exit() override; //void exit() override;
static const char* GameLanguage(); static const char* GameLanguage();
+2 -2
View File
@@ -617,7 +617,7 @@ void Movies::init() {
SkipOpeningMoviesPatch(); SkipOpeningMoviesPatch();
} }
void Movies::exit() { //void Movies::exit() {
} //}
} }
+1 -1
View File
@@ -27,7 +27,7 @@ class Movies : public Module {
public: public:
const char* name() { return "Movies"; } const char* name() { return "Movies"; }
void init(); void init();
void exit() override; //void exit() override;
}; };
static constexpr int MaxMovies = 32; static constexpr int MaxMovies = 32;
+35
View File
@@ -20,6 +20,7 @@
#include "..\main.h" #include "..\main.h"
#include "..\FalloutEngine\Fallout2.h" #include "..\FalloutEngine\Fallout2.h"
#include "..\Translate.h"
#include "DamageMod.h" #include "DamageMod.h"
@@ -34,6 +35,8 @@ static struct {
fo::HandSlotMode mode; fo::HandSlotMode mode;
} slotHitData[2]; } slotHitData[2];
std::string hitNames[14];
class Hits { class Hits {
public: public:
static const long count = 20; static const long count = 20;
@@ -335,6 +338,18 @@ long Unarmed::GetDamage(fo::AttackType hit, long &minOut, long &maxOut) {
return unarmed.Hit(hit).bonusDamage; return unarmed.Hit(hit).bonusDamage;
} }
const char* Unarmed::GetName(fo::AttackType hit) {
if (hit > fo::AttackType::ATKTYPE_PIERCINGKICK) return nullptr;
switch (hit) {
case fo::AttackType::ATKTYPE_PUNCH:
case fo::AttackType::ATKTYPE_KICK:
return (!hitNames[hit - 4].empty()) ? hitNames[hit - 4].c_str() : nullptr;
default:
return (hit >= fo::AttackType::ATKTYPE_STRONGPUNCH && !hitNames[hit - 6].empty()) ? hitNames[hit - 6].c_str() : nullptr;
}
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static fo::AttackType GetPunchingHit() { static fo::AttackType GetPunchingHit() {
@@ -477,6 +492,26 @@ void Unarmed::init() {
// Store the current values of unarmed attack modes when opening the player's inventory // Store the current values of unarmed attack modes when opening the player's inventory
HookCall(0x46E8D4, handle_inventory_hook); HookCall(0x46E8D4, handle_inventory_hook);
const char* setting[14] = {
"Punch",
"Kick",
"StrongPunch",
"HammerPunch",
"Haymaker",
"Jab",
"PalmStrike",
"PiercingStrike",
"StrongKick",
"SnapKick",
"PowerKick",
"HipKick",
"HookKick",
"PiercingKick"
};
for (size_t i = 0; i < 14; i++) {
hitNames[i] = Translate::Get("Unarmed", setting[i], "", 17);
}
} }
//void Unarmed::exit() { //void Unarmed::exit() {
+1
View File
@@ -31,6 +31,7 @@ public:
static long GetHitAPCost(fo::AttackType hit); static long GetHitAPCost(fo::AttackType hit);
static long GetDamage(fo::AttackType hit, long &minOut, long &maxOut); static long GetDamage(fo::AttackType hit, long &minOut, long &maxOut);
static const char* GetName(fo::AttackType hit);
static fo::AttackType GetStoredHitMode(fo::HandSlot slot); static fo::AttackType GetStoredHitMode(fo::HandSlot slot);
}; };