mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Corrected/edited some code.
This commit is contained in:
+2
-2
@@ -724,8 +724,8 @@ CreditsAtBottom=0
|
|||||||
;Paths outside of scripts folder are supported
|
;Paths outside of scripts folder are supported
|
||||||
GlobalScriptPaths=scripts\gl*.int,scripts\sfall\gl*.int
|
GlobalScriptPaths=scripts\gl*.int,scripts\sfall\gl*.int
|
||||||
|
|
||||||
;Uncomment the option to specify a common folder path for all scripted ini configuration files
|
;Uncomment the option to specify a common folder path for all ini files used by scripts
|
||||||
;You will need to place all the available ini files of the mods to this directory
|
;You will have to put all the available ini files of the mods in this directory
|
||||||
;The maximum length of the specified path is 61 characters
|
;The maximum length of the specified path is 61 characters
|
||||||
;IniConfigFolder=IniConfig
|
;IniConfigFolder=IniConfig
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ void Criticals::init() {
|
|||||||
mode = GetConfigInt("Misc", "OverrideCriticalTable", 2);
|
mode = GetConfigInt("Misc", "OverrideCriticalTable", 2);
|
||||||
if (mode < 0 || mode > 3) mode = 0;
|
if (mode < 0 || mode > 3) mode = 0;
|
||||||
if (mode) {
|
if (mode) {
|
||||||
critTableFile += GetConfigString("Misc", "OverrideCriticalFile", "CriticalOverrides.ini", MAX_PATH - 3);
|
critTableFile += GetConfigString("Misc", "OverrideCriticalFile", "CriticalOverrides.ini", MAX_PATH);
|
||||||
CriticalTableOverride();
|
CriticalTableOverride();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -602,12 +602,11 @@ 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++) {
|
||||||
fo::func::runProgram(it->second.ptr);
|
fo::func::runProgram(it->second.ptr);
|
||||||
}
|
}
|
||||||
}
|
} else if (procId == fo::ScriptProc::map_exit_p_proc) onMapExit.invoke();
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
if (procId == fo::ScriptProc::map_exit_p_proc) onMapExit.invoke();
|
|
||||||
|
|
||||||
return procId; // restore eax (don't delete)
|
return procId; // restore eax (don't delete)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,7 +725,7 @@ void ScriptExtender::init() {
|
|||||||
dlogr("Arrays in backward-compatiblity mode.", DL_SCRIPT);
|
dlogr("Arrays in backward-compatiblity mode.", DL_SCRIPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
iniConfigFolder = GetConfigString("Scripts", "IniConfigFolder", "");
|
iniConfigFolder = GetConfigString("Scripts", "IniConfigFolder", "", 64);
|
||||||
size_t len = iniConfigFolder.length();
|
size_t len = iniConfigFolder.length();
|
||||||
if (len) {
|
if (len) {
|
||||||
char c = iniConfigFolder[len - 1];
|
char c = iniConfigFolder[len - 1];
|
||||||
|
|||||||
@@ -276,24 +276,22 @@ void sf_round(OpcodeContext& ctx) {
|
|||||||
|
|
||||||
void sf_message_str_game(OpcodeContext& ctx) {
|
void sf_message_str_game(OpcodeContext& ctx) {
|
||||||
const char* msg = nullptr;
|
const char* msg = nullptr;
|
||||||
const ScriptValue &fileIdArg = ctx.arg(0),
|
|
||||||
&msgIdArg = ctx.arg(1);
|
|
||||||
|
|
||||||
int fileId = fileIdArg.asInt();
|
int fileId = ctx.arg(0).rawValue();
|
||||||
int msgId = msgIdArg.asInt();
|
if (fileId >= 0) {
|
||||||
if (fileId >= 0 && fileId <= 19) { // main msg files
|
int msgId = ctx.arg(1).rawValue();
|
||||||
msg = fo::GetMessageStr(gameMsgFiles[fileId], msgId);
|
if (fileId < 20) { // main msg files
|
||||||
} else if (fileId >= 0x1000 && fileId <= 0x1005) { // proto msg files
|
msg = fo::GetMessageStr(gameMsgFiles[fileId], msgId);
|
||||||
msg = fo::GetMessageStr(&fo::var::proto_msg_files[fileId - 0x1000], msgId);
|
} else if (fileId >= 0x1000 && fileId <= 0x1005) { // proto msg files
|
||||||
} else if (fileId >= 0x2000) { // Extra game message files.
|
msg = fo::GetMessageStr(&fo::var::proto_msg_files[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.get(), msgId, 2);
|
if (it != gExtraGameMsgLists.end()) {
|
||||||
|
msg = GetMsg(it->second.get(), msgId, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg == nullptr) {
|
if (msg == nullptr) msg = "Error";
|
||||||
msg = "Error";
|
|
||||||
}
|
|
||||||
ctx.setReturn(msg);
|
ctx.setReturn(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,8 +70,7 @@ ScriptValue::ScriptValue(fo::GameObject* obj) {
|
|||||||
_type = DataType::INT;
|
_type = DataType::INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScriptValue::isInt() const
|
bool ScriptValue::isInt() const {
|
||||||
{
|
|
||||||
return _type == DataType::INT;
|
return _type == DataType::INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ void Skills::init() {
|
|||||||
HookCall(0x47831E, item_w_skill_hook);
|
HookCall(0x47831E, item_w_skill_hook);
|
||||||
|
|
||||||
char buf[512], key[16];
|
char buf[512], key[16];
|
||||||
auto skillsFile = GetConfigString("Misc", "SkillsFile", "");
|
auto skillsFile = GetConfigString("Misc", "SkillsFile", "", MAX_PATH);
|
||||||
if (!skillsFile.empty()) {
|
if (!skillsFile.empty()) {
|
||||||
fo::SkillInfo *skills = fo::var::skill_data;
|
fo::SkillInfo *skills = fo::var::skill_data;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -285,7 +285,7 @@ inline void SfallInit() {
|
|||||||
strcpy_s(ini, ::sfall::ddrawIni);
|
strcpy_s(ini, ::sfall::ddrawIni);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetConfigString("Main", "TranslationsINI", "./Translations.ini", translationIni, 65);
|
GetConfigString("Main", "TranslationsINI", ".\\Translations.ini", translationIni, 65);
|
||||||
modifiedIni = GetConfigInt("Main", "ModifiedIni", 0);
|
modifiedIni = GetConfigInt("Main", "ModifiedIni", 0);
|
||||||
|
|
||||||
InitModules();
|
InitModules();
|
||||||
|
|||||||
Reference in New Issue
Block a user