Skip to content

Commit

Permalink
update things
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealJake12 committed Nov 19, 2023
1 parent 9e561ca commit 707bfae
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project>
<!-- _________________________ Application Settings _________________________ -->

<app title="Kade Engine Community" file="Kade Engine Community" packageName="com.therealjake12.kec" package="com.therealjake12.kec" main="Main" version="1.8.2" company="TheRealJake12" />
<app title="Kade Engine Community" file="Kade Engine Community" packageName="com.therealjake12.kec" package="com.therealjake12.kec" main="Main" version="1.9" company="TheRealJake12" />

<!--Switch Export with Unique ApplicationID and Icon-->
<set name="APP_ID" value="0x0100f6c013bbc000" />
Expand Down
10 changes: 0 additions & 10 deletions source/KadeEngineData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,6 @@ class KadeEngineData

if (FlxG.save.data.mirror == null)
FlxG.save.data.mirror = false;
#if web
if (FlxG.save.data.stressMP4 == null)
FlxG.save.data.stressMP4 = false;
#else
if (FlxG.save.data.stressMP4 == null)
FlxG.save.data.stressMP4 = true;

if (FlxG.save.data.stressMP4 == false)
FlxG.save.data.stressMP4 = true;
#end

if (FlxG.save.data.background == null)
FlxG.save.data.background = true;
Expand Down
2 changes: 0 additions & 2 deletions source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ class Main extends Sprite
{
if (Std.isOfType(this, debug.StageDebugState))
Paths.clearStoredMemory(true);
if (!FlxG.save.data.gpuRender)
FlxG.bitmap.dumpCache();

var cache = cast(Assets.cache, AssetCache);
for (key => font in cache.font)
Expand Down
39 changes: 25 additions & 14 deletions source/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ class Paths
}

// Sprite content caching with GPU based on Forever Engine texture compression.
public static function loadImage(key:String, ?library:String, ?gpuRender:Bool):FlxGraphic

