portable-izing file loading routines
authorBradley Bell <btb@icculus.org>
Fri, 26 Jul 2002 09:22:39 +0000 (09:22 +0000)
committerBradley Bell <btb@icculus.org>
Fri, 26 Jul 2002 09:22:39 +0000 (09:22 +0000)
25 files changed:
3d/interp.c
include/cfile.h
main/Makefile.am
main/bm.c
main/bm.h
main/cntrlcen.c
main/cntrlcen.h
main/effects.c
main/effects.h
main/piggy.c
main/piggy.h
main/player.c [new file with mode: 0644]
main/player.h
main/polyobj.c
main/polyobj.h
main/powerup.c
main/powerup.h
main/robot.c
main/robot.h
main/vclip.c
main/vclip.h
main/wall.c
main/wall.h
main/weapon.c
main/weapon.h

index 0019afb..da51b57 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: interp.c,v 1.5 2002-07-17 21:55:19 bradleyb Exp $ */
+/* $Id: interp.c,v 1.6 2002-07-26 09:22:39 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -40,7 +40,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: interp.c,v 1.5 2002-07-17 21:55:19 bradleyb Exp $";
+static char rcsid[] = "$Id: interp.c,v 1.6 2002-07-26 09:22:39 btb Exp $";
 #endif
 
 #include <stdlib.h>
@@ -49,6 +49,7 @@ static char rcsid[] = "$Id: interp.c,v 1.5 2002-07-17 21:55:19 bradleyb Exp $";
 #include "3d.h"
 #include "globvars.h"
 #include "gr.h"
+#include "byteswap.h"
 
 #define OP_EOF                         0       //eof
 #define OP_DEFPOINTS           1       //defpoints
@@ -98,6 +99,121 @@ g3s_point *point_list[MAX_POINTS_PER_POLY];
 
 int glow_num = -1;
 
+#ifdef WORDS_BIGENDIAN
+void short_swap(short *s)
+{
+       *s = swapshort(*s);
+}
+
+void vms_vector_swap(vms_vector *v)
+{
+       v->x = (fix)swapint((int)v->x);
+       v->y = (fix)swapint((int)v->y);
+       v->z = (fix)swapint((int)v->z);
+}
+
+void swap_polygon_model_data(ubyte *data)
+{
+       int i;
+       short n;
+       g3s_uvl *uvl_val;
+       ubyte *p = data;
+
+       short_swap(wp(p));
+
+       while (w(p) != OP_EOF) {
+               switch (w(p)) {
+                       case OP_DEFPOINTS:
+                               short_swap(wp(p + 2));
+                               n = w(p+2);
+                               for (i = 0; i < n; i++)
+                                       vms_vector_swap(vp((p + 4) + (i * sizeof(vms_vector))));
+                               p += n*sizeof(struct vms_vector) + 4;
+                               break;
+
+                       case OP_DEFP_START:
+                               short_swap(wp(p + 2));
+                               short_swap(wp(p + 4));
+                               n = w(p+2);
+                               for (i = 0; i < n; i++)
+                                       vms_vector_swap(vp((p + 8) + (i * sizeof(vms_vector))));
+                               p += n*sizeof(struct vms_vector) + 8;
+                               break;
+
+                       case OP_FLATPOLY:
+                               short_swap(wp(p+2));
+                               n = w(p+2);
+                               vms_vector_swap(vp(p + 4));
+                               vms_vector_swap(vp(p + 16));
+                               short_swap(wp(p+28));
+#ifdef MACINTOSH
+                               // swap the colors 0 and 255 here!!!!
+                               if (w(p+28) == 0)
+                                       w(p+28) = 255;
+                               else if (w(p+28) == 255)
+                                       w(p+28) = 0;
+#endif
+                               for (i=0; i < n; i++)
+                                       short_swap(wp(p + 30 + (i * 2)));
+                               p += 30 + ((n&~1)+1)*2;
+                               break;
+
+                       case OP_TMAPPOLY:
+                               short_swap(wp(p+2));
+                               n = w(p+2);
+                               vms_vector_swap(vp(p + 4));
+                               vms_vector_swap(vp(p + 16));
+                               for (i=0;i<n;i++) {
+                                       uvl_val = (g3s_uvl *)((p+30+((n&~1)+1)*2) + (i * sizeof(g3s_uvl)));
+                                       uvl_val->u = (fix)swapint((int)uvl_val->u);
+                                       uvl_val->v = (fix)swapint((int)uvl_val->v);
+                               }
+                               short_swap(wp(p+28));
+                               for (i=0;i<n;i++)
+                                       short_swap(wp(p + 30 + (i * 2)));
+                               p += 30 + ((n&~1)+1)*2 + n*12;
+                               break;
+
+                       case OP_SORTNORM:
+                               vms_vector_swap(vp(p + 4));
+                               vms_vector_swap(vp(p + 16));
+                               short_swap(wp(p + 28));
+                               short_swap(wp(p + 30));
+                               swap_polygon_model_data(p + w(p+28));
+                               swap_polygon_model_data(p + w(p+30));
+                               p += 32;
+                               break;
+
+                       case OP_RODBM:
+                               vms_vector_swap(vp(p + 20));
+                               vms_vector_swap(vp(p + 4));
+                               short_swap(wp(p+2));
+                               *((int *)(p + 16)) = swapint(*((int *)(p + 16)));
+                               *((int *)(p + 32)) = swapint(*((int *)(p + 32)));
+                               p+=36;
+                               break;
+
+                       case OP_SUBCALL:
+                               short_swap(wp(p+2));
+                               vms_vector_swap(vp(p+4));
+                               short_swap(wp(p+16));
+                               swap_polygon_model_data(p + w(p+16));
+                               p += 20;
+                               break;
+
+                       case OP_GLOW:
+                               short_swap(wp(p + 2));
+                               p += 4;
+                               break;
+                               
+                       default:
+                               Int3();
+               }
+               short_swap(wp(p));
+       }
+}
+#endif
+
 //calls the object interpreter to render an object.  The object renderer
 //is really a seperate pipeline. returns true if drew
 bool g3_draw_polygon_model(void *model_ptr,grs_bitmap **model_bitmaps,vms_angvec *anim_angles,fix model_light,fix *glow_values)
index 3c4fa27..25e4532 100644 (file)
@@ -11,16 +11,16 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 */
 
-
-
 #ifndef _CFILE_H
 #define _CFILE_H
 
