mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added settings about the mirrored shades to tweaks.ini
Updated the description of Fallout1Behavior.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
[Main]
|
||||
|
||||
|
||||
[Items]
|
||||
;Override the PIDs of the standard healing drugs that AI will use in combat
|
||||
;Set to -1 if you don't want AI to identify this item as a healing drug
|
||||
@@ -11,3 +10,10 @@
|
||||
STIMPAK=40
|
||||
SUPER_STIMPAK=144
|
||||
HEALING_POWDER=273
|
||||
|
||||
;Overrides the PID of the item that grants a +1 stat bonus when placed in an active item slot
|
||||
;Default is 433. Set to -1 to prevent any item from granting the bonus
|
||||
MIRROR_SHADES_PID=433
|
||||
;The SPECIAL stat number (0..6) to which the bonus is applied
|
||||
;Default is 3 (Charisma). Set to -1 to disable the item's effect
|
||||
MIRROR_SHADES_STAT=3
|
||||
|
||||
+4
-4
@@ -270,10 +270,10 @@ XltKey=0
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Misc]
|
||||
;Changes some of Fallout 2 engine functions to Fallout 1 behavior:
|
||||
;- disables playing the final movie/credits after the endgame slideshow
|
||||
;- disables halving the weight for power armor items
|
||||
;- endgame_movie script function plays movie 10 or 11 based on the player's gender before the credits
|
||||
;- the initial in-game time is 7:21 rather than 8:24
|
||||
;- the final movie/credits are not played after the endgame slideshow
|
||||
;- the weight of power armor items is not halved
|
||||
;- the endgame_movie script function plays movie 10 or 11 based on the player's gender before the credits
|
||||
;- the initial in-game time is set to 7:21
|
||||
Fallout1Behavior=0
|
||||
|
||||
;Time limit in years. Must be between -3 and 13
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "..\main.h"
|
||||
#include "..\FalloutEngine\Fallout2.h"
|
||||
#include "..\Utils.h"
|
||||
|
||||
#include "..\Game\items.h"
|
||||
|
||||
@@ -26,6 +27,36 @@
|
||||
namespace sfall
|
||||
{
|
||||
|
||||
static long mirrorShadesPid = fo::PID_MIRROR_SHADES;
|
||||
static long mirrorShadesStat = fo::STAT_ch;
|
||||
|
||||
static long __fastcall MirrorShadesOverride(fo::GameObject* critter, long stat) {
|
||||
if (stat == mirrorShadesStat) {
|
||||
fo::GameObject* item = fo::func::inven_right_hand(critter);
|
||||
if (item && item->protoId == mirrorShadesPid) return 1;
|
||||
item = fo::func::inven_left_hand(critter);
|
||||
if (item && item->protoId == mirrorShadesPid) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __declspec(naked) void stat_level_hack_shades() {
|
||||
__asm {
|
||||
push ecx;
|
||||
mov ecx, ebx; // critter (always obj_dude)
|
||||
mov edx, esi; // stat
|
||||
call MirrorShadesOverride;
|
||||
pop ecx;
|
||||
test eax, eax;
|
||||
jz end;
|
||||
inc ecx; // stat value +1
|
||||
end: // overwritten engine code
|
||||
lea edi, [ecx + 1];
|
||||
test esi, esi;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
void EngineTweaks::init() {
|
||||
std::string tweaksFile = IniReader::GetConfigString("Misc", "TweaksFile", "");
|
||||
if (!tweaksFile.empty()) {
|
||||
@@ -35,6 +66,15 @@ void EngineTweaks::init() {
|
||||
game::Items::SetHealingPID(0, IniReader::GetInt("Items", "STIMPAK", fo::PID_STIMPAK, cTweaksFile));
|
||||
game::Items::SetHealingPID(1, IniReader::GetInt("Items", "SUPER_STIMPAK", fo::PID_SUPER_STIMPAK, cTweaksFile));
|
||||
game::Items::SetHealingPID(2, IniReader::GetInt("Items", "HEALING_POWDER", fo::PID_HEALING_POWDER, cTweaksFile));
|
||||
|
||||
mirrorShadesPid = IniReader::GetInt("Items", "MIRROR_SHADES_PID", fo::PID_MIRROR_SHADES, cTweaksFile);
|
||||
mirrorShadesStat = clamp<long>(IniReader::GetInt("Items", "MIRROR_SHADES_STAT", fo::STAT_ch, cTweaksFile), -1, fo::STAT_lu);
|
||||
if (mirrorShadesPid != fo::PID_MIRROR_SHADES || mirrorShadesStat != fo::STAT_ch) {
|
||||
MakeCall(0x4AF10A, stat_level_hack_shades);
|
||||
// Disable original handling
|
||||
SafeWrite8(0x4AF1C3, CodeType::Jump);
|
||||
SafeWrite32(0x4AF1C4, 487); // jmp 0x4AF3AF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -810,9 +810,9 @@ static void F1EngineBehaviorPatch() {
|
||||
if (IniReader::GetConfigInt("Misc", "Fallout1Behavior", 0)) {
|
||||
dlogr("Applying Fallout 1 engine behavior patch.", DL_INIT);
|
||||
BlockCall(0x4A4343); // disable playing the final movie/credits after the endgame slideshow
|
||||
SafeWrite8(0x477C71, CodeType::JumpShort); // disable halving the weight for power armor items
|
||||
SafeWrite8(0x477C71, CodeType::JumpShort); // disable halving the weight of power armor items
|
||||
HookCall(0x43F872, endgame_movie_hook); // play movie 10 or 11 based on the player's gender before the credits
|
||||
SafeWrite32(0x4A5201, 264600); // change the initial in-game time to 7:21
|
||||
SafeWrite32(0x4A5201, 264600); // set the initial in-game time to 7:21
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user