Skip to content

Commit

Permalink
Custom Dialogue Characters Complete?? some bugs
Browse files Browse the repository at this point in the history
Also other stuff
  • Loading branch information
CamLikesKirby committed May 29, 2024
1 parent cc9c68a commit bae7121
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 7 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/preload/locale/en-US/textList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,5 +410,8 @@ credit_Cotiles==Beta Tester
//Extra Keys Addon Creator
credit_Magman==Extra Keys Charter, Coder, Shaggy Covers, 3D Extra Keys Note Sprite

//The Mod
credit_Cam==Created Dave and Bambi Moddable

//Special Thanks
credit_You!==For playing the mod and contributing to the growth of the community we created.
5 changes: 5 additions & 0 deletions mods/test/data/characters/dialogue/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"x": 200,
"y": 220,
"right": true
}
1 change: 1 addition & 0 deletions mods/test/data/charts/test-dia.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test:normal:bf:normal:DaveDialogue
5 changes: 3 additions & 2 deletions mods/test/data/dialogue/test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:bf:Yoo it me pixel bf in the funny test song!
:test,normal:Yoo it me pixel bf in the funny test song!
:test,normal:Yoo it me pixel bf in the funny test song!
:bf:Shut up
:bf:ok
:test,normal:ok
Empty file.
Binary file added mods/test/images/dialogue/test/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 20 additions & 4 deletions source/CreditsMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,15 @@ class CreditsMenuState extends MusicBeatState
new Social('youtube', 'https://www.youtube.com/channel/UC1IWpXJIB0wYTCnQI0E9HMQ'),
new Social('twitter', 'https://twitter.com/magar_manh')
]),
// The Mod
new Person("Cam", CreditsType.TheMod,
[
new Social('youtube', 'https://www.youtube.com/@CamtheKirby'),
new Social('discord', 'camthekirby'),
new Social('twitter', 'https://x.com/camthekirby1'),
new Social('roblox', 'https://www.roblox.com/users/2232065384/profile'),
new Social('gamebanana', 'https://gamebanana.com/members/1795786')
], true),
// Special Thanks //
new Person("You!", CreditsType.SpecialThanks, [])
];
Expand Down Expand Up @@ -442,6 +451,7 @@ class CreditsMenuState extends MusicBeatState
var betaTesters:Array<Person> = new Array<Person>();
var specialThanks:Array<Person> = new Array<Person>();
var ekaCreator:Array<Person> = new Array<Person>();
var theMod:Array<Person> = new Array<Person>();

for (person in peopleInCredits)
{
Expand All @@ -453,13 +463,14 @@ class CreditsMenuState extends MusicBeatState
case BetaTester: betaTesters.push(person);
case SpecialThanks: specialThanks.push(person);
case EKACreator: ekaCreator.push(person);
case TheMod: theMod.push(person);
}
}