+#include <stdio.h>
+
 #include "maths.h"
 #include "vecmat.h"
 
 typedef struct CFILE {
-       FILE                            *file;
+       FILE                    *file;
        int                             size;
        int                             lib_offset;
        int                             raw_position;
index b5deac4..84d6be4 100644 (file)
@@ -37,7 +37,7 @@ config.c    gamecntl.c        kconfig.c   scores.c \
 controls.c  gamefont.c kludge.c    newdemo.c   slew.c \
 credits.c   gamemine.c newmenu.c   songs.c \
 crypt.c     gamepal.c  laser.c     object.c    state.c \
-console.c   cmd.c
+console.c   cmd.c       player.c
 
 EXTRA_libmain_a_SOURCES = \
 ipx_drv.c kmatrix.c multi.c multibot.c network.c netpkt.c \
index de6b76f..a721cbe 100644 (file)
--- a/main/bm.c
+++ b/main/bm.c
@@ -1,3 +1,4 @@
+/* $ Id: $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -12,26 +13,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 */
 
 /*
- * $Source: /cvs/cvsroot/d2x/main/bm.c,v $
- * $Revision: 1.8 $
- * $Author: bradleyb $
- * $Date: 2002-02-11 07:44:44 $
  *
  * Bitmap and palette loading functions.
  *
- * $Log: not supported by cvs2svn $
- * Revision 1.7  2001/11/14 09:34:32  bradleyb
- * use MAKE_SIG
- *
- * Revision 1.6  2001/11/02 02:22:25  bradleyb
- * formatting
- *
- * Revision 1.5  2001/10/25 02:15:55  bradleyb
- * conditionalize including multi.h and network.h, fix backslashes
- *
- * Revision 1.4  2001/10/19 08:06:20  bradleyb
- * Partial application of linux/alpha patch.  Courtesy of Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
- *
  *
  */
 
@@ -39,10 +23,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #include <conf.h>
 #endif
 
-#ifdef WORDS_BIGENDIAN
-#define PORTABLE_LOADER
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -114,335 +94,24 @@ int                                       First_multi_bitmap_num=-1;
 bitmap_index           ObjBitmaps[MAX_OBJ_BITMAPS];
 ushort                         ObjBitmapPtrs[MAX_OBJ_BITMAPS];         // These point back into ObjBitmaps, since some are used twice.
 
-#ifdef PORTABLE_LOADER
-void read_tmap_info(CFILE *fp, int inNumTexturesToRead, int inOffset)
-{
-       int i;
-       
-       for (i = inOffset; i < (inNumTexturesToRead + inOffset); i++)
-       {
-               TmapInfo[i].flags = cfile_read_byte(fp);
-               TmapInfo[i].pad[0] = cfile_read_byte(fp);
-               TmapInfo[i].pad[1] = cfile_read_byte(fp);
-               TmapInfo[i].pad[2] = cfile_read_byte(fp);
-               TmapInfo[i].lighting = cfile_read_fix(fp);
-               TmapInfo[i].damage = cfile_read_fix(fp);
-               TmapInfo[i].eclip_num = cfile_read_short(fp);
-               TmapInfo[i].destroyed = cfile_read_short(fp);
-               TmapInfo[i].slide_u = cfile_read_short(fp);
-               TmapInfo[i].slide_v = cfile_read_short(fp);
-       }
-}
-
-void read_vclip_info(CFILE *fp, int inNumVClipsToRead, int inOffset)
-{
-       int i, j;
-       
-       for (i = inOffset; i < (inNumVClipsToRead + inOffset); i++)
-       {
-               Vclip[i].play_time = cfile_read_fix(fp);
-               Vclip[i].num_frames = cfile_read_int(fp);
-               Vclip[i].frame_time = cfile_read_fix(fp);
-               Vclip[i].flags = cfile_read_int(fp);
-               Vclip[i].sound_num = cfile_read_short(fp);
-               for (j = 0; j < VCLIP_MAX_FRAMES; j++)
-                       Vclip[i].frames[j].index = cfile_read_short(fp);
-               Vclip[i].light_value = cfile_read_fix(fp);
-       }
-}
-
-void read_effect_info(CFILE *fp, int inNumEffectsToRead, int inOffset)
-{
-       int i, j;
-
-
-       for (i = inOffset; i < (inNumEffectsToRead + inOffset); i++)
-       {
-               Effects[i].vc.play_time = cfile_read_fix(fp);
-               Effects[i].vc.num_frames = cfile_read_int(fp);
-               Effects[i].vc.frame_time = cfile_read_fix(fp);
-               Effects[i].vc.flags = cfile_read_int(fp);
-               Effects[i].vc.sound_num = cfile_read_short(fp);
-               for (j = 0; j < VCLIP_MAX_FRAMES; j++)
-                       Effects[i].vc.frames[j].index = cfile_read_short(fp);
-               Effects[i].vc.light_value = cfile_read_fix(fp);
-               Effects[i].time_left = cfile_read_fix(fp);
-               Effects[i].frame_count = cfile_read_int(fp);
-               Effects[i].changing_wall_texture = cfile_read_short(fp);
-               Effects[i].changing_object_texture = cfile_read_short(fp);
-               Effects[i].flags = cfile_read_int(fp);
-               Effects[i].crit_clip = cfile_read_int(fp);
-               Effects[i].dest_bm_num = cfile_read_int(fp);
-               Effects[i].dest_vclip = cfile_read_int(fp);
-               Effects[i].dest_eclip = cfile_read_int(fp);
-               Effects[i].dest_size = cfile_read_fix(fp);
-               Effects[i].sound_num = cfile_read_int(fp);
-               Effects[i].segnum = cfile_read_int(fp);
-               Effects[i].sidenum = cfile_read_int(fp);
-       }
-}
-
-void read_wallanim_info(CFILE *fp, int inNumWallAnimsToRead, int inOffset)
-{
-       int i, j;
-       
-       for (i = inOffset; i < (inNumWallAnimsToRead + inOffset); i++)
-       {
-               WallAnims[i].play_time = cfile_read_fix(fp);;
-               WallAnims[i].num_frames = cfile_read_short(fp);;
-               for (j = 0; j < MAX_CLIP_FRAMES; j++)
-                       WallAnims[i].frames[j] = cfile_read_short(fp);
-               WallAnims[i].open_sound = cfile_read_short(fp);
-               WallAnims[i].close_sound = cfile_read_short(fp);
-               WallAnims[i].flags = cfile_read_short(fp);
-               cfread(WallAnims[i].filename, 13, 1, fp);
-               WallAnims[i].pad = cfile_read_byte(fp);
-       }               
-}
-
-void read_robot_info(CFILE *fp, int inNumRobotsToRead, int inOffset)
-{
-       int i, j, k;
-       
-       for (i = inOffset; i < (inNumRobotsToRead + inOffset); i++)
-       {
-               Robot_info[i].model_num = cfile_read_int(fp);
-               for (j = 0; j < MAX_GUNS; j++)
-                       cfile_read_vector(&(Robot_info[i].gun_points[j]), fp);
-               for (j = 0; j < MAX_GUNS; j++)
-                       Robot_info[i].gun_submodels[j] = cfile_read_byte(fp);
-
-               Robot_info[i].exp1_vclip_num = cfile_read_short(fp);
-               Robot_info[i].exp1_sound_num = cfile_read_short(fp);
-
-               Robot_info[i].exp2_vclip_num = cfile_read_short(fp);
-               Robot_info[i].exp2_sound_num = cfile_read_short(fp);
-
-               Robot_info[i].weapon_type = cfile_read_byte(fp);
-               Robot_info[i].weapon_type2 = cfile_read_byte(fp);
-               Robot_info[i].n_guns = cfile_read_byte(fp);
-               Robot_info[i].contains_id = cfile_read_byte(fp);
-
-               Robot_info[i].contains_count = cfile_read_byte(fp);
-               Robot_info[i].contains_prob = cfile_read_byte(fp);
-               Robot_info[i].contains_type = cfile_read_byte(fp);
-               Robot_info[i].kamikaze = cfile_read_byte(fp);
-
-               Robot_info[i].score_value = cfile_read_short(fp);
-               Robot_info[i].badass = cfile_read_byte(fp);
-               Robot_info[i].energy_drain = cfile_read_byte(fp);
-               
-               Robot_info[i].lighting = cfile_read_fix(fp);
-               Robot_info[i].strength = cfile_read_fix(fp);
-
-               Robot_info[i].mass = cfile_read_fix(fp);
-               Robot_info[i].drag = cfile_read_fix(fp);
-
-               for (j = 0; j < NDL; j++)
-                       Robot_info[i].field_of_view[j] = cfile_read_fix(fp);
-               for (j = 0; j < NDL; j++)
-                       Robot_info[i].firing_wait[j] = cfile_read_fix(fp);
-               for (j = 0; j < NDL; j++)
-                       Robot_info[i].firing_wait2[j] = cfile_read_fix(fp);
-               for (j = 0; j < NDL; j++)
-                       Robot_info[i].turn_time[j] = cfile_read_fix(fp);
-               for (j = 0; j < NDL; j++)
-                       Robot_info[i].max_speed[j] = cfile_read_fix(fp);
-               for (j = 0; j < NDL; j++)
-                       Robot_info[i].circle_distance[j] = cfile_read_fix(fp);
-               for (j = 0; j < NDL; j++)
-                       cfread(&(Robot_info[i].rapidfire_count[j]), sizeof(byte), 1, fp);
-               for (j = 0; j < NDL; j++)
-                       cfread(&(Robot_info[i].evade_speed[j]), sizeof(byte), 1, fp);
-               Robot_info[i].cloak_type = cfile_read_byte(fp);
-               Robot_info[i].attack_type = cfile_read_byte(fp);
-
-               Robot_info[i].see_sound = cfile_read_byte(fp);
-               Robot_info[i].attack_sound = cfile_read_byte(fp);
-               Robot_info[i].claw_sound = cfile_read_byte(fp);
-               Robot_info[i].taunt_sound = cfile_read_byte(fp);
-
-               Robot_info[i].boss_flag = cfile_read_byte(fp);
-               Robot_info[i].companion = cfile_read_byte(fp);
-               Robot_info[i].smart_blobs = cfile_read_byte(fp);
-               Robot_info[i].energy_blobs = cfile_read_byte(fp);
-
-               Robot_info[i].thief = cfile_read_byte(fp);
-               Robot_info[i].pursuit = cfile_read_byte(fp);
-               Robot_info[i].lightcast = cfile_read_byte(fp);
-               Robot_info[i].death_roll = cfile_read_byte(fp);
-
-               Robot_info[i].flags = cfile_read_byte(fp);
-               Robot_info[i].pad[0] = cfile_read_byte(fp);
-               Robot_info[i].pad[1] = cfile_read_byte(fp);
-               Robot_info[i].pad[2] = cfile_read_byte(fp);
-
-               Robot_info[i].deathroll_sound = cfile_read_byte(fp);
-               Robot_info[i].glow = cfile_read_byte(fp);
-               Robot_info[i].behavior = cfile_read_byte(fp);
-               Robot_info[i].aim = cfile_read_byte(fp);
-
-               for (j = 0; j < MAX_GUNS + 1; j++) {
-                       for (k = 0; k < N_ANIM_STATES; k++) {
-                               Robot_info[i].anim_states[j][k].n_joints = cfile_read_short(fp);
-                               Robot_info[i].anim_states[j][k].offset = cfile_read_short(fp);
-                       }
-               }
-
-               Robot_info[i].always_0xabcd = cfile_read_int(fp);
-       }
-}
-
-void read_robot_joint_info(CFILE *fp, int inNumRobotJointsToRead, int inOffset)
-{
-       int i;
-
-       for (i = inOffset; i < (inNumRobotJointsToRead + inOffset); i++)
-       {
-               Robot_joints[i].jointnum = cfile_read_short(fp);
-               cfile_read_angvec(&(Robot_joints[i].angles), fp);
-       }
-}
-
-void read_weapon_info(CFILE *fp, int inNumWeaponsToRead, int inOffset)
-{
-       int i, j;
-       
-       for (i = inOffset; i < (inNumWeaponsToRead + inOffset); i++)
-       {
-               Weapon_info[i].render_type = cfile_read_byte(fp);
-               Weapon_info[i].persistent = cfile_read_byte(fp);
-               Weapon_info[i].model_num = cfile_read_short(fp);
-               Weapon_info[i].model_num_inner = cfile_read_short(fp);
-
-               Weapon_info[i].flash_vclip = cfile_read_byte(fp);
-               Weapon_info[i].robot_hit_vclip = cfile_read_byte(fp);
-               Weapon_info[i].flash_sound = cfile_read_short(fp);              
-
-               Weapon_info[i].wall_hit_vclip = cfile_read_byte(fp);
-               Weapon_info[i].fire_count = cfile_read_byte(fp);
-               Weapon_info[i].robot_hit_sound = cfile_read_short(fp);
-               
-               Weapon_info[i].ammo_usage = cfile_read_byte(fp);
-               Weapon_info[i].weapon_vclip = cfile_read_byte(fp);
-               Weapon_info[i].wall_hit_sound = cfile_read_short(fp);           
-
-               Weapon_info[i].destroyable = cfile_read_byte(fp);
-               Weapon_info[i].matter = cfile_read_byte(fp);
-               Weapon_info[i].bounce = cfile_read_byte(fp);
-               Weapon_info[i].homing_flag = cfile_read_byte(fp);
-
-               Weapon_info[i].speedvar = cfile_read_byte(fp);
-               Weapon_info[i].flags = cfile_read_byte(fp);
-               Weapon_info[i].flash = cfile_read_byte(fp);
-               Weapon_info[i].afterburner_size = cfile_read_byte(fp);
-               
-               Weapon_info[i].children = cfile_read_byte(fp);
-
-               Weapon_info[i].energy_usage = cfile_read_fix(fp);
-               Weapon_info[i].fire_wait = cfile_read_fix(fp);
-               
-               Weapon_info[i].multi_damage_scale = cfile_read_fix(fp);
-               
-               Weapon_info[i].bitmap.index = cfile_read_short(fp);     // bitmap_index = short
-
-               Weapon_info[i].blob_size = cfile_read_fix(fp);
-               Weapon_info[i].flash_size = cfile_read_fix(fp);
-               Weapon_info[i].impact_size = cfile_read_fix(fp);
-               for (j = 0; j < NDL; j++)
-                       Weapon_info[i].strength[j] = cfile_read_fix(fp);
-               for (j = 0; j < NDL; j++)
-                       Weapon_info[i].speed[j] = cfile_read_fix(fp);
-               Weapon_info[i].mass = cfile_read_fix(fp);
-               Weapon_info[i].drag = cfile_read_fix(fp);
-               Weapon_info[i].thrust = cfile_read_fix(fp);
-               Weapon_info[i].po_len_to_width_ratio = cfile_read_fix(fp);
-               Weapon_info[i].light = cfile_read_fix(fp);
-               Weapon_info[i].lifetime = cfile_read_fix(fp);
-               Weapon_info[i].damage_radius = cfile_read_fix(fp);
-               Weapon_info[i].picture.index = cfile_read_short(fp);            // bitmap_index is a short
-               Weapon_info[i].hires_picture.index = cfile_read_short(fp);              // bitmap_index is a short
-       }
-}
-
-void read_powerup_info(CFILE *fp, int inNumPowerupsToRead, int inOffset)
-{
-       int i;
-       
-       for (i = inOffset; i < (inNumPowerupsToRead + inOffset); i++)
-       {
-               Powerup_info[i].vclip_num = cfile_read_int(fp);
-               Powerup_info[i].hit_sound = cfile_read_int(fp);
-               Powerup_info[i].size = cfile_read_fix(fp);
-               Powerup_info[i].light = cfile_read_fix(fp);
-       }
-}
-
-void read_polygon_models(CFILE *fp, int inNumPolygonModelsToRead, int inOffset)
-{
-       int i, j;
-
-       for (i = inOffset; i < (inNumPolygonModelsToRead + inOffset); i++)
-       {
-               Polygon_models[i].n_models = cfile_read_int(fp);
-               Polygon_models[i].model_data_size = cfile_read_int(fp);
-               Polygon_models[i].model_data = (ubyte *) cfile_read_int(fp);
-               for (j = 0; j < MAX_SUBMODELS; j++)
-                       Polygon_models[i].submodel_ptrs[j] = cfile_read_int(fp);
-               for (j = 0; j < MAX_SUBMODELS; j++)
-                       cfile_read_vector(&(Polygon_models[i].submodel_offsets[j]), fp);
-               for (j = 0; j < MAX_SUBMODELS; j++)
-                       cfile_read_vector(&(Polygon_models[i].submodel_norms[j]), fp);
-               for (j = 0; j < MAX_SUBMODELS; j++)
-                       cfile_read_vector(&(Polygon_models[i].submodel_pnts[j]), fp);
-               for (j = 0; j < MAX_SUBMODELS; j++)
-                       Polygon_models[i].submodel_rads[j] = cfile_read_fix(fp);
-               for (j = 0; j < MAX_SUBMODELS; j++)
-                       Polygon_models[i].submodel_parents[j] = cfile_read_byte(fp);
-               for (j = 0; j < MAX_SUBMODELS; j++)
-                       cfile_read_vector(&(Polygon_models[i].submodel_mins[j]), fp);
-               for (j = 0; j < MAX_SUBMODELS; j++)
-                       cfile_read_vector(&(Polygon_models[i].submodel_maxs[j]), fp);
-               cfile_read_vector(&(Polygon_models[i].mins), fp);
-               cfile_read_vector(&(Polygon_models[i].maxs), fp);
-               Polygon_models[i].rad = cfile_read_fix(fp);             
-               Polygon_models[i].n_textures = cfile_read_byte(fp);
-               Polygon_models[i].first_texture = cfile_read_short(fp);
-               Polygon_models[i].simpler_model = cfile_read_byte(fp);
-       }
-}
-
-void read_player_ship(CFILE *fp)
+/*
+ * reads a tmap_info structure from a CFILE
+ */
+void tmap_info_read(tmap_info *ti, CFILE *fp)
 {
-       int i;
-
-       only_player_ship.model_num = cfile_read_int(fp);
-       only_player_ship.expl_vclip_num = cfile_read_int(fp);
-       only_player_ship.mass = cfile_read_fix(fp);
-       only_player_ship.drag = cfile_read_fix(fp);
-       only_player_ship.max_thrust = cfile_read_fix(fp);
-       only_player_ship.reverse_thrust = cfile_read_fix(fp);
-       only_player_ship.brakes = cfile_read_fix(fp);
-       only_player_ship.wiggle = cfile_read_fix(fp);
-       only_player_ship.max_rotthrust = cfile_read_fix(fp);
-       for (i = 0; i < N_PLAYER_GUNS; i++)
-               cfile_read_vector(&(only_player_ship.gun_points[i]), fp);
+       ti->flags = cfile_read_byte(fp);
+       ti->pad[0] = cfile_read_byte(fp);
+       ti->pad[1] = cfile_read_byte(fp);
+       ti->pad[2] = cfile_read_byte(fp);
+       ti->lighting = cfile_read_fix(fp);
+       ti->damage = cfile_read_fix(fp);
+       ti->eclip_num = cfile_read_short(fp);
+       ti->destroyed = cfile_read_short(fp);
+       ti->slide_u = cfile_read_short(fp);
+       ti->slide_v = cfile_read_short(fp);
 }
 
-void read_reactor_info(CFILE *fp, int inNumReactorsToRead, int inOffset)
-{
-       int i, j;
-       
-       for (i = inOffset; i < (inNumReactorsToRead + inOffset); i++)
-       {
-               Reactors[i].model_num = cfile_read_int(fp);
-               Reactors[i].n_guns = cfile_read_int(fp);
-               for (j = 0; j < MAX_CONTROLCEN_GUNS; j++)
-                       cfile_read_vector(&(Reactors[i].gun_points[j]), fp);
-               for (j = 0; j < MAX_CONTROLCEN_GUNS; j++)
-                       cfile_read_vector(&(Reactors[i].gun_dirs[j]), fp);
-       }
-}
+#ifdef MACINTOSH
 
 #ifdef SHAREWARE
 extern int exit_modelnum,destroyed_exit_modelnum, Num_bitmap_files;
@@ -516,7 +185,7 @@ void load_exit_models()
        exit_modelnum = N_polygon_models++;
        destroyed_exit_modelnum = N_polygon_models++;
 
-#ifndef PORTABLE_LOADER
+#ifndef MACINTOSH
        cfread( &Polygon_models[exit_modelnum], sizeof(polymodel), 1, exit_hamfile );
        cfread( &Polygon_models[destroyed_exit_modelnum], sizeof(polymodel), 1, exit_hamfile );
 #else
@@ -572,7 +241,7 @@ void load_exit_models()
 }
 #endif         // SHAREWARE
 
