rpms/cylindrix/devel cylindrix-1.0-arch-independ-file-read.patch, NONE, 1.1 cylindrix-1.0-arch-independ-file-write.patch, NONE, 1.1 cylindrix-1.0-fix-packing.patch, NONE, 1.1 cylindrix-1.0-use-int-not-long.patch, NONE, 1.1 cylindrix.desktop, NONE, 1.1 cylindrix.png, NONE, 1.1 cylindrix.sh, NONE, 1.1 cylindrix.spec, NONE, 1.1 import.log, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Jon Ciesla (limb) fedora-extras-commits at redhat.com
Tue Jun 17 12:31:35 UTC 2008


Author: limb

Update of /cvs/pkgs/rpms/cylindrix/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30143/devel

Modified Files:
	.cvsignore sources 
Added Files:
	cylindrix-1.0-arch-independ-file-read.patch 
	cylindrix-1.0-arch-independ-file-write.patch 
	cylindrix-1.0-fix-packing.patch 
	cylindrix-1.0-use-int-not-long.patch cylindrix.desktop 
	cylindrix.png cylindrix.sh cylindrix.spec import.log 
Log Message:
Initial import.


cylindrix-1.0-arch-independ-file-read.patch:

--- NEW FILE cylindrix-1.0-arch-independ-file-read.patch ---
--- ai.c	2008-06-15 22:52:49.000000000 +0200
+++ ai.c	2008-06-15 22:53:07.000000000 +0200
@@ -19,7 +19,7 @@
 #include "ai.h"
 #include "keys.h" /* For get_keypress */
 #include "jonsb.h"
-
+#include <allegro/file.h>
 
 extern char g_DataPath[255];
 
@@ -210,29 +210,55 @@ void Init_AI( WorldStuff *world_stuff )
  
 } /* End of Init_AI */
 
+#define i386_character_type_size 660
+
+/* Read a character, which is a binary dump of struct character_type on i386
+   from disk, do this in an arch independent way.
+   
+   Note we use the same brillaint error handling as the original fread
+   call: none :) */
+void read_character(character_type *character, PACKFILE *fp)
+{
+   /* read all the strings at the beginning of the struct */
+   pack_fread(character, 40 + 15 + 7 * 80, fp);
+
+   /* skip 1 byte of padding + 7 * 4 byte pointers (yes pointers on disk,
+      yeah! */
+   pack_fseek(fp, 1 + 7 * 4);
+
+   /* read the state (enum == lsb int */
+   character->state = pack_igetl(fp);
+
+   /* and read the 9 unsigned chars at the end of the struct */
+   pack_fread(&character->passive_aggressive, 9, fp);
+
+   /* last skip 3 bytes of padding */
+   pack_fseek(fp, 3);
+}
+
 
 /* Load the ai file filename, and load in the ai_number'th character
    and store it in character */
 void Load_AI( character_type *character, char *filename, int ai_number )
     {
-     FILE *fp;
+     PACKFILE *fp;
 	char newfilename[512];
 
 	sprintf(newfilename,"%s%s",g_DataPath,filename);
 
-     if( (fp = fopen( newfilename, "rb" )) == NULL ) /* Open input file */
+     if( (fp = pack_fopen( newfilename, "r" )) == NULL ) /* Open input file */
          {
           printf("Error loading AI \n");
           exit_gracefully();
          }
 
      /* Move to the ai_number'th character in the file */
-     fseek( fp, sizeof( character_type ) * ai_number, SEEK_SET );
+     pack_fseek( fp, i386_character_type_size * ai_number);
       
      /* Read the data into character */
-     fread( character, sizeof( character_type ), 1, fp );
+     read_character(character, fp);
 
-     fclose( fp );
+     pack_fclose( fp );
 
           /* Load the samples for this ai */
           
--- fli.c	2008-06-15 22:52:49.000000000 +0200
+++ fli.c	2008-06-15 22:53:07.000000000 +0200
@@ -21,6 +21,7 @@
 #include "util.h" /* For exit_gracefully() */
 #include "timer.h"
 #include "keys.h"
+#include <allegro/file.h>
 
 extern char g_DataPath[255];
 
@@ -34,6 +35,8 @@ int current_frame;
 unsigned long first_frame = 0;
 unsigned long file_length = 0;
 
+#if 0
+
 /* Delta chunk is the most common type of chunk...
    it contains the changes in the image from the last
    frame */
@@ -375,11 +378,33 @@ void Play_Fli( char *filename )
      fclose( fp ); /* Close the file */
     }
 
-
+#endif
 
 /* Beginning of Ram based fli reading */
 
+static int read_intel_int32(unsigned char *file_buffer,
+  unsigned long *file_pos)
+{
+   int res;
+   
+   res  = file_buffer[(*file_pos)++];
+   res |= file_buffer[(*file_pos)++] << 8;
+   res |= file_buffer[(*file_pos)++] << 16;
+   res |= file_buffer[(*file_pos)++] << 24;
+
+   return res;
+}
+
+static short read_intel_int16(unsigned char *file_buffer,
+  unsigned long *file_pos)
+{
+   short res;
+
+   res  = file_buffer[(*file_pos)++];
+   res |= file_buffer[(*file_pos)++] << 8;
 
+   return res;
+}
 
 void Delta_Chunk_Ram( unsigned char *file_buffer, unsigned long *file_pos )
     {
@@ -397,19 +422,13 @@ void Delta_Chunk_Ram( unsigned char *fil
      
      unsigned char pixel_data;      /* One pixel to put on screen */
      unsigned long byte_count;       /* Index for loop             */
-     long x, y, i;
-     unsigned char *temp_buffer;
+     long x, y;
 
 
      /* Get the y position we start on */ 
-     temp_buffer = (unsigned char *)&lines_to_skip;
-     for( i = 0; i < sizeof( short ); i++ )
-         temp_buffer[i] = file_buffer[ (*file_pos)++ ];
+     lines_to_skip = read_intel_int16(file_buffer, file_pos);
      /* Get the number of lines encoded */
-     temp_buffer = (unsigned char *)&number_lines;
-     for( i = 0; i < sizeof( short ); i++ )
-         temp_buffer[i] = file_buffer[ (*file_pos)++ ];
-     
+     number_lines = read_intel_int16(file_buffer, file_pos);
 
      x = y = 0;
 
@@ -474,7 +493,6 @@ void Color_Chunk_Ram( unsigned char *fil
      unsigned short num_packets; 
      RGB_color color;
      
-     unsigned char *temp_buffer;
 
      /* Packet */
      unsigned char skip_count;
@@ -484,11 +502,7 @@ void Color_Chunk_Ram( unsigned char *fil
      long i, j;
      
 
-     temp_buffer = (unsigned char *)&num_packets;
-     for( i = 0; i < sizeof( unsigned short ); i++ )
-         {
-          temp_buffer[i] = file_buffer[ (*file_pos)++ ];
-         }
+     num_packets = read_intel_int16(file_buffer, file_pos);
 
      for( i = 0; i < num_packets; i++ )
          {
@@ -619,16 +633,9 @@ void Byte_Run_Chunk_Ram( unsigned char *
 int Read_Sub_Chunk_Ram( unsigned char *file_buffer, unsigned long *file_pos )
     {
      sub_chunk_header header;
-     long i;
-     unsigned char *temp_buffer;
 
-
-     temp_buffer = (unsigned char *)&header;
-
-     for( i = 0; i < sizeof(sub_chunk_header); i++ )
-         {
-          temp_buffer[i] = file_buffer[ (*file_pos)++ ];
-         }
+     header.chunk_size = read_intel_int32(file_buffer, file_pos);
+     header.chunk_type = read_intel_int16(file_buffer, file_pos);;
 
      if( header.chunk_type == 0xC )
          {
@@ -668,22 +675,17 @@ long Read_Chunk_Ram( unsigned char *file
      chunk_header header;
      long i;
      unsigned long pos;
-     unsigned char *temp_buffer;
-
-
-     /* Alias pointer to chunk header */
-     temp_buffer = (unsigned char *)&header;
 
      if( *file_pos >= file_length )
          return 0;
 
      pos = *file_pos;
 
-     /* Get chunk header from array */
-     for( i = 0; i < sizeof( chunk_header ); i++ )
-         {
-          temp_buffer[i] = file_buffer[ (*file_pos)++ ]; 
-         }
+     header.chunk_size = read_intel_int32(file_buffer, file_pos);
+     header.chunk_type = read_intel_int16(file_buffer, file_pos);
+     header.number_of_chunks = read_intel_int16(file_buffer, file_pos);
+     /* skip 8 reserved bytes */
+     (*file_pos) += 8;
 
      /* If there are subchunks */
      if( header.number_of_chunks > 0 )
@@ -709,6 +711,7 @@ long Read_Chunk_Ram( unsigned char *file
 
     } /* End of Read_Chunk_Ram */
 
+#if 0
 
 void Play_Fli_Ram( char *filename )
     {
@@ -912,8 +915,7 @@ void One_Frame( fli_file_type *fli_file 
 
     } /* End of One_Frame */
 
-
-
+#endif
 
 /* Size of buffer we load chunks of fli file into */
 #define FLI_BUFFER_SIZE 66000
@@ -927,6 +929,8 @@ typedef struct
     } fli_file_type;
 */
 
+#define i386_flic_header_size 128
+
 void Play_Fli_Buffered( char *filename )
     {
      unsigned char done = 0; /* Flag for the loop           */
@@ -940,6 +944,7 @@ void Play_Fli_Buffered( char *filename )
      int done_reading = 0; /* Flag to say we're done reading file */
      long i, temp;
    	char newfilename[512];
+   	unsigned char header_buf[i386_flic_header_size];
 
 	sprintf(newfilename,"%s%s",g_DataPath,filename);
 
@@ -956,7 +961,31 @@ void Play_Fli_Buffered( char *filename )
 		 return;
 
      /* Read the damm header */
-     fread( &header, sizeof( header ), 1, fp);
+     fread( header_buf, i386_flic_header_size, 1, fp);
+     
+     header.file_size        = read_intel_int32(header_buf, &file_pos);
+     header.file_id          = read_intel_int16(header_buf, &file_pos);
+     header.number_of_frames = read_intel_int16(header_buf, &file_pos);
+     header.width            = read_intel_int16(header_buf, &file_pos);
+     header.height           = read_intel_int16(header_buf, &file_pos);
+     header.pixel_depth      = read_intel_int16(header_buf, &file_pos);
+     header.flags            = read_intel_int16(header_buf, &file_pos);
+     header.frame_delay      = read_intel_int32(header_buf, &file_pos);
+     header.reserved1        = read_intel_int16(header_buf, &file_pos);
+     /* The following fields are set to zero in a .fli file */       
+     header.date_created = read_intel_int32(header_buf, &file_pos);
+     header.creator_sn   = read_intel_int32(header_buf, &file_pos);
+     header.last_updated = read_intel_int32(header_buf, &file_pos);
+     header.updater_sn   = read_intel_int32(header_buf, &file_pos);
+     header.x_aspect     = read_intel_int16(header_buf, &file_pos);
+     header.y_aspect     = read_intel_int16(header_buf, &file_pos);
+     /* skip 38 reserved bytes */
+     file_pos += 38;
+     header.frame1_offset = read_intel_int32(header_buf, &file_pos);
+     header.frame2_offset = read_intel_int32(header_buf, &file_pos);
+     /* skip 40 reserved bytes */
+     file_pos += 40;
+
 
      current_frame = 0;
 
@@ -982,6 +1011,7 @@ void Play_Fli_Buffered( char *filename )
      current_buffer = buffer_one;
      old_buffer     = buffer_two;
      
+     file_pos = 0;
      file_length = FLI_BUFFER_SIZE; /* Update global */
 
      Set_Timer(0);

--- level.c	2008-06-15 22:52:49.000000000 +0200
+++ level.c	2008-06-15 22:53:07.000000000 +0200
@@ -17,24 +17,96 @@
 */
 
 #include <stdio.h>
+#include <allegro/file.h>
 #include "level.h"
 
 extern char g_DataPath[255];
 
+/* Read a level, which is a binary dump of struct level_type on i386
+   from disk, do this in an arch independent way.
+   
+   Note we use the same brillaint error handling as the original fread
+   call: none :) */
+void read_level(level_type *level, PACKFILE *fp)
+{
+   union {
+      int i;
+      float f;
+   } u;
+   int i, j;
+
+   /* read all the strings at the beginning of the struct */
+   pack_fread(level, 9 * 40, fp);
+
+   /* read boolean wire_tube */
+   pack_fread(&level->wire_tube, 1, fp);
+   
+   /* skip 3 bytes of padding */
+   pack_fseek(fp, 3);
+
+   /* read the other members of the struct */
+   u.i = pack_igetl(fp);
+   level->angular_friction = u.f;
+
+   u.i = pack_igetl(fp);
+   level->surface_friction = u.f;
+
+   u.i = pack_igetl(fp);
+   level->air_friction = u.f;
+
+   level->yon_clipping_plane = pack_igetl(fp);
+
+   /* Orientation contains 9 floats, treat it as an array */
+   for (i = 0; i < 2; i++) {
+      float *f = (float *)(&level->base_orientations[i]);
+      for (j = 0; j < 9; j++) {
+         u.i = pack_igetl(fp);
+         f[j] = u.f;
+      }
+   }
+   
+   for (i = 0; i < 2; i++) {
+      float *f = (float *)(&level->turret_orientations[i]);
+      for (j = 0; j < 9; j++) {
+         u.i = pack_igetl(fp);
+         f[j] = u.f;
+      }
+   }
+
+   for (i = 0; i < 6; i++) {
+      float *f = (float *)(&level->vehicle_orientations[i]);
+      for (j = 0; j < 9; j++) {
+         u.i = pack_igetl(fp);
+         f[j] = u.f;
+      }
+   }
+
+   for (i = 0; i < NUM_GRADIENTS; i++) {
+      level->color_info.gradient[i].active = pack_getc(fp);
+      level->color_info.gradient[i].first = pack_getc(fp);
+      level->color_info.gradient[i].last = pack_getc(fp);
+      /* skip 1 byte of padding */ 
+      pack_fseek(fp, 1);
+      level->color_info.gradient[i].num_colors = pack_igetl(fp);
+   }
+   level->color_info.size = pack_igetl(fp);
+}
+
+
 int Load_Level( char *filename, level_type *level )
     {
-     FILE *fp;
+     PACKFILE *fp;
 	char newfilename[512];
 
 	sprintf(newfilename,"%s%s",g_DataPath,filename);
 
 
-     if( (fp = fopen( newfilename, "rb" )) == NULL )
+     if( (fp = pack_fopen( newfilename, "r" )) == NULL )
          return 0;
 
-     fread( level, sizeof(level_type), 1, fp );
+     read_level(level, fp);
 
-     fclose( fp );
+     pack_fclose( fp );
     
      return(1); /* Function was successful */
     }

--- pcx.c	2008-06-15 22:52:49.000000000 +0200
+++ pcx.c	2008-06-15 22:53:07.000000000 +0200
@@ -22,6 +22,7 @@
 
 #include "prim.h"
 
+#include <endian.h>
 #include <allegro.h>
 
 /* Allocate about 64k for image->buffer */
@@ -45,7 +46,7 @@ void PCX_Allocate( pcx_picture_ptr image
 
     } /* End of PCX_Allocate */
 
-
+#define swap_short(a) a = (((unsigned)(a)) >> 8) | (((unsigned)(a)) << 8)
 
 /* Function PCX load loads and uncompresses a PCX image into image->buffer
    And loads the palette into image->palette
@@ -79,6 +80,17 @@ void PCX_Load( char *filename, pcx_pictu
      fseek( fp, 0, SEEK_SET ); /* Move to beginning of file */
      fread( &image->header, sizeof( pcx_header ), 1, fp );
 
+#if __BYTE_ORDER == __BIG_ENDIAN
+     swap_short(image->header.xstart);
+     swap_short(image->header.ystart);
+     swap_short(image->header.xend);
+     swap_short(image->header.yend);
+     swap_short(image->header.horz_res);
+     swap_short(image->header.vert_res);
+     swap_short(image->header.bytes_per_line);
+     swap_short(image->header.palette_type);
+#endif
+
      /* Compute the width of the image in pixels  */
      image->xpixels = image->header.xend - image->header.xstart;
 

--- stats.c	2008-06-15 22:52:49.000000000 +0200
+++ stats.c	2008-06-15 22:53:07.000000000 +0200
@@ -21,6 +21,7 @@
 #include "keys.h"
 
 #include <stdio.h>
+#include <allegro/file.h>
 
 extern char g_DataPath[255];
 
@@ -274,24 +275,58 @@ int Save_Overall_Stats_Binary( overall_s
      return(1);
     } /* End of Save_Overall_Stats_Binary() */
 
+/* Read overal stats, which is a binary dump of overall_stats_type on i386
+   from disk, do this in an arch independent way.
+   
+   Note we use the same brillaint error handling as the original fread
+   call: none :) */
+void read_overall_stats(overall_stats_type *overall_stats, PACKFILE *fp)
+{
+   union {
+      int i;
+      float f;
+   } u;
+
+   pack_fread(overall_stats->name, 80, fp);
+   overall_stats->number_of_games = pack_igetl(fp);
+   overall_stats->victories = pack_igetl(fp);
+   overall_stats->defeats = pack_igetl(fp);
+
+   u.i = pack_igetl(fp);
+   overall_stats->win_percentage = u.f;
+
+   overall_stats->kills = pack_igetl(fp);
+   overall_stats->times_killed = pack_igetl(fp);
+   overall_stats->shots_fired = pack_igetl(fp);
+   overall_stats->enemy_hits = pack_igetl(fp);
+   overall_stats->friendly_hits = pack_igetl(fp);
+   overall_stats->misses = pack_igetl(fp);
+   overall_stats->times_hit = pack_igetl(fp);
+
+   u.i = pack_igetl(fp);
+   overall_stats->hit_percentage = u.f;
+
+   overall_stats->pylons_grabbed = pack_igetl(fp);
+}
+
 
 int Load_Overall_Stats_Binary( overall_stats_type *overall_stats, char *filename )
     {
-     FILE *fp;
+     PACKFILE *fp;
 	char newfilename[512];
 
 	sprintf(newfilename,"%s%s",g_DataPath,filename);
 
 
 
-     fp = fopen( newfilename, "rb" );
+     fp = pack_fopen( newfilename, "r" );
 
      if( fp == NULL )
          return(0);
 
-     fread( overall_stats, sizeof(overall_stats_type), 1, fp );
+     read_overall_stats(overall_stats, fp);
 
-     fclose(fp);
+     pack_fclose(fp);
 
      return(1);
     } /* End of Load_Overall_Stats_Binary() */

--- tanks.c	2008-06-15 22:52:49.000000000 +0200
+++ tanks.c	2008-06-15 22:53:07.000000000 +0200
@@ -22,12 +22,197 @@
 #include "tanks.h"
 #include "object.h"
 #include "collide.h"
+#include <allegro/file.h>
 
 extern char g_DataPath[255];
 
+/* Read a tank, which is a binary dump of struct Vehicle on i386
+   from disk, do this in an arch independent way.
+   
+   Note we use the same brillaint error handling as the original fread
+   call: none :) */
+void read_tank(Vehicle *tank, PACKFILE *fp)
+{
+    union {
+      int i;
+      float f;
+    } u;
+    float *f;
+    int i, *ip;
+
+    /* General information about this vehicle */
+
+    tank->vtype = pack_igetl(fp);
+    tank->team = pack_igetl(fp);
+    tank->vehicle_mode = pack_igetl(fp);
+    tank->alive = pack_igetw(fp);
+
+    /* skip 2 bytes of padding */
+    pack_fseek(fp, 2);
+
+    u.i = pack_igetl(fp);
+    tank->surface_rad = u.f;
+
+    /* Information about this vehicles 3d object */
+
+    /* skip 4 PointFace pointers */
+    pack_fseek(fp, 4 * 4);
+
+    /* BoundingBox contains 6 floats, treat it as an array of floats */
+    f = (float *)(&tank->box);
+    for (i = 0; i < 6; i++) {
+        u.i = pack_igetl(fp);
+        f[i] = u.f;
+    }
+
+    /* MagicBoundingBox contains 6 32 bit ints, treat it as an array of ints */
+    ip = (int *)(&tank->mbox);
+    for (i = 0; i < 6; i++) {
+        ip[i] = pack_igetl(fp);
+    }
+
+    /* skip EdgeTable edge pointer */
+    pack_fseek(fp, 4);
+
+    tank->collision_edges.edges = pack_igetl(fp);
+
+    /* Orientation contains 9 floats, treat it as an array */
+    f = (float *)(&tank->orient);
+    for (i = 0; i < 9; i++) {
+        u.i = pack_igetl(fp);
+        f[i] = u.f;
+    }
+
+    /* Information about this vehicles movement and rotation */
+
+    /* Float_Vector contains 3 floats, treat it as an array */
+    f = (float *)(&tank->vel);
+    for (i = 0; i < 3; i++) {
+        u.i = pack_igetl(fp);
+        f[i] = u.f;
+    }
+
+    u.i = pack_igetl(fp);
+    tank->air_forward_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->air_max_forward_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->air_inc_forward_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->air_max_sidestep_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->air_inc_sidestep_speed = u.f;
+
+    u.i = pack_igetl(fp);
+    tank->air_rise_rot_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->air_spin_rot_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->air_inc_rot_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->air_max_rot_speed = u.f;
+
+    u.i = pack_igetl(fp);
+    tank->surface_max_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->surface_inc_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->surface_inc_sidestep_speed = u.f;
+
+    u.i = pack_igetl(fp);
+    tank->surface_rot_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->surface_inc_rot_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->surface_max_rot_speed = u.f;
+
+    /* Information about this vehicles weapons */
+
+    /* skip 1 float pointer */
+    pack_fseek(fp, 4);
+
+    u.i = pack_igetl(fp);
+    tank->laser_speed = u.f;
+
+    tank->laser_life = pack_igetw(fp);
+    tank->laser_damage = pack_igetw(fp);
+    tank->laser_reload_time = pack_igetw(fp);
+    tank->frames_till_fire_laser = pack_igetw(fp);
+
+    u.i = pack_igetl(fp);
+    tank->missile_speed = u.f;
+    u.i = pack_igetl(fp);
+    tank->turning_angle = u.f;
+
+    tank->missile_life = pack_igetw(fp);
+    tank->missile_damage = pack_igetw(fp);
+    tank->missile_reload_time = pack_igetw(fp);
+    tank->frames_till_fire_missile = pack_igetw(fp);
+    tank->missile_generation_time = pack_igetw(fp);
+    tank->frames_till_new_missile = pack_igetw(fp);
+    tank->max_missile_storage = pack_igetw(fp);
+    tank->missiles_stored = pack_igetw(fp);
+
+    tank->max_projectiles = pack_igetw(fp);
+
+    /* skip 2 bytes pad + 1 Projectile pointer */
+    pack_fseek(fp, 6);
+
+    /* Information about this vehicles hitpoints */
+
+    tank->max_hitpoints = pack_igetl(fp);
+    tank->current_hitpoints = pack_igetl(fp);
+
+    tank->ramming_active = pack_igetw(fp);
+    tank->ramming_damage = pack_igetw(fp);
+
+    tank->double_lasers_active = pack_igetw(fp);
+
+    tank->mine_reload_time = pack_igetw(fp);
+    tank->mine_damage = pack_igetw(fp);
+    tank->mine_life = pack_igetw(fp);
+
+    tank->cs_missile_reload_time = pack_igetw(fp);
+    tank->cs_missile_life = pack_igetw(fp);
+
+    u.i = pack_igetl(fp);
+    tank->cs_missile_speed = u.f;
+
+    tank->controls_scrambled = pack_igetw(fp);
+    tank->frames_till_unscramble = pack_igetw(fp);
+    tank->scramble_life = pack_igetw(fp);
+
+    tank->traitor_missile_reload_time = pack_igetw(fp);
+    tank->traitor_missile_life = pack_igetw(fp);
+    /* skip 2 bytes pad */
+    pack_fseek(fp, 2);
+
+    u.i = pack_igetl(fp);
+    tank->traitor_missile_speed = u.f;
+
+    tank->traitor_life = pack_igetw(fp);
+    tank->traitor_active = pack_igetw(fp);
+    tank->frames_till_traitor_deactivate = pack_igetw(fp);
+
+    tank->anti_missile_active = pack_igetw(fp);
+
+    tank->cloaking_active = pack_igetw(fp);
+    tank->cloak_reload_time = pack_igetw(fp);
+    tank->frames_till_cloak = pack_igetw(fp);
+    tank->cloak_time = pack_igetw(fp);
+    tank->frames_till_cloak_suck = pack_igetw(fp);
+
+    tank->decoy_life = pack_igetw(fp);
+    tank->decoy_reload_time = pack_igetw(fp);
+    /* skip 2 bytes pad */
+    pack_fseek(fp, 2);
+}
+
+#define i386_Vehicle_size 316
+
 void Load_Tank( Vehicle *tank, enum VehicleType tank_type )
     {
-     FILE *fp;
+     PACKFILE *fp;
 
 	char newfilename[512];
 
@@ -35,16 +220,16 @@ void Load_Tank( Vehicle *tank, enum Vehi
 
 
 
-     if( (fp = fopen( newfilename, "rb" )) == NULL ) {
+     if( (fp = pack_fopen( newfilename, "r" )) == NULL ) {
          printf( "Load_Tank() : fopen failed\n" );
          Get_Keypress();
          exit_gracefully();
      }
 
-     fseek( fp, sizeof( Vehicle ) * tank_type, SEEK_SET );
-     fread( tank, sizeof( Vehicle ), 1, fp );
+     pack_fseek( fp, i386_Vehicle_size * tank_type );
+     read_tank( tank, fp );
 
-     fclose( fp );
+     pack_fclose( fp );
 
     } /* End of Load_Tank */
 

cylindrix-1.0-arch-independ-file-write.patch:

--- NEW FILE cylindrix-1.0-arch-independ-file-write.patch ---
--- config.c	2003-09-17 20:52:02.000000000 +0200
+++ config.c	2008-06-16 21:28:03.000000000 +0200
@@ -441,7 +441,7 @@ void Save_Game_Configuration( game_confi
 	sprintf(newfilename,"%sgamedata/game.cfg",g_DataPath);
 
 
-     fp = fopen( newfilename, "r" );
+     fp = fopen( newfilename, "w" );
 
 
      switch( game_configuration->serial_com_port )

--- menu.c	2008-06-16 21:28:03.000000000 +0200
+++ menu.c	2008-06-16 21:29:49.000000000 +0200
@@ -25,6 +25,7 @@
 */
 
 #include <string.h>
+#include <ctype.h>
 #include "menu.h"
 #include "types.h"
 #include "prim.h"
@@ -7670,7 +7671,7 @@ void view_stats_menu_return_key()
         
         for( i = 0; i < 1000; i++ ) {
         
-            sprintf( filename, "%sSTATS/OVER%03d.TXT", g_DataPath, i );
+            sprintf( filename, "%sstats/over%03d.txt", g_DataPath, i );
             
             if( (fp = fopen( filename, "r" ) ) == NULL ) {
             
@@ -7696,6 +7697,10 @@ void view_stats_menu_return_key()
                      menu_stuff.menu_text.xpixels + 1,
                      menu_stuff.menu_text.ypixels + 1, SELECTED_TEXT_COLOR );
                      
+        /* string_blit cannot display lowercase text!! */
+        for (i = 0; filename[i]; i++)
+          filename[i] = toupper(filename[i]);
+
         string_blit( filename, 75, 85,
                      menu_stuff.menu_text.buffer,
                      menu_stuff.menu_text.xpixels + 1,
@@ -9822,7 +9827,7 @@ void custom_game_stat_menu_return_key()
         
         for( i = 0; i < 1000; i++ ) {
                 
-            sprintf( filename, "%sSTATS/CUST%03d.TXT", g_DataPath, i );
+            sprintf( filename, "%sstats/cust%03d.txt", g_DataPath, i );
             
             if( (fp = fopen( filename, "r" ) ) == NULL ) {
             
@@ -9848,6 +9853,10 @@ void custom_game_stat_menu_return_key()
                      menu_stuff.menu_text.xpixels + 1,
                      menu_stuff.menu_text.ypixels + 1, SELECTED_TEXT_COLOR );
                      
+        /* string_blit cannot display lowercase text!! */
+        for (i = 0; filename[i]; i++)
+          filename[i] = toupper(filename[i]);
+
         string_blit( filename, 75, 85,
                      menu_stuff.menu_text.buffer,
                      menu_stuff.menu_text.xpixels + 1,
@@ -10234,7 +10243,7 @@ void tournament_game_stat_menu_return_ke
         
         for( i = 0; i < 1000; i++ ) {
                 
-            sprintf( filename, "%sSTATS/TOUR%03d.TXT", g_DataPath, i );
+            sprintf( filename, "%sstats/tour%03d.txt", g_DataPath, i );
             
             if( (fp = fopen( filename, "r" ) ) == NULL ) {
             
@@ -10260,6 +10269,10 @@ void tournament_game_stat_menu_return_ke
                      menu_stuff.menu_text.xpixels + 1,
                      menu_stuff.menu_text.ypixels + 1, SELECTED_TEXT_COLOR );
                      
+        /* string_blit cannot display lowercase text!! */
+        for (i = 0; filename[i]; i++)
+          filename[i] = toupper(filename[i]);
+
         string_blit( filename, 75, 85,
                      menu_stuff.menu_text.buffer,
                      menu_stuff.menu_text.xpixels + 1,

--- stats.c	2008-06-16 21:28:03.000000000 +0200
+++ stats.c	2008-06-16 21:28:03.000000000 +0200
@@ -254,23 +254,57 @@ int Save_Overall_Stats_Text( overall_sta
 } /* End of Save_Overall_Stats_Text() */
 
 
+/* Write overal stats as a binary dump of overall_stats_type on i386,
+   do this in an arch independent way.
+   
+   Note we use the same brillaint error handling as the original fwrite
+   call: none :) */
+void write_overall_stats(overall_stats_type *overall_stats, PACKFILE *fp)
+{
+   union {
+      int i;
+      float f;
+   } u;
+
+   pack_fwrite(overall_stats->name, 80, fp);
+   pack_iputl(overall_stats->number_of_games, fp);
+   pack_iputl(overall_stats->victories, fp);
+   pack_iputl(overall_stats->defeats, fp);
+
+   u.f = overall_stats->win_percentage;
+   pack_iputl(u.i, fp);
+
+   pack_iputl(overall_stats->kills, fp);
+   pack_iputl(overall_stats->times_killed, fp);
+   pack_iputl(overall_stats->shots_fired, fp);
+   pack_iputl(overall_stats->enemy_hits, fp);
+   pack_iputl(overall_stats->friendly_hits, fp);
+   pack_iputl(overall_stats->misses, fp);
+   pack_iputl(overall_stats->times_hit, fp);
+
+   u.f = overall_stats->hit_percentage;
+   pack_iputl(u.i, fp);
+
+   pack_iputl(overall_stats->pylons_grabbed, fp);
+}
+
 int Save_Overall_Stats_Binary( overall_stats_type *overall_stats, char *filename )
     {
-     FILE *fp;
+     PACKFILE *fp;
 	char newfilename[512];
 
 	sprintf(newfilename,"%s%s",g_DataPath,filename);
 
 
 
-     fp = fopen( newfilename, "wb" );
+     fp = pack_fopen( newfilename, "w" );
 
      if( fp == NULL )
          return(0);
 
-     fwrite( overall_stats, sizeof(overall_stats_type), 1, fp );
+     write_overall_stats( overall_stats, fp );
 
-     fclose(fp);
+     pack_fclose(fp);
 
      return(1);
     } /* End of Save_Overall_Stats_Binary() */

cylindrix-1.0-fix-packing.patch:

--- NEW FILE cylindrix-1.0-fix-packing.patch ---
--- jonipx.h	2001-12-18 21:08:44.000000000 +0100
+++ jonipx.h	2008-06-15 11:05:20.000000000 +0200
@@ -25,7 +25,7 @@
 /* #define __LINUX__ */
 /* Only use linux specific __attribute__ tag on Linux */
 #ifndef PACKED_STRUCT 
-	#ifdef __LINUX__
+	#ifdef __linux__
 		#define PACKED_STRUCT __attribute__((packed))
 	#else
 		#define PACKED_STRUCT 
@@ -89,27 +89,27 @@
 
 typedef struct 
     {                                                        
-     net_type          net           PACKED_STRUCT;  /* Network address */
-     node_address_type node_address  PACKED_STRUCT;  /* Node address */
+     net_type          net                        ;  /* Network address */
+     node_address_type node_address               ;  /* Node address */
      unsigned short    socket        PACKED_STRUCT;  /* Big endian socket number */
     } net_address_type;
 
 typedef struct
     {
-     net_type           net          PACKED_STRUCT; /* My network address */
-     node_address_type  node_address PACKED_STRUCT; /* My node address */
+     net_type           net                       ; /* My network address */
+     node_address_type  node_address              ; /* My node address */
     } local_address_type;
 
 typedef struct
     {
      address_type      link              PACKED_STRUCT; /* Pointer to next ECB */
      unsigned long     ESR               PACKED_STRUCT; /* Event service routine 00000000h if none */
-     unsigned char     in_use            PACKED_STRUCT; /* In use flag */
-     unsigned char     complete          PACKED_STRUCT; /* Completing flag */
+     unsigned char     in_use                         ; /* In use flag */
+     unsigned char     complete                       ; /* Completing flag */
      unsigned short    socket            PACKED_STRUCT; /* Big endian socket number */
-     unsigned char     IPX_work[4]       PACKED_STRUCT; /* IPX work space */
-     unsigned char     D_work[12]        PACKED_STRUCT; /* Driver work space */
-     node_address_type immediate_address PACKED_STRUCT; /* Immediate local node address */
+     unsigned char     IPX_work[4]                    ; /* IPX work space */
+     unsigned char     D_work[12]                     ; /* Driver work space */
+     node_address_type immediate_address              ; /* Immediate local node address */
      unsigned short    fragment_count    PACKED_STRUCT; /* Fragment count */
      unsigned long     fragment_data     PACKED_STRUCT; /* Pointer to data fragment */
      unsigned short    fragment_size     PACKED_STRUCT; /* Size of data fragment */
@@ -119,19 +119,19 @@
     {
      unsigned short   checksum          PACKED_STRUCT;   /* Big endian checksum */
      unsigned short   length            PACKED_STRUCT;   /* Big endian length in bytes */
-     unsigned char    transport_control PACKED_STRUCT;   /* Transport control */
-     unsigned char    packet_type       PACKED_STRUCT;   /* Packet type */
-     net_address_type destination       PACKED_STRUCT;   /* Destination network address */
-     net_address_type source            PACKED_STRUCT;   /* Source network address */
+     unsigned char    transport_control              ;   /* Transport control */
+     unsigned char    packet_type                    ;   /* Packet type */
+     net_address_type destination                    ;   /* Destination network address */
+     net_address_type source                         ;   /* Source network address */
     } IPX_header_type;
 
 
 
 typedef struct
     {
-     ECB_type        ecb         PACKED_STRUCT;
-     IPX_header_type ipx_header  PACKED_STRUCT;
-     string_type     string      PACKED_STRUCT;
+     ECB_type        ecb;
+     IPX_header_type ipx_header;
+     string_type     string;
     } packet_type;
 
 
--- fli.h	2001-12-18 21:08:44.000000000 +0100
+++ fli.h	2008-06-15 10:42:13.000000000 +0200
@@ -54,10 +54,10 @@
      unsigned long  updater_sn    PACKED_STRUCT; /* Serial number of updater prog   */
      unsigned short x_aspect      PACKED_STRUCT; /* X of display aspect ratio       */
      unsigned short y_aspect      PACKED_STRUCT; /* Y of display aspect ratio       */
-     char           reserved2[38] PACKED_STRUCT; /* Not used (set to 0x00)          */
+     char           reserved2[38];               /* Not used (set to 0x00)          */
      unsigned long  frame1_offset PACKED_STRUCT; /* Offset of first frame           */
      unsigned long  frame2_offset PACKED_STRUCT; /* Offset of second frame          */
-     char           reserved3[40] PACKED_STRUCT; /* Not used (set to 0x00)          */
+     char           reserved3[40];               /* Not used (set to 0x00)          */
     } flic_header;
 
 
@@ -66,7 +66,7 @@
      unsigned long  chunk_size       PACKED_STRUCT; /* Total size of the chunk */
      unsigned short chunk_type       PACKED_STRUCT; /* Chunk identifier */
      unsigned short number_of_chunks PACKED_STRUCT; /* Number of subchunks in this chunk */
-     char           reserved[8]      PACKED_STRUCT; /* Not used (set to 0x00 ) */
+     char           reserved[8];                    /* Not used (set to 0x00 ) */
     } chunk_header;
 
 typedef struct
--- packets.h	2001-12-18 21:08:45.000000000 +0100
+++ packets.h	2008-06-15 10:42:58.000000000 +0200
@@ -77,13 +77,13 @@
 
 typedef struct
     {
-     unsigned char vehicle_one   PACKED_STRUCT;
-     unsigned char vehicle_two   PACKED_STRUCT;
-     unsigned char vehicle_three PACKED_STRUCT;
-     unsigned char wingman_one   PACKED_STRUCT;
-     unsigned char wingman_two   PACKED_STRUCT;
-     unsigned char wingman_three PACKED_STRUCT;
-     string   cylinder_filename  PACKED_STRUCT;
+     unsigned char vehicle_one;
+     unsigned char vehicle_two;
+     unsigned char vehicle_three;
+     unsigned char wingman_one;
+     unsigned char wingman_two;
+     unsigned char wingman_three;
+     string   cylinder_filename;
     } game_info_type;
 
 
--- types.h	2003-04-30 16:27:18.000000000 +0200
+++ types.h	2008-06-15 22:35:00.000000000 +0200
@@ -44,7 +44,7 @@
 
 /* #define __LINUX__ */
 /* Only use linux specific __attribute__ tag on Linux */
-#ifdef __LINUX__
+#ifdef __linux__
 	#define PACKED_STRUCT __attribute__((packed))
 #else
 	#define PACKED_STRUCT 
@@ -188,21 +188,21 @@
 
 /* The packed is so we can read in the header using sizeof header */
 typedef struct pcx_header_typ {
-    unsigned char manufacturer    PACKED_STRUCT;
-    unsigned char version         PACKED_STRUCT;
-    unsigned char encoding        PACKED_STRUCT;
-    unsigned char bits_per_pixel  PACKED_STRUCT;
+    unsigned char manufacturer;
+    unsigned char version;
+    unsigned char encoding;
+    unsigned char bits_per_pixel;
     unsigned short xstart,ystart  PACKED_STRUCT;
     unsigned short xend, yend     PACKED_STRUCT;
     unsigned short horz_res       PACKED_STRUCT;
     unsigned short vert_res       PACKED_STRUCT;
-    unsigned char ega_palette[48] PACKED_STRUCT;
-    unsigned char reserved        PACKED_STRUCT;
-    unsigned char num_bit_planes  PACKED_STRUCT;
+    unsigned char ega_palette[48];
+    unsigned char reserved;
+    unsigned char num_bit_planes;
     unsigned short bytes_per_line PACKED_STRUCT;
     unsigned short palette_type   PACKED_STRUCT;
-    unsigned char padding[58]     PACKED_STRUCT;
-} pcx_header, *pcx_header_ptr;
+    unsigned char padding[58];
+} PACKED_STRUCT pcx_header, *pcx_header_ptr;
 
 
 typedef struct pcx_picture_typ { /* Structure to hold a PCX picture */

cylindrix-1.0-use-int-not-long.patch:

--- NEW FILE cylindrix-1.0-use-int-not-long.patch ---
--- ai_util.c	2003-04-30 16:27:17.000000000 +0200
+++ ai_util.c	2008-06-15 23:02:37.000000000 +0200
@@ -141,7 +141,7 @@
 {
     Point u_point3d, position;
     Point2d u_point2d, position2d, u, v, v_point2d;
-    long dx, dy, len, result, u_theta, v_theta;
+    int dx, dy, len, result, u_theta, v_theta;
     float temp;
 
     position[X] = rounding_ftom( o->position[X] );
@@ -300,7 +300,7 @@
 
 void center( Point2d center, Point2d point, Point2d new_point )
 {
-    long x_shift;
+    int x_shift;
 
     x_shift = point[X] + MAGIC_CYLINDER_CENTER - center[X];
 
@@ -321,7 +321,7 @@
 float Point_Distance_2D( Float_Point2d point, Float_Point2d position )
 {
     Point2d p, q, new_p, new_q;
-    long x, y;
+    int x, y;
     float temp;
 
     p[X] = rounding_ftom( position[X] );
@@ -406,7 +406,7 @@
 
 int fixed_ill2( Point2d p1, Point2d p2, Point2d q1, Point2d q2, Point2d v )
 {
-    long mu, delta, lambda;
+    int mu, delta, lambda;
     Point2d v1, v2, v3, v4;
 
     v[X] = 0;
@@ -458,9 +458,9 @@
 
 int Old_Is_Visible_2D( Float_Point2d point, Float_Point2d position, Pylons *pylons )
 {
-    long i, pos_x;
+    int i, pos_x;
     Point2d p1, p2, inter, p, q;
-    long x_shift, min_x, max_x;
+    int x_shift, min_x, max_x;
 
     pos_x = rounding_ftom( position[X] );
 
@@ -591,9 +591,9 @@
 
 */
 
-long CompOutCode( Float_Point2d p, BoundingBox2d *box )
+int CompOutCode( Float_Point2d p, BoundingBox2d *box )
 {
-    long outcode;
+    int outcode;
 
     outcode = 0;
 
@@ -616,11 +616,11 @@
 /* Detects whether or not a ray and a 2d bounding box intersect.  It uses
    a hacked version of Cohen-Sutherland line clipping algorithm */
 
-long ray_bounding_box_intersect_2d( Float_Point2d start, Float_Point2d end,
+int ray_bounding_box_intersect_2d( Float_Point2d start, Float_Point2d end,
                                     BoundingBox2d *box )
 {
-    long accept, done;
-    long outcode0, outcode1, outcodeOut;
+    int accept, done;
+    int outcode0, outcode1, outcodeOut;
     Float_Point2d p0, p1;
     float x = 0.0, y = 0.0;
 
@@ -694,7 +694,7 @@
     Float_Point2d p, q;
     float x_shift, min_x, max_x;
     BoundingBox2d box, ray_box;
-    long i;
+    int i;
 
 
     p[X] = 31.5;
@@ -807,7 +807,7 @@
 
 void iCylinder_x_y( Point point, Point2d point2d )
 {
-    long theta, radius, temp;
+    int theta, radius, temp;
 
     /* find the radius of point w.r.t. the x-y plane */
 
@@ -866,7 +866,7 @@
 void Cylinder_x_y( Float_Point point, Float_Point2d point2d )
 {
     Point2d ipoint2d;
-    long theta, radius, temp;
+    int theta, radius, temp;
 
     ipoint2d[X] = rounding_ftom( point[X] );
     ipoint2d[Y] = rounding_ftom( point[Y] );
@@ -1004,10 +1004,10 @@
 int Is_Visible_3D( Float_Point point, Float_Point pos, Pylons *pylons )
 {
     BoundingBox ray_box;
-    long vert[2][3];
+    int vert[2][3];
     EdgeTable et;
-    long edge[1][2];
-    long dummy, i;
+    int edge[1][2];
+    int dummy, i;
 
 
     /* build the EdgeTable */
@@ -1337,7 +1337,7 @@
     Float_Point2d p, q;
     float x_shift, min_x, max_x;
     BoundingBox2d box, ray_box;
-    long i;
+    int i;
 
 
     p[X] = 31.5;
@@ -1443,10 +1443,10 @@
 int Is_Visible_3D_Pylon( Float_Point point, Float_Point pos, Pylons *pylons, int pylon_index )
 {
     BoundingBox ray_box;
-    long vert[2][3];
+    int vert[2][3];
     EdgeTable et;
-    long edge[1][2];
-    long dummy, i;
+    int edge[1][2];
+    int dummy, i;
 
 
     /* build the EdgeTable */
@@ -1742,9 +1742,9 @@
     } /* End of Point_Square_3D */
 
 
-void update_leader( long view_vehicle )
+void update_leader( int view_vehicle )
     {
-     long i;
+     int i;
      boolean blue_leader_picked = FALSE;
      boolean red_leader_picked = FALSE;
 

--- ai_util.h	2001-12-18 21:08:43.000000000 +0100
+++ ai_util.h	2008-06-15 23:02:38.000000000 +0200
@@ -111,7 +111,7 @@
  
 int Find_Bullet_Owner( Projectile *p );
 
-void update_leader( long view_vehicle );
+void update_leader( int view_vehicle );
 
 int Decoys_Active( WorldStuff *world_stuff, int index );
 

--- base.c	2003-04-30 16:27:17.000000000 +0200
+++ base.c	2008-06-15 23:02:37.000000000 +0200
@@ -66,7 +66,7 @@
 
 void init_red_radar_base( RadarBase *red_base )
 {
-    long i;
+    int i;
 
     red_base->team = RED_TEAM;
 
@@ -262,7 +262,7 @@
 
 void init_blue_radar_base( RadarBase *blue_base )
 {
-    long i;
+    int i;
 
     blue_base->team = BLUE_TEAM;
 
@@ -462,7 +462,7 @@
 void move_base_projectiles_forward( RadarBase *base, Pylons *pylons, Player *player )
 {
     Projectile *p, *last;
-    long face_index;
+    int face_index;
     Orientation o;
     Vehicle v; /* Hack Alert */
 
@@ -999,7 +999,7 @@
 {
     Float_Vector new_front, axis, temp;
     float theta, len, min_len, foo;
[...5554 lines suppressed...]
     else {
 
-	long d_theta; /* number of radians each color in the gradient sweeps
+	int d_theta; /* number of radians each color in the gradient sweeps
 			 through */
 
-	long theta;   /* angle of face to light source (arccos(dotprod)) */
-	long i;
+	int theta;   /* angle of face to light source (arccos(dotprod)) */
+	int i;
 
 	theta = iarccos( dotprod << 3 );
 
@@ -247,17 +247,17 @@
    source.  This function finds the color based the angle of the light souce
    and the distance from the light source. */
 
-unsigned char distance_diffuse_shade( long dotprod, long distance, Gradient gradient )
+unsigned char distance_diffuse_shade( int dotprod, int distance, Gradient gradient )
 {
     unsigned char num_colors = world_stuff.color_info.gradient[gradient].num_colors;
     unsigned char offset = world_stuff.color_info.gradient[gradient].first;
-    long d_theta; /* number of radians each color in the gradient sweeps
+    int d_theta; /* number of radians each color in the gradient sweeps
 		     through */
-    long theta;   /* angle of face to light source (arccos(dotprod)) */
-    long i;
-    long max_distance = ((((25 << MEXP) << MEXP) / -5120) * level.yon_clipping_plane) >> MEXP;
-    long factor = ((num_colors << MEXP) << MEXP) / max_distance; /* (num_colors / max_distance) */
-    long shade;
+    int theta;   /* angle of face to light source (arccos(dotprod)) */
+    int i;
+    int max_distance = ((((25 << MEXP) << MEXP) / -5120) * level.yon_clipping_plane) >> MEXP;
+    int factor = ((num_colors << MEXP) << MEXP) / max_distance; /* (num_colors / max_distance) */
+    int shade;
 
     dotprod = (dotprod >> 1) + 512 + 50; /* shading hack to make things brighter */
 
@@ -301,17 +301,17 @@
 }
 
 
-unsigned char vehicle_menu_distance_diffuse_shade( long dotprod, long distance, Gradient gradient )
+unsigned char vehicle_menu_distance_diffuse_shade( int dotprod, int distance, Gradient gradient )
 {
     unsigned char num_colors = 64;
     unsigned char offset = 5;
-    long d_theta; /* number of radians each color in the gradient sweeps
+    int d_theta; /* number of radians each color in the gradient sweeps
 		     through */
-    long theta;   /* angle of face to light source (arccos(dotprod)) */
-    long i;
-    long max_distance = ((((25 << MEXP) << MEXP) / -5120) * level.yon_clipping_plane) >> MEXP;
-    long factor = ((num_colors << MEXP) << MEXP) / max_distance; /* (num_colors / max_distance) */
-    long shade;
+    int theta;   /* angle of face to light source (arccos(dotprod)) */
+    int i;
+    int max_distance = ((((25 << MEXP) << MEXP) / -5120) * level.yon_clipping_plane) >> MEXP;
+    int factor = ((num_colors << MEXP) << MEXP) / max_distance; /* (num_colors / max_distance) */
+    int shade;
 
     dotprod = (dotprod >> 1) + 512 + 50; /* shading hack to make things brighter */
 
@@ -358,12 +358,12 @@
 /* Finds the actual color of a pixel that is some distance away from the
    light soruce. */
 
-unsigned char tube_shade( long distance, Gradient gradient )
+unsigned char tube_shade( int distance, Gradient gradient )
 {
     unsigned char num_colors = world_stuff.color_info.gradient[gradient].num_colors;
     unsigned char offset = world_stuff.color_info.gradient[gradient].first;
-    long shade;
-    long factor = ((num_colors << MEXP) << MEXP) / level.yon_clipping_plane; /* (num_colors / max_distance) */
+    int shade;
+    int factor = ((num_colors << MEXP) << MEXP) / level.yon_clipping_plane; /* (num_colors / max_distance) */
 
     if( num_colors == 1 ) {
 	return offset;
@@ -382,12 +382,12 @@
     }
 }
 
-unsigned char radar_tube_shade( long distance, Gradient gradient )
+unsigned char radar_tube_shade( int distance, Gradient gradient )
 {
-    long num_colors = world_stuff.color_info.gradient[gradient].num_colors;
-    long offset = world_stuff.color_info.gradient[gradient].first;
-    long shade;
-    long factor = (num_colors << MEXP) / 4;
+    int num_colors = world_stuff.color_info.gradient[gradient].num_colors;
+    int offset = world_stuff.color_info.gradient[gradient].first;
+    int shade;
+    int factor = (num_colors << MEXP) / 4;
 
     distance -= (3 << MEXP);
 
@@ -722,13 +722,13 @@
     printf("  vel      = (%.25f,%.25f,%.25f)\n", v->vel[X], v->vel[Y], v->vel[Z] );
 }
 
-void print_player_info( Player *p, long frame )
+void print_player_info( Player *p, int frame )
 {
-    printf("%ld  position = (%.25f,%.25f,%.25f)\n", frame, p->tank.orient.position[X], p->tank.orient.position[Y], p->tank.orient.position[Z] );
-    printf("%ld  front    = (%.25f,%.25f,%.25f)\n", frame, p->tank.orient.front[X], p->tank.orient.front[Y], p->tank.orient.front[Z] );
-    printf("%ld  up       = (%.25f,%.25f,%.25f)\n", frame, p->tank.orient.up[X], p->tank.orient.up[Y], p->tank.orient.up[Z] );
-    printf("%ld  vel      = (%.25f,%.25f,%.25f)\n", frame, p->tank.vel[X], p->tank.vel[Y], p->tank.vel[Z] );
-    printf("%ld  input_table = (%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)\n", frame, (int)p->table[0], (int)p->table[1],
+    printf("%d  position = (%.25f,%.25f,%.25f)\n", frame, p->tank.orient.position[X], p->tank.orient.position[Y], p->tank.orient.position[Z] );
+    printf("%d  front    = (%.25f,%.25f,%.25f)\n", frame, p->tank.orient.front[X], p->tank.orient.front[Y], p->tank.orient.front[Z] );
+    printf("%d  up       = (%.25f,%.25f,%.25f)\n", frame, p->tank.orient.up[X], p->tank.orient.up[Y], p->tank.orient.up[Z] );
+    printf("%d  vel      = (%.25f,%.25f,%.25f)\n", frame, p->tank.vel[X], p->tank.vel[Y], p->tank.vel[Z] );
+    printf("%d  input_table = (%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)\n", frame, (int)p->table[0], (int)p->table[1],
         (int)p->table[2], (int)p->table[3], (int)p->table[4], (int)p->table[5], (int)p->table[6], (int)p->table[7],
         (int)p->table[8], (int)p->table[9], (int)p->table[10], (int)p->table[11], (int)p->table[12] );
 }

--- util.h	2003-04-28 17:52:34.000000000 +0200
+++ util.h	2008-06-15 23:02:38.000000000 +0200
@@ -25,22 +25,22 @@
 
 void init_sine_table();
 void init_arc_cos_table();
-long isin( long x );
-long icos( long x );
-long iarccos( long x );
-
-unsigned char diffuse_shade( long dotprod, Gradient gradient );
-unsigned char distance_diffuse_shade( long dotprod, long distance, Gradient gradient );
-unsigned char vehicle_menu_distance_diffuse_shade( long dotprod, long distance, Gradient gradient );
-unsigned char tube_shade( long distance, Gradient gradient );
-unsigned char radar_tube_shade( long distance, Gradient gradient );
-
-
-float mtof( long magic );
-long ftom( float num );
-long rounding_ftom( float num );
-long rounding_fixed_multiply( long x, long y );
-long rounding_fixed_to_long( long fixed );
+int isin( int x );
+int icos( int x );
+int iarccos( int x );
+
+unsigned char diffuse_shade( int dotprod, Gradient gradient );
+unsigned char distance_diffuse_shade( int dotprod, int distance, Gradient gradient );
+unsigned char vehicle_menu_distance_diffuse_shade( int dotprod, int distance, Gradient gradient );
+unsigned char tube_shade( int distance, Gradient gradient );
+unsigned char radar_tube_shade( int distance, Gradient gradient );
+
+
+float mtof( int magic );
+int ftom( float num );
+int rounding_ftom( float num );
+int rounding_fixed_multiply( int x, int y );
+int rounding_fixed_to_long( int fixed );
 
 /* floating point linear algabra functions */
 
@@ -61,7 +61,7 @@
 
 void print_vehicle_info( Vehicle *v );
 void print_player_array_info( Player p[] );
-void print_player_info( Player *p, long frame );
+void print_player_info( Player *p, int frame );
 
 #endif
 

--- voices.c	2003-04-30 16:27:18.000000000 +0200
+++ voices.c	2008-06-15 23:02:38.000000000 +0200
@@ -62,7 +62,7 @@
 
 
 /* Handle the gloat and despair voices */
-void Gloat_Despair( WorldStuff *world_stuff, long view_vehicle )
+void Gloat_Despair( WorldStuff *world_stuff, int view_vehicle )
     {
      int i;
      Player *player_array;
@@ -101,7 +101,7 @@
 
     } /* End of Gloat_Despair */
 
-void Handle_Voices( WorldStuff *world_stuff, long view_vehicle, unsigned char first_person_view, unsigned char teleporting )
+void Handle_Voices( WorldStuff *world_stuff, int view_vehicle, unsigned char first_person_view, unsigned char teleporting )
     {
      int i;
      team_type current_team;

--- voices.h	2001-12-18 21:08:45.000000000 +0100
+++ voices.h	2008-06-15 23:02:38.000000000 +0200
@@ -34,6 +34,6 @@
 
 
 void Init_Voices( void );
-void Handle_Voices( WorldStuff *world_stuff, long view_vehicle, unsigned char first_person_view, unsigned char teleporting );
+void Handle_Voices( WorldStuff *world_stuff, int view_vehicle, unsigned char first_person_view, unsigned char teleporting );
 void Zero_Voice( int wingman_number );
 void No_Despair( int wingman_number );


--- NEW FILE cylindrix.desktop ---
[Desktop Entry]
Name=Cylindrix
GenericName=Cylindrix
Comment=3D combat
Exec=cylindrix
Icon=cylindrix
Terminal=true
StartupNotify=false
Type=Application
Categories=Game;ActionGame;


--- NEW FILE cylindrix.sh ---
#!/bin/bash

#if no .cylindrix in home
if [ ! -d ~/.cylindrix ]; then

  #make .cylindrix in home
  mkdir ~/.cylindrix || :
  #link to data
  ln -s /usr/share/cylindrix/3d_data ~/.cylindrix/3d_data || :
  ln -s /usr/share/cylindrix/anything.mod ~/.cylindrix/anything.mod  || :
  ln -s /usr/share/cylindrix/cylindrx.fli ~/.cylindrix/cylindrx.fli || :
  ln -s /usr/share/cylindrix/pcx_data ~/.cylindrix/pcx_data || :
  ln -s /usr/share/cylindrix/wav_data ~/.cylindrix/wav_data || :

  #copy mutable data
  cp -p /usr/share/cylindrix/people.dat ~/.cylindrix/ || :
  cp -pr /usr/share/cylindrix/stats ~/.cylindrix/ || :
  cp -pr /usr/share/cylindrix/gamedata ~/.cylindrix/ || :
fi

cd ~/.cylindrix
exec cylindrix-bin "$@"


--- NEW FILE cylindrix.spec ---
Name: cylindrix
Version:  1.0
Release: 4%{?dist}
Summary: Cylindrix is a 3 degrees of freedom combat game

Group: Amusements/Games 
License: LGPLv2        
URL: http://www.hardgeus.com/cylindrix/
Source0: http://www.hardgeus.com/cylindrix/cylindrix-1.0.tar.gz
Source1: cylindrix.desktop
Source2: cylindrix.png
Source3: cylindrix.sh
Patch0: cylindrix-1.0-fix-packing.patch
Patch1: cylindrix-1.0-arch-independ-file-read.patch
Patch2: cylindrix-1.0-use-int-not-long.patch
Patch3: cylindrix-1.0-arch-independ-file-write.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root%(%{__id_u} -n)
Requires: hicolor-icon-theme
BuildRequires: allegro-devel, desktop-file-utils

%description
Cylindrix is a 3-on-3 combat game with 360 degrees of freedom that is
similar to Spectre VR but with a wider variety of ships, as well as the
addition of drivers. Attack and be attacked from all angles as you battle
in huge orbiting arenas that are each unique in physics, atmospheric
conditions, and configuration. You must build your team from 37 warriors
from 10 alien races and select from 8 vehicles, each with unique 
maneuverability, speed, and firepower. The graphics are good, although
structure and ship graphics are a little too monotonous. Gameplay is fast
and furious... so furious, in fact, that it is difficult to differentiate
between friend and foe in the thick of battle. For those who are confident
of their reflexes or have beaten Spectre and Battlezone, though, this game
is worth a try.

%prep
%setup -qn cylindrix

%patch0 -p0
%patch1 -p0
%patch2 -p0
%patch3 -p0

%build

%configure
make CFLAGS="$RPM_OPT_FLAGS -Wno-pointer-sign"

rm -rf */CVS
rm -rf */*/CVS
rm -rf */*/*/CVS

%install
rm -rf %{buildroot}

mkdir -p %{buildroot}%{_bindir}
install -m 755 %{SOURCE3} %{buildroot}%{_bindir}/cylindrix
install -m 755 cylindrix %{buildroot}%{_bindir}/cylindrix-bin

mkdir -p %{buildroot}%{_datadir}/cylindrix

cp -pr 3d_data %{buildroot}%{_datadir}/cylindrix
cp -pr anything.mod %{buildroot}%{_datadir}/cylindrix
cp -pr cylindrx.fli %{buildroot}%{_datadir}/cylindrix
cp -pr gamedata %{buildroot}%{_datadir}/cylindrix
cp -pr pcx_data %{buildroot}%{_datadir}/cylindrix
cp -pr people.dat %{buildroot}%{_datadir}/cylindrix
cp -pr stats %{buildroot}%{_datadir}/cylindrix
cp -pr wav_data %{buildroot}%{_datadir}/cylindrix


mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor fedora            \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  %{SOURCE1}

mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/64x64/apps
install -p -m 644 %{SOURCE2} \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/64x64/apps

%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

%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%{_bindir}/cylindrix*
%{_datadir}/cylindrix/

%doc AUTHORS COPYING
%{_datadir}/applications/fedora-cylindrix.desktop
%{_datadir}/icons/hicolor/64x64/apps/cylindrix.png


%changelog
* Mon Jun 16 2008 Jon Ciesla <limb at jcomserv.net> - 1.0-4
- Fixed launcher script, data locations.
- Added Hans's newest review patch.

* Mon Jun 16 2008 Jon Ciesla <limb at jcomserv.net> - 1.0-3
- Dropped VS files.
- Dropped icon extension.
- Added CFLAG.

* Mon Jun 16 2008 Jon Ciesla <limb at jcomserv.net> - 1.0-2
- Added allegro-devel, desktop-file-utils BRs.
- Added Hans's review patches.
- Corrected data installation method for shared and mutable data.

* Sat Sep 08 2007 Jon Ciesla <limb at jcomserv.net> - 1.0-1
- Added h-i-theme requires, xparentfied icon.
- create.


--- NEW FILE import.log ---
cylindrix-1_0-4_fc9:HEAD:cylindrix-1.0-4.fc9.src.rpm:1213705813


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/cylindrix/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	16 Jun 2008 20:49:26 -0000	1.1
+++ .cvsignore	17 Jun 2008 12:30:51 -0000	1.2
@@ -0,0 +1 @@
+cylindrix-1.0.tar.gz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/cylindrix/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	16 Jun 2008 20:49:26 -0000	1.1
+++ sources	17 Jun 2008 12:30:51 -0000	1.2
@@ -0,0 +1 @@
+914cf70b0a95f4a36cfdfde7edbaa240  cylindrix-1.0.tar.gz




More information about the fedora-extras-commits mailing list