mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Some code refactoring
This commit is contained in:
+6
-6
@@ -674,25 +674,25 @@ CreditsAtBottom=0
|
|||||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||||
|
|
||||||
;To change the path and filename of the critical table file, uncomment the next line
|
;To change the path and filename of the critical table file, uncomment the next line
|
||||||
;OverrideCriticalFile=CriticalOverrides.ini
|
;OverrideCriticalFile=sfall\CriticalOverrides.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
|
||||||
;See the Stats.ini in the modders pack for an example file
|
;See the Stats.ini in the modders pack for an example file
|
||||||
;DerivedStats=Stats.ini
|
;DerivedStats=sfall\Stats.ini
|
||||||
|
|
||||||
;Allows you to edit the skill tables
|
;Allows you to edit the skill tables
|
||||||
;Point the next line to 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=sfall\Skills.ini
|
||||||
|
|
||||||
;To add additional perks to the game, uncomment the next line and set it to point to a file containing perk information
|
;To add additional perks to the game, uncomment the next line and set it to point to a file containing perk information
|
||||||
;PerksFile=Perks.ini
|
;PerksFile=sfall\Perks.ini
|
||||||
|
|
||||||
;To add additional books to the game, uncomment the next line and point to a file containing book information
|
;To add additional books to the game, uncomment the next line and point to a file containing book information
|
||||||
;See the Books.ini in the modders pack for an example file
|
;See the Books.ini in the modders pack for an example file
|
||||||
;BooksFile=Books.ini
|
;BooksFile=sfall\Books.ini
|
||||||
|
|
||||||
;Point to an ini file containing elevator data
|
;Point to an ini file containing elevator data
|
||||||
;ElevatorsFile=Elevators.ini
|
;ElevatorsFile=sfall\Elevators.ini
|
||||||
|
|
||||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||||
[Debugging]
|
[Debugging]
|
||||||
|
|||||||
@@ -302,19 +302,18 @@ hide:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* artDbgMsg = "\nError: file not found: %s\n";
|
static char* artDbgMsg = "\nERROR: File not found: %s\n";
|
||||||
static void __declspec(naked) art_data_size_hook() {
|
static void __declspec(naked) art_data_size_hook() {
|
||||||
__asm {
|
__asm {
|
||||||
test edi, edi;
|
test edi, edi;
|
||||||
jz artNotExist;
|
jz artNotExist;
|
||||||
retn;
|
retn;
|
||||||
artNotExist:
|
artNotExist:
|
||||||
mov eax, [esp + 0x124 - 0x1C + 4]; // filename
|
mov edx, [esp + 0x124 - 0x1C + 4]; // filename
|
||||||
push eax;
|
push edx;
|
||||||
push artDbgMsg;
|
push artDbgMsg;
|
||||||
call debug_printf_;
|
call debug_printf_;
|
||||||
mov eax, [esp + 0x124 - 0x1C + 12]; // filename
|
push edx; // filename
|
||||||
push eax;
|
|
||||||
push artDbgMsg;
|
push artDbgMsg;
|
||||||
lea eax, [esp + 0x124 - 0x124 + 20]; // buf
|
lea eax, [esp + 0x124 - 0x124 + 20]; // buf
|
||||||
push eax;
|
push eax;
|
||||||
@@ -360,7 +359,7 @@ static void DebugModePatch() {
|
|||||||
if (iniGetInt("Debugging", "HideObjIsNullMsg", 0, ddrawIniDef)) {
|
if (iniGetInt("Debugging", "HideObjIsNullMsg", 0, ddrawIniDef)) {
|
||||||
MakeJump(0x453FD2, dbg_error_hack);
|
MakeJump(0x453FD2, dbg_error_hack);
|
||||||
}
|
}
|
||||||
// prints a debug message about missing art file for critters to debug.log and the message window
|
// prints a debug message about missing art file for critters to both debug.log and the message window
|
||||||
HookCall(0x419B65, art_data_size_hook);
|
HookCall(0x419B65, art_data_size_hook);
|
||||||
|
|
||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ end:
|
|||||||
|
|
||||||
static void __declspec(naked) DialogHook() {
|
static void __declspec(naked) DialogHook() {
|
||||||
__asm {
|
__asm {
|
||||||
test inLoop, DIALOG; // check bit flag
|
test inLoop, DIALOG; // check byte flag
|
||||||
jz changeMode;
|
jz changeMode;
|
||||||
jmp gdProcess_;
|
jmp gdProcess_;
|
||||||
changeMode:
|
changeMode:
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ static void sf_get_sfall_arg_at();
|
|||||||
static void sf_add_g_timer_event();
|
static void sf_add_g_timer_event();
|
||||||
static void sf_remove_timer_event();
|
static void sf_remove_timer_event();
|
||||||
|
|
||||||
|
static char gTextBuffer[5120]; // used as global temp text buffer for script functions
|
||||||
|
|
||||||
|
// returns the size of the global text buffer
|
||||||
|
inline static const long GlblTextBufferSize() { return sizeof(gTextBuffer); }
|
||||||
|
|
||||||
// variables for new opcodes
|
// variables for new opcodes
|
||||||
#define OP_MAX_ARGUMENTS (8)
|
#define OP_MAX_ARGUMENTS (8)
|
||||||
|
|
||||||
@@ -740,12 +745,10 @@ static DWORD _stdcall GetSfallArgs2() {
|
|||||||
static void __declspec(naked) GetSfallArgs() {
|
static void __declspec(naked) GetSfallArgs() {
|
||||||
__asm {
|
__asm {
|
||||||
push ecx;
|
push ecx;
|
||||||
push edx;
|
|
||||||
call GetSfallArgs2;
|
call GetSfallArgs2;
|
||||||
mov edx, eax;
|
mov edx, eax;
|
||||||
mov eax, ebx;
|
mov eax, ebx;
|
||||||
_RET_VAL_INT2;
|
_RET_VAL_INT2;
|
||||||
pop edx;
|
|
||||||
pop ecx;
|
pop ecx;
|
||||||
retn;
|
retn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
* Misc operators
|
* Misc operators
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char* stringTooLong = "%s() - the string length exceeds maximum of 64 characters.";
|
const char* stringTooLong = "%s() - the string exceeds maximum length of 64 characters.";
|
||||||
|
|
||||||
static void _stdcall SetDMModel2() {
|
static void _stdcall SetDMModel2() {
|
||||||
const ScriptValue &modelArg = opHandler.arg(0);
|
const ScriptValue &modelArg = opHandler.arg(0);
|
||||||
@@ -549,7 +549,6 @@ static int ParseIniSetting(const char* iniString, const char* &key, char section
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char IniStrBuffer[256];
|
|
||||||
static DWORD _stdcall GetIniSetting2(const char* str, DWORD isString) {
|
static DWORD _stdcall GetIniSetting2(const char* str, DWORD isString) {
|
||||||
const char* key;
|
const char* key;
|
||||||
char section[33], file[67];
|
char section[33], file[67];
|
||||||
@@ -558,9 +557,9 @@ static DWORD _stdcall GetIniSetting2(const char* str, DWORD isString) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (isString) {
|
if (isString) {
|
||||||
IniStrBuffer[0] = 0;
|
gTextBuffer[0] = 0;
|
||||||
iniGetString(section, key, "", IniStrBuffer, 256, file);
|
iniGetString(section, key, "", gTextBuffer, 256, file);
|
||||||
return (DWORD)&IniStrBuffer[0];
|
return (DWORD)&gTextBuffer[0];
|
||||||
} else {
|
} else {
|
||||||
return iniGetInt(section, key, -1, file);
|
return iniGetInt(section, key, -1, file);
|
||||||
}
|
}
|
||||||
@@ -1316,8 +1315,8 @@ static void sf_set_ini_setting() {
|
|||||||
|
|
||||||
const char* saveValue;
|
const char* saveValue;
|
||||||
if (argVal.isInt()) {
|
if (argVal.isInt()) {
|
||||||
_itoa_s(argVal.rawValue(), IniStrBuffer, 10);
|
_itoa_s(argVal.rawValue(), gTextBuffer, 10);
|
||||||
saveValue = IniStrBuffer;
|
saveValue = gTextBuffer;
|
||||||
} else {
|
} else {
|
||||||
saveValue = argVal.strValue();
|
saveValue = argVal.strValue();
|
||||||
}
|
}
|
||||||
|
|||||||
+224
-227
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user