Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ltris2 for openSUSE:Factory checked in at 2024-10-13 17:34:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ltris2 (Old) and /work/SRC/openSUSE:Factory/.ltris2.new.19354 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ltris2" Sun Oct 13 17:34:24 2024 rev:2 rq:1207542 version:2.0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ltris2/ltris2.changes 2024-09-15 12:39:10.943506800 +0200 +++ /work/SRC/openSUSE:Factory/.ltris2.new.19354/ltris2.changes 2024-10-13 17:34:26.472141451 +0200 @@ -1,0 +2,10 @@ +Sat Oct 12 17:01:41 UTC 2024 - Martin Hauke <[email protected]> + +- Update to version 2.0.2 + * apply autoshift changes to current game. + * added custom cursor and hide it while playing. + * CPU player names include settings. + * changed step for cpu speed factor to 10%. + * fixed bug in key handling. + +------------------------------------------------------------------- Old: ---- ltris2-2.0.1.tar.gz New: ---- ltris2-2.0.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ltris2.spec ++++++ --- /var/tmp/diff_new_pack.nNKbFs/_old 2024-10-13 17:34:27.344177599 +0200 +++ /var/tmp/diff_new_pack.nNKbFs/_new 2024-10-13 17:34:27.344177599 +0200 @@ -17,7 +17,7 @@ Name: ltris2 -Version: 2.0.1 +Version: 2.0.2 Release: 0 Summary: Tetris Clone with Multiplayer and CPU Opponents License: GPL-3.0-or-later ++++++ ltris2-2.0.1.tar.gz -> ltris2-2.0.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/Changelog new/ltris2-2.0.2/Changelog --- old/ltris2-2.0.1/Changelog 2024-09-03 17:50:33.000000000 +0200 +++ new/ltris2-2.0.2/Changelog 2024-10-12 11:11:03.000000000 +0200 @@ -1,3 +1,10 @@ +2.0.2: +- apply autoshift changes to current game (2024/10/07 MS) +- added custom cursor and hide it while playing (2024/10/05 MS) +- CPU player names include settings (2024/09/21 MS) +- changed step for cpu speed factor to 10% (2024/09/21 MS) +- fixed bug in key handling (2024/09/21 MS) + 2.0.1: - count score faster (2024/09/03 MS) - use special block for sent garbage lines (2024/09/03 MS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/configure new/ltris2-2.0.2/configure --- old/ltris2-2.0.1/configure 2024-09-03 17:51:54.000000000 +0200 +++ new/ltris2-2.0.2/configure 2024-10-12 11:11:32.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for ltris2 2.0.1. +# Generated by GNU Autoconf 2.71 for ltris2 2.0.2. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, @@ -608,8 +608,8 @@ # Identity of this package. PACKAGE_NAME='ltris2' PACKAGE_TARNAME='ltris2' -PACKAGE_VERSION='2.0.1' -PACKAGE_STRING='ltris2 2.0.1' +PACKAGE_VERSION='2.0.2' +PACKAGE_STRING='ltris2 2.0.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1351,7 +1351,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ltris2 2.0.1 to adapt to many kinds of systems. +\`configure' configures ltris2 2.0.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1422,7 +1422,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ltris2 2.0.1:";; + short | recursive ) echo "Configuration of ltris2 2.0.2:";; esac cat <<\_ACEOF @@ -1530,7 +1530,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ltris2 configure 2.0.1 +ltris2 configure 2.0.2 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1925,7 +1925,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ltris2 $as_me 2.0.1, which was +It was created by ltris2 $as_me 2.0.2, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3416,7 +3416,7 @@ # Define the identity of the package. PACKAGE='ltris2' - VERSION='2.0.1' + VERSION='2.0.2' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -10924,7 +10924,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ltris2 $as_me 2.0.1, which was +This file was extended by ltris2 $as_me 2.0.2, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -10992,7 +10992,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -ltris2 config.status 2.0.1 +ltris2 config.status 2.0.2 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/configure.ac new/ltris2-2.0.2/configure.ac --- old/ltris2-2.0.1/configure.ac 2024-09-03 17:51:49.000000000 +0200 +++ new/ltris2-2.0.2/configure.ac 2024-10-12 11:11:25.000000000 +0200 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.71]) -AC_INIT([ltris2],[2.0.1]) +AC_INIT([ltris2],[2.0.2]) AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/libgame/bowl.c new/ltris2-2.0.2/libgame/bowl.c --- old/ltris2-2.0.1/libgame/bowl.c 2024-09-03 16:53:57.000000000 +0200 +++ new/ltris2-2.0.2/libgame/bowl.c 2024-10-07 19:54:07.000000000 +0200 @@ -1450,7 +1450,8 @@ hori_movement = 1; bowl_check_lockdelay(bowl); } - } else if (bc->lrot == CS_DOWN || bc->rrot == CS_DOWN) { + } + if (bc->lrot == CS_DOWN || bc->rrot == CS_DOWN) { /* test if we actually can rotate * if not shift block if modern and rotate anyways */ if (bc->lrot == CS_DOWN) { @@ -1501,7 +1502,8 @@ bowl_compute_help_pos(bowl); bowl_check_lockdelay(bowl); } - } else if (bc->hdrop == CS_DOWN) { + } + if (bc->hdrop == CS_DOWN) { if (config.gametype == GAME_TRAINING) bowl_toggle_gravity(bowl); else { @@ -1511,7 +1513,8 @@ if (bowl->ldelay_cur > 0) bowl->ldelay_cur = 1; } - } else if (bc->hold == CS_DOWN && bowl->hold_active && !bowl->hold_used) { + } + if (bc->hold == CS_DOWN && bowl->hold_active && !bowl->hold_used) { /* put current piece to hold, use piece in hold or next block */ bowl->ldelay_cur = 0; /* reset lock delay if any */ bowl_use_hold(bowl); @@ -1964,3 +1967,11 @@ return; bowl->zero_gravity = !bowl->zero_gravity; } + +void bowl_set_autoshift(Bowl *bowl, int delay, int speed) +{ + bowl->das_maxcharge = config.as_delay; + bowl->das_drop = config.as_speed; + if (bowl->das_charge > bowl->das_maxcharge) + bowl->das_charge = bowl->das_maxcharge; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/libgame/bowl.h new/ltris2-2.0.2/libgame/bowl.h --- old/ltris2-2.0.1/libgame/bowl.h 2024-09-01 17:56:58.000000000 +0200 +++ new/ltris2-2.0.2/libgame/bowl.h 2024-10-07 19:54:14.000000000 +0200 @@ -254,6 +254,8 @@ int bowl_piece_can_drop(Bowl *bowl); +void bowl_set_autoshift(Bowl *bowl, int delay, int speed); + #ifdef __cplusplus }; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/libgame/config.h new/ltris2-2.0.2/libgame/config.h --- old/ltris2-2.0.1/libgame/config.h 2024-09-01 18:03:08.000000000 +0200 +++ new/ltris2-2.0.2/libgame/config.h 2024-09-21 12:43:07.000000000 +0200 @@ -86,7 +86,7 @@ int cpu_style; /* cpu style */ int cpu_delay; /* delay in ms before CPU soft drops */ int cpu_rot_delay; /* delay between rotation steps */ - int cpu_sfactor; /* multiplier for dropping speed in 0.25 steps */ + int cpu_sfactor; /* multiplier for dropping speed in percent */ /* controls */ int as_delay; int as_speed; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/libgame/tetris.c new/ltris2-2.0.2/libgame/tetris.c --- old/ltris2-2.0.1/libgame/tetris.c 2024-09-01 17:56:58.000000000 +0200 +++ new/ltris2-2.0.2/libgame/tetris.c 2024-10-02 15:24:51.000000000 +0200 @@ -310,6 +310,13 @@ */ int tetris_init() { + char cpu_base[32], cpu_name[32], cpu_name2[32]; + snprintf(cpu_base,32,"CPU-%c%d", + config.cpu_style==CS_DEFENSIVE?'D': + config.cpu_style==CS_NORMAL?'N':'A',config.cpu_sfactor); + snprintf(cpu_name,32,"%s-1",cpu_base); + snprintf(cpu_name2,32,"%s-2",cpu_base); + /* create block buffer with several bags each containing all 7 * tetrominoes permuted randomly */ last_generated_block = -1; @@ -338,7 +345,7 @@ &config.player2.controls ); else bowls[1] = bowl_create( 420, 0, 327, config.modern?100:160, - 327,290, blocks, qmark, "CPU-1", 0 ); + 327,290, blocks, qmark, cpu_base, 0 ); break; case GAME_VS_HUMAN_HUMAN: case GAME_VS_HUMAN_CPU: @@ -347,11 +354,11 @@ if ( config.gametype != GAME_VS_CPU_CPU ) bowls[1] = bowl_create( 220, 0, -1, -1, -1,-1, blocks, qmark, config.player2.name, &config.player2.controls ); else - bowls[1] = bowl_create( 220, 0, -1, -1, -1,-1, blocks, qmark, "CPU-1", 0 ); + bowls[1] = bowl_create( 220, 0, -1, -1, -1,-1, blocks, qmark, cpu_name, 0 ); if ( config.gametype == GAME_VS_HUMAN_HUMAN ) bowls[2] = bowl_create( 430, 0, -1, -1, -1,-1, blocks, qmark, config.player3.name, &config.player3.controls ); else - bowls[2] = bowl_create( 430, 0, -1, -1, -1,-1, blocks, qmark, "CPU-2", 0 ); + bowls[2] = bowl_create( 430, 0, -1, -1, -1,-1, blocks, qmark, cpu_name2, 0 ); break; } /* enable stats for one bowl games */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/po/de.po new/ltris2-2.0.2/po/de.po --- old/ltris2-2.0.1/po/de.po 2024-09-03 17:51:55.000000000 +0200 +++ new/ltris2-2.0.2/po/de.po 2024-10-12 11:11:34.000000000 +0200 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: ltris2 2.0\n" "Report-Msgid-Bugs-To: [email protected]\n" -"POT-Creation-Date: 2024-09-03 17:51+0200\n" +"POT-Creation-Date: 2024-10-12 11:11+0200\n" "PO-Revision-Date: 2024-07-13 11:10+0200\n" "Last-Translator: Michael <[email protected]>\n" "Language-Team: German <[email protected]>\n" @@ -18,23 +18,23 @@ "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: src/menu.h:166 +#: src/menu.h:167 msgid "Back" msgstr "" -#: src/menu.h:282 +#: src/menu.h:283 msgid "Off" msgstr "" -#: src/menu.h:282 +#: src/menu.h:283 msgid "On" msgstr "" -#: src/menu.h:331 +#: src/menu.h:332 msgid "Enter Name" msgstr "" -#: src/view.cpp:46 src/view.cpp:367 +#: src/view.cpp:46 src/view.cpp:388 msgid "Normal" msgstr "" @@ -54,31 +54,31 @@ msgid "Vs 2xCPU" msgstr "" -#: src/view.cpp:74 src/vgame.cpp:221 +#: src/view.cpp:74 src/vgame.cpp:214 msgid "(Re)" msgstr "" -#: src/view.cpp:364 +#: src/view.cpp:385 msgid "50 FPS" msgstr "" -#: src/view.cpp:364 +#: src/view.cpp:385 msgid "60 FPS" msgstr "" -#: src/view.cpp:364 +#: src/view.cpp:385 msgid "200 FPS" msgstr "" -#: src/view.cpp:367 +#: src/view.cpp:388 msgid "Defensive" msgstr "" -#: src/view.cpp:367 +#: src/view.cpp:388 msgid "Aggressive" msgstr "" -#: src/view.cpp:370 +#: src/view.cpp:391 msgid "" "This is your starting level which will be ignored for mode 'Figures' (always " "starts at level 0).\n" @@ -87,7 +87,7 @@ "(the higher the starting level the more lines)." msgstr "" -#: src/view.cpp:374 +#: src/view.cpp:395 msgid "" "Normal: Starts with an empty bowl. Try to survive as long as possible.\n" "\n" @@ -97,7 +97,7 @@ "Vs Human/CPU/2xCPU: Play against another human or one or two CPU opponents." msgstr "" -#: src/view.cpp:377 +#: src/view.cpp:398 msgid "" "Modern: Enables all that stuff that makes tetris casual like ghost piece, " "wall-kicks, hold, DAS charge during ARE (allows to shift next piece faster), " @@ -107,79 +107,79 @@ "very interesting." msgstr "" -#: src/view.cpp:395 src/view.cpp:508 +#: src/view.cpp:416 src/view.cpp:529 msgid "New Game" msgstr "" -#: src/view.cpp:396 src/view.cpp:418 +#: src/view.cpp:417 src/view.cpp:439 msgid "Multiplayer Options" msgstr "" -#: src/view.cpp:397 src/view.cpp:510 +#: src/view.cpp:418 src/view.cpp:531 msgid "Controls" msgstr "" -#: src/view.cpp:398 src/view.cpp:407 src/view.cpp:443 +#: src/view.cpp:419 src/view.cpp:428 src/view.cpp:464 msgid "Player 1" msgstr "" -#: src/view.cpp:399 src/view.cpp:408 src/view.cpp:444 +#: src/view.cpp:420 src/view.cpp:429 src/view.cpp:465 msgid "Player 2" msgstr "" -#: src/view.cpp:400 src/view.cpp:512 +#: src/view.cpp:421 src/view.cpp:533 msgid "Audio" msgstr "" -#: src/view.cpp:401 src/view.cpp:511 +#: src/view.cpp:422 src/view.cpp:532 msgid "Graphics" msgstr "" -#: src/view.cpp:405 +#: src/view.cpp:426 msgid "Start Game" msgstr "" -#: src/view.cpp:411 +#: src/view.cpp:432 msgid "Game Mode" msgstr "" -#: src/view.cpp:413 +#: src/view.cpp:434 msgid "Game Style" msgstr "" -#: src/view.cpp:414 +#: src/view.cpp:435 msgid "Classic" msgstr "" -#: src/view.cpp:414 +#: src/view.cpp:435 msgid "Modern" msgstr "" -#: src/view.cpp:415 +#: src/view.cpp:436 msgid "Starting Level" msgstr "" -#: src/view.cpp:423 +#: src/view.cpp:444 msgid "Holes" msgstr "" -#: src/view.cpp:424 +#: src/view.cpp:445 msgid "Number of holes in sent lines." msgstr "" -#: src/view.cpp:426 +#: src/view.cpp:447 msgid "Random Holes" msgstr "" -#: src/view.cpp:427 +#: src/view.cpp:448 msgid "If multiple lines are sent, each line has different holes." msgstr "" -#: src/view.cpp:430 +#: src/view.cpp:451 msgid "CPU Style" msgstr "" -#: src/view.cpp:431 +#: src/view.cpp:452 msgid "" "Defensive: Clears any lines.\n" "Normal: Mostly goes for two lines.\n" @@ -189,31 +189,31 @@ "completing multiple lines at the expense of a balanced bowl contents." msgstr "" -#: src/view.cpp:433 +#: src/view.cpp:454 msgid "CPU Drop Delay" msgstr "" -#: src/view.cpp:436 +#: src/view.cpp:457 msgid "CPU Speed" msgstr "" -#: src/view.cpp:446 +#: src/view.cpp:467 msgid "Auto-Shift Delay" msgstr "" -#: src/view.cpp:447 +#: src/view.cpp:468 msgid "Initial delay before auto shift starts. Classic DAS has 270." msgstr "" -#: src/view.cpp:449 +#: src/view.cpp:470 msgid "Auto-Shift Speed" msgstr "" -#: src/view.cpp:450 +#: src/view.cpp:471 msgid "Delay between auto shift steps. Classic DAS has 100." msgstr "" -#: src/view.cpp:457 +#: src/view.cpp:478 msgid "" "Left/Right: horizontal movement\n" "Rotate Left/Right: piece rotation\n" @@ -222,126 +222,126 @@ "Hold: put current piece to hold (only for modern style)" msgstr "" -#: src/view.cpp:462 +#: src/view.cpp:483 msgid "Left" msgstr "" -#: src/view.cpp:463 +#: src/view.cpp:484 msgid "Right" msgstr "" -#: src/view.cpp:464 +#: src/view.cpp:485 msgid "Rotate Left" msgstr "" -#: src/view.cpp:465 +#: src/view.cpp:486 msgid "Rotate Right" msgstr "" -#: src/view.cpp:466 +#: src/view.cpp:487 msgid "Down" msgstr "" -#: src/view.cpp:467 +#: src/view.cpp:488 msgid "Drop" msgstr "" -#: src/view.cpp:468 src/vgame.cpp:488 +#: src/view.cpp:489 src/vgame.cpp:481 msgid "Hold" msgstr "" -#: src/view.cpp:474 +#: src/view.cpp:495 msgid "Theme" msgstr "" -#: src/view.cpp:475 +#: src/view.cpp:496 msgid "Select theme. (not applied yet)" msgstr "" -#: src/view.cpp:477 +#: src/view.cpp:498 msgid "Mode" msgstr "" -#: src/view.cpp:478 +#: src/view.cpp:499 msgid "Select mode. (not applied yet)" msgstr "" -#: src/view.cpp:479 +#: src/view.cpp:500 msgid "Window" msgstr "" -#: src/view.cpp:479 +#: src/view.cpp:500 msgid "Fullscreen" msgstr "" -#: src/view.cpp:480 +#: src/view.cpp:501 msgid "Apply Theme&Mode" msgstr "" -#: src/view.cpp:481 +#: src/view.cpp:502 msgid "Apply the above settings." msgstr "" -#: src/view.cpp:483 +#: src/view.cpp:504 msgid "Animations" msgstr "" -#: src/view.cpp:485 +#: src/view.cpp:506 msgid "Smooth Drop" msgstr "" -#: src/view.cpp:486 +#: src/view.cpp:507 msgid "Drop piece block-by-block or smoothly. Does not affect drop speed." msgstr "" -#: src/view.cpp:488 +#: src/view.cpp:509 msgid "Frame Limit" msgstr "" -#: src/view.cpp:494 +#: src/view.cpp:515 msgid "Sound" msgstr "" -#: src/view.cpp:495 +#: src/view.cpp:516 msgid "Volume" msgstr "" -#: src/view.cpp:497 +#: src/view.cpp:518 msgid "Buffer Size" msgstr "" -#: src/view.cpp:498 +#: src/view.cpp:519 msgid "" "Reduce buffer size if you experience sound delays. Might have more CPU " "impact though. (not applied yet)" msgstr "" -#: src/view.cpp:500 +#: src/view.cpp:521 msgid "Channels" msgstr "" -#: src/view.cpp:501 +#: src/view.cpp:522 msgid "" "More channels gives more sound variety, less channels less (not applied yet)" msgstr "" -#: src/view.cpp:503 +#: src/view.cpp:524 msgid "Apply Size&Channels" msgstr "" -#: src/view.cpp:504 +#: src/view.cpp:525 msgid "Apply above settings" msgstr "" -#: src/view.cpp:514 +#: src/view.cpp:535 msgid "Quit" msgstr "" -#: src/view.cpp:853 +#: src/view.cpp:878 msgid "Hiscores" msgstr "" -#: src/vgame.cpp:485 +#: src/vgame.cpp:478 msgid "Next" msgstr "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/po/ltris2.pot new/ltris2-2.0.2/po/ltris2.pot --- old/ltris2-2.0.1/po/ltris2.pot 2024-09-03 17:51:55.000000000 +0200 +++ new/ltris2-2.0.2/po/ltris2.pot 2024-10-12 11:11:34.000000000 +0200 @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: ltris2 2.0.1\n" +"Project-Id-Version: ltris2 2.0.2\n" "Report-Msgid-Bugs-To: [email protected]\n" -"POT-Creation-Date: 2024-09-03 17:51+0200\n" +"POT-Creation-Date: 2024-10-12 11:11+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <[email protected]>\n" @@ -17,23 +17,23 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/menu.h:166 +#: src/menu.h:167 msgid "Back" msgstr "" -#: src/menu.h:282 +#: src/menu.h:283 msgid "Off" msgstr "" -#: src/menu.h:282 +#: src/menu.h:283 msgid "On" msgstr "" -#: src/menu.h:331 +#: src/menu.h:332 msgid "Enter Name" msgstr "" -#: src/view.cpp:46 src/view.cpp:367 +#: src/view.cpp:46 src/view.cpp:388 msgid "Normal" msgstr "" @@ -53,31 +53,31 @@ msgid "Vs 2xCPU" msgstr "" -#: src/view.cpp:74 src/vgame.cpp:221 +#: src/view.cpp:74 src/vgame.cpp:214 msgid "(Re)" msgstr "" -#: src/view.cpp:364 +#: src/view.cpp:385 msgid "50 FPS" msgstr "" -#: src/view.cpp:364 +#: src/view.cpp:385 msgid "60 FPS" msgstr "" -#: src/view.cpp:364 +#: src/view.cpp:385 msgid "200 FPS" msgstr "" -#: src/view.cpp:367 +#: src/view.cpp:388 msgid "Defensive" msgstr "" -#: src/view.cpp:367 +#: src/view.cpp:388 msgid "Aggressive" msgstr "" -#: src/view.cpp:370 +#: src/view.cpp:391 msgid "" "This is your starting level which will be ignored for mode 'Figures' (always " "starts at level 0).\n" @@ -86,7 +86,7 @@ "(the higher the starting level the more lines)." msgstr "" -#: src/view.cpp:374 +#: src/view.cpp:395 msgid "" "Normal: Starts with an empty bowl. Try to survive as long as possible.\n" "\n" @@ -96,7 +96,7 @@ "Vs Human/CPU/2xCPU: Play against another human or one or two CPU opponents." msgstr "" -#: src/view.cpp:377 +#: src/view.cpp:398 msgid "" "Modern: Enables all that stuff that makes tetris casual like ghost piece, " "wall-kicks, hold, DAS charge during ARE (allows to shift next piece faster), " @@ -106,79 +106,79 @@ "very interesting." msgstr "" -#: src/view.cpp:395 src/view.cpp:508 +#: src/view.cpp:416 src/view.cpp:529 msgid "New Game" msgstr "" -#: src/view.cpp:396 src/view.cpp:418 +#: src/view.cpp:417 src/view.cpp:439 msgid "Multiplayer Options" msgstr "" -#: src/view.cpp:397 src/view.cpp:510 +#: src/view.cpp:418 src/view.cpp:531 msgid "Controls" msgstr "" -#: src/view.cpp:398 src/view.cpp:407 src/view.cpp:443 +#: src/view.cpp:419 src/view.cpp:428 src/view.cpp:464 msgid "Player 1" msgstr "" -#: src/view.cpp:399 src/view.cpp:408 src/view.cpp:444 +#: src/view.cpp:420 src/view.cpp:429 src/view.cpp:465 msgid "Player 2" msgstr "" -#: src/view.cpp:400 src/view.cpp:512 +#: src/view.cpp:421 src/view.cpp:533 msgid "Audio" msgstr "" -#: src/view.cpp:401 src/view.cpp:511 +#: src/view.cpp:422 src/view.cpp:532 msgid "Graphics" msgstr "" -#: src/view.cpp:405 +#: src/view.cpp:426 msgid "Start Game" msgstr "" -#: src/view.cpp:411 +#: src/view.cpp:432 msgid "Game Mode" msgstr "" -#: src/view.cpp:413 +#: src/view.cpp:434 msgid "Game Style" msgstr "" -#: src/view.cpp:414 +#: src/view.cpp:435 msgid "Classic" msgstr "" -#: src/view.cpp:414 +#: src/view.cpp:435 msgid "Modern" msgstr "" -#: src/view.cpp:415 +#: src/view.cpp:436 msgid "Starting Level" msgstr "" -#: src/view.cpp:423 +#: src/view.cpp:444 msgid "Holes" msgstr "" -#: src/view.cpp:424 +#: src/view.cpp:445 msgid "Number of holes in sent lines." msgstr "" -#: src/view.cpp:426 +#: src/view.cpp:447 msgid "Random Holes" msgstr "" -#: src/view.cpp:427 +#: src/view.cpp:448 msgid "If multiple lines are sent, each line has different holes." msgstr "" -#: src/view.cpp:430 +#: src/view.cpp:451 msgid "CPU Style" msgstr "" -#: src/view.cpp:431 +#: src/view.cpp:452 msgid "" "Defensive: Clears any lines.\n" "Normal: Mostly goes for two lines.\n" @@ -188,31 +188,31 @@ "completing multiple lines at the expense of a balanced bowl contents." msgstr "" -#: src/view.cpp:433 +#: src/view.cpp:454 msgid "CPU Drop Delay" msgstr "" -#: src/view.cpp:436 +#: src/view.cpp:457 msgid "CPU Speed" msgstr "" -#: src/view.cpp:446 +#: src/view.cpp:467 msgid "Auto-Shift Delay" msgstr "" -#: src/view.cpp:447 +#: src/view.cpp:468 msgid "Initial delay before auto shift starts. Classic DAS has 270." msgstr "" -#: src/view.cpp:449 +#: src/view.cpp:470 msgid "Auto-Shift Speed" msgstr "" -#: src/view.cpp:450 +#: src/view.cpp:471 msgid "Delay between auto shift steps. Classic DAS has 100." msgstr "" -#: src/view.cpp:457 +#: src/view.cpp:478 msgid "" "Left/Right: horizontal movement\n" "Rotate Left/Right: piece rotation\n" @@ -221,126 +221,126 @@ "Hold: put current piece to hold (only for modern style)" msgstr "" -#: src/view.cpp:462 +#: src/view.cpp:483 msgid "Left" msgstr "" -#: src/view.cpp:463 +#: src/view.cpp:484 msgid "Right" msgstr "" -#: src/view.cpp:464 +#: src/view.cpp:485 msgid "Rotate Left" msgstr "" -#: src/view.cpp:465 +#: src/view.cpp:486 msgid "Rotate Right" msgstr "" -#: src/view.cpp:466 +#: src/view.cpp:487 msgid "Down" msgstr "" -#: src/view.cpp:467 +#: src/view.cpp:488 msgid "Drop" msgstr "" -#: src/view.cpp:468 src/vgame.cpp:488 +#: src/view.cpp:489 src/vgame.cpp:481 msgid "Hold" msgstr "" -#: src/view.cpp:474 +#: src/view.cpp:495 msgid "Theme" msgstr "" -#: src/view.cpp:475 +#: src/view.cpp:496 msgid "Select theme. (not applied yet)" msgstr "" -#: src/view.cpp:477 +#: src/view.cpp:498 msgid "Mode" msgstr "" -#: src/view.cpp:478 +#: src/view.cpp:499 msgid "Select mode. (not applied yet)" msgstr "" -#: src/view.cpp:479 +#: src/view.cpp:500 msgid "Window" msgstr "" -#: src/view.cpp:479 +#: src/view.cpp:500 msgid "Fullscreen" msgstr "" -#: src/view.cpp:480 +#: src/view.cpp:501 msgid "Apply Theme&Mode" msgstr "" -#: src/view.cpp:481 +#: src/view.cpp:502 msgid "Apply the above settings." msgstr "" -#: src/view.cpp:483 +#: src/view.cpp:504 msgid "Animations" msgstr "" -#: src/view.cpp:485 +#: src/view.cpp:506 msgid "Smooth Drop" msgstr "" -#: src/view.cpp:486 +#: src/view.cpp:507 msgid "Drop piece block-by-block or smoothly. Does not affect drop speed." msgstr "" -#: src/view.cpp:488 +#: src/view.cpp:509 msgid "Frame Limit" msgstr "" -#: src/view.cpp:494 +#: src/view.cpp:515 msgid "Sound" msgstr "" -#: src/view.cpp:495 +#: src/view.cpp:516 msgid "Volume" msgstr "" -#: src/view.cpp:497 +#: src/view.cpp:518 msgid "Buffer Size" msgstr "" -#: src/view.cpp:498 +#: src/view.cpp:519 msgid "" "Reduce buffer size if you experience sound delays. Might have more CPU " "impact though. (not applied yet)" msgstr "" -#: src/view.cpp:500 +#: src/view.cpp:521 msgid "Channels" msgstr "" -#: src/view.cpp:501 +#: src/view.cpp:522 msgid "" "More channels gives more sound variety, less channels less (not applied yet)" msgstr "" -#: src/view.cpp:503 +#: src/view.cpp:524 msgid "Apply Size&Channels" msgstr "" -#: src/view.cpp:504 +#: src/view.cpp:525 msgid "Apply above settings" msgstr "" -#: src/view.cpp:514 +#: src/view.cpp:535 msgid "Quit" msgstr "" -#: src/view.cpp:853 +#: src/view.cpp:878 msgid "Hiscores" msgstr "" -#: src/vgame.cpp:485 +#: src/vgame.cpp:478 msgid "Next" msgstr "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/menu.h new/ltris2-2.0.2/src/menu.h --- old/ltris2-2.0.1/src/menu.h 2024-09-03 16:39:13.000000000 +0200 +++ new/ltris2-2.0.2/src/menu.h 2024-10-07 19:40:05.000000000 +0200 @@ -29,7 +29,8 @@ AID_SOUND, AID_VOLUME, AID_APPLYAUDIO, - AID_APPLYTHEMEMODE + AID_APPLYTHEMEMODE, + AID_AUTOSHIFT }; class Menu; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/sdl.cpp new/ltris2-2.0.2/src/sdl.cpp --- old/ltris2-2.0.1/src/sdl.cpp 2024-09-01 17:56:58.000000000 +0200 +++ new/ltris2-2.0.2/src/sdl.cpp 2024-10-05 18:43:11.000000000 +0200 @@ -534,3 +534,39 @@ return state; } + +/** Update key states and return state array. + * (0=released,1=permanently pressed,2=down,3=up) + * FIXME? Theoretically, if a cycle takes too long and during a key + * press a key up/down occurs (or during key release a key down/up) + * it is not registered which although at high frame rates it should + * be impossible to hit keys that fast? */ +const Uint8 *Keystate::update() +{ + int numkeys; + const Uint8 *ks; + + SDL_PumpEvents(); + ks = SDL_GetKeyboardState(&numkeys); + + if (numkeys > SDL_NUM_SCANCODES) + numkeys = SDL_NUM_SCANCODES; /* should not happen, for safety */ + + memcpy(oldstate,curstate,sizeof(curstate)); + memset(curstate,KS_RELEASED,sizeof(curstate)); + + for (int id = 0; id < numkeys; id++) { + if (ks[id]) { + if (oldstate[id]==KS_DOWN || oldstate[id]==KS_PRESSED) + curstate[id] = KS_PRESSED; + else + curstate[id] = KS_DOWN; + + } else { + if (oldstate[id]==KS_DOWN || oldstate[id]==KS_PRESSED) + curstate[id] = KS_UP; + } + } + + return curstate; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/sdl.h new/ltris2-2.0.2/src/sdl.h --- old/ltris2-2.0.1/src/sdl.h 2024-09-01 17:56:58.000000000 +0200 +++ new/ltris2-2.0.2/src/sdl.h 2024-10-05 19:48:10.000000000 +0200 @@ -357,4 +357,37 @@ const Uint8 *update(); }; +/** Similiar to gamepad we need an object properly keystates. + * Using SDL_KEYDOWN for (first) DOWN event doesn't work as + * it gets auto repeated... */ +enum { + KS_RELEASED = 0, /* not pressed */ + KS_PRESSED, /* continously pressed */ + KS_DOWN, /* freshly pressed in this cycle */ + KS_UP /* just released in this cycle */ + +}; +class Keystate { + Uint8 oldstate[SDL_NUM_SCANCODES]; + Uint8 curstate[SDL_NUM_SCANCODES]; +public: + Keystate() { + reset(); + } + void reset() { + memset(oldstate,KS_RELEASED,sizeof(oldstate)); + memset(curstate,KS_RELEASED,sizeof(curstate)); + } + const Uint8 *update(); + void forceKeyDown(int scancode) { + if (scancode < 0 || scancode >= SDL_NUM_SCANCODES) + return; + if (curstate[scancode] == KS_RELEASED || curstate[scancode] == KS_UP) { + oldstate[scancode] = KS_RELEASED; + curstate[scancode] = KS_DOWN; + _loginfo("Oops, need to force key down: %d\n",scancode); + } + } +}; + #endif /* SDL_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/theme.cpp new/ltris2-2.0.2/src/theme.cpp --- old/ltris2-2.0.1/src/theme.cpp 2024-09-01 17:56:58.000000000 +0200 +++ new/ltris2-2.0.2/src/theme.cpp 2024-10-05 19:35:48.000000000 +0200 @@ -61,6 +61,12 @@ sMenuClick.load(testRc(path,"s_menuclick.wav")); sMenuMotion.load(testRc(path,"s_menumotion.wav")); + /* cursor - scale to 0.036 of screen height */ + cursor.load(testRc(path,"cursor.png")); + uint ch = r.ry2sy(0.036); + uint cw = cursor.getWidth() * ch / cursor.getHeight(); + cursor.scale(cw,ch); + /* wallpapers */ numWallpapers = 0; string wfname = path + "/wallpaper0.jpg"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/theme.h new/ltris2-2.0.2/src/theme.h --- old/ltris2-2.0.1/src/theme.h 2024-09-03 17:06:35.000000000 +0200 +++ new/ltris2-2.0.2/src/theme.h 2024-10-05 19:37:35.000000000 +0200 @@ -42,6 +42,7 @@ Sound sMenuClick, sMenuMotion; SDL_Color fontColorNormal; SDL_Color fontColorHighlight; + Texture cursor; Texture wallpapers[MAXWALLPAPERS]; uint numWallpapers; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/themes/Standard/Makefile.am new/ltris2-2.0.2/src/themes/Standard/Makefile.am --- old/ltris2-2.0.1/src/themes/Standard/Makefile.am 2024-09-01 17:56:58.000000000 +0200 +++ new/ltris2-2.0.2/src/themes/Standard/Makefile.am 2024-10-05 19:36:52.000000000 +0200 @@ -1,6 +1,6 @@ EXTRA_DIST = CREDITS SIL-OFL.txt theme.ini \ f_normal.otf f_bold.otf \ - menu.png blocks.png \ + menu.png cursor.png blocks.png \ s_menuclick.wav s_menumotion.wav \ s_explosion.wav s_insert.wav s_nextlevel.wav s_shift.wav s_tetris.wav \ wallpaper0.jpg wallpaper1.jpg wallpaper2.jpg wallpaper3.jpg \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/themes/Standard/Makefile.in new/ltris2-2.0.2/src/themes/Standard/Makefile.in --- old/ltris2-2.0.1/src/themes/Standard/Makefile.in 2024-09-03 17:51:53.000000000 +0200 +++ new/ltris2-2.0.2/src/themes/Standard/Makefile.in 2024-10-12 11:11:32.000000000 +0200 @@ -252,7 +252,7 @@ top_srcdir = @top_srcdir@ EXTRA_DIST = CREDITS SIL-OFL.txt theme.ini \ f_normal.otf f_bold.otf \ - menu.png blocks.png \ + menu.png cursor.png blocks.png \ s_menuclick.wav s_menumotion.wav \ s_explosion.wav s_insert.wav s_nextlevel.wav s_shift.wav s_tetris.wav \ wallpaper0.jpg wallpaper1.jpg wallpaper2.jpg wallpaper3.jpg \ Binary files old/ltris2-2.0.1/src/themes/Standard/cursor.png and new/ltris2-2.0.2/src/themes/Standard/cursor.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/vconfig.cpp new/ltris2-2.0.2/src/vconfig.cpp --- old/ltris2-2.0.1/src/vconfig.cpp 2024-09-03 09:53:14.000000000 +0200 +++ new/ltris2-2.0.2/src/vconfig.cpp 2024-10-05 19:01:55.000000000 +0200 @@ -67,7 +67,8 @@ /* controls */ as_delay = 170; - as_speed = 50; + as_speed = 70; + keystatefix = 0; /* sounds */ sound = 1; @@ -130,8 +131,13 @@ fp.get("cpu_delay",cpu_delay); fp.get("cpu_sfactor",cpu_sfactor); + /* fix non 10% setting for cpu_sfactor since we changed the step */ + if ((cpu_sfactor % 10) != 0) + cpu_sfactor = 100; + fp.get("as_delay",as_delay); fp.get("as_speed",as_speed); + fp.get("keystatefix",keystatefix); fp.get("sound", sound); fp.get("volume", volume); @@ -190,6 +196,7 @@ ofs << "as_delay=" << as_delay << "\n"; ofs << "as_speed=" << as_speed << "\n"; + ofs << "keystatefix=" << keystatefix << "\n"; ofs << "sound=" << sound << "\n"; ofs << "volume=" << volume << "\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/vconfig.h new/ltris2-2.0.2/src/vconfig.h --- old/ltris2-2.0.1/src/vconfig.h 2024-09-01 17:56:58.000000000 +0200 +++ new/ltris2-2.0.2/src/vconfig.h 2024-10-05 19:01:23.000000000 +0200 @@ -74,6 +74,7 @@ /* controls */ int as_delay; int as_speed; + int keystatefix; /* sound */ int sound; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/vgame.cpp new/ltris2-2.0.2/src/vgame.cpp --- old/ltris2-2.0.1/src/vgame.cpp 2024-09-03 08:37:58.000000000 +0200 +++ new/ltris2-2.0.2/src/vgame.cpp 2024-10-07 20:00:56.000000000 +0200 @@ -30,60 +30,53 @@ extern Block_Mask block_masks[BLOCK_COUNT]; /** Translate current event/input states into bowl controls for human player. */ -void VGame::setBowlControls(uint bid, BowlControls &bc, SDL_Event &ev, +void VGame::setBowlControls(uint bid, BowlControls &bc, const Uint8 *keystate, const Uint8 *gpstate, PControls &pctrl) { - /* get key state */ - const Uint8 *keystate = SDL_GetKeyboardState(NULL); - /* clear input state */ memset(&bc,0,sizeof(bc)); - if (keystate[pctrl.lshift]) + if (keystate[pctrl.sdrop] == KS_PRESSED || keystate[pctrl.sdrop] == KS_DOWN) + bc.sdrop = CS_PRESSED; + if (keystate[pctrl.lshift] == KS_PRESSED) bc.lshift = CS_PRESSED; - if (keystate[pctrl.rshift]) + else if (keystate[pctrl.lshift] == KS_DOWN) + bc.lshift = CS_DOWN; + if (keystate[pctrl.rshift] == KS_PRESSED) bc.rshift = CS_PRESSED; - if (keystate[pctrl.sdrop]) - bc.sdrop = CS_PRESSED; + else if (keystate[pctrl.rshift] == KS_DOWN) + bc.rshift = CS_DOWN; - if (ev.type == SDL_KEYDOWN) { - if (ev.key.keysym.scancode == pctrl.lshift) - bc.lshift = CS_DOWN; - if (ev.key.keysym.scancode == pctrl.rshift) - bc.rshift = CS_DOWN; - if (ev.key.keysym.scancode == pctrl.lrot) - bc.lrot = CS_DOWN; - if (ev.key.keysym.scancode == pctrl.rrot) - bc.rrot = CS_DOWN; - if (ev.key.keysym.scancode == pctrl.hdrop) - bc.hdrop = CS_DOWN; - if (ev.key.keysym.scancode == pctrl.hold) - bc.hold = CS_DOWN; - } + if (keystate[pctrl.lrot] == KS_DOWN) + bc.lrot = CS_DOWN; + if (keystate[pctrl.rrot] == KS_DOWN) + bc.rrot = CS_DOWN; + if (keystate[pctrl.hdrop] == KS_DOWN) + bc.hdrop = CS_DOWN; + if (keystate[pctrl.hold] == KS_DOWN) + bc.hold = CS_DOWN; /* allow gamepad for bowl 0 */ if (bid == 0 && vconfig.gp_enabled) { - if (gpstate[GPAD_DOWN] == CS_PRESSED || gpstate[GPAD_DOWN] == CS_DOWN) + if (gpstate[GPAD_DOWN] == GPBS_PRESSED || gpstate[GPAD_DOWN] == GPBS_DOWN) bc.sdrop = CS_PRESSED; - else if (gpstate[GPAD_LEFT] == CS_PRESSED) + else if (gpstate[GPAD_LEFT] == GPBS_PRESSED) bc.lshift = CS_PRESSED; - else if (gpstate[GPAD_LEFT] == CS_DOWN) + else if (gpstate[GPAD_LEFT] == GPBS_DOWN) bc.lshift = CS_DOWN; - else if (gpstate[GPAD_RIGHT] == CS_PRESSED) + else if (gpstate[GPAD_RIGHT] == GPBS_PRESSED) bc.rshift = CS_PRESSED; - else if (gpstate[GPAD_RIGHT] == CS_DOWN) + else if (gpstate[GPAD_RIGHT] == GPBS_DOWN) bc.rshift = CS_DOWN; - if (ev.type == SDL_JOYBUTTONDOWN) { - if (ev.jbutton.button == vconfig.gp_lrot) - bc.lrot = CS_DOWN; - if (ev.jbutton.button == vconfig.gp_rrot) - bc.rrot = CS_DOWN; - if (ev.jbutton.button == vconfig.gp_hdrop) - bc.hdrop = CS_DOWN; - if (ev.jbutton.button == vconfig.gp_hold) - bc.hold = CS_DOWN; - } + if (gpstate[GPAD_BUTTON0 + vconfig.gp_lrot] == GPBS_DOWN) + bc.lrot = CS_DOWN; + if (gpstate[GPAD_BUTTON0 + vconfig.gp_rrot] == GPBS_DOWN) + bc.rrot = CS_DOWN; + if (gpstate[GPAD_BUTTON0 + vconfig.gp_hdrop] == GPBS_DOWN) + bc.hdrop = CS_DOWN; + if (gpstate[GPAD_BUTTON0 + vconfig.gp_hold] == GPBS_DOWN) + bc.hold = CS_DOWN; } } @@ -368,7 +361,7 @@ /** Update bowls according to passed time @ms in milliseconds and input. * Return 1 if state switches to game over, 0 otherwise. */ -bool VGame::update(uint ms, SDL_Event &ev, const Uint8 *gpstate) { +bool VGame::update(uint ms, const Uint8 *keystate, const Uint8 *gpstate) { BowlControls bc; int oldlev; @@ -382,7 +375,7 @@ if (vbowls[i].bowl->cpu_player) setBowlControlsCPU(bc,vbowls[i]); else - setBowlControls(i, bc, ev, gpstate, vconfig.controls[i]); + setBowlControls(i, bc, keystate, gpstate, vconfig.controls[i]); vbowls[i].update(ms,bc); } @@ -489,3 +482,16 @@ renderer.clearTarget(); } } + +/** Set autoshift settings for all active bowls. */ +void VGame::setAutoShift(int delay, int speed) +{ + /* technically setting config is not needed as only used + * in tetris_init. bowls itself use das_maxcharge and das_drop. */ + config.as_delay = delay; + config.as_speed = speed; + + for (auto &vb : vbowls) + if (vb.initialized()) + bowl_set_autoshift(vb.bowl, delay, speed); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/vgame.h new/ltris2-2.0.2/src/vgame.h --- old/ltris2-2.0.1/src/vgame.h 2024-09-01 17:56:58.000000000 +0200 +++ new/ltris2-2.0.2/src/vgame.h 2024-10-07 19:56:58.000000000 +0200 @@ -35,17 +35,18 @@ SDL_Rect rHiscores; /* screen region for hiscore chart */ int frPadding, frBorder; /* padding and border for all frames */ - void setBowlControls(uint bid, BowlControls &bc, SDL_Event &ev, + void setBowlControls(uint bid, BowlControls &bc, const Uint8 *keystate, const Uint8 *gpstate, PControls &pctrl); void setBowlControlsCPU(BowlControls &bc, VBowl &bowl); void addFrame(SDL_Rect inner, int padding = 0, int border = 0); void renderBackground(uint wid); + void setAutoShift(int delay, int speed); public: VGame(); ~VGame(); void init(int _type); void render(); - bool update(uint ms, SDL_Event &ev, const Uint8 *gpstate); + bool update(uint ms, const Uint8 *keystate, const Uint8 *gpstate); void pause(bool p=true); bool isDemo(); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/view.cpp new/ltris2-2.0.2/src/view.cpp --- old/ltris2-2.0.1/src/view.cpp 2024-09-03 16:42:26.000000000 +0200 +++ new/ltris2-2.0.2/src/view.cpp 2024-10-07 19:59:00.000000000 +0200 @@ -124,12 +124,15 @@ state = VS_IDLE; sprites.clear(); changingKey = false; + keystate.reset(); fpsStart = SDL_GetTicks(); fpsCycles = 0; render(); + SDL_ShowCursor(0); + while (!quitReceived) { renderTicks.reset(); @@ -174,6 +177,18 @@ /* get passed time */ ms = ticks.get(); + /* update key state */ + const Uint8 *ks = keystate.update(); + if (vconfig.keystatefix && !menuActive && newEvent + && ev.type == SDL_KEYDOWN) { + /* in low frame rates we might lose key downs from + * cycle to cycle (see comment for Keystate::update()) + * so as a workaround we force a keydown for keys + * not currently pressed in keystate so at least + * key down events should never get lost... */ + keystate.forceKeyDown(ev.key.keysym.scancode); + } + /* update gamepad state */ const Uint8 *gpadstate = gamepad.update(); @@ -202,7 +217,7 @@ curMenu->update(ms); /* update game */ - if (game.update(ms,ev,gpadstate)) { + if (game.update(ms,ks,gpadstate)) { /* game over, save hiscores, only for single player */ if (game.type == GT_NORMAL || game.type == GT_FIGURES) { HiscoreChart *hc = hiscores.get(gameTypeNames[game.type]); @@ -269,6 +284,8 @@ SDL_FlushEvent(SDL_MOUSEMOTION); /* prevent event loop from dying */ } + SDL_ShowCursor(1); + if (!quitReceived) dim(); } @@ -296,6 +313,10 @@ lblCredits2.copy(renderer.getWidth()-2,renderer.getHeight() - theme.fTooltip.getLineHeight(), ALIGN_X_RIGHT | ALIGN_Y_BOTTOM); curMenu->render(); + + int cx, cy; + SDL_GetMouseState(&cx, &cy); + theme.cursor.copy(cx,cy); } /* stats */ @@ -435,7 +456,7 @@ AID_NONE,vconfig.cpu_delay,0,2000,100)); mMultiplayer->add(new MenuItemRange(_("CPU Speed"), "Multiplier in percent for dropping speed of pieces, e.g.,\n50% = half the regular speed\n100% = regular speed\n200% = doubled speed\nCan range between 50% and 400%.", - AID_NONE,vconfig.cpu_sfactor,50,400,25)); + AID_NONE,vconfig.cpu_sfactor,50,300,10)); mMultiplayer->add(new MenuItemSep()); mMultiplayer->add(new MenuItemBack(mNewGame)); @@ -445,10 +466,10 @@ mControls->add(new MenuItemSep()); mControls->add(new MenuItemRange(_("Auto-Shift Delay"), _("Initial delay before auto shift starts. Classic DAS has 270."), - AID_NONE,vconfig.as_delay,20,300,10)); + AID_AUTOSHIFT,vconfig.as_delay,20,300,10)); mControls->add(new MenuItemRange(_("Auto-Shift Speed"), _("Delay between auto shift steps. Classic DAS has 100."), - AID_NONE,vconfig.as_speed,20,200,10)); + AID_AUTOSHIFT,vconfig.as_speed,20,200,10)); mControls->add(new MenuItemSep()); mControls->add(new MenuItemBack(rootMenu.get())); @@ -713,6 +734,10 @@ menuActive = false; waitForInputRelease(); game.init(vconfig.gametype); + keystate.reset(); + break; + case AID_AUTOSHIFT: + game.setAutoShift(vconfig.as_delay, vconfig.as_speed); break; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ltris2-2.0.1/src/view.h new/ltris2-2.0.2/src/view.h --- old/ltris2-2.0.1/src/view.h 2024-09-01 17:56:58.000000000 +0200 +++ new/ltris2-2.0.2/src/view.h 2024-09-21 11:09:54.000000000 +0200 @@ -29,6 +29,7 @@ /* general */ Mixer mixer; Gamepad gamepad; + Keystate keystate; /* menu */ bool menuActive;
