Hello community, here is the log from the commit of package lpairs for openSUSE:Factory checked in at 2020-09-01 20:10:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lpairs (Old) and /work/SRC/openSUSE:Factory/.lpairs.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lpairs" Tue Sep 1 20:10:16 2020 rev:3 rq:830993 version:1.0.5 Changes: -------- --- /work/SRC/openSUSE:Factory/lpairs/lpairs.changes 2015-06-24 21:04:18.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.lpairs.new.3399/lpairs.changes 2020-09-01 20:10:30.860680694 +0200 @@ -1,0 +2,12 @@ +Mon Aug 31 17:28:09 UTC 2020 - Carsten Ziepke <[email protected]> + +- Update to 1.0.5 + - reduced delay to prevent event loop from dying (2018/11/02 MS) + - fixed compiler warnings and errors (2018/11/02 MS) + - improved ingame font (2015/04/12 MS) + - always choose set from all icons (2015/04/12 MS) + - added animation for removing cards (2015/04/12 MS) +- Run spec-cleaner +- Fix Group Tag + +------------------------------------------------------------------- Old: ---- lpairs-1.0.4.tar.gz New: ---- lpairs-1.0.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lpairs.spec ++++++ --- /var/tmp/diff_new_pack.dba1tX/_old 2020-09-01 20:10:31.496680992 +0200 +++ /var/tmp/diff_new_pack.dba1tX/_new 2020-09-01 20:10:31.496680992 +0200 @@ -1,7 +1,7 @@ # # spec file for package lpairs # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,23 +12,22 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: lpairs -Version: 1.0.4 +Version: 1.0.5 Release: 0 Summary: Classical memory game -License: GPL-2.0 -Group: Amusements/Games/Arcade/LogicGame -Url: http://lgames.sourceforge.net/index.php?project=LPairs -Source0: http://downloads.sourceforge.net/lgames/%{name}-%{version}.tar.gz -%if 0%{?suse_version} +License: GPL-2.0-only +Group: Amusements/Games/Logic +URL: http://lgames.sourceforge.net/index.php?project=LPairs +Source0: https://downloads.sourceforge.net/lgames/%{name}-%{version}.tar.gz +BuildRequires: pkgconfig +BuildRequires: pkgconfig(sdl) BuildRequires: fdupes BuildRequires: update-desktop-files -%endif -BuildRequires: pkgconfig(sdl) %description LPairs is a classical memory game. This means you have to find pairs of @@ -42,15 +41,17 @@ sed -i 's|games/lpairs|lpairs|' configure %build - -export CFLAGS="%{optflags} -fgnu89-inline" +# FIXME: Package suffers from c11/inline issues +# Workaround by appending -std=gnu89 to CFLAGS +# Proper fix would be to fix the source-code +export CFLAGS="%{optflags} -std=gnu89" %configure -make %{?_smp_mflags} +%make_build %install mkdir -p %{buildroot}%{_bindir} -make DESTDIR=%{buildroot} install -%find_lang %name +%make_install +%find_lang %{name} # install icon install -Dm 0644 %{name}.png %{buildroot}%{_datadir}/pixmaps/%{name}.png @@ -58,14 +59,12 @@ # install desktop install -Dm 0644 %{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop -%if 0%{?suse_version} - %suse_update_desktop_file %{name} - %fdupes -s %{buildroot}%{_prefix} -%endif - -%files -f %name.lang -%defattr(-,root,root,-) -%doc AUTHORS COPYING ChangeLog README +%suse_update_desktop_file %{name} +%fdupes -s %{buildroot}%{_prefix} + +%files -f %{name}.lang +%license COPYING +%doc AUTHORS ChangeLog README %{_bindir}/%{name} %{_datadir}/applications/%{name}.desktop %{_datadir}/pixmaps/%{name}.png ++++++ lpairs-1.0.4.tar.gz -> lpairs-1.0.5.tar.gz ++++++ ++++ 20107 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/ChangeLog new/lpairs-1.0.5/ChangeLog --- old/lpairs-1.0.4/ChangeLog 2008-08-30 20:56:36.000000000 +0200 +++ new/lpairs-1.0.5/ChangeLog 2018-11-02 20:12:52.000000000 +0100 @@ -1,3 +1,10 @@ +1.0.5: +- reduced delay to prevent event loop from dying (2018/11/02 MS) +- fixed compiler warnings and errors (2018/11/02 MS) +- improved ingame font (2015/04/12 MS) +- always choose set from all icons (2015/04/12 MS) +- added animation for removing cards (2015/04/12 MS) + 1.0.4: - replaced graphics and removed logo (part of background now) (08/08/24 KG) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/compile new/lpairs-1.0.5/compile --- old/lpairs-1.0.4/compile 1970-01-01 01:00:00.000000000 +0100 +++ new/lpairs-1.0.5/compile 2018-11-02 17:45:48.000000000 +0100 @@ -0,0 +1,347 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-10-14.11; # UTC + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Written by Tom Tromey <[email protected]>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to <[email protected]> or send patches to +# <[email protected]>. + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to <[email protected]>. +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/config.h.in new/lpairs-1.0.5/config.h.in --- old/lpairs-1.0.4/config.h.in 2008-08-30 20:57:40.000000000 +0200 +++ new/lpairs-1.0.5/config.h.in 2018-11-02 20:15:06.000000000 +0100 @@ -101,6 +101,9 @@ /* Define if your <locale.h> file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H @@ -240,6 +243,9 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/configure.in new/lpairs-1.0.5/configure.in --- old/lpairs-1.0.4/configure.in 2008-08-30 20:57:07.000000000 +0200 +++ new/lpairs-1.0.5/configure.in 2018-11-02 20:14:27.000000000 +0100 @@ -5,7 +5,7 @@ AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(lpairs,1.0.4) +AM_INIT_AUTOMAKE(lpairs,1.0.5) dnl Checks for programs. AM_GNU_GETTEXT @@ -13,10 +13,11 @@ AC_PROG_RANLIB dnl Checks for libraries. +AC_CHECK_LIB(m, main,, AC_MSG_ERROR(lib math is needed)) dnl check SDL version AM_PATH_SDL(1.0.0,, AC_MSG_ERROR(lib SDL is needed)) -CFLAGS="$CFLAGS $SDL_CFLAGS" +CFLAGS="$CFLAGS $SDL_CFLAGS -Wno-unused-result" LIBS="$LIBS $SDL_LIBS" AM_PATH_SDL(1.1.5, CFLAGS="$CFLAGS -DSDL_1_1_5",) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/lpairs/Makefile.am new/lpairs-1.0.5/lpairs/Makefile.am --- old/lpairs-1.0.4/lpairs/Makefile.am 2008-08-30 20:58:08.000000000 +0200 +++ new/lpairs-1.0.5/lpairs/Makefile.am 2018-11-02 17:43:54.000000000 +0100 @@ -15,7 +15,7 @@ gfx/12.bmp gfx/13.bmp gfx/14.bmp gfx/15.bmp gfx/16.bmp gfx/17.bmp \ gfx/18.bmp gfx/19.bmp \ gfx/button.bmp gfx/back.bmp gfx/title.bmp \ -gfx/f_white.bmp gfx/f_yellow.bmp gfx/stan_font.bmp \ +gfx/f_small_white.bmp gfx/f_white.bmp gfx/f_yellow.bmp gfx/f_standard.bmp \ \ sound/click.wav sound/remove.wav sound/fail.wav diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/lpairs/dynlist.c new/lpairs-1.0.5/lpairs/dynlist.c --- old/lpairs-1.0.4/lpairs/dynlist.c 2001-03-16 10:18:34.000000000 +0100 +++ new/lpairs-1.0.5/lpairs/dynlist.c 2018-11-02 19:53:39.000000000 +0100 @@ -18,6 +18,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <stdint.h> #include "dynlist.h" /* initialize list */ @@ -131,7 +132,7 @@ break; } else { - fprintf(stderr, "ERR: dl_delete: list does not contain item 0x%x...\n", (int)item); + fprintf(stderr, "ERR: dl_delete: list does not contain item 0x%lu...\n", (uintptr_t)item); return 1; } @@ -239,7 +240,7 @@ break; } else { - fprintf(stderr, "ERR: DL_GetE: list does not contain item 0x%x...\n", (int)item); + fprintf(stderr, "ERR: DL_GetE: list does not contain item 0x%lu...\n", (uintptr_t)item); return 0; } Binary files old/lpairs-1.0.4/lpairs/gfx/f_small_white.bmp and new/lpairs-1.0.5/lpairs/gfx/f_small_white.bmp differ Binary files old/lpairs-1.0.4/lpairs/gfx/f_standard.bmp and new/lpairs-1.0.5/lpairs/gfx/f_standard.bmp differ Binary files old/lpairs-1.0.4/lpairs/gfx/stan_font.bmp and new/lpairs-1.0.5/lpairs/gfx/stan_font.bmp differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/lpairs/main.c new/lpairs-1.0.5/lpairs/main.c --- old/lpairs-1.0.4/lpairs/main.c 2008-08-24 19:43:16.000000000 +0200 +++ new/lpairs-1.0.5/lpairs/main.c 2018-11-02 20:10:17.000000000 +0100 @@ -1,7 +1,7 @@ /*************************************************************************** main.c - description ------------------- - begin : Fre M�r 16 10:16:42 CET 2001 + begin : Fre M�r 16 10:16:42 CET 2001 copyright : (C) 2001 by Michael Speck email : [email protected] ***************************************************************************/ @@ -92,7 +92,7 @@ MM_Ini(back->w / 2, back->h - 100, 50, back, NULL, font_y, font_w); /* add copyright and homepage */ - small_font = load_fixed_font( "stan_font.bmp" , 32, 96, 8); + small_font = load_fixed_font( "f_small_white.bmp" , 32, 96, 8); small_font->align = ALIGN_X_LEFT | ALIGN_Y_BOTTOM; sprintf( str, "http://lgames.sourceforge.net" ); write_text( small_font, back, 2, back->h - 2, str, OPAQUE ); @@ -142,6 +142,18 @@ MM_Ck(); } +static int all_filter( const SDL_Event *event ) { return 0; } + +void event_clear_sdl_queue() +{ + SDL_EventFilter old_filter; + SDL_Event event; + old_filter = SDL_GetEventFilter(); + SDL_SetEventFilter( all_filter ); + while ( SDL_PollEvent( &event ) ); + SDL_SetEventFilter( old_filter ); +} + int main(int argc, char *argv[]) { Pairs pairs; @@ -236,7 +248,7 @@ M_CmA(mm.c_mn, ms); M_Shw(mm.c_mn); refresh_rects(); - SDL_Delay( 5 ); + SDL_Delay( 1 ); } // terminate menu // @@ -248,6 +260,7 @@ /* free resources */ delete_res( &pairs ); + sa_free_background(); /* save config */ C_Sv(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/lpairs/pairs.c new/lpairs-1.0.5/lpairs/pairs.c --- old/lpairs-1.0.4/lpairs/pairs.c 2007-11-27 20:59:47.000000000 +0100 +++ new/lpairs-1.0.5/lpairs/pairs.c 2018-11-02 20:10:46.000000000 +0100 @@ -83,7 +83,7 @@ } */ /* font */ - pairs->font = load_fixed_font( "stan_font.bmp" , 32, 96, 8); + pairs->font = load_fixed_font( "f_standard.bmp" , 32, 96, 10); /* sounds */ #ifdef SOUND @@ -151,6 +151,8 @@ { int i, dummy, pos1, pos2; int map_size = width * height; + int pair_num = map_size / 2; + int pair_ids[ICON_NUMBER]; /* all ids, first will be selected */ int leave = 0; SDL_Event event; int reveal_time = 0; @@ -173,16 +175,25 @@ /* pairs to go */ pairs->pairs_left = map_size / 2; + /* randomly choose pairnum pairs */ + for (i = 0; i < ICON_NUMBER; i++) + pair_ids[i] = i; + for (i = 0; i < ICON_NUMBER*20; i++) { + pos1 = rand() % ICON_NUMBER; + pos2 = rand() % ICON_NUMBER; + dummy = pair_ids[pos1]; + pair_ids[pos1] = pair_ids[pos2]; + pair_ids[pos2] = dummy; + } + /* recreate map */ pairs->map = calloc( map_size, sizeof( int ) ); /* add sorted pairs */ i = 0; - while ( i < map_size / 2 ) { - - pairs->map[i] = i; - pairs->map[i + map_size / 2] = i; + while ( i < pair_num ) { + pairs->map[i] = pair_ids[i]; + pairs->map[i + map_size / 2] = pair_ids[i]; i++; - } /* unsort these pairs */ for ( i = 0; i < map_size * 20; i++ ) { @@ -255,7 +266,7 @@ } - SDL_Delay( 5 ); + SDL_Delay( 1 ); } @@ -274,6 +285,30 @@ set_video_mode( 640, 480, 16, SDL_SWSURFACE ); } +/* init card removal animation */ +void init_card_animation(Pairs *pairs, int mx1, int my1, int mx2, int my2) +{ + int sx1 = pairs->x_offset + mx1 * ( BUTTON_WIDTH + BORDER ); + int sy1 = pairs->y_offset + my1 * ( BUTTON_HEIGHT + BORDER ); + int sx2 = pairs->x_offset + mx2 * ( BUTTON_WIDTH + BORDER ); + int sy2 = pairs->y_offset + my2 * ( BUTTON_HEIGHT + BORDER ); + int dx = (sx1 + sx2)/2, dy = (sy1 + sy2)/2; + int sa = 0, da = 192; + SDL_Surface *img = 0; + + img = create_surf(BUTTON_WIDTH, BUTTON_HEIGHT, SDL_SWSURFACE); + DEST(img,0,0,img->w,img->h); + SOURCE(sdl.screen,sx1,sy1) + blit_surf(); + sa_init(&pairs->anim1,img,sx1,sy1,sa,dx,dy,da,300); + + img = create_surf(BUTTON_WIDTH, BUTTON_HEIGHT, SDL_SWSURFACE); + DEST(img,0,0,img->w,img->h); + SOURCE(sdl.screen,sx2,sy2) + blit_surf(); + sa_init(&pairs->anim2,img,sx2,sy2,sa,dx,dy,da,300); +} + /* run game */ void run_game( Pairs *pairs ) { @@ -282,7 +317,6 @@ int x, y; int ms; char str[128]; - int removed = 0; int restart = 0; reset_timer(); @@ -299,7 +333,9 @@ break; case SDL_MOUSEBUTTONUP: - if ( event.button.button == LEFT_BUTTON && pairs->status != BOTH_SEL ) + if ( event.button.button == LEFT_BUTTON && + pairs->status != BOTH_SEL && + pairs->status != REMOVE_CARDS ) if ( get_map_pos( pairs, event.button.x, event.button.y, &x, &y ) ) { /* same tile? */ @@ -347,11 +383,32 @@ } - /* get millisceonds */ + /* get milliseconds */ ms = get_time(); /* add time */ - pairs->time += ms; + if (pairs->status != REMOVE_CARDS) + pairs->time += ms; + else { + if (sa_update(&pairs->anim1,ms) || sa_update(&pairs->anim2,ms)) { + /* both reach destination at the same time */ + pairs->pairs_left--; + if ( pairs->pairs_left <= 0 ) + pairs->status = DONE; + else + pairs->status = NO_SEL; + + sa_finalize(&pairs->anim1); + sa_finalize(&pairs->anim2); + sa_draw_background(); + sdl.rect_count = RECT_LIMIT; /* XXX fake full update */ + } else { + sa_draw_background(); + sa_draw(&pairs->anim1); + sa_draw(&pairs->anim2); + sdl.rect_count = RECT_LIMIT; /* XXX fake full update */ + } + } /* check if buttons must be closed */ if ( pairs->status == BOTH_SEL ) { @@ -369,30 +426,28 @@ /* close buttons? */ if ( pairs->status == CLOSE_SEL ) { - removed = 0; - - /* remove buttons? */ - if ( get_map_cont( pairs, pairs->first_sel.x, pairs->first_sel.y ) == - get_map_cont( pairs, pairs->sec_sel.x, pairs->sec_sel.y ) ) { - - removed = 1; - + /* remove cards? */ + if (get_map_cont(pairs, pairs->first_sel.x, pairs->first_sel.y) == + get_map_cont(pairs, pairs->sec_sel.x, pairs->sec_sel.y )) { + + pairs->status = REMOVE_CARDS; + init_card_animation(pairs, + pairs->first_sel.x, pairs->first_sel.y, + pairs->sec_sel.x, pairs->sec_sel.y); + set_map_cont( pairs, pairs->first_sel.x, pairs->first_sel.y, -1 ); set_map_cont( pairs, pairs->sec_sel.x, pairs->sec_sel.y, -1 ); - pairs->pairs_left--; - - if ( pairs->pairs_left <= 0 ) - pairs->status = DONE; - } draw_button( pairs, pairs->first_sel.x, pairs->first_sel.y, CLOSED ); draw_button( pairs, pairs->sec_sel.x, pairs->sec_sel.y, CLOSED ); - if ( pairs->status != DONE ) - pairs->status = NO_SEL; + if (pairs->status != REMOVE_CARDS) + pairs->status = NO_SEL; + else + sa_get_background(); #ifdef SOUND - if ( removed ) + if ( pairs->status == REMOVE_CARDS ) SSrv_Ply(pairs->remove_sound, 0); else SSrv_Ply(pairs->fail_sound, 0); @@ -401,7 +456,7 @@ pairs->tries++; } - + draw_info( pairs ); refresh_rects(); @@ -424,14 +479,12 @@ pairs->font->align = ALIGN_X_CENTER | ALIGN_Y_TOP; y = ( sdl.screen->h >> 1 ) - 50; - sprintf( str, _("Congratulations! You have resolved this puzzle!") ); + sprintf( str, _("Congratulations!") ); write_text( pairs->font, sdl.screen, sdl.screen->w >> 1, y, str, OPAQUE ); - sprintf( str, _("It now will restart with the same settings.") ); + sprintf( str, _("Press ESC to exit or") ); write_text( pairs->font, sdl.screen, sdl.screen->w >> 1, y + 20, str, OPAQUE ); - sprintf( str, _("If you want to change these press <Escape> after restart.") ); + sprintf( str, _("any other key to restart.") ); write_text( pairs->font, sdl.screen, sdl.screen->w >> 1, y + 40, str, OPAQUE ); - sprintf( str, _("(Press any key to continue...)") ); - write_text( pairs->font, sdl.screen, sdl.screen->w >> 1, y + 60, str, OPAQUE ); refresh_screen( 0, 0, 0, 0 ); @@ -446,7 +499,7 @@ } - SDL_Delay( 5 ); + SDL_Delay( 1 ); } if ( cfg.dim ) @@ -499,13 +552,13 @@ } /* get map contents at position */ -inline int get_map_cont( Pairs *pairs, int map_x, int map_y ) +int get_map_cont( Pairs *pairs, int map_x, int map_y ) { return ( pairs->map[map_y * pairs->width + map_x] ); } /* set map contents at position */ -inline void set_map_cont( Pairs *pairs, int map_x, int map_y, int cont ) +void set_map_cont( Pairs *pairs, int map_x, int map_y, int cont ) { pairs->map[map_y * pairs->width + map_x] = cont; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/lpairs/pairs.h new/lpairs-1.0.5/lpairs/pairs.h --- old/lpairs-1.0.4/lpairs/pairs.h 2005-09-27 16:02:58.000000000 +0200 +++ new/lpairs-1.0.5/lpairs/pairs.h 2018-11-02 19:48:41.000000000 +0100 @@ -32,7 +32,7 @@ BUTTON_WIDTH = 64, BUTTON_HEIGHT = 64, BORDER = 16, /* distance between buttons */ - DELAY = 1000 + DELAY = 3000 }; /* draw map tile open or closed? */ @@ -47,10 +47,11 @@ /* game stats */ enum { - NO_SEL = 0, - ONE_SEL, - BOTH_SEL, - CLOSE_SEL, + NO_SEL = 0, /* no card selected */ + ONE_SEL, /* one card selected */ + BOTH_SEL, /* two cards selected */ + CLOSE_SEL, /* close non-matching cards or start animation */ + REMOVE_CARDS, /* small animation on removing matching cards */ DONE }; @@ -64,6 +65,7 @@ SDL_Surface **icons; /* icons displayed on buttons */ int icon_number; Font *font; + SimpleAnimation anim1, anim2; /* for removing cards */ #ifdef SOUND Wv *click_sound; Wv *remove_sound; @@ -102,10 +104,10 @@ void draw_button( Pairs *pairs, int map_x, int map_y, int type ); /* get map contents at position */ -inline int get_map_cont( Pairs *pairs, int map_x, int map_y ); +int get_map_cont( Pairs *pairs, int map_x, int map_y ); /* set map contents at position */ -inline void set_map_cont( Pairs *pairs, int map_x, int map_y, int cont ); +void set_map_cont( Pairs *pairs, int map_x, int map_y, int cont ); /* draw all buttons */ void draw_all_buttons( Pairs *pairs, int type ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/lpairs/sdl.c new/lpairs-1.0.5/lpairs/sdl.c --- old/lpairs-1.0.4/lpairs/sdl.c 2001-03-16 19:48:14.000000000 +0100 +++ new/lpairs-1.0.5/lpairs/sdl.c 2018-11-02 19:46:10.000000000 +0100 @@ -19,6 +19,7 @@ #include <stdlib.h> #include <string.h> #include <sys/timeb.h> +#include <math.h> #include "sdl.h" extern int term_game; @@ -31,7 +32,7 @@ // sdl surface // /* return full path of bitmap */ -inline void get_full_bmp_path( char *full_path, char *file_name ) +void get_full_bmp_path( char *full_path, char *file_name ) { sprintf(full_path, "%sgfx/%s", SRC_DIR, file_name ); } @@ -110,7 +111,7 @@ /* lock surface */ -inline void lock_surf(SDL_Surface *sur) +void lock_surf(SDL_Surface *sur) { if (SDL_MUSTLOCK(sur)) SDL_LockSurface(sur); @@ -119,7 +120,7 @@ /* unlock surface */ -inline void unlock_surf(SDL_Surface *sur) +void unlock_surf(SDL_Surface *sur) { if (SDL_MUSTLOCK(sur)) SDL_UnlockSurface(sur); @@ -354,7 +355,7 @@ /* lock font surface */ -inline void lock_font(Font *fnt) +void lock_font(Font *fnt) { if (SDL_MUSTLOCK(fnt->pic)) SDL_LockSurface(fnt->pic); @@ -363,7 +364,7 @@ /* unlock font surface */ -inline void unlock_font(Font *fnt) +void unlock_font(Font *fnt) { if (SDL_MUSTLOCK(fnt->pic)) SDL_UnlockSurface(fnt->pic); @@ -480,7 +481,7 @@ /* update rectangle (0,0,0,0)->fullscreen */ -inline void refresh_screen(int x, int y, int w, int h) +void refresh_screen(int x, int y, int w, int h) { SDL_UpdateRect(sdl.screen, x, y, w, h); } @@ -630,7 +631,7 @@ /* lock surface */ -inline void lock_screen() +void lock_screen() { if (SDL_MUSTLOCK(sdl.screen)) SDL_LockSurface(sdl.screen); @@ -639,7 +640,7 @@ /* unlock surface */ -inline void unlock_screen() +void unlock_screen() { if (SDL_MUSTLOCK(sdl.screen)) SDL_UnlockSurface(sdl.screen); @@ -648,7 +649,7 @@ /* flip hardware screens (double buffer) */ -inline void flip_screen() +void flip_screen() { SDL_Flip(sdl.screen); } @@ -727,3 +728,77 @@ { last_time = SDL_GetTicks(); } + + +/* Simple Animation */ + +SDL_Surface *sa_background = 0; /* copy of screen contents */ + +void sa_get_background() +{ + if (sa_background == 0) + sa_background = create_surf(sdl.screen->w, sdl.screen->h, SDL_SWSURFACE); + FULL_DEST(sa_background); + FULL_SOURCE(sdl.screen); + blit_surf(); +} +void sa_free_background() +{ + if (sa_background) + SDL_FreeSurface(sa_background); + sa_background = 0; +} +void sa_draw_background() +{ + FULL_DEST(sdl.screen); + FULL_SOURCE(sa_background); + blit_surf(); +} + +void sa_init(SimpleAnimation *anim, SDL_Surface *img, + int sx, int sy, int sa, int dx, int dy, int da, int time) +{ + double len, v; + + anim->image = img; + anim->px = sx; + anim->py = sy; + anim->pa = sa; + + /* compute speed vector */ + anim->vx = dx - sx; + anim->vy = dy - sy; + len = sqrt(anim->vx * anim->vx + anim->vy * anim->vy); + v = len / time; /* time is in milliseconds */ + anim->vx = anim->vx / len * v; + anim->vy = anim->vy / len * v; + + /* compute alpha vector */ + anim->va = (double)(da - sa) / time; + + anim->runtime = time; +} +void sa_finalize(SimpleAnimation *anim) +{ + SDL_FreeSurface(anim->image); + anim->image = 0; + anim->runtime = 0; +} +int sa_update(SimpleAnimation *anim, int ms) +{ + if (anim->runtime > 0) { + anim->px += anim->vx * ms; + anim->py += anim->vy * ms; + anim->pa += anim->va * ms; + anim->runtime -= ms; + } + return (anim->runtime <= 0); +} +void sa_draw(SimpleAnimation *anim) +{ + if (anim->image) { + DEST( sdl.screen, anim->px, anim->py, anim->image->w, anim->image->h ); + SOURCE( anim->image, 0, 0 ); + alpha_blit_surf(anim->pa); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/lpairs/sdl.h new/lpairs-1.0.5/lpairs/sdl.h --- old/lpairs-1.0.4/lpairs/sdl.h 2001-03-16 19:43:22.000000000 +0100 +++ new/lpairs-1.0.5/lpairs/sdl.h 2018-11-02 19:46:21.000000000 +0100 @@ -40,8 +40,8 @@ SDL_Surface* load_surf(char *fname, int f); SDL_Surface* create_surf(int w, int h, int f); int disp_format(SDL_Surface *sur); -inline void lock_surf(SDL_Surface *sur); -inline void unlock_surf(SDL_Surface *sur); +void lock_surf(SDL_Surface *sur); +void unlock_surf(SDL_Surface *sur); void blit_surf(void); void alpha_blit_surf(int alpha); void fill_surf(int c); @@ -86,8 +86,8 @@ Font* load_fixed_font(char *fname, int off, int len, int w); void free_font(Font *sfnt); int write_text(Font *sfnt, SDL_Surface *dest, int x, int y, char *str, int alpha); -inline void lock_font(Font *sfnt); -inline void unlock_font(Font *sfnt); +void lock_font(Font *sfnt); +void unlock_font(Font *sfnt); SDL_Rect last_write_rect(Font *fnt); int text_width(Font *fnt, char *str); @@ -116,16 +116,16 @@ void quit_sdl(); int set_video_mode( int w, int h, int d, int f ); void hardware_cap(); -inline void refresh_screen( int x, int y, int w, int h ); +void refresh_screen( int x, int y, int w, int h ); void refresh_rects(); void add_refresh_rect(int x, int y, int w, int h); void dim_screen(int steps, int delay, int trp); void undim_screen(int steps, int delay, int trp); int wait_for_key(); void wait_for_click(); -inline void lock_screen(); -inline void unlock_screen(); -inline void flip_screen(); +void lock_screen(); +void unlock_screen(); +void flip_screen(); /* cursor */ /* creates cursor */ @@ -135,6 +135,23 @@ int get_time(); void reset_timer(); +/* Simple Animation: linear movement of image in front of "frozen" screen */ +typedef struct { + SDL_Surface *image; /* surface (is deleted after animation) */ + double px,py,pa; /* current position/alpha */ + double vx,vy,va; /* change per millisecond */ + double runtime; /* remaining runtime of animation in milliseconds */ +} SimpleAnimation; + +void sa_get_background(); +void sa_free_background(); +void sa_draw_background(); + +void sa_init(SimpleAnimation *anim, SDL_Surface *img, int sx, int sy, int sa, int dx, int dy, int da, int time); +void sa_finalize(SimpleAnimation *anim); +int sa_update(SimpleAnimation *anim, int ms); +void sa_draw(SimpleAnimation *anim); + #ifdef __cplusplus }; #endif Binary files old/lpairs-1.0.4/po/de.gmo and new/lpairs-1.0.5/po/de.gmo differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lpairs-1.0.4/po/de.po new/lpairs-1.0.5/po/de.po --- old/lpairs-1.0.4/po/de.po 2008-08-30 20:57:41.000000000 +0200 +++ new/lpairs-1.0.5/po/de.po 2018-11-02 20:15:06.000000000 +0100 @@ -8,10 +8,11 @@ msgstr "" "Project-Id-Version: lpairs 1.0.1\n" "Report-Msgid-Bugs-To: http://lgames.sf.net/contact.php\n" -"POT-Creation-Date: 2008-08-30 20:57+0200\n" +"POT-Creation-Date: 2018-11-02 20:15+0100\n" "PO-Revision-Date: 2005-09-26 14:49+0200\n" "Last-Translator: Michael Speck <[email protected]>\n" "Language-Team: German\n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -77,37 +78,45 @@ msgid "Volume:" msgstr "Lautstaerke" -#: lpairs/pairs.c:427 +#: lpairs/pairs.c:482 #, c-format -msgid "Congratulations! You have resolved this puzzle!" -msgstr "Glueckwunsch! Sie haben dieses Puzzle geloest!" - -#: lpairs/pairs.c:429 -#, c-format -msgid "It now will restart with the same settings." -msgstr "Es wird jetzt mit den gleichen Einstellungen neu gestartet." +msgid "Congratulations!" +msgstr "" -#: lpairs/pairs.c:431 +#: lpairs/pairs.c:484 #, c-format -msgid "If you want to change these press <Escape> after restart." -msgstr "Wenn Sie diese aendern moechten, druecken Sie ESC nach dem Neuteilen." +msgid "Press ESC to exit or" +msgstr "" -#: lpairs/pairs.c:433 +#: lpairs/pairs.c:486 #, c-format -msgid "(Press any key to continue...)" -msgstr "(Beliebige Taste um fortzufahren...)" +msgid "any other key to restart." +msgstr "" -#: lpairs/pairs.c:578 +#: lpairs/pairs.c:631 #, c-format msgid "Pairs left: %i" msgstr "Verbliebene Paare: %i" -#: lpairs/pairs.c:583 +#: lpairs/pairs.c:636 #, c-format msgid "Tries: %i" msgstr "Versuche: %i" -#: lpairs/pairs.c:586 +#: lpairs/pairs.c:639 #, c-format msgid "Time: %s" msgstr "Zeit: %s" + +#~ msgid "Congratulations! You have resolved this puzzle!" +#~ msgstr "Glueckwunsch! Sie haben dieses Puzzle geloest!" + +#~ msgid "It now will restart with the same settings." +#~ msgstr "Es wird jetzt mit den gleichen Einstellungen neu gestartet." + +#~ msgid "If you want to change these press <Escape> after restart." +#~ msgstr "" +#~ "Wenn Sie diese aendern moechten, druecken Sie ESC nach dem Neuteilen." + +#~ msgid "(Press any key to continue...)" +#~ msgstr "(Beliebige Taste um fortzufahren...)"
