more gameplay improvements. level-editor is getting closer to a useable state . etc.
authorTobias Gläßer <tobi.web@gmx.de>
Sun, 29 Feb 2004 20:44:57 +0000 (20:44 +0000)
committerTobias Gläßer <tobi.web@gmx.de>
Sun, 29 Feb 2004 20:44:57 +0000 (20:44 +0000)
SVN-Revision: 158

12 files changed:
src/badguy.c
src/button.c
src/gameloop.c
src/globals.c
src/globals.h
src/leveleditor.c
src/menu.c
src/menu.h
src/player.c
src/player.h
src/scene.c
src/setup.c

index 80c5f9c..27530cd 100644 (file)
@@ -314,16 +314,15 @@ void badguy_action(bad_guy_type* pbad)
 
   /* Handle mode timer: */
 
-  if (pbad->mode == FLAT /* && bad_guys[1].mode != HELD*/)
+  if (pbad->mode == FLAT && pbad->mode != HELD)
     {
       if(!timer_check(&pbad->timer))
         pbad->mode = NORMAL;
     }
-  /* else if (pbad->mode == KICK)
-     {
-       if (pbad->timer > 0)
-         pbad->timer--;
-     }*/
+  else if (pbad->mode == KICK)
+    {
+      timer_check(&pbad->timer);
+    }
 
 
   /* Handle dying timer: */
@@ -576,7 +575,8 @@ void badguy_collision(bad_guy_type* pbad, void *p_c_object, int c_object)
         {
           pbad->dying = SQUISHED;
           timer_start(&pbad->timer,4000);
-          pplayer_c->base.ym = -KILL_BOUNCE_YM;
+          physic_set_state(&pplayer_c->vphysic,PH_VT);
+          physic_set_start_vy(&pplayer_c->vphysic,2.);
 
           add_score(pbad->base.x - scroll_x, pbad->base.y,
                     50 * score_multiplier);
@@ -595,7 +595,8 @@ void badguy_collision(bad_guy_type* pbad, void *p_c_object, int c_object)
 
               timer_start(&pbad->timer,10000);
 
-              pplayer_c->base.y = pplayer_c->base.y - 32;
+              physic_set_state(&pplayer_c->vphysic,PH_VT);
+              physic_set_start_vy(&pplayer_c->vphysic,2.);
             }
           else
             {
@@ -609,10 +610,13 @@ void badguy_collision(bad_guy_type* pbad, void *p_c_object, int c_object)
               else
                 pbad->dir = LEFT;
 
+              pbad->base.xm = 8;
+
               timer_start(&pbad->timer,5000);
             }
 
-          pplayer_c->base.ym = -KILL_BOUNCE_YM;
+          physic_set_state(&pplayer_c->vphysic,PH_VT);
+          physic_set_start_vy(&pplayer_c->vphysic,2.);
 
           add_score(pbad->base.x - scroll_x,
                     pbad->base.y,
index b52ed4c..fcd96ce 100644 (file)
@@ -73,6 +73,8 @@ void button_draw(button_type* pbutton)
       sprintf(str,"(%s)", SDL_GetKeyName(pbutton->shortcut));
       text_draw(&white_small_text, str, pbutton->x - strlen(str) * white_small_text.w, pbutton->y + white_small_text.h+2, 1, NO_UPDATE);
     }
+  if(pbutton->state == BN_PRESSED)
+    fillrect(pbutton->x,pbutton->y,pbutton->w,pbutton->h,75,75,75,200);
 }
 
 void button_free(button_type* pbutton)
@@ -89,8 +91,17 @@ void button_event(button_type* pbutton, SDL_Event *event)
       if(key == pbutton->shortcut)
         pbutton->state = BN_CLICKED;
     }
-  else if(event->motion.x > pbutton->x && event->motion.x < pbutton->x + pbutton->w &&
-          event->motion.y > pbutton->y && event->motion.y < pbutton->y + pbutton->h)
+  else if(event->type == SDL_MOUSEMOTION)
+    {
+
+      if(pbutton->show_info)
+        {
+          pbutton->show_info = NO;
+        }
+    }
+
+  if(event->motion.x > pbutton->x && event->motion.x < pbutton->x + pbutton->w &&
+      event->motion.y > pbutton->y && event->motion.y < pbutton->y + pbutton->h)
     {
       if(event->type == SDL_MOUSEBUTTONDOWN)
         {
@@ -115,9 +126,9 @@ void button_event(button_type* pbutton, SDL_Event *event)
             }
         }
     }
-  else if(event->type == SDL_MOUSEMOTION)
+  else
     {
-
+      pbutton->state = -1;
       if(pbutton->show_info)
         {
           pbutton->show_info = NO;
@@ -170,22 +181,22 @@ void button_panel_draw(button_panel_type* pbutton_panel)
 
 void button_panel_additem(button_panel_type* pbutton_panel, button_type* pbutton)
 {
-int max_cols, row, col;
+  int max_cols, row, col;
 
   ++pbutton_panel->num_items;
   pbutton_panel->item = (button_type*) realloc(pbutton_panel->item, sizeof(button_type) * pbutton_panel->num_items);
   memcpy(&pbutton_panel->item[pbutton_panel->num_items-1],pbutton,sizeof(button_type));
   free(pbutton);
-  
+
   /* A button_panel takes control of the buttons it contains and arranges them */
-  
+
   max_cols = pbutton_panel->w / 32;
-  
+
   row = pbutton_panel->num_items / max_cols;
   col = pbutton_panel->num_items % max_cols;
-  
+
   pbutton_panel->item[pbutton_panel->num_items-1].x = pbutton_panel->x + col * 32;
   pbutton_panel->item[pbutton_panel->num_items-1].y = pbutton_panel->y + row * 32;
-  
+
 }
 
index 8593b13..5c6f4c9 100644 (file)
@@ -629,9 +629,7 @@ int gameloop(char * subset, int levelnb, int mode)
       /* Handle events: */
 
       tux.input.old_fire = tux.input.fire;
-
-      /*printf("%lf\n",frame_ratio);*/
-
+      
       game_event();
 
       if(show_menu)
index ab059fb..d49c899 100644 (file)
@@ -13,7 +13,7 @@
 #include "globals.h"
 
 SDL_Surface * screen;
-text_type black_text, gold_text, blue_text, red_text, yellow_nums, white_text, white_small_text;
+text_type black_text, gold_text, blue_text, red_text, yellow_nums, white_text, white_small_text, white_big_text;
 
 int use_gl, use_joystick, use_fullscreen, debug_mode, show_fps;
 
index 9d9fc1c..09f892d 100644 (file)
@@ -19,7 +19,7 @@
 #include "menu.h"
 
 extern SDL_Surface * screen;
-extern text_type black_text, gold_text, white_text, white_small_text, blue_text, red_text, yellow_nums;
+extern text_type black_text, gold_text, white_text, white_small_text, white_big_text, blue_text, red_text, yellow_nums;
 
 extern int use_gl, use_joystick, use_fullscreen, debug_mode, show_fps;
 
index 68c3b33..2ed158d 100644 (file)
@@ -72,6 +72,7 @@ void le_set_defaults(void);
 void le_activate_bad_guys(void);
 
 void le_highlight_selection();
+void apply_level_settings_menu();
 
 /* leveleditor internals */
 static char **level_subsets;
@@ -90,6 +91,8 @@ static int le_mouse_pressed;
 static button_type le_test_level_bt;
 static button_type le_next_level_bt;
 static button_type le_previous_level_bt;
+static button_type le_move_right_bt;
+static button_type le_move_left_bt;
 static button_type le_rubber_bt;
 static button_type le_select_mode_one_bt;
 static button_type le_select_mode_two_bt;
@@ -206,8 +209,8 @@ int leveleditor(int levelnb)
                   break;
                 case 4:
                   break;
-                case 11:
-                  strcpy(le_current_level->name,level_settings_menu.item[1].input);
+                case 13:
+                  apply_level_settings_menu();
                   break;
                 }
             }
