Make gnuski into gnuskii. - gnuskii - GNUSki improved for ascii skiing experience.
 (HTM) git clone git://bitreich.org/gnuskii git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gnuskii
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit c8f10d133d57af101e0beece67f9c5902ce0ca1a
 (DIR) parent 11cc620aa0c6b69f1540219053d5078bdc8a8990
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Wed, 19 Nov 2025 18:39:58 +0100
       
       Make gnuski into gnuskii.
       
       * Apply bitreich changes.
       * Add info for control.
       * Add bigfoot, snowman and jump feature.
       
       Diffstat:
         M src/Makefile                        |       2 +-
         M src/main.c                          |      35 +++++++++++++++++++++++++-------
         M src/objects.c                       |      55 ++++++++++++++++++++++++++++---
         M src/objects.h                       |       3 ++-
         M src/readme                          |       2 +-
       
       5 files changed, 82 insertions(+), 15 deletions(-)
       ---
 (DIR) diff --git a/src/Makefile b/src/Makefile
       @@ -1,6 +1,6 @@
        CC=gcc
        FLAGS=-O2 -o gnuski
       -LIBS=-lncurses
       +LIBS=-lncurses -ltinfo
        FILES=main.c objects.c
        
        all:
 (DIR) diff --git a/src/main.c b/src/main.c
       @@ -25,7 +25,7 @@
        #include <unistd.h>
        #include <ncurses.h>
        
       -#define MAX_OBJECTS 300
       +#define MAX_OBJECTS 128
        
        int main (int argc, char* argv[])
        {
       @@ -47,13 +47,26 @@ int main (int argc, char* argv[])
        
          /* Create objects */
          player = makeObject (skier, maxCols/2, maxRows/2);
       -  for (i = 0; i < MAX_OBJECTS; i++)
       +  for (i = 0; i < MAX_OBJECTS; i++) {
            objects[i] = makeObject (rand () % 3+1,
                                     rand () % maxCols,
                                     rand () % (maxRows*4 + maxRows/2));
       +  }
       +
       +  objects[rand() % MAX_OBJECTS] = makeObject (bigfoot,
       +                             rand () % maxCols,
       +                             rand () % (maxRows*4 + maxRows/2));
       +  objects[rand() % MAX_OBJECTS] = makeObject (snowman,
       +                             rand () % maxCols,
       +                             rand () % (maxRows*4 + maxRows/2));
        
          /* Menu will go here */
          printw ("GNUSki 0.3 - Skifree clone using NCurses, licensed under the GNU GPL.\n");
       +  printw ("left, h, h - lean left\n");
       +  printw ("right, L, l - lean right\n");
       +  printw ("up, K, k - slow down\n");
       +  printw ("down, J, j - speed up\n");
       +  printw ("space - go into trick mode (beware, you can't move)\n");
          printw ("Press any key to start...");
          refresh ();
          getch ();
       @@ -63,25 +76,28 @@ int main (int argc, char* argv[])
              switch (c)
                {
                case KEY_LEFT: case 'h': case 'H':
       +          if (player.trick) break;
                  facing[0] = '4';
                  facing[1] = '2';
                  break;
       -
                case KEY_RIGHT: case 'l': case 'L':
       +          if (player.trick) break;
                  facing[0] = '3';
                  facing[1] = '1';
                  break;
       -
                case KEY_UP: case 'k': case 'K':
       +          if (player.trick) break;
                  if (speed > 0)
                    speed--;
                  break;
       -
                case KEY_DOWN: case 'j': case 'J':
       +          if (player.trick) break;
                  if (speed < 4)
                    speed++;
                  break;
       -
       +        case ' ':
       +          player.trick++;
       +          break;
                case 'Q': case 'q':
                  state = lose;
                  break;
       @@ -111,10 +127,15 @@ int main (int argc, char* argv[])
                        draw (objects[i], facing[1]);
                    }
                  draw (player, facing[0]);
       +          if (player.trick) {
       +            style += 1;
       +            player.trick -= 0.10;
       +            if (player.trick < 0) player.trick = 0;
       +          }
                  printw ("Time:   0:00:00.00\n");
                  printw ("Dist:     %02im\n", distance);
                  printw ("Speed:    %02im/s\n", speed);
       -          printw ("Style:    %4i", style);
       +          printw ("Style:    %4i (trick = %.2f%%)", style, player.trick*100);
                  distance += speed;
                  frame_counter++;
              refresh ();
 (DIR) diff --git a/src/objects.c b/src/objects.c
       @@ -30,8 +30,14 @@ setupColors ()
              exit (1);
            }
          start_color ();
       +  /* tree */
          init_pair (1, COLOR_GREEN, COLOR_BLACK);
       +  /* rock */
          init_pair (2, COLOR_WHITE, COLOR_BLACK);
       +  /* bigfoot */
       +  init_pair (3, COLOR_BLUE, COLOR_BLACK);
       +  /* snowman */
       +  init_pair (4, COLOR_CYAN, COLOR_BLACK);
        }
        
        struct Object
       @@ -41,6 +47,7 @@ makeObject (enum objectType type, int x, int y)
          o.type = type;
          o.x = x;
          o.y = y;
       +  o.trick = 0;
          return o;
        }
        
       @@ -78,25 +85,40 @@ draw (struct Object o, char facing)
                case 'n':
                case 's':
                  move (o.y, o.x);
       -          printw ("||");
       +          if (o.trick)
       +            printw ("@@");
       +          else
       +            printw ("||");
                  break;
                case 'w':
                  move (o.y, o.x);
       -          printw ("==");
       +          if (o.trick)
       +            printw ("@@");
       +          else
       +            printw ("==");
                  break;
                case 'e':
                  move (o.y, o.x+1);
       -          printw ("==");
       +          if (o.trick)
       +            printw ("@@");
       +          else
       +            printw ("==");
                  break;
                case '1':
                case '3':
                  move (o.y, o.x);
       -          printw ("\\\\");
       +          if (o.trick)
       +            printw ("@@");
       +          else
       +            printw ("\\\\");
                  break;
                case '2':
                case '4':
                  move (o.y, o.x);
       -          printw ("//");
       +          if (o.trick)
       +            printw ("@@");
       +          else
       +            printw ("//");
                  break;
                }
              break;
       @@ -119,6 +141,27 @@ draw (struct Object o, char facing)
            case hill:
              move (o.y, o.x);
              printw ("/^\\");
       +      break;
       +    case bigfoot:
       +      attron (COLOR_PAIR(3));
       +      move (o.y, o.x);
       +      printw (" O ");
       +      move (o.y+1, o.x);
       +      printw ("\\|/");
       +      move (o.y+2, o.x);
       +      printw ("/ \\");
       +      attroff (COLOR_PAIR(3));
       +      break;
       +    case snowman:
       +      attron (COLOR_PAIR(4));
       +      move (o.y, o.x);
       +      printw (" o ");
       +      move (o.y+1, o.x);
       +      printw ("\\O/");
       +      move (o.y+2, o.x);
       +      printw (" O ");
       +      attroff (COLOR_PAIR(4));
       +      break;
            case none: default:
              break;
            }
       @@ -131,6 +174,8 @@ collision (struct Object player, struct Object target)
          switch (target.type)
            {
            case tree:
       +    case bigfoot:
       +    case snowman:
              return player.y == target.y+2 && player.x == target.x+1;
              break;
            case rock:
 (DIR) diff --git a/src/objects.h b/src/objects.h
       @@ -25,12 +25,13 @@
        #include <stdlib.h>
        #include <ncurses.h>
        
       -enum objectType { none, tree, rock, hill, skier, bigfoot };
       +enum objectType { none, tree, rock, hill, skier, bigfoot, snowman };
        
        struct Object
        {
          enum objectType type;
          int x, y;
       +  float trick;
        };
        
        struct Object makeObject (enum objectType type, int x, int y);
 (DIR) diff --git a/src/readme b/src/readme
       @@ -15,7 +15,7 @@ Left, H, h  - lean to the left
        Right, L, l - lean to the right
        Up, K, k    - slow down
        Down, J, j  - speed up
       -Space       - trick (not available just yet)
       +Space       - trick
        
        == For Programmers ==