mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added OverrideCriticalFile option for specifying alternative crit file
Added code for preparing clearing map_update_event in queue. Fixed a crash bug in message_str_game function when passing a negative fileId value. Corrected/edited some code.
This commit is contained in:
+4
-2
@@ -319,7 +319,7 @@ OverrideArtCacheSize=0
|
|||||||
;Set to 2 to block all saving in combat
|
;Set to 2 to block all saving in combat
|
||||||
SaveInCombatFix=1
|
SaveInCombatFix=1
|
||||||
|
|
||||||
;Point at an ini file containing elevator data
|
;Point to an ini file containing elevator data
|
||||||
;ElevatorsFile=Elevators.ini
|
;ElevatorsFile=Elevators.ini
|
||||||
|
|
||||||
;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.
|
||||||
@@ -347,6 +347,8 @@ AdditionalWeaponAnims=1
|
|||||||
;If the ExtraKillTypes option is enabled, this should be set to 3, with containing entries for any new types
|
;If the ExtraKillTypes option is enabled, this should be set to 3, with containing entries for any new types
|
||||||
;Must be non-zero to use the edit/get/reset_critical script functions
|
;Must be non-zero to use the edit/get/reset_critical script functions
|
||||||
OverrideCriticalTable=2
|
OverrideCriticalTable=2
|
||||||
|
;To change the path and filename of the critical table file, uncomment the next line
|
||||||
|
;OverrideCriticalFile=CriticalOverrides.ini
|
||||||
|
|
||||||
;Set to 1 to get notification of karma changes in the notification window
|
;Set to 1 to get notification of karma changes in the notification window
|
||||||
DisplayKarmaChanges=0
|
DisplayKarmaChanges=0
|
||||||
@@ -489,7 +491,7 @@ FastShotFix=1
|
|||||||
BoostScriptDialogLimit=0
|
BoostScriptDialogLimit=0
|
||||||
|
|
||||||
;Allows you to edit the skill tables
|
;Allows you to edit the skill tables
|
||||||
;Point the next line at an ini file containing the replacement skill data
|
;Point the next line to an ini file containing the replacement skill data
|
||||||
;SkillsFile=Skills.ini
|
;SkillsFile=Skills.ini
|
||||||
|
|
||||||
;To change the relationship between SPECIAL stats and derived stats, uncomment the next line
|
;To change the relationship between SPECIAL stats and derived stats, uncomment the next line
|
||||||
|
|||||||
+9
-5
@@ -23,7 +23,8 @@
|
|||||||
#include "FalloutEngine.h"
|
#include "FalloutEngine.h"
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
|
|
||||||
static const char* CritTableFile = ".\\CriticalOverrides.ini";
|
static std::string critTableFile(".\\");
|
||||||
|
|
||||||
static const DWORD CritTableCount = 2 * 19 + 1; // Number of species in new critical table
|
static const DWORD CritTableCount = 2 * 19 + 1; // Number of species in new critical table
|
||||||
//static const DWORD origCritTableSize = 6 * 9 * 20; // Number of entries in original table
|
//static const DWORD origCritTableSize = 6 * 9 * 20; // Number of entries in original table
|
||||||
static const DWORD CritTableSize = 6 * 9 * CritTableCount; // Number of entries in new critical table
|
static const DWORD CritTableSize = 6 * 9 * CritTableCount; // Number of entries in new critical table
|
||||||
@@ -99,7 +100,7 @@ void CritLoad() {
|
|||||||
int slot1 = crit + part * 6 + critter * 9 * 6;
|
int slot1 = crit + part * 6 + critter * 9 * 6;
|
||||||
int slot2 = crit + part * 6 + ((critter == 19) ? 38 : critter) * 9 * 6;
|
int slot2 = crit + part * 6 + ((critter == 19) ? 38 : critter) * 9 * 6;
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
baseCritTable[slot2].values[i] = GetPrivateProfileIntA(section, CritNames[i], defaultTable[slot1].values[i], CritTableFile);
|
baseCritTable[slot2].values[i] = GetPrivateProfileIntA(section, CritNames[i], defaultTable[slot1].values[i], critTableFile.c_str());
|
||||||
if (isDebug) {
|
if (isDebug) {
|
||||||
char logmsg[256];
|
char logmsg[256];
|
||||||
if (baseCritTable[slot2].values[i] != defaultTable[slot1].values[i]) {
|
if (baseCritTable[slot2].values[i] != defaultTable[slot1].values[i]) {
|
||||||
@@ -122,11 +123,11 @@ void CritLoad() {
|
|||||||
for (int critter = 0; critter < CritTableCount; critter++) {
|
for (int critter = 0; critter < CritTableCount; critter++) {
|
||||||
sprintf_s(buf, "c_%02d", critter);
|
sprintf_s(buf, "c_%02d", critter);
|
||||||
int all;
|
int all;
|
||||||
if (!(all = GetPrivateProfileIntA(buf, "Enabled", 0, CritTableFile))) continue;
|
if (!(all = GetPrivateProfileIntA(buf, "Enabled", 0, critTableFile.c_str()))) continue;
|
||||||
for (int part = 0; part < 9; part++) {
|
for (int part = 0; part < 9; part++) {
|
||||||
if (all < 2) {
|
if (all < 2) {
|
||||||
sprintf_s(buf2, "Part_%d", part);
|
sprintf_s(buf2, "Part_%d", part);
|
||||||
if (!GetPrivateProfileIntA(buf, buf2, 0, CritTableFile)) continue;
|
if (!GetPrivateProfileIntA(buf, buf2, 0, critTableFile.c_str())) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf_s(buf2, "c_%02d_%d", critter, part);
|
sprintf_s(buf2, "c_%02d_%d", critter, part);
|
||||||
@@ -134,7 +135,7 @@ void CritLoad() {
|
|||||||
int slot = crit + part * 6 + critter * 9 * 6;
|
int slot = crit + part * 6 + critter * 9 * 6;
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
sprintf_s(buf3, "e%d_%s", crit, CritNames[i]);
|
sprintf_s(buf3, "e%d_%s", crit, CritNames[i]);
|
||||||
baseCritTable[slot].values[i] = GetPrivateProfileIntA(buf2, buf3, baseCritTable[slot].values[i], CritTableFile);
|
baseCritTable[slot].values[i] = GetPrivateProfileIntA(buf2, buf3, baseCritTable[slot].values[i], critTableFile.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,6 +274,9 @@ void CritInit() {
|
|||||||
mode = GetPrivateProfileIntA("Misc", "OverrideCriticalTable", 2, ini);
|
mode = GetPrivateProfileIntA("Misc", "OverrideCriticalTable", 2, ini);
|
||||||
if (mode < 0 || mode > 3) mode = 0;
|
if (mode < 0 || mode > 3) mode = 0;
|
||||||
if (mode) {
|
if (mode) {
|
||||||
|
char critFile[MAX_PATH];
|
||||||
|
GetPrivateProfileStringA("Misc", "OverrideCriticalFile", "CriticalOverrides.ini", critFile, MAX_PATH, ini);
|
||||||
|
critTableFile += critFile;
|
||||||
CriticalTableOverride();
|
CriticalTableOverride();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ DWORD* ptr_pipmesg = reinterpret_cast<DWORD*>(_pipmesg);
|
|||||||
DWORD* ptr_preload_list_index = reinterpret_cast<DWORD*>(_preload_list_index);
|
DWORD* ptr_preload_list_index = reinterpret_cast<DWORD*>(_preload_list_index);
|
||||||
DWORD* ptr_procTableStrs = reinterpret_cast<DWORD*>(_procTableStrs); // table of procId (from define.h) => procName map
|
DWORD* ptr_procTableStrs = reinterpret_cast<DWORD*>(_procTableStrs); // table of procId (from define.h) => procName map
|
||||||
DWORD* ptr_proto_main_msg_file = reinterpret_cast<DWORD*>(_proto_main_msg_file);
|
DWORD* ptr_proto_main_msg_file = reinterpret_cast<DWORD*>(_proto_main_msg_file);
|
||||||
|
DWORD* ptr_proto_msg_files = reinterpret_cast<DWORD*>(_proto_msg_files);
|
||||||
DWORD* ptr_ptable = reinterpret_cast<DWORD*>(_ptable);
|
DWORD* ptr_ptable = reinterpret_cast<DWORD*>(_ptable);
|
||||||
DWORD* ptr_pud = reinterpret_cast<DWORD*>(_pud);
|
DWORD* ptr_pud = reinterpret_cast<DWORD*>(_pud);
|
||||||
DWORD* ptr_queue = reinterpret_cast<DWORD*>(_queue);
|
DWORD* ptr_queue = reinterpret_cast<DWORD*>(_queue);
|
||||||
|
|||||||
@@ -195,6 +195,7 @@
|
|||||||
#define _preload_list_index 0x519640
|
#define _preload_list_index 0x519640
|
||||||
#define _procTableStrs 0x51C758 // table of procId (from define.h) => procName map
|
#define _procTableStrs 0x51C758 // table of procId (from define.h) => procName map
|
||||||
#define _proto_main_msg_file 0x6647FC
|
#define _proto_main_msg_file 0x6647FC
|
||||||
|
#define _proto_msg_files 0x6647AC
|
||||||
#define _ptable 0x59E934
|
#define _ptable 0x59E934
|
||||||
#define _pud 0x59E960
|
#define _pud 0x59E960
|
||||||
#define _quest_count 0x51C12C
|
#define _quest_count 0x51C12C
|
||||||
@@ -404,6 +405,7 @@ extern DWORD* ptr_pipmesg;
|
|||||||
extern DWORD* ptr_preload_list_index;
|
extern DWORD* ptr_preload_list_index;
|
||||||
extern DWORD* ptr_procTableStrs; // table of procId (from define.h) => procName map
|
extern DWORD* ptr_procTableStrs; // table of procId (from define.h) => procName map
|
||||||
extern DWORD* ptr_proto_main_msg_file;
|
extern DWORD* ptr_proto_main_msg_file;
|
||||||
|
extern DWORD* ptr_proto_msg_files;
|
||||||
extern DWORD* ptr_ptable;
|
extern DWORD* ptr_ptable;
|
||||||
extern DWORD* ptr_pud;
|
extern DWORD* ptr_pud;
|
||||||
extern DWORD* ptr_queue;
|
extern DWORD* ptr_queue;
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
return _type == DATATYPE_STR;
|
return _type == DATATYPE_STR;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD rawValue() const {
|
unsigned long rawValue() const {
|
||||||
return _val.dw;
|
return _val.dw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1354,7 +1354,15 @@ static void __declspec(naked) map_save_in_game_hook() {
|
|||||||
jmp game_time_;
|
jmp game_time_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
static void ClearEventUpdateMapProc() {
|
||||||
|
__asm {
|
||||||
|
mov eax, map_update_event; // type
|
||||||
|
xor edx, edx; // func
|
||||||
|
call queue_clear_type_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
void ScriptExtenderSetup() {
|
void ScriptExtenderSetup() {
|
||||||
toggleHighlightsKey = GetPrivateProfileIntA("Input", "ToggleItemHighlightsKey", 0, ini);
|
toggleHighlightsKey = GetPrivateProfileIntA("Input", "ToggleItemHighlightsKey", 0, ini);
|
||||||
if (toggleHighlightsKey) {
|
if (toggleHighlightsKey) {
|
||||||
@@ -1423,7 +1431,7 @@ void ScriptExtenderSetup() {
|
|||||||
long long data = 0x397401C1F6; // test cl, 1; jz 0x483CF2
|
long long data = 0x397401C1F6; // test cl, 1; jz 0x483CF2
|
||||||
SafeWriteBytes(0x483CB4, (BYTE*)&data, 5);
|
SafeWriteBytes(0x483CB4, (BYTE*)&data, 5);
|
||||||
|
|
||||||
// Set the DAM_BACKWASH_ flag for the attacker before calling compute_damage_
|
// Set the DAM_BACKWASH flag for the attacker before calling compute_damage_
|
||||||
SafeWrite32(0x423DE7, 0x40164E80); // or [esi+ctd.flags3Source], DAM_BACKWASH_
|
SafeWrite32(0x423DE7, 0x40164E80); // or [esi+ctd.flags3Source], DAM_BACKWASH_
|
||||||
long idata = 0x146E09; // or dword ptr [esi+ctd.flagsSource], ebp
|
long idata = 0x146E09; // or dword ptr [esi+ctd.flagsSource], ebp
|
||||||
SafeWriteBytes(0x423DF0, (BYTE*)&idata, 3);
|
SafeWriteBytes(0x423DF0, (BYTE*)&idata, 3);
|
||||||
@@ -2015,11 +2023,14 @@ static DWORD _stdcall HandleMapUpdateForScripts(const DWORD procId) {
|
|||||||
for (SfallProgsMap::iterator it = sfallProgsMap.begin(); it != sfallProgsMap.end(); it++) {
|
for (SfallProgsMap::iterator it = sfallProgsMap.begin(); it != sfallProgsMap.end(); it++) {
|
||||||
DWORD progPtr = it->second.ptr;
|
DWORD progPtr = it->second.ptr;
|
||||||
__asm {
|
__asm {
|
||||||
mov eax, progPtr;
|
mov eax, progPtr;
|
||||||
call runProgram_;
|
call runProgram_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} /*else if (procId == map_exit_p_proc) {
|
||||||
|
ClearEventUpdateMapProc();
|
||||||
|
}*/
|
||||||
|
|
||||||
RunGlobalScriptsAtProc(procId); // gl* scripts of types 0 and 3
|
RunGlobalScriptsAtProc(procId); // gl* scripts of types 0 and 3
|
||||||
RunHookScriptsAtProc(procId); // all hs_ scripts
|
RunHookScriptsAtProc(procId); // all hs_ scripts
|
||||||
|
|
||||||
|
|||||||
@@ -813,31 +813,32 @@ static const DWORD game_msg_files[] = {
|
|||||||
0x672FB0, // WORLDMAP
|
0x672FB0, // WORLDMAP
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: move to FalloutEngine
|
|
||||||
static const DWORD* proto_msg_files = (DWORD*)0x006647AC;
|
|
||||||
|
|
||||||
static void _stdcall op_message_str_game2() {
|
static void _stdcall op_message_str_game2() {
|
||||||
const char* msg = 0;
|
const char* msg = nullptr;
|
||||||
const ScriptValue &fileIdArg = opHandler.arg(0),
|
const ScriptValue &fileIdArg = opHandler.arg(0),
|
||||||
&msgIdArg = opHandler.arg(1);
|
&msgIdArg = opHandler.arg(1);
|
||||||
|
|
||||||
if (fileIdArg.isInt() && msgIdArg.isInt()) {
|
if (fileIdArg.isInt() && msgIdArg.isInt()) {
|
||||||
int fileId = fileIdArg.asInt();
|
int fileId = fileIdArg.rawValue();
|
||||||
int msgId = msgIdArg.asInt();
|
if (fileId >= 0) {
|
||||||
if (fileId < 20) { // main msg files
|
int msgId = msgIdArg.rawValue();
|
||||||
msg = GetMessageStr(game_msg_files[fileId], msgId);
|
if (fileId < 20) { // main msg files
|
||||||
} else if (fileId >= 0x1000 && fileId <= 0x1005) { // proto msg files
|
msg = GetMessageStr(game_msg_files[fileId], msgId);
|
||||||
msg = GetMessageStr((DWORD)&proto_msg_files[2*(fileId - 0x1000)], msgId);
|
} else if (fileId >= 0x1000 && fileId <= 0x1005) { // proto msg files
|
||||||
} else if (fileId >= 0x2000) { // Extra game message files.
|
msg = GetMessageStr((DWORD)&ptr_proto_msg_files[2 * (fileId - 0x1000)], msgId);
|
||||||
ExtraGameMessageListsMap::iterator it = gExtraGameMsgLists.find(fileId);
|
} else if (fileId >= 0x2000) { // Extra game message files.
|
||||||
if (it != gExtraGameMsgLists.end()) {
|
ExtraGameMessageListsMap::iterator it = gExtraGameMsgLists.find(fileId);
|
||||||
msg = GetMsg(it->second, msgId, 2);
|
if (it != gExtraGameMsgLists.end()) {
|
||||||
|
msg = GetMsg(it->second, msgId, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (msg == nullptr) msg = "Error";
|
||||||
|
opHandler.setReturn(msg);
|
||||||
|
} else {
|
||||||
|
OpcodeInvalidArgs("message_str_game");
|
||||||
|
opHandler.setReturn(-1);
|
||||||
}
|
}
|
||||||
if (msg == 0) {
|
|
||||||
msg = "Error";
|
|
||||||
}
|
|
||||||
opHandler.setReturn(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __declspec(naked) op_message_str_game() {
|
static void __declspec(naked) op_message_str_game() {
|
||||||
|
|||||||
+1
-1
@@ -245,7 +245,7 @@ void StatsInit() {
|
|||||||
StatMulti[31 * 7 + 2] = 2; // rad resist
|
StatMulti[31 * 7 + 2] = 2; // rad resist
|
||||||
StatMulti[32 * 7 + 2] = 5; // poison resist
|
StatMulti[32 * 7 + 2] = 5; // poison resist
|
||||||
|
|
||||||
char key[6], buf2[256], buf3[256];
|
char key[6], buf2[256], buf3[MAX_PATH];
|
||||||
strcpy_s(buf3, table);
|
strcpy_s(buf3, table);
|
||||||
sprintf(table, ".\\%s", buf3);
|
sprintf(table, ".\\%s", buf3);
|
||||||
for (int i = STAT_max_hit_points; i <= STAT_poison_resist; i++) {
|
for (int i = STAT_max_hit_points; i <= STAT_poison_resist; i++) {
|
||||||
|
|||||||
+3
-5
@@ -644,8 +644,6 @@ static void __declspec(naked) display_stats_hook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void DllMain2() {
|
static void DllMain2() {
|
||||||
//SafeWrite8(0x4B15E8, 0xc3);
|
|
||||||
//SafeWrite8(0x4B30C4, 0xc3); //this is the one I need to override for bigger tiles
|
|
||||||
DWORD tmp;
|
DWORD tmp;
|
||||||
dlogr("In DllMain2", DL_MAIN);
|
dlogr("In DllMain2", DL_MAIN);
|
||||||
|
|
||||||
@@ -809,8 +807,8 @@ static void DllMain2() {
|
|||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
char elevPath[MAX_PATH];
|
char elevPath[MAX_PATH - 3];
|
||||||
GetPrivateProfileString("Misc", "ElevatorsFile", "", elevPath, MAX_PATH, ini);
|
GetPrivateProfileString("Misc", "ElevatorsFile", "", elevPath, MAX_PATH - 3, ini);
|
||||||
if (strlen(elevPath) > 0) {
|
if (strlen(elevPath) > 0) {
|
||||||
dlog("Applying elevator patch.", DL_INIT);
|
dlog("Applying elevator patch.", DL_INIT);
|
||||||
ElevatorsInit(elevPath);
|
ElevatorsInit(elevPath);
|
||||||
@@ -1336,7 +1334,7 @@ bool _stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) {
|
|||||||
strcpy_s(ini, ".\\ddraw.ini");
|
strcpy_s(ini, ".\\ddraw.ini");
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPrivateProfileStringA("Main", "TranslationsINI", "./Translations.ini", translationIni, 65, ini);
|
GetPrivateProfileStringA("Main", "TranslationsINI", ".\\Translations.ini", translationIni, 65, ini);
|
||||||
modifiedIni = GetPrivateProfileIntA("Main", "ModifiedIni", 0, ini);
|
modifiedIni = GetPrivateProfileIntA("Main", "ModifiedIni", 0, ini);
|
||||||
|
|
||||||
DllMain2();
|
DllMain2();
|
||||||
|
|||||||
+2
-2
@@ -290,8 +290,8 @@ void SkillsInit() {
|
|||||||
// 0x00000400 - Energy Weapon (forces weapon to use Energy Weapons skill)
|
// 0x00000400 - Energy Weapon (forces weapon to use Energy Weapons skill)
|
||||||
HookCall(0x47831E, item_w_skill_hook);
|
HookCall(0x47831E, item_w_skill_hook);
|
||||||
|
|
||||||
char buf[512], key[16], file[64];
|
char buf[512], key[16], file[MAX_PATH];
|
||||||
if (GetPrivateProfileStringA("Misc", "SkillsFile", "", buf, 62, ini) > 0) {
|
if (GetPrivateProfileStringA("Misc", "SkillsFile", "", buf, MAX_PATH - 3, ini) > 0) {
|
||||||
SkillInfo *skills = (SkillInfo*)_skill_data;
|
SkillInfo *skills = (SkillInfo*)_skill_data;
|
||||||
|
|
||||||
sprintf(file, ".\\%s", buf);
|
sprintf(file, ".\\%s", buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user