mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added SmallFrameFix option
Code style edit: use !boolean instead of (boolean == false) for some checks.
This commit is contained in:
@@ -531,6 +531,9 @@ RemoveCriticalTimelimits=0
|
||||
;3 - Fallout 1 original behavior: -1 AP cost for all weapons; aimed attacks are disabled
|
||||
FastShotFix=1
|
||||
|
||||
;Set to 1 to fix the carry weight penalty of the Small Frame trait not being applied to bonus Strength points
|
||||
SmallFrameFix=0
|
||||
|
||||
;Set to 1 to boost the maximum number of script names from 1450 to 10000
|
||||
BoostScriptDialogLimit=0
|
||||
|
||||
|
||||
+2
-2
@@ -613,8 +613,8 @@ void Interface_Init() {
|
||||
}
|
||||
|
||||
// Corrects the height of the black background for death screen subtitles
|
||||
if (hrpIsEnabled == false) SafeWrite32(0x48134D, 38 - (640 * 3)); // main_death_scene_ (shift y-offset 2px up, w/o HRP)
|
||||
if (hrpIsEnabled == false || hrpVersionValid) SafeWrite8(0x481345, 4); // main_death_scene_
|
||||
if (!hrpIsEnabled) SafeWrite32(0x48134D, 38 - (640 * 3)); // main_death_scene_ (shift y-offset 2px up, w/o HRP)
|
||||
if (!hrpIsEnabled || hrpVersionValid) SafeWrite8(0x481345, 4); // main_death_scene_
|
||||
if (hrpVersionValid) SafeWrite8(HRPAddress(0x10011738), 10);
|
||||
|
||||
// Cosmetic fix for the background image of the character portrait on the player's inventory screen
|
||||
|
||||
+27
-17
@@ -935,11 +935,13 @@ static void PerkSetup() {
|
||||
|
||||
/////////////////////////// TRAIT FUNCTIONS ///////////////////////////////////
|
||||
|
||||
static bool smallFrameTraitFix = false;
|
||||
|
||||
static int __stdcall DudeGetBaseStat(DWORD statID) {
|
||||
return fo_stat_get_base_direct(*ptr_obj_dude, statID);
|
||||
}
|
||||
|
||||
static bool __stdcall CheckTrait(DWORD traitID) {
|
||||
static __forceinline bool __stdcall CheckTrait(DWORD traitID) {
|
||||
return (!disableTraits[traitID] && (ptr_pc_trait[0] == traitID || ptr_pc_trait[1] == traitID));
|
||||
}
|
||||
|
||||
@@ -947,8 +949,10 @@ static int __stdcall trait_adjust_stat_override(DWORD statID) {
|
||||
if (statID > STAT_max_derived) return 0;
|
||||
|
||||
int result = 0;
|
||||
if (ptr_pc_trait[0] != -1) result += traitStatBonuses[statID * TRAIT_count + ptr_pc_trait[0]];
|
||||
if (ptr_pc_trait[1] != -1) result += traitStatBonuses[statID * TRAIT_count + ptr_pc_trait[1]];
|
||||
if (traitsEnable) {
|
||||
if (ptr_pc_trait[0] != -1) result += traitStatBonuses[statID * TRAIT_count + ptr_pc_trait[0]];
|
||||
if (ptr_pc_trait[1] != -1) result += traitStatBonuses[statID * TRAIT_count + ptr_pc_trait[1]];
|
||||
}
|
||||
|
||||
switch (statID) {
|
||||
case STAT_st:
|
||||
@@ -985,8 +989,13 @@ static int __stdcall trait_adjust_stat_override(DWORD statID) {
|
||||
break;
|
||||
case STAT_carry_amt:
|
||||
if (CheckTrait(TRAIT_small_frame)) {
|
||||
int str = DudeGetBaseStat(STAT_st);
|
||||
result -= str * 10;
|
||||
int st;
|
||||
if (smallFrameTraitFix) {
|
||||
st = fo_stat_level(*ptr_obj_dude, STAT_st);
|
||||
} else {
|
||||
st = DudeGetBaseStat(STAT_st);
|
||||
}
|
||||
result -= st * 10;
|
||||
}
|
||||
break;
|
||||
case STAT_sequence:
|
||||
@@ -1025,15 +1034,13 @@ static void __declspec(naked) trait_adjust_stat_hack() {
|
||||
|
||||
static int __stdcall trait_adjust_skill_override(DWORD skillID) {
|
||||
int result = 0;
|
||||
if (ptr_pc_trait[0] != -1) {
|
||||
result += traitSkillBonuses[skillID * TRAIT_count + ptr_pc_trait[0]];
|
||||
}
|
||||
if (ptr_pc_trait[1] != -1) {
|
||||
result += traitSkillBonuses[skillID * TRAIT_count + ptr_pc_trait[1]];
|
||||
}
|
||||
if (CheckTrait(TRAIT_gifted)) {
|
||||
result -= 10;
|
||||
if (traitsEnable) {
|
||||
if (ptr_pc_trait[0] != -1) result += traitSkillBonuses[skillID * TRAIT_count + ptr_pc_trait[0]];
|
||||
if (ptr_pc_trait[1] != -1) result += traitSkillBonuses[skillID * TRAIT_count + ptr_pc_trait[1]];
|
||||
}
|
||||
|
||||
if (CheckTrait(TRAIT_gifted)) result -= 10;
|
||||
|
||||
if (CheckTrait(TRAIT_good_natured)) {
|
||||
if (skillID <= SKILL_THROWING) {
|
||||
result -= 10;
|
||||
@@ -1068,10 +1075,6 @@ static void PerkAndTraitSetup() {
|
||||
|
||||
if (!traitsEnable) return;
|
||||
|
||||
// Replace functions
|
||||
MakeJump(trait_adjust_stat_, trait_adjust_stat_hack); // 0x4B3C7C
|
||||
MakeJump(trait_adjust_skill_, trait_adjust_skill_hack); // 0x4B40FC
|
||||
|
||||
std::memcpy(traits, (void*)FO_VAR_trait_data, sizeof(TraitInfo) * TRAIT_count);
|
||||
|
||||
// _trait_data
|
||||
@@ -1404,6 +1407,13 @@ void PerksAcceptCharScreen() {
|
||||
}
|
||||
|
||||
void Perks_Init() {
|
||||
// Replace functions
|
||||
MakeJump(trait_adjust_stat_, trait_adjust_stat_hack); // 0x4B3C7C
|
||||
MakeJump(trait_adjust_skill_, trait_adjust_skill_hack); // 0x4B40FC
|
||||
|
||||
// Fix the carry weight penalty of the Small Frame trait not being applied to bonus Strength points
|
||||
smallFrameTraitFix = (GetConfigInt("Misc", "SmallFrameFix", 0) != 0);
|
||||
|
||||
FastShotTraitFix();
|
||||
|
||||
// Disable losing unused perks
|
||||
|
||||
@@ -1543,7 +1543,7 @@ static DWORD HandleTimedEventScripts() {
|
||||
|
||||
bool eventWasRunning = false;
|
||||
for (std::list<TimedEvent>::const_iterator timerIt = timerEventScripts.cbegin(); timerIt != timerEventScripts.cend(); ++timerIt) {
|
||||
if (timerIt->isActive == false) continue;
|
||||
if (!timerIt->isActive) continue;
|
||||
if (currentTime >= timerIt->time) {
|
||||
if (timedEvent) executeTimedEvents.push(timedEvent); // store a pointer to the currently running event
|
||||
|
||||
@@ -1570,7 +1570,7 @@ static DWORD HandleTimedEventScripts() {
|
||||
timedEvent = nullptr;
|
||||
// delete all previously executed events
|
||||
for (std::list<TimedEvent>::const_iterator it = timerEventScripts.cbegin(); it != timerEventScripts.cend();) {
|
||||
if (it->isActive == false) {
|
||||
if (!it->isActive) {
|
||||
dev_printf("\n[TimedEventScripts] Remove event: %d", it->time);
|
||||
it = timerEventScripts.erase(it);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user