for (i in 0...peopleInCredits.length)
{
var currentPerson = peopleInCredits[i];
if (currentPerson == developers[0] || currentPerson == translators[0] || currentPerson == contributors[0] || currentPerson == betaTesters[0] || currentPerson == specialThanks[0] || currentPerson == ekaCreator[0])
if (currentPerson == developers[0] || currentPerson == translators[0] || currentPerson == contributors[0] || currentPerson == betaTesters[0] || currentPerson == specialThanks[0] || currentPerson == ekaCreator[0] || currentPerson == theMod[0])
{
switch (currentPerson.creditsType)
{
Expand All @@ -481,6 +492,9 @@ class CreditsMenuState extends MusicBeatState
case EKACreator:
creditsTypeString = 'Extra Keys Addon Creator';
translatedCreditsType = LanguageManager.getTextString('credits_ekaCreator');
case TheMod:
creditsTypeString = 'Mod Devs';
translatedCreditsType = 'Mod Devs';
}
var titleText:FlxText = new FlxText(0, 0, 0, translatedCreditsType);
titleText.setFormat("Comic Sans MS Bold", 64, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
Expand Down Expand Up @@ -810,7 +824,7 @@ class CreditsMenuState extends MusicBeatState
credits.setFormat(selectedFormat.font, selectedFormat.size, selectedFormat.color, selectedFormat.alignment, selectedFormat.borderStyle, selectedFormat.borderColor);
credits.screenCenter(X);
credits.updateHitbox();
credits.antialiasing = true;
credits.antialiasing = true;
credits.scrollFactor.set();
credits.active = false;

Expand Down Expand Up @@ -902,12 +916,14 @@ class Person
public var name:String;
public var creditsType:CreditsType;
public var socialMedia:Array<Social>;
public var custom:Bool;

public function new(name:String, creditsType:CreditsType, socialMedia:Array<Social>)
public function new(name:String, creditsType:CreditsType, socialMedia:Array<Social>, custom:Bool = false)
{
this.name = name;
this.creditsType = creditsType;
this.socialMedia = socialMedia;
this.custom = custom;
}
}
class Social
Expand Down Expand Up @@ -969,7 +985,7 @@ class SocialButton
}
enum CreditsType
{
Dev; Translator; Contributor; BetaTester; SpecialThanks; EKACreator;
Dev; Translator; Contributor; BetaTester; SpecialThanks; EKACreator; TheMod;
}
enum State
{
Expand Down
102 changes: 102 additions & 0 deletions source/DialogueBox.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@ import flixel.input.FlxKeyManager;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import sys.FileSystem;
import sys.io.File;
import haxe.Json;

using StringTools;

typedef DiaCharacter =
{
var x:Float;
var y:Float;
var right:Bool;
}

class DialogueBox extends FlxSpriteGroup
{
var box:FlxSprite;
Expand Down Expand Up @@ -51,12 +61,26 @@ class DialogueBox extends FlxSpriteGroup
var debug:Bool = false;

var curshader:Dynamic;
var custom:Array<String>;

public var rawJsonDial:String;
public var jsonDial:DiaCharacter;

public var rawJsonDialTwo:String;
public var jsonDialTwo:DiaCharacter;

public var rawJsonDialThree:String;
public var jsonDialThree:DiaCharacter;

public static var randomNumber:Int;

public function new(talkingRight:Bool = true, ?dialogueList:Array<String>, playMusic:Bool = true)
{
super();

if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-dia.txt')) {
custom = CoolUtil.coolTextFile(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-dia.txt');
}

if (playMusic)
{
Expand Down Expand Up @@ -96,7 +120,19 @@ class DialogueBox extends FlxSpriteGroup
case 'rano':
FlxG.sound.playMusic(Paths.music('stocknightambianceforranolol'), 0);
default:
if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-dia.txt')) {
for (i in 0...custom.length)
{
var data:Array<String> = custom[i].split(':');
if (data[4] == null) {
FlxG.sound.music.stop();
} else {
FlxG.sound.playMusic(Paths.music(data[4]), 0);
}
}
} else {
FlxG.sound.music.stop();
}
}
FlxG.sound.music.fadeIn(1, 0, 0.8);
}
Expand Down Expand Up @@ -170,6 +206,15 @@ class DialogueBox extends FlxSpriteGroup
portraitLeftCharacter = ['dave', 'festival-tired'];
case 'interdimensional':
portraitLeftCharacter = ['dave', 'festival-3d-scared'];
default:
if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-dia.txt')) {
for (i in 0...custom.length)
{
var data:Array<String> = custom[i].split(':');
portraitLeftCharacter = [data[0], data[1]];
portraitRightCharacter = [data[2], data[3]];
}
}
}


