mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed missing AC/DR mod stats when examining ammo in barter screen.
Added an option to display full item description for weapon/ammo in barter screen. Minor code correction in ScriptExtender.cpp. Minor edits to document. Updated version number.
This commit is contained in:
+4
-1
@@ -1,5 +1,5 @@
|
||||
;sfall configuration settings
|
||||
;v3.8.12
|
||||
;v3.8.13
|
||||
|
||||
[Main]
|
||||
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
|
||||
@@ -631,6 +631,9 @@ NumbersInDialogue=0
|
||||
;Set to 1 to use Fallout's normal text font instead of DOS-like font on the world map
|
||||
WorldMapFontPatch=0
|
||||
|
||||
;Set to 1 to display full item description for weapon/ammo in barter screen
|
||||
FullItemDescInBarter=0
|
||||
|
||||
;Set to 1 to display experience points with the bonus from Swift Learner perk when gained from non-scripted situations
|
||||
DisplaySwiftLearnerExp=1
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ set_fake_trait and set_fake_perk can be used to add additional traits and perks
|
||||
|
||||
has_fake_trait and has_fake_perk return the number of levels the player has of the perks/traits with the given name.
|
||||
|
||||
perk_add_mode, set_selectable_perk, set_perkbox_title, hide_real_perks, show_real_perks and clear_selectable_perks control the behaviour of the select a perk box. set_selectable_perk can be used to add additional items by setting the 'active' parameter to 1, and to remove them again by setting it to 0. set_perkbox_title can be used to change the title of the box, or by using "" it will be set back to the default. hide and show_real_perks can be used to prevent the dialog from displaying any of the original 119 perks. perk_add_mode modifies what happens when a fake perk is selected from the perks dialog. It is treated as a set of flags - if bit 1 is set then it is added to the players traits, if bit 2 is set it is added to the players perks, and if bit 3 is set it is removed from the list of selectable perks. The default is 0x2. clear_selectable_perks restores the dialog to it's default state.
|
||||
perk_add_mode, set_selectable_perk, set_perkbox_title, hide_real_perks, show_real_perks and clear_selectable_perks control the behaviour of the select a perk box. set_selectable_perk can be used to add additional items by setting the 'active' parameter to 1, and to remove them again by setting it to 0. set_perkbox_title can be used to change the title of the box, or by using "" it will be set back to the default. hide and show_real_perks can be used to prevent the dialog from displaying any of the original 119 perks. perk_add_mode modifies what happens when a fake perk is selected from the perks dialog. It is treated as a set of flags - if bit 1 is set then it is added to the players traits, if bit 2 is set it is added to the players perks, and if bit 3 is set it is removed from the list of selectable perks. The default is 0x2. clear_selectable_perks restores the dialog to its default state.
|
||||
|
||||
show_iface_tag, hide_iface_tag and is_iface_tag_active relate to the boxes that appear above the interface such as SNEAK and LEVEL. You can use 3 for LEVEL and 4 for ADDICT, or the range from 5 to 9 for custom boxes. Remember to add your messages to intrface.msg and set up the font colours in ddraw.ini if you're going to use custom boxes. Starting from sfall 3.8.12, is_iface_tag_active can also be used to check 0 for SNEAK, 1 for POISONED, and 2 for RADIATED.
|
||||
|
||||
@@ -98,7 +98,7 @@ array - array ID to be used with array-related functions (actually an integer)
|
||||
----------------------------------------------
|
||||
|
||||
> int game_loaded()
|
||||
- returns 1 the first time it is called after a new game or game load, and 0 any time after. It works on an individual basis for each script, so one script wont interfere with others. It's primary use is for global scripts, so that they know when to call set_global_script_repeat, but it can be called from normal scripts too.
|
||||
- returns 1 the first time it is called after a new game or game load, and 0 any time after. It works on an individual basis for each script, so one script wont interfere with others. Its primary use is for global scripts, so that they know when to call set_global_script_repeat, but it can be called from normal scripts too.
|
||||
|
||||
> void inc_npc_level(string npc)
|
||||
- takes an NPC name as an argument. The NPC must be in your party. This function ignores player level requirements and the minimum 3 player level delay between NPC level gains. It also ignores the random element, regardless of sfall's NPCAutoLevel setting.
|
||||
@@ -223,13 +223,13 @@ was made as a dirty easy hack to allow dynamically change some explosion paramet
|
||||
- currently y is not used and x means: 1 - reduced explosion pattern (3 effects are spawned instead of 7), 0 - full pattern
|
||||
|
||||
> void set_attack_explosion_art(x, y)
|
||||
- y not used and x is a misc frame ID (last 3 bytes, without object type) to use for the next explosion.
|
||||
- y is not used and x is a misc frame ID (last 3 bytes, without object type) to use for the next explosion.
|
||||
|
||||
> void set_attack_explosion_radius(x)
|
||||
- changes radius at which explosion will hit secondary targets for the next attack (from the experiments it is limited to something around 8 by the engine)
|
||||
|
||||
> void set_attack_is_explosion_fire
|
||||
- if you call this right before using a weapon with fire damage type, it will produce explosion effects (and radius damage) just like "explosion" type, but all targets will still receive fire damage.
|
||||
- if you call this right before using a weapon with fire damage type (e.g. in HOOK_AFTERHITROLL), it will produce explosion effects (and radius damage) just like "explosion" type, but all targets will still receive fire damage.
|
||||
|
||||
> void set_explosion_radius(grenade, rocket)
|
||||
- sets a permanent radius of the explosion for grenades and/or rockets. Passing 0 means not changing the corresponding radius.
|
||||
|
||||
+97
-4
@@ -10,6 +10,8 @@ static DWORD critterBody = 0;
|
||||
static DWORD sizeOnBody = 0;
|
||||
static DWORD weightOnBody = 0;
|
||||
|
||||
static char textBuf[355];
|
||||
|
||||
void ResetBodyState() {
|
||||
_asm mov critterBody, 0;
|
||||
_asm mov sizeOnBody, 0;
|
||||
@@ -806,6 +808,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD SetNewResults_Ret = 0x424FC6;
|
||||
static void __declspec(naked) set_new_results_hack() {
|
||||
__asm {
|
||||
test ah, 0x1 // DAM_KNOCKED_OUT?
|
||||
@@ -816,8 +819,7 @@ static void __declspec(naked) set_new_results_hack() {
|
||||
jmp queue_remove_this_ // Remove knockout from queue (if there is one)
|
||||
end:
|
||||
add esp, 4 // Destroy the return address
|
||||
push 0x424FC6
|
||||
retn
|
||||
jmp SetNewResults_Ret
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1306,6 +1308,80 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static int currDescLen = 0;
|
||||
static bool showItemDescription = false;
|
||||
static void __stdcall AppendText(const char* text, const char* desc) {
|
||||
if (showItemDescription && currDescLen == 0) {
|
||||
strncpy_s(textBuf, desc, 161);
|
||||
int len = strlen(textBuf);
|
||||
if (len > 160) {
|
||||
len = 158;
|
||||
textBuf[len++] = '.';
|
||||
textBuf[len++] = '.';
|
||||
textBuf[len++] = '.';
|
||||
}
|
||||
textBuf[len++] = ' ';
|
||||
textBuf[len] = 0;
|
||||
currDescLen = len;
|
||||
} else if (currDescLen == 0) {
|
||||
textBuf[0] = 0;
|
||||
}
|
||||
|
||||
strncat(textBuf, text, 64);
|
||||
currDescLen += strlen(text);
|
||||
if (currDescLen < 300) {
|
||||
textBuf[currDescLen++] = '.';
|
||||
textBuf[currDescLen++] = ' ';
|
||||
textBuf[currDescLen] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) obj_examine_func_hack_ammo0() {
|
||||
__asm {
|
||||
cmp dword ptr [esp + 0x1AC - 0x14 + 4], 0x445448; // gdialogDisplayMsg_
|
||||
jnz skip;
|
||||
push esi;
|
||||
push eax;
|
||||
call AppendText;
|
||||
retn;
|
||||
skip:
|
||||
jmp dword ptr [esp + 0x1AC - 0x14 + 4];
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) obj_examine_func_hack_ammo1() {
|
||||
__asm {
|
||||
cmp dword ptr [esp + 0x1AC - 0x14 + 4], 0x445448; // gdialogDisplayMsg_
|
||||
jnz skip;
|
||||
push 0;
|
||||
push eax;
|
||||
call AppendText;
|
||||
mov currDescLen, 0;
|
||||
lea eax, [textBuf];
|
||||
jmp gdialogDisplayMsg_;
|
||||
skip:
|
||||
jmp dword ptr [esp + 0x1AC - 0x14 + 4];
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD ObjExamineFuncWeapon_Ret = 0x49B63C;
|
||||
static void __declspec(naked) obj_examine_func_hack_weapon() {
|
||||
__asm {
|
||||
cmp dword ptr [esp + 0x1AC - 0x14], 0x445448; // gdialogDisplayMsg_
|
||||
jnz skip;
|
||||
push esi;
|
||||
push eax;
|
||||
call AppendText;
|
||||
mov eax, currDescLen;
|
||||
sub eax, 2;
|
||||
mov byte ptr textBuf[eax], 0; // cutoff last character
|
||||
mov currDescLen, 0;
|
||||
lea eax, [textBuf];
|
||||
skip:
|
||||
jmp ObjExamineFuncWeapon_Ret;
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD expSwiftLearner; // experience points for print
|
||||
static void __declspec(naked) statPCAddExperienceCheckPMs_hack() {
|
||||
__asm {
|
||||
@@ -1398,13 +1474,12 @@ static void __declspec(naked) ai_best_weapon_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
static char worldMapMsg[128];
|
||||
static void __declspec(naked) wmSetupRandomEncounter_hook() {
|
||||
__asm {
|
||||
push eax; // text 2
|
||||
push edi; // text 1
|
||||
push 0x500B64; // fmt '%s %s'
|
||||
lea edi, worldMapMsg;
|
||||
lea edi, textBuf;
|
||||
push edi; // buf
|
||||
call sprintf_;
|
||||
add esp, 16;
|
||||
@@ -1895,6 +1970,24 @@ void BugsInit()
|
||||
// in their AI packages is set to stay_close/charge, or NPCsTryToSpendExtraAP is enabled
|
||||
HookCall(0x42A1A8, ai_move_steps_closer_hook); // 0x42B24D
|
||||
|
||||
// Fix missing AC/DR mod stats when examining ammo in barter screen
|
||||
dlog("Applying fix for displaying ammo stats in barter screen.", DL_INIT);
|
||||
MakeCall(0x49B4AD, obj_examine_func_hack_ammo0);
|
||||
SafeWrite16(0x49B4B2, 0x9090);
|
||||
MakeCall(0x49B504, obj_examine_func_hack_ammo0);
|
||||
SafeWrite16(0x49B509, 0x9090);
|
||||
MakeCall(0x49B563, obj_examine_func_hack_ammo1);
|
||||
SafeWrite16(0x49B568, 0x9090);
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
// Display full item description for weapon/ammo in barter screen
|
||||
showItemDescription = (GetPrivateProfileIntA("Misc", "FullItemDescInBarter", 0, ini) != 0);
|
||||
if (showItemDescription) {
|
||||
dlog("Applying full item description in barter patch.", DL_INIT);
|
||||
HookCall(0x49B452, obj_examine_func_hack_weapon); // it's jump
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
// Display experience points with the bonus from Swift Learner perk when gained from non-scripted situations
|
||||
if (GetPrivateProfileIntA("Misc", "DisplaySwiftLearnerExp", 1, ini)) {
|
||||
dlog("Applying Swift Learner exp display patch.", DL_INIT);
|
||||
|
||||
+13
-10
@@ -1007,36 +1007,39 @@ end:
|
||||
|
||||
static void __declspec(naked) MainGameLoopHook() {
|
||||
__asm {
|
||||
push ebx;
|
||||
call get_input_;
|
||||
push ecx;
|
||||
push edx;
|
||||
call get_input_
|
||||
push eax;
|
||||
call RunGlobalScripts1;
|
||||
pop eax;
|
||||
pop edx;
|
||||
pop ecx;
|
||||
pop ebx;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) CombatLoopHook() {
|
||||
__asm {
|
||||
pushad;
|
||||
push ecx;
|
||||
push edx;
|
||||
push eax;
|
||||
call RunGlobalScripts1;
|
||||
popad;
|
||||
jmp get_input_
|
||||
pop eax;
|
||||
pop edx;
|
||||
pop ecx;
|
||||
jmp get_input_;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) AfterCombatAttackHook() {
|
||||
__asm {
|
||||
pushad;
|
||||
push ecx;
|
||||
push edx;
|
||||
call AfterAttackCleanup;
|
||||
popad;
|
||||
pop edx;
|
||||
pop ecx;
|
||||
mov eax, 1;
|
||||
push 0x4230DA;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -1305,7 +1308,7 @@ void ScriptExtenderSetup() {
|
||||
MakeJump(0x4A5E34, ScrPtrHack);
|
||||
memset(&OverrideScriptStruct, 0, sizeof(TScript));
|
||||
|
||||
MakeJump(0x4230D5, AfterCombatAttackHook);
|
||||
MakeCall(0x4230D5, AfterCombatAttackHook);
|
||||
MakeJump(0x4A67F0, ExecMapScriptsHack);
|
||||
|
||||
// this patch makes it possible to export variables from sfall global scripts
|
||||
|
||||
+3
-3
@@ -24,13 +24,13 @@
|
||||
|
||||
#define VERSION_MAJOR 3
|
||||
#define VERSION_MINOR 8
|
||||
#define VERSION_BUILD 12
|
||||
#define VERSION_BUILD 13
|
||||
#define VERSION_REV 0
|
||||
|
||||
#ifdef WIN2K
|
||||
#define VERSION_STRING "3.8.12 win2k"
|
||||
#define VERSION_STRING "3.8.13 win2k"
|
||||
#else
|
||||
#define VERSION_STRING "3.8.12"
|
||||
#define VERSION_STRING "3.8.13"
|
||||
#endif
|
||||
|
||||
#define CHECK_VAL (4)
|
||||
|
||||
Reference in New Issue
Block a user