diff --git a/bin/rescomp.jar b/bin/rescomp.jar index 0acdf310..d2397159 100644 Binary files a/bin/rescomp.jar and b/bin/rescomp.jar differ diff --git a/bin/rescomp.txt b/bin/rescomp.txt index 692d899a..1b7cdb53 100644 --- a/bin/rescomp.txt +++ b/bin/rescomp.txt @@ -1,4 +1,4 @@ -ResComp 3.85 (August 2024) +ResComp 3.87 (November 2024) Copyright Stephane Dallongeville https://github.com/Stephane-D/SGDK @@ -343,7 +343,11 @@ SPRITE name img_file width height [compression [time [collision [opt_type [opt_l 1 / APLIB = aplib library (good compression ratio but slow, don't use it for streamed sprite) 2 / FAST / LZ4W = custom lz4 compression (average compression ratio but fast, recommended for streamed sprite) time display frame time in 1/60 of second (time between each animation frame) - If this value is set to 0 (default) then auto animation is disabled + If this value is set to 0 (default) then auto animation is disabled. + It can be either set globally (single value) or independently for each frame of each animation. + Example for 3 anim x 5 frame sprite sheet: + [[3,3,3,4,4][4,5,5][2,3,3,4]] + No space allowed ! And you can have empty value for empty frame. collision collision type: CIRCLE, BOX or NONE (NONE by default) opt_type sprite cutting optimization strategy, accepted values: 0 / BALANCED = balance between used tiles and hardware sprites (default) diff --git a/src/pal.c b/src/pal.c index c2b8b948..0e1a7ffa 100644 --- a/src/pal.c +++ b/src/pal.c @@ -341,6 +341,10 @@ bool NO_INLINE PAL_initFade(u16 fromCol, u16 toCol, const u16* palSrc, const u16 bool NO_INLINE PAL_doFadeStep(void) { + // fading is done? --> exit + if (fadeCounter <= 0) + return FALSE; + // prepare fade palette for next frame s16* palR = fadeR; s16* palG = fadeG; diff --git a/tools/rescomp/src/sgdk/rescomp/Launcher.java b/tools/rescomp/src/sgdk/rescomp/Launcher.java index 427df1f9..bc9e0979 100644 --- a/tools/rescomp/src/sgdk/rescomp/Launcher.java +++ b/tools/rescomp/src/sgdk/rescomp/Launcher.java @@ -30,7 +30,7 @@ else if (dep && depTarget == null) depTarget = param; } - System.out.println("ResComp 3.86 - SGDK Resource Compiler - Copyright 2024 (Stephane Dallongeville)"); + System.out.println("ResComp 3.87 - SGDK Resource Compiler - Copyright 2024 (Stephane Dallongeville)"); if (fileName == null) { diff --git a/tools/rescomp/src/sgdk/rescomp/processor/SpriteProcessor.java b/tools/rescomp/src/sgdk/rescomp/processor/SpriteProcessor.java index cfc67135..e9c11ec0 100644 --- a/tools/rescomp/src/sgdk/rescomp/processor/SpriteProcessor.java +++ b/tools/rescomp/src/sgdk/rescomp/processor/SpriteProcessor.java @@ -38,6 +38,11 @@ public Resource execute(String[] fields) throws Exception System.out.println(" 1 / APLIB = aplib library (good compression ratio but slow)"); System.out.println(" 2 / FAST / LZ4W = custom lz4 compression (average compression ratio but fast)"); System.out.println(" time display frame time in 1/60 of second (time between each animation frame)"); + System.out.println(" If this value is set to 0 (default) then auto animation is disabled"); + System.out.println(" It can be set globally (single value) or independently for each frame of each animation"); + System.out.println(" Example for a sprite sheet of 3 animations x 5 frames:"); + System.out.println(" [[3,3,3,4,4][4,5,5][2,3,3,4]]"); + System.out.println(" As you can see you can have empty value for empty frame"); System.out.println(" collision collision type: CIRCLE, BOX or NONE (BOX by default)"); System.out.println(" opt_type sprite cutting optimization strategy, accepted values:"); System.out.println(" 0 / BALANCED = balance between used tiles and hardware sprites (default)"); @@ -90,9 +95,9 @@ public Resource execute(String[] fields) throws Exception if (fields.length >= 6) compression = Util.getCompression(fields[5]); // get frame time - int time = 0; + int[][] time = new int[][] {{ 0 }}; if (fields.length >= 7) - time = StringUtil.parseInt(fields[6], 0); + time = StringUtil.parseIntArray2D(fields[6], new int[][] {{ 0 }}); // get collision value CollisionType collision = CollisionType.NONE; if (fields.length >= 8) diff --git a/tools/rescomp/src/sgdk/rescomp/resource/Sprite.java b/tools/rescomp/src/sgdk/rescomp/resource/Sprite.java index 2f93b469..f1492956 100644 --- a/tools/rescomp/src/sgdk/rescomp/resource/Sprite.java +++ b/tools/rescomp/src/sgdk/rescomp/resource/Sprite.java @@ -34,7 +34,7 @@ public class Sprite extends Resource public final Palette palette; - public Sprite(String id, String imgFile, int wf, int hf, Compression compression, int time, CollisionType collision, OptimizationType optType, + public Sprite(String id, String imgFile, int wf, int hf, Compression compression, int[][] time, CollisionType collision, OptimizationType optType, OptimizationLevel optLevel, boolean showCut, boolean optDuplicate) throws Exception { super(id); @@ -108,7 +108,7 @@ public Sprite(String id, String imgFile, int wf, int hf, Compression compression for (int i = 0; i < numAnim; i++) { // build sprite animation - SpriteAnimation animation = new SpriteAnimation(id + "_animation" + i, image, wt, ht, i, wf, hf, time, collision, compression, optType, optLevel, optDuplicate); + SpriteAnimation animation = new SpriteAnimation(id + "_animation" + i, image, wt, ht, i, wf, hf, time[Math.min(time.length - 1, i)], collision, compression, optType, optLevel, optDuplicate); // check if empty if (!animation.isEmpty()) diff --git a/tools/rescomp/src/sgdk/rescomp/resource/internal/SpriteAnimation.java b/tools/rescomp/src/sgdk/rescomp/resource/internal/SpriteAnimation.java index c86ee77c..2812db77 100644 --- a/tools/rescomp/src/sgdk/rescomp/resource/internal/SpriteAnimation.java +++ b/tools/rescomp/src/sgdk/rescomp/resource/internal/SpriteAnimation.java @@ -39,7 +39,7 @@ public class SpriteAnimation extends Resource * height of frame in tile * @param showCuttingResult */ - public SpriteAnimation(String id, byte[] image8bpp, int w, int h, int animIndex, int wf, int hf, int time, CollisionType collision, Compression compression, + public SpriteAnimation(String id, byte[] image8bpp, int w, int h, int animIndex, int wf, int hf, int[] time, CollisionType collision, Compression compression, OptimizationType optType, OptimizationLevel optLevel, boolean optDuplicate) { super(id); @@ -117,7 +117,7 @@ public SpriteAnimation(String id, byte[] image8bpp, int w, int h, int animIndex, // frames.add(frame); // create sprite frame ('timer' is augmented by number of duplicate) - SpriteFrame frame = new SpriteFrame(id + "_frame" + i, frameImage, wf, hf, time * (duplicate + 1), collision, compression, optType, optLevel); + SpriteFrame frame = new SpriteFrame(id + "_frame" + i, frameImage, wf, hf, time[Math.min(time.length - 1, i)] * (duplicate + 1), collision, compression, optType, optLevel); // add as internal resource (get duplicate if exist) frame = (SpriteFrame) addInternalResource(frame); // bypass duplicates