Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better way to support winning icon on large icons (aka 900x300, 1800x600, etc) #759

Closed
wants to merge 8 commits into from
2 changes: 1 addition & 1 deletion source/ClientPrefs.hx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class ClientPrefs { //default settings if it can't find a save file containing y
// credits to my friend sanco
for (field in Type.getClassFields(ClientPrefs))
{
if (Type.typeof(Reflect.field(ClientPrefs, field)) != TFunction)
if (!Reflect.isFunction(Reflect.field(ClientPrefs, field))) //(Type.typeof(Reflect.field(ClientPrefs, field)) != TFunction)
{
if (!importantMap.get("saveBlackList").contains(field))
Reflect.setField(FlxG.save.data, field, Reflect.field(ClientPrefs, field));
Expand Down
26 changes: 8 additions & 18 deletions source/HealthIcon.hx
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,17 @@ class HealthIcon extends FlxSprite
trace("Warning: could not find the placeholder icon, expect crashes!");
}

loadGraphic(file); //Load stupidly first for getting the file size
initialWidth = width;
initialHeight = height;
var width2 = width;
if (width == 450) {
loadGraphic(file, true, Math.floor(width / 3), Math.floor(height)); //Then load it fr // winning icons go br
iconOffsets[0] = (width - 150) / 3;
iconOffsets[1] = (height - 150) / 3;
} else {
loadGraphic(file, true, Math.floor(width / 2), Math.floor(height)); //Then load it fr // winning icons go br
iconOffsets[0] = (width - 150) / 2;
iconOffsets[1] = (height - 150) / 2;
}
//loadGraphic(file); //Load stupidly first for getting the file size // why we need to load file first to get file size while we can using 'file' instance to get it?
initialWidth = file.width;
initialHeight = file.height;
final iSize:Float = Math.floor(file.width / file.height); // fastest way to get icon frame without using old shit condition thingy.
loadGraphic(file, true, Math.floor(file.width / iSize), Math.floor(file.height)); //Then load it fr // winning icons go br
iconOffsets[0] = (width - 150) / iSize;
iconOffsets[1] = (height - 150) / iSize;

updateHitbox();

if (width2 == 450) {
animation.add(char, [0, 1, 2], 0, false, isPlayer);
} else {
animation.add(char, [0, 1], 0, false, isPlayer);
}
animation.add(char, [for(i in 0...frames.frames.length) i], 0, false, isPlayer);
animation.play(char);
this.char = char;

Expand Down
4 changes: 2 additions & 2 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6257,8 +6257,8 @@ class PlayState extends MusicBeatState
{
bopIcons();
}
iconP1.updateHitbox();
iconP2.updateHitbox();
//iconP1.updateHitbox();
//iconP2.updateHitbox();

if (ClientPrefs.charsAndBG) characterBopper(curBeat);
lastBeatHit = curBeat;
Expand Down
Loading