Sega Genesis Dev Kit (SGDK)
Moderator: Stef
Re: Sega Genesis Dev Kit (SGDK)
How to turn off looping animation in "sprite_eng"?
How to change animation speed?
How to change animation speed?
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sega Genesis Dev Kit (SGDK)
There is no real way of doing that automatically yet unfortunately.
To disable looping you need to set sprite->timer to 0 when you're reaching last animation frame (setting timer to 0 actually disable auto animation).
Also to change animation speed, again you need to set manually the sprite->timer variable manually after changing animation frame, to be honest in this case it's just more convenient to handle animation manually (letting timer to 0 and using setFrame / setAnimation methods manually).
To disable looping you need to set sprite->timer to 0 when you're reaching last animation frame (setting timer to 0 actually disable auto animation).
Also to change animation speed, again you need to set manually the sprite->timer variable manually after changing animation frame, to be honest in this case it's just more convenient to handle animation manually (letting timer to 0 and using setFrame / setAnimation methods manually).
Re: Sega Genesis Dev Kit (SGDK)
Stef, Thanks!
Re: Sega Genesis Dev Kit (SGDK)
I'm in trouble.
Just have 2 un-used s16 vars. I used them but not now.
But if I delete one of them ( or both ), main player animation fails!
This is what I get in GensKmod message window:
"SPR_setAnim: error - trying to use non existing animation #1 - num animation = 0"
All msgs similar to this one, just change which animation fails.
The question is, these s16 vars are not used ever, they are not in any file ( I looked for them ).
Very strange, sure my code will have a mistake somewhere but I don't know where
Update: Just forget. Unused "s16 vars" were not guilty ones. I was so stupid... I was using
Sprite* spr_m[0];
spr_m[0] = SPR_addSprite(......)
Not sure why but it was working until today, when deleting s16 vars all was wrong.
Then I change:
Sprite* spr_m[1]; //1 element, idiot!!
and all working again. It's C folks, this is not Java, you have the responsability to check everything. My fault
Just have 2 un-used s16 vars. I used them but not now.
But if I delete one of them ( or both ), main player animation fails!
This is what I get in GensKmod message window:
"SPR_setAnim: error - trying to use non existing animation #1 - num animation = 0"
All msgs similar to this one, just change which animation fails.
The question is, these s16 vars are not used ever, they are not in any file ( I looked for them ).
Very strange, sure my code will have a mistake somewhere but I don't know where
Update: Just forget. Unused "s16 vars" were not guilty ones. I was so stupid... I was using
Sprite* spr_m[0];
spr_m[0] = SPR_addSprite(......)
Not sure why but it was working until today, when deleting s16 vars all was wrong.
Then I change:
Sprite* spr_m[1]; //1 element, idiot!!
and all working again. It's C folks, this is not Java, you have the responsability to check everything. My fault
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sega Genesis Dev Kit (SGDK)
When you have that kind of weird behavior you can be certain this is just an edge effect and that the bug is somewhere else.
That's the problem with C code, you don't have any protection against illegal pointer / index access so it could work until you change something completely not related but which internally may alter memory mapping and those exhibit the issue.
That's the problem with C code, you don't have any protection against illegal pointer / index access so it could work until you change something completely not related but which internally may alter memory mapping and those exhibit the issue.
Re: Sega Genesis Dev Kit (SGDK)
Yes.
You can delete these posts if u want, as they are not SGDK related
You can delete these posts if u want, as they are not SGDK related
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sega Genesis Dev Kit (SGDK)
Maybe you can edit the title but honestly *many* people fall in that kind of trouble / caveat so it can still be somehow useful
-
- Very interested
- Posts: 118
- Joined: Mon Feb 19, 2018 7:31 pm
Re: Sega Genesis Dev Kit (SGDK)
Thank you for update!
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sega Genesis Dev Kit (SGDK)
You're welcome ! I forgot to mention it indeed, i just updated to SGDK 1.50, i think i will soon publish a 1.51 version to fix minors issues (as usual) :p
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Re: Sega Genesis Dev Kit (SGDK)
Just updated my local copy and noticed something... in joy.h, the header has this for doc generation
It's missing a few supported devices. Also automatically detected and supported are the EA 4-Way Play, the Menacer, and the Justifier. Also supported, but not automatically, are the Sega Master System pad, trackball, and Phaser. Another caveat is that although the Menacer and Justifier are automatically recognized and supported, the support is not enabled until the programmer tells it to because of the extra overhead that lightguns add. This way, SGDK defaults to a lower overhead state for controllers. Games that can use lightguns can check and enable the lightgun as part of the init process, while normal games can ignore that and simply count on the default init state for controllers.
Note that mice are enabled by default by JOY_init() and will return emulated pad values for reading the port as if it were a controller. This allows using a mouse as a pad for SGDK games. However, mice use a little more overhead than pads, so a game that doesn't use mice as mice and wants every last scrap of speed should check if mice are connected and turn them off to get just that extra little bit of speed. If you have an existing SGDK based game that needs every last bit of speed and doesn't check for mice, unplug any mice for extra speed. Mice are only enabled if detected.
Code: Select all
/**
* \file joy.h
* \brief General controller support.
* \author Chilly Willy & Stephane Dallongeville
* \date 05/2012
*
* This unit provides methods to read controller state.<br>
*<br>
* Here is the list of supported controller device:<br>
* - 3 buttons joypad<br>
* - 6 buttons joypad<br>
* - Sega Mouse<br>
* - team player adapter<br>
*/
Note that mice are enabled by default by JOY_init() and will return emulated pad values for reading the port as if it were a controller. This allows using a mouse as a pad for SGDK games. However, mice use a little more overhead than pads, so a game that doesn't use mice as mice and wants every last scrap of speed should check if mice are connected and turn them off to get just that extra little bit of speed. If you have an existing SGDK based game that needs every last bit of speed and doesn't check for mice, unplug any mice for extra speed. Mice are only enabled if detected.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sega Genesis Dev Kit (SGDK)
Thanks a lot Chilly Willy, looks like this unit needed a documentation update :p
I will add all those precious informations in the header as this is very informative
I will add all those precious informations in the header as this is very informative
Re: Sega Genesis Dev Kit (SGDK)
Hi there!
First cheers to Stef for new update. But my question is about old version
Not really about old version, as I think I'm doing somethig wrong but I don't know where.
If I use SPR_getNumActiveSprite () I get a low number, i.e. 28
But if I check VDP-Sprites in GensKmod, is almost full...
but also there are lot of empty spaces between:
I don't remember this in 1.3 SGDK... maybe is 1.4 SGDK sprite optimization, not sure, better ask!
What is happening there? Is ok?
---------------
Edit: I think these "non-used" sprites are really being used, I saw when some sprites changed they are used, when these sprites are not animated (only 1 sprite for idle animation i.e.) they are a black block, maybe SGKD save this sprite-slots for animation moments or something like that.
First cheers to Stef for new update. But my question is about old version
Not really about old version, as I think I'm doing somethig wrong but I don't know where.
If I use SPR_getNumActiveSprite () I get a low number, i.e. 28
But if I check VDP-Sprites in GensKmod, is almost full...
but also there are lot of empty spaces between:
I don't remember this in 1.3 SGDK... maybe is 1.4 SGDK sprite optimization, not sure, better ask!
What is happening there? Is ok?
---------------
Edit: I think these "non-used" sprites are really being used, I saw when some sprites changed they are used, when these sprites are not animated (only 1 sprite for idle animation i.e.) they are a black block, maybe SGKD save this sprite-slots for animation moments or something like that.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Sega Genesis Dev Kit (SGDK)
Heydanibus wrote: ↑Sun May 10, 2020 2:15 pmHi there!
First cheers to Stef for new update. But my question is about old version
Not really about old version, as I think I'm doing somethig wrong but I don't know where.
...
Edit: I think these "non-used" sprites are really being used, I saw when some sprites changed they are used, when these sprites are not animated (only 1 sprite for idle animation i.e.) they are a black block, maybe SGKD save this sprite-slots for animation moments or something like that.
SPR_getNumActiveSprite() returns you the number of active SGDK sprites (meta sprite) which can internally use several hardware sprite so it's normal that you don't have the same number here.
About the un-used sprite, indeed the sprite engine will always allocate the maximum required sprites, some animation frames may use less sprites than others depending how sprite cutting optimization was done (and indeed that is new to SGDK 1.4).
You may find that sprite cutting optimization is using too many hardware sprites per default, so you can that by specifying the "opt" parameter in the SPRITE resource definition (you can read the rescomp.txt file to get more information about that)
Re: Sega Genesis Dev Kit (SGDK)
Yesssss, I forget about hw sprite vs SGDK sprites, that's a good point.Stef wrote: ↑Mon May 11, 2020 12:03 pmHeydanibus wrote: ↑Sun May 10, 2020 2:15 pmHi there!
First cheers to Stef for new update. But my question is about old version
Not really about old version, as I think I'm doing somethig wrong but I don't know where.
...
Edit: I think these "non-used" sprites are really being used, I saw when some sprites changed they are used, when these sprites are not animated (only 1 sprite for idle animation i.e.) they are a black block, maybe SGKD save this sprite-slots for animation moments or something like that.
SPR_getNumActiveSprite() returns you the number of active SGDK sprites (meta sprite) which can internally use several hardware sprite so it's normal that you don't have the same number here.
About the un-used sprite, indeed the sprite engine will always allocate the maximum required sprites, some animation frames may use less sprites than others depending how sprite cutting optimization was done (and indeed that is new to SGDK 1.4).
You may find that sprite cutting optimization is using too many hardware sprites per default, so you can that by specifying the "opt" parameter in the SPRITE resource definition (you can read the rescomp.txt file to get more information about that)
Regarding the rest, I don't use to check VPD sprite table as there are enough entries for almost everything... sure cutting optimization makes some funny "sprites" in VDP hehehe thanks for replying
-
- Very interested
- Posts: 118
- Joined: Mon Feb 19, 2018 7:31 pm
Re: Sega Genesis Dev Kit (SGDK)
@stef
Hi.
I have a sound corruption in my first sfx, fruit.pcm, fruit2.pcm and fruit3.pcm are same sfx.
VIDEO
https://youtu.be/fp6pkZ9joKE
At 11 seconds you can heard the issue.
fruit.pcm = OK
fruit2.pcm = OK
fruit3.pcm = Sound Corruption
sound.res file
C file
Using SGDK 1.51 (april 2020).
I love SGDK, it's marvelous.
Thank you!
Hi.
I have a sound corruption in my first sfx, fruit.pcm, fruit2.pcm and fruit3.pcm are same sfx.
VIDEO
https://youtu.be/fp6pkZ9joKE
At 11 seconds you can heard the issue.
fruit.pcm = OK
fruit2.pcm = OK
fruit3.pcm = Sound Corruption
sound.res file
Code: Select all
BIN fruit3_sfx "sfx/fruit3.pcm"
XGM stage1 "music/to_the_south.vgm"
BIN fruit2_sfx "sfx/fruit2.pcm"
BIN fruit_sfx "sfx/fruit.pcm"
Code: Select all
...
#define SFX_FRUIT 64
#define SFX_FRUIT2 91
#define SFX_FRUIT3 92
...
XGM_setPCM(SFX_FRUIT, fruit_sfx, sizeof(fruit_sfx));
XGM_setPCM(SFX_FRUIT2, fruit2_sfx, sizeof(fruit2_sfx));
XGM_setPCM(SFX_FRUIT3, fruit3_sfx, sizeof(fruit3_sfx));
...
XGM_startPlayPCM(SFX_FRUIT, 1, SOUND_PCM_CH3);
XGM_startPlayPCM(SFX_FRUIT2, 1, SOUND_PCM_CH3);
XGM_startPlayPCM(SFX_FRUIT3, 1, SOUND_PCM_CH3);
...
Using SGDK 1.51 (april 2020).
I love SGDK, it's marvelous.
Thank you!
Last edited by cloudstrifer on Fri Jun 05, 2020 7:33 pm, edited 1 time in total.