-#endif         // PORTABLE_LOADER
+#endif         // MACINTOSH
 
 //-----------------------------------------------------------------
 // Read data from piggy.
@@ -598,129 +267,83 @@ void bm_read_all(CFILE * fp)
        int i,t;
 
        NumTextures = cfile_read_int(fp);
-#ifndef PORTABLE_LOADER
-       cfread( Textures, sizeof(bitmap_index), NumTextures, fp );
-       cfread( TmapInfo, sizeof(tmap_info), NumTextures, fp );
-#else
        for (i = 0; i < NumTextures; i++)
-               Textures[i].index = cfile_read_short(fp);
-       read_tmap_info(fp, NumTextures, 0);
-#endif
+               bitmap_index_read(&Textures[i], fp);
+       for (i = 0; i < NumTextures; i++)
+               tmap_info_read(&TmapInfo[i], fp);
 
        t = cfile_read_int(fp); 
        cfread( Sounds, sizeof(ubyte), t, fp );
        cfread( AltSounds, sizeof(ubyte), t, fp );
 
        Num_vclips = cfile_read_int(fp);
-#ifndef PORTABLE_LOADER
-       cfread( Vclip, sizeof(vclip), Num_vclips, fp );
-#else
-       read_vclip_info(fp, Num_vclips, 0);
-#endif
+       for (i = 0; i < Num_vclips; i++)
+               vclip_read(&Vclip[i], fp);
 
        Num_effects = cfile_read_int(fp);
