Skip to content

Commit

Permalink
LR2 skin parser : bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
exch-bms2 committed Sep 29, 2016
1 parent 1e349bc commit 1c25239
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 31 deletions.
12 changes: 6 additions & 6 deletions src/bms/player/beatoraja/select/MusicSelectSkin.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ public MusicSelectSkin(Rectangle r) {
SkinImage mode = new SkinImage();
mode.setImage(modet, 0);
mode.setReferenceID(MusicSelector.BUTTON_MODE);
setDestination(mode, 0, 120, 10, 144, 24, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0);
setDestination(mode, 0, 120, 10, 108, 18, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0);
add(mode);
addImage(new TextureRegion(st, 240,744 ,144,24), 0, 10, 10,144, 24, 0, 128,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0);
addImage(new TextureRegion(st, 240,744 ,144,24), 0, 10, 10,108, 18, 0, 128,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0);

TextureRegion[][] sortt = new TextureRegion[5][];
for(int i = 0;i < sortt.length;i++) {
Expand All @@ -289,9 +289,9 @@ public MusicSelectSkin(Rectangle r) {
SkinImage sort = new SkinImage();
sort.setImage(sortt, 0);
sort.setReferenceID(MusicSelector.BUTTON_SORT);
setDestination(sort, 0, 390, 10, 120, 24, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0);
setDestination(sort, 0, 390, 10, 108, 18, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0);
add(sort);
addImage(new TextureRegion(st, 400,720 ,96,24), 0, 280, 10,96, 24, 0, 128,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0);
addImage(new TextureRegion(st, 400,720 ,96,24), 0, 280, 10,72, 18, 0, 128,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0);

TextureRegion[][] lnt = new TextureRegion[3][];
for(int i = 0;i < lnt.length;i++) {
Expand All @@ -300,9 +300,9 @@ public MusicSelectSkin(Rectangle r) {
SkinImage lnmode = new SkinImage();
lnmode.setImage(lnt, 0);
lnmode.setReferenceID(MusicSelector.BUTTON_LNMODE);
setDestination(lnmode, 0, 700, 10, 72, 24, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0);
setDestination(lnmode, 0, 700, 10, 54, 18, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0);
add(lnmode);
addImage(new TextureRegion(st, 550,672 ,144,24), 0, 540, 10,144, 24, 0, 128,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0);
addImage(new TextureRegion(st, 550,672 ,144,24), 0, 540, 10,108, 18, 0, 128,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0);


// timer
Expand Down
22 changes: 16 additions & 6 deletions src/bms/player/beatoraja/skin/LR2PlaySkinLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ public void execute(String[] str) {
}
if (lane < note.length && note[lane] == null) {
TextureRegion[] images = getSourceImage(values);
note[lane] = new Sprite(images[0]);
if(images != null) {
note[lane] = new Sprite(images[0]);
}
}
if (lanerender == null) {
lanerender = new PlaySkin.SkinLaneObject(skin);
Expand All @@ -160,7 +162,9 @@ public void execute(String[] str) {
}
if (lane < lnend.length && lnend[lane] == null) {
TextureRegion[] images = getSourceImage(values);
lnend[lane] = new Sprite(images[0]);
if(images != null) {
lnend[lane] = new Sprite(images[0]);
}
}
}
});
Expand All @@ -180,7 +184,9 @@ public void execute(String[] str) {
}
if (lane < lnstart.length && lnstart[lane] == null) {
TextureRegion[] images = getSourceImage(values);
lnstart[lane] = new Sprite(images[0]);
if(images != null) {
lnstart[lane] = new Sprite(images[0]);
}
}
}
});
Expand All @@ -201,8 +207,10 @@ public void execute(String[] str) {
}
if (lane < lnbody.length && lnbody[lane] == null) {
TextureRegion[] images = getSourceImage(values);
lnbody[lane] = new Sprite(images[0]);
lnbodya[lane] = new Sprite(images[images.length - 1]);
if(images != null) {
lnbody[lane] = new Sprite(images[0]);
lnbodya[lane] = new Sprite(images[images.length - 1]);
}
}
}
});
Expand All @@ -223,7 +231,9 @@ public void execute(String[] str) {
}
if (lane < mine.length && mine[lane] == null) {
TextureRegion[] images = getSourceImage(values);
mine[lane] = new Sprite(images[0]);
if(images != null) {
mine[lane] = new Sprite(images[0]);
}
}
}
});
Expand Down
58 changes: 40 additions & 18 deletions src/bms/player/beatoraja/skin/LR2SkinCSVLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,25 +203,46 @@ public void execute(String[] str) {
num = null;
try {
int[] values = parseInt(str);
TextureRegion[] images = getSourceImage(values);
if(images != null) {
if (images.length >= 24) {
TextureRegion[] pn = new TextureRegion[12];
TextureRegion[] mn = new TextureRegion[12];
for (int i = 0; i < 12; i++) {
pn[i] = images[i];
mn[i] = images[i + 12];
int divx = values[7];
if (divx <= 0) {
divx = 1;
}
int divy = values[8];
if (divy <= 0) {
divy = 1;
}

if(divx * divy >= 10) {
TextureRegion[] images = getSourceImage(values);
if(images != null) {
if (images.length % 24 == 0) {
TextureRegion[] pn = new TextureRegion[12];
TextureRegion[] mn = new TextureRegion[12];

for (int i = 0; i < 12; i++) {
pn[i] = images[i];
mn[i] = images[i + 12];
}
num = new SkinNumber(pn, mn, values[9], values[13] + 1, 0, values[11]);
num.setAlign(values[12]);
} else {
int d = images.length % 10 == 0 ? 10 :11;

TextureRegion[][] nimages = new TextureRegion[divx * divy / d][d];
for (int i = 0; i < d; i++) {
for (int j = 0; j < divx * divy / d; j++) {
nimages[j][i] = images[j * d + i];
}
}

num = new SkinNumber(nimages, values[9], values[13], d > 10 ? 2 : 0, values[11]);
num.setAlign(values[12]);
}
num = new SkinNumber(pn, mn, values[9], values[13] + 1, 0, values[11]);
num.setAlign(values[12]);
} else {
num = new SkinNumber(images, values[9], values[13], images.length > 10 ? 2 : 0, values[11]);
num.setAlign(values[12]);
}
num.setTimer(values[10]);
skin.add(num);
// System.out.println("Number Added - " +
// (num.getId()));
num.setTimer(values[10]);
skin.add(num);
// System.out.println("Number Added - " +
// (num.getId()));
}
}
} catch (NumberFormatException e) {
e.printStackTrace();
Expand Down Expand Up @@ -526,6 +547,7 @@ protected TextureRegion[] getSourceImage(int[] values) {
return getSourceImage(imagelist.get(values[2]), values[3], values[4], values[5], values[6], values[7],
values[8]);
}
System.out.println("failed to load image : " + line);
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/bms/player/beatoraja/skin/SkinObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void setDestination(long time, float x, float y, float w, float h, int ac
if (dstfilter == 0) {
dstfilter = filter;
}
if (dstcenter == 0) {
if (dstcenter == 0 && center < 10) {
dstcenter = center;
}
if (dsttimer == 0) {
Expand Down

0 comments on commit 1c25239

Please sign in to comment.