Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
small rendering optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Dec 29, 2023
1 parent 696b1b8 commit 7df297f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<haxedev set='webgl' />
<haxelib name="flixel-ui" />
<haxelib name="flixel-addons" />
<haxelib name="discord_rpc" if="cpp"/>
<haxelib name="discord_rpc" if="DISCORD_ALLOWED"/>
<haxelib name="hxCodec" if="VIDEOS_ALLOWED"/>
<haxelib name="maru-hscript" />
<haxelib name="hxcpp-gh-release" />
Expand Down
3 changes: 2 additions & 1 deletion source/flixel/graphics/tile/FlxDrawQuadsItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ class FlxDrawQuadsItem extends FlxDrawBaseItem<FlxDrawQuadsItem>
transforms.push(matrix.tx);
transforms.push(matrix.ty);

var alphaMultiplier = transform != null ? transform.alphaMultiplier : 1.0;
for (i in 0...VERTICES_PER_QUAD)
alphas.push(transform != null ? transform.alphaMultiplier : 1.0);
alphas.push(alphaMultiplier);

if (colored || hasColorOffsets)
{
Expand Down
6 changes: 1 addition & 5 deletions source/funkin/graphics/FlxSpriteExt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,8 @@ class FlxSpriteExt extends FlxSkewedSprite {
}

override function checkEmptyFrame() {
if (_frame == null) {
//trace(Main.DEFAULT_GRAPHIC);
if (_frame == null)
frames = Main.DEFAULT_GRAPHIC.imageFrame;
}

//loadGraphic(Main.DEFAULT_GRAPHIC);
}

@:noCompletion
Expand Down
35 changes: 32 additions & 3 deletions source/funkin/states/MusicBeatState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,43 @@ class MusicBeatState extends FlxUIState implements IMusicGetter {
if (ScriptUtil.stateQueue != null) {
CoolUtil.switchState(ScriptUtil.stateQueue.state, ScriptUtil.stateQueue.skipTransOpen, ScriptUtil.stateQueue.skipTransClose);
ScriptUtil.stateQueue = null;
if (!Transition.skipTransOpen) super.draw();
if (!Transition.skipTransOpen) __superDraw();
}
else super.draw();
else __superDraw();
}

@:noCompletion
inline private function __superDraw():Void {
if (persistentDraw) {
@:privateAccess {
final oldDefaultCameras = FlxCamera._defaultCameras;
if (cameras != null)
FlxCamera._defaultCameras = cameras;

for (basic in members) {
if (basic != null && basic.exists && basic.visible)
basic.draw();
}

FlxCamera._defaultCameras = oldDefaultCameras;
}
}

if (subState != null)
subState.draw();
}

override function update(elapsed:Float):Void {
ModdingUtil.addCall('stateUpdate', [elapsed]);
super.update(elapsed);
__superUpdate(elapsed);
}

@:noCompletion
inline private function __superUpdate(elapsed:Float) {
for (basic in members) {
if (basic != null && basic.exists && basic.visible)
basic.update(elapsed);
}
}

public function stepHit(curStep:Int):Void {
Expand Down

0 comments on commit 7df297f

Please sign in to comment.