Conversation
…iables on a per reference/instance basis instead of per record. same goes for subscripts. many papyrus calls now respect target properly now as well including startscript. these fixes bring us much closer to parity with morrowind script execution.
…ild of the game world and played through some of the main quest. Everything seems to be working just fine!
| private int nxtGenStateId; | ||
|
|
||
| public DialogESD(ESM esm, Layout layout, MainSoundBank sound, ScriptManager scriptManager, Paramanager paramanager, TextManager textManager, ItemManager itemManager, SpeffManager speffManager, Script areaScript, uint id, CharacterContent npcContent, List<NpcManager.TopicData> topicData) | ||
| public DialogESD(ESM esm, Layout layout, SoulsFormats.MSBE msb, MainSoundBank sound, ScriptManager scriptManager, Paramanager paramanager, TextManager textManager, ItemManager itemManager, SpeffManager speffManager, Script areaScript, uint id, CharacterContent npcContent, List<NpcManager.TopicData> topicData) |
There was a problem hiding this comment.
one more constructor param, as a treat
There was a problem hiding this comment.
Clearly it didn't have enough already
horfius
left a comment
There was a problem hiding this comment.
Main is getting more bloated from this. I really got to take a look at refactoring the structure of that file to break it up a little more. The sections are more clear at least, so it's really just sharing variables and scope that is the challenge.
| retFlag = scriptManager.GetFlag(Script.Flag.Designation.Local, varName); // look for it, if we dont find it we create it | ||
| if (retFlag == null) { retFlag = scriptManager.common.CreateFlag(Script.Flag.Category.Saved, Script.Flag.Type.Short, Script.Flag.Designation.Local, varName); } | ||
| // Find refernce to object that matches the record id of this local var | ||
| string recordId = varName.Split(".")[0].Replace("\"", "").Trim(); |
There was a problem hiding this comment.
Should assign varName.Split(".") to a local var just to reduce duplication.
| interiors = new(); | ||
|
|
||
| Lort.Log("Generating layout...", Lort.Type.Main); | ||
| Lort.NewTask("Generating Layout", 14); |
| /* Creatures */ | ||
| foreach (CreatureContent creature in tile.creatures) | ||
| { | ||
| Override.EnemyRemap remap = Override.GetEnemyRemap(creature.id); |
There was a problem hiding this comment.
Do you need to handle null?
| MSBE.Part.Asset asset = MakePart.Asset(pickableInfo); | ||
| asset.Position = content.relative + Const.MSB_OFFSET; | ||
| asset.Rotation = content.rotation; | ||
| asset.Scale = new Vector3(content.scale * 0.01f); |
There was a problem hiding this comment.
Probably should make the 0.01f a named constant.
| retFlag = scriptManager.GetFlag(Script.Flag.Designation.Local, varName); // look for it, if we dont find it we create it | ||
| if (retFlag == null) { retFlag = scriptManager.common.CreateFlag(Script.Flag.Category.Saved, Script.Flag.Type.Short, Script.Flag.Designation.Local, varName); } | ||
| // Find refernce to object that matches the record id of this local var | ||
| string recordId = varName.Split(".")[0].Replace("\"", "").Trim(); |
There was a problem hiding this comment.
Should move varName.Split to a local var to reduce duplication.
|
|
||
| public static void InitializeLocalVariables(ESM esm, ScriptManager scriptManager, BaseScript script, Papyrus papyrus, Content content) | ||
| { | ||
| void DoStuff(Papyrus p) |
There was a problem hiding this comment.
It's a bit pointless to make this internal function and then have it be the only thing that's called.
|
|
||
| pc = 0; | ||
|
|
||
| string[] spawnHandlerWithDisableRaw = new string[] |
There was a problem hiding this comment.
Can be done like this instead, but I don't know how ParseAddArg handles multiline string.
$"""
SkipIfEventFlag(...)
ChangeCharacterEnableState(...)
...
"""
Reworking the Papyrus and Dialog compilation process to be staged out and separate from the MSB generation process. This allows me to create flags and variables in a preprocess stage which will make compiling cleaner and more consistent.