Skip to content

Commit

Permalink
Changed special value of numSprite to 0x81 (make it easier to recover…
Browse files Browse the repository at this point in the history
… the number of sprite)
  • Loading branch information
Stephane-D committed Aug 25, 2024
1 parent 097aa8a commit 65c5a6b
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
Binary file modified bin/rescomp.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/rescomp.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ResComp 3.83 (March 2024)
ResComp 3.85 (August 2024)
Copyright Stephane Dallongeville
https://github.com/Stephane-D/SGDK

Expand Down
3 changes: 2 additions & 1 deletion inc/sprite_eng.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ typedef struct
* Sprite animation frame structure.
*
* \param numSprite
* number of VDP sprite which compose this frame (-1 is a special value when we have a single optimisable VDP sprite)
* number of VDP sprite which compose this frame.
* bit 7 is used as a special flag for the sprite engine so always use 'numSprite & 0x7F' to just retrieve the number of sprite
* \param timer
* active time for this frame (in 1/60 of second)
* \param tileset
Expand Down
3 changes: 2 additions & 1 deletion inc/sprite_eng_legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ typedef struct
* Sprite animation frame structure.
*
* \param numSprite
* number of VDP sprite which compose this frame
* number of VDP sprite which compose this frame.
* bit 7 is used as a special flag for the sprite engine so always use 'numSprite & 0x7F' to just retrieve the number of sprite
* \param timer
* active time for this frame (in 1/60 of second)
* \param tileset
Expand Down
Binary file modified lib/libmd.a
Binary file not shown.
10 changes: 5 additions & 5 deletions src/sprite_eng_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ static u16 updateVisibility(Sprite* sprite, u16 status)
else if ((xmax < 0) || ((xmin - fw) > 0)) visibility = VISIBILITY_OFF;
else
{
u16 num = (frame->numSprite < 0)?1:frame->numSprite;
u16 num = frame->numSprite & 0x7F;
// start from the last one
FrameVDPSprite* frameSprite = &(frame->frameVDPSprites[num]);
visibility = 0;
Expand Down Expand Up @@ -1846,7 +1846,7 @@ static u16 updateFrame(Sprite* sprite, u16 status)
}

// detect if we need to hide some VDP sprite
s16 currentNumSprite = (frame->numSprite < 0)?1:frame->numSprite;
s16 currentNumSprite = frame->numSprite & 0x7F;

// adjust number of sprite to hide
sprite->spriteToHide += sprite->lastNumSprite - currentNumSprite;
Expand Down Expand Up @@ -1902,7 +1902,7 @@ static void updateSpriteTableAll(Sprite* sprite)
visibility = sprite->visibility;
attr = sprite->attribut;
frame = sprite->frame;
num = (frame->numSprite < 0)?1:frame->numSprite;
num = frame->numSprite & 0x7F;
frameSprite = frame->frameVDPSprites;
vdpSprite = &vdpSpriteCache[sprite->VDPSpriteIndex];

Expand Down Expand Up @@ -1990,7 +1990,7 @@ static void updateSpriteTablePos(Sprite* sprite)
visibility = sprite->visibility;
attr = sprite->attribut;
frame = sprite->frame;
num = (frame->numSprite < 0)?1:frame->numSprite;
num = frame->numSprite & 0x7F;
frameSprite = frame->frameVDPSprites;
vdpSprite = &vdpSpriteCache[sprite->VDPSpriteIndex];

Expand Down Expand Up @@ -2063,7 +2063,7 @@ static void updateSpriteTableHide(Sprite* sprite)

VDPSprite* vdpSprite = &vdpSpriteCache[sprite->VDPSpriteIndex];
// don't forget to hide sprites that were used by previous frame
s16 num = (sprite->frame->numSprite < 0)?1:sprite->frame->numSprite;
s16 num = sprite->frame->numSprite & 0x7F;

if (sprite->spriteToHide > 0) num += sprite->spriteToHide;

Expand Down
2 changes: 1 addition & 1 deletion tools/rescomp/src/sgdk/rescomp/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ else if (dep && depTarget == null)
depTarget = param;
}

System.out.println("ResComp 3.84 - SGDK Resource Compiler - Copyright 2024 (Stephane Dallongeville)");
System.out.println("ResComp 3.85 - SGDK Resource Compiler - Copyright 2024 (Stephane Dallongeville)");

if (fileName == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public void out(ByteArrayOutputStream outB, StringBuilder outS, StringBuilder ou
// AnimationFrame structure
Util.decl(outS, outH, "AnimationFrame", id, 2, global);
// number of sprite / timer info
int numSprite = isOptimisable() ? -1 : getNumSprite();
int numSprite = isOptimisable() ? 0x81 : getNumSprite();
outS.append(" dc.w " + (((numSprite << 8) & 0xFF00) | ((timer << 0) & 0xFF)) + "\n");
// set tileset pointer
outS.append(" dc.l " + tileset.id + "\n");
Expand Down

0 comments on commit 65c5a6b

Please sign in to comment.