-#ifndef PORTABLE_LOADER
-       cfread( Effects, sizeof(eclip), Num_effects, fp );
-#else  
-       read_effect_info(fp, Num_effects, 0);
-#endif
+       for (i = 0; i < Num_effects; i++)
+               eclip_read(&Effects[i], fp);
 
        Num_wall_anims = cfile_read_int(fp);
-#ifndef PORTABLE_LOADER
-       cfread( WallAnims, sizeof(wclip), Num_wall_anims, fp );
-#else
-       read_wallanim_info(fp, Num_wall_anims, 0);
-#endif
+       for (i = 0; i < Num_wall_anims; i++)
+               wclip_read(&WallAnims[i], fp);
 
        N_robot_types = cfile_read_int(fp);
-#ifndef PORTABLE_LOADER
-       cfread( Robot_info, sizeof(robot_info), N_robot_types, fp );
-#else
-       read_robot_info(fp, N_robot_types, 0);
-#endif
+       for (i = 0; i < N_robot_types; i++)
+               robot_info_read(&Robot_info[i], fp);
+
        N_robot_joints = cfile_read_int(fp);
-#ifndef PORTABLE_LOADER
-       cfread( Robot_joints, sizeof(jointpos), N_robot_joints, fp );
-#else
-       read_robot_joint_info(fp, N_robot_joints, 0);
-#endif
+       for (i = 0; i < N_robot_joints; i++)
+               jointpos_read(&Robot_joints[i], fp);
 
        N_weapon_types = cfile_read_int(fp);
-#ifndef PORTABLE_LOADER
-       cfread( Weapon_info, sizeof(weapon_info), N_weapon_types, fp );
-#else
-       read_weapon_info(fp, N_weapon_types, 0);
-#endif
+       for (i = 0; i < N_weapon_types; i++)
+               weapon_info_read(&Weapon_info[i], fp);
 
        N_powerup_types = cfile_read_int(fp);
-#ifndef PORTABLE_LOADER
-       cfread( Powerup_info, sizeof(powerup_type_info), N_powerup_types, fp );
-#else
-       read_powerup_info(fp, N_powerup_types, 0);
-#endif
+       for (i = 0; i < N_powerup_types; i++)
+               powerup_type_info_read(&Powerup_info[i], fp);
        
        N_polygon_models = cfile_read_int(fp);
-#ifndef PORTABLE_LOADER
-       cfread( Polygon_models, sizeof(polymodel), N_polygon_models, fp );
-#else
-       read_polygon_models(fp, N_polygon_models, 0);
-#endif
+       for (i = 0; i < N_polygon_models; i++)
+               polymodel_read(&Polygon_models[i], fp);
 
        for (i=0; i<N_polygon_models; i++ )     {
                Polygon_models[i].model_data = d_malloc(Polygon_models[i].model_data_size);
                Assert( Polygon_models[i].model_data != NULL );
                cfread( Polygon_models[i].model_data, sizeof(ubyte), Polygon_models[i].model_data_size, fp );
-#ifdef MACINTOSH
+#ifdef WORDS_BIGENDIAN
                swap_polygon_model_data(Polygon_models[i].model_data);
 #endif
                g3_init_polygon_model(Polygon_models[i].model_data);
        }
 
-       cfread( Dying_modelnums, sizeof(int), N_polygon_models, fp );
-       cfread( Dead_modelnums, sizeof(int), N_polygon_models, fp );
-#ifdef MACINTOSH
        for (i = 0; i < N_polygon_models; i++)
-               Dying_modelnums[i]= SWAPINT(Dying_modelnums[i]);
+               Dying_modelnums[i] = cfile_read_int(fp);
        for (i = 0; i < N_polygon_models; i++)
-               Dead_modelnums[i]= SWAPINT(Dead_modelnums[i]);
-#endif
+               Dead_modelnums[i] = cfile_read_int(fp);
 
        t = cfile_read_int(fp);
-       cfread( Gauges, sizeof(bitmap_index), t, fp );
-       cfread( Gauges_hires, sizeof(bitmap_index), t, fp );
-#ifdef MACINTOSH
-       for (i = 0; i < t; i++) {
-               Gauges[i].index = SWAPSHORT(Gauges[i].index);
-               Gauges_hires[i].index = SWAPSHORT(Gauges_hires[i].index);
-       }
-#endif
+       for (i = 0; i < t; i++)
+               bitmap_index_read(&Gauges[i], fp);
+       for (i = 0; i < t; i++)
+               bitmap_index_read(&Gauges_hires[i], fp);
 
        t = cfile_read_int(fp);
-       cfread( ObjBitmaps, sizeof(bitmap_index), t, fp );
-       cfread( ObjBitmapPtrs, sizeof(ushort), t, fp );
+       for (i = 0; i < t; i++)
+               bitmap_index_read(&ObjBitmaps[i], fp);
+       for (i = 0; i < t; i++)
+               ObjBitmapPtrs[i] = cfile_read_short(fp);
 
-#ifdef MACINTOSH
 #ifdef SHAREWARE
        N_ObjBitmaps = t;
 #endif
-       for (i = 0; i < t; i++) {
-               ObjBitmaps[i].index = SWAPSHORT(ObjBitmaps[i].index);
-               ObjBitmapPtrs[i] = SWAPSHORT(ObjBitmapPtrs[i]);
-       }
-#endif
 
-#ifndef PORTABLE_LOADER
-       cfread( &only_player_ship, sizeof(player_ship), 1, fp );
-#else
-       read_player_ship(fp);
-#endif
+       player_ship_read(&only_player_ship, fp);
 
        Num_cockpits = cfile_read_int(fp);
-       cfread( cockpit_bitmap, sizeof(bitmap_index), Num_cockpits, fp );
-#ifdef PORTABLE_LOADER
        for (i = 0; i < Num_cockpits; i++)
-               cockpit_bitmap[i].index = SWAPSHORT(cockpit_bitmap[i].index);
-#endif
+               bitmap_index_read(&cockpit_bitmap[i], fp);
 
 //@@   cfread( &Num_total_object_types, sizeof(int), 1, fp );
 //@@   cfread( ObjType, sizeof(byte), Num_total_object_types, fp );
@@ -730,11 +353,8 @@ void bm_read_all(CFILE * fp)
        First_multi_bitmap_num = cfile_read_int(fp);
 
        Num_reactors = cfile_read_int(fp);
-#ifndef MACINTOSH
-       cfread( Reactors, sizeof(*Reactors), Num_reactors, fp);
-#else
-       read_reactor_info(fp, Num_reactors, 0);
-#endif
+       for (i = 0; i < Num_reactors; i++)
+               reactor_read(&Reactors[i], fp);
 
        Marker_model_num = cfile_read_int(fp);
 
@@ -789,89 +409,61 @@ void bm_read_extra_robots(char *fname,int type)
        N_weapon_types = N_D2_WEAPON_TYPES+t;
        if (N_weapon_types >= MAX_WEAPON_TYPES)
                Error("Too many weapons (%d) in <%s>.  Max is %d.",t,fname,MAX_WEAPON_TYPES-N_D2_WEAPON_TYPES);
