Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New script editor!! #21

Merged
merged 13 commits into from
Feb 6, 2023
12 changes: 11 additions & 1 deletion src/SerialLoops.Lib/IO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,21 @@ public static void OpenRom(Project project, string romPath)
new(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Sources", "linker.x")),
new(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Sources", "Makefile_main"), "Makefile"),
});
IODirectory assetsDirectoryTree = new("assets", new IODirectory[]
{
new("data", Array.Empty<IODirectory>(), Array.Empty<IOFile>()),
new("events", Array.Empty<IODirectory>(), Array.Empty<IOFile>()),
new("graphics", Array.Empty<IODirectory>(), Array.Empty<IOFile>()),
new("misc", Array.Empty<IODirectory>(), new IOFile[] { new(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Sources", "charset.json")) }),
new("movie", Array.Empty<IODirectory>(), Array.Empty<IOFile>()),
new("scn", Array.Empty<IODirectory>(), Array.Empty<IOFile>()),
}, Array.Empty<IOFile>());
originalDirectoryTree.Create(project.BaseDirectory);
originalDirectoryTree.Create(project.IterativeDirectory);
srcDirectoryTree.Create(project.BaseDirectory);
srcDirectoryTree.Create(project.IterativeDirectory);

assetsDirectoryTree.Create(project.BaseDirectory);
assetsDirectoryTree.Create(project.IterativeDirectory);

// Copy out the files we need to build the ROM
CopyFiles(Path.Combine(project.BaseDirectory, "rom", "data"), Path.Combine(project.BaseDirectory, "original", "archives"), "*.bin");
Expand Down
18 changes: 18 additions & 0 deletions src/SerialLoops.Lib/Items/BackgroundMusicItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace SerialLoops.Lib.Items
{
public class BackgroundMusicItem : Item
{
public string BgmFile { get; set; }
public int Index { get; set; }

public BackgroundMusicItem(string bgmFile, int index) : base(bgmFile, ItemType.BGM)
{
BgmFile = bgmFile;
Index = index;
}

public override void Refresh(Project project)
{
}
}
}
3 changes: 3 additions & 0 deletions src/SerialLoops.Lib/Items/ItemDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ public class ItemDescription
{

public string Name { get; protected set; }
public string DisplayName => UnsavedChanges ? $"{Name} *" : Name;
public ItemType Type { get; private set; }
public bool UnsavedChanges { get; set; } = false;

public ItemDescription(string name, ItemType type)
{
Expand All @@ -26,6 +28,7 @@ public enum ItemType
Puzzle,
Scenario,
Script,
Sfx,
System_Texture,
Topic,
Transition,
Expand Down
5 changes: 4 additions & 1 deletion src/SerialLoops.Lib/Items/MapItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ namespace SerialLoops.Lib.Items
public class MapItem : Item
{
public MapFile Map { get; set; }
public int QmapIndex { get; set; }

public MapItem(string name) : base(name, ItemType.Map)
{
}
public MapItem(MapFile map) : base(map.Name[0..^1], ItemType.Map)
public MapItem(MapFile map, int qmapIndex) : base(map.Name[0..^1], ItemType.Map)
{
Map = map;
QmapIndex = qmapIndex;
}

public override void Refresh(Project project)
Expand Down
6 changes: 1 addition & 5 deletions src/SerialLoops.Lib/Items/ScriptItem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using HaruhiChokuretsuLib.Archive;
using HaruhiChokuretsuLib.Archive.Data;
using HaruhiChokuretsuLib.Archive.Event;
using HaruhiChokuretsuLib.Archive.Graphics;
using HaruhiChokuretsuLib.Archive.Event;

namespace SerialLoops.Lib.Items
{
Expand All @@ -19,7 +16,6 @@ public ScriptItem(EventFile evt) : base(evt.Name[0..^1], ItemType.Script)

public override void Refresh(Project project)
{
throw new System.NotImplementedException();
}
}
}
2 changes: 1 addition & 1 deletion src/SerialLoops.Lib/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void LoadArchives(ILogger log)
QMapFile qmap = Dat.Files.First(f => f.Name == "QMAPS").CastTo<QMapFile>();
Items.AddRange(Dat.Files
.Where(d => qmap.QMaps.Select(q => q.Name.Replace(".", "")).Contains(d.Name))
.Select(m => new MapItem(m.CastTo<MapFile>())));
.Select(m => new MapItem(m.CastTo<MapFile>(), qmap.QMaps.FindIndex(q => q.Name.Replace(".", "") == m.Name))));
Items.AddRange(Dat.Files
.Where(d => d.Name.StartsWith("SLG"))
.Select(d => new PuzzleItem(d.CastTo<PuzzleFile>(), this)));
Expand Down
16 changes: 16 additions & 0 deletions src/SerialLoops.Lib/Script/BgScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using SerialLoops.Lib.Items;

namespace SerialLoops.Lib.Script
{
public class BgScriptParameter : ScriptParameter
{
public BackgroundItem Background { get; set; }
public bool Kinetic { get; set; }

public BgScriptParameter(string name, BackgroundItem background, bool kinetic) : base(name, ParameterType.BG)
{
Background = background;
Kinetic = kinetic;
}
}
}
28 changes: 28 additions & 0 deletions src/SerialLoops.Lib/Script/BgScrollDirectionScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SerialLoops.Lib.Script
{
public class BgScrollDirectionScriptParameter : ScriptParameter
{
public BgScrollDirection ScrollDirection { get; set; }

public BgScrollDirectionScriptParameter(string name, short scrollDirection) : base(name, ParameterType.BG_SCROLL_DIRECTION)
{
ScrollDirection = (BgScrollDirection)scrollDirection;
}

public enum BgScrollDirection : short
{
DOWN = 1,
UP = 2,
LEFT = 3,
RIGHT = 4,
DIAGONAL_RIGHT_DOWN = 5,
DIAGONAL_LEFT_UP = 6,
}
}
}
18 changes: 18 additions & 0 deletions src/SerialLoops.Lib/Script/BgmModeScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace SerialLoops.Lib.Script
{
public class BgmModeScriptParameter : ScriptParameter
{
public BgmMode Mode { get; set; }

public BgmModeScriptParameter(string name, short mode) : base(name, ParameterType.BGM_MODE)
{
Mode = (BgmMode)mode;
}

public enum BgmMode : short
{
START = 2,
STOP = 4,
}
}
}
19 changes: 19 additions & 0 deletions src/SerialLoops.Lib/Script/BgmScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using SerialLoops.Lib.Items;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SerialLoops.Lib.Script
{
public class BgmScriptParameter : ScriptParameter
{
public BackgroundMusicItem Bgm { get; set; }

public BgmScriptParameter(string name, BackgroundMusicItem bgm) : base(name, ParameterType.BGM)
{
Bgm = bgm;
}
}
}
10 changes: 1 addition & 9 deletions src/SerialLoops.Lib/Script/BoolScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SerialLoops.Lib.Script
namespace SerialLoops.Lib.Script
{
public class BoolScriptParameter : ScriptParameter
{
Expand All @@ -14,7 +8,5 @@ public BoolScriptParameter(string name, bool value) : base(name, ParameterType.B
{
Value = value;
}


}
}
12 changes: 12 additions & 0 deletions src/SerialLoops.Lib/Script/ChessFileScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace SerialLoops.Lib.Script
{
public class ChessFileScriptParameter : ScriptParameter
{
public short ChessFileIndex { get; set; }

public ChessFileScriptParameter(string name, short chessFileIndex) : base(name, ParameterType.CHESS_FILE)
{
ChessFileIndex = chessFileIndex;
}
}
}
12 changes: 12 additions & 0 deletions src/SerialLoops.Lib/Script/ChessPieceScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace SerialLoops.Lib.Script
{
public class ChessPieceScriptParameter : ScriptParameter
{
public short ChessPiece { get; set; }

public ChessPieceScriptParameter(string name, short chessPiece) : base(name, ParameterType.CHESS_PIECE)
{
ChessPiece = chessPiece;
}
}
}
15 changes: 15 additions & 0 deletions src/SerialLoops.Lib/Script/ChessSpaceScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Security.Cryptography.X509Certificates;

namespace SerialLoops.Lib.Script
{
public class ChessSpaceScriptParameter : ScriptParameter
{
public short SpaceIndex { get; set; }

public ChessSpaceScriptParameter(string name, short spaceIndex) : base(name, ParameterType.CHESS_SPACE)
{
SpaceIndex = spaceIndex;
}

}
}
21 changes: 21 additions & 0 deletions src/SerialLoops.Lib/Script/ChibiEmoteScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace SerialLoops.Lib.Script
{
public class ChibiEmoteScriptParameter : ScriptParameter
{
public ChibiEmote Emote { get; set; }

public ChibiEmoteScriptParameter(string name, short emote) : base(name, ParameterType.CHIBI_EMOTE)
{
Emote = (ChibiEmote)emote;
}

public enum ChibiEmote : short
{
EXCLAMATION_POINT = 1,
LIGHT_BULB = 2,
ANGER_MARK = 3,
MUSIC_NOTE = 4,
SWEAT_DROP = 5,
}
}
}
18 changes: 18 additions & 0 deletions src/SerialLoops.Lib/Script/ChibiEnterExitScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace SerialLoops.Lib.Script
{
public class ChibiEnterExitScriptParameter : ScriptParameter
{
public ChibiEnterExitType Mode { get; set; }

public ChibiEnterExitScriptParameter(string name, short mode) : base(name, ParameterType.CHIBI_ENTER_EXIT)
{
Mode = (ChibiEnterExitType)mode;
}

public enum ChibiEnterExitType
{
ENTER = 0,
EXIT = 1,
}
}
}
14 changes: 14 additions & 0 deletions src/SerialLoops.Lib/Script/ChibiScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using SerialLoops.Lib.Items;

namespace SerialLoops.Lib.Script
{
public class ChibiScriptParameter : ScriptParameter
{
public ChibiItem Chibi { get; set; }

public ChibiScriptParameter(string name, ChibiItem chibi) : base(name, ParameterType.CHIBI)
{
Chibi = chibi;
}
}
}
19 changes: 19 additions & 0 deletions src/SerialLoops.Lib/Script/ColorMonochromeScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace SerialLoops.Lib.Script
{
public class ColorMonochromeScriptParameter : ScriptParameter
{
public ColorMonochrome ColorType { get; set; }

public ColorMonochromeScriptParameter(string name, short colorType) : base(name, ParameterType.COLOR_MONOCHROME)
{
ColorType = (ColorMonochrome)colorType;
}

public enum ColorMonochrome : short
{
CUSTOM = 0,
BLACK = 1,
WHITE = 2,
}
}
}
30 changes: 30 additions & 0 deletions src/SerialLoops.Lib/Script/ColorScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using SkiaSharp;

namespace SerialLoops.Lib.Script
{
public class ColorScriptParameter : ScriptParameter
{
private byte _red;
private byte _green;
private byte _blue;

public SKColor Color { get; set; }

public ColorScriptParameter(string name, short red) : base(name, ParameterType.COLOR)
{
_red = (byte)red;
}

public void SetGreen(short green)
{
_green = (byte)green;
}

public void SetBlue(short blue)
{
_blue = (byte)blue;

Color = new(_red, _green, _blue);
}
}
}
12 changes: 12 additions & 0 deletions src/SerialLoops.Lib/Script/ConditionalScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace SerialLoops.Lib.Script
{
public class ConditionalScriptParameter : ScriptParameter
{
public string Value { get; set; }

public ConditionalScriptParameter(string name, string value) : base(name, ParameterType.CONDITIONAL)
{
Value = value;
}
}
}
14 changes: 14 additions & 0 deletions src/SerialLoops.Lib/Script/DialoguePropertyScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using HaruhiChokuretsuLib.Archive.Data;

namespace SerialLoops.Lib.Script
{
public class DialoguePropertyScriptParameter : ScriptParameter
{
public MessageInfo DialogueProperties { get; set; }

public DialoguePropertyScriptParameter(string name, MessageInfo dialogueProperties) : base(name, ParameterType.DIALOGUE_PROPERTY)
{
DialogueProperties = dialogueProperties;
}
}
}
14 changes: 14 additions & 0 deletions src/SerialLoops.Lib/Script/DialogueScriptParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using HaruhiChokuretsuLib.Archive.Event;

namespace SerialLoops.Lib.Script
{
public class DialogueScriptParameter : ScriptParameter
{
public DialogueLine Line { get; set; }

public DialogueScriptParameter(string name, DialogueLine line) : base(name, ParameterType.DIALOGUE)
{
Line = line;
}
}
}
Loading