rpms/lacewing/devel lacewing-fullscreen.patch, NONE, 1.1 lacewing-nicecpu.patch, NONE, 1.1 lacewing.desktop, NONE, 1.1 lacewing.patch, NONE, 1.1 lacewing.png, NONE, 1.1 lacewing.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Mon Jan 30 21:34:11 UTC 2006


Author: jwrdegoede

Update of /cvs/extras/rpms/lacewing/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv889/devel

Modified Files:
	.cvsignore sources 
Added Files:
	lacewing-fullscreen.patch lacewing-nicecpu.patch 
	lacewing.desktop lacewing.patch lacewing.png lacewing.spec 
Log Message:
auto-import lacewing-1.10-3 on branch devel from lacewing-1.10-3.src.rpm

lacewing-fullscreen.patch:

--- NEW FILE lacewing-fullscreen.patch ---
diff -ur lacewing.orig/config.h lacewing/config.h
--- lacewing.orig/config.h	2006-01-21 13:00:59.000000000 +0100
+++ lacewing/config.h	2006-01-21 11:19:54.000000000 +0100
@@ -792,6 +792,7 @@
  int run_vsync; // on or off
  int sound_volume; // sound fx volume; if 0 sound effects not played
  int ambience_volume; // if 0 ambience not played
+ int windowed; // GFX_AUTODETECT_FULLSCREEN or GFX_AUTODETECT_WINDOWED
 };
 
 struct starstruct
diff -ur lacewing.orig/main.c lacewing/main.c
--- lacewing.orig/main.c	2006-01-21 13:00:59.000000000 +0100
+++ lacewing/main.c	2006-01-21 11:20:18.000000000 +0100
@@ -245,7 +245,7 @@
 
    set_color_depth(8);
 