/**
* For a given key and library for an image, returns the corresponding BitmapData.
* We can probably move the cache handling here.
* @param key
* @param library
* @return BitmapData
*/
static function loadImage(key:String, ?library:String, ?gpuRender:Bool)
{
var path:String = '';

Expand All @@ -71,36 +79,39 @@ class Paths

if (OpenFlAssets.exists(path, IMAGE))
{
if (!currentTrackedAssets.exists(key))
if (!currentTrackedAssets.exists(path))
{
var bitmap:BitmapData = OpenFlAssets.getBitmapData(path, false);
var graphic:FlxGraphic = null;

var graphic:FlxGraphic = null;
if (gpuRender)
{
var texture = FlxG.stage.context3D.createTexture(bitmap.width, bitmap.height, BGRA, false, 0);
bitmap.lock();
var texture = FlxG.stage.context3D.createRectangleTexture(bitmap.width, bitmap.height, BGRA, true);
texture.uploadFromBitmapData(bitmap);
currentTrackedTextures.set(key, texture);

bitmap.disposeImage();

FlxDestroyUtil.dispose(bitmap);

bitmap = null;
graphic = FlxGraphic.fromBitmapData(BitmapData.fromTexture(texture), false, key);
}
else
{
graphic = FlxGraphic.fromBitmapData(bitmap, false, key, false);

bitmap = BitmapData.fromTexture(texture);

bitmap.unlock();
}
graphic = FlxGraphic.fromBitmapData(bitmap, false, path, false);

graphic.persist = true;
currentTrackedAssets.set(key, graphic);
currentTrackedAssets.set(path, graphic);
}
else
{
// Get data from cache.
// Debug.logTrace('Loading existing image from cache: $key');
}

localTrackedAssets.push(key);
return currentTrackedAssets.get(key);
localTrackedAssets.push(path);
return currentTrackedAssets.get(path);
}

Debug.logWarn('Could not find image at path $path');
Expand Down
24 changes: 9 additions & 15 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ class PlayState extends MusicBeatState
scrollSpeed = FlxG.save.data.scrollSpeed;
PlayStateChangeables.Optimize = FlxG.save.data.optimize;
PlayStateChangeables.zoom = FlxG.save.data.zoom;
PlayStateChangeables.botPlay = FlxG.save.data.botplay;

if (!isStoryMode)
{
Expand Down Expand Up @@ -3884,7 +3885,7 @@ class PlayState extends MusicBeatState
|| daNote.wasGoodHit
|| holdArray[Math.floor(Math.abs(daNote.noteData))]))
{
if (daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= origin)
if ((daNote.causesMisses) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= origin)
{
// Clip to strumline
swagRect.width = daNote.frameWidth;
Expand All @@ -3897,14 +3898,9 @@ class PlayState extends MusicBeatState
}
else
{
if (daNote.mustPress)
daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y
- 0.45 * ((Conductor.songPosition - daNote.strumTime) / songMultiplier) * (FlxMath.roundDecimal(leSpeed, 2)))
+ daNote.noteYOff;
else
daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y
- 0.45 * ((Conductor.songPosition - daNote.strumTime) / songMultiplier) * (FlxMath.roundDecimal(leSpeed, 2)))
+ daNote.noteYOff;
daNote.y = (strumY
- 0.45 * ((Conductor.songPosition - daNote.strumTime) / songMultiplier) * (FlxMath.roundDecimal(leSpeed, 2)))
+ daNote.noteYOff;
if (daNote.isSustainNote)
{
if ((PlayStateChangeables.botPlay
Expand All @@ -3913,7 +3909,7 @@ class PlayState extends MusicBeatState
|| holdArray[Math.floor(Math.abs(daNote.noteData))]))
{
// Clip to strumline
if (daNote.y + daNote.offset.y * daNote.scale.y <= origin)
if ((daNote.causesMisses) && daNote.y + daNote.offset.y * daNote.scale.y <= origin)
{
swagRect.y = (origin - daNote.y) / daNote.scale.y;
swagRect.width = daNote.width / daNote.scale.x;
Expand Down Expand Up @@ -3981,7 +3977,7 @@ class PlayState extends MusicBeatState
totalNotesHit += 1;
else
{
if (daNote.causesMisses && !daNote.isSustainEnd)
if (daNote.causesMisses && !daNote.sustainActive && !daNote.isSustainEnd)
{
if (!SONG.splitVoiceTracks)
vocals.volume = 0;
Expand Down Expand Up @@ -4021,15 +4017,13 @@ class PlayState extends MusicBeatState
if (!daNote.wasGoodHit
&& daNote.isSustainNote
&& daNote.sustainActive
&& daNote.spotInLine != daNote.parent.children.length
&& !daNote.isSustainEnd
&& daNote.causesMisses)
{
// health -= 0.05; // give a health punishment for failing a LN
trace("hold fell over at " + daNote.spotInLine);
for (i in daNote.parent.children)
{
i.alpha = 0.3;
i.sustainActive = false;
}
if (daNote.parent.wasGoodHit)
Expand Down Expand Up @@ -4060,12 +4054,13 @@ class PlayState extends MusicBeatState
}
else
{
if (daNote.causesMisses && !daNote.isSustainEnd)
if (daNote.causesMisses && !daNote.sustainActive && !daNote.isSustainEnd)
{
if (!SONG.splitVoiceTracks)
vocals.volume = 0;
else
vocalsPlayer.volume = 0;
Debug.logTrace("huh2");
}
if (theFunne && !daNote.isSustainNote && daNote.causesMisses)
{
Expand All @@ -4091,7 +4086,6 @@ class PlayState extends MusicBeatState
if (!daNote.wasGoodHit
&& daNote.isSustainNote
&& daNote.sustainActive
&& daNote.spotInLine != daNote.parent.children.length
&& !daNote.isSustainEnd
&& daNote.causesMisses)
{
Expand Down
8 changes: 4 additions & 4 deletions source/debug/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ class ChartingState extends MusicBeatState

function loadSong(daSong:String, reloadFromFile:Bool = false):Void
{
inst = new FlxSound().loadEmbedded(Paths.inst(_song.audioFile));
inst = FlxG.sound.load(Paths.inst(_song.audioFile));
if (inst != null)
{
inst.stop();
Expand All @@ -1831,7 +1831,7 @@ class ChartingState extends MusicBeatState
if (!_song.splitVoiceTracks)
{
if (_song.needsVoices)
vocals = new FlxSound().loadEmbedded(Paths.voices(_song.audioFile));
vocals = FlxG.sound.load(Paths.voices(_song.audioFile));
else
vocals = new FlxSound();
FlxG.sound.list.add(vocals);
Expand All @@ -1840,8 +1840,8 @@ class ChartingState extends MusicBeatState
{
if (_song.needsVoices)
{
vocalsPlayer = new FlxSound().loadEmbedded(Paths.voices(_song.audioFile, 'P'));
vocalsEnemy = new FlxSound().loadEmbedded(Paths.voices(_song.audioFile, 'E'));
vocalsPlayer = FlxG.sound.load(Paths.voices(_song.audioFile, 'P'));
vocalsEnemy = FlxG.sound.load(Paths.voices(_song.audioFile, 'E'));
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion source/stages/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ class Stage extends MusicBeatState
this.curStage = daStage;
camZoom = 1.05; // Don't change zoom here, unless you want to change zoom of every stage that doesn't have custom one

if (FlxG.save.data.background)
if (!FlxG.save.data.optimize)
{
switch (daStage)
{
case 'halloween':
{
hasGF = false;
if (FlxG.save.data.distractions)
{
var hallowTex = Paths.getSparrowAtlas('halloween_bg', 'week2');
Expand Down

0 comments on commit 707bfae

Please sign in to comment.