@@ -225,7 +228,7 @@ int leveleditor(int levelnb)
                       le_level = 1;
                       arrays_init();
                       loadshared();
-                     le_current_level = (st_level*) malloc(sizeof(st_level));
+                      le_current_level = (st_level*) malloc(sizeof(st_level));
                       if(level_load(le_current_level, le_level_subset.name, le_level) != 0)
                         {
                           le_quit();
@@ -239,6 +242,39 @@ int leveleditor(int levelnb)
                   break;
                 }
             }
+          else if(current_menu == &subset_new_menu)
+            {
+              if(subset_new_menu.item[2].input[0] == '\0')
+                subset_new_menu.item[3].kind = MN_DEACTIVE;
+              else
+                subset_new_menu.item[3].kind = MN_ACTION;
+
+              /*switch (i = menu_check(&subset_load_menu))
+                {
+                case 0:
+                  break;
+                default:
+                  if(i != -1)
+                    {
+                      subset_load(&le_level_subset,level_subsets[i-2]);
+                      leveleditor_menu.item[3].kind = MN_GOTO;
+                      le_level = 1;
+                      arrays_init();
+                      loadshared();
+              le_current_level = (st_level*) malloc(sizeof(st_level));
+                      if(level_load(le_current_level, le_level_subset.name, le_level) != 0)
+                        {
+                          le_quit();
+                          return 1;
+                        }
+                      le_set_defaults();
+                      level_load_gfx(le_current_level);
+                      le_activate_bad_guys();
+                      show_menu = YES;
+                    }
+                  break;
+                }*/
+            }
         }
 
       if(done)
@@ -272,13 +308,13 @@ int le_init()
   level_subsets = dsubdirs("/levels", "info", &subsets_num);
 
   le_show_grid = YES;
-  
+
   /*  level_changed = NO;*/
   fire = DOWN;
   done = 0;
   le_frame = 0;        /* support for frames in some tiles, like waves and bad guys */
   le_level_changed = NO;