-   if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0)
+   if (set_gfx_mode(options.windowed, 640, 480, 0, 0) != 0)
    {
       set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
       allegro_message("Unable to set 640x480 mode\n%s\n", allegro_error);
diff -ur lacewing.orig/menu.c lacewing/menu.c
--- lacewing.orig/menu.c	2006-01-21 13:00:59.000000000 +0100
+++ lacewing/menu.c	2006-01-21 11:54:18.000000000 +0100
@@ -61,6 +61,7 @@
 #define KP_WAIT_SHORT 5
 
 extern struct optionstruct options;
+extern RGB palet [256];
 
 enum
 {
@@ -604,7 +605,7 @@
   char ostr [50];
   char istr [10];
 
-  for (i = 0; i < 32; i ++)
+  for (i = 0; i < 33; i ++)
   {
 
    col = COLOUR_GREEN6;
@@ -663,114 +664,121 @@
        strcat(ostr, itoa(options.ambience_volume, istr, 10));
      break;
     case 4:
+     strcpy(ostr, "Full Screen - ");
+     if (options.windowed == GFX_AUTODETECT_WINDOWED)
+      strcat(ostr, "Off");
+       else
+        strcat(ostr, "On");
+     break;
+    case 5:
      strcpy(ostr, "Video Sync - ");
      if (options.run_vsync == 0)
       strcat(ostr, "Off");
        else
         strcat(ostr, "On");
      break;
-    case 5:
+    case 6:
      strcpy(ostr, "Test Speakers");
      break;
-    case 6:
+    case 7:
      strcpy(ostr, "Test Keys");
      break;
-    case 7:
+    case 8:
      strcpy(ostr, "");
      break;
-    case 8:
+    case 9:
      col = COLOUR_GREY6;
      strcpy(ostr, "Player 1 Keys");
      break;
-    case 9:
+    case 10:
      strcpy(ostr, "Forwards - ");
      strcat(ostr, scancode_to_keyname(player[0].keys [CMD_THRUST]));
      break;
-    case 10:
+    case 11:
      strcpy(ostr, "Left - ");
      strcat(ostr, scancode_to_keyname(player[0].keys [CMD_LEFT]));
      break;
-    case 11:
+    case 12:
      strcpy(ostr, "Right - ");
      strcat(ostr, scancode_to_keyname(player[0].keys [CMD_RIGHT]));
      break;
-    case 12:
+    case 13:
      strcpy(ostr, "Brake - ");
      strcat(ostr, scancode_to_keyname(player[0].keys [CMD_BRAKE]));
      break;
-    case 13:
+    case 14:
      strcpy(ostr, "Fire Cannon - ");
      strcat(ostr, scancode_to_keyname(player[0].keys [CMD_FIRE1]));
      break;
-    case 14:
+    case 15:
      strcpy(ostr, "Fire Secondary - ");
      strcat(ostr, scancode_to_keyname(player[0].keys [CMD_FIRE2]));
      break;
-    case 15:
+    case 16:
      strcpy(ostr, "Upgrade - ");
      strcat(ostr, scancode_to_keyname(player[0].keys [CMD_UPGRADE]));
      break;
-    case 16:
+    case 17:
      strcpy(ostr, "Slide Left - ");
      strcat(ostr, scancode_to_keyname(player[0].keys [CMD_LEFT1]));
      break;
-    case 17:
+    case 18:
      strcpy(ostr, "Slide Right - ");
      strcat(ostr, scancode_to_keyname(player[0].keys [CMD_RIGHT1]));
      break;
-    case 18:
+    case 19:
      strcpy(ostr, "Toggle Linked Fire - ");
      strcat(ostr, scancode_to_keyname(player[0].keys [CMD_LINK]));
      break;
-    case 19:
+    case 20:
      col = COLOUR_GREY6;
      strcpy(ostr, "Player 2 Keys");
      break;
-    case 20:
+    case 21:
      strcpy(ostr, "Forwards - ");
      strcat(ostr, scancode_to_keyname(player[1].keys [CMD_THRUST]));
      break;
-    case 21:
+    case 22:
      strcpy(ostr, "Left - ");
      strcat(ostr, scancode_to_keyname(player[1].keys [CMD_LEFT]));
      break;
-    case 22:
+    case 23:
      strcpy(ostr, "Right - ");
      strcat(ostr, scancode_to_keyname(player[1].keys [CMD_RIGHT]));
      break;
-    case 23:
+    case 24:
      strcpy(ostr, "Brake - ");
      strcat(ostr, scancode_to_keyname(player[1].keys [CMD_BRAKE]));
      break;
-    case 24:
+    case 25:
      strcpy(ostr, "Fire Cannon - ");
      strcat(ostr, scancode_to_keyname(player[1].keys [CMD_FIRE1]));
      break;
-    case 25:
+    case 26:
      strcpy(ostr, "Fire Secondary - ");
      strcat(ostr, scancode_to_keyname(player[1].keys [CMD_FIRE2]));
      break;
-    case 26:
+    case 27:
      strcpy(ostr, "Upgrade - ");
      strcat(ostr, scancode_to_keyname(player[1].keys [CMD_UPGRADE]));
      break;
-    case 27:
+    case 28:
      strcpy(ostr, "Slide Left - ");
      strcat(ostr, scancode_to_keyname(player[1].keys [CMD_LEFT1]));
      break;
-    case 28:
+    case 29:
      strcpy(ostr, "Slide Right - ");
      strcat(ostr, scancode_to_keyname(player[1].keys [CMD_RIGHT1]));
      break;
-    case 29:
+    case 30:
      strcpy(ostr, "Toggle Linked Fire - ");
      strcat(ostr, scancode_to_keyname(player[1].keys [CMD_LINK]));
      break;
-    case 30:
+    case 31:
      strcpy(ostr, "");
 //     strcat(ostr, scancode_to_keyname(player[1].keys [CMD_LINK])
      break;
-    case 31:
+    case 32:
      strcpy(ostr, "Exit");
      break;
 
@@ -798,10 +806,10 @@
  {
 //  case 5:
 //  case 6:
-  case 7:
   case 8:
-  case 19:
-  case 30:
+  case 9:
+  case 20:
+  case 31:
    return 1;
  }
 
@@ -1116,13 +1124,13 @@
    }
    break;
   case MENU_OPTIONS:
-   if (menu_index == 31)
+   if (menu_index == 32)
    {
     play_sound(WAV_MENU2);
     change_menu(MENU_MAIN);
     break;
    }
-   if (menu_index < 9)
+   if (menu_index < 10)
    {
     switch(menu_index)
     {
@@ -1148,18 +1156,33 @@
       play_sound(WAV_MENU1);
       return;
      case 4:
+      if (options.windowed == GFX_AUTODETECT_WINDOWED)
+       options.windowed = GFX_AUTODETECT_FULLSCREEN;
+        else
+         options.windowed = GFX_AUTODETECT_WINDOWED;
+      play_sound(WAV_MENU1);
+      if (set_gfx_mode(options.windowed, 640, 480, 0, 0) != 0)
+      {
+       set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
+       allegro_message("Error switching fullscreen / windowed mode\n%s\n",
+        allegro_error);
+       exit(1);
+      }
+      set_palette(palet);
+      return;
+     case 5:
       if (options.run_vsync == 1)
        options.run_vsync = 0;
         else
          options.run_vsync = 1;
       play_sound(WAV_MENU1);
       return;
-     case 5:
+     case 6:
       test_speakers();
       ticked = 0;
 // test speakers
       return;
-     case 6:
+     case 7:
       play_sound(WAV_MENU2);
       jam_keys();
       return;
@@ -1268,7 +1291,7 @@
   if (option_index() == -1)
    return;
 
-  if (menu_index < 20)
+  if (menu_index < 21)
    player[0].keys [option_index()] = inputted;
     else
      player[1].keys [option_index()] = inputted;
@@ -1282,35 +1305,35 @@
 {
   switch(menu_index)
   {
-   case 9:
-   case 20:
-    return CMD_THRUST;
    case 10:
    case 21:
-    return CMD_LEFT;
+    return CMD_THRUST;
    case 11:
    case 22:
-    return CMD_RIGHT;
+    return CMD_LEFT;
    case 12:
    case 23:
-    return CMD_BRAKE;
+    return CMD_RIGHT;
    case 13:
    case 24:
-    return CMD_FIRE1;
+    return CMD_BRAKE;
    case 14:
    case 25:
-    return CMD_FIRE2;
+    return CMD_FIRE1;
    case 15:
    case 26:
-    return CMD_UPGRADE;
+    return CMD_FIRE2;
    case 16:
    case 27:
-    return CMD_LEFT1;
+    return CMD_UPGRADE;
    case 17:
    case 28:
-    return CMD_RIGHT1;
+    return CMD_LEFT1;
    case 18:
    case 29:
+    return CMD_RIGHT1;
+   case 19:
+   case 30:
     return CMD_LINK;
   }
 
@@ -1391,7 +1414,7 @@
   case MENU_OPTIONS:
     which_menu = MENU_OPTIONS;
     menu_index = 1;
-    menu_index_max = 31;
+    menu_index_max = 32;
     menu_index_min = 1;
     break;
   case MENU_DUEL:
@@ -2827,6 +2850,7 @@
  options.run_vsync = get_config_int("Options", "Run_vsync", 0);
  options.sound_volume = get_config_int("Options", "Sound_volume", 100);
  options.ambience_volume = get_config_int("Options", "Ambience_volume", 100);
+ options.windowed = get_config_int("Options", "Windowed", GFX_AUTODETECT_FULLSCREEN);
 
  for (i = 0; i < NO_CMDS; i ++)
  {
@@ -2905,6 +2929,7 @@
  set_config_int("Options", "Run_vsync", options.run_vsync);
  set_config_int("Options", "Sound_volume", options.sound_volume);
  set_config_int("Options", "Ambience_volume", options.ambience_volume);
+ set_config_int("Options", "Windowed", options.windowed);
 
  for (i = 0; i < NO_CMDS; i ++)
  {

lacewing-nicecpu.patch:

--- NEW FILE lacewing-nicecpu.patch ---
diff -ur lacewing.orig/display.c lacewing/display.c
--- lacewing.orig/display.c	2006-01-21 13:31:40.000000000 +0100
+++ lacewing/display.c	2006-01-21 13:21:34.000000000 +0100
@@ -3140,7 +3140,7 @@
  do
  {
   while(ticked == 0)
-   rest(0);
+   rest(1);
     
   waiting--;
   ticked--;
diff -ur lacewing.orig/game.c lacewing/game.c
--- lacewing.orig/game.c	2006-01-21 13:31:40.000000000 +0100
+++ lacewing/game.c	2006-01-21 13:21:37.000000000 +0100
@@ -180,7 +180,7 @@
    frames_skipped++;
 
   while(ticked == 0)
-   rest(0);
+   rest(1);
 
   ticked --;
 
diff -ur lacewing.orig/menu.c lacewing/menu.c
--- lacewing.orig/menu.c	2006-01-21 13:32:08.000000000 +0100
+++ lacewing/menu.c	2006-01-21 13:29:55.000000000 +0100
@@ -361,7 +361,7 @@
   menu_input();
 
   while(ticked == 0)
-   rest(0);
+   rest(1);
   ticked --;
 
  } while(TRUE);
@@ -403,7 +403,8 @@
 
   text_mode(-1);
 
-  vsync();
+  if (options.run_vsync > 0)
+   vsync();
 
   RGB title_colour [1];
 
@@ -1375,7 +1376,9 @@
 
  game.type = game_type;
 
- vsync();
+ if (options.run_vsync > 0)
+  vsync();
+ 
  clear_bitmap(screen);
 
  begin_game();
@@ -1599,7 +1602,7 @@
   }
 
   while (ticked == 0)
-   rest(0);
+   rest(1);
 
   ticked --;
 
@@ -3203,12 +3206,13 @@
 //   textprintf_centre(menu_bmp, small_font, 320, 305, COLOUR_YELLOW8, "your time, like ");
    if (county2 > 99)
     textprintf_centre(menu_bmp, small_font, 320, 380, COLOUR_YELLOW5, "Press Space to continue.");
-   vsync();
+   if (options.run_vsync > 0)
+    vsync();
    blit(menu_bmp, screen, 0, 0, 0, 0, 640, 480);
   }
 
   while (ticked == 0)
-   rest(0);
+   rest(1);
   ticked --;
 
   county2 ++;


--- NEW FILE lacewing.desktop ---
[Desktop Entry]
Encoding=UTF-8
Name=Lacewing
GenericName=Asteroid like game
Comment=A cross between Spacewar and Centipede
Exec=lacewing
Icon=lacewing.png
Terminal=false
Type=Application
Categories=Game;ArcadeGame
Version=1.10


lacewing.patch:

--- NEW FILE lacewing.patch ---
diff -urN lacewing.orig/Makefile lacewing/Makefile
--- lacewing.orig/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ lacewing/Makefile	2006-01-20 13:14:27.000000000 +0100
@@ -0,0 +1,28 @@
+PREFIX  = /home/opt
+DATADIR = $(PREFIX)/share/$(TARGET)
+CFLAGS  = -g -Wall -O2
+LDFLAGS = `allegro-config --libs`
+DEFINES = -DDATADIR=\"$(DATADIR)/\"
+OBJS    = actor.o bullet.o cloud.o cmds.o displ_in.o display.o eclass.o \
+          enemy.o game.o input.o levels.o main.o menu.o palette.o pickup.o \
+          score.o ships.o sound.o stars.o stuff.o upgrades.o
+TARGET  = lacewing
+
+$(TARGET): $(OBJS)
+	$(CC) $(LDFLAGS) -o $@ $^
+
+%.o: %.c
+	$(CC) $(CFLAGS) $(DEFINES) -o $@ -c $<
+
+install: $(TARGET)
+	mkdir -p $(PREFIX)/bin
+	mkdir -p $(DATADIR)/gfx
+	mkdir -p $(DATADIR)/sound/ambi
+	install -p -m 755 $(TARGET) $(PREFIX)/bin
+	install -p -m 644 lacew.cfg $(DATADIR)
+	install -p -m 644 gfx/* $(DATADIR)/gfx
+	install -p -m 644 sound/*.wav $(DATADIR)/sound
+	install -p -m 644 sound/ambi/* $(DATADIR)/sound/ambi
+	
+clean:
+	rm -f $(OBJS) $(TARGET) *~
diff -urN lacewing.orig/config.h lacewing/config.h
--- lacewing.orig/config.h	2003-11-24 21:54:40.000000000 +0100
+++ lacewing/config.h	2006-01-20 14:34:10.000000000 +0100
@@ -37,6 +37,8 @@
 
 #define ATTACK_NONE -1
 
+#define MAX_FRAMESKIP 4
+
 struct armoury
 {
  char *name;
@@ -1067,3 +1069,13 @@
 
 
 
+/* compat defines */
+#include <stdio.h>
+
+#ifndef DATADIR
+#define DATADIR
+#endif
+
+#define PI M_PI
+#define itoa(integer, buf, bufsize) \
+ (snprintf(buf, bufsize, "%d", integer), buf)
diff -urN lacewing.orig/displ_in.c lacewing/displ_in.c
--- lacewing.orig/displ_in.c	2003-11-25 01:25:16.000000000 +0100
+++ lacewing/displ_in.c	2006-01-20 00:28:03.000000000 +0100
@@ -89,7 +89,7 @@
  RGB temp_palette [256];
  RGB temp_palette3 [1024];
 
- DATAFILE *datf = load_datafile("gfx\\data.dat");
+ DATAFILE *datf = load_datafile(DATADIR "gfx/data.dat");
  if (datf == NULL)
  {
   set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
@@ -107,7 +107,7 @@
  textprintf_centre(screen, font, 320, 200, COLOUR_GREEN8, "Loading}...");
  textprintf_centre(screen, font2, 320, 200, COLOUR_YELLOW8, "Loading}...");
 
- BITMAP *temp_bitmap = load_bitmap("gfx\\ship8_i.bmp", temp_palette);
+ BITMAP *temp_bitmap = load_bitmap(DATADIR "gfx/ship8_i.bmp", temp_palette);
  if (temp_bitmap == NULL)
  {
   bitmap_error("temp_bitmap");
@@ -205,7 +205,7 @@
 
 // Load in enemy bitmaps:
 
- temp_bitmap = load_bitmap("gfx\\enemy1.bmp", temp_palette);
+ temp_bitmap = load_bitmap(DATADIR "gfx/enemy1.bmp", temp_palette);
  if (temp_bitmap == NULL)
  {
   bitmap_error("temp_bitmap (enemy1.bmp not loaded correctly?)");
@@ -251,7 +251,7 @@
 
  destroy_bitmap(temp_bitmap);
 
- temp_bitmap = load_bitmap("gfx\\enemy3.bmp", temp_palette);
+ temp_bitmap = load_bitmap(DATADIR "gfx/enemy3.bmp", temp_palette);
  if (temp_bitmap == NULL)
  {
   bitmap_error("temp_bitmap (enemy3.bmp not loaded correctly?)");
@@ -273,7 +273,7 @@
  destroy_bitmap(temp_bitmap);
 // destroy_bitmap(temp_bitmap2);
 
- temp_bitmap = load_bitmap("gfx\\small1.bmp", temp_palette);
+ temp_bitmap = load_bitmap(DATADIR "gfx/small1.bmp", temp_palette);
  if (temp_bitmap == NULL)
  {
   bitmap_error("temp_bitmap (small1.bmp not loaded correctly?)");
@@ -287,7 +287,7 @@
  destroy_bitmap(temp_bitmap);
 
 
- temp_bitmap = load_bitmap("gfx\\small2.bmp", temp_palette);
+ temp_bitmap = load_bitmap(DATADIR "gfx/small2.bmp", temp_palette);
  if (temp_bitmap == NULL)
  {
   bitmap_error("temp_bitmap (small2.bmp not loaded correctly?)");
@@ -300,7 +300,7 @@
 
  destroy_bitmap(temp_bitmap);
 
- temp_bitmap = load_bitmap("gfx\\enemy2.bmp", temp_palette);
+ temp_bitmap = load_bitmap(DATADIR "gfx/enemy2.bmp", temp_palette);
  if (temp_bitmap == NULL)
  {
   bitmap_error("temp_bitmap (enemy2.bmp not loaded correctly?)");
@@ -313,7 +313,7 @@
 
  destroy_bitmap(temp_bitmap);
  
- temp_bitmap = load_bitmap("gfx\\lships.bmp", temp_palette);
+ temp_bitmap = load_bitmap(DATADIR "gfx/lships.bmp", temp_palette);
  if (temp_bitmap == NULL)
  {
   bitmap_error("temp_bitmap (lships.bmp not loaded correctly?)");
diff -urN lacewing.orig/display.c lacewing/display.c
--- lacewing.orig/display.c	2003-11-25 01:27:20.000000000 +0100
+++ lacewing/display.c	2006-01-20 14:32:31.000000000 +0100
@@ -53,7 +53,6 @@
 BITMAP *player2;
 //extern volatile int frames_per_second;
 extern volatile int ticked;
-extern int slacktime;
 
 extern struct optionstruct options;
 
@@ -3093,12 +3092,10 @@
 // textprintf(bmp, small_font, 20, 110, 5, "Xs %i  Ys %i  TS %f  DS %f  Drag %i",
 //  actor[player[play].actor_controlled].x_speed, actor[player[play].actor_controlled].y_speed, hypot(actor[player[play].actor_controlled].x_speed, actor[player[play].actor_controlled].y_speed), hypot(actor[player[play].actor_controlled].x_speed, actor[player[play].actor_controlled].y_speed) * game.drag, actor[player[play].actor_controlled].drag_amount);
 // textprintf(bmp, small_font, 20, 60, 5, "Stack %i", stackavail());
-// textprintf(bmp, small_font, 20, 90, 5, "Slack %i", slacktime);
 // textprintf(bmp, small_font, 20, 100, 5, "Lock %i", actor[0].lock);
 //textprintf(bmp, smallfont, 20, 50, 5, "Fps} %i", frames_per_second);
 /* textprintf(bmp, font, 20, 50, 5, "Fps} %i", frames_per_second);
  textprintf(bmp, font2, 20, 50, 5, "Fps} %i", frames_per_second);
- textprintf(bmp, font, 20, 80, 5, "Slack} %i", slacktime);
  textprintf(bmp, font, 20, 110, 5, "Xs} %i  Ys} %i  Drag} %i",
   actor[player[play].actor_controlled].x_speed, actor[player[play].actor_controlled].y_speed, actor[player[play].actor_controlled].drag_amount);
  textprintf(bmp, font, 20, 140, 5, "X} %i  Y} %i ",
@@ -3107,7 +3104,6 @@
   enemy[0].angle, enemy[0].attribute [ATTRIB_SWERVER_ANGLE], enemy[0].attacking, enemy[0].recycle);
  textprintf(bmp, font, 20, 200, 5, "Lock} %i ", actor[0].lock);*/
 /* textprintf(bmp, small_font, 20, 50, 5, "FPS %i", frames_per_second);
- textprintf(bmp, small_font, 20, 60, 5, "SLACK %i", slacktime);
  textprintf(bmp, small_font, 20, 70, 5, "XS %i  YS %i  DRAG %i",
   actor[player[play].actor_controlled].x_speed, actor[player[play].actor_controlled].y_speed, actor[player[play].actor_controlled].drag_amount);
  textprintf(bmp, small_font, 20, 80, 5, "X %i  Y %i ",
@@ -3128,10 +3124,11 @@
 
 void level_announcement(void)
 {
+ int frames_skipped = 0;
+ int waiting = 30;
 
  clear_bitmap(screen);
 
- int waiting = 30;
 
  if (arena.level == 1)
   waiting = 60;
@@ -3142,11 +3139,20 @@
 
  do
  {
-  while(ticked > 0)
+  while(ticked == 0)
+   rest(0);
+    
+  waiting--;
+  ticked--;
+
+  /* skip drawing if we can't keep up */
+  if (ticked && (frames_skipped < MAX_FRAMESKIP))
   {
-   waiting --;
-   ticked --;
-  };
+   frames_skipped++;
+   continue;
+  }
+  frames_skipped = 0;
+
   if ((waiting / 5) % 2 == 0)
   {
    textprintf_centre(screen, font, 320, 240, COLOUR_GREEN4 + (waiting / 2) % 4, "Get}  Ready}");
diff -urN lacewing.orig/game.c lacewing/game.c
--- lacewing.orig/game.c	2003-10-06 00:35:54.000000000 +0200
+++ lacewing/game.c	2006-01-20 14:32:11.000000000 +0100
@@ -64,12 +64,12 @@
 
 extern volatile unsigned char ticked;
 extern volatile int framecounter;
-extern int slacktime;
 
 
 void game_loop(void)
 {
  int playing = 1;
+ int frames_skipped = 0;
  
  counter = 0;
 
@@ -168,19 +168,20 @@
 
      
    }
-   
-  if (ticked == 0)
+
+  /* only draw if we can keepup */
+  if ( (ticked == 0) || (frames_skipped > MAX_FRAMESKIP))
   {
    run_display();
+   frames_skipped = 0;
 //   framecounter++;
   }
+  else
+   frames_skipped++;
+
+  while(ticked == 0)
+   rest(0);
 
-  slacktime = 0;
-  
-  do
-  {
-   slacktime ++;
-  } while(ticked == 0);
   ticked --;
 
   counter ++;
diff -urN lacewing.orig/main.c lacewing/main.c
--- lacewing.orig/main.c	2003-11-22 13:33:22.000000000 +0100
+++ lacewing/main.c	2006-01-20 14:03:49.000000000 +0100
@@ -96,11 +96,10 @@
 
 #include "allegro.h"
 
-#include <conio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <pc.h>
 #include <math.h>
+#include <stdio.h>
 
 #include "config.h"
 
@@ -150,17 +149,16 @@
 //volatile int framecounter;
 //volatile int frames_per_second;
 
-volatile int inputcounter = 0;
-volatile int inputs_per_second = 0;
+//volatile int inputcounter = 0;
+//volatile int inputs_per_second = 0;
 
-volatile int turncounter = 0;
-volatile int turns_per_second = 0;
+//volatile int turncounter = 0;
+//volatile int turns_per_second = 0;
 
 void tickover(void);
 
 volatile unsigned char ticked;
 //volatile unsigned char tick_counter;
-int slacktime;
 // --- end timer interupt
 
 
@@ -199,33 +197,13 @@
 
 int main(void)
 {
-
- cprintf("\n\rHello and welcome to Lacewing version 1.10!");
- cprintf("\n\rCopyright 2003 by Linley Henzell & Captain Pork.\n\r");
- cprintf("\n\rLacewing is free software published under the");
- cprintf("\n\rGeneral Public Licence. It can be modified and");
- cprintf("\n\rredistributed under certain conditions and comes");
- cprintf("\n\rwith no warranties of any kind.");
- cprintf("\n\rPlease read the LICENCE.TXT file for more information.\n\r");
- cprintf("\n\rPress Q to Quit, or any other key to continue...\n\r");
-
- char rkey;
-
- int randcount; // doesn't matter if it's not initialised - better, actually
-
- do
- {
-   randcount ++;
- }
-  while(kbhit() == 0);
-  
- rkey = getch();
- if (rkey == 'q' || rkey == 'Q')
-  return 0;
- if (rkey == 0)
-  getch();
-
- srandom(randcount);
+ printf("Hello and welcome to Lacewing version 1.10!");
+ printf("\nCopyright 2003 by Linley Henzell & Captain Pork.\n");
+ printf("\nLacewing is free software published under the");
+ printf("\nGeneral Public Licence. It can be modified and");
+ printf("\nredistributed under certain conditions and comes");
+ printf("\nwith no warranties of any kind.");
+ printf("\nPlease read the LICENCE.TXT file for more information.\n");
 
  init_at_startup();
 
@@ -242,9 +220,9 @@
 {
 
    allegro_init();
-
-   set_config_file("lacew.cfg");
    
+   init_config();
+
    install_keyboard();
    install_timer();
 
@@ -257,8 +235,8 @@
 //   LOCK_VARIABLE (tick_counter);
 //   LOCK_VARIABLE (frames_per_second);
 //   LOCK_VARIABLE (framecounter);
-   LOCK_VARIABLE (turns_per_second);
-   LOCK_VARIABLE (turncounter);
+//   LOCK_VARIABLE (turns_per_second);
+//   LOCK_VARIABLE (turncounter);
 //   LOCK_VARIABLE (inputs_per_second);
 //   LOCK_VARIABLE (inputcounter);
 
diff -urN lacewing.orig/menu.c lacewing/menu.c
--- lacewing.orig/menu.c	2003-11-25 01:53:04.000000000 +0100
+++ lacewing/menu.c	2006-01-20 14:33:30.000000000 +0100
@@ -138,7 +138,6 @@
 int option_index(void);
 void enter_keystroke(void);
 int option_jump(int direction);
-void init_config(void);
 void save_config(void);
 
 void choose_ships(void);
@@ -205,7 +204,6 @@
 void init_menus_once_only(void)
 {
  text_mode(-1);
- init_config();
 
  menu_bmp = create_bitmap(640, 480);
 
@@ -226,7 +224,7 @@
 
  RGB temp_palette [256];
 
- BITMAP *temp_bmp = load_bitmap("gfx\\title_i.bmp", temp_palette);
+ BITMAP *temp_bmp = load_bitmap(DATADIR "gfx/title_i.bmp", temp_palette);
 
  if (!temp_bmp)
  {
@@ -246,7 +244,7 @@
 
  destroy_bitmap(temp_bmp);
 
- temp_bmp = load_bitmap("gfx\\title_o.bmp", temp_palette);
+ temp_bmp = load_bitmap(DATADIR "gfx/title_o.bmp", temp_palette);
 
  if (!temp_bmp)
  {
@@ -266,7 +264,7 @@
 
  destroy_bitmap(temp_bmp);
 
- temp_bmp = load_bitmap("gfx\\title_s.bmp", temp_palette);
+ temp_bmp = load_bitmap(DATADIR "gfx/title_s.bmp", temp_palette);
 
  if (!temp_bmp)
  {
@@ -286,7 +284,7 @@
 
  destroy_bitmap(temp_bmp);
 
- upgrade_box1 = load_bitmap("gfx\\upg_box.bmp", temp_palette);
+ upgrade_box1 = load_bitmap(DATADIR "gfx/upg_box.bmp", temp_palette);
 
  if (!upgrade_box1)
  {
@@ -295,7 +293,7 @@
       exit(1);
  }
 
- upgrade_box2 = load_bitmap("gfx\\upg_box2.bmp", temp_palette);
+ upgrade_box2 = load_bitmap(DATADIR "gfx/upg_box2.bmp", temp_palette);
 
  if (!upgrade_box2)
  {
@@ -304,7 +302,7 @@
       exit(1);
  }
 
- upgrade_box3 = load_bitmap("gfx\\upg_box3.bmp", temp_palette);
+ upgrade_box3 = load_bitmap(DATADIR "gfx/upg_box3.bmp", temp_palette);
 
  if (!upgrade_box3)
  {
@@ -324,7 +322,8 @@
 
 void menu_loop(void)
 {
-
+ int frames_skipped = 0;
+ 
  which_menu = MENU_MAIN;
  menu_index_max = 4;
  menu_index_min = 0;
@@ -347,20 +346,21 @@
   if (which_menu == MENU_SCORES || which_menu == MENU_ENTER_SCORES)
    make_bouncies_move();
 
-  if (ticked == 0)
+  /* only draw if we can keepup */
+  if ( (ticked == 0) || (frames_skipped > MAX_FRAMESKIP))
   {
    clear_bitmap(menu_bmp);
    menu_display();
    blit(menu_bmp, screen, 0, 0, 0, 0, 640, 480);
+   frames_skipped = 0;
   }
+  else
+   frames_skipped++;
 
   menu_input();
 
-  slacktime = 0;
-  do
-  {
-   slacktime ++;
-  } while(ticked == 0);
+  while(ticked == 0)
+   rest(0);
   ticked --;
 
  } while(TRUE);
@@ -1431,8 +1431,6 @@
  game.single_player = 0;
  game.users = 1;
 
- int county = 0;
-
  int keypress_wait1 = KP_WAIT_SHORT;
  int keypress_wait2 = KP_WAIT_SHORT;
  int waiting = 5;
@@ -1577,10 +1575,8 @@
    blit(menu_bmp, screen, 0, 0, 0, 0, 640, 480);
   }
 
-  do
-  {
-   county ++;
-  } while (ticked == 0);
+  while (ticked == 0)
+   rest(0);
 
   ticked --;
 
@@ -2451,7 +2447,7 @@
 
       set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
 //      clrscr();
-      allegro_message("\n\rBye bye!                           ");
+//      allegro_message("\n\rBye bye!                           ");
 //      free(palet);
       exit(0);
 
@@ -2762,17 +2758,69 @@
 
 }
 
+/* Function(s) to find the homedir of a user under Unix */
+#ifdef __unix__
+#include <pwd.h>
+#include <unistd.h>
+#include <sys/types.h>
+#if defined(__DECC) && defined(VMS)
+#include <unixlib.h>
+static char *vms_to_unix_buffer = NULL;
+static int convert_vms_to_unix(char *vms_dir_name)
+{
+	vms_to_unix_buffer = vms_dir_name;
+}
+#endif
+
+/* 
+ * Locate user's home directory.
+ */
+char *get_home_dir(void)
+{
+	struct passwd *pw;
+
+	if (!(pw = getpwuid(getuid())))
+	{ 
+		fprintf(stderr, "Who are you? Not found in passwd database!!\n");
+		return NULL;
+	}
+
+#if defined(__DECC) && defined(VMS)
+	/* Convert The OpenVMS Formatted "$HOME" Directory Path Into Unix
+	   Format. */
+	decc$from_vms(pw->pw_dir, convert_vms_to_unix, 1);
+	return vms_to_unix_buffer;
+#else
+	return pw->pw_dir;
+#endif
+}
+#endif /* defined __unix__ */
+
 void init_config(void)
 {
-
-set_config_file("lacew.cfg");
-
-
  char miscstring [40];
  char wstring [40];
  char itstring [40];
  int i;
-
+#ifdef __unix__   
+ char config_file_name[512];
+ char *home_dir = get_home_dir();
+ int using_global_cfg = 1;
+   
+ snprintf(config_file_name, sizeof(config_file_name)/sizeof(char), "%s/.%s",
+  home_dir? home_dir:".", "lacew.cfg");
+      
+ /* does the cfg file exist? */
+ if (access(config_file_name, R_OK) == 0)
+ {
+  override_config_file(config_file_name);
+  using_global_cfg = 0;
+ }
+ else
+#endif   
+  override_config_file(DATADIR "lacew.cfg");
+  
+ srandom(get_config_int("Misc", "Seed", 0));
 
  options.sound_init = get_config_int("Options", "Sound_init", 1);
  options.sound_mode = get_config_int("Options", "Sound_mode", SOUNDMODE_STEREO);
@@ -2835,7 +2883,12 @@
   strcat(miscstring, itoa(i, itstring, 10));
   strcpy(hs_coop[i].name, get_config_string(wstring, miscstring, "CaptainP"));
  }
-
+#ifdef __unix__
+ /* make sure any changes get written to the per user file and not to
+    the global file */
+ if (using_global_cfg)
+  override_config_file(config_file_name);
+#endif
 }
 
 void save_config(void)
@@ -2845,6 +2898,8 @@
  char itstring [40];
  int i;
 
+ set_config_int("Misc", "Seed", random());
+
 // options.sound_init = get_config_int("Options", "Sound_init", 1);
  set_config_int("Options", "Sound_mode", options.sound_mode);
  set_config_int("Options", "Run_vsync", options.run_vsync);
@@ -3102,7 +3157,6 @@
 void display_victory_screen(void)
 {
 
- int county = 0;
  int county2 = 0;
 
  do
@@ -3128,11 +3182,8 @@
    blit(menu_bmp, screen, 0, 0, 0, 0, 640, 480);
   }
 
-  do
-  {
-   county ++;
-  } while (ticked == 0);
-
+  while (ticked == 0)
+   rest(0);
   ticked --;
 
   county2 ++;
diff -urN lacewing.orig/menu.h lacewing/menu.h
--- lacewing.orig/menu.h	2003-09-04 19:28:36.000000000 +0200
+++ lacewing/menu.h	2006-01-20 13:10:33.000000000 +0100
@@ -1,3 +1,5 @@
 void init_menus_once_only(void);
 
 void menu_loop(void);
+
+void init_config(void);
diff -urN lacewing.orig/ships.c lacewing/ships.c
--- lacewing.orig/ships.c	2003-09-04 20:51:46.000000000 +0200
+++ lacewing/ships.c	2006-01-18 22:10:54.000000000 +0100
@@ -55,7 +55,8 @@
 0, // system 3 status 2
 BRAKES_DRAG, // brake type
 5, // brake strength
-1000 // armour                   },
+1000 // armour
+},
 {
 "Arrow",
 6000, // radius
diff -urN lacewing.orig/sound.c lacewing/sound.c
--- lacewing.orig/sound.c	2003-10-06 22:22:16.000000000 +0200
+++ lacewing/sound.c	2006-01-20 00:33:01.000000000 +0100
@@ -41,7 +41,6 @@
 #include "config.h"
 #include "globvars.h"
 
-#include "conio.h"
 #include "math.h"
 //DATAFILE *soundf;
 
@@ -114,7 +113,7 @@
 
    
    sound_active = 1;
-
+   
    if (options.sound_init == 0)
    {
 //    cprintf("\n\r\n\rSound disabled in proj.cfg.");
@@ -128,12 +127,8 @@
    reserve_voices(10, 0);
    if (install_sound (DIGI_AUTODETECT, MIDI_AUTODETECT, NULL) == -1)
    {
-//    allegro_message("\n\r\n\rSound autodetect failed.");
+    printf("Warning: %s, sound disabled\n", allegro_error);
     sound_active = 0;
-    rest(300);
-    do
-    {
-    } while (keypressed() == 0);
    }
    set_volume(255, 0);
 
@@ -263,7 +258,7 @@
 
  char sfile_name [50];
 
- strcpy(sfile_name, ".\\sound\\");
+ strcpy(sfile_name, DATADIR "sound/");
  strcat(sfile_name, sfile);
  strcat(sfile_name, ".wav");
 
@@ -678,7 +673,7 @@
 
  char sfile_name [50];
 
- strcpy(sfile_name, ".\\sound\\ambi\\");
+ strcpy(sfile_name, DATADIR "sound/ambi/");
  strcat(sfile_name, sfile);
  strcat(sfile_name, ".wav");
 
diff -urN lacewing.orig/stars.c lacewing/stars.c
--- lacewing.orig/stars.c	2003-08-06 01:32:04.000000000 +0200
+++ lacewing/stars.c	2006-01-18 22:13:12.000000000 +0100
@@ -56,7 +56,7 @@
  int j = 0;
  int k = 1;
 
- if (game[0].users == 2)
+ if (game.users == 2)
   k = 2;
 
  for (j = 0; j < k; j ++)


--- NEW FILE lacewing.spec ---
Name:           lacewing
Version:        1.10
Release:        3%{?dist}
Summary:        Asteroid like game with many different ships
Group:          Amusements/Games
License:        GPL
URL:            http://users.olis.net.au/zel/
Source0:        http://users.olis.net.au/zel/lwsrc.zip
Source1:        http://users.olis.net.au/zel/lwdata.zip
Source2:        lacewing.desktop
Source3:        lacewing.png
Patch0:         lacewing.patch
Patch1:         lacewing-fullscreen.patch
Patch2:         lacewing-nicecpu.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  allegro-devel desktop-file-utils

%description
Asteroid like game where you can choose a type of ship and depending on the
type of ship can pickup a number of upgrades during the game.

Lacewing is an arcade-style shoot-em-up which plays a little bit like a cross
between Spacewar and Centipede. It has a decidedly retro style to it. It has
a single-player mode, and also co-operative and duel modes for two players
(split-screen).


%prep
%setup -q -c
unzip -qqo %{SOURCE1}
%patch0 -p1 -z .unix
%patch1 -p1 -z .fullscreen
%patch2 -p1 -z .nicecpu
%{__sed} -i 's/\r//' readme.txt licence.txt
chmod 644 readme.txt licence.txt


%build
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" PREFIX=%{_prefix}


%install
rm -rf $RPM_BUILD_ROOT
make install PREFIX=$RPM_BUILD_ROOT%{_prefix}

# below is the desktop file and icon stuff.
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor fedora            \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  --add-category X-Fedora                       \
  %{SOURCE2}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps
install -p -m 644 %{SOURCE3} \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps


%clean
rm -rf $RPM_BUILD_ROOT


%post
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%postun
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%files
%defattr(-,root,root,-)
%doc readme.txt licence.txt
%{_bindir}/lacewing
%{_datadir}/lacewing
%{_datadir}/applications/fedora-lacewing.desktop
%{_datadir}/icons/hicolor/48x48/apps/lacewing.png

%changelog
* Mon Jan 30 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 1.10-3
- Summary and Description text fixes (bz 178568)

* Sun Jan 22 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 1.10-2
- Some minor spec file cleanups (bz 178568):
  - use %%{_prefix} instead of /usr
  - use advised scriplets from the Wiki (use %%{_bindir}, || : )
  - run sed on doc files to convert DOS line-ends to UNIX ones
  - don't mark the default default settings file %%config as suggested
    in comment 5

* Sat Jan 21 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 1.10-1
- Initial Fedora Extras package


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/lacewing/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	30 Jan 2006 21:32:51 -0000	1.1
+++ .cvsignore	30 Jan 2006 21:34:11 -0000	1.2
@@ -0,0 +1,2 @@
+lwdata.zip
+lwsrc.zip


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/lacewing/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	30 Jan 2006 21:32:51 -0000	1.1
+++ sources	30 Jan 2006 21:34:11 -0000	1.2
@@ -0,0 +1,2 @@
+70040f8882414057a6243d8fb568a72f  lwdata.zip
+2de183840c0ec3603cc324c0b64fd856  lwsrc.zip




More information about the fedora-extras-commits mailing list