Compare commits

..
14 Commits
Author SHA1 Message Date
NovaRain 4d0c056e72 Merge branch 'develop' 2017-12-24 21:35:52 +08:00
NovaRain d388a5c3bb Fixed player's base EMP DR isn't properly initialized when creating a new character and then starting the game. 2017-12-15 07:32:18 +08:00
NovaRain 9b808cd008 Changed sneak_success to call is_pc_sneak_working_ engine function, which takes player's current sneaking status into account as well, instead of only returning the result of last sneak attempt. 2017-12-05 10:22:35 +08:00
NovaRain fd91be7ea2 Replaced data type hex values with proper VAR_TYPE_* defines for code readability. 2017-12-03 23:54:39 +08:00
NovaRain 4fdd1d3cd8 Added missing entry of block_combat script function in opcode list. 2017-12-03 02:36:00 +08:00
NovaRain 9cb2d3df3e Added the damage type offset of weapon proto to define_extra.h. 2017-11-27 14:14:31 +08:00
NovaRain 08242d77d5 Fixed a typo in hookscripts.txt. 2017-11-27 12:24:22 +08:00
NovaRain 68d0a3e894 Changed the if condition for ProcessorIdle to make sure out-of-bounds values not resulting in unexpected but valid values (ref. commit 50c91db5ea) 2017-11-26 02:08:09 +08:00
NovaRain 16ff0e9ca6 Added a new example mod gl_autodoors (by Mr.Stalin) to modderspack. #19 2017-11-08 21:23:15 +08:00
NovaRain 218ba3004c Tweaked the way DebugMode works, now only DebugMode=2 sends debug output to a debug.log file. Any other non-0 value sends debug output to the screen. #123 2017-11-07 10:46:24 +08:00
NovaRain 8473ce5210 Replaced some SafeWrite* usages in old code with corresponding HookCall/MakeCall/MakeJump for code readability. 2017-11-06 15:13:05 +08:00
NovaRain 38a3dba476 Added description and define of display_stats to notes.txt and sfall.h. 2017-11-06 14:03:22 +08:00
NovaRain 9c1d439153 Added "display_stats" script function #113 2017-11-06 10:16:02 +08:00
NovaRain bc38a02508 Enabled mouse scroll control in barter and loot screens when the cursor is hovering over other lists, also enabled scrolling through the display monitor (from Crafty) #120
Rearraged the code style in dinput.cpp.
Updated version number.
2017-10-25 11:50:37 +08:00
37 changed files with 818 additions and 566 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.0.1
;v4.0.2
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -72,7 +72,7 @@ Use32BitHeadGraphics=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Input]
;Set to 1 to enable the mouse scroll wheel to scroll through your inventory
;Set to 1 to enable the mouse scroll wheel to scroll through inventory, barter, and loot screens
UseScrollWheel=1
;The mouse Z position is divided by this modifier to calculate the number of inventory
Binary file not shown.
@@ -0,0 +1,77 @@
/*
Auto Doors mod for Fallout 2 by Mr.Stalin
-----------------------------------------
- allows the player to automatically open/walk through unlocked doors when not in combat
Requires sfall 3.7b or higher
NOTE: this script requires compiler from sfall modderspack with -s option
(short circuit evaluation)
*/
#include "..\headers\define.h"
#include "..\headers\command.h"
#include "..\headers\sfall\sfall.h"
#include "..\headers\sfall\define_extra.h"
procedure start;
procedure map_enter_p_proc;
procedure set_door_flag(variable state);
procedure combatturn_handler;
#define PORTAL (0)
#define DOOR_FLAGS (0x24)
variable only_once := 0;
procedure start begin
if game_loaded then begin
if (sfall_ver_major >= 4) then
register_hook_proc(HOOK_COMBATTURN, combatturn_handler);
else
set_global_script_repeat(60);
call map_enter_p_proc;
end else begin
if (only_once == 1 and combat_is_initialized) then begin
only_once := 2;
call set_door_flag(false);
end else if (only_once == 2 and not(combat_is_initialized)) then begin
only_once := 1;
if (sfall_ver_major >= 4) then
set_global_script_repeat(0);
call set_door_flag(FLAG_WALKTHRU);
end
end
end
procedure map_enter_p_proc begin
only_once := 1;
call set_door_flag(FLAG_WALKTHRU);
end
procedure set_door_flag(variable state) begin
variable objectMap, obj, objPid, arrayPid, i;
objectMap := list_as_array(LIST_SCENERY);
arrayPid := temp_array(1, 0);
foreach (obj in objectMap) begin
objPid := obj_pid(obj);
if (proto_data(objPid, sc_type) != PORTAL) or is_in_array(objPid, arrayPid) then
continue;
arrayPid[i] := objPid;
i++;
resize_array(arrayPid, i + 1);
set_proto_data(objPid, DOOR_FLAGS, state);
end
end
procedure combatturn_handler begin
if (only_once == 1) then
set_global_script_repeat(60);
end
@@ -0,0 +1,9 @@
Auto Doors mod for Fallout 2 by Mr.Stalin
-----------------------------------------
- allows the player to automatically open/walk through unlocked doors when not in combat
Requires sfall 3.7b or higher.
To use, copy gl_autodoors.int to your scripts folder.
@@ -115,6 +115,7 @@
#define PROTO_WP_ANIM (36)
#define PROTO_WP_DMG_MIN (40)
#define PROTO_WP_DMG_MAX (44)
#define PROTO_WP_DMG_TYPE (48)
#define PROTO_WP_RANGE_1 (52)
#define PROTO_WP_RANGE_2 (56)
#define PROTO_WP_PROJ_PID (60)
+1
View File
@@ -211,6 +211,7 @@
#define car_gas_amount sfall_func0("car_gas_amount")
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
#define display_stats sfall_func0("display_stats")
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
#define get_cursor_mode sfall_func0("get_cursor_mode")
#define get_flags(obj) sfall_func1("get_flags", obj)
+1 -1
View File
@@ -309,7 +309,7 @@ Runs when retriving the damage rating of the players used weapon. (Which may be
int arg1 - The default min damage
int arg2 - The default max damage
Item arg3 - The weapin used. (0 if unarmed)
Item arg3 - The weapon used. (0 if unarmed)
Critter arg4 - The critter doing the attacking
int arg5 - The type of attack
int arg6 - non zero if this is an attack using a melee weapon
+6 -2
View File
@@ -299,8 +299,8 @@ Some utility/math functions are available:
- Additional game msg files added by ExtraGameMsgFileList setting will have consecutive fileIds assigned beginning from 0x2000. (e.g. if you set ExtraGameMsgFileList=foo,bar in ddraw.ini, foo.msg will be associated with 0x2000 and bar.msg with 0x2001.)
> int sneak_success
- returns 1 if last sneak attempt (roll against skill) was successful, 0 otherwise
- this is an internal engine variable wich is used to determine the perception range of critters (which you can override using HOOK_WITHINPERCEPTION)
- returns 1 if the player is currently sneaking, and last sneak attempt (roll against skill) was successful; 0 otherwise
- this calls an internal engine function which is used to determine the perception range of critters (which you can override using HOOK_WITHINPERCEPTION)
> int tile_light(int elevation, int tileNum)
- returns light intensity at the given tile in range from 0 to 65535
@@ -425,6 +425,10 @@ Some utility/math functions are available:
> void sfall_func1("set_cursor_mode", int mode)
- sets the current cursor mode
> void sfall_func0("display_stats")
- displays player stats in the inventory screen display window
- works only in opened inventory
------------------------
------ MORE INFO -------
------------------------
@@ -319,6 +319,7 @@
0x8248 - object get_last_target(object critter)
0x8249 - object get_last_attacker(object critter)
0x824a - void block_combat(int enable)
0x824b - int tile_under_cursor
0x824c - int gdialog_get_barter_mod
+1
View File
@@ -41,6 +41,7 @@ WRAP_WATCOM_FUNC1(Window*, GNW_find, long, winRef)
WRAP_WATCOM_FUNC0(long, intface_is_item_right_hand)
WRAP_WATCOM_FUNC0(void, intface_toggle_item_state)
WRAP_WATCOM_FUNC0(void, intface_use_item)
WRAP_WATCOM_FUNC0(long, is_pc_sneak_working)
WRAP_WATCOM_FUNC1(long, item_w_max_ammo, GameObject*, item)
WRAP_WATCOM_FUNC1(long, item_w_curr_ammo, GameObject*, item)
WRAP_WATCOM_FUNC1(long, item_weight, GameObject*, item)
+31 -18
View File
@@ -23,6 +23,7 @@
#include "main.h"
#include "Logging.h"
#include "FalloutEngine\Fallout2.h"
#include "Modules\Graphics.h"
#include "InputFuncs.h"
@@ -30,7 +31,7 @@
namespace sfall
{
static bool useScrollWheel;
bool useScrollWheel = true;
static DWORD wheelMod;
static bool reverseMouse;
@@ -131,21 +132,21 @@ void _stdcall TapKey(DWORD key) {
class FakeDirectInputDevice : public IDirectInputDeviceA {
private:
IDirectInputDeviceA* RealDevice;
DWORD DeviceType;
IDirectInputDeviceA* RealDevice;
DWORD DeviceType;
ULONG Refs;
bool formatLock;
DIDATAFORMAT oldFormat;
public:
/*** Constructor and misc functions ***/
FakeDirectInputDevice(IDirectInputDevice* device,DWORD type) {
RealDevice=device;
DeviceType=type;
Refs=1;
/*** Constructor and misc functions ***/
FakeDirectInputDevice(IDirectInputDevice* device,DWORD type) {
RealDevice = device;
DeviceType = type;
Refs = 1;
formatLock = false;
oldFormat.dwDataSize=0;
}
oldFormat.dwDataSize = 0;
}
/*** IUnknown methods ***/
HRESULT _stdcall QueryInterface(REFIID riid, LPVOID * ppvObj) {
@@ -220,13 +221,25 @@ public:
if (useScrollWheel) {
int count = 1;
if (MouseState.lZ > 0) {
if (wheelMod) count = MouseState.lZ / wheelMod;
if (count < 1) count = 1;
while (count--) TapKey(DIK_UP);
if (fo::var::gmouse_current_cursor == 2 || fo::var::gmouse_current_cursor == 3) {
__asm {
call fo::funcoffs::display_scroll_up_;
}
} else {
if (wheelMod) count = MouseState.lZ / wheelMod;
if (count < 1) count = 1;
while (count--) TapKey(DIK_UP);
}
} else if (MouseState.lZ < 0) {
if (wheelMod) count = (-MouseState.lZ) / wheelMod;
if (count < 1) count = 1;
while (count--) TapKey(DIK_DOWN);
if (fo::var::gmouse_current_cursor == 2 || fo::var::gmouse_current_cursor == 3) {
__asm {
call fo::funcoffs::display_scroll_down_;
}
} else {
if (wheelMod) count = (-MouseState.lZ) / wheelMod;
if (count < 1) count = 1;
while (count--) TapKey(DIK_DOWN);
}
}
}
if (middleMouseKey&&MouseState.rgbButtons[2]) {
@@ -323,7 +336,7 @@ public:
RealInput = Real; Refs = 1;
}
/*** IUnknown methods ***/
/*** IUnknown methods ***/
HRESULT _stdcall QueryInterface(REFIID riid, LPVOID* ppvObj) {
return RealInput->QueryInterface(riid, ppvObj);
}
@@ -347,7 +360,7 @@ public:
GUID GUID_SysMouse = { 0x6F1D2B60, 0xD5A0, 0x11CF, { 0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00} };
GUID GUID_SysKeyboard = { 0x6F1D2B61, 0xD5A0, 0x11CF, { 0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00} };
if (r != GUID_SysKeyboard&&r != GUID_SysMouse) {
if (r != GUID_SysKeyboard && r != GUID_SysMouse) {
return RealInput->CreateDevice(r, device, unused);
} else {
DWORD d;
+8 -1
View File
@@ -25,6 +25,8 @@
namespace sfall
{
extern bool useScrollWheel;
void SetMDown(bool down, bool right);
void SetMPos(int x, int y);
@@ -135,7 +137,7 @@ void GetMouse(int* x, int* y);
#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */
#define DIK_YEN 0x7D /* (Japanese keyboard) */
#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */
//#define DIK_CIRCUMFLEX 0x90 /* (Japanese keyboard) */
#define DIK_PREVTRACK 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */
#define DIK_AT 0x91 /* (NEC PC98) */
#define DIK_COLON 0x92 /* (NEC PC98) */
#define DIK_UNDERLINE 0x93 /* (NEC PC98) */
@@ -182,6 +184,11 @@ void GetMouse(int* x, int* y);
#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */
#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */
/*
* Alternate names for keys originally not used on US keyboards.
*/
#define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */
void _stdcall ForceGraphicsRefresh(DWORD);
}
+4 -4
View File
@@ -915,8 +915,8 @@ public:
};
HRESULT _stdcall FakeDirectDrawCreate2_graphics(void*, IDirectDraw** b, void*) {
ResWidth = *(DWORD*)0x004CAD6B;
ResHeight = *(DWORD*)0x004CAD66;
ResWidth = *(DWORD*)0x4CAD6B;
ResHeight = *(DWORD*)0x4CAD66;
if (!d3d9) {
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
@@ -995,14 +995,14 @@ void Graphics::init() {
} else {
FreeLibrary(h);
}
SafeWrite8(0x0050FB6B, '2');
SafeWrite8(0x50FB6B, '2');
dlogr(" Done", DL_INIT);
#undef _DLL_NAME
}
fadeMulti = GetConfigInt("Graphics", "FadeMultiplier", 100);
if (fadeMulti != 100) {
dlog("Applying fade patch.", DL_INIT);
SafeWrite32(0x00493B17, ((DWORD)&FadeHook) - 0x00493B1b);
HookCall(0x493B16, &FadeHook);
fadeMulti = ((double)fadeMulti) / 100.0;
dlogr(" Done", DL_INIT);
}
+127
View File
@@ -585,6 +585,126 @@ end:
}
}
static void __declspec(naked) loot_container_hack2() {
__asm {
cmp esi, 0x150 // source_down
je scroll
cmp esi, 0x148 // source_up
jne end
scroll:
push edx
push ecx
push ebx
mov eax, ds:[FO_VAR_i_wid]
call fo::funcoffs::GNW_find_
mov ebx, [eax+0x8+0x0] // ebx = _i_wid.rect.x
mov ecx, [eax+0x8+0x4] // ecx = _i_wid.rect.y
mov eax, 297
add eax, ebx // x_start
add ebx, 297+64 // x_end
mov edx, 37
add edx, ecx // y_start
add ecx, 37+6*48 // y_end
call fo::funcoffs::mouse_click_in_
pop ebx
pop ecx
pop edx
test eax, eax
jz end
cmp esi, 0x150 // source_down
je targetDown
mov esi, 0x18D // target_up
jmp end
targetDown:
mov esi, 0x191 // target_down
end:
mov eax, ds:[FO_VAR_curr_stack]
retn
}
}
static void __declspec(naked) barter_inventory_hack2() {
__asm {
push edx
push ecx
push ebx
xchg esi, eax
cmp esi, 0x150 // source_down
je scroll
cmp esi, 0x148 // source_up
jne end
scroll:
mov eax, ds:[FO_VAR_i_wid]
call fo::funcoffs::GNW_find_
mov ebx, [eax+0x8+0x0] // ebx = _i_wid.rect.x
mov ecx, [eax+0x8+0x4] // ecx = _i_wid.rect.y
push ebx
push ecx
mov eax, 395
add eax, ebx // x_start
add ebx, 395+64 // x_end
mov edx, 35
add edx, ecx // y_start
add ecx, 35+3*48 // y_end
call fo::funcoffs::mouse_click_in_
pop ecx
pop ebx
test eax, eax
jz notTargetScroll
cmp esi, 0x150 // source_down
je targetDown
mov esi, 0x18D // target_up
jmp end
targetDown:
mov esi, 0x191 // target_down
jmp end
notTargetScroll:
push ebx
push ecx
mov eax, 250
add eax, ebx // x_start
add ebx, 250+64 // x_end
mov edx, 20
add edx, ecx // y_start
add ecx, 20+3*48 // y_end
call fo::funcoffs::mouse_click_in_
pop ecx
pop ebx
test eax, eax
jz notTargetBarter
cmp esi, 0x150 // source_down
je barterTargetDown
mov esi, 0x184 // target_barter_up
jmp end
barterTargetDown:
mov esi, 0x176 // target_barter_down
jmp end
notTargetBarter:
mov eax, 165
add eax, ebx // x_start
add ebx, 165+64 // x_end
mov edx, 20
add edx, ecx // y_start
add ecx, 20+3*48 // y_end
call fo::funcoffs::mouse_click_in_
test eax, eax
jz end
cmp esi, 0x150 // source_down
je barterSourceDown
mov esi, 0x149 // source_barter_up
jmp end
barterSourceDown:
mov esi, 0x151 // source_barter_down
end:
pop ebx
pop ecx
pop edx
mov eax, esi
cmp eax, 0x11
retn
}
}
int __stdcall ItemCountFixStdcall(fo::GameObject* who, fo::GameObject* item) {
int count = 0;
for (int i = 0; i < who->invenSize; i++) {
@@ -753,6 +873,13 @@ void Inventory::init() {
// Move items to player's main inventory instead of the opened bag/backpack when confirming a trade
SafeWrite32(0x475CF2, FO_VAR_stack);
// Enable mouse scroll control in barter and loot screens when the cursor is hovering over other lists
if (useScrollWheel) {
MakeCall(0x473E66, loot_container_hack2);
MakeCall(0x4759F1, barter_inventory_hack2);
fo::var::max = 100;
};
// Fix item_count function returning incorrect value when there is a container-item inside
MakeJump(0x47808C, ItemCountFix); // replacing item_count_ function
}
+10 -10
View File
@@ -75,24 +75,24 @@ void KillCounterInit(bool use) {
usingExtraKillTypes = 1;
//Overwrite the function that reads the kill counter with my own
SafeWrite32(0x004344C0, ((DWORD)&ReadKillCounter) - 0x004344C4);
SafeWrite32(0x0043A163, ((DWORD)&ReadKillCounter) - 0x0043A167);
SafeWrite32(0x004571D9, ((DWORD)&ReadKillCounter) - 0x004571DD);
HookCall(0x4344BF, &ReadKillCounter);
HookCall(0x43A162, &ReadKillCounter);
HookCall(0x4571D8, &ReadKillCounter);
//Overwrite the function that increments the kill counter with my own
SafeWrite32(0x00425145, ((DWORD)&IncKillCounter) - 0x00425149);
HookCall(0x425144, &IncKillCounter);
//Edit the GetKillTypeName function to accept kill types over 0x13
SafeWrite8(0x0042D980, 38);
SafeWrite8(0x0042D990, 38);
SafeWrite8(0x42D980, 38);
SafeWrite8(0x42D990, 38);
//And the same for GetKillTypeDesc
SafeWrite8(0x0042D9C0, 38);
SafeWrite8(0x0042D9D0, 38);
SafeWrite32(0x0042D9DD, 1488);
SafeWrite8(0x42D9C0, 38);
SafeWrite8(0x42D9D0, 38);
SafeWrite32(0x42D9DD, 1488);
//Change char sheet to loop through the extra kill types
SafeWrite8(0x004344E4, 38);
SafeWrite8(0x4344E4, 38);
}
void KillCounter::init() {
+1 -1
View File
@@ -80,7 +80,7 @@ static DWORD _stdcall CalcKnockback(int flags, int damage, DWORD target, DWORD a
return (DWORD)floor(result);
}
static const DWORD KnockbackRetAddr=0x00424B85;
static const DWORD KnockbackRetAddr=0x424B85;
static void __declspec(naked) KnockbackHook() {
__asm {
mov ecx, [esp+0x14];
+8
View File
@@ -152,6 +152,13 @@ end:
}
}
static void __declspec(naked) SetPCBaseStatEMP() {
__asm {
mov ds:[29*4 + 0x51C394], 100; // set_pc_base_stat(STAT_dmg_resist_emp, 100)
retn;
}
}
// Called right before savegame slot is being loaded
static void _stdcall LoadGame_Before() {
onBeforeGameStart.invoke();
@@ -457,6 +464,7 @@ static void __declspec(naked) AutomapHook() {
}
void LoadGameHook::init() {
LoadGameHook::OnAfterGameStarted() += SetPCBaseStatEMP;
saveInCombatFix = GetConfigInt("Misc", "SaveInCombatFix", 1);
if (saveInCombatFix > 2) saveInCombatFix = 0;
saveFailMsg = Translate("sfall", "SaveInCombat", "Cannot save at this time");
+25 -25
View File
@@ -376,18 +376,18 @@ void DebugModePatch() {
if (dbgMode) {
dlog("Applying debugmode patch.", DL_INIT);
//If the player is using an exe with the debug patch already applied, just skip this block without erroring
if (*((DWORD*)0x00444A64) != 0x082327e8) {
SafeWrite32(0x00444A64, 0x082327e8);
SafeWrite32(0x00444A68, 0x0120e900);
SafeWrite8(0x00444A6D, 0);
SafeWrite32(0x00444A6E, 0x90909090);
if (*((DWORD*)0x444A64) != 0x082327E8) {
SafeWrite32(0x444A64, 0x082327E8); // call debug_register_env_
SafeWrite32(0x444A68, 0x0120E900); // jmp 0x444B8E
SafeWrite8(0x444A6D, 0);
SafeWrite32(0x444A6E, 0x90909090);
}
SafeWrite8(0x004C6D9B, 0xb8);
if (dbgMode == 1) {
SafeWrite32(0x004C6D9C, (DWORD)debugGnw);
SafeWrite8(0x4C6D9B, 0xB8); // mov eax, GNW/LOG
if (dbgMode == 2) {
SafeWrite32(0x4C6D9C, (DWORD)debugLog);
}
else {
SafeWrite32(0x004C6D9C, (DWORD)debugLog);
SafeWrite32(0x4C6D9C, (DWORD)debugGnw);
}
dlogr(" Done", DL_INIT);
}
@@ -412,8 +412,8 @@ void NpcAutoLevelPatch() {
if (GetConfigInt("Misc", "OverrideArtCacheSize", 0)) {
dlog("Applying override art cache size patch.", DL_INIT);
SafeWrite32(0x00418867, 0x90909090);
SafeWrite32(0x00418872, 256);
SafeWrite32(0x418867, 0x90909090);
SafeWrite32(0x418872, 256);
dlogr(" Done", DL_INIT);
}
}
@@ -434,31 +434,31 @@ void SkilldexImagesPatch() {
dlog("Checking for changed skilldex images.", DL_INIT);
tmp = GetConfigInt("Misc", "Lockpick", 293);
if (tmp != 293) {
SafeWrite32(0x00518D54, tmp);
SafeWrite32(0x518D54, tmp);
}
tmp = GetConfigInt("Misc", "Steal", 293);
if (tmp != 293) {
SafeWrite32(0x00518D58, tmp);
SafeWrite32(0x518D58, tmp);
}
tmp = GetConfigInt("Misc", "Traps", 293);
if (tmp != 293) {
SafeWrite32(0x00518D5C, tmp);
SafeWrite32(0x518D5C, tmp);
}
tmp = GetConfigInt("Misc", "FirstAid", 293);
if (tmp != 293) {
SafeWrite32(0x00518D4C, tmp);
SafeWrite32(0x518D4C, tmp);
}
tmp = GetConfigInt("Misc", "Doctor", 293);
if (tmp != 293) {
SafeWrite32(0x00518D50, tmp);
SafeWrite32(0x518D50, tmp);
}
tmp = GetConfigInt("Misc", "Science", 293);
if (tmp != 293) {
SafeWrite32(0x00518D60, tmp);
SafeWrite32(0x518D60, tmp);
}
tmp = GetConfigInt("Misc", "Repair", 293);
if (tmp != 293) {
SafeWrite32(0x00518D64, tmp);
SafeWrite32(0x518D64, tmp);
}
dlogr(" Done", DL_INIT);
}
@@ -677,7 +677,7 @@ void OverrideMusicDirPatch() {
void DialogueFix() {
if (GetConfigInt("Misc", "DialogueFix", 1)) {
dlog("Applying dialogue patch.", DL_INIT);
SafeWrite8(0x00446848, 0x31);
SafeWrite8(0x446848, 0x31);
dlogr(" Done", DL_INIT);
}
}
@@ -685,7 +685,7 @@ void DialogueFix() {
void DontDeleteProtosPatch() {
if (isDebug && GetPrivateProfileIntA("Debugging", "DontDeleteProtos", 0, ".\\ddraw.ini")) {
dlog("Applying permanent protos patch.", DL_INIT);
SafeWrite8(0x48007E, 0xeb);
SafeWrite8(0x48007E, 0xEB);
dlogr(" Done", DL_INIT);
}
}
@@ -758,29 +758,29 @@ void MiscPatches::init() {
mapName[64] = 0;
if (GetConfigString("Misc", "StartingMap", "", mapName, 64)) {
dlog("Applying starting map patch.", DL_INIT);
SafeWrite32(0x00480AAA, (DWORD)&mapName);
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(0x004B4588, (DWORD)&versionString);
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(0x00444BA5, (DWORD)&configName);
SafeWrite32(0x00444BCA, (DWORD)&configName);
SafeWrite32(0x444BA5, (DWORD)&configName);
SafeWrite32(0x444BCA, (DWORD)&configName);
dlogr(" Done", DL_INIT);
}
patchName[64] = 0;
if (GetConfigString("Misc", "PatchFile", "", patchName, 64)) {
dlog("Applying patch file patch.", DL_INIT);
SafeWrite32(0x00444323, (DWORD)&patchName);
SafeWrite32(0x444323, (DWORD)&patchName);
dlogr(" Done", DL_INIT);
}
+40 -38
View File
@@ -77,7 +77,7 @@ static const DWORD GainStatPerks[7][2] = {
};
void _stdcall SetPerkFreq(int i) {
PerkFreqOverride=i;
PerkFreqOverride = i;
}
static DWORD _stdcall IsTraitDisabled(int id) {
@@ -136,15 +136,15 @@ void _stdcall RestoreDefaultPerks() {
void _stdcall SetPerkboxTitle(char* name) {
if (name[0] == '\0') {
SafeWrite32(0x0043C77D, 0x488cb);
SafeWrite32(0x43C77D, 0x488CB);
} else {
strcpy_s(PerkBoxTitle, name);
HookCall(0x0043C77C, GetPerkBoxTitleHook);
HookCall(0x43C77C, GetPerkBoxTitleHook);
}
}
void _stdcall SetSelectablePerk(char* name, int level, int image, char* desc) {
if (level < 0 || level>1) return;
if (level < 0 || level > 1) return;
if (level == 0) {
for (DWORD i = 0; i < fakeSelectablePerks.size(); i++) {
if (!strcmp(name, fakeSelectablePerks[i].Name)) {
@@ -172,7 +172,7 @@ void _stdcall SetSelectablePerk(char* name, int level, int image, char* desc) {
}
void _stdcall SetFakePerk(char* name, int level, int image, char* desc) {
if (level < 0 || level>100) return;
if (level < 0 || level > 100) return;
if (level == 0) {
for (DWORD i = 0; i < fakePerks.size(); i++) {
if (!strcmp(name, fakePerks[i].Name)) {
@@ -200,7 +200,7 @@ void _stdcall SetFakePerk(char* name, int level, int image, char* desc) {
}
void _stdcall SetFakeTrait(char* name, int level, int image, char* desc) {
if (level < 0 || level>1) return;
if (level < 0 || level > 1) return;
if (level == 0) {
for (DWORD i = 0; i < fakeTraits.size(); i++) {
if (!strcmp(name, fakeTraits[i].Name)) {
@@ -613,24 +613,24 @@ lower:
}
void _stdcall ApplyHeaveHoFix() {
SafeWrite8(0x478AC4, 0xe9);
SafeWrite8(0x478AC4, 0xE9);
HookCall(0x478AC4, HeaveHoHook);
perks[PERK_heave_ho].strengthMin = 0;
}
static void PerkSetup() {
//Character screen
HookCall(0x00434256, PlayerHasTraitHook);
SafeWrite8(0x0043436B, 0xe9);
HookCall(0x0043436B, PlayerHasPerkHook);
HookCall(0x004343AC, GetPerkLevelHook);
HookCall(0x004343C1, GetPerkNameHook);
HookCall(0x004343DF, GetPerkNameHook);
HookCall(0x0043440D, GetPerkImageHook);
HookCall(0x0043441B, GetPerkNameHook);
HookCall(0x00434432, GetPerkDescHook);
SafeWrite8(0x0043443D, 0xe9);
HookCall(0x0043443D, EndPerkLoopHook);
HookCall(0x434256, PlayerHasTraitHook);
SafeWrite8(0x43436B, 0xE9);
HookCall(0x43436B, PlayerHasPerkHook);
HookCall(0x4343AC, GetPerkLevelHook);
HookCall(0x4343C1, GetPerkNameHook);
HookCall(0x4343DF, GetPerkNameHook);
HookCall(0x43440D, GetPerkImageHook);
HookCall(0x43441B, GetPerkNameHook);
HookCall(0x434432, GetPerkDescHook);
SafeWrite8(0x43443D, 0xE9);
HookCall(0x43443D, EndPerkLoopHook);
//GetPlayerAvailablePerks
HookCall(0x43D127, GetAvailablePerksHook);
@@ -638,8 +638,8 @@ static void PerkSetup() {
HookCall(0x43D25E, GetPerkSLevelHook);
HookCall(0x43D275, GetPerkSLevelHook);
//ShowPerkBox
HookCall(0x0043C82E, GetPerkSLevelHook);
HookCall(0x0043C85B, GetPerkSLevelHook);
HookCall(0x43C82E, GetPerkSLevelHook);
HookCall(0x43C85B, GetPerkSLevelHook);
HookCall(0x43C888, GetPerkSDescHook);
HookCall(0x43C8A6, GetPerkSNameHook);
HookCall(0x43C8D1, GetPerkSDescHook);
@@ -659,15 +659,15 @@ static void PerkSetup() {
memset(Desc, 0, sizeof(Desc));
memcpy(perks, var::perk_data, sizeof(PerkInfo) * PERK_count);
SafeWrite32(0x00496669, (DWORD)perks);
SafeWrite32(0x00496837, (DWORD)perks);
SafeWrite32(0x00496BAD, (DWORD)perks);
SafeWrite32(0x00496C41, (DWORD)perks);
SafeWrite32(0x00496D25, (DWORD)perks);
SafeWrite32(0x00496696, (DWORD)perks + 4);
SafeWrite32(0x00496BD1, (DWORD)perks + 4);
SafeWrite32(0x00496BF5, (DWORD)perks + 8);
SafeWrite32(0x00496AD4, (DWORD)perks + 12);
SafeWrite32(0x496669, (DWORD)perks);
SafeWrite32(0x496837, (DWORD)perks);
SafeWrite32(0x496BAD, (DWORD)perks);
SafeWrite32(0x496C41, (DWORD)perks);
SafeWrite32(0x496D25, (DWORD)perks);
SafeWrite32(0x496696, (DWORD)perks + 4);
SafeWrite32(0x496BD1, (DWORD)perks + 4);
SafeWrite32(0x496BF5, (DWORD)perks + 8);
SafeWrite32(0x496AD4, (DWORD)perks + 12);
if (strlen(perksFile)) {
char num[4];
@@ -734,11 +734,11 @@ static void PerkSetup() {
SafeWrite8(0x43C2EC, 0xEB); //skip the block of code which checks if the player has gained a perk (now handled in level up code)
SafeWrite8(0x43C362, 0xe8); //call sub_43401C, dec byte ptr ds:[0x00570A29]
SafeWrite32(0x43C363, 0x0043410C - 0x0043C367); //replaces call sub_43401C, mov byte ptr ds:[0x00570A29], 0
SafeWrite8(0x43C367, 0x3e);
SafeWrite16(0x43C368, 0x0dfe);
SafeWrite32(0x43C36a, 0x00570A29);
SafeWrite8(0x43C362, 0xE8); //call sub_43401C, dec byte ptr ds:[0x570A29]
SafeWrite32(0x43C363, 0x43410C - 0x43C367); //replaces call sub_43401C, mov byte ptr ds:[0x570A29], 0
SafeWrite8(0x43C367, 0x3E);
SafeWrite16(0x43C368, 0x0DFE);
SafeWrite32(0x43C36A, 0x00570A29);
SafeWrite8(0x43C36e, 0x90);
}
@@ -884,7 +884,9 @@ static void TraitSetup() {
char* num2 = &num[1];
for (int i = 0; i < TRAIT_count; i++) {
_itoa_s(i, num2, 4, 10);
if (GetPrivateProfileString(num, "Name", "", &tName[i * 64], 63, perksFile)) traits[i].name = &tName[i * 64];
if (GetPrivateProfileString(num, "Name", "", &tName[i * 64], 63, perksFile)) {
traits[i].name = &tName[i * 64];
}
if (GetPrivateProfileString(num, "Desc", "", &tDesc[i * 1024], 1023, perksFile)) {
traits[i].description = &tDesc[i * 1024];
}
@@ -1006,10 +1008,10 @@ void PerksReset() {
fakeTraits.clear();
fakePerks.clear();
fakeSelectablePerks.clear();
SafeWrite32(0x0043C77D, 0x488cb);
SafeWrite32(0x43C77D, 0x488CB);
IgnoringDefaultPerks = 0;
addPerkMode = 2;
SafeWrite8(0x478AC4, 0xba);
SafeWrite8(0x478AC4, 0xBA);
SafeWrite32(0x478AC5, 0x23);
PerkFreqOverride = 0;
}
@@ -1086,7 +1088,7 @@ DWORD _stdcall HasFakeTrait(char* name) {
void _stdcall ClearSelectablePerks() {
fakeSelectablePerks.clear();
addPerkMode = 2;
SafeWrite32(0x0043C77D, 0x488cb);
SafeWrite32(0x43C77D, 0x488CB);
IgnoringDefaultPerks = 0;
}
+4 -4
View File
@@ -35,27 +35,27 @@ void PlayerModel::init() {
startMaleModelName[64] = 0;
if (GetConfigString("Misc", "MaleStartModel", "", startMaleModelName, 64)) {
dlog("Applying male start model patch.", DL_INIT);
SafeWrite32(0x00418B88, (DWORD)&startMaleModelName);
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(0x00418BAB, (DWORD)&startFemaleModelName);
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(0x00418B50, (DWORD)&defaultMaleModelName);
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(0x00418B6D, (DWORD)&defaultFemaleModelName);
SafeWrite32(0x418B6D, (DWORD)&defaultFemaleModelName);
dlogr(" Done", DL_INIT);
}

Some files were not shown because too many files have changed in this diff Show More