mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added WorldMapTerrainInfo option for toggling the display
Minor code refactoring in MiscPatches/PlayerModel modules. Updated compiler document.
This commit is contained in:
+4
-1
@@ -120,7 +120,7 @@ ExpandWorldMap=0
|
||||
ActionPointsBar=0
|
||||
|
||||
;Set to 1 to enable drawing a dotted line when traveling on the world map (similar to Fallout 1)
|
||||
WorldTravelMarkers=0
|
||||
WorldMapTravelMarkers=0
|
||||
;Uncomment these lines to change the appearance of the markers
|
||||
;The color index in Fallout default palette (valid range: 1..255; default is 133)
|
||||
;TravelMarkerColor=133
|
||||
@@ -129,6 +129,9 @@ WorldTravelMarkers=0
|
||||
;The spacing between the dots in pixels (valid range: 1..10)
|
||||
;TravelMarkerSpaces=2
|
||||
|
||||
;Set to 1 to display terrain types when moving the cursor over a green triangle on the world map
|
||||
WorldMapTerrainInfo=0
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Input]
|
||||
;Set to 1 to enable the mouse scroll wheel to scroll through the inventory, barter, and loot screens
|
||||
|
||||
@@ -82,6 +82,14 @@ old:
|
||||
X := value2;
|
||||
|
||||
|
||||
> To assign values, you can use the alternative assignment operator from C/Java instead of Pascal syntax.
|
||||
|
||||
new:
|
||||
x = 5;
|
||||
old:
|
||||
x := 5;
|
||||
|
||||
|
||||
> Multiple variable decleration: Multiple variables can be declared on one line, seperated by commas. This is an alterative to the ugly begin/end block, or the bulky single variable per line style.
|
||||
|
||||
new:
|
||||
@@ -102,12 +110,12 @@ old:
|
||||
NOTE: if your expression starts with a constant (eg. 2+2), enclose it in parentheses, otherwise compiler will be confused and give you errors.
|
||||
|
||||
|
||||
> hexadecimal numerical constants: Simply prefix a number with 0x to create a hexadecimal. The numbers 0 to 9 and a-f are allowed in the number. The number may not have a decimal point.
|
||||
> Hexadecimal numerical constants: Simply prefix a number with 0x to create a hexadecimal. The numbers 0 to 9 and a-f are allowed in the number. The number may not have a decimal point.
|
||||
|
||||
new:
|
||||
a:=0x1000;
|
||||
a := 0x1000;
|
||||
old:
|
||||
a:=4096;
|
||||
a := 4096;
|
||||
|
||||
|
||||
> increment/decrement operators: ++ and -- can be used as shorthand for +=1 and -=1 respectively. They are mearly a syntactic shorthand to improve readability, and so their use is only allowed where +=1 would normally be allowed.
|
||||
@@ -115,7 +123,7 @@ old:
|
||||
new:
|
||||
a++;
|
||||
old:
|
||||
a+=1;
|
||||
a += 1;
|
||||
|
||||
|
||||
> "break" & "continue" statements: they work just like in most high-level languages. "break" jumps out of the loop. "continue" jumps right to the beginning of the next iteration (see "for" and "foreach" sections for additional details).
|
||||
@@ -157,12 +165,12 @@ old:
|
||||
|
||||
> "for" loops: Another piece of syntactic shorthand, to shorten while loops in many cases. Parentheses around the loop statements are recommended but not required (when not using parentheses, a semicolon is required after the 3rd loop statement).
|
||||
new:
|
||||
for (i:=0; i<5; i++) begin
|
||||
for (i := 0; i < 5; i++) begin
|
||||
display_msg("i = "+i);
|
||||
end
|
||||
old
|
||||
i:=0;
|
||||
while i<5 do begin
|
||||
i := 0;
|
||||
while (i < 5) do begin
|
||||
display_msg("i = "+i);
|
||||
i++;
|
||||
end
|
||||
@@ -179,7 +187,7 @@ new:
|
||||
end
|
||||
old:
|
||||
variable tmp;
|
||||
tmp:=get_attack_type;
|
||||
tmp := get_attack_type;
|
||||
if tmp == ATKTYPE_PUNCH then begin
|
||||
display_msg("punch");
|
||||
end else if tmp == ATKTYPE_KICK then begin
|
||||
@@ -219,17 +227,17 @@ new:
|
||||
new:
|
||||
procedure bingle begin
|
||||
variable a[2];
|
||||
a[0]:=5;
|
||||
a[a[0]-4]:=a[0] + 4;
|
||||
display_msg("a[0]="+a[0]+", a[1]="+a[1]);
|
||||
a[0] := 5;
|
||||
a[a[0] - 4] := a[0] + 4;
|
||||
display_msg("a[0]=" + a[0] + ", a[1]=" + a[1]);
|
||||
end
|
||||
old:
|
||||
procedure bingle begin
|
||||
variable a;
|
||||
a:=temp_array(2, 4);
|
||||
a := temp_array(2, 4);
|
||||
set_array(a, 0, 5);
|
||||
set_array(a, get_array(a, 0) - 4, get_array(a, 0) + 4);
|
||||
display_msg("a[0]="+get_array(a, 0)+", a[1]="+get_array(a, 1));
|
||||
display_msg("a[0]=" + get_array(a, 0) + ", a[1]=" + get_array(a, 1));
|
||||
end
|
||||
|
||||
|
||||
@@ -273,12 +281,12 @@ new:
|
||||
old:
|
||||
procedure bingle begin
|
||||
variable begin critter; array; len; count; end
|
||||
array:=list_as_array(LIST_CRITTERS);
|
||||
len:=len_array(array);
|
||||
count:=0;
|
||||
array := list_as_array(LIST_CRITTERS);
|
||||
len := len_array(array);
|
||||
count := 0;
|
||||
while count < len do begin
|
||||
critter:=array[count];
|
||||
display_msg(""+critter);
|
||||
critter := array[count];
|
||||
display_msg("" + critter);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -334,7 +342,8 @@ There are several changes in this version of sslc which may result in problems f
|
||||
|
||||
> sfall 4.2.3
|
||||
- fixed compiler giving "assignment operator expected" error when a variable-like macro is not being defined properly
|
||||
- added new logical operators 'AndAlso', 'OrElse' for short-circuit evaluation of logical expressions
|
||||
- added new logical operators "AndAlso", "OrElse" for short-circuit evaluation of logical expressions
|
||||
- added an alternative (C/Java-style) assignment operator "="
|
||||
|
||||
> sfall 4.2.2
|
||||
- added support for new opcode "reg_anim_callback"
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "..\FalloutEngine\EngineUtils.h"
|
||||
#include "Graphics.h"
|
||||
#include "LoadGameHook.h"
|
||||
//#include "Worldmap.h"
|
||||
|
||||
#include "Interface.h"
|
||||
|
||||
@@ -463,7 +462,7 @@ static void WorldmapViewportPatch() {
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
////////////////////////////// FALLOUT 1 FEATURES //////////////////////////////
|
||||
///////////////////////// FALLOUT 1 WORLDMAP FEATURES //////////////////////////
|
||||
|
||||
enum TerrainHoverImage {
|
||||
width = 100,
|
||||
@@ -595,7 +594,7 @@ static long __fastcall wmDetectHotspotHover(long wmMouseX, long wmMouseY) {
|
||||
fo::MemCopyToWinBuffer(x_offset, y, TerrainHoverImage::width, TerrainHoverImage::height, wmapWinWidth, *(BYTE**)FO_VAR_wmBkWinBuf, wmTmpBuffer.data());
|
||||
backImageIsCopy = false;
|
||||
}
|
||||
// redraw worldmap interface rectangle
|
||||
// redraw rectangle on worldmap interface
|
||||
RECT rect;
|
||||
rect.top = y;
|
||||
rect.left = x_offset;
|
||||
@@ -689,7 +688,9 @@ static void WorldMapInterfacePatch() {
|
||||
}
|
||||
}
|
||||
|
||||
if (GetConfigInt("Interface", "WorldTravelMarkers", 0)) {
|
||||
// Fallout 1 features, travel markers and displaying terrain types
|
||||
bool showTravelMarkers, showTerrainType;
|
||||
if (showTravelMarkers = GetConfigInt("Interface", "WorldMapTravelMarkers", 0) != 0) {
|
||||
dlog("Applying world map travel markers patch.", DL_INIT);
|
||||
optionLenDot = GetConfigInt("Interface", "TravelMarkerLength", optionLenDot);
|
||||
optionSpaceDot = GetConfigInt("Interface", "TravelMarkerSpaces", optionSpaceDot);
|
||||
@@ -706,9 +707,12 @@ static void WorldMapInterfacePatch() {
|
||||
};
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
// Fallout 1 features, travel markers and displaying terrain type
|
||||
HookCall(0x4C3C7E, wmInterfaceRefresh_hook); // when calling wmDrawCursorStopped_
|
||||
MakeCall(0x4BFE84, wmWorldMap_hack);
|
||||
if (showTerrainType = GetConfigInt("Interface", "WorldMapTerrainInfo", 0) != 0) {
|
||||
dlog("Applying display terrain types patch.", DL_INIT);
|
||||
MakeCall(0x4BFE84, wmWorldMap_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
if (showTravelMarkers || showTerrainType) HookCall(0x4C3C7E, wmInterfaceRefresh_hook); // when calling wmDrawCursorStopped_
|
||||
|
||||
// Car fuel gauge graphics patch
|
||||
MakeCall(0x4C528A, wmInterfaceRefreshCarFuel_hack_empty);
|
||||
|
||||
@@ -706,7 +706,7 @@ void Inventory::init() {
|
||||
|
||||
MakeJump(fo::funcoffs::adjust_fid_, adjust_fid_hack_replacement);
|
||||
|
||||
long weightWidth = 135;
|
||||
long widthWeight = 135;
|
||||
|
||||
sizeLimitMode = GetConfigInt("Misc", "CritterInvSizeLimitMode", 0);
|
||||
if (sizeLimitMode > 0 && sizeLimitMode <= 7) {
|
||||
@@ -740,7 +740,7 @@ void Inventory::init() {
|
||||
SafeWrite32(0x4725F9, 0x9C + 0x0C);
|
||||
SafeWrite8(0x472606, 0x10 + 0x0C);
|
||||
SafeWrite8(0x472638, 0); // x offset position
|
||||
weightWidth = 150;
|
||||
widthWeight = 150;
|
||||
|
||||
// Display item size when examining
|
||||
HookCall(0x472FFE, inven_obj_examine_func_hook);
|
||||
@@ -758,7 +758,7 @@ void Inventory::init() {
|
||||
}
|
||||
}
|
||||
// Adjust the max text width of the total weight display on the inventory screen
|
||||
SafeWrite32(0x472632, weightWidth);
|
||||
SafeWrite32(0x472632, widthWeight);
|
||||
|
||||
if (GetConfigInt("Misc", "SuperStimExploitFix", 0)) {
|
||||
superStimMsg = Translate("sfall", "SuperStimExploitMsg", "You cannot use a super stim on someone who is not injured!");
|
||||
|
||||
+117
-143
@@ -16,13 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "..\main.h"
|
||||
#include "..\FalloutEngine\Fallout2.h"
|
||||
#include "..\SimplePatch.h"
|
||||
#include "ScriptExtender.h"
|
||||
#include "LoadGameHook.h"
|
||||
|
||||
#include "MiscPatches.h"
|
||||
@@ -30,31 +26,13 @@
|
||||
namespace sfall
|
||||
{
|
||||
|
||||
// TODO: split this into smaller files
|
||||
|
||||
static char mapName[65];
|
||||
static char configName[65];
|
||||
static char patchName[65];
|
||||
static char versionString[65];
|
||||
static char mapName[65] = {};
|
||||
static char configName[65] = {};
|
||||
static char patchName[65] = {};
|
||||
static char versionString[65] = {};
|
||||
|
||||
static int* scriptDialog = nullptr;
|
||||
|
||||
static const DWORD PutAwayWeapon[] = {
|
||||
0x411EA2, // action_climb_ladder_
|
||||
0x412046, // action_use_an_item_on_object_
|
||||
0x41224A, // action_get_an_object_
|
||||
0x4606A5, // intface_change_fid_animate_
|
||||
0x472996, // invenWieldFunc_
|
||||
};
|
||||
|
||||
static const DWORD script_dialog_msgs[] = {
|
||||
0x4A50C2, 0x4A5169, 0x4A52FA, 0x4A5302, 0x4A6B86, 0x4A6BE0, 0x4A6C37,
|
||||
};
|
||||
|
||||
static const DWORD walkDistanceAddr[] = {
|
||||
0x411FF0, 0x4121C4, 0x412475, 0x412906,
|
||||
};
|
||||
|
||||
static void __declspec(naked) WeaponAnimHook() {
|
||||
__asm {
|
||||
cmp edx, 11;
|
||||
@@ -72,88 +50,88 @@ c15:
|
||||
}
|
||||
|
||||
static void __declspec(naked) register_object_take_out_hack() {
|
||||
using namespace fo::Fields;
|
||||
__asm {
|
||||
push ecx
|
||||
push eax
|
||||
mov ecx, edx // ID1
|
||||
mov edx, [eax + 0x1C] // cur_rot
|
||||
inc edx
|
||||
push edx // ID3
|
||||
xor ebx, ebx // ID2
|
||||
mov edx, [eax + 0x20] // fid
|
||||
and edx, 0xFFF // Index
|
||||
xor eax, eax
|
||||
inc eax // Obj_Type
|
||||
call fo::funcoffs::art_id_
|
||||
xor ebx, ebx
|
||||
dec ebx
|
||||
xchg edx, eax
|
||||
pop eax
|
||||
call fo::funcoffs::register_object_change_fid_
|
||||
pop ecx
|
||||
xor eax, eax
|
||||
retn
|
||||
push ecx;
|
||||
push eax;
|
||||
mov ecx, edx; // ID1
|
||||
mov edx, [eax + rotation]; // cur_rot
|
||||
inc edx;
|
||||
push edx; // ID3
|
||||
xor ebx, ebx; // ID2
|
||||
mov edx, [eax + artFid]; // fid
|
||||
and edx, 0xFFF; // Index
|
||||
xor eax, eax;
|
||||
inc eax; // Obj_Type CRITTER
|
||||
call fo::funcoffs::art_id_;
|
||||
mov edx, eax;
|
||||
xor ebx, ebx;
|
||||
dec ebx; // delay -1
|
||||
pop eax; // critter
|
||||
call fo::funcoffs::register_object_change_fid_;
|
||||
pop ecx;
|
||||
xor eax, eax;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) gdAddOptionStr_hack() {
|
||||
__asm {
|
||||
mov ecx, ds:[FO_VAR_gdNumOptions]
|
||||
add ecx, '1'
|
||||
push ecx
|
||||
push 0x4458FA
|
||||
retn
|
||||
mov ecx, ds:[FO_VAR_gdNumOptions];
|
||||
add ecx, '1';
|
||||
push ecx;
|
||||
mov ecx, 0x4458FA;
|
||||
jmp ecx;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ScienceCritterCheckHook() {
|
||||
static void __declspec(naked) action_use_skill_on_hook_science() {
|
||||
using namespace fo;
|
||||
__asm {
|
||||
cmp esi, ds:[FO_VAR_obj_dude];
|
||||
jne end;
|
||||
mov eax, 10;
|
||||
mov eax, robot_type; // KillType
|
||||
retn;
|
||||
end:
|
||||
jmp fo::funcoffs::critter_kill_count_type_;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ReloadHook() {
|
||||
static void __declspec(naked) intface_item_reload_hook() {
|
||||
__asm {
|
||||
push eax;
|
||||
push ebx;
|
||||
push edx;
|
||||
mov eax, dword ptr ds:[FO_VAR_obj_dude];
|
||||
mov eax, dword ptr ds:[FO_VAR_obj_dude];
|
||||
call fo::funcoffs::register_clear_;
|
||||
xor eax, eax;
|
||||
inc eax;
|
||||
test eax, eax;
|
||||
jnz fail;
|
||||
inc eax;
|
||||
call fo::funcoffs::register_begin_;
|
||||
xor edx, edx;
|
||||
xor ebx, ebx;
|
||||
mov eax, dword ptr ds:[FO_VAR_obj_dude];
|
||||
dec ebx;
|
||||
xor edx, edx;
|
||||
xor ebx, ebx;
|
||||
mov eax, dword ptr ds:[FO_VAR_obj_dude];
|
||||
dec ebx;
|
||||
call fo::funcoffs::register_object_animate_;
|
||||
call fo::funcoffs::register_end_;
|
||||
pop edx;
|
||||
pop ebx;
|
||||
pop eax;
|
||||
jmp fo::funcoffs::gsound_play_sfx_file_;
|
||||
fail:
|
||||
pop eax;
|
||||
jmp fo::funcoffs::gsound_play_sfx_file_;
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD ScannerHookRet = 0x41BC1D;
|
||||
static const DWORD ScannerHookRet = 0x41BC1D;
|
||||
static const DWORD ScannerHookFail = 0x41BC65;
|
||||
static void __declspec(naked) ScannerAutomapHook() {
|
||||
static void __declspec(naked) automap_hack() {
|
||||
using fo::PID_MOTION_SENSOR;
|
||||
__asm {
|
||||
mov eax, ds:[FO_VAR_obj_dude];
|
||||
mov edx, PID_MOTION_SENSOR;
|
||||
mov eax, ds:[FO_VAR_obj_dude];
|
||||
mov edx, PID_MOTION_SENSOR;
|
||||
call fo::funcoffs::inven_pid_is_carried_ptr_;
|
||||
test eax, eax;
|
||||
jz fail;
|
||||
mov edx, eax;
|
||||
jmp ScannerHookRet;
|
||||
jz fail;
|
||||
mov edx, eax;
|
||||
jmp ScannerHookRet;
|
||||
fail:
|
||||
jmp ScannerHookFail;
|
||||
jmp ScannerHookFail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,12 +163,12 @@ static void __declspec(naked) display_stats_hook() {
|
||||
__asm {
|
||||
push eax;
|
||||
push ecx;
|
||||
mov ecx, ds:[esp + edi + 0xA8 + 0xC]; // get itemPtr
|
||||
call GetWeaponSlotMode; // ecx - itemPtr, edx - mode;
|
||||
mov edx, eax;
|
||||
pop ecx;
|
||||
pop eax;
|
||||
jmp fo::funcoffs::item_w_range_;
|
||||
mov ecx, ds:[esp + edi + 0xA8 + 0xC]; // get itemPtr
|
||||
call GetWeaponSlotMode; // ecx - itemPtr, edx - mode;
|
||||
mov edx, eax;
|
||||
pop ecx;
|
||||
pop eax;
|
||||
jmp fo::funcoffs::item_w_range_;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,19 +212,19 @@ static void __declspec(naked) switch_hand_hack() {
|
||||
__asm {
|
||||
pushfd;
|
||||
test ebx, ebx;
|
||||
jz skip;
|
||||
cmp ebx, edx;
|
||||
jz skip;
|
||||
jz skip;
|
||||
cmp ebx, edx;
|
||||
jz skip;
|
||||
push ecx;
|
||||
mov ecx, eax;
|
||||
mov ecx, eax;
|
||||
call SwapHandSlots;
|
||||
pop ecx;
|
||||
pop ecx;
|
||||
skip:
|
||||
popfd;
|
||||
jz end;
|
||||
jz end;
|
||||
retn;
|
||||
end:
|
||||
mov dword ptr [esp], 0x4715B7;
|
||||
mov dword ptr [esp], 0x4715B7;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
@@ -269,26 +247,21 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD EncounterTableSize[] = {
|
||||
0x4BD1A3, 0x4BD1D9, 0x4BD270, 0x4BD604, 0x4BDA14, 0x4BDA44, 0x4BE707,
|
||||
0x4C0815, 0x4C0D4A, 0x4C0FD4,
|
||||
};
|
||||
|
||||
void AdditionalWeaponAnimsPatch() {
|
||||
if (GetConfigInt("Misc", "AdditionalWeaponAnims", 0)) {
|
||||
dlog("Applying additional weapon animations patch.", DL_INIT);
|
||||
SafeWrite8(0x419320, 0x12);
|
||||
HookCall(0x4194CC, WeaponAnimHook);
|
||||
HookCall(0x451648, WeaponAnimHook);
|
||||
HookCall(0x451671, WeaponAnimHook);
|
||||
SafeWrite8(0x419320, 18); // art_get_code_
|
||||
HookCalls(WeaponAnimHook, {
|
||||
0x451648, 0x451671, // gsnd_build_character_sfx_name_
|
||||
0x4194CC // art_get_name_
|
||||
});
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
void SkilldexImagesPatch() {
|
||||
DWORD tmp;
|
||||
dlog("Checking for changed skilldex images.", DL_INIT);
|
||||
tmp = GetConfigInt("Misc", "Lockpick", 293);
|
||||
long tmp = GetConfigInt("Misc", "Lockpick", 293);
|
||||
if (tmp != 293) {
|
||||
SafeWrite32(0x518D54, tmp);
|
||||
}
|
||||
@@ -322,15 +295,19 @@ void SkilldexImagesPatch() {
|
||||
void ScienceOnCrittersPatch() {
|
||||
switch (GetConfigInt("Misc", "ScienceOnCritters", 0)) {
|
||||
case 1:
|
||||
HookCall(0x41276E, ScienceCritterCheckHook);
|
||||
HookCall(0x41276E, action_use_skill_on_hook_science);
|
||||
break;
|
||||
case 2:
|
||||
SafeWrite8(0x41276A, 0xeb);
|
||||
SafeWrite8(0x41276A, 0xEB);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BoostScriptDialogLimitPatch() {
|
||||
const DWORD script_dialog_msgs[] = {
|
||||
0x4A50C2, 0x4A5169, 0x4A52FA, 0x4A5302, 0x4A6B86, 0x4A6BE0, 0x4A6C37,
|
||||
};
|
||||
|
||||
if (GetConfigInt("Misc", "BoostScriptDialogLimit", 0)) {
|
||||
const int scriptDialogCount = 10000;
|
||||
dlog("Applying script dialog limit patch.", DL_INIT);
|
||||
@@ -338,9 +315,7 @@ void BoostScriptDialogLimitPatch() {
|
||||
SafeWrite32(0x4A50E3, scriptDialogCount); // scr_init
|
||||
SafeWrite32(0x4A519F, scriptDialogCount); // scr_game_init
|
||||
SafeWrite32(0x4A534F, scriptDialogCount * 8); // scr_message_free
|
||||
for (int i = 0; i < sizeof(script_dialog_msgs) / 4; i++) {
|
||||
SafeWrite32(script_dialog_msgs[i], (DWORD)scriptDialog); // scr_get_dialog_msg_file
|
||||
}
|
||||
SafeWriteBatch<DWORD>((DWORD)scriptDialog, script_dialog_msgs); // scr_get_dialog_msg_file
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
@@ -361,15 +336,21 @@ void NumbersInDialoguePatch() {
|
||||
}
|
||||
|
||||
void InstantWeaponEquipPatch() {
|
||||
const DWORD PutAwayWeapon[] = {
|
||||
0x411EA2, // action_climb_ladder_
|
||||
0x412046, // action_use_an_item_on_object_
|
||||
0x41224A, // action_get_an_object_
|
||||
0x4606A5, // intface_change_fid_animate_
|
||||
0x472996, // invenWieldFunc_
|
||||
};
|
||||
|
||||
if (GetConfigInt("Misc", "InstantWeaponEquip", 0)) {
|
||||
//Skip weapon equip/unequip animations
|
||||
dlog("Applying instant weapon equip patch.", DL_INIT);
|
||||
for (int i = 0; i < sizeof(PutAwayWeapon) / 4; i++) {
|
||||
SafeWrite8(PutAwayWeapon[i], 0xEB); // jmps
|
||||
}
|
||||
BlockCall(0x472AD5); //
|
||||
BlockCall(0x472AE0); // invenUnwieldFunc_
|
||||
BlockCall(0x472AF0); //
|
||||
SafeWriteBatch<BYTE>(0xEB, PutAwayWeapon); // jmps
|
||||
BlockCall(0x472AD5); //
|
||||
BlockCall(0x472AE0); // invenUnwieldFunc_
|
||||
BlockCall(0x472AF0); //
|
||||
MakeJump(0x415238, register_object_take_out_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
@@ -386,16 +367,15 @@ void DontTurnOffSneakIfYouRunPatch() {
|
||||
void PlayIdleAnimOnReloadPatch() {
|
||||
if (GetConfigInt("Misc", "PlayIdleAnimOnReload", 0)) {
|
||||
dlog("Applying idle anim on reload patch.", DL_INIT);
|
||||
HookCall(0x460B8C, ReloadHook);
|
||||
HookCall(0x460B8C, intface_item_reload_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionScannerFlagsPatch() {
|
||||
DWORD flags;
|
||||
if (flags = GetConfigInt("Misc", "MotionScannerFlags", 1)) {
|
||||
if (long flags = GetConfigInt("Misc", "MotionScannerFlags", 1)) {
|
||||
dlog("Applying MotionScannerFlags patch.", DL_INIT);
|
||||
if (flags & 1) MakeJump(0x41BBE9, ScannerAutomapHook);
|
||||
if (flags & 1) MakeJump(0x41BBE9, automap_hack);
|
||||
if (flags & 2) {
|
||||
// automap_
|
||||
SafeWrite16(0x41BC24, 0x9090);
|
||||
@@ -408,14 +388,17 @@ void MotionScannerFlagsPatch() {
|
||||
}
|
||||
|
||||
void EncounterTableSizePatch() {
|
||||
const DWORD EncounterTableSize[] = {
|
||||
0x4BD1A3, 0x4BD1D9, 0x4BD270, 0x4BD604, 0x4BDA14, 0x4BDA44, 0x4BE707,
|
||||
0x4C0815, 0x4C0D4A, 0x4C0FD4,
|
||||
};
|
||||
|
||||
DWORD tableSize = GetConfigInt("Misc", "EncounterTableSize", 0);
|
||||
if (tableSize > 40 && tableSize <= 127) {
|
||||
dlog("Applying EncounterTableSize patch.", DL_INIT);
|
||||
SafeWrite8(0x4BDB17, (BYTE)tableSize);
|
||||
DWORD nsize = (tableSize + 1) * 180 + 0x50;
|
||||
for (int i = 0; i < sizeof(EncounterTableSize) / 4; i++) {
|
||||
SafeWrite32(EncounterTableSize[i], nsize);
|
||||
}
|
||||
SafeWriteBatch<DWORD>(nsize, EncounterTableSize);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
@@ -439,13 +422,10 @@ void ObjCanSeeShootThroughPatch() {
|
||||
|
||||
static const char* musicOverridePath = "data\\sound\\music\\";
|
||||
void OverrideMusicDirPatch() {
|
||||
DWORD overrideMode;
|
||||
if (overrideMode = GetConfigInt("Sound", "OverrideMusicDir", 0)) {
|
||||
SafeWrite32(0x4449C2, (DWORD)musicOverridePath);
|
||||
SafeWrite32(0x4449DB, (DWORD)musicOverridePath);
|
||||
if (long overrideMode = GetConfigInt("Sound", "OverrideMusicDir", 0)) {
|
||||
SafeWriteBatch<DWORD>((DWORD)musicOverridePath, {0x4449C2, 0x4449DB});
|
||||
if (overrideMode == 2) {
|
||||
SafeWrite32(0x518E78, (DWORD)musicOverridePath);
|
||||
SafeWrite32(0x518E7C, (DWORD)musicOverridePath);
|
||||
SafeWriteBatch<DWORD>((DWORD)musicOverridePath, {0x518E78, 0x518E7C});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -474,7 +454,7 @@ void RemoveWindowRoundingPatch() {
|
||||
}
|
||||
|
||||
void InventoryCharacterRotationSpeedPatch() {
|
||||
DWORD setting = GetConfigInt("Misc", "SpeedInventoryPCRotation", 166);
|
||||
long setting = GetConfigInt("Misc", "SpeedInventoryPCRotation", 166);
|
||||
if (setting != 166 && setting <= 1000) {
|
||||
dlog("Applying SpeedInventoryPCRotation patch.", DL_INIT);
|
||||
SafeWrite32(0x47066B, setting);
|
||||
@@ -483,18 +463,20 @@ void InventoryCharacterRotationSpeedPatch() {
|
||||
}
|
||||
|
||||
void UIAnimationSpeedPatch() {
|
||||
DWORD addrs[2] = {0x45F9DE, 0x45FB33};
|
||||
DWORD addrs[] = {
|
||||
0x45F9DE, 0x45FB33,
|
||||
0x447DF4, 0x447EB6,
|
||||
0x499B99, 0x499DA8
|
||||
};
|
||||
SimplePatch<WORD>(addrs, 2, "Misc", "CombatPanelAnimDelay", 1000, 0, 65535);
|
||||
addrs[0] = 0x447DF4; addrs[1] = 0x447EB6;
|
||||
SimplePatch<BYTE>(addrs, 2, "Misc", "DialogPanelAnimDelay", 33, 0, 255);
|
||||
addrs[0] = 0x499B99; addrs[1] = 0x499DA8;
|
||||
SimplePatch<BYTE>(addrs, 2, "Misc", "PipboyTimeAnimDelay", 50, 0, 127);
|
||||
SimplePatch<BYTE>(&addrs[2], 2, "Misc", "DialogPanelAnimDelay", 33, 0, 255);
|
||||
SimplePatch<BYTE>(&addrs[4], 2, "Misc", "PipboyTimeAnimDelay", 50, 0, 127);
|
||||
}
|
||||
|
||||
void MusicInDialoguePatch() {
|
||||
if (GetConfigInt("Misc", "EnableMusicInDialogue", 0)) {
|
||||
dlog("Applying music in dialogue patch.", DL_INIT);
|
||||
SafeWrite8(0x44525B, 0x0);
|
||||
SafeWrite8(0x44525B, 0);
|
||||
//BlockCall(0x450627);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
@@ -523,7 +505,7 @@ void DisableHorriganPatch() {
|
||||
}
|
||||
|
||||
void DisplaySecondWeaponRangePatch() {
|
||||
if (GetConfigInt("Misc", "DisplaySecondWeaponRange", 1)) {
|
||||
if (GetConfigInt("Misc", "DisplaySecondWeaponRange", 1)) { // TODO: remove option?
|
||||
dlog("Applying display second weapon range patch.", DL_INIT);
|
||||
HookCall(0x472201, display_stats_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
@@ -581,7 +563,7 @@ void UseWalkDistancePatch() {
|
||||
int distance = GetConfigInt("Misc", "UseWalkDistance", 3) + 2;
|
||||
if (distance > 1 && distance < 5) {
|
||||
dlog("Applying walk distance for using objects patch.", DL_INIT);
|
||||
SafeWriteBatch<BYTE>(distance, walkDistanceAddr); // default is 5
|
||||
SafeWriteBatch<BYTE>(distance, {0x411FF0, 0x4121C4, 0x412475, 0x412906}); // default is 5
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
@@ -596,29 +578,24 @@ void F1EngineBehaviorPatch() {
|
||||
}
|
||||
|
||||
void MiscPatches::init() {
|
||||
mapName[64] = 0;
|
||||
if (GetConfigString("Misc", "StartingMap", "", mapName, 64)) {
|
||||
dlog("Applying starting map patch.", DL_INIT);
|
||||
SafeWrite32(0x480AAA, (DWORD)&mapName);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
versionString[64] = 0;
|
||||
if (GetConfigString("Misc", "VersionString", "", versionString, 64)) {
|
||||
dlog("Applying version string patch.", DL_INIT);
|
||||
SafeWrite32(0x4B4588, (DWORD)&versionString);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
configName[64] = 0;
|
||||
if (GetConfigString("Misc", "ConfigFile", "", configName, 64)) {
|
||||
dlog("Applying config file patch.", DL_INIT);
|
||||
SafeWrite32(0x444BA5, (DWORD)&configName);
|
||||
SafeWrite32(0x444BCA, (DWORD)&configName);
|
||||
SafeWriteBatch<DWORD>((DWORD)&configName, {0x444BA5, 0x444BCA});
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
patchName[64] = 0;
|
||||
if (GetConfigString("Misc", "PatchFile", "", patchName, 64)) {
|
||||
dlog("Applying patch file patch.", DL_INIT);
|
||||
SafeWrite32(0x444323, (DWORD)&patchName);
|
||||
@@ -640,8 +617,7 @@ void MiscPatches::init() {
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
int time = GetConfigInt("Misc", "CorpseDeleteTime", 6); // time in days
|
||||
if (time != 6) {
|
||||
if (int time = GetConfigInt("Misc", "CorpseDeleteTime", 6) != 6) { // time in days
|
||||
dlog("Applying corpse deletion time patch.", DL_INIT);
|
||||
if (time <= 0) {
|
||||
time = 12; // hours
|
||||
@@ -710,9 +686,7 @@ void MiscPatches::init() {
|
||||
}
|
||||
|
||||
void MiscPatches::exit() {
|
||||
if (scriptDialog != nullptr) {
|
||||
delete[] scriptDialog;
|
||||
}
|
||||
if (scriptDialog) delete[] scriptDialog;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,33 +26,29 @@
|
||||
namespace sfall
|
||||
{
|
||||
|
||||
static char startMaleModelName[65];
|
||||
char defaultMaleModelName[65];
|
||||
static char startFemaleModelName[65];
|
||||
char defaultFemaleModelName[65];
|
||||
static char startMaleModelName[65] = {};
|
||||
char defaultMaleModelName[65] = {};
|
||||
static char startFemaleModelName[65] = {};
|
||||
char defaultFemaleModelName[65] = {};
|
||||
|
||||
void PlayerModel::init() {
|
||||
startMaleModelName[64] = 0;
|
||||
if (GetConfigString("Misc", "MaleStartModel", "", startMaleModelName, 64)) {
|
||||
dlog("Applying male start model patch.", DL_INIT);
|
||||
SafeWrite32(0x418B88, (DWORD)&startMaleModelName);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
startFemaleModelName[64] = 0;
|
||||
if (GetConfigString("Misc", "FemaleStartModel", "", startFemaleModelName, 64)) {
|
||||
dlog("Applying female start model patch.", DL_INIT);
|
||||
SafeWrite32(0x418BAB, (DWORD)&startFemaleModelName);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
defaultMaleModelName[64] = 0;
|
||||
GetConfigString("Misc", "MaleDefaultModel", "hmjmps", defaultMaleModelName, 64);
|
||||
dlog("Applying male model patch.", DL_INIT);
|
||||
SafeWrite32(0x418B50, (DWORD)&defaultMaleModelName);
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
defaultFemaleModelName[64] = 0;
|
||||
GetConfigString("Misc", "FemaleDefaultModel", "hfjmps", defaultFemaleModelName, 64);
|
||||
dlog("Applying female model patch.", DL_INIT);
|
||||
SafeWrite32(0x418B6D, (DWORD)&defaultFemaleModelName);
|
||||
|
||||
Reference in New Issue
Block a user