Compare commits
6 Commits
8a803b9cdc
...
main
Author | SHA1 | Date | |
---|---|---|---|
2a63c748f1 | |||
216f1ecd4c | |||
035f69d9fc | |||
624b538ad8 | |||
e375d0028e | |||
d308ce7231 |
8
TODO.md
8
TODO.md
@ -11,15 +11,19 @@
|
|||||||
- [ ] Room labels
|
- [ ] Room labels
|
||||||
- [ ] Background music
|
- [ ] Background music
|
||||||
- [ ] Sound effects
|
- [ ] Sound effects
|
||||||
|
- [ ] Custom debug console commands
|
||||||
|
|
||||||
## Bugs
|
## Bugs
|
||||||
|
|
||||||
- [ ] Fix console rendering issues
|
- [x] Console rendering issues
|
||||||
|
- [ ] DOM tree rendering issues
|
||||||
|
- [x] Inconsistent text formatting
|
||||||
|
|
||||||
### Dialogue
|
### Dialogue
|
||||||
|
|
||||||
- [ ] Text formatting
|
- [x] Text formatting
|
||||||
- [ ] Character profiles / speaker ID
|
- [ ] Character profiles / speaker ID
|
||||||
|
- [ ] Scrollable dialogue pane (like Citizen Sleeper / Disco Elysium)
|
||||||
|
|
||||||
## Code architecture
|
## Code architecture
|
||||||
|
|
||||||
|
@ -2,4 +2,4 @@ compile-common.hxml
|
|||||||
|
|
||||||
-D windowTitle=StoneInAGlasshouse
|
-D windowTitle=StoneInAGlasshouse
|
||||||
-lib hlsdl
|
-lib hlsdl
|
||||||
-hl bin/rewild.hl
|
-hl bin/glasshouse.hl
|
||||||
|
10
makefile
10
makefile
@ -1,23 +1,23 @@
|
|||||||
.PHONY: watch run
|
.PHONY: watch run
|
||||||
|
|
||||||
default: bin/rewild.hl
|
default: bin/glasshouse.hl
|
||||||
|
|
||||||
SOURCES := $(shell find . -name \*.hx -print)
|
SOURCES := $(shell find . -name \*.hx -print)
|
||||||
|
|
||||||
bin/rewild.hl: $(SOURCES)
|
bin/glasshouse.hl: $(SOURCES)
|
||||||
haxe compile-hl.hxml
|
haxe compile-hl.hxml
|
||||||
|
|
||||||
bin/rewild.js: $(SOURCES)
|
bin/glasshouse.js: $(SOURCES)
|
||||||
haxe compile-js.hxml
|
haxe compile-js.hxml
|
||||||
|
|
||||||
debug: $(SOURCES)
|
debug: $(SOURCES)
|
||||||
haxe --debug compile-hl.hxml
|
haxe --debug compile-hl.hxml
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f bin/rewild.hl bin/rewild.js
|
rm -f bin/glasshouse.hl bin/glasshouse.js
|
||||||
|
|
||||||
watch:
|
watch:
|
||||||
@inotifywait --recursive --monitor --event modify,move,create,delete --include '.*.hx$$' ./ | while read changed; do echo $$changed; make debug; done
|
@inotifywait --recursive --monitor --event modify,move,create,delete --include '.*.hx$$' ./ | while read changed; do echo $$changed; make debug; done
|
||||||
|
|
||||||
run:
|
run:
|
||||||
hl bin/rewild.hl
|
hl bin/glasshouse.hl
|
||||||
|
@ -55,18 +55,16 @@ menubutton:active {
|
|||||||
|
|
||||||
flow.dialogue-container {
|
flow.dialogue-container {
|
||||||
fill-width: true;
|
fill-width: true;
|
||||||
height: 20;
|
min-height: 20;
|
||||||
layout: vertical;
|
layout: vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogue-box {
|
dialogue-box {
|
||||||
fill-width: true;
|
fill-width: true;
|
||||||
height: 20;
|
|
||||||
/* background: tile("ui.png", 5, 5); */
|
|
||||||
/* background-tile-pos: 1 1; */
|
|
||||||
background: blue;
|
background: blue;
|
||||||
padding: 10;
|
padding: 10;
|
||||||
alpha: 0.9;
|
alpha: 0.9;
|
||||||
|
min-height: 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogue-options {
|
dialogue-options {
|
||||||
|
@ -1,37 +1,42 @@
|
|||||||
title: Room:quarters
|
title: Room:quarters
|
||||||
---
|
---
|
||||||
<<declare $roll = 0>>
|
<<declare $roll = 0>>
|
||||||
|
<<declare $quartersIntroSeen = false>>
|
||||||
<<declare $hangarKeyFound = false>>
|
<<declare $hangarKeyFound = false>>
|
||||||
<<declare $sleepingMatSetUp = false>>
|
<<declare $sleepingMatSetUp = false>>
|
||||||
You: It's the crew quarters.
|
<<if not $quartersIntroSeen>>
|
||||||
|
You: It's the [room]crew quarters[/room].
|
||||||
You: Well, it will be. Set-up hasn't started yet.
|
You: Well, it will be. Set-up hasn't started yet.
|
||||||
You: That was meant to be one of my first jobs after defrost...
|
You: That was meant to be one of my first jobs after defrost...
|
||||||
You: ...but it doesn't exactly seem like a priority now.
|
You: ...but it doesn't exactly seem like a priority now.
|
||||||
|
<<set $quartersIntroSeen to true>>
|
||||||
|
<<endif>>
|
||||||
You: Maybe there's something useful here?
|
You: Maybe there's something useful here?
|
||||||
-> Search the lockers (perception) <<if not $hangarKeyFound>>
|
-> Search the lockers [ability](perception)[/ability] <<if not $hangarKeyFound>>
|
||||||
<<set $roll to dice(6)>>
|
<<set $roll to dice(6)>>
|
||||||
<<if $roll > 2>>
|
<<if $roll > 0>>
|
||||||
You: Aha! A small piece of paper with the **hangar access code**.
|
You: Aha! A small piece of paper with the [item]access code[/item] for the [room]hangar[/room].
|
||||||
<<room hangar>>
|
<<room hangar>>
|
||||||
<<set $hangarKeyFound to true>>
|
<<set $hangarKeyFound to true>>
|
||||||
<<else>>
|
<<else>>
|
||||||
You: Just some dust bunnies. Guess they stowed away from Earth.
|
You: Just some dust bunnies. Guess they stowed away from Earth.
|
||||||
<<endif>>
|
<<endif>>
|
||||||
-> Set up a sleeping mat (ingenuity) <<if not $sleepingMatSetUp>>
|
-> Set up a sleeping mat [ability](ingenuity)[/ability] <<if not $sleepingMatSetUp>>
|
||||||
<<set $roll to dice(6)>>
|
<<set $roll to dice(6)>>
|
||||||
<<if $roll > 2>>
|
<<if $roll > 2>>
|
||||||
You: Nice, at least I have somewhere to crash now.
|
You: Nice, at least I have somewhere to crash now.
|
||||||
<<set $sleepingMatSetUp to true>>
|
<<set $sleepingMatSetUp to true>>
|
||||||
<<else>>
|
<<else>>
|
||||||
You: Hmm, I was never good at this camping stuff. Maybe I can find somewhere else to rest.
|
You: [failure]Hmm, I was never good at this camping stuff. Maybe I can find somewhere else to rest.[/failure]
|
||||||
<<endif>>
|
<<endif>>
|
||||||
-> Leave
|
-> Leave
|
||||||
===
|
===
|
||||||
title: Room:hangar
|
title: Room:hangar
|
||||||
---
|
---
|
||||||
You: The **hangar** seems eerily deserted.
|
You: The [room]hangar[/room] seems eerily deserted.
|
||||||
===
|
===
|
||||||
title: Room not open
|
title: Room not open
|
||||||
---
|
---
|
||||||
You: Hmm, that part of the ship is still inaccessible. I wonder how to get in?
|
You: Hmm, that part of the ship is still inaccessible. I wonder how to get in?
|
||||||
|
<<room hangar>>
|
||||||
===
|
===
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package components;
|
package components;
|
||||||
|
|
||||||
|
import h2d.HtmlText;
|
||||||
|
import hxyarn.dialogue.markup.MarkupParseResult;
|
||||||
|
|
||||||
import dialogue.event.NextLine;
|
import dialogue.event.NextLine;
|
||||||
|
import dialogue.event.LineShown;
|
||||||
import dialogue.event.OptionSelected;
|
import dialogue.event.OptionSelected;
|
||||||
import dialogue.event.OptionsShown.OptionChoice;
|
import dialogue.event.OptionsShown.OptionChoice;
|
||||||
|
|
||||||
@ -69,6 +73,12 @@ class DialogueOptionsComponent extends h2d.Flow implements h2d.domkit.Object {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override function onRemove() {
|
||||||
|
for (option in this.options)
|
||||||
|
option.remove();
|
||||||
|
super.onRemove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@:uiComp("dialogue-box")
|
@:uiComp("dialogue-box")
|
||||||
@ -77,9 +87,10 @@ class DialogueBoxComponent extends h2d.Flow implements h2d.domkit.Object {
|
|||||||
var chan:hxd.snd.Channel;
|
var chan:hxd.snd.Channel;
|
||||||
var textPos:Int = 0;
|
var textPos:Int = 0;
|
||||||
var game:Game;
|
var game:Game;
|
||||||
|
public var lineMarkup:MarkupParseResult;
|
||||||
|
|
||||||
static var SRC = <dialogue-box>
|
static var SRC = <dialogue-box>
|
||||||
<text text={displayedText} public font={Game.current.font} id="dialogueText" />
|
<html-text text={displayedText} public font={Game.current.font} id="dialogueText" />
|
||||||
</dialogue-box>
|
</dialogue-box>
|
||||||
|
|
||||||
public var displayedText(get, set):String;
|
public var displayedText(get, set):String;
|
||||||
@ -103,11 +114,12 @@ class DialogueBoxComponent extends h2d.Flow implements h2d.domkit.Object {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function new(text:String, ?parent) {
|
public function new(lineShown:LineShown, ?parent) {
|
||||||
this.game = Game.current;
|
this.game = Game.current;
|
||||||
super(parent);
|
super(parent);
|
||||||
initComponent();
|
initComponent();
|
||||||
internalText = text;
|
this.lineMarkup = lineShown.markUpResults;
|
||||||
|
this.internalText = lineShown.line();
|
||||||
|
|
||||||
enableInteractive = true;
|
enableInteractive = true;
|
||||||
interactive.onClick = function(_) onClick();
|
interactive.onClick = function(_) onClick();
|
||||||
@ -116,7 +128,6 @@ class DialogueBoxComponent extends h2d.Flow implements h2d.domkit.Object {
|
|||||||
function updateText() {
|
function updateText() {
|
||||||
if (textPos == internalText.length) {
|
if (textPos == internalText.length) {
|
||||||
timer.stop();
|
timer.stop();
|
||||||
// onReady();
|
|
||||||
// if (chan != null)
|
// if (chan != null)
|
||||||
// chan.stop();
|
// chan.stop();
|
||||||
return;
|
return;
|
||||||
@ -133,7 +144,66 @@ class DialogueBoxComponent extends h2d.Flow implements h2d.domkit.Object {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
textPos++;
|
textPos++;
|
||||||
displayedText = internalText.substr(0, textPos);
|
displayedText = applyTextAttributes(internalText.substr(0, textPos));
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyTextAttributes(text:String):String {
|
||||||
|
var characterOffset = 0;
|
||||||
|
var characterAttribute = lineMarkup.tryGetAttributeWithName("character");
|
||||||
|
if (characterAttribute != null)
|
||||||
|
characterOffset = -characterAttribute.length;
|
||||||
|
|
||||||
|
var htmlTagsByIndex = new Map<Int, String>();
|
||||||
|
|
||||||
|
for (attribute in lineMarkup.attributes) {
|
||||||
|
var startTagIndex = attribute.position + characterOffset;
|
||||||
|
if (startTagIndex < text.length) {
|
||||||
|
var currrentStartTag = "";
|
||||||
|
var currentEndTag = "";
|
||||||
|
var endTagIndex = Std.int(Math.min(text.length, startTagIndex + attribute.length));
|
||||||
|
if (htmlTagsByIndex.exists(startTagIndex))
|
||||||
|
currrentStartTag = htmlTagsByIndex.get(startTagIndex);
|
||||||
|
|
||||||
|
if (htmlTagsByIndex.exists(endTagIndex))
|
||||||
|
currentEndTag = htmlTagsByIndex.get(endTagIndex);
|
||||||
|
|
||||||
|
if (attribute.name == "room") {
|
||||||
|
var openTag = '$currrentStartTag<font color="#00FF00">';
|
||||||
|
var closeTag = '</font>$currentEndTag';
|
||||||
|
htmlTagsByIndex.set(startTagIndex, openTag);
|
||||||
|
htmlTagsByIndex.set(endTagIndex, closeTag);
|
||||||
|
} else if (attribute.name == "item") {
|
||||||
|
var openTag = '$currrentStartTag<font color="#CD853F">';
|
||||||
|
var closeTag = '</font>$currentEndTag';
|
||||||
|
htmlTagsByIndex.set(startTagIndex, openTag);
|
||||||
|
htmlTagsByIndex.set(endTagIndex, closeTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var sb = new StringBuf();
|
||||||
|
|
||||||
|
for (i in 0...text.length) {
|
||||||
|
var char = text.charAt(i);
|
||||||
|
if (htmlTagsByIndex.exists(i)) {
|
||||||
|
sb.add(htmlTagsByIndex.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.add(char);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (htmlTagsByIndex.exists(text.length)) {
|
||||||
|
sb.add(htmlTagsByIndex.get(text.length));
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
override function onRemove() {
|
||||||
|
super.onRemove();
|
||||||
|
// if (chan != null)
|
||||||
|
// chan.stop();
|
||||||
|
// timer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public dynamic function onClick() {
|
public dynamic function onClick() {
|
||||||
@ -141,7 +211,7 @@ class DialogueBoxComponent extends h2d.Flow implements h2d.domkit.Object {
|
|||||||
Game.current.globalEventBus.publishEvent(new NextLine());
|
Game.current.globalEventBus.publishEvent(new NextLine());
|
||||||
else if (textPos < internalText.length) {
|
else if (textPos < internalText.length) {
|
||||||
textPos = internalText.length;
|
textPos = internalText.length;
|
||||||
displayedText = internalText;
|
displayedText = applyTextAttributes(internalText);
|
||||||
updateText();
|
updateText();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -36,25 +36,19 @@ class DialogueBoxController {
|
|||||||
eventBus.subscribe(DialogueComplete, onDialogueComplete);
|
eventBus.subscribe(DialogueComplete, onDialogueComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
// override function onRemove() {
|
|
||||||
// super.onRemove();
|
|
||||||
// // if (chan != null)
|
|
||||||
// // chan.stop();
|
|
||||||
// // timer.stop();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public dynamic function onClick() {}
|
public dynamic function onClick() {}
|
||||||
|
|
||||||
public dynamic function onReady() {}
|
public dynamic function onReady() {}
|
||||||
|
|
||||||
function onLineShown(event:LineShown) {
|
function onLineShown(event:LineShown) {
|
||||||
if (dialogueBox != null) {
|
if (dialogueBox == null) {
|
||||||
dialogueBox.remove();
|
var d = new DialogueBoxComponent(event, this.parent);
|
||||||
}
|
|
||||||
var d = new DialogueBoxComponent(event.line(), this.parent);
|
|
||||||
style.addObject(d);
|
style.addObject(d);
|
||||||
|
|
||||||
dialogueBox = d;
|
dialogueBox = d;
|
||||||
|
} else {
|
||||||
|
dialogueBox.lineMarkup = event.markUpResults;
|
||||||
|
dialogueBox.internalText = event.line();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOptionsShown(event:OptionsShown) {
|
function onOptionsShown(event:OptionsShown) {
|
||||||
@ -69,6 +63,6 @@ class DialogueBoxController {
|
|||||||
dialogueBox.remove();
|
dialogueBox.remove();
|
||||||
if (dialogueOptions != null)
|
if (dialogueOptions != null)
|
||||||
dialogueOptions.remove();
|
dialogueOptions.remove();
|
||||||
|
dialogueBox = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user