-       #ifdef MACINTOSH
-               read_weapon_info(fp, t, N_D2_WEAPON_TYPES);
-       #else
-               cfread( &Weapon_info[N_D2_WEAPON_TYPES], sizeof(weapon_info), t, fp );
-       #endif 
-       
+       for (i = N_D2_WEAPON_TYPES; i < t + N_D2_WEAPON_TYPES; i++)
+               weapon_info_read(&Weapon_info[i], fp);
+
        //now read robot info
 
        t = cfile_read_int(fp);
        N_robot_types = N_D2_ROBOT_TYPES+t;
        if (N_robot_types >= MAX_ROBOT_TYPES)
                Error("Too many robots (%d) in <%s>.  Max is %d.",t,fname,MAX_ROBOT_TYPES-N_D2_ROBOT_TYPES);
-       #ifdef MACINTOSH
-               read_robot_info(fp, t, N_D2_ROBOT_TYPES);
-       #else
-               cfread( &Robot_info[N_D2_ROBOT_TYPES], sizeof(robot_info), t, fp );
-       #endif
+       for (i = N_D2_ROBOT_TYPES; i < t + N_D2_ROBOT_TYPES; i++)
+               robot_info_read(&Robot_info[i], fp);
        
        t = cfile_read_int(fp);
        N_robot_joints = N_D2_ROBOT_JOINTS+t;
        if (N_robot_joints >= MAX_ROBOT_JOINTS)
                Error("Too many robot joints (%d) in <%s>.  Max is %d.",t,fname,MAX_ROBOT_JOINTS-N_D2_ROBOT_JOINTS);
-       #ifdef MACINTOSH
-               read_robot_joint_info(fp, t, N_D2_ROBOT_JOINTS);
-       #else
-               cfread( &Robot_joints[N_D2_ROBOT_JOINTS], sizeof(jointpos), t, fp );
-       #endif
+       for (i = N_D2_ROBOT_JOINTS; i < t + N_D2_ROBOT_JOINTS; i++)
+               jointpos_read(&Robot_joints[i], fp);
        
        t = cfile_read_int(fp);
        N_polygon_models = N_D2_POLYGON_MODELS+t;
        if (N_polygon_models >= MAX_POLYGON_MODELS)
                Error("Too many polygon models (%d) in <%s>.  Max is %d.",t,fname,MAX_POLYGON_MODELS-N_D2_POLYGON_MODELS);
-       #ifdef MACINTOSH
-               read_polygon_models(fp, t, N_D2_POLYGON_MODELS);
-       #else
-               cfread( &Polygon_models[N_D2_POLYGON_MODELS], sizeof(polymodel), t, fp );
-       #endif
-       
+       for (i = N_D2_POLYGON_MODELS; i < t + N_D2_POLYGON_MODELS; i++)
+               polymodel_read(&Polygon_models[i], fp);
+
        for (i=N_D2_POLYGON_MODELS; i<N_polygon_models; i++ )
        {
                Polygon_models[i].model_data = d_malloc(Polygon_models[i].model_data_size);
                Assert( Polygon_models[i].model_data != NULL );
                cfread( Polygon_models[i].model_data, sizeof(ubyte), Polygon_models[i].model_data_size, fp );
                
-               #ifdef MACINTOSH
-                       swap_polygon_model_data(Polygon_models[i].model_data);
-               #endif
+#ifdef WORDS_BIGENDIAN
+               swap_polygon_model_data(Polygon_models[i].model_data);
+#endif
                
                g3_init_polygon_model(Polygon_models[i].model_data);
        }
 
-       cfread( &Dying_modelnums[N_D2_POLYGON_MODELS], sizeof(int), t, fp );
-       cfread( &Dead_modelnums[N_D2_POLYGON_MODELS], sizeof(int), t, fp );
-
-       #ifdef MACINTOSH
-               for (i = N_D2_POLYGON_MODELS; i < N_polygon_models; i++)
-               {
-                       Dying_modelnums[i]= SWAPINT(Dying_modelnums[i]);
-                       Dead_modelnums[i]= SWAPINT(Dead_modelnums[i]);
-               }
-       #endif
+       for (i = N_D2_POLYGON_MODELS; i < N_polygon_models; i++)
+               Dying_modelnums[i] = cfile_read_int(fp);
+       for (i = N_D2_POLYGON_MODELS; i < N_polygon_models; i++)
+               Dead_modelnums[i] = cfile_read_int(fp);
 
        t = cfile_read_int(fp);
        if (N_D2_OBJBITMAPS+t >= MAX_OBJ_BITMAPS)
                Error("Too many object bitmaps (%d) in <%s>.  Max is %d.",t,fname,MAX_OBJ_BITMAPS-N_D2_OBJBITMAPS);
-       cfread( &ObjBitmaps[N_D2_OBJBITMAPS], sizeof(bitmap_index), t, fp );
-       #ifdef MACINTOSH
-               for (i = N_D2_OBJBITMAPS; i < (N_D2_OBJBITMAPS + t); i++)
-               {
-                       ObjBitmaps[i].index = SWAPSHORT(ObjBitmaps[i].index);
-               }
-       #endif
+       for (i = N_D2_OBJBITMAPS; i < (N_D2_OBJBITMAPS + t); i++)
+               bitmap_index_read(&ObjBitmaps[i], fp);
 
        t = cfile_read_int(fp);
        if (N_D2_OBJBITMAPPTRS+t >= MAX_OBJ_BITMAPS)
                Error("Too many object bitmap pointers (%d) in <%s>.  Max is %d.",t,fname,MAX_OBJ_BITMAPS-N_D2_OBJBITMAPPTRS);
-       cfread( &ObjBitmapPtrs[N_D2_OBJBITMAPPTRS], sizeof(ushort), t, fp );
-       #ifdef MACINTOSH
-               for (i = N_D2_OBJBITMAPPTRS; i < (N_D2_OBJBITMAPPTRS + t); i++)
-               {
-                       ObjBitmapPtrs[i] = SWAPSHORT(ObjBitmapPtrs[i]);
-               }
-       #endif
+       for (i = N_D2_OBJBITMAPPTRS; i < (N_D2_OBJBITMAPPTRS + t); i++)
+               ObjBitmapPtrs[i] = cfile_read_short(fp);
 
        cfclose(fp);
 }
@@ -904,13 +496,9 @@ void load_robot_replacements(char *level_name)
        t = cfile_read_int(fp);                 //read number of robots
        for (j=0;j<t;j++) {
                i = cfile_read_int(fp);         //read robot number
-          if (i<0 || i>=N_robot_types)
+               if (i<0 || i>=N_robot_types)
                        Error("Robots number (%d) out of range in (%s).  Range = [0..%d].",i,level_name,N_robot_types-1);
-               #ifdef MACINTOSH
-                       read_robot_info(fp, 1, i);
-               #else
-                       cfread( &Robot_info[i], sizeof(robot_info), 1, fp );
-               #endif
+               robot_info_read(&Robot_info[i], fp);
        }
 
        t = cfile_read_int(fp);                 //read number of joints
@@ -918,11 +506,7 @@ void load_robot_replacements(char *level_name)
                i = cfile_read_int(fp);         //read joint number
                if (i<0 || i>=N_robot_joints)
                        Error("Robots joint (%d) out of range in (%s).  Range = [0..%d].",i,level_name,N_robot_joints-1);
-               #ifdef MACINTOSH
-                       read_robot_joint_info(fp, 1, i);
-               #else
-                       cfread( &Robot_joints[i], sizeof(jointpos), 1, fp );
-               #endif
+               jointpos_read(&Robot_joints[i], fp);
        }
 
        t = cfile_read_int(fp);                 //read number of polygon models
@@ -931,21 +515,16 @@ void load_robot_replacements(char *level_name)
                i = cfile_read_int(fp);         //read model number
                if (i<0 || i>=N_polygon_models)
                        Error("Polygon model (%d) out of range in (%s).  Range = [0..%d].",i,level_name,N_polygon_models-1);
-       
-               #ifdef MACINTOSH
-                       read_polygon_models(fp, 1, i);
-               #else
-                       cfread( &Polygon_models[i], sizeof(polymodel), 1, fp );
-               #endif
+               polymodel_read(&Polygon_models[i], fp);
        
                d_free(Polygon_models[i].model_data);
                Polygon_models[i].model_data = d_malloc(Polygon_models[i].model_data_size);
                Assert( Polygon_models[i].model_data != NULL );
 
                cfread( Polygon_models[i].model_data, sizeof(ubyte), Polygon_models[i].model_data_size, fp );
-               #ifdef MACINTOSH
-                       swap_polygon_model_data(Polygon_models[i].model_data);
-               #endif
+#ifdef WORDS_BIGENDIAN
+               swap_polygon_model_data(Polygon_models[i].model_data);
+#endif
                g3_init_polygon_model(Polygon_models[i].model_data);
 
                Dying_modelnums[i] = cfile_read_int(fp);
@@ -957,7 +536,7 @@ void load_robot_replacements(char *level_name)
                i = cfile_read_int(fp);         //read objbitmap number
                if (i<0 || i>=MAX_OBJ_BITMAPS)
                        Error("Object bitmap number (%d) out of range in (%s).  Range = [0..%d].",i,level_name,MAX_OBJ_BITMAPS-1);
