mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Changed the priority of files in AutoSearchPath
* now they have higher priority than the PatchFileXX options. Minor code edits/fixes.
This commit is contained in:
+3
-3
@@ -18,9 +18,9 @@ UseCommandLine=0
|
|||||||
;The greater numbers take precedence over lesser numbers
|
;The greater numbers take precedence over lesser numbers
|
||||||
;PatchFile0=mods\RP_data
|
;PatchFile0=mods\RP_data
|
||||||
|
|
||||||
;Path to the folder in which the game will automatically search and load custom .dat files
|
;Path to the folder in which the game will automatically search and load custom files (by *.dat mask, including folders)
|
||||||
;The data load order of the .dat files in the folder will be in reverse alphabetical order of the filenames
|
;The data load order of the files in the folder will be in reverse alphabetical order of the filenames
|
||||||
;The .dat files specified in the PatchFileXX options will have higher priority than others
|
;The files placed in this folder will have higher priority than the PatchFileXX options
|
||||||
;Uncomment the option to specify a different folder path. The default path is <GameRoot>\mods\
|
;Uncomment the option to specify a different folder path. The default path is <GameRoot>\mods\
|
||||||
;AutoSearchPath=mods
|
;AutoSearchPath=mods
|
||||||
|
|
||||||
|
|||||||
@@ -265,16 +265,15 @@ fix: // check result
|
|||||||
|
|
||||||
static void __declspec(naked) cai_perform_distance_prefs_hack() {
|
static void __declspec(naked) cai_perform_distance_prefs_hack() {
|
||||||
__asm {
|
__asm {
|
||||||
push eax; // current distance to target
|
mov ecx, eax; // current distance to target
|
||||||
mov eax, esi;
|
mov eax, esi;
|
||||||
xor ebx, ebx; // no called shot
|
xor ebx, ebx; // no called shot
|
||||||
mov edx, ATKTYPE_RWEAPON_PRIMARY;
|
mov edx, ATKTYPE_RWEAPON_PRIMARY;
|
||||||
call fo::funcoffs::item_w_mp_cost_;
|
call fo::funcoffs::item_w_mp_cost_;
|
||||||
mov edx, [esi + movePoints];
|
mov edx, [esi + movePoints];
|
||||||
sub edx, eax; // ap - cost = free AP's
|
sub edx, eax; // ap - cost = free AP's
|
||||||
pop eax;
|
|
||||||
jle moveAway; // <= 0
|
jle moveAway; // <= 0
|
||||||
lea edx, [edx + eax - 1];
|
lea edx, [edx + ecx - 1];
|
||||||
cmp edx, 5; // minimum threshold distance
|
cmp edx, 5; // minimum threshold distance
|
||||||
jge skipMove; // distance >= 5?
|
jge skipMove; // distance >= 5?
|
||||||
moveAway:
|
moveAway:
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ static const DWORD bodypartAddr[] = {
|
|||||||
0x421656, 0x421675, // combat_safety_invalidate_weapon_func_
|
0x421656, 0x421675, // combat_safety_invalidate_weapon_func_
|
||||||
0x421CC0, // combat_begin_extra_
|
0x421CC0, // combat_begin_extra_
|
||||||
0x4229A9, // combat_turn_
|
0x4229A9, // combat_turn_
|
||||||
0x42330E, 0x4233AB, // shoot_along_path_
|
0x42330E, 0x4233A6, 0x4233AB, // shoot_along_path_
|
||||||
0x423E25, 0x423E2A, // compute_explosion_on_extras_
|
0x423E25, 0x423E2A, // compute_explosion_on_extras_
|
||||||
0x425F83, // combat_anim_finished_
|
0x425F83, // combat_anim_finished_
|
||||||
0x42946D, // ai_best_weapon_
|
0x42946D, // ai_best_weapon_
|
||||||
|
|||||||
@@ -504,16 +504,17 @@ void Graphics::ShowMovieFrame() {
|
|||||||
d3d9Device->SetStreamSource(0, vBuffer2, 0, sizeof(VertexFormat));
|
d3d9Device->SetStreamSource(0, vBuffer2, 0, sizeof(VertexFormat));
|
||||||
d3d9Device->SetRenderTarget(0, backbuffer);
|
d3d9Device->SetRenderTarget(0, backbuffer);
|
||||||
|
|
||||||
if (Graphics::GPUBlt /*&& !ScriptShaders::Count()*/) {
|
// TODO: The commented code sometimes for some unknown reason crashes the game when playing videos
|
||||||
UINT unused;
|
//if (Graphics::GPUBlt /*&& !ScriptShaders::Count()*/) {
|
||||||
gpuBltEffect->Begin(&unused, 0);
|
// UINT unused;
|
||||||
gpuBltEffect->BeginPass(0);
|
// gpuBltEffect->Begin(&unused, 0);
|
||||||
}
|
// gpuBltEffect->BeginPass(0);
|
||||||
|
//}
|
||||||
d3d9Device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
d3d9Device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||||
if (Graphics::GPUBlt /*&& !ScriptShaders::Count()*/) {
|
//if (Graphics::GPUBlt /*&& !ScriptShaders::Count()*/) {
|
||||||
gpuBltEffect->EndPass();
|
// gpuBltEffect->EndPass();
|
||||||
gpuBltEffect->End();
|
// gpuBltEffect->End();
|
||||||
}
|
//}
|
||||||
|
|
||||||
// for movie
|
// for movie
|
||||||
d3d9Device->SetTexture(0, movieTex);
|
d3d9Device->SetTexture(0, movieTex);
|
||||||
@@ -956,6 +957,7 @@ public:
|
|||||||
ULONG _stdcall Release() { // called from game on exit
|
ULONG _stdcall Release() { // called from game on exit
|
||||||
if (!--Refs) {
|
if (!--Refs) {
|
||||||
ScriptShaders::Release();
|
ScriptShaders::Release();
|
||||||
|
|
||||||
SAFERELEASE(backbuffer);
|
SAFERELEASE(backbuffer);
|
||||||
SAFERELEASE(sSurf1);
|
SAFERELEASE(sSurf1);
|
||||||
SAFERELEASE(sSurf2);
|
SAFERELEASE(sSurf2);
|
||||||
@@ -969,6 +971,7 @@ public:
|
|||||||
SAFERELEASE(gpuPalette);
|
SAFERELEASE(gpuPalette);
|
||||||
SAFERELEASE(gpuBltEffect);
|
SAFERELEASE(gpuBltEffect);
|
||||||
SAFERELEASE(movieBuffer);
|
SAFERELEASE(movieBuffer);
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
} else return Refs;
|
} else return Refs;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ static fo::PathNode* __fastcall RemoveDatabase(const char* pathPatches) {
|
|||||||
while (paths) {
|
while (paths) {
|
||||||
if (_stricmp(paths->path, pathPatches) == 0) { // found path
|
if (_stricmp(paths->path, pathPatches) == 0) { // found path
|
||||||
fo::PathNode* nextPaths = paths->next; // pointer to the node of the next path
|
fo::PathNode* nextPaths = paths->next; // pointer to the node of the next path
|
||||||
// TODO: need to check if this condition is used correctly
|
// TODO: need to check if this condition is used correctly (everything seems to be in order here)
|
||||||
if (paths != _paths)
|
if (paths != _paths)
|
||||||
_paths->next = nextPaths; // replace the pointer in the previous node, removing the current(found) path from the chain
|
_paths->next = nextPaths; // replace the pointer in the previous node, removing the current(found) path from the chain
|
||||||
else // if the current node is equal to the previous node
|
else // if the current node is equal to the previous node
|
||||||
@@ -204,7 +204,15 @@ static bool NormalizePath(std::string &path) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Patches placed at the back of the vector will have priority in the chain over the front (previous) patches
|
||||||
static void GetExtraPatches() {
|
static void GetExtraPatches() {
|
||||||
|
char patchFile[12] = "PatchFile";
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
_itoa(i, &patchFile[9], 10);
|
||||||
|
auto patch = GetConfigString("ExtraPatches", patchFile, "", MAX_PATH);
|
||||||
|
if (patch.empty() || !NormalizePath(patch) || GetFileAttributes(patch.c_str()) == INVALID_FILE_ATTRIBUTES) continue;
|
||||||
|
patchFiles.push_back(patch);
|
||||||
|
}
|
||||||
std::string searchPath = GetConfigString("ExtraPatches", "AutoSearchPath", "mods\\", MAX_PATH);
|
std::string searchPath = GetConfigString("ExtraPatches", "AutoSearchPath", "mods\\", MAX_PATH);
|
||||||
if (!searchPath.empty() && NormalizePath(searchPath)) {
|
if (!searchPath.empty() && NormalizePath(searchPath)) {
|
||||||
if (searchPath.back() != '\\') searchPath += "\\";
|
if (searchPath.back() != '\\') searchPath += "\\";
|
||||||
@@ -223,13 +231,6 @@ static void GetExtraPatches() {
|
|||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char patchFile[12] = "PatchFile";
|
|
||||||
for (int i = 0; i < 100; i++) {
|
|
||||||
_itoa(i, &patchFile[9], 10);
|
|
||||||
auto patch = GetConfigString("ExtraPatches", patchFile, "", MAX_PATH);
|
|
||||||
if (patch.empty() || !NormalizePath(patch) || GetFileAttributes(patch.c_str()) == INVALID_FILE_ATTRIBUTES) continue;
|
|
||||||
patchFiles.push_back(patch);
|
|
||||||
}
|
|
||||||
// Remove first duplicates
|
// Remove first duplicates
|
||||||
size_t size = patchFiles.size();
|
size_t size = patchFiles.size();
|
||||||
for (size_t i = 1; i < size; ++i) {
|
for (size_t i = 1; i < size; ++i) {
|
||||||
@@ -381,7 +382,7 @@ end:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _F_SAV (const char*)0x50A480
|
#define _F_SAV (const char*)0x50A480
|
||||||
#define _F_PROTO_CRITTERS (const char*)0x50A490
|
#define _F_PROTO_CRITTERS (const char*)0x50A490
|
||||||
|
|
||||||
static void RemoveSavFiles() {
|
static void RemoveSavFiles() {
|
||||||
|
|||||||
@@ -299,33 +299,19 @@ static void AdditionalWeaponAnimsPatch() {
|
|||||||
static void SkilldexImagesPatch() {
|
static void SkilldexImagesPatch() {
|
||||||
dlog("Checking for changed skilldex images.", DL_INIT);
|
dlog("Checking for changed skilldex images.", DL_INIT);
|
||||||
long tmp = GetConfigInt("Misc", "Lockpick", 293);
|
long tmp = GetConfigInt("Misc", "Lockpick", 293);
|
||||||
if (tmp != 293) {
|
if (tmp != 293) SafeWrite32(0x518D54, tmp);
|
||||||
SafeWrite32(0x518D54, tmp);
|
|
||||||
}
|
|
||||||
tmp = GetConfigInt("Misc", "Steal", 293);
|
tmp = GetConfigInt("Misc", "Steal", 293);
|
||||||
if (tmp != 293) {
|
if (tmp != 293) SafeWrite32(0x518D58, tmp);
|
||||||
SafeWrite32(0x518D58, tmp);
|
|
||||||
}
|
|
||||||
tmp = GetConfigInt("Misc", "Traps", 293);
|
tmp = GetConfigInt("Misc", "Traps", 293);
|
||||||
if (tmp != 293) {
|
if (tmp != 293) SafeWrite32(0x518D5C, tmp);
|
||||||
SafeWrite32(0x518D5C, tmp);
|
|
||||||
}
|
|
||||||
tmp = GetConfigInt("Misc", "FirstAid", 293);
|
tmp = GetConfigInt("Misc", "FirstAid", 293);
|
||||||
if (tmp != 293) {
|
if (tmp != 293) SafeWrite32(0x518D4C, tmp);
|
||||||
SafeWrite32(0x518D4C, tmp);
|
|
||||||
}
|
|
||||||
tmp = GetConfigInt("Misc", "Doctor", 293);
|
tmp = GetConfigInt("Misc", "Doctor", 293);
|
||||||
if (tmp != 293) {
|
if (tmp != 293) SafeWrite32(0x518D50, tmp);
|
||||||
SafeWrite32(0x518D50, tmp);
|
|
||||||
}
|
|
||||||
tmp = GetConfigInt("Misc", "Science", 293);
|
tmp = GetConfigInt("Misc", "Science", 293);
|
||||||
if (tmp != 293) {
|
if (tmp != 293) SafeWrite32(0x518D60, tmp);
|
||||||
SafeWrite32(0x518D60, tmp);
|
|
||||||
}
|
|
||||||
tmp = GetConfigInt("Misc", "Repair", 293);
|
tmp = GetConfigInt("Misc", "Repair", 293);
|
||||||
if (tmp != 293) {
|
if (tmp != 293) SafeWrite32(0x518D64, tmp);
|
||||||
SafeWrite32(0x518D64, tmp);
|
|
||||||
}
|
|
||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user