-  
+
   /*
     subset_load(&le_level_subset,"default");
     arrays_init();
@@ -312,6 +348,8 @@ int le_init()
   button_load(&le_select_mode_two_bt,"/images/icons/select-mode2.png","Select Tiles",SDLK_F3,screen->w-32,16);
   button_load(&le_test_level_bt,"/images/icons/test-level.png","Test Level",SDLK_F4,screen->w-64,screen->h - 64);
   button_load(&le_settings_bt,"/images/icons/settings.png","Level settings",SDLK_0,screen->w-32,screen->h - 64);
+  button_load(&le_move_left_bt,"/images/icons/left.png","Test Level",SDLK_F4,screen->w-64,screen->h - 32);
+  button_load(&le_move_right_bt,"/images/icons/right.png","Level settings",SDLK_0,screen->w-48,screen->h - 32);
   button_panel_init(&le_bt_panel, screen->w - 64,64, 64, 380);
 
   menu_init(&leveleditor_menu);
@@ -327,7 +365,7 @@ int le_init()
   menu_reset();
   menu_set_current(&leveleditor_menu);
   show_menu = YES;
-    
+
   menu_init(&subset_load_menu);
   menu_additem(&subset_load_menu,menu_item_create(MN_LABEL,"Load Level Subset",0,0));
   menu_additem(&subset_load_menu,menu_item_create(MN_HL,"",0,0));
@@ -356,9 +394,9 @@ int le_init()
   menu_additem(&level_settings_menu,menu_item_create(MN_LABEL,"Level Settings",0,0));
   menu_additem(&level_settings_menu,menu_item_create(MN_HL,"",0,0));
   menu_additem(&level_settings_menu,menu_item_create(MN_TEXTFIELD,"Name:",0,0));
-  menu_additem(&level_settings_menu,menu_item_create(MN_TEXTFIELD,"Theme:",0,0));
-  menu_additem(&level_settings_menu,menu_item_create(MN_TEXTFIELD,"Song:",0,0));
-  menu_additem(&level_settings_menu,menu_item_create(MN_TEXTFIELD,"Background:",0,0));
+  menu_additem(&level_settings_menu,menu_item_create(MN_STRINGSELECT,"Theme:",0,0));
+  menu_additem(&level_settings_menu,menu_item_create(MN_STRINGSELECT,"Song:",0,0));
+  menu_additem(&level_settings_menu,menu_item_create(MN_STRINGSELECT,"Background:",0,0));
   menu_additem(&level_settings_menu,menu_item_create(MN_NUMFIELD,"Length: ",0,0));
   menu_additem(&level_settings_menu,menu_item_create(MN_NUMFIELD,"Time:   ",0,0));
   menu_additem(&level_settings_menu,menu_item_create(MN_NUMFIELD,"Gravity:",0,0));
@@ -377,27 +415,63 @@ int le_init()
   return 0;
 }
 
-void update_level_settings()
+void update_level_settings_menu()
 {
   char str[80];
 
-  menu_item_change_input(&level_settings_menu.item[1], le_current_level->name);
+  menu_item_change_input(&level_settings_menu.item[2], le_current_level->name);
   sprintf(str,"%d",le_current_level->width);
-  menu_item_change_input(&level_settings_menu.item[5], str);
-  sprintf(str,"%d",le_current_level->time_left);
   menu_item_change_input(&level_settings_menu.item[6], str);
-  sprintf(str,"%2.0f",le_current_level->gravity);
+  sprintf(str,"%d",le_current_level->time_left);
   menu_item_change_input(&level_settings_menu.item[7], str);
-  sprintf(str,"%d",le_current_level->bkgd_red);
+  sprintf(str,"%2.0f",le_current_level->gravity);
   menu_item_change_input(&level_settings_menu.item[8], str);
-  sprintf(str,"%d",le_current_level->bkgd_green);
+  sprintf(str,"%d",le_current_level->bkgd_red);
   menu_item_change_input(&level_settings_menu.item[9], str);
-  sprintf(str,"%d",le_current_level->bkgd_blue);
+  sprintf(str,"%d",le_current_level->bkgd_green);
   menu_item_change_input(&level_settings_menu.item[10], str);
+  sprintf(str,"%d",le_current_level->bkgd_blue);
+  menu_item_change_input(&level_settings_menu.item[11], str);
+}
+
+void apply_level_settings_menu()
+{
+  int i,y,j;
+  strcpy(le_current_level->name,level_settings_menu.item[2].input);
+
+  i = le_current_level->width;
+  le_current_level->width = atoi(level_settings_menu.item[6].input);
+  if(le_current_level->width < i)
+    {
+      if(le_current_level->width < 21)
+        le_current_level->width = 21;
+      for(y = 0; y < 15; ++y)
+        {
+          le_current_level->tiles[y] = (unsigned char*) realloc(le_current_level->tiles[y],(le_current_level->width+1)*sizeof(unsigned char));
+          le_current_level->tiles[y][le_current_level->width] = (unsigned char) '\0';
+        }
+    }
+  else if(le_current_level->width > i)
+    {
+      for(y = 0; y < 15; ++y)
+        {
+          le_current_level->tiles[y] = (unsigned char*) realloc(le_current_level->tiles[y],(le_current_level->width+1)*sizeof(unsigned char));
+          for(j = 0; j < le_current_level->width - i; ++j)
+            le_current_level->tiles[y][i+j] = (unsigned char) '.';
+          le_current_level->tiles[y][le_current_level->width] = (unsigned char) '\0';
+        }
+    }
+  le_current_level->time_left = atoi(level_settings_menu.item[7].input);
+  le_current_level->gravity = atof(level_settings_menu.item[8].input);
+  le_current_level->bkgd_red = atoi(level_settings_menu.item[9].input);
+  le_current_level->bkgd_green = atoi(level_settings_menu.item[10].input);
+  le_current_level->bkgd_blue = atoi(level_settings_menu.item[11].input);
 }
 
 void le_goto_level(int levelnb)
 {
+  arrays_free();
+  arrays_init();
 
   level_free(le_current_level);
   if(level_load(le_current_level, le_level_subset.name, levelnb) != 0)
@@ -485,6 +559,8 @@ void le_drawinterface()
       button_draw(&le_select_mode_two_bt);
       button_draw(&le_bad_bsod_bt);
       button_draw(&le_settings_bt);
+      button_draw(&le_move_right_bt);
+      button_draw(&le_move_left_bt);
       button_panel_draw(&le_bt_panel);
 
       sprintf(str, "%d/%d", le_level,le_level_subset.levels);
@@ -870,6 +946,12 @@ void le_checkevents()
               if(le_level > 1)
                 le_goto_level(--le_level);
             }
+          button_event(&le_move_left_bt,&event);
+          if(button_get_state(&le_move_left_bt) == BN_PRESSED)
+            pos_x -= 180;
+          button_event(&le_move_right_bt,&event);
+          if(button_get_state(&le_move_right_bt) == BN_PRESSED)
+            pos_x += 180;
           button_event(&le_rubber_bt,&event);
           if(button_get_state(&le_rubber_bt) == BN_CLICKED)
             le_current_tile = '.';
@@ -887,6 +969,7 @@ void le_checkevents()
             {
               if(show_menu == NO)
                 {
+                  update_level_settings_menu();
                   menu_set_current(&level_settings_menu);
                   show_menu = YES;
                 }
index 33dccbe..191296d 100644 (file)
@@ -35,7 +35,8 @@
 int menuaction;
 int show_menu;
 int menu_change;
-texture_type checkbox, checkbox_checked, back;
+texture_type checkbox, checkbox_checked, back, arrow_left, arrow_right;
+;
 
 menu_type main_menu, game_menu, options_menu, highscore_menu, load_game_menu, save_game_menu;
 menu_type* current_menu, * last_menu;
@@ -147,6 +148,12 @@ void menu_action(menu_type* pmenu)
           else
             pmenu->active_item = 0;
           break;
+        case MN_LEFT:
+          if(pmenu->item[pmenu->active_item].kind == MN_STRINGSELECT)
+          {}
+        case MN_RIGHT:
+          if(pmenu->item[pmenu->active_item].kind == MN_STRINGSELECT)
+          {}
         case MN_HIT:
           if(pmenu->item[pmenu->active_item].kind == MN_GOTO && pmenu->item[pmenu->active_item].target_menu != NULL)
             menu_set_current((menu_type*)pmenu->item[pmenu->active_item].target_menu);
@@ -263,31 +270,31 @@ void menu_draw(menu_type* pmenu)
   fillrect(screen->w/2 - menu_width/2,screen->h/2-(((pmenu->num_items)*24)/2),menu_width,menu_height,150,150,150,100);
 
   if(timer_check(&pmenu->effect))
-  {
-  e = timer_get_left(&pmenu->effect) / 4;
-  }
+    {
+      e = timer_get_left(&pmenu->effect) / 4;
+    }
   else
-  {
-  e = 0;
-  }
-  
+    {
+      e = 0;
+    }
+
   for(i = 0; i < pmenu->num_items; ++i)
     {
       if(pmenu->arrange_left == YES)
         b = (a - ((strlen(pmenu->item[i].text)+strlen(pmenu->item[i].input)) * 16)) / 2;
       else
         b = 0;
-       
-       if(e != 0)
-       {
-       if(i % 2)
-       f = e;
-       else
-       f = -e;
-       }
-       else
-       f = 0;
-       
+
+      if(e != 0)
+        {
+          if(i % 2)
+            f = e;
+          else
+            f = -e;
+        }
+      else
+        f = 0;
+
       if(pmenu->item[i].kind == MN_DEACTIVE)
         {
           text_drawf(&black_text,pmenu->item[i].text, - b,(i)*24 - menu_height/2 + 10 + f,A_HMIDDLE, A_VMIDDLE,2,NO_UPDATE);
@@ -300,10 +307,31 @@ void menu_draw(menu_type* pmenu)
         }
       else if(pmenu->item[i].kind == MN_LABEL)
         {
-          text_drawf(&gold_text,pmenu->item[i].text, - b,(i)*24 - menu_height/2 + 10,A_HMIDDLE, A_VMIDDLE,2,NO_UPDATE);
+          text_drawf(&white_big_text,pmenu->item[i].text, - b,(i)*24 - menu_height/2 + 10,A_HMIDDLE, A_VMIDDLE,2,NO_UPDATE);
         }
       else if(pmenu->item[i].kind == MN_TEXTFIELD || pmenu->item[i].kind == MN_NUMFIELD)
         {
+          fillrect(-b +screen->w/2 - ((strlen(pmenu->item[i].input)*16)/2) + ((strlen(pmenu->item[i].text) + 1)*16)/2 - 1,(i)*24 - menu_height/2 + 10 + screen->h /2 - 10 + f,(strlen(pmenu->item[i].input)+1)*16 + 2,20,255,255,255,255);
+          fillrect(- b +screen->w/2 - ((strlen(pmenu->item[i].input)*16)/2) + ((strlen(pmenu->item[i].text) + 1)*16)/2,(i)*24 - menu_height/2 + 10 + screen->h /2 - 9 + f,(strlen(pmenu->item[i].input)+1)*16,18,0,0,0,128);
+          text_drawf(&gold_text,pmenu->item[i].input, - b + ((strlen(pmenu->item[i].text)+1) * 16)/2,(i)*24 - menu_height/2 + 10 + f,A_HMIDDLE, A_VMIDDLE,2,NO_UPDATE);
+          if(i == pmenu->active_item)
+            {
+              text_drawf(&blue_text,pmenu->item[i].text, - b  -(((strlen(pmenu->item[i].input)+1) * 16)/2),(i)*24 - menu_height/2 + 10 + f,A_HMIDDLE, A_VMIDDLE,3,NO_UPDATE);
+            }
+          else
+            {
+              text_drawf(&white_text,pmenu->item[i].text, - b  -(((strlen(pmenu->item[i].input)+1) * 16)/2),(i)*24 - menu_height/2 +10 + f,A_HMIDDLE, A_VMIDDLE,2,NO_UPDATE);
+            }
+        }
+      else if(pmenu->item[i].kind == MN_STRINGSELECT)
+        {
+         /* Draw arrows */
+          texture_draw(&arrow_left,-b +screen->w/2 - ((strlen(pmenu->item[i].input)*16)/2) + ((strlen(pmenu->item[i].text) + 1)*16)/2 - 17,(i)*24 - menu_height/2 + 10 + screen->h / 2 -8 + f,NO_UPDATE);
+          texture_draw(&arrow_right,-b +screen->w/2 - ((strlen(pmenu->item[i].input)*16)/2) + ((strlen(pmenu->item[i].text) + 1)*16)/2 - 1 + (strlen(pmenu->item[i].input)+1)*16,(i)*24 - menu_height/2 + 10 + screen->h / 2 -8 + f,NO_UPDATE);
+         /* Draw input background */
+          fillrect(-b +screen->w/2 - ((strlen(pmenu->item[i].input)*16)/2) + ((strlen(pmenu->item[i].text) + 1)*16)/2 - 1,(i)*24 - menu_height/2 + 10 + screen->h /2 - 10 + f,(strlen(pmenu->item[i].input)+1)*16 + 2,20,255,255,255,255);
+          fillrect(- b +screen->w/2 - ((strlen(pmenu->item[i].input)*16)/2) + ((strlen(pmenu->item[i].text) + 1)*16)/2,(i)*24 - menu_height/2 + 10 + screen->h /2 - 9 + f,(strlen(pmenu->item[i].input)+1)*16,18,0,0,0,128);
+         
           text_drawf(&gold_text,pmenu->item[i].input, - b + ((strlen(pmenu->item[i].text)+1) * 16)/2,(i)*24 - menu_height/2 + 10 + f,A_HMIDDLE, A_VMIDDLE,2,NO_UPDATE);
           if(i == pmenu->active_item)
             {
@@ -395,6 +423,14 @@ void menu_event(SDL_keysym* keysym)
       menuaction = MN_DOWN;
       menu_change = YES;
       break;
+    case SDLK_LEFT:            /* Menu Up */
+      menuaction = MN_LEFT;
+      menu_change = YES;
+      break;
+    case SDLK_RIGHT:           /* Menu Down */
+      menuaction = MN_RIGHT;
+      menu_change = YES;
+      break;
     case SDLK_RETURN: /* Menu Hit */
       menuaction = MN_HIT;
       menu_change = YES;
index 923efac..5550b59 100644 (file)
 #include "timer.h"
 
 typedef struct menu_item_type
-{
- int kind;
- char *text;
- char *input;
- int toggled;
- void* target_menu;
-}
+  {
   int kind;
   char *text;
   char *input;
   int toggled;
   void* target_menu;
+  }
 menu_item_type;
 
 menu_item_type* menu_item_create(int kind, char *text, int init_toggle, void* target_menu);
@@ -32,13 +32,13 @@ void menu_item_change_text(menu_item_type* pmenu_item, char *text);
 void menu_item_change_input(menu_item_type* pmenu_item, char *text);
 
 typedef struct menu_type
-{
- int num_items;
- int active_item;
- int arrange_left;
- menu_item_type *item;
- timer_type effect;
-}
+  {
   int num_items;
   int active_item;
   int arrange_left;
   menu_item_type *item;
   timer_type effect;
+  }
 menu_type;
 
 void menu_init(menu_type* pmenu);
@@ -58,6 +58,7 @@ enum {
   MN_DEACTIVE,
   MN_TEXTFIELD,
   MN_NUMFIELD,
+  MN_STRINGSELECT,
   MN_LABEL,
   MN_HL /* horizontal line */
 };
@@ -66,6 +67,8 @@ enum {
 enum {
   MN_UP,
   MN_DOWN,
+  MN_LEFT,
+  MN_RIGHT,
   MN_HIT,
   MN_INPUT,
   MN_REMOVE
@@ -75,7 +78,7 @@ enum {
 extern int menuaction;
 extern int show_menu;
 extern int menu_change;
-extern texture_type checkbox, checkbox_checked, back;
+extern texture_type checkbox, checkbox_checked, back, arrow_left, arrow_right;
 
 extern menu_type main_menu, game_menu, options_menu, highscore_menu, load_game_menu, save_game_menu;
 extern menu_type* current_menu, * last_menu;
index 3d4871e..44d5830 100644 (file)
@@ -71,6 +71,7 @@ void player_init(player_type* pplayer)
   timer_init(&pplayer->invincible_timer,YES);
   timer_init(&pplayer->skidding_timer,YES);
   timer_init(&pplayer->safe_timer,YES);
+  timer_init(&pplayer->frame_timer,YES);
   physic_init(&pplayer->hphysic);
   physic_init(&pplayer->vphysic);
 }
@@ -160,7 +161,7 @@ void player_action(player_type* pplayer)
         }
       else
         {
-           /* Land: */
+          /* Land: */
 
           if (pplayer->base.ym > 0)
             {
@@ -170,7 +171,7 @@ void player_action(player_type* pplayer)
           physic_init(&pplayer->vphysic);
         }
 
-      while(issolid( pplayer->base.x + 16,  pplayer->base.y + pplayer->base.height) && !issolid( pplayer->base.x + 16,  pplayer->base.y))
+      while(issolid( pplayer->base.x + 16,  pplayer->base.y + pplayer->base.height) && !issolid( pplayer->base.x + 16,  pplayer->base.y + 1))
         {
           --pplayer->base.y;
         }
@@ -187,7 +188,7 @@ void player_action(player_type* pplayer)
           --pplayer->base.x;
         }
 
-      if(pplayer->base.ym <= 0)
+      if(pplayer->base.ym < 0)
         {
 
           if (isbrick(pplayer->base.x, pplayer->base.y) ||
@@ -260,103 +261,260 @@ void player_action(player_type* pplayer)
                   distros++;
                 }
             }
-           }
+        }
 