-               ObjBitmaps[i].index = cfile_read_short(fp);
+               bitmap_index_read(&ObjBitmaps[i], fp);
        }
 
        t = cfile_read_int(fp);                 //read number of objbitmapptrs
index 7801b74..8222a85 100644 (file)
--- a/main/bm.h
+++ b/main/bm.h
@@ -39,7 +39,7 @@ typedef struct {
        char            filename[13];           //used by editor to remap textures
        char            pad2[3];
        #endif
-} __pack__ tmap_info;
+} tmap_info;
 
 extern int Num_object_types;
 
index 9f98ed3..3001e20 100644 (file)
@@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: cntrlcen.c,v 1.3 2001-10-25 02:15:55 bradleyb Exp $";
+static char rcsid[] = "$Id: cntrlcen.c,v 1.4 2002-07-26 09:22:05 btb Exp $";
 #endif
 
 #ifdef WINDOWS
@@ -507,3 +507,17 @@ void special_reactor_stuff(void)
        }
 }
 
+/*
+ * reads a reactor structure from a CFILE
+ */
+extern void reactor_read(reactor *r, CFILE *fp)
+{
+       int i;
+       
+       r->model_num = cfile_read_int(fp);
+       r->n_guns = cfile_read_int(fp);
+       for (i = 0; i < MAX_CONTROLCEN_GUNS; i++)
+               cfile_read_vector(&(r->gun_points[i]), fp);
+       for (i = 0; i < MAX_CONTROLCEN_GUNS; i++)
+               cfile_read_vector(&(r->gun_dirs[i]), fp);
+}
index 8cb1c8f..7143f9c 100644 (file)
@@ -38,7 +38,7 @@ typedef struct reactor {
        int     n_guns;
        vms_vector gun_points[MAX_CONTROLCEN_GUNS];
        vms_vector gun_dirs[MAX_CONTROLCEN_GUNS];
-} __pack__ reactor;
+} reactor;
 
 #define MAX_REACTORS 7
 
@@ -74,4 +74,9 @@ extern int Control_center_destroyed,Countdown_seconds_left;
 extern int Base_control_center_explosion_time;         //how long to blow up on insane
 extern int Reactor_strength;
 
+/*
+ * reads a reactor structure from a CFILE
+ */
+extern void reactor_read(reactor *r, CFILE *fp);
+
 #endif
index 6406b45..dcc1ad4 100644 (file)
@@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: effects.c,v 1.2 2001-01-31 15:17:50 bradleyb Exp $";
+static char rcsid[] = "$Id: effects.c,v 1.3 2002-07-26 09:22:05 btb Exp $";
 #endif
 
 #include <stdio.h>
@@ -169,3 +169,23 @@ void restart_effect(int effect_num)
        //Assert(Effects[effect_num].bm_ptr != -1);
 }
 
+/*
+ * reads an eclip structure from a CFILE
+ */
+void eclip_read(eclip *ec, CFILE *fp)
+{
+       vclip_read(&ec->vc, fp);
+       ec->time_left = cfile_read_fix(fp);
+       ec->frame_count = cfile_read_int(fp);
+       ec->changing_wall_texture = cfile_read_short(fp);
+       ec->changing_object_texture = cfile_read_short(fp);
+       ec->flags = cfile_read_int(fp);
+       ec->crit_clip = cfile_read_int(fp);
+       ec->dest_bm_num = cfile_read_int(fp);
+       ec->dest_vclip = cfile_read_int(fp);
+       ec->dest_eclip = cfile_read_int(fp);
+       ec->dest_size = cfile_read_fix(fp);
+       ec->sound_num = cfile_read_int(fp);
+       ec->segnum = cfile_read_int(fp);
+       ec->sidenum = cfile_read_int(fp);
+}
index b85157e..af8135d 100644 (file)
@@ -40,7 +40,7 @@ typedef struct eclip {
        fix                     dest_size;              //3d size of explosion
        int                     sound_num;              //what sound this makes
        int                     segnum,sidenum; //what seg & side, for one-shot clips
-} __pack__ eclip;
+} eclip;
 
 extern int Num_effects;
 extern eclip Effects[MAX_EFFECTS];
@@ -63,4 +63,9 @@ void stop_effect(int effect_num);
 //restart a stopped effect
 void restart_effect(int effect_num);
 
+/*
+ * reads an eclip structure from a CFILE
+ */
+extern void eclip_read(eclip *ec, CFILE *fp);
+
 #endif
index 86d0d6b..92d328e 100644 (file)
@@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: piggy.c,v 1.7 2001-11-14 09:34:32 bradleyb Exp $";
+static char rcsid[] = "$Id: piggy.c,v 1.8 2002-07-26 09:22:05 btb Exp $";
 #endif
 
 
@@ -1730,7 +1730,12 @@ void piggy_bitmap_page_out_all_w()
 {
 }
 
-
 #endif
 
-
+/*
+ * reads a bitmap_index structure from a CFILE
+ */
+void bitmap_index_read(bitmap_index *bi, CFILE *fp)
+{
+       bi->index = cfile_read_short(fp);
+}
index bf48e44..3569ee4 100644 (file)
@@ -19,6 +19,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #include "digi.h"
 #include "sounds.h"
 #include "inferno.h"
+#include "cfile.h"
 
 #define MAX_ALIASES 20
 
@@ -32,7 +33,7 @@ extern int Num_aliases;
 
 typedef struct bitmap_index {
        ushort  index;
-} __pack__ bitmap_index;
+} bitmap_index;
 
 int piggy_init();
 void piggy_close();
@@ -90,4 +91,9 @@ void piggy_read_sounds();
 //returns the size of all the bitmap data
 void piggy_new_pigfile(char *pigname);
 
+/*
+ * reads a bitmap_index structure from a CFILE
+ */
+void bitmap_index_read(bitmap_index *bi, CFILE *fp);
+
 #endif
diff --git a/main/player.c b/main/player.c
new file mode 100644 (file)
index 0000000..5a71606
--- /dev/null
@@ -0,0 +1,32 @@
+/* $ Id: $ */
+
+#ifdef HAVE_CONFIG_H
+#include <conf.h>
+#endif
+
+#include "player.h"
+#include "cfile.h"
+
+#ifdef RCS
+static char rcsid[] = "$Id: player.c,v 1.1 2002-07-26 09:22:05 btb Exp $";
+#endif
+
+/*
+ * reads a player_ship structure from a CFILE
+ */
+void player_ship_read(player_ship *ps, CFILE *fp)
+{
+       int i;
+
+       ps->model_num = cfile_read_int(fp);
+       ps->expl_vclip_num = cfile_read_int(fp);
+       ps->mass = cfile_read_fix(fp);
+       ps->drag = cfile_read_fix(fp);
+       ps->max_thrust = cfile_read_fix(fp);
+       ps->reverse_thrust = cfile_read_fix(fp);
+       ps->brakes = cfile_read_fix(fp);
+       ps->wiggle = cfile_read_fix(fp);
+       ps->max_rotthrust = cfile_read_fix(fp);
+       for (i = 0; i < N_PLAYER_GUNS; i++)
+               cfile_read_vector(&(ps->gun_points[i]), fp);
+}
index 1acd583..7914138 100644 (file)
@@ -129,7 +129,7 @@ typedef struct player_ship {
        fix             wiggle;
        fix             max_rotthrust;
        vms_vector gun_points[N_PLAYER_GUNS];
-} __pack__ player_ship;
+} player_ship;
 
 extern int N_players;                                                          // Number of players ( >1 means a net game, eh?)
 extern int Player_num;                                                         // The player number who is on the console.
@@ -190,4 +190,9 @@ typedef struct player16 {
        byte            hours_total;                                    // Hours played (since time_total can only go up to 9 hours)
 } __pack__ player16;
 
+/*
+ * reads a player_ship structure from a CFILE
+ */
+void player_ship_read(player_ship *ps, CFILE *fp);
+
 #endif
index c83aaeb..3b3ac8c 100644 (file)
@@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: polyobj.c,v 1.5 2001-01-31 15:34:40 bradleyb Exp $";
+static char rcsid[] = "$Id: polyobj.c,v 1.6 2002-07-26 09:22:05 btb Exp $";
 #endif
 
 #include <stdio.h>
@@ -758,3 +758,35 @@ void draw_model_picture(int mn,vms_angvec *orient_angles)
        gr_free_canvas(temp_canv);
 }
 
