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