Commit 640a7ad2 authored by David Bruce's avatar David Bruce

code cleanup and other work to make "Practice" fullscreen-compliant (practice.c);

correction of several errata in finger hint table (alphabet.c)


git-svn-id: svn://svn.debian.org/svn/tux4kids/tuxtype/trunk@753 47d30e19-490b-0410-9d18-e851f4e465b3
parent f672f620
......@@ -15,7 +15,6 @@ tuxtype_SOURCES = \
theme.c \
practice.c \
audio.c \
gettext.c \
snow.c \
scripting.c \
SDL_extras.c \
......
......@@ -54,10 +54,10 @@ PROGRAMS = $(bin_PROGRAMS)
am_tuxtype_OBJECTS = playgame.$(OBJEXT) main.$(OBJEXT) \
titlescreen.$(OBJEXT) loaders.$(OBJEXT) setup.$(OBJEXT) \
laser.$(OBJEXT) alphabet.$(OBJEXT) theme.$(OBJEXT) \
practice.$(OBJEXT) audio.$(OBJEXT) gettext.$(OBJEXT) \
snow.$(OBJEXT) scripting.$(OBJEXT) SDL_extras.$(OBJEXT) \
pixels.$(OBJEXT) pause.$(OBJEXT) ConvertUTF.$(OBJEXT) \
options.$(OBJEXT) iconv_string.$(OBJEXT)
practice.$(OBJEXT) audio.$(OBJEXT) snow.$(OBJEXT) \
scripting.$(OBJEXT) SDL_extras.$(OBJEXT) pixels.$(OBJEXT) \
pause.$(OBJEXT) ConvertUTF.$(OBJEXT) options.$(OBJEXT) \
iconv_string.$(OBJEXT)
tuxtype_OBJECTS = $(am_tuxtype_OBJECTS)
tuxtype_LDADD = $(LDADD)
tuxtype_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(tuxtype_LDFLAGS) \
......@@ -204,7 +204,6 @@ tuxtype_SOURCES = \
theme.c \
practice.c \
audio.c \
gettext.c \
snow.c \
scripting.c \
SDL_extras.c \
......@@ -299,7 +298,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SDL_extras.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alphabet.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettext.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iconv_string.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/laser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loaders.Po@am__quote@
......
This diff is collapsed.
......@@ -615,24 +615,29 @@ int PlayLaserGame(int diff_level)
MusicPlay(musics[MUS_GAME + (rand() % NUM_MUSICS)], 0);
/* Pause (keep frame-rate event) */
DEBUGCODE
{
fprintf(stderr, "now_time = %d\tlast_time = %d, elapsed time = %d\n",
now_time, last_time, now_time - last_time);
}
now_time = SDL_GetTicks();
if (now_time < last_time + FPS)
SDL_Delay(last_time + FPS - now_time);
}
while (!done && !quit);
while (!done && !quit);
/* Free backgrounds: */
FreeBothBkgds();
/* Stop music: */
if ((settings.sys_sound) && (Mix_PlayingMusic()))
Mix_HaltMusic();
laser_unload_data();
return 1;
/* Stop music: */
if ((settings.sys_sound) && (Mix_PlayingMusic()))
Mix_HaltMusic();
laser_unload_data();
return 1;
}
......
......@@ -134,6 +134,7 @@ int PlayCascade(int diflevel)
int temp_text_frames;
int temp_text_count;
Uint16 key_unicode;
Uint32 last_time, now_time;
DEBUGCODE
{
......@@ -251,6 +252,8 @@ int PlayCascade(int diflevel)
while (playing_level)
{
last_time = SDL_GetTicks();
oldlives = curlives;
oldfish_left = fish_left;
......@@ -395,9 +398,30 @@ int PlayCascade(int diflevel)
{
/* This does all the blits that we have queued up this frame: */
UpdateScreen(&frame);
}
if (!settings.speed_up)
WaitFrame();
/* Pause (keep frame-rate event) */
now_time = SDL_GetTicks();
DEBUGCODE
{
fprintf(stderr, "now_time = %d\tlast_time = %d, elapsed time = %d\n",
now_time, last_time, now_time - last_time);
}
if (now_time < last_time + 1000/FRAMES_PER_SEC)
{
//Prevent any possibility of a time wrap-around
// (this is a very unlikely problem unless there is an SDL bug
// or you leave tuxmath running for 49 days...)
now_time = (last_time + 1000/FRAMES_PER_SEC) - now_time; // this holds the delay
if (now_time > 1000/FRAMES_PER_SEC)
now_time = 1000/FRAMES_PER_SEC;
SDL_Delay(now_time);
}
else
{
fprintf(stderr, "Did not achieve desired frame rate!\n");
}
} /* End per-frame game loop - level completed */
......@@ -861,14 +885,14 @@ static void UpdateScreen(int* frame)
{
if (blits[i].type == 'E')
{
DEBUGCODE
{
fprintf(stderr, "Erasing blits[%d]\n", i);
fprintf(stderr, "srcrect->x = %d\t srcrect->y = %d\t srcrect->w = %d\t srcrect->h = %d\n",
blits[i].srcrect->x, blits[i].srcrect->y, blits[i].srcrect->w, blits[i].srcrect->h);
fprintf(stderr, "dstrect->x = %d\t dstrect->y = %d\t dstrect->w = %d\t dstrect->h = %d\n",
blits[i].dstrect->x, blits[i].dstrect->y, blits[i].dstrect->w, blits[i].dstrect->h);
}
// DEBUGCODE
// {
// fprintf(stderr, "Erasing blits[%d]\n", i);
// fprintf(stderr, "srcrect->x = %d\t srcrect->y = %d\t srcrect->w = %d\t srcrect->h = %d\n",
// blits[i].srcrect->x, blits[i].srcrect->y, blits[i].srcrect->w, blits[i].srcrect->h);
// fprintf(stderr, "dstrect->x = %d\t dstrect->y = %d\t dstrect->w = %d\t dstrect->h = %d\n",
// blits[i].dstrect->x, blits[i].dstrect->y, blits[i].dstrect->w, blits[i].dstrect->h);
// }
SDL_LowerBlit(blits[i].src, blits[i].srcrect, screen, blits[i].dstrect);
}
......@@ -883,14 +907,14 @@ static void UpdateScreen(int* frame)
{
if (blits[i].type == 'D')
{
DEBUGCODE
{
fprintf(stderr, "drawing blits[%d]\n", i);
fprintf(stderr, "srcrect->x = %d\t srcrect->y = %d\t srcrect->w = %d\t srcrect->h = %d\n",
blits[i].srcrect->x, blits[i].srcrect->y, blits[i].srcrect->w, blits[i].srcrect->h);
fprintf(stderr, "dstrect->x = %d\t dstrect->y = %d\t dstrect->w = %d\t dstrect->h = %d\n",
blits[i].dstrect->x, blits[i].dstrect->y, blits[i].dstrect->w, blits[i].dstrect->h);
}
// DEBUGCODE
// {
// fprintf(stderr, "drawing blits[%d]\n", i);
// fprintf(stderr, "srcrect->x = %d\t srcrect->y = %d\t srcrect->w = %d\t srcrect->h = %d\n",
// blits[i].srcrect->x, blits[i].srcrect->y, blits[i].srcrect->w, blits[i].srcrect->h);
// fprintf(stderr, "dstrect->x = %d\t dstrect->y = %d\t dstrect->w = %d\t dstrect->h = %d\n",
// blits[i].dstrect->x, blits[i].dstrect->y, blits[i].dstrect->w, blits[i].dstrect->h);
// }
SDL_BlitSurface(blits[i].src, blits[i].srcrect, screen, blits[i].dstrect);
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment