Some edits to YAAM code

Changed OverrideArtCacheSize to set the art cache size to 261.
Fixed typo in ddraw.ini.
This commit is contained in:
NovaRain
2021-10-27 22:02:09 +08:00
parent a533943200
commit 53278a090b
4 changed files with 20 additions and 21 deletions
+2 -2
View File
@@ -372,7 +372,7 @@ ViewYPos=-1
;Set to 1 to force Fallout not to use multiple processor cores even if they are available
SingleCore=1
;Set to 1 to override the art_chache_size setting in fallout2.cfg
;Set to 1 to override the art_cache_size setting in fallout2.cfg
OverrideArtCacheSize=0
;Prevents you from saving in combat except at the start of your turn to avoid a few bugs
@@ -659,7 +659,7 @@ ArraysBehavior=1
;Set to 1 to add proper check for ammo before attacking and proper calculation of the number of burst rounds
;By default, weapons can make attacks when at least one ammo is left, regardless of ammo cost calculations
;Note that enabling this option will prevent super cattle prods and mega power fists from attacking if there is only one ammo left
;Note that enabling this option will prevent super cattle prods and mega power fists from attacking with only one ammo left
CheckWeaponAmmoCost=0
;Controls the speed of combat panel animations (lower - faster; valid range: 0..65535)
+16 -17
View File
@@ -113,56 +113,55 @@ void DamageMod::DamageGlovz(fo::ComputeAttackResult &ctd, DWORD &accumulatedDama
}
}
// YAAM
void DamageMod::DamageYAAM(fo::ComputeAttackResult &ctd, DWORD &accumulatedDamage, int rounds, int armorDT, int armorDR, int bonusRangedDamage,int multiplyDamage, int difficulty) {
int ammoDiv = fo::func::item_w_dam_div(ctd.weapon); // Retrieve Ammo Divisor
int ammoMult = fo::func::item_w_dam_mult(ctd.weapon); // Retrieve Ammo Dividend
// YAAM v1.1a by Haenlomal 2010.05.13
void DamageMod::DamageYAAM(fo::ComputeAttackResult &ctd, DWORD &accumulatedDamage, long rounds, long armorDT, long armorDR, long bonusRangedDamage, long multiplyDamage, long difficulty) {
if (rounds <= 0) return;
long ammoDiv = fo::func::item_w_dam_div(ctd.weapon); // Retrieve Ammo Divisor
long ammoMult = fo::func::item_w_dam_mult(ctd.weapon); // Retrieve Ammo Dividend
multiplyDamage *= ammoMult; // Damage Multipler = Critical Multipler * Ammo Dividend
int ammoDivisor = 1 * ammoDiv; // Ammo Divisor = 1 * Ammo Divisor
int ammoDT = fo::func::item_w_dr_adjust(ctd.weapon); // Retrieve ammo DT (well, it's really Retrieve ammo DR, but since we're treating ammo DR as ammo DT...)
long ammoDT = fo::func::item_w_dr_adjust(ctd.weapon); // Retrieve ammo DT (well, it's really Retrieve ammo DR, but since we're treating ammo DR as ammo DT...)
// Start of damage calculation loop
for (int i = 0; i < rounds; i++) { // Check number of hits
int rawDamage = fo::func::item_w_damage(ctd.attacker, ctd.hitMode); // Retrieve Raw Damage
for (long i = 0; i < rounds; i++) { // Check number of hits
long rawDamage = fo::func::item_w_damage(ctd.attacker, ctd.hitMode); // Retrieve Raw Damage
rawDamage += bonusRangedDamage; // Raw Damage = Raw Damage + Bonus Ranged Damage
int calcDT = armorDT - ammoDT; // DT = armor DT - ammo DT
if (calcDT < 0) calcDT = 0;
rawDamage -= calcDT; // Raw Damage = Raw Damage - DT
long calcDT = armorDT - ammoDT; // DT = armor DT - ammo DT
if (calcDT > 0) rawDamage -= calcDT; // Raw Damage = Raw Damage - DT
if (rawDamage <= 0) continue; // Is Raw Damage <= 0? If yes, skip damage calculation and go to bottom of loop
rawDamage *= multiplyDamage; // Raw Damage = Raw Damage * Damage Multiplier
if (ammoDivisor != 0) { // avoid divide by zero error
rawDamage /= ammoDivisor; // Raw Damage = Raw Damage / Ammo Divisor
if (ammoDiv != 0) { // avoid divide by zero error
rawDamage /= ammoDiv; // Raw Damage = Raw Damage / Ammo Divisor
}
rawDamage /= 2; // Raw Damage = Raw Damage / 2 (related to critical hit damage multiplier bonus)
rawDamage *= difficulty; // Raw Damage = Raw Damage * combat difficulty setting (75 if wimpy, 100 if normal or if attacker is player, 125 if rough)
rawDamage /= 100; // Raw Damage = Raw Damage / 100
calcDT = armorDT - ammoDT; // DT = armor DT - ammo DT
if (calcDT >= 0) { // Is DT >= 0?
calcDT = 0; // If yes, set DT = 0
} else {
calcDT *= 10; // Otherwise, DT = DT * 10 (note that this should be a negative value)
}
int calcDR = armorDR + calcDT; // DR = armor DR + DT (note that DT should be less than or equal to zero)
long calcDR = armorDR + calcDT; // DR = armor DR + DT (note that DT should be less than or equal to zero)
if (calcDR >= 100) { // Is DR >= 100?
continue; // If yes, damage will be zero, so stop calculating and go to bottom of loop
} else if (calcDR < 0) { // Is DR >= 0?
calcDR = 0; // If no, set DR = 0
}
int resistedDamage = calcDR * rawDamage; // Otherwise, Resisted Damage = DR * Raw Damage
long resistedDamage = calcDR * rawDamage; // Otherwise, Resisted Damage = DR * Raw Damage
resistedDamage /= 100; // Resisted Damage = Resisted Damage / 100
rawDamage -= resistedDamage; // Raw Damage = Raw Damage - Resisted Damage
if (rawDamage > 0) accumulatedDamage += rawDamage; // Accumulated Damage = Accumulated Damage + Raw Damage
}
}
////////////////////////////////////////////////////////////////////////////////
// Display melee damage w/o PERK_bonus_hth_damage bonus
+1 -1
View File
@@ -30,7 +30,7 @@ public:
static int formula;
static void DamageGlovz(fo::ComputeAttackResult &ctd, DWORD &accumulatedDamage, long rounds, long armorDT, long armorDR, long bonusRangedDamage, long multiplyDamage, long difficulty);
static void DamageYAAM(fo::ComputeAttackResult &ctd, DWORD &accumulatedDamage, int rounds, int armorDT, int armorDR, int bonusRangedDamage,int multiplyDamage, int difficulty);
static void DamageYAAM(fo::ComputeAttackResult &ctd, DWORD &accumulatedDamage, long rounds, long armorDT, long armorDR, long bonusRangedDamage, long multiplyDamage, long difficulty);
static long GetHtHMinDamageBonus(fo::GameObject* source);
};
+1 -1
View File
@@ -890,7 +890,7 @@ void MiscPatches::init() {
if (IniReader::GetConfigInt("Misc", "OverrideArtCacheSize", 0)) {
dlog("Applying override art cache size patch.", DL_INIT);
SafeWrite32(0x418867, 0x90909090);
SafeWrite32(0x418872, 256);
SafeWrite32(0x418872, 261); // setup default for 512 MB system memory
dlogr(" Done", DL_INIT);
}