mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Code edits
This commit is contained in:
+14
-14
@@ -51,14 +51,6 @@ static struct tBox {
|
||||
|
||||
static bool setCustomBoxText;
|
||||
|
||||
static const DWORD bboxMemAddr[] = {
|
||||
0x461266, 0x4612AC, 0x461374, 0x4613E8, 0x461479, 0x46148C, 0x4616BB,
|
||||
};
|
||||
|
||||
static const DWORD bboxSlotAddr[] = {
|
||||
0x4616F7, 0x46170F, 0x461736, 0x4616B1, 0x46151D, 0x4615B3
|
||||
};
|
||||
|
||||
static void __declspec(naked) DisplayBoxesHack() {
|
||||
static const DWORD DisplayBoxesRet1 = 0x4615A8;
|
||||
static const DWORD DisplayBoxesRet2 = 0x4615BE;
|
||||
@@ -67,7 +59,7 @@ static void __declspec(naked) DisplayBoxesHack() {
|
||||
xor ebx, ebx;
|
||||
start:
|
||||
imul eax, ebx, tSize;
|
||||
mov al, byte ptr [edx][eax + 3]; // .isActive
|
||||
mov al, byte ptr [edx + 3][eax]; // tBox.isActive
|
||||
test al, al;
|
||||
jz next;
|
||||
lea eax, [ebx + 5]; // index box
|
||||
@@ -92,20 +84,20 @@ static void __declspec(naked) BarBoxesTextHack() {
|
||||
sub ecx, 5; // subtract vanilla boxes
|
||||
imul ecx, tSize;
|
||||
mov esi, [boxText]; // boxText addr
|
||||
cmp byte ptr [esi][ecx], 1; // .hasText
|
||||
cmp byte ptr [esi][ecx], 1; // tBox.hasText
|
||||
je customText;
|
||||
add esp, 4;
|
||||
jmp getmsg_;
|
||||
customText:
|
||||
// get color
|
||||
movzx ebx, byte ptr [esi][ecx + 1]; // .color
|
||||
movzx ebx, byte ptr [esi + 1][ecx]; // tBox.color
|
||||
// set text
|
||||
lea eax, [esi + ecx + 4]; // .text
|
||||
lea eax, [esi + 4][ecx]; // tBox.text
|
||||
// set color
|
||||
pop ecx; // restore BoxIndex
|
||||
imul ecx, sSize;
|
||||
mov esi, [boxes]; // boxes addr
|
||||
cmp dword ptr [esi][ecx + 4], 2; // .colour
|
||||
cmp dword ptr [esi + 4][ecx], 2; // sBox.colour
|
||||
jb skip;
|
||||
mov [esp + 0x440 - 0x20], ebx; // set to Color
|
||||
skip:
|
||||
@@ -138,13 +130,21 @@ exitLoop:
|
||||
static void ReconstructBarBoxes(int count) {
|
||||
SafeWrite8(0x46140B, count);
|
||||
__asm {
|
||||
//call refresh_box_bar_win_;
|
||||
call reset_box_bar_win_;
|
||||
call construct_box_bar_win_;
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD bboxMemAddr[] = {
|
||||
0x461266, 0x4612AC, 0x461374, 0x4613E8, 0x461479, 0x46148C, 0x4616BB,
|
||||
};
|
||||
|
||||
static const DWORD bboxSlotAddr[] = {
|
||||
0x4616F7, 0x46170F, 0x461736, 0x4616B1, 0x46151D, 0x4615B3
|
||||
};
|
||||
|
||||
//static BYTE restoreData[] = {0x31, 0xD2, 0x89, 0x94, 0x24}; // xor edx, edx; mov...
|
||||
|
||||
static void ResetBoxes() {
|
||||
for (int i = 0; i < actualBoxCount; i++) {
|
||||
boxText[i].isActive = false;
|
||||
|
||||
+5
-5
@@ -314,21 +314,21 @@ void __stdcall KnockbackSetMod(TGameObj* object, DWORD type, float val, DWORD mo
|
||||
std::vector<KnockbackModifier>* mods;
|
||||
switch (mode) {
|
||||
case 0:
|
||||
if (object->Type() != OBJ_TYPE_ITEM) {
|
||||
if (object->IsNotItem()) {
|
||||
fo_debug_printf("\nOPCODE ERROR: set_weapon_knockback() - the object is not an item.");
|
||||
return;
|
||||
}
|
||||
mods = &mWeapons;
|
||||
break;
|
||||
case 1:
|
||||
if (object->Type() != OBJ_TYPE_CRITTER) {
|
||||
if (object->IsNotCritter()) {
|
||||
fo_debug_printf("\nOPCODE ERROR: set_target_knockback() - the object is not a critter.");
|
||||
return;
|
||||
}
|
||||
mods = &mTargets;
|
||||
break;
|
||||
case 2:
|
||||
if (object->Type() != OBJ_TYPE_CRITTER) {
|
||||
if (object->IsNotCritter()) {
|
||||
fo_debug_printf("\nOPCODE ERROR: set_attacker_knockback() - the object is not a critter.");
|
||||
return;
|
||||
}
|
||||
@@ -382,7 +382,7 @@ void __stdcall SetHitChanceMax(TGameObj* critter, DWORD maximum, DWORD mod) {
|
||||
baseHitChance.mod = mod;
|
||||
return;
|
||||
}
|
||||
if (critter->Type() != OBJ_TYPE_CRITTER) return;
|
||||
if (critter->IsNotCritter()) return;
|
||||
long id = Objects_SetObjectUniqueID(critter);
|
||||
for (size_t i = 0; i < hitChanceMods.size(); i++) {
|
||||
if (id == hitChanceMods[i].id) {
|
||||
@@ -399,7 +399,7 @@ void __stdcall SetHitChanceMax(TGameObj* critter, DWORD maximum, DWORD mod) {
|
||||
}
|
||||
|
||||
void __stdcall SetNoBurstMode(TGameObj* critter, bool on) {
|
||||
if (critter == *ptr_obj_dude || critter->Type() != OBJ_TYPE_CRITTER) return;
|
||||
if (critter == *ptr_obj_dude || critter->IsNotCritter()) return;
|
||||
|
||||
long id = Objects_SetObjectUniqueID(critter);
|
||||
for (size_t i = 0; i < noBursts.size(); i++) {
|
||||
|
||||
+10
-2
@@ -21,6 +21,8 @@
|
||||
#include <Windows.h>
|
||||
#include <dsound.h>
|
||||
|
||||
#include "Define.h"
|
||||
|
||||
struct sRectangle {
|
||||
long x, y, width, height;
|
||||
|
||||
@@ -159,11 +161,17 @@ struct TGameObj {
|
||||
return ((artFid >> 24) & 0x0F);
|
||||
}
|
||||
|
||||
inline bool IsCritter() {
|
||||
return (Type() == OBJ_TYPE_CRITTER);
|
||||
}
|
||||
inline bool IsNotCritter() {
|
||||
return (Type() != OBJ_TYPE_CRITTER);
|
||||
}
|
||||
inline bool IsItem() {
|
||||
return (Type() == OBJ_TYPE_ITEM);
|
||||
}
|
||||
inline bool IsCritter() {
|
||||
return (Type() == OBJ_TYPE_CRITTER);
|
||||
inline bool IsNotItem() {
|
||||
return (Type() != OBJ_TYPE_ITEM);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+5
-4
@@ -21,9 +21,10 @@
|
||||
#include "main.h"
|
||||
#include "FalloutEngine.h"
|
||||
#include "InputFuncs.h"
|
||||
#include "Inventory.h"
|
||||
#include "LoadGameHook.h"
|
||||
|
||||
#include "Inventory.h"
|
||||
|
||||
static DWORD sizeLimitMode;
|
||||
static DWORD invSizeMaxLimit;
|
||||
|
||||
@@ -322,13 +323,12 @@ static void __declspec(naked) gdControlUpdateInfo_hack() {
|
||||
|
||||
static char superStimMsg[128];
|
||||
static int __fastcall SuperStimFix(TGameObj* item, TGameObj* target) {
|
||||
if (item->protoId != PID_SUPER_STIMPAK || !target || target->Type() != OBJ_TYPE_CRITTER) {
|
||||
if (item->protoId != PID_SUPER_STIMPAK || !target || target->IsNotCritter()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
long curr_hp = fo_stat_level(target, STAT_current_hp);
|
||||
long max_hp = fo_stat_level(target, STAT_max_hit_points);
|
||||
if (curr_hp < max_hp) return 0;
|
||||
if (target->critter.health < max_hp) return 0;
|
||||
|
||||
fo_display_print(superStimMsg);
|
||||
return -1;
|
||||
@@ -684,6 +684,7 @@ void Inventory_Init() {
|
||||
SafeWrite8(0x449150, 0x10 + 0x08);
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust the max text width of the total weight display on the inventory screen
|
||||
SafeWrite32(0x472632, widthWeight);
|
||||
|
||||
|
||||
@@ -735,7 +735,7 @@ static void mf_unwield_slot() {
|
||||
return;
|
||||
}
|
||||
TGameObj* critter = opHandler.arg(0).object();
|
||||
if (critter->Type() != OBJ_TYPE_CRITTER) {
|
||||
if (critter->IsNotCritter()) {
|
||||
opHandler.printOpcodeError("unwield_slot() - the object is not a critter.");
|
||||
opHandler.setReturn(-1);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user