-          player_grabdistros(pplayer);
+      player_grabdistros(pplayer);
 
-          /* FIXME: this code is COMPLETLY broken!!! */
-          /* if (issolid(pplayer->base.x, pplayer->base.y + 31) &&
-               !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y + 31))
+      /* FIXME: this code is COMPLETLY broken!!! */
+      /* if (issolid(pplayer->base.x, pplayer->base.y + 31) &&
+           !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y + 31))
+         {
+           while (issolid(pplayer->base.x, pplayer->base.y + 31))
              {
-               while (issolid(pplayer->base.x, pplayer->base.y + 31))
-                 {
-                   if (pplayer->base.xm < 0)
-                     pplayer->base.x++;
-                   else if (pplayer->base.xm > 0)
-                     pplayer->base.x--;
-                 }
-
-               pplayer->base.xm = 0;
-             }*/
-
-          /*if (issolid(pplayer->base.x, pplayer->base.y) &&
-              !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y))
-            {
-              while (issolid(pplayer->base.x, (pplayer->base.y)))
-                {
-                  if (pplayer->base.xm < 0)
-                    pplayer->base.x++;
-                  else if (pplayer->base.xm > 0)
-                    pplayer->base.x--;
-                }
+               if (pplayer->base.xm < 0)
+                 pplayer->base.x++;
+               else if (pplayer->base.xm > 0)
+                 pplayer->base.x--;
+             }
 
-              pplayer->base.xm = 0;
-            }*/
+           pplayer->base.xm = 0;
+         }*/
 
-          /*if (issolid(pplayer->base.x, pplayer->base.y + 31))
+      /*if (issolid(pplayer->base.x, pplayer->base.y) &&
+          !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y))
+        {
+          while (issolid(pplayer->base.x, (pplayer->base.y)))
             {
-              /* Set down properly: * /
+              if (pplayer->base.xm < 0)
+                pplayer->base.x++;
+              else if (pplayer->base.xm > 0)
+                pplayer->base.x--;
+            }
+
+          pplayer->base.xm = 0;
+        }*/
 
-              int debug_int = 0;
-              while (issolid(pplayer->base.x, pplayer->base.y + 31))
+      /*if (issolid(pplayer->base.x, pplayer->base.y + 31))
+        {
+          /* Set down properly: * /
+
+          int debug_int = 0;
+          while (issolid(pplayer->base.x, pplayer->base.y + 31))
+            {
+              ++debug_int;
+              if(debug_int > 32)
                 {
-                  ++debug_int;
-                  if(debug_int > 32)
-                    {
-                      DEBUG_MSG("FIXME - UNDER certain circumstances I'm hanging in a loop here!");
-                      /*the circumstances are:
-                      issolid() is true and base.ym == 0
-                      use of floating point varibles for base stuff* /
-                      break;
-                    }
-                  if (pplayer->base.ym < 0)
-                    pplayer->base.y++;
-                  else if (pplayer->base.ym > 0)
-                    pplayer->base.y--;
+                  DEBUG_MSG("FIXME - UNDER certain circumstances I'm hanging in a loop here!");
+                  /*the circumstances are:
+                  issolid() is true and base.ym == 0
+                  use of floating point varibles for base stuff* /
+                  break;
                 }
+              if (pplayer->base.ym < 0)
+                pplayer->base.y++;
+              else if (pplayer->base.ym > 0)
+                pplayer->base.y--;
+            }
 
 
-              /* Reset score multiplier (for multi-hits): */
+          /* Reset score multiplier (for multi-hits): */
 
