Fixed xp exploit from canceling Here and Now perk

(when the player has Swift Learner perk)

Removed DisplaySwiftLearnerExp from ddraw.ini (always enabled)
This commit is contained in:
NovaRain
2024-03-29 16:57:10 +08:00
parent 53f427fcac
commit b50dcaa151
3 changed files with 20 additions and 18 deletions
+13 -16
View File
@@ -160,7 +160,7 @@ UseScrollWheel=1
;Set to 0 to only ever scroll 1 click
ScrollMod=0
;Adjusts mouse sensitivity to some percentage of normal.
;Adjusts mouse sensitivity to some percentage of normal
;Negative values are valid if you want your mouse axis reversed for some reason
MouseSensitivity=100
@@ -311,7 +311,7 @@ FemaleDialogMsgs=0
;The text must be enclosed in angle brackets (example: <MaleText^FemaleText>)
DialogGenderWords=0
;To change the default and starting player models, uncomment the next four lines.
;To change the default and starting player models, uncomment the next four lines
;The default models can also be changed in-game via script
;MaleStartModel=hmwarr
;MaleDefaultModel=hmjmps
@@ -346,7 +346,7 @@ Movie17=credits.mve
;StartDay=-1
;To change the limit of the distance away from the player to which you're allowed to scroll the local maps, uncomment the next two lines
;Defaults are 480 in the x direction and 400 in the y direction.
;Defaults are 480 in the x direction and 400 in the y direction
;Does not work with the hi-res patch by Mash!
;LocalMapXLimit=480
;LocalMapYLimit=400
@@ -357,12 +357,12 @@ PipBoyAvailableAtGameStart=0
;Set to 1 to double the number of available kill types
;If you use this, you need to provide the extra descriptions in proto.msg (entries from 1450 to 1487 are names and 1488 to 1525 are descriptions)
;Changing this option mid game will not invalidate old save games, but the player's kill counters will be completely screwed.
;Changing this option mid game will not invalidate old save games, but the player's kill counters will be completely screwed
;Setting this to 1 may cause problems if the player kills more than 32767 of any one critter type
;Additional kill types must have their new critical tables set! (See the OverrideCriticalTable option)
ExtraKillTypes=0
;Choose the damage formula used to calculate combat damage.
;Choose the damage formula used to calculate combat damage
;Don't set this to anything other than 0 unless another mod you're using explicitly tells you to!
;0 - Fallout default
;1 - Glovz's Damage Fix
@@ -370,7 +370,7 @@ ExtraKillTypes=0
;5 - Haenlomal's Yet Another Ammo Mod
DamageFormula=0
;Prevents you from using 0 to escape from dialogue at any time.
;Prevents you from using 0 to escape from dialogue at any time
DialogueFix=1
;Prevents you from using number keys to enter unvisited areas on a town map
@@ -379,7 +379,7 @@ TownMapHotkeysFix=1
;Set to 1 to disable the Horrigan encounter
DisableHorrigan=0
;Set to 1 to disable the random element in NPC levelling.
;Set to 1 to disable the random element in NPC levelling
;This will cause all NPC party members to automatically level up as soon as the player reaches the requirements
NPCAutoLevel=0
@@ -401,7 +401,7 @@ OverrideArtCacheSize=0
;Set to 2 to block all saving in combat
SaveInCombatFix=1
;Uncomment and set a comma delimited list of numbers to use a custom xp table.
;Uncomment and set a comma delimited list of numbers to use a custom xp table
;Player's level is capped once the highest specified level is reached
;XPTable=50,100,200
@@ -460,8 +460,8 @@ EnableHeroAppearanceMod=0
;Set to 2 to also skip the splash screen
SkipOpeningMovies=0
;Causes NPCs who complete their combat turn with AP left over will try and find other ways to spend it.
;Only NPCs with AP left equal to or greater than the value given here will be considered.
;Causes NPCs who complete their combat turn with AP left over will try and find other ways to spend it
;Only NPCs with AP left equal to or greater than the value given here will be considered
;Set to 0 to disable
NPCsTryToSpendExtraAP=0
@@ -500,7 +500,7 @@ UseScrollingQuestsList=1
;PremadeFIDs=201,203,202
;Use this line to modify the list of cities and their associated global variables used for city reputations
;Syntax is 'city id:global id', with each city/global pair separated by a comma.
;Syntax is 'city id:global id', with each city/global pair separated by a comma
;CityRepsList=0:47,2:48,1:49,4:50,5:51,3:52,8:53,6:54,7:55,13:56,10:57,11:59,14:61,17:63,19:64,18:65,25:66,9:294,20:308
;Set this to a valid path to save a copy of the console contents
@@ -542,7 +542,7 @@ BoxBarCount=5
;The line must contain the same number of digits as the value of BoxBarCount, each either a 0 for green or 1 for red
;BoxBarColours=00000
;Set to 1 to fix the bug that caused bonus HtH damage to not be applied correctly.
;Set to 1 to fix the bug that caused bonus HtH damage to not be applied correctly
BonusHtHDamageFix=1
;Set to 1 to display additional points of damage from Bonus HtH/Ranged Damage perks in the inventory
@@ -605,7 +605,7 @@ DisablePipboyAlarm=0
;MainMenuCreditsOffsetX=0
;MainMenuCreditsOffsetY=0
;Prevents you from using super stims on a critter who is at full health.
;Prevents you from using super stims on a critter who is at full health
SuperStimExploitFix=0
;Change the AP cost for accessing inventory in combat, and the related effect of Quick Pockets perk
@@ -707,9 +707,6 @@ DeathScreenFontPatch=0
;Set to 1 to display full item description for weapon/ammo in the barter screen
FullItemDescInBarter=0
;Set to 1 to display experience points with the bonus from Swift Learner perk when gained from non-scripted situations
DisplaySwiftLearnerExp=1
;Set to 1 to display party member's current level/AC/addict flag on the combat control panel
PartyMemberExtraInfo=0
+1
View File
@@ -129,6 +129,7 @@
#define FO_VAR_gsound_background_fade 0x518E40
#define FO_VAR_gsound_initialized 0x518E30
#define FO_VAR_gsound_speech_tag 0x518E54
#define FO_VAR_hereAndNowExps 0x51C124
#define FO_VAR_hit_location_penalty 0x510954
#define FO_VAR_holo_flag 0x664529
#define FO_VAR_holodisk 0x6644F4
+6 -2
View File
@@ -1791,6 +1791,10 @@ static DWORD expSwiftLearner; // experience points for print
static void __declspec(naked) statPCAddExperienceCheckPMs_hack() {
__asm {
mov expSwiftLearner, edi;
cmp dword ptr [esp + 0x24 + 4], 0x496CAA + 5; // called from perk_add_effect_ (PERK_here_and_now)
jne notHereAndNow;
mov dword ptr ds:[FO_VAR_hereAndNowExps], edi;
notHereAndNow:
mov eax, dword ptr ds:[FO_VAR_Experience_pc];
retn;
}
@@ -3828,14 +3832,14 @@ void BugFixes::init() {
}
// Display experience points with the bonus from Swift Learner perk when gained from non-scripted situations
if (IniReader::GetConfigInt("Misc", "DisplaySwiftLearnerExp", 1)) {
//if (IniReader::GetConfigInt("Misc", "DisplaySwiftLearnerExp", 1)) {
dlogr("Applying Swift Learner exp display patch.", DL_FIX);
MakeCall(0x4AFAEF, statPCAddExperienceCheckPMs_hack);
HookCall(0x4221E2, combat_give_exps_hook);
MakeJump(0x4745AE, loot_container_exp_hack);
SafeWrite16(0x4C0AB1, 0x23EB); // jmps 0x4C0AD6
HookCall(0x4C0AEB, wmRndEncounterOccurred_hook);
}
//}
// Fix for obj_can_see_obj not checking if source and target objects are on the same elevation before calling
// is_within_perception_