Expand All @@ -186,7 +231,17 @@ class DialogueBox extends FlxSpriteGroup
switch (PlayState.SONG.song.toLowerCase())
{
default:
if (FileSystem.exists(TitleState.modFolder + '/data/characters/dialogue/${curCharacter}.json')) {
rawJsonDialThree = File.getContent((TitleState.modFolder + '/data/characters/dialogue/${curCharacter}.json'));
jsonDialThree = cast Json.parse(rawJsonDialThree);
if (jsonDialThree.right) {
portraitRight.setPosition(jsonDialThree.x, jsonDialThree.y);
} else {
portraitLeft.setPosition(jsonDialThree.x, jsonDialThree.y);
}
} else {
portraitLeft.setPosition(276.95, 170);
}
}
add(portraitLeft);
add(portraitRight);
Expand Down Expand Up @@ -378,6 +433,20 @@ class DialogueBox extends FlxSpriteGroup
portraitLeft.setPosition(143, 200);
case 'bf' | 'gf': //create boyfriend & genderbent boyfriend
portraitRight.setPosition(570, 220);
default:
if (FileSystem.exists(TitleState.modFolder + '/data/characters/dialogue/${curCharacter}.json')) {
trace('test');
rawJsonDial = File.getContent((TitleState.modFolder + '/data/characters/dialogue/${curCharacter}.json'));
jsonDial = cast Json.parse(rawJsonDial);
if (jsonDial.right) {
portraitRight.setPosition(jsonDial.x, jsonDial.y);
} else {
portraitLeft.setPosition(jsonDial.x, jsonDial.y);
}
} else {
portraitRight.setPosition(570, 220);
trace('not test');
}
}
box.flipX = portraitLeft.visible;

Expand Down Expand Up @@ -453,7 +522,14 @@ class DialogueBox extends FlxSpriteGroup
}
else
{
if (FileSystem.exists('assets/shared/images/${portrait.portraitPath}.png')) {
portraitSprite.loadGraphic(Paths.image(portrait.portraitPath));
} else if (FileSystem.exists(portrait.portraitPath + '.png')) {
portraitSprite.loadGraphic(Paths.customImage(portrait.portraitPath));
} else {
portraitSprite.loadGraphic(Paths.image('dialogue/dave/dave_annoyed'));
trace('sad');
}
}
portraitSprite.updateHitbox();
portraitSprite.scrollFactor.set();
Expand Down Expand Up @@ -551,6 +627,32 @@ class DialogueBox extends FlxSpriteGroup
default:
portrait.portraitPath = 'dialogue/tristan/tristan_content';
}
default:
if (FileSystem.exists(TitleState.modFolder + '/data/characters/dialogue/${character}.json')) {
trace('test 2');
rawJsonDialTwo = File.getContent((TitleState.modFolder + '/data/characters/dialogue/${character}.json'));
jsonDialTwo = cast Json.parse(rawJsonDialTwo);
switch (expression)
{
default:
portrait.portraitPath = TitleState.modFolder + '/images/dialogue/${character}/${character}_${expression}';
}
portrait.left = jsonDialTwo.right;
} else {
trace('not test 2');
switch (expression)
{
case 'ready':
portrait.portraitPath = 'dialogue/bf/bf_ready';
case 'confused':
portrait.portraitPath = 'dialogue/bf/bf_confused';
case 'upset':
portrait.portraitPath = 'dialogue/bf/bf_upset';
default:
portrait.portraitPath = 'dialogue/bf/bf_happy';
}
portrait.left = false;
}
}
return portrait;
}
Expand Down
2 changes: 1 addition & 1 deletion source/ResultsScreen.hx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ResultsScreen extends FlxState
info.alpha = 0;
add(info);

var info2:FlxText = new FlxText(FlxG.width - 700, FlxG.height - 100, 0, '${PlayState.rssong} (By ${CreditsPopUp.songCreator})', 12);
var info2:FlxText = new FlxText(FlxG.width - 400, FlxG.height - 100, 0, '${PlayState.rssong} (By ${CreditsPopUp.songCreator})', 12);
info2.antialiasing = true;
info2.scrollFactor.set();
info2.setFormat("Comic Sans MS Bold", 45, FlxColor.BLACK, LEFT);
Expand Down

0 comments on commit bae7121

Please sign in to comment.