-          if (pplayer->base.ym > 0)
-            score_multiplier = 1;
+      if (pplayer->base.ym > 2)
+        score_multiplier = 1;
 
 
-          /* Stop jumping! * /
+      /* Stop jumping! * /
 
+      pplayer->base.ym = 0;
+      pplayer->jumping = NO;
+      pplayer->input.up = UP;
+      }
+      /* FIXME: this code is COMPLETLY broken!!! */
+      /*if (issolid(pplayer->base.x, pplayer->base.y) ||
+          (pplayer->size == BIG && !pplayer->duck &&
+           (issolid(pplayer->base.x, pplayer->base.y - 32))))
+        {*/
+      /*if (!issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y) &&
+          (pplayer->size == SMALL || pplayer->duck ||
+           !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y - 32)))* /
+
+      if (((!issolid(pplayer->base.x, pplayer->base.y- pplayer->base.ym * frame_ratio) && (issolid(pplayer->base.x, pplayer->base.y) || issolid(pplayer->base.x, pplayer->base.y+31))))
+      ||((!issolid(pplayer->base.x - pplayer->base.xm * frame_ratio, pplayer->base.y) && (issolid(pplayer->base.x, pplayer->base.y) || issolid(pplayer->base.x+32, pplayer->base.y)))))
+          /*(pplayer->size == SMALL || pplayer->duck ||
+           !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y - 32))* /
+        {
+          pplayer->base.y = pplayer->base.y- pplayer->base.ym * frame_ratio;
           pplayer->base.ym = 0;
-          pplayer->jumping = NO;
-          pplayer->input.up = UP;
-          }
-          /* FIXME: this code is COMPLETLY broken!!! */
-          /*if (issolid(pplayer->base.x, pplayer->base.y) ||
-              (pplayer->size == BIG && !pplayer->duck &&
-               (issolid(pplayer->base.x, pplayer->base.y - 32))))
-            {*/
-          /*if (!issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y) &&
-              (pplayer->size == SMALL || pplayer->duck ||
-               !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y - 32)))* /
+        }
+
+      if (((issolid(pplayer->base.x, pplayer->base.y) || issolid(pplayer->base.x+32, pplayer->base.y)) &&  (!issolid(pplayer->base.x - pplayer->base.xm * frame_ratio, pplayer->base.y))
+          /*(pplayer->size == SMALL || pplayer->duck ||
+           !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y - 32))* /) || 
+      (!issolid(pplayer->base.x - pplayer->base.xm * frame_ratio, pplayer->base.y+pplayer->base.height) && (issolid(pplayer->base.x, pplayer->base.y+pplayer->base.height) || issolid(pplayer->base.x +32, pplayer->base.y+pplayer->base.height))))
+        {
+      pplayer->base.x = pplayer->base.x- pplayer->base.xm * frame_ratio;
+          pplayer->base.xm = 0;
+        }
 
-          if (((!issolid(pplayer->base.x, pplayer->base.y- pplayer->base.ym * frame_ratio) && (issolid(pplayer->base.x, pplayer->base.y) || issolid(pplayer->base.x, pplayer->base.y+31))))
-          ||((!issolid(pplayer->base.x - pplayer->base.xm * frame_ratio, pplayer->base.y) && (issolid(pplayer->base.x, pplayer->base.y) || issolid(pplayer->base.x+32, pplayer->base.y)))))
-              /*(pplayer->size == SMALL || pplayer->duck ||
-               !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y - 32))* /
+          if (pplayer->base.ym <= 0)
             {
-              pplayer->base.y = pplayer->base.y- pplayer->base.ym * frame_ratio;
-              pplayer->base.ym = 0;
+      if (isbrick(pplayer->base.x, pplayer->base.y) ||
+          isfullbox(pplayer->base.x, pplayer->base.y))
+        {
+          trygrabdistro(pplayer->base.x, pplayer->base.y - 32,BOUNCE);
+          trybumpbadguy(pplayer->base.x, pplayer->base.y - 64);
+          bumpbrick(pplayer->base.x, pplayer->base.y);
+          tryemptybox(pplayer->base.x, pplayer->base.y);
+        }
+
+      if (isbrick(pplayer->base.x+ 31, pplayer->base.y) ||
+          isfullbox(pplayer->base.x+ 31, pplayer->base.y))
+        {
+          trygrabdistro(pplayer->base.x+ 31, pplayer->base.y - 32,BOUNCE);
+          trybumpbadguy(pplayer->base.x+ 31, pplayer->base.y - 64);
+          bumpbrick(pplayer->base.x+ 31, pplayer->base.y);
+          tryemptybox(pplayer->base.x+ 31, pplayer->base.y);
+        }
+      /* Get a distro from a brick? * /
+
+      if (shape(pplayer->base.x, pplayer->base.y) == 'x' ||
+          shape(pplayer->base.x, pplayer->base.y) == 'y')
+        {
+          add_bouncy_distro(((pplayer->base.x+ 1)
+                             / 32) * 32,
+                            (int)(pplayer->base.y / 32) * 32);
+
+          if (counting_distros == NO)
+            {
+              counting_distros = YES;
+              distro_counter = 100;
             }
 
-          if (((issolid(pplayer->base.x, pplayer->base.y) || issolid(pplayer->base.x+32, pplayer->base.y)) &&  (!issolid(pplayer->base.x - pplayer->base.xm * frame_ratio, pplayer->base.y))
-              /*(pplayer->size == SMALL || pplayer->duck ||
-               !issolid(pplayer->base.x- pplayer->base.xm, pplayer->base.y - 32))* /) || 
-          (!issolid(pplayer->base.x - pplayer->base.xm * frame_ratio, pplayer->base.y+pplayer->base.height) && (issolid(pplayer->base.x, pplayer->base.y+pplayer->base.height) || issolid(pplayer->base.x +32, pplayer->base.y+pplayer->base.height))))
+          if (distro_counter <= 0)
+            level_change(&current_level,pplayer->base.x,pplayer->base.y, 'a');
+
+          play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
+          score = score + SCORE_DISTRO;
+          distros++;
+        }
+      else if (shape(pplayer->base.x+ 31, pplayer->base.y) == 'x' ||
+               shape(pplayer->base.x+ 31, pplayer->base.y) == 'y')
+        {
+          add_bouncy_distro(((pplayer->base.x+ 1 + 31)
+                             / 32) * 32,
+                            (int)(pplayer->base.y / 32) * 32);
+
+          if (counting_distros == NO)
             {
-          pplayer->base.x = pplayer->base.x- pplayer->base.xm * frame_ratio;
-              pplayer->base.xm = 0;
+              counting_distros = YES;
+              distro_counter = 100;
             }
 
+          if (distro_counter <= 0)
+            level_change(&current_level,pplayer->base.x+ 31, pplayer->base.y, 'a');
+
+          play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
+          score = score + SCORE_DISTRO;
+          distros++;
+        }
+
+      }
+      else
+      {
+      pplayer->base.ym = 0;
+      pplayer->jumping = NO;
+      timer_start(&pplayer->jump_timer,MAX_JUMP_TIME);
+      }
+      /*}*/
+      /* Bump into things: * /
+       
+      if (issolid(pplayer->base.x, pplayer->base.y) ||
+          (pplayer->size == BIG && !pplayer->duck &&
+           (issolid(pplayer->base.x, pplayer->base.y - 32))))
+        {
+       
+          if (!issolid(pplayer->base.x, pplayer->base.y - pplayer->base.ym) &&
+              (pplayer->size == SMALL || pplayer->duck ||
+               !issolid(pplayer->base.x, pplayer->base.y - 32 - pplayer->base.ym)))
+            {
               if (pplayer->base.ym <= 0)
                 {
+                  /* Jumping up? */
+      /* FIXME: this code is COMPLETLY broken!!! */
+      if (pplayer->size == BIG)
+        {
+          /* Break bricks and empty boxes: * /
+
+          if (!pplayer->duck)
+            {
+              if (isbrick(pplayer->base.x, pplayer->base.y - 32) ||
+                  isfullbox(pplayer->base.x, pplayer->base.y - 32))
+                {
+                  trygrabdistro(pplayer->base.x, pplayer->base.y - 64, BOUNCE);
+                  trybumpbadguy(pplayer->base.x, pplayer->base.y - 96);
+
+                  if (isfullbox(pplayer->base.x, pplayer->base.y - 32))
+                    {
+                      bumpbrick(pplayer->base.x, pplayer->base.y - 32);
+                    }
+
+                  trybreakbrick(pplayer->base.x, pplayer->base.y - 32);
+                  tryemptybox(pplayer->base.x, pplayer->base.y - 32);
+                }
+
+              if (isbrick(pplayer->base.x+ 31, pplayer->base.y - 32) ||
+                  isfullbox(pplayer->base.x+ 31, pplayer->base.y - 32))
+                {
+                  trygrabdistro(pplayer->base.x+ 31,
+                                pplayer->base.y - 64,
+                                BOUNCE);
+                  trybumpbadguy(pplayer->base.x+ 31,
+                                pplayer->base.y - 96);
+
+                  if (isfullbox(pplayer->base.x+ 31, pplayer->base.y - 32))
+                    {
+                      bumpbrick(pplayer->base.x+ 31, pplayer->base.y - 32);
+                    }
+
+                  trybreakbrick(pplayer->base.x+ 31,
+                                pplayer->base.y - 32);
+                  tryemptybox(pplayer->base.x+ 31,
+                              pplayer->base.y - 32);
+                }
+            }
+          else /* ducking * /
+            {
+              if (isbrick(pplayer->base.x, pplayer->base.y) ||
+                  isfullbox(pplayer->base.x, pplayer->base.y))
+                {
+                  trygrabdistro(pplayer->base.x, pplayer->base.y - 32,BOUNCE);
+                  trybumpbadguy(pplayer->base.x, pplayer->base.y - 64);
+                  if (isfullbox(pplayer->base.x, pplayer->base.y))
+                    bumpbrick(pplayer->base.x, pplayer->base.y);
+                  trybreakbrick(pplayer->base.x, pplayer->base.y);
+                  tryemptybox(pplayer->base.x, pplayer->base.y);
+                }
+
+              if (isbrick(pplayer->base.x+ 31, pplayer->base.y) ||
+                  isfullbox(pplayer->base.x+ 31, pplayer->base.y))
+                {
+                  trygrabdistro(pplayer->base.x+ 31,
+                                pplayer->base.y - 32,
+                                BOUNCE);
+                  trybumpbadguy(pplayer->base.x+ 31,
+                                pplayer->base.y - 64);
+                  if (isfullbox(pplayer->base.x+ 31, pplayer->base.y))
+                    bumpbrick(pplayer->base.x+ 31, pplayer->base.y);
+                  trybreakbrick(pplayer->base.x+ 31, pplayer->base.y);
+                  tryemptybox(pplayer->base.x+ 31, pplayer->base.y);
+                }
+            }
+          }
+          else
+          {
+          /* It's a brick and we're small, make the brick
+             bounce, and grab any distros above it: *  /
+
           if (isbrick(pplayer->base.x, pplayer->base.y) ||
               isfullbox(pplayer->base.x, pplayer->base.y))
             {
@@ -374,6 +532,8 @@ void player_action(player_type* pplayer)
               bumpbrick(pplayer->base.x+ 31, pplayer->base.y);
               tryemptybox(pplayer->base.x+ 31, pplayer->base.y);
             }
+
+
           /* Get a distro from a brick? * /
 
           if (shape(pplayer->base.x, pplayer->base.y) == 'x' ||
@@ -416,184 +576,25 @@ void player_action(player_type* pplayer)
               score = score + SCORE_DISTRO;
               distros++;
             }
+          }
+
 
+          /* Bump head: * /
+
+          pplayer->base.y = (int)(pplayer->base.y / 32) * 32 + 30;
           }
           else
           {
+          /* Land on feet: * /
+
+          pplayer->base.y = (int)(pplayer->base.y / 32) * 32 - 32;
+          }
+
           pplayer->base.ym = 0;
           pplayer->jumping = NO;
           timer_start(&pplayer->jump_timer,MAX_JUMP_TIME);
-          }
-          /*}*/
-          /* Bump into things: * /
-           
-          if (issolid(pplayer->base.x, pplayer->base.y) ||
-              (pplayer->size == BIG && !pplayer->duck &&
-               (issolid(pplayer->base.x, pplayer->base.y - 32))))
-            {
-           
-              if (!issolid(pplayer->base.x, pplayer->base.y - pplayer->base.ym) &&
-                  (pplayer->size == SMALL || pplayer->duck ||
-                   !issolid(pplayer->base.x, pplayer->base.y - 32 - pplayer->base.ym)))
-                {
-                  if (pplayer->base.ym <= 0)
-                    {
-                      /* Jumping up? */
-          /* FIXME: this code is COMPLETLY broken!!! */
-          if (pplayer->size == BIG)
-            {
-              /* Break bricks and empty boxes: * /
-
-              if (!pplayer->duck)
-                {
-                  if (isbrick(pplayer->base.x, pplayer->base.y - 32) ||
-                      isfullbox(pplayer->base.x, pplayer->base.y - 32))
-                    {
-                      trygrabdistro(pplayer->base.x, pplayer->base.y - 64, BOUNCE);
-                      trybumpbadguy(pplayer->base.x, pplayer->base.y - 96);
-
-                      if (isfullbox(pplayer->base.x, pplayer->base.y - 32))
-                        {
-                          bumpbrick(pplayer->base.x, pplayer->base.y - 32);
-                        }
-
-                      trybreakbrick(pplayer->base.x, pplayer->base.y - 32);
-                      tryemptybox(pplayer->base.x, pplayer->base.y - 32);
-                    }
-
-                  if (isbrick(pplayer->base.x+ 31, pplayer->base.y - 32) ||
-                      isfullbox(pplayer->base.x+ 31, pplayer->base.y - 32))
-                    {
-                      trygrabdistro(pplayer->base.x+ 31,
-                                    pplayer->base.y - 64,
-                                    BOUNCE);
-                      trybumpbadguy(pplayer->base.x+ 31,
-                                    pplayer->base.y - 96);
-
-                      if (isfullbox(pplayer->base.x+ 31, pplayer->base.y - 32))
-                        {
-                          bumpbrick(pplayer->base.x+ 31, pplayer->base.y - 32);
-                        }
-
-                      trybreakbrick(pplayer->base.x+ 31,
-                                    pplayer->base.y - 32);
-                      tryemptybox(pplayer->base.x+ 31,
-                                  pplayer->base.y - 32);
-                    }
-                }
-              else /* ducking * /
-                {
-                  if (isbrick(pplayer->base.x, pplayer->base.y) ||
-                      isfullbox(pplayer->base.x, pplayer->base.y))
-                    {
-                      trygrabdistro(pplayer->base.x, pplayer->base.y - 32,BOUNCE);
-                      trybumpbadguy(pplayer->base.x, pplayer->base.y - 64);
-                      if (isfullbox(pplayer->base.x, pplayer->base.y))
-                        bumpbrick(pplayer->base.x, pplayer->base.y);
-                      trybreakbrick(pplayer->base.x, pplayer->base.y);
-                      tryemptybox(pplayer->base.x, pplayer->base.y);
-                    }
-
-                  if (isbrick(pplayer->base.x+ 31, pplayer->base.y) ||
-                      isfullbox(pplayer->base.x+ 31, pplayer->base.y))
-                    {
-                      trygrabdistro(pplayer->base.x+ 31,
-                                    pplayer->base.y - 32,
-                                    BOUNCE);
-                      trybumpbadguy(pplayer->base.x+ 31,
-                                    pplayer->base.y - 64);
-                      if (isfullbox(pplayer->base.x+ 31, pplayer->base.y))
-                        bumpbrick(pplayer->base.x+ 31, pplayer->base.y);
-                      trybreakbrick(pplayer->base.x+ 31, pplayer->base.y);
-                      tryemptybox(pplayer->base.x+ 31, pplayer->base.y);
-                    }
-                }
-              }
-              else
-              {
-              /* It's a brick and we're small, make the brick
-                 bounce, and grab any distros above it: *  /
-
-              if (isbrick(pplayer->base.x, pplayer->base.y) ||
-                  isfullbox(pplayer->base.x, pplayer->base.y))
-                {
-                  trygrabdistro(pplayer->base.x, pplayer->base.y - 32,BOUNCE);
-                  trybumpbadguy(pplayer->base.x, pplayer->base.y - 64);
-                  bumpbrick(pplayer->base.x, pplayer->base.y);
-                  tryemptybox(pplayer->base.x, pplayer->base.y);
-                }
-
-              if (isbrick(pplayer->base.x+ 31, pplayer->base.y) ||
-                  isfullbox(pplayer->base.x+ 31, pplayer->base.y))
-                {
-                  trygrabdistro(pplayer->base.x+ 31, pplayer->base.y - 32,BOUNCE);
-                  trybumpbadguy(pplayer->base.x+ 31, pplayer->base.y - 64);
-                  bumpbrick(pplayer->base.x+ 31, pplayer->base.y);
-                  tryemptybox(pplayer->base.x+ 31, pplayer->base.y);
-                }
-
-
-              /* Get a distro from a brick? * /
-
-              if (shape(pplayer->base.x, pplayer->base.y) == 'x' ||
-                  shape(pplayer->base.x, pplayer->base.y) == 'y')
-                {
-                  add_bouncy_distro(((pplayer->base.x+ 1)
-                                     / 32) * 32,
-                                    (int)(pplayer->base.y / 32) * 32);
-
-                  if (counting_distros == NO)
-                    {
-                      counting_distros = YES;
-                      distro_counter = 100;
-                    }
-
-                  if (distro_counter <= 0)
-                    level_change(&current_level,pplayer->base.x,pplayer->base.y, 'a');
-
-                  play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
-                  score = score + SCORE_DISTRO;
-                  distros++;
-                }
-              else if (shape(pplayer->base.x+ 31, pplayer->base.y) == 'x' ||
-                       shape(pplayer->base.x+ 31, pplayer->base.y) == 'y')
-                {
-                  add_bouncy_distro(((pplayer->base.x+ 1 + 31)
-                                     / 32) * 32,
-                                    (int)(pplayer->base.y / 32) * 32);
-
-                  if (counting_distros == NO)
-                    {
-                      counting_distros = YES;
-                      distro_counter = 100;
-                    }
-
-                  if (distro_counter <= 0)
-                    level_change(&current_level,pplayer->base.x+ 31, pplayer->base.y, 'a');
-
-                  play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
-                  score = score + SCORE_DISTRO;
-                  distros++;
-                }
-              }
-
-
-              /* Bump head: * /
-
-              pplayer->base.y = (int)(pplayer->base.y / 32) * 32 + 30;
-              }
-              else
-              {
-              /* Land on feet: * /
-
-              pplayer->base.y = (int)(pplayer->base.y / 32) * 32 - 32;
-              }
-
-              pplayer->base.ym = 0;
-              pplayer->jumping = NO;
-              timer_start(&pplayer->jump_timer,MAX_JUMP_TIME);
-              }*/
-            }
+          }*/
+        }
     }
 
 
