Removed some more unnecessary memset code.

Added note on effect flags to CriticalOverrides.ini.
This commit is contained in:
NovaRain
2019-01-31 09:12:15 +08:00
parent 4a5f556cd3
commit 4edf36a1dc
4 changed files with 17 additions and 18 deletions
+5 -4
View File
@@ -14,15 +14,16 @@ Part_0=1 ; Tell sfall that we want to modify the head entries
[c_00_0] ; The entries for the head table of the men critter type.
e0_DamageMultiplier=100 ;First level critical
e0_EffectFlags=0
e0_EffectFlags=0 ; The value of the flags (see DAM_* in Define.h)
; For multiple effects, use the sum of the flags (e.g. 2050 = knocked down + bypass armor)
e0_StatCheck=0
e0_StatMod=0
e0_FailureEffect=0
e0_Message=0 ; This is an index into the msg file, not a string
e0_FailMessage=0
e1_... ; Second level critical
... ; And so on up to the hardest hitting level 5 critical
e5_...
;e1_... ; Second level critical
;... ; And so on up to the hardest hitting level 5 critical
;e5_...
;You can skip any entries from this section to leave them at their defaults
;Any missing entries for critters 19-37 will be replaced by a 0, since they have no default
+5 -6
View File
@@ -21,20 +21,21 @@
#include "BarBoxes.h"
#include "FalloutEngine.h"
static const DWORD DisplayBoxesRet1 = 0x4615A8;
static const DWORD DisplayBoxesRet2 = 0x4615BE;
struct sBox {
DWORD msg;
DWORD colour;
void* mem;
};
static sBox boxes[10];
static DWORD boxesEnabled[5];
static sBox boxes[10] = {0};
static DWORD boxesEnabled[5] = {0};
static const DWORD bboxMemAddr[] = {
0x461266, 0x4612AC, 0x461374, 0x4613E8, 0x461479, 0x46148C, 0x4616BB,
};
static const DWORD DisplayBoxesRet1 = 0x4615A8;
static const DWORD DisplayBoxesRet2 = 0x4615BE;
static void __declspec(naked) DisplayBoxesHook() {
__asm {
mov ebx, 0;
@@ -64,8 +65,6 @@ void BarBoxesInit() {
SafeWrite32(0x4612FE, (DWORD)boxes + 4); //.colour
SafeWrite32(0x46133C, (DWORD)boxes + 0); //.msg
memset(boxes, 0, 12 * 10);
memset(boxesEnabled, 0, 5 * 4);
memcpy(boxes, (void*)0x518FE8, 12 * 5);
for (int i = 5; i < 10; i++) {
+5 -5
View File
@@ -90,7 +90,6 @@ void CritLoad() {
if (mode == 1) {
dlogr("Setting up critical hit table using CriticalOverrides.ini", DL_CRITICALS);
char section[16];
memset(baseCritTable, 0, CritTableSize * sizeof(CritStruct));
for (DWORD critter = 0; critter < 20; critter++) {
for (DWORD part = 0; part < 9; part++) {
for (DWORD crit = 0; crit < 6; crit++) {
@@ -113,8 +112,8 @@ void CritLoad() {
} else {
dlogr("Setting up critical hit table using RP fixes", DL_CRITICALS);
memcpy(baseCritTable, defaultTable, 6 * 9 * 19 * sizeof(CritStruct));
memset(&baseCritTable[6 * 9 * 19], 0, 6 * 9 * 19 * sizeof(CritStruct));
memcpy(&baseCritTable[6 * 9 * 38], (void*)_pc_crit_succ_eff, 6 * 9 * sizeof(CritStruct)); // PC crit table
//memset(&baseCritTable[6 * 9 * 19], 0, 6 * 9 * 19 * sizeof(CritStruct));
memcpy(&baseCritTable[6 * 9 * 38], (CritStruct*)_pc_crit_succ_eff, 6 * 9 * sizeof(CritStruct)); // PC crit table
if (mode == 3) {
char buf[32], buf2[32], buf3[32];
@@ -145,6 +144,7 @@ void CritLoad() {
}
#define SetEntry(critter, bodypart, effect, param, value) defaultTable[critter * 9 * 6 + bodypart * 6 + effect].values[param] = value;
void CritInit() {
mode = GetPrivateProfileIntA("Misc", "OverrideCriticalTable", 2, ini);
if (mode < 0 || mode > 3) mode = 0;
@@ -152,13 +152,13 @@ void CritInit() {
if (!mode) return;
dlog("Initializing critical table override.", DL_INIT);
baseCritTable = new CritStruct[CritTableSize];
baseCritTable = new CritStruct[CritTableSize]();
critTable = new CritStruct[CritTableSize];
playerCrit = &critTable[6 * 9 * 38];
SafeWrite32(0x423F96, (DWORD)playerCrit);
SafeWrite32(0x423FB3, (DWORD)critTable);
if (mode == 2 || mode == 3) {
if (mode == 2 || mode == 3) { // bug fixes
CritStruct* defaultTable = (CritStruct*)_crit_succ_eff;
SetEntry(2, 4, 1, 4, 0);
+1 -2
View File
@@ -210,8 +210,7 @@ void SkillsInit() {
SkillInfo *skills = (SkillInfo*)_skill_data;
sprintf(file, ".\\%s", buf);
multipliers = new double[7 * SKILL_count];
memset(multipliers, 0, 7 * SKILL_count * sizeof(double));
multipliers = new double[7 * SKILL_count]();
for (int i = 0; i < SKILL_count; i++) {
sprintf(key, "Skill%d", i);