mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added a patch to allow setting custom colors for object outlines
Added a tweak to ObjCanSeeObj_ShootThru_Fix to allow critters to see through other critters. Corrected some code.
This commit is contained in:
@@ -21,6 +21,7 @@ CheckLOS=0
|
||||
; 16 - bright yellow
|
||||
; 32 - dark yellow
|
||||
; 64 - purple
|
||||
; You can set a custom color from the game palette by multiplying the color index value by 256 (available since sfall 4.2.7)
|
||||
OutlineColor=16
|
||||
|
||||
; Motion Scanner mode:
|
||||
|
||||
+3
-3
@@ -134,7 +134,7 @@ AllowSoundForFloats=0
|
||||
AllowDShowSound=0
|
||||
|
||||
;Set to 1 to override the default music path with data\sound\music\ if music_path is not present in the cfg
|
||||
;Set to 2 to overwrite all occurances of the music path
|
||||
;Set to 2 to overwrite all occurrences of the music path
|
||||
OverrideMusicDir=1
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
@@ -576,8 +576,8 @@ SuperStimExploitFix=0
|
||||
InventoryApCost=4
|
||||
QuickPocketsApCostReduction=2
|
||||
|
||||
;Set to 1 to allow objects seeing through other objects that have their ShootThru flag set
|
||||
;Note that enabling this option can cause unexpected NPC behavior in some situations
|
||||
;Set to 1 to fix obj_can_see_obj script function to allow critters to see through other critters and objects with 'ShootThru' flag set
|
||||
;Note that enabling this option can cause unexpected NPC behavior in some situations, e.g. able to attack or enter into a dialogue with the player behind some objects
|
||||
ObjCanSeeObj_ShootThru_Fix=0
|
||||
|
||||
;Set to 1 to fix the broken obj_can_hear_obj script function
|
||||
|
||||
@@ -432,8 +432,9 @@ Some utility/math functions are available:
|
||||
- gets the current outline color for an object
|
||||
|
||||
> void sfall_func2("set_outline", object, int color)
|
||||
- sets the outline color of an object
|
||||
- 0 means or any value above 0x00FFFFFF disables the outline
|
||||
- sets the outline color of an object (see OUTLINE_* constants in sfall.h)
|
||||
- can also set a custom color from the game palette by shifting the color index value left by 8 bits: 0xCC00 where CC is the palette index (available since sfall 4.2.7/3.8.27)
|
||||
- passing 0 will disable the outline
|
||||
- call "tile_refresh_display" after changing outline of objects to properly redraw the scene
|
||||
|
||||
> int sfall_func1("get_flags", object)
|
||||
|
||||
@@ -253,8 +253,8 @@ checkArt:
|
||||
call fo::funcoffs::db_access_; // check art file exists
|
||||
test eax, eax;
|
||||
jz notExists;
|
||||
//mov eax, FO_VAR_art_name;
|
||||
jmp LoadOrder::art_get_name_hack; //retn; Not sure if we need a jump to: art_get_name_hack
|
||||
mov eax, FO_VAR_art_name;
|
||||
retn;
|
||||
notExists: // if file not found load regular critter art instead
|
||||
sub esi, critterArraySize;
|
||||
add esp, 4; // drop func ret address
|
||||
|
||||
@@ -66,8 +66,6 @@ static Delegate<> onBeforeGameClose;
|
||||
|
||||
static DWORD inLoop = 0;
|
||||
static DWORD saveInCombatFix;
|
||||
static bool disableHorrigan = false;
|
||||
static bool pipBoyAvailableAtGameStart = false;
|
||||
static bool gameLoaded = false;
|
||||
|
||||
// True if game was started, false when on the main menu
|
||||
|
||||
@@ -417,16 +417,14 @@ void __declspec(naked) LoadOrder::art_get_name_hack() {
|
||||
jne artHasAlias;
|
||||
retn;
|
||||
artHasAlias:
|
||||
sub esp, 4;
|
||||
mov edx, esp;
|
||||
call fo::funcoffs::db_dir_entry_;
|
||||
add esp, 4;
|
||||
cmp eax, -1;
|
||||
je artNotExist;
|
||||
call fo::funcoffs::db_access_;
|
||||
test eax, eax;
|
||||
jz artNotExist;
|
||||
mov aliasFID, -1;
|
||||
mov eax, FO_VAR_art_name;
|
||||
retn;
|
||||
artNotExist:
|
||||
dec eax; // -1
|
||||
xchg eax, aliasFID
|
||||
add esp, 4;
|
||||
jmp art_get_name_Alias; // get name of art alias
|
||||
@@ -471,7 +469,7 @@ void LoadOrder::init() {
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
// Predefined behavior for replacing art aliases for critters
|
||||
// Redefined behavior for replacing art aliases for critters
|
||||
// first check the existence of the art file of the current critter and then replace the art alias if file not found
|
||||
HookCall(0x419440, art_get_name_hook);
|
||||
SafeWrite16(0x419521, 0x003B); // jmp 0x419560
|
||||
|
||||
@@ -132,13 +132,32 @@ fail:
|
||||
}
|
||||
|
||||
static void __declspec(naked) op_obj_can_see_obj_hook() {
|
||||
using namespace fo;
|
||||
using namespace Fields;
|
||||
__asm {
|
||||
mov edi, [esp + 4]; // buf **ret_objStruct
|
||||
push fo::funcoffs::obj_shoot_blocking_at_; // check hex objects func pointer
|
||||
push 0x20; // flags, 0x20 = check ShootThru
|
||||
mov ecx, dword ptr [esp + 0x0C]; // buf **ret_objStruct
|
||||
push ecx;
|
||||
xor ecx, ecx;
|
||||
call fo::funcoffs::make_straight_path_func_; // (EAX *objStruct, EDX hexNum1, EBX hexNum2, ECX 0, stack1 **ret_objStruct, stack2 flags, stack3 *check_hex_objs_func)
|
||||
push edi;
|
||||
call fo::funcoffs::make_straight_path_func_;
|
||||
// fix: see through critters
|
||||
mov edx, [esp + 4];
|
||||
mov ebx, [edx];
|
||||
test ebx, ebx;
|
||||
jz skip;
|
||||
cmp ebx, [edx - 8]; // target
|
||||
jne noTarget;
|
||||
skip:
|
||||
retn 8;
|
||||
noTarget:
|
||||
mov eax, [ebx + protoId];
|
||||
shr eax, 24;
|
||||
cmp eax, OBJ_TYPE_CRITTER;
|
||||
je isCritter;
|
||||
retn 8;
|
||||
isCritter:
|
||||
mov [edx - 4], ebx; // replace source
|
||||
mov dword ptr [esp], 0x456BAB; // continue
|
||||
retn 8;
|
||||
}
|
||||
}
|
||||
@@ -280,6 +299,18 @@ skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) obj_render_outline_hack() {
|
||||
__asm {
|
||||
test eax, 0xFF00;
|
||||
jnz palColor;
|
||||
mov al, ds:[FO_VAR_GoodColor];
|
||||
retn;
|
||||
palColor:
|
||||
mov al, ah;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void AdditionalWeaponAnimsPatch() {
|
||||
if (GetConfigInt("Misc", "AdditionalWeaponAnims", 0)) {
|
||||
dlog("Applying additional weapon animations patch.", DL_INIT);
|
||||
@@ -433,7 +464,7 @@ static void DisablePipboyAlarmPatch() {
|
||||
|
||||
static void ObjCanSeeShootThroughPatch() {
|
||||
if (GetConfigInt("Misc", "ObjCanSeeObj_ShootThru_Fix", 0)) {
|
||||
dlog("Applying ObjCanSeeObj ShootThru Fix.", DL_INIT);
|
||||
dlog("Applying obj_can_see_obj fix for critters and ShootThru objects.", DL_INIT);
|
||||
HookCall(0x456BC6, op_obj_can_see_obj_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
@@ -705,6 +736,9 @@ void MiscPatches::init() {
|
||||
// Increase the max text width of the information card on the character screen
|
||||
SafeWriteBatch<BYTE>(145, {0x43ACD5, 0x43DD37}); // 136, 133
|
||||
|
||||
// Allow setting custom colors from the game palette for object outlines
|
||||
MakeCall(0x48EE00, obj_render_outline_hack);
|
||||
|
||||
F1EngineBehaviorPatch();
|
||||
DialogueFix();
|
||||
AdditionalWeaponAnimsPatch();
|
||||
|
||||
Reference in New Issue
Block a user