mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added an additional 'Energy Weapon' flag to ext flags in weapon protos
* it forces the weapon to use EW skill regardless of its damage type. Placed an object with PID 0x5000004 (corpse blood) to the lower z-layer of the tile.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
|
||||
#define WEAPON_BIGGUN 256 // 0x00000100 - Big Gun
|
||||
#define WEAPON_2HAND 512 // 0x00000200 - 2Hnd (weapon is two-handed)
|
||||
#define WEAPON_ENERGYWEAPON 1024 // 0x00000400 - Energy Weapon (forces weapon to use Energy Weapons skill)
|
||||
|
||||
#define ATKMODE_PRI_NONE 0
|
||||
#define ATKMODE_PRI_PUNCH 1 // 0001
|
||||
|
||||
@@ -198,6 +198,24 @@ void Objects::LoadProtoAutoMaxLimit() {
|
||||
MakeCall(0x4A21B2, proto_ptr_hack);
|
||||
}
|
||||
|
||||
static void __declspec(naked) obj_insert_hack() {
|
||||
using namespace fo::Fields;
|
||||
__asm {
|
||||
mov edi, [ebx];
|
||||
mov [esp + 0x38 - 0x1C + 4], esi; // 0
|
||||
test edi, edi;
|
||||
jnz insert;
|
||||
retn;
|
||||
insert:
|
||||
mov esi, [ecx]; // esi - inserted object
|
||||
cmp dword ptr [esi + protoId], 0x5000004; // corpse blood pid
|
||||
jnz skip;
|
||||
xor edi, edi;
|
||||
skip:
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
void Objects::init() {
|
||||
LoadGameHook::OnGameReset() += []() {
|
||||
RestoreObjUnjamAllLocks();
|
||||
@@ -213,6 +231,9 @@ void Objects::init() {
|
||||
SafeWrite8(0x482E71, 0x85); // jz > jnz
|
||||
// Additionally fix object IDs for queued events
|
||||
MakeCall(0x4A25BA, queue_add_hack);
|
||||
|
||||
// Place some objects on the tile to the lower z-layer
|
||||
MakeCall(0x48D918, obj_insert_hack, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,6 +65,19 @@ static ChanceModifier basePickpocket;
|
||||
|
||||
static int skillNegPoints; // skill raw points (w/o limit)
|
||||
|
||||
static void __declspec(naked) item_w_skill_hook() {
|
||||
__asm {
|
||||
mov edx, [esp + 4]; // item proto
|
||||
test byte ptr [edx + 0x19], 4; // weapon.flags_ext
|
||||
jnz energy;
|
||||
mov edx, ebx;
|
||||
jmp fo::funcoffs::item_w_damage_type_;
|
||||
energy:
|
||||
inc eax; // DMG_laser
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static int __fastcall PickpocketMod(int base, fo::GameObject* critter) {
|
||||
for (DWORD i = 0; i < pickpocketMods.size(); i++) {
|
||||
if (critter->id == pickpocketMods[i].id) {
|
||||
@@ -313,6 +326,11 @@ void Skills::init() {
|
||||
SafeWrite8(0x4ABC67, 0x89); // mov [esp + 0x54], eax
|
||||
SafeWrite32(0x4ABC6B, 0x90909090);
|
||||
|
||||
// Add an additional 'Energy Weapon' flag to the weapon flags (offset 0x0018)
|
||||
// Weapon Flags:
|
||||
// 0x00000400 - Energy Weapon (forces weapon to use Energy Weapons skill)
|
||||
HookCall(0x47831E, item_w_skill_hook);
|
||||
|
||||
char buf[512], key[16];
|
||||
auto skillsFile = GetConfigString("Misc", "SkillsFile", "");
|
||||
if (!skillsFile.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user