Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Initialize.tjs - ????????
- // Copyright (C)2001-2005, W.Dee and contributors ??·???????
- // ?????????
- var kagVersion = "3.25 beta 10 TYPE-MOON customized";
- /*
- Debug.message ?????????
- */
- var dm = Debug.message; // ??? dm("message"); ??????? message ??????
- function dmt(args*)
- {
- Debug.message(args.join(", ")+": "+Scripts.getTraceString());
- }
- @if(DEBUG==1)
- var _dm = Debug.message;
- @endif
- @if(DEBUG!=1)
- var _dm = function(){};
- @endif
- @if(!DEBUG)
- {
- System.setArgument("-debugwin", "no");
- // System.setArgument("-datapath", "$(personalpath)\savedata");
- System.setArgument("-drawthred", "auto");
- System.setArgument = function() {}; // ???
- }
- @endif
- /*
- ????????????????????
- */
- System.exceptionHandler = function (e)
- {
- // ????????????????????????????????
- // ?????e ??????????
- if(e instanceof "ConductorException")
- {
- // ??????????????
- Debug.logAsError(); // ????????????????????
- var event_disabled = System.eventDisabled;
- System.eventDisabled = true;
- // ??????????????????????????
- // ???????????????????????
- System.inform(e.message);
- System.eventDisabled = event_disabled;
- // ???????????????????
- return true; // true ????????????????????
- }
- else
- {
- return false; // false ???????????
- }
- };
- /*
- ?????
- ?????????????????????
- */
- function useArchiveIfExists(name)
- {
- // name ??????????????????
- var arcname;
- if(Storages.isExistentStorage(arcname = System.exePath + name))
- Storages.addAutoPath(arcname + ">");
- }
- Storages.addAutoPath(System.exePath + "video/"); // exePath ??? video/
- Storages.addAutoPath(RootDirectory+"voice/"); // voice ????
- Storages.addAutoPath(RootDirectory+"video/"); // video ????
- Storages.addAutoPath(RootDirectory+"etc/"); // ???
- Storages.addAutoPath(RootDirectory+"rule/"); // ?????????
- Storages.addAutoPath(RootDirectory+"sound/"); // ???????
- Storages.addAutoPath(RootDirectory+"bgm/"); // BGM ????
- Storages.addAutoPath(RootDirectory+"fgimage/"); // ????????
- Storages.addAutoPath(RootDirectory+"bgimage/"); // ????????
- Storages.addAutoPath(RootDirectory+"scenario/"); // ????????
- Storages.addAutoPath(RootDirectory+"image/"); // ???????????
- Storages.addAutoPath(RootDirectory+"system/"); // ????????
- Storages.addAutoPath(RootDirectory+"plugin/"); // ?????
- @if(DEBUG)
- Plugins.link("dirlist.dll");
- var dirs = [ "bgimage/", "fgimage/", "image/", "scenario/", "rule/", "sound/", "etc/", "voice/" ];
- for(var i=0; i<dirs.count; i++)
- {
- var dir = dirs[i];
- var files = getDirList(dir);
- for(var i=0; i<files.count; i++)
- {
- var fn = files[i];
- if(fn[0] == ".")
- continue;
- if(fn[fn.length - 1] == "/")
- {
- dirs.add(dir + fn);
- Storages.addAutoPath(RootDirectory+dir+fn);
- }
- }
- }
- @endif
- /*
- {// ????????(patch?????)
- Debug.message("start \"add auto path\"");
- var path = Scripts.evalStorage("searchpath.ksc");
- for(var i=path.count-1; i>=0; i--)
- {
- if(path[i] == void)
- continue;
- Storages.addAutoPath(RootDirectory+path[i]);
- Debug.message("add auto path: "+RootDirectory+path[i]);
- }
- }
- {// Fate_PS2?????
- Plugins.link("dirlist.dll");
- var base = "d:/Fate_PS2/data/";
- var dirs = [ "bgimage/", "fgimage/", "sound/", "bgm/" ];
- for(var i=0; i<dirs.count; i++)
- {
- var dir = dirs[i];
- var files = getDirList(base + dir);
- for(var i=0; i<files.count; i++)
- {
- var file = files[i];
- if(file[0] != "." && file[file.length-1] == "/")
- {
- Debug.message("add auto path: "+base + dir+file);
- dirs.add(dir+file);
- }
- }
- Storages.addAutoPath(base + dir);
- }
- }
- */
- // ??????????????
- // ???????????????????????????
- // ????????????????????
- useArchiveIfExists("voice.xp3");
- useArchiveIfExists("video.xp3");
- useArchiveIfExists("others.xp3");
- useArchiveIfExists("rule.xp3");
- useArchiveIfExists("sound.xp3");
- useArchiveIfExists("bgm.xp3");
- useArchiveIfExists("etc.xp3");
- useArchiveIfExists("fgimage.xp3");
- useArchiveIfExists("bgimage.xp3");
- useArchiveIfExists("scenario.xp3");
- useArchiveIfExists("image.xp3");
- useArchiveIfExists("system.xp3");
- useArchiveIfExists("patch.xp3");
- // ???????????????
- /*
- for(var i = 2; ; i++)
- {
- // ????????? patch2.xp3, patch3.xp3 ... ??????????
- // ???????????
- if(Storages.isExistentStorage(System.exePath + "patch" + i + ".xp3"))
- Storages.addAutoPath(System.exePath + "patch" + i + ".xp3>");
- else
- break;
- }
- */
- delete useArchiveIfExists; // useArchiveIfExists ????????????????
- /*
- ?????????
- */
- Debug.notice("OS : " + System.osName + " (" + System.platformName + ")");
- Debug.notice("KAG : " + kagVersion);
- Debug.notice("Kirikiri : " + System.versionString);
- /*
- ( ???? ) ????
- */
- var parseStartTick = System.getTickCount();
- /*
- ?????????????
- */
- function KAGLoadScript(name)
- {
- var start = System.getTickCount();
- Scripts.execStorage(name);
- dm(name + " ????????(" + (System.getTickCount() - start) + "ms)");
- }
- var loaded_scripts = %[];
- function KAGLoadScriptOnce(name)
- {
- // ??????????????????????????
- if(global.loaded_scripts[name] === true) return; // ?????????
- global.KAGLoadScript(name);
- global.loaded_scripts[name] = true;
- }
- /*
- Config.tjs ????
- */
- if(Storages.isExistentStorage("Config.tjs"))
- {
- KAGLoadScript("Config.tjs");
- }
- else if(Storages.isExistentStorage("Config.~new"))
- {
- System.inform("Config.tjs ?????????\nsystem ??????? "
- "Config.~new ????? Config.tjs ??????????");
- System.exit();
- }
- else
- {
- throw new Exception("Config.tjs ?????????");
- }
- /*
- Config.tjs ?????????
- */
- if(typeof global.config_version == "undefined" || config_version != kagVersion)
- {
- KAGLoadScript("UpdateConfig.tjs");
- }
- // savedata ?????????
- @if(!DEBUG)
- {
- var dir = System.personalPath + "faterealtanua_savedata/";
- try
- {
- Plugins.link("dirlist.dll");
- var files = getDirList(dir);
- var patches = [];
- for(var i=0; i<files.count; i++)
- {
- var fn = files[i];
- if(fn.substr(0, 8) == "rinpatch" && Storages.extractStorageExt(fn) == ".xp3")
- patches.add(fn);
- }
- patches.sort("a");
- for(var i=0; i<patches.count; i++)
- {
- Storages.addAutoPath(dir + patches[i] + ">");
- // ???????????????
- }
- }
- catch(e)
- dm(dir+" ??????????");
- }
- @endif
- /*
- ?????????
- */
- // ???????????????????????
- if(RootDirectory==void && !System.createAppLock(System.exePath.replace(/[^A-Za-z]/g, '_')))
- {
- // ?????????
- System.inform(System.title + "???????????");
- System.exit();
- }
- /*
- ??·????·??????????????
- */
- property askYesNo { getter() { KAGLoadScript("YesNoDialog.tjs"); return global.askYesNo; } }
- property CheckBoxLayer { getter() { KAGLoadScript("CheckBoxLayer.tjs"); return global.CheckBoxLayer; } }
- property ButtonLayer { getter() { KAGLoadScript("ButtonLayer.tjs"); return global.ButtonLayer; } }
- property EditLayer { getter() { KAGLoadScript("EditLayer.tjs"); return global.EditLayer; } }
- property KAGPlugin { getter() { KAGLoadScript("Plugin.tjs"); return global.KAGPlugin; } }
- /*
- ?????????
- */
- dm("KAG System ??????????????...");
- KAGLoadScript("Utils.tjs");
- KAGLoadScript("KAGLayer.tjs");
- KAGLoadScript("HistoryLayer.tjs");
- KAGLoadScript("BGM.tjs");
- KAGLoadScript("SE.tjs");
- KAGLoadScript("Movie.tjs");
- KAGLoadScript("Conductor.tjs");
- KAGLoadScript("AnimationLayer.tjs");
- KAGLoadScript("GraphicLayer.tjs");
- @set(OLDMESSAGELAYER=1)
- @if(OLDMESSAGELAYER==1)
- KAGLoadScript("MessageLayer.tjs");
- @endif
- @if(OLDMESSAGELAYER!=1)
- KAGLoadScript("ActingMessageLayer.tjs");
- @endif
- KAGLoadScript("Menus.tjs");
- //KAGLoadScript("DefaultMover.tjs");
- KAGLoadScript("MainWindow.tjs");
- if(Storages.isExistentStorage("Override.tjs"))
- KAGLoadScript("Override.tjs");
- /*
- if(Storages.isExistentStorage(System.exePath + "Override2.tjs"))
- KAGLoadScript(System.exePath + "Override2.tjs");
- */
- /*
- ( ???? ) ????
- */
- dm("??????????? " + (System.getTickCount() - parseStartTick) + "ms ??????");
- parseStartTick = System.getTickCount();
- /*
- ( ???? ) VM ???????
- */
- // Scripts.dump();
- /*
- ( ???? ) ????
- */
- parseStartTick = System.getTickCount();
- /*
- KAG ???????????
- ???????? kag ???????? KAGWindow ????
- ??????????????
- */
- global.kag = new KAGWindow();// if typeof global.kag == "undefined"; // ScenarioEditer????
- /*
- ??????????????????????????
- ????????
- */
- var f = kag.flags; // ????? (???)
- var sf = kag.sflags; // ?????? (????)
- var tf = kag.tflags; // ???? (?????)
- property mp
- {
- getter { return kag.conductor.macroParams; }
- }
- /*
- ( ???? ) ????
- */
- dm("KAGMainWindow ????????? " + (System.getTickCount() - parseStartTick) + "ms ??????");
- delete parseStartTick;
- /*
- AfterInit.tjs ????????
- */
- if(Storages.isExistentStorage("AfterInit.tjs"))
- KAGLoadScript("AfterInit.tjs");
- /*
- if(Storages.isExistentStorage(System.exePath + "AfterInit2.tjs"))
- KAGLoadScript(System.exePath + "AfterInit2.tjs");
- */
- /*
- ??????????????? -ovr ?????????
- ???????? TJS ??????
- */
- /*
- {
- var ovr = System.getArgument('-ovr');
- if(ovr !== void && ovr != 'yes') Scripts.eval(ovr);
- }
- */
- // krkr 2.25 beta 8 ????exe??"imageTagLayerType"???????????????
- if(typeof global.imageTagLayerType == "undefined")
- {
- global.imageTagLayerType = %[
- opaque: %[type:ltOpaque],
- rect: %[type:ltOpaque],
- addalpha: %[type:ltAddAlpha],
- add: %[type:ltAdditive],
- sub: %[type:ltSubtractive],
- mul: %[type:ltMultiplicative],
- dodge: %[type:ltDodge],
- darken: %[type:ltDarken],
- lighten: %[type:ltLighten],
- screen: %[type:ltScreen],
- ];
- }
- /*
- first.ks ???
- */
- kag.process("first.ks");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement