projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20030804-1-src
[rocksndiamonds.git]
/
src
/
libgame
/
toons.c
diff --git
a/src/libgame/toons.c
b/src/libgame/toons.c
index c8c71e3a96c6f7ac6323ae12dea69b10c1197a75..01229f019b0b7285fe295fdc135bce184504246a 100644
(file)
--- a/
src/libgame/toons.c
+++ b/
src/libgame/toons.c
@@
-64,10
+64,10
@@
int getAnimationFrame(int num_frames, int delay, int mode, int start_frame,
{
/* note: expect different frames for the same delay cycle! */
{
/* note: expect different frames for the same delay cycle! */
- if (
anim.
random_frame < 0)
+ if (
gfx.anim_
random_frame < 0)
frame = SimpleRND(num_frames);
else
frame = SimpleRND(num_frames);
else
- frame =
anim.
random_frame % num_frames;
+ frame =
gfx.anim_
random_frame % num_frames;
}
if (mode & ANIM_REVERSE) /* use reverse animation direction */
}
if (mode & ANIM_REVERSE) /* use reverse animation direction */
@@
-85,6
+85,7
@@
static int get_toon_direction(char *direction_raw)
{
static char *direction = NULL;
{
static char *direction = NULL;
+ /* !!! MEMORY LEAK HERE! FIX IT! !!! */
setString(&direction, getStringToLower(direction_raw));
return (strcmp(direction, "left") == 0 ? MV_LEFT :
setString(&direction, getStringToLower(direction_raw));
return (strcmp(direction, "left") == 0 ? MV_LEFT :
@@
-317,6
+318,10
@@
void HandleAnimation(int mode)
if (!setup.toons)
return;
if (!setup.toons)
return;
+ /* this may happen after reloading graphics and redefining "num_toons" */
+ if (toon_nr >= screen_info.num_toons)
+ anim_restart = TRUE;
+
switch(mode)
{
case ANIM_START:
switch(mode)
{
case ANIM_START:
@@
-359,7
+364,7
@@
void HandleAnimation(int mode)
toon_nr = SimpleRND(screen_info.num_toons);
}
toon_nr = SimpleRND(screen_info.num_toons);
}
- anim_restart = reset_delay = AnimateToon(toon_nr,anim_restart);
+ anim_restart = reset_delay = AnimateToon(toon_nr,
anim_restart);
}
void InitAnimation()
}
void InitAnimation()