@@ -802,19 +803,6 @@ void player_handle_vertical_input(player_type *pplayer)
     }
   else if(pplayer->input.up == UP && pplayer->jumping == YES)
     {
-      /* Land: * /
-      DEBUG_MSG("Stop Jump");
-      pplayer->jumping = NO;
-
-      if (pplayer->base.ym > 0)
-        {
-          pplayer->base.y = (int)(pplayer->base.y / 32) * 32;
-          pplayer->base.ym = 0;
-        }
-      physic_init(&pplayer->vphysic);
-      }
-      else if(pplayer->input.up == UP)
-      {*/
       if (issolid(pplayer->base.x + 16, pplayer->base.y + pplayer->base.height + 1))
         {
           physic_init(&pplayer->vphysic);
@@ -823,14 +811,13 @@ void player_handle_vertical_input(player_type *pplayer)
       else
         {
           pplayer->jumping = NO;
-         printf("%f",physic_get_velocity(&pplayer->vphysic));
           if(physic_is_set(&pplayer->vphysic))
             {
-           if(physic_get_velocity(&pplayer->vphysic) < 0.)
-           {
-                       physic_set_state(&pplayer->vphysic,PH_VT);
-              physic_set_start_vy(&pplayer->vphysic,0);
-             }
+              if(physic_get_velocity(&pplayer->vphysic) < 0.)
+                {
+                  physic_set_state(&pplayer->vphysic,PH_VT);
+                  physic_set_start_vy(&pplayer->vphysic,0);
+                }
             }
           else
             {
@@ -937,21 +924,25 @@ void player_input(player_type *pplayer)
 
   /* (Tux): */
 
-  if (pplayer->input.right == UP && pplayer->input.left == UP)
-    {
-      pplayer->frame_main = 1;
-      pplayer->frame = 1;
-    }
-  else
+  if(!timer_check(&pplayer->frame_timer))
     {
-      if ((pplayer->input.fire == DOWN && (frame % 2) == 0) ||
-          (frame % 4) == 0)
-        pplayer->frame_main = (pplayer->frame_main + 1) % 4;
+      timer_start(&pplayer->frame_timer,25);
+      if (pplayer->input.right == UP && pplayer->input.left == UP)
+        {
+          pplayer->frame_main = 1;
+          pplayer->frame = 1;
+        }
+      else
+        {
+          if ((pplayer->input.fire == DOWN && (frame % 2) == 0) ||
+              (frame % 4) == 0)
+            pplayer->frame_main = (pplayer->frame_main + 1) % 4;
 
-      pplayer->frame = pplayer->frame_main;
+          pplayer->frame = pplayer->frame_main;
 
-      if (pplayer->frame == 3)
-        pplayer->frame = 1;
+          if (pplayer->frame == 3)
+            pplayer->frame = 1;
+        }
     }
 
 }
@@ -1261,7 +1252,8 @@ void player_collision(player_type* pplayer, void* p_c_object, int c_object)
                       else
                         {
                           pbad_c->dying = FALLING;
-                          pbad_c->base.ym = -8;
+                          physic_set_state(&pplayer->vphysic,PH_VT);
+                          physic_set_start_vy(&pplayer->vphysic,-2.);
                           play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER);
                         }
                     }
@@ -1276,7 +1268,8 @@ void player_collision(player_type* pplayer, void* p_c_object, int c_object)
               else
                 {
                   pbad_c->dying = FALLING;
-                  pbad_c->base.ym = -8;
+                  physic_set_state(&pplayer->vphysic,PH_VT);
+                  physic_set_start_vy(&pplayer->vphysic,-2.);
                   play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER);
                 }
             }
index 0563db8..31b0c5d 100644 (file)
@@ -77,6 +77,7 @@ typedef struct player_type
  timer_type invincible_timer;
  timer_type skidding_timer;
  timer_type safe_timer;
+ timer_type frame_timer;
  physic_type vphysic;
  physic_type hphysic;
 }
index dad92df..f151d86 100644 (file)
@@ -125,10 +125,6 @@ void add_score(float x, float y, int s)
 
 void add_bouncy_distro(float x, float y)
 {
-
-
-printf("X _--- %f Y-- isdojf %f\n",x,y);
-
   int i, found;
 
   found = -1;
index 899e851..22fecc4 100644 (file)
@@ -385,12 +385,15 @@ void st_general_setup(void)
   text_load(&red_text,DATA_PREFIX "/images/status/letters-red.png", TEXT_TEXT, 16,18);
   text_load(&white_text,DATA_PREFIX "/images/status/letters-white.png", TEXT_TEXT, 16,18);
   text_load(&white_small_text,DATA_PREFIX "/images/status/letters-white-small.png", TEXT_TEXT, 8,9);
+  text_load(&white_big_text,DATA_PREFIX "/images/status/letters-white-big.png", TEXT_TEXT, 24,27);
   text_load(&yellow_nums,DATA_PREFIX "/images/status/numbers.png", TEXT_NUM, 32,32);
 
   /* Load GUI/menu images: */
   texture_load(&checkbox, DATA_PREFIX "/images/status/checkbox.png", USE_ALPHA);
   texture_load(&checkbox_checked, DATA_PREFIX "/images/status/checkbox-checked.png", USE_ALPHA);
   texture_load(&back, DATA_PREFIX "/images/status/back.png", USE_ALPHA);
+  texture_load(&arrow_left, DATA_PREFIX "/images/icons/left.png", USE_ALPHA);
+  texture_load(&arrow_right, DATA_PREFIX "/images/icons/right.png", USE_ALPHA);
 
   /* Set icon image: */