initial commit, kind of working.

This commit is contained in:
2026-10-10 15:50:17 -06:00
commit 4db96b0bae
1041 changed files with 51423 additions and 0 deletions
@@ -0,0 +1,26 @@
package com.arc.dh.util.text
{
import com.arc.flixel.ArcSprite;
public class Avatar
{
public static const SAGA_SPRITE:Class = Avatar_SAGA_SPRITE;
public static const PROFESSOR_SPRITE:Class = Avatar_PROFESSOR_SPRITE;
public static const X:int = 57;
public static const Y:int = 223;
public static const SAGA:ArcSprite = new ArcSprite(0,0,SAGA_SPRITE);
public static const PROFESSOR:ArcSprite = new ArcSprite(0,0,PROFESSOR_SPRITE);
public function Avatar()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package com.arc.dh.util.text
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/265_com.arc.dh.util.text.Avatar_PROFESSOR_SPRITE.png")]
public class Avatar_PROFESSOR_SPRITE extends BitmapAsset
{
public function Avatar_PROFESSOR_SPRITE()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package com.arc.dh.util.text
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/116_com.arc.dh.util.text.Avatar_SAGA_SPRITE.png")]
public class Avatar_SAGA_SPRITE extends BitmapAsset
{
public function Avatar_SAGA_SPRITE()
{
super();
}
}
}
@@ -0,0 +1,91 @@
package com.arc.dh.util.text
{
import com.arc.dh.util.Config;
import com.arc.flixel.ArcGroup;
import com.arc.flixel.ArcSprite;
import org.flixel.FlxG;
public class TextFrame extends ArcGroup
{
private static const frameSprite:Class = TextFrame_frameSprite;
private static const SCROLL_IN:int = 0;
private static const SHOWING:int = 1;
private static const SCROLL_OUT:int = 2;
private static const HIDING:int = 3;
private static const TARGET_Y:Number = Config.HEIGHT - 21;
public static const SCROLL_SPEED:Number = 50;
private var _frame:ArcSprite;
private var _state:int = 3;
public function TextFrame(param1:Number = 0, param2:Number = 0)
{
super(param1,param2);
this._frame = new ArcSprite(0,0,frameSprite);
add(this._frame);
}
public function reset() : void
{
this._state = HIDING;
this._frame.y = Config.HEIGHT;
}
public function get ready() : Boolean
{
return this._state == SHOWING;
}
public function get hidden() : Boolean
{
return this._state == HIDING;
}
override public function update() : void
{
if(this._state == SCROLL_IN)
{
this._frame.y -= FlxG.elapsed * SCROLL_SPEED;
if(this._frame.y < TARGET_Y)
{
this._frame.y = TARGET_Y;
this._state = SHOWING;
}
}
else if(this._state != SHOWING)
{
if(this._state == SCROLL_OUT)
{
this._frame.y += FlxG.elapsed * SCROLL_SPEED;
if(this._frame.y > Config.HEIGHT)
{
this._frame.y = Config.HEIGHT;
visible = false;
this._state = HIDING;
}
}
}
super.update();
}
public function show() : void
{
visible = true;
this._state = SCROLL_IN;
}
public function hide() : void
{
this._state = SCROLL_OUT;
}
}
}
@@ -0,0 +1,15 @@
package com.arc.dh.util.text
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/149_com.arc.dh.util.text.TextFrame_frameSprite.png")]
public class TextFrame_frameSprite extends BitmapAsset
{
public function TextFrame_frameSprite()
{
super();
}
}
}
@@ -0,0 +1,117 @@
package com.arc.dh.util.text
{
import org.flixel.FlxBitmapFont;
import org.flixel.FlxBitmapText;
import org.flixel.FlxG;
public class TextLine extends FlxBitmapText
{
private var _offset:int = 0;
private var _fulltext:String;
private var _textOffset:int = 0;
private var _delay:Number = 0.02;
private var _active:Boolean = false;
private var _done:Boolean = false;
private var _targety:int = 0;
private var _vy:Number = 0;
private var _fading:Boolean = false;
public function TextLine(param1:int, param2:FlxBitmapFont, param3:String = " ", param4:String = "left", param5:Number = 0, param6:Boolean = false)
{
super(TextSystem.FRAME_OFFSET + TextSystem.TEXT_OFFSET,223 + param1 * 8,param2,"",param4,param5,param6);
this._fulltext = param3;
this._offset = param1;
alpha = 0.7;
visible = false;
solid = false;
}
public function push() : void
{
this._targety = y - 8;
this._vy = -20;
--this._offset;
if(this._offset == -1)
{
this._fading = true;
}
}
public function show() : void
{
visible = true;
}
override public function update() : void
{
if(!this._done && this._active)
{
this._delay -= FlxG.elapsed;
if(this._delay <= 0)
{
this._delay = TextSystem.TYPE_SPEED * TextSystem.speed;
this.addCharacter();
}
}
if(this._vy != 0)
{
y += this._vy * FlxG.elapsed;
if(y <= this._targety)
{
y = this._targety;
this._vy = 0;
}
}
if(this._fading)
{
alpha -= FlxG.elapsed * TextSystem.FADE_SPEED;
if(alpha <= 0)
{
exists = false;
visible = false;
alive = false;
}
}
super.update();
}
private function addCharacter() : void
{
++this._textOffset;
text = this._fulltext.substr(0,this._textOffset);
if(this._fulltext.charAt(this._textOffset - 1) == ".")
{
this._delay = TextSystem.FULL_STOP_DELAY * TextSystem.speed;
}
else if(this._fulltext.charAt(this._textOffset - 1) == ",")
{
this._delay = TextSystem.HALF_STOP_DELAY * TextSystem.speed;
}
if(this._textOffset == this._fulltext.length)
{
this._done = true;
}
}
public function get done() : Boolean
{
return this._done;
}
public function activate() : void
{
this._active = true;
this.show();
}
}
}
@@ -0,0 +1,120 @@
package com.arc.dh.util.text
{
import com.arc.dh.util.Fonts;
import com.arc.flixel.ArcGroup;
import com.arc.flixel.ArcSprite;
import org.flixel.FlxBitmapText;
import org.flixel.FlxG;
import org.flixel.FlxPoint;
public class TextSet extends ArcGroup
{
private var _avatar:ArcSprite;
private var _text:String;
private var _activeText:TextLine;
private var _textQueue:Array = new Array();
private var _numShown:int = 0;
private var _textDelay:Number = 0;
private var _textMembers:Array = new Array();
private var _hiding:Boolean = false;
public function TextSet(param1:Array)
{
var _loc5_:TextLine = null;
super();
this._avatar = param1[0];
this._text = param1[1].toUpperCase();
var _loc2_:FlxBitmapText = new FlxBitmapText(0,0,Fonts.font(Fonts.OUTLINE_BLUE),this._text,"left",TextSystem.TEXT_WIDTH);
var _loc3_:Array = _loc2_.lines;
var _loc4_:int = 0;
while(_loc4_ < _loc3_.length)
{
_loc5_ = new TextLine(_loc4_,Fonts.font(Fonts.OUTLINE_BLACK),_loc3_[_loc4_] as String,"left",TextSystem.TEXT_WIDTH + 50,true);
this.add(_loc5_);
this._textQueue.push(_loc5_);
this._textMembers.push(_loc5_);
_loc4_++;
}
this._avatar.x = Avatar.X;
this._avatar.y = Avatar.Y;
this.add(this._avatar);
this.next();
setAll("scrollFactor",new FlxPoint(0,0));
}
override public function update() : void
{
if(this._activeText != null && this._activeText.done)
{
if(this._textDelay <= 0)
{
this.next();
}
else
{
this._textDelay -= FlxG.elapsed;
}
}
if(this._activeText == null && this._textDelay > 0)
{
this._textDelay -= FlxG.elapsed;
}
if(this._hiding)
{
this._textMembers.forEach(function(param1:TextLine, param2:int, param3:Array):void
{
if(param1.visible)
{
param1.y += FlxG.elapsed * TextFrame.SCROLL_SPEED;
}
});
this._avatar.y += FlxG.elapsed * TextFrame.SCROLL_SPEED;
}
super.update();
}
private function next() : void
{
var _loc1_:TextLine = null;
this._activeText = this._textQueue.shift();
if(this._activeText != null)
{
this._activeText.activate();
}
else
{
this._textDelay = TextSystem.TEXT_DELAY * TextSystem.speed;
}
if(++this._numShown >= 3 && this._activeText != null)
{
for each(_loc1_ in this._textMembers)
{
_loc1_.push();
}
}
if(this._numShown % 2 == 0 && this._numShown > 1)
{
this._textDelay = TextSystem.TEXT_DELAY * TextSystem.speed;
}
}
public function get done() : Boolean
{
return this._activeText == null && this._textDelay <= 0;
}
public function hide() : void
{
this._hiding = true;
}
}
}
@@ -0,0 +1,194 @@
package com.arc.dh.util.text
{
import com.arc.dh.state.PlayMode;
import com.arc.dh.util.Config;
import com.arc.dh.util.Data;
import com.arc.dh.util.Sound;
import com.arc.dh.util.SoundSystem;
import com.arc.flixel.ArcGroup;
import com.arc.flixel.ArcSprite;
import org.flixel.FlxPoint;
public class TextSystem extends ArcGroup
{
private static var _instance:TextSystem;
private static const IDLE:int = 0;
private static const SCROLL_IN:int = 1;
private static const SHOWING:int = 2;
private static const SCROLL_OUT:int = 3;
public static const FRAME_WIDTH:int = 255;
public static const FRAME_OFFSET:int = 53;
public static const TEXT_WIDTH:int = 224;
public static const TEXT_OFFSET:int = 21;
public static const TYPE_SPEED:Number = 0.02;
public static const FADE_SPEED:Number = 5;
public static const TEXT_DELAY:Number = 2;
public static const FULL_STOP_DELAY:Number = 0.25;
public static const HALF_STOP_DELAY:Number = 0.1;
private var _texts:Array;
private var _currentText:Array;
private var _state:int;
private var _frame:TextFrame;
private var _textset:TextSet;
public var recent:Array = new Array();
public function TextSystem()
{
super();
this._texts = new Array();
this._currentText = new Array();
this._state = IDLE;
this._frame = new TextFrame(FRAME_OFFSET,Config.HEIGHT + 21);
this.add(this._frame);
setAll("scrollFactor",new FlxPoint(0,0));
}
public static function get speed() : Number
{
return Data.textspeed == Data.SPEED_FAST ? 0.5 : (Data.textspeed == Data.SPEED_SLOW ? 2 : 1);
}
public static function reset() : void
{
if(instance._texts == null)
{
return;
}
instance._texts = new Array();
instance._currentText = new Array();
instance._state = IDLE;
instance._frame.reset();
instance._textset = null;
}
public static function get instance() : TextSystem
{
return _instance == null ? (_instance = new TextSystem()) : _instance;
}
public static function display(param1:ArcSprite, param2:String) : void
{
if(PlayMode.mode != PlayMode.STORY_MODE)
{
return;
}
instance._texts.push([param1,param2]);
if(instance.recent.length == 0 || instance.recent[instance.recent.length - 1][1] != param2)
{
instance.recent.push([param1,param2]);
}
}
public static function active() : Boolean
{
return instance._state != IDLE || _instance._texts.length != 0;
}
override public function update() : void
{
switch(this._state)
{
case IDLE:
this.idle();
break;
case SCROLL_IN:
this.scrollIn();
break;
case SHOWING:
this.showing();
break;
case SCROLL_OUT:
this.scrollOut();
}
super.update();
if(this._textset != null)
{
this._textset.update();
}
}
override public function draw() : void
{
super.draw();
if(this._textset != null)
{
this._textset.draw();
}
}
private function idle() : void
{
if(this._texts.length > 0)
{
SoundSystem.play(Sound.TEXT);
this._state = SCROLL_IN;
this._frame.show();
}
}
private function scrollIn() : void
{
if(this._frame.ready)
{
this._state = SHOWING;
this.setup();
}
}
private function showing() : void
{
if(this._textset.done)
{
if(this._texts.length > 0)
{
this.setup();
}
else
{
this._state = SCROLL_OUT;
this._textset.hide();
this._frame.hide();
}
}
}
private function scrollOut() : void
{
if(this._frame.hidden)
{
this._state = IDLE;
}
}
private function setup() : void
{
var _loc1_:Array = this._texts.shift();
this._textset = new TextSet(_loc1_);
}
override public function destroy() : void
{
}
}
}