+/*
+ * reads a polymodel structure from a CFILE
+ */
+extern void polymodel_read(polymodel *pm, CFILE *fp)
+{
+       int i;
+
+       pm->n_models = cfile_read_int(fp);
+       pm->model_data_size = cfile_read_int(fp);
+       pm->model_data = (ubyte *) cfile_read_int(fp);
+       for (i = 0; i < MAX_SUBMODELS; i++)
+               pm->submodel_ptrs[i] = cfile_read_int(fp);
+       for (i = 0; i < MAX_SUBMODELS; i++)
+               cfile_read_vector(&(pm->submodel_offsets[i]), fp);
+       for (i = 0; i < MAX_SUBMODELS; i++)
+               cfile_read_vector(&(pm->submodel_norms[i]), fp);
+       for (i = 0; i < MAX_SUBMODELS; i++)
+               cfile_read_vector(&(pm->submodel_pnts[i]), fp);
+       for (i = 0; i < MAX_SUBMODELS; i++)
+               pm->submodel_rads[i] = cfile_read_fix(fp);
+       cfread(pm->submodel_parents, MAX_SUBMODELS, 1, fp);
+       for (i = 0; i < MAX_SUBMODELS; i++)
+               cfile_read_vector(&(pm->submodel_mins[i]), fp);
+       for (i = 0; i < MAX_SUBMODELS; i++)
+               cfile_read_vector(&(pm->submodel_maxs[i]), fp);
+       cfile_read_vector(&(pm->mins), fp);
+       cfile_read_vector(&(pm->maxs), fp);
+       pm->rad = cfile_read_fix(fp);           
+       pm->n_textures = cfile_read_byte(fp);
+       pm->first_texture = cfile_read_short(fp);
+       pm->simpler_model = cfile_read_byte(fp);
+}
index 367dbf2..b243a51 100644 (file)
@@ -46,7 +46,7 @@ typedef struct polymodel {
        ushort  first_texture;
        ubyte           simpler_model;          //alternate model with less detail (0 if none, model_num+1 else)
 //     vms_vector min,max;
-} __pack__ polymodel;
+} polymodel;
 
 //array of pointers to polygon objects
 extern polymodel Polygon_models[];
@@ -87,5 +87,10 @@ extern grs_bitmap *texture_list[MAX_POLYOBJ_TEXTURES];
 extern bitmap_index texture_list_index[MAX_POLYOBJ_TEXTURES];
 extern g3s_point robot_points[];
 
+/*
+ * reads a polymodel structure from a CFILE
+ */
+extern void polymodel_read(polymodel *pm, CFILE *fp);
+
 #endif
 
index 64479c2..15ad48f 100644 (file)
@@ -700,3 +700,14 @@ int do_powerup(object *obj)
        return used;
 
 }
+
+/*
+ * reads a powerup_type_info structure from a CFILE
+ */
+extern void powerup_type_info_read(powerup_type_info *pti, CFILE *fp)
+{
+       pti->vclip_num = cfile_read_int(fp);
+       pti->hit_sound = cfile_read_int(fp);
+       pti->size = cfile_read_fix(fp);
+       pti->light = cfile_read_fix(fp);
+}
index ff883ef..c485200 100644 (file)
@@ -95,7 +95,7 @@ typedef struct powerup_type_info {
        int     hit_sound;
        fix     size;                   //3d size of longest dimension
        fix     light;          //      amount of light cast by this powerup, set in bitmaps.tbl
-} __pack__ powerup_type_info;
+} powerup_type_info;
 
 extern int N_powerup_types;
 extern powerup_type_info Powerup_info[MAX_POWERUP_TYPES];
@@ -115,4 +115,9 @@ extern void do_megawow_powerup(int quantity);
 
 extern void powerup_basic(int redadd, int greenadd, int blueadd, int score, char *format, ...);
 
+/*
+ * reads a powerup_type_info structure from a CFILE
+ */
+extern void powerup_type_info_read(powerup_type_info *pti, CFILE *fp);
+
 #endif
index 8c662f6..4a47d35 100644 (file)
@@ -238,4 +238,108 @@ void robot_set_angles(robot_info *r,polymodel *pm,vms_angvec angs[N_ANIM_STATES]
 
 }
 
+/*
+ * reads a jointlist structure from a CFILE
+ */
+static void jointlist_read(jointlist *jl, CFILE *fp)
+{
+       jl->n_joints = cfile_read_short(fp);
+       jl->offset = cfile_read_short(fp);
+}
+
+/*
+ * reads a robot_info structure from a CFILE
+ */
+void robot_info_read(robot_info *ri, CFILE *fp)
+{
+       int i, j;
+       
+       ri->model_num = cfile_read_int(fp);
+       for (i = 0; i < MAX_GUNS; i++)
+               cfile_read_vector(&(ri->gun_points[i]), fp);
+       cfread(ri->gun_submodels, MAX_GUNS, 1, fp);
+
+       ri->exp1_vclip_num = cfile_read_short(fp);
+       ri->exp1_sound_num = cfile_read_short(fp);
+
+       ri->exp2_vclip_num = cfile_read_short(fp);
+       ri->exp2_sound_num = cfile_read_short(fp);
+
+       ri->weapon_type = cfile_read_byte(fp);
+       ri->weapon_type2 = cfile_read_byte(fp);
+       ri->n_guns = cfile_read_byte(fp);
+       ri->contains_id = cfile_read_byte(fp);
+
+       ri->contains_count = cfile_read_byte(fp);
+       ri->contains_prob = cfile_read_byte(fp);
+       ri->contains_type = cfile_read_byte(fp);
+       ri->kamikaze = cfile_read_byte(fp);
+
+       ri->score_value = cfile_read_short(fp);
+       ri->badass = cfile_read_byte(fp);
+       ri->energy_drain = cfile_read_byte(fp);
+
+       ri->lighting = cfile_read_fix(fp);
+       ri->strength = cfile_read_fix(fp);
+
+       ri->mass = cfile_read_fix(fp);
+       ri->drag = cfile_read_fix(fp);
+
+       for (i = 0; i < NDL; i++)
+               ri->field_of_view[i] = cfile_read_fix(fp);
+       for (i = 0; i < NDL; i++)
+               ri->firing_wait[i] = cfile_read_fix(fp);
+       for (i = 0; i < NDL; i++)
+               ri->firing_wait2[i] = cfile_read_fix(fp);
+       for (i = 0; i < NDL; i++)
+               ri->turn_time[i] = cfile_read_fix(fp);
+       for (i = 0; i < NDL; i++)
+               ri->max_speed[i] = cfile_read_fix(fp);
+       for (i = 0; i < NDL; i++)
+               ri->circle_distance[i] = cfile_read_fix(fp);
+       cfread(ri->rapidfire_count, NDL, 1, fp);
+
+       cfread(ri->evade_speed, NDL, 1, fp);
+
+       ri->cloak_type = cfile_read_byte(fp);
+       ri->attack_type = cfile_read_byte(fp);
+
+       ri->see_sound = cfile_read_byte(fp);
+       ri->attack_sound = cfile_read_byte(fp);
+       ri->claw_sound = cfile_read_byte(fp);
+       ri->taunt_sound = cfile_read_byte(fp);
+
+       ri->boss_flag = cfile_read_byte(fp);
+       ri->companion = cfile_read_byte(fp);
+       ri->smart_blobs = cfile_read_byte(fp);
+       ri->energy_blobs = cfile_read_byte(fp);
+
+       ri->thief = cfile_read_byte(fp);
+       ri->pursuit = cfile_read_byte(fp);
+       ri->lightcast = cfile_read_byte(fp);
+       ri->death_roll = cfile_read_byte(fp);
+
+       ri->flags = cfile_read_byte(fp);
+       cfread(ri->pad, 3, 1, fp);
+
+       ri->deathroll_sound = cfile_read_byte(fp);
+       ri->glow = cfile_read_byte(fp);
+       ri->behavior = cfile_read_byte(fp);
+       ri->aim = cfile_read_byte(fp);
+
+       for (i = 0; i < MAX_GUNS + 1; i++)
+               for (j = 0; j < N_ANIM_STATES; j++)
+                       jointlist_read(&ri->anim_states[i][j], fp);
+
+       ri->always_0xabcd = cfile_read_int(fp);
+}
+
+/*
+ * reads a jointpos structure from a CFILE
+ */
+void jointpos_read(jointpos *jp, CFILE *fp)
+{
+       jp->jointnum = cfile_read_short(fp);
+       cfile_read_angvec(&jp->angles, fp);
+}
 
index 51122d9..781cd39 100644 (file)
@@ -19,26 +19,27 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #include "vecmat.h"
 #include "object.h"
 #include "game.h"
+#include "cfile.h"
 
 #define MAX_GUNS 8             //should be multiple of 4 for ubyte array
 
 //Animation states
-#define AS_REST                        0
-#define AS_ALERT                       1
-#define AS_FIRE                        2
-#define AS_RECOIL                      3
-#define AS_FLINCH                      4
-#define N_ANIM_STATES  5
+#define AS_REST                0
+#define AS_ALERT        1
+#define AS_FIRE                2
+#define AS_RECOIL       3
+#define AS_FLINCH       4
+#define N_ANIM_STATES   5
 
-#define        RI_CLOAKED_NEVER                                        0
-#define        RI_CLOAKED_ALWAYS                                       1
-#define        RI_CLOAKED_EXCEPT_FIRING                2
+#define        RI_CLOAKED_NEVER            0
+#define        RI_CLOAKED_ALWAYS           1
+#define        RI_CLOAKED_EXCEPT_FIRING    2
 
 //describes the position of a certain joint
 typedef struct jointpos {
        short jointnum;
        vms_angvec angles;
-} __pack__ jointpos;
+} jointpos;
 
 //describes a list of joint positions
 typedef struct jointlist {
@@ -125,7 +126,7 @@ typedef struct robot_info {
 
        int             always_0xabcd;                                                  // debugging
 
-} __pack__ robot_info;
+} robot_info;
 
 
 #define        MAX_ROBOT_TYPES 85                      // maximum number of robot types
@@ -170,4 +171,14 @@ void calc_gun_point(vms_vector *gun_point,object *obj,int gun_num);
 //             jp_list_ptr is stuffed with a pointer to a static array of joint positions.  This pointer is valid forever.
 extern int robot_get_anim_state(jointpos **jp_list_ptr,int robot_type,int gun_num,int state);
 
+/*
+ * reads a robot_info structure from a CFILE
+ */
+extern void robot_info_read(robot_info *ri, CFILE *fp);
+
+/*
+ * reads a jointpos structure from a CFILE
+ */
+extern void jointpos_read(jointpos *jp, CFILE *fp);
+
 #endif
index 2e96b69..3e90f9b 100644 (file)
@@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: vclip.c,v 1.2 2001-01-31 15:17:59 bradleyb Exp $";
+static char rcsid[] = "$Id: vclip.c,v 1.3 2002-07-26 09:22:05 btb Exp $";
 #endif
 
 #include <stdlib.h>
@@ -101,3 +101,19 @@ void draw_weapon_vclip(object *obj)
 
 }
 
+/*
+ * reads a vclip structure from a CFILE
+ */
+void vclip_read(vclip *vc, CFILE *fp)
+{
+       int i;
+
+       vc->play_time = cfile_read_fix(fp);
+       vc->num_frames = cfile_read_int(fp);
+       vc->frame_time = cfile_read_fix(fp);
+       vc->flags = cfile_read_int(fp);
+       vc->sound_num = cfile_read_short(fp);
+       for (i = 0; i < VCLIP_MAX_FRAMES; i++)
+               vc->frames[i].index = cfile_read_short(fp);
+       vc->light_value = cfile_read_fix(fp);
+}
index 871f102..c9e88f3 100644 (file)
@@ -17,6 +17,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #include "gr.h"
 #include "object.h"
 #include "piggy.h"
+#include "cfile.h"
 
 #define VCLIP_SMALL_EXPLOSION          2
 #define VCLIP_PLAYER_HIT                       1
@@ -42,7 +43,7 @@ typedef struct {
        short                           sound_num;
        bitmap_index    frames[VCLIP_MAX_FRAMES];
        fix                             light_value;
-} __pack__ vclip;
+} vclip;
 
 extern int Num_vclips;
 extern vclip Vclip[VCLIP_MAXNUM];
@@ -51,4 +52,9 @@ extern vclip Vclip[VCLIP_MAXNUM];
 void draw_vclip_object(object *obj,fix timeleft,int lighted, int vclip_num);
 extern void draw_weapon_vclip(object *obj);
 
+/*
+ * reads a vclip structure from a CFILE
+ */
+extern void vclip_read(vclip *vc, CFILE *fp);
+
 #endif
index c83dac6..fb6aedb 100644 (file)
@@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: wall.c,v 1.4 2001-10-25 02:15:57 bradleyb Exp $";
+static char rcsid[] = "$Id: wall.c,v 1.5 2002-07-26 09:22:05 btb Exp $";
 #endif
 
 #include <stdio.h>
@@ -1544,3 +1544,20 @@ void blast_nearby_glass(object *objp, fix damage)
 
 }
 
+/*
+ * reads a wclip structure from a CFILE
+ */
+void wclip_read(wclip *wc, CFILE *fp)
+{
+       int i;
+       
+       wc->play_time = cfile_read_fix(fp);;
+       wc->num_frames = cfile_read_short(fp);;
+       for (i = 0; i < MAX_CLIP_FRAMES; i++)
+               wc->frames[i] = cfile_read_short(fp);
+       wc->open_sound = cfile_read_short(fp);
+       wc->close_sound = cfile_read_short(fp);
+       wc->flags = cfile_read_short(fp);
+       cfread(wc->filename, 13, 1, fp);
+       wc->pad = cfile_read_byte(fp);
+}
index 33a7062..b298b25 100644 (file)
@@ -17,6 +17,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #include "inferno.h"
 #include "segment.h"
 #include "object.h"
+#include "cfile.h"
 
 //#include "vclip.h"
 
@@ -136,7 +137,7 @@ typedef struct {
        short                           flags;
        char                            filename[13];
        char                            pad;
-} __pack__ wclip;
+} wclip;
 
 extern char    Wall_names[7][10];
 
@@ -222,4 +223,9 @@ void kill_stuck_objects(int wallnum);
 void start_wall_cloak(segment *seg, int side);
 void start_wall_decloak(segment *seg, int side);
 
+/*
+ * reads a wclip structure from a CFILE
+ */
+extern void wclip_read(wclip *wc, CFILE *fp);
+
 #endif
index ee5e789..0ea4a86 100644 (file)
@@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: weapon.c,v 1.2 2001-01-31 15:17:59 bradleyb Exp $";
+static char rcsid[] = "$Id: weapon.c,v 1.3 2002-07-26 09:22:05 btb Exp $";
 #endif
 
 #include <stdlib.h>
@@ -1299,3 +1299,64 @@ void tactile_set_button_jolt ()
    }
   #endif
  }
+
+/*
+ * reads a weapon_info structure from a CFILE
+ */
+extern void weapon_info_read(weapon_info *wi, CFILE *fp)
+{
+       int i;
+       
+       wi->render_type = cfile_read_byte(fp);
+       wi->persistent = cfile_read_byte(fp);
+       wi->model_num = cfile_read_short(fp);
+       wi->model_num_inner = cfile_read_short(fp);
+
+       wi->flash_vclip = cfile_read_byte(fp);
+       wi->robot_hit_vclip = cfile_read_byte(fp);
+       wi->flash_sound = cfile_read_short(fp);         
+
+       wi->wall_hit_vclip = cfile_read_byte(fp);
+       wi->fire_count = cfile_read_byte(fp);
+       wi->robot_hit_sound = cfile_read_short(fp);
+               
+       wi->ammo_usage = cfile_read_byte(fp);
+       wi->weapon_vclip = cfile_read_byte(fp);
+       wi->wall_hit_sound = cfile_read_short(fp);              
+
+       wi->destroyable = cfile_read_byte(fp);
+       wi->matter = cfile_read_byte(fp);
+       wi->bounce = cfile_read_byte(fp);
+       wi->homing_flag = cfile_read_byte(fp);
+
+       wi->speedvar = cfile_read_byte(fp);
+       wi->flags = cfile_read_byte(fp);
+       wi->flash = cfile_read_byte(fp);
+       wi->afterburner_size = cfile_read_byte(fp);
+               
+       wi->children = cfile_read_byte(fp);
+
+       wi->energy_usage = cfile_read_fix(fp);
+       wi->fire_wait = cfile_read_fix(fp);
+               
+       wi->multi_damage_scale = cfile_read_fix(fp);
+               
+       wi->bitmap.index = cfile_read_short(fp);        // bitmap_index = short
+
+       wi->blob_size = cfile_read_fix(fp);
+       wi->flash_size = cfile_read_fix(fp);
+       wi->impact_size = cfile_read_fix(fp);
+       for (i = 0; i < NDL; i++)
+               wi->strength[i] = cfile_read_fix(fp);
+       for (i = 0; i < NDL; i++)
+               wi->speed[i] = cfile_read_fix(fp);
+       wi->mass = cfile_read_fix(fp);
+       wi->drag = cfile_read_fix(fp);
+       wi->thrust = cfile_read_fix(fp);
+       wi->po_len_to_width_ratio = cfile_read_fix(fp);
+       wi->light = cfile_read_fix(fp);
+       wi->lifetime = cfile_read_fix(fp);
+       wi->damage_radius = cfile_read_fix(fp);
+       wi->picture.index = cfile_read_short(fp);               // bitmap_index is a short
+       wi->hires_picture.index = cfile_read_short(fp);         // bitmap_index is a short
+}
index 0573dc9..6bc8c73 100644 (file)
@@ -18,6 +18,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #include "gr.h"
 #include "game.h"
 #include "piggy.h"
+#include "cfile.h"
 
 //weapon info flags
 #define WIF_PLACABLE           1               //can be placed by level designer
@@ -83,7 +84,7 @@ typedef struct weapon_info {
 #ifndef SHAREWARE
        bitmap_index    hires_picture;          // a hires picture of the above
 #endif
-} __pack__ weapon_info;
+} weapon_info;
 
 #define        REARM_TIME                                      (F1_0)
 
@@ -223,4 +224,9 @@ extern void smega_rock_stuff(void);
 extern void init_smega_detonates(void);
 extern void tactile_set_button_jolt (void);
 
+/*
+ * reads a weapon_info structure from a CFILE
+ */
+extern void weapon_info_read(weapon_info *wi, CFILE *fp);
+
 #endif