Use macros to use Segment2s when necessary.
authorBradley Bell <btb@icculus.org>
Fri, 24 Dec 2004 05:17:09 +0000 (05:17 +0000)
committerBradley Bell <btb@icculus.org>
Fri, 24 Dec 2004 05:17:09 +0000 (05:17 +0000)
ChangeLog
main/editor/centers.c
main/editor/editor.h
main/editor/eswitch.c
main/editor/group.c
main/editor/med.c
main/editor/meddraw.c
main/editor/medwall.c
main/editor/mine.c
main/editor/seguvs.c
main/segment.h

index 244526b..4559d69 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-12-23  Bradley Bell  <btb@icculus.org>
+
+       * main/editor/centers.c, main/editor/editor.h,
+       main/editor/eswitch.c, main/editor/group.c, main/editor/med.c,
+       main/editor/meddraw.h, main/editor/medwall.c, main/editor/mine.c,
+       main/editor/seguvs.c, main/segment.h: Use macros to use Segment2s
+       when necessary.
+
 2004-12-21  Chris Taylor  <c.taylor@student.curtin.edu.au>
 
        * main/bmread.c: don't duplicate the period in the filename
index 78468ce..602b703 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: centers.c,v 1.3 2004-12-19 15:21:11 btb Exp $ */
+/* $Id: centers.c,v 1.4 2004-12-24 05:17:09 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -19,7 +19,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  */
 
 #ifdef RCS
-static char rcsid[] = "$Id: centers.c,v 1.3 2004-12-19 15:21:11 btb Exp $";
+static char rcsid[] = "$Id: centers.c,v 1.4 2004-12-24 05:17:09 btb Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -145,15 +145,15 @@ void do_centers_window()
                        CenterFlag[i]->status = 1;              // Tells ui to redraw button
                }
 
-               Assert(Cursegp->special < MAX_CENTER_TYPES);
-               CenterFlag[Cursegp->special]->flag = 1;
+               Assert(Curseg2p->special < MAX_CENTER_TYPES);
+               CenterFlag[Curseg2p->special]->flag = 1;
 
-               mprintf((0, "Cursegp->matcen_num = %i\n", Cursegp->matcen_num));
+               mprintf((0, "Curseg2p->matcen_num = %i\n", Curseg2p->matcen_num));
 
                //      Read materialization center robot bit flags
                for (   i=0; i < N_robot_types; i++ ) {
                        RobotMatFlag[i]->status = 1;            // Tells ui to redraw button
-                       if (RobotCenters[Cursegp->matcen_num].robot_flags & (1 << i))
+                       if (RobotCenters[Curseg2p->matcen_num].robot_flags[0] & (1 << i))
                                RobotMatFlag[i]->flag = 1;              // Tells ui that this button is checked
                        else
                                RobotMatFlag[i]->flag = 0;              // Tells ui that this button is not checked
@@ -172,7 +172,8 @@ void do_centers_window()
                  {
                        if ( i == 0)
                                fuelcen_delete(Cursegp);
-                       else if ( Cursegp->special != i ) {
+                       else if (Curseg2p->special != i)
+                       {
                                fuelcen_delete(Cursegp);
                                redraw_window = 1;
                                fuelcen_activate( Cursegp, i );
@@ -182,13 +183,16 @@ void do_centers_window()
 
        for (   i=0; i < N_robot_types; i++ )   {
                if ( RobotMatFlag[i]->flag == 1 ) {
-                       if (!(RobotCenters[Cursegp->matcen_num].robot_flags & (1<<i) )) {
-                               RobotCenters[Cursegp->matcen_num].robot_flags |= (1<<i);
-                               mprintf((0,"Segment %i, matcen = %i, Robot_flags %d\n", Cursegp-Segments, Cursegp->matcen_num, RobotCenters[Cursegp->matcen_num].robot_flags));
+                       if (!(RobotCenters[Curseg2p->matcen_num].robot_flags[0] & (1 << i)))
+                       {
+                               RobotCenters[Curseg2p->matcen_num].robot_flags[0] |= (1 << i);
+                               mprintf((0, "Segment %i, matcen = %i, Robot_flags %d\n", Cursegp - Segments, Curseg2p->matcen_num, RobotCenters[Curseg2p->matcen_num].robot_flags[0]));
                        } 
-               } else if (RobotCenters[Cursegp->matcen_num].robot_flags & 1<<i) {
-                       RobotCenters[Cursegp->matcen_num].robot_flags &= ~(1<<i);
-                       mprintf((0,"Segment %i, matcen = %i, Robot_flags %d\n", Cursegp-Segments, Cursegp->matcen_num, RobotCenters[Cursegp->matcen_num].robot_flags));
+               }
+               else if (RobotCenters[Curseg2p->matcen_num].robot_flags[0] & 1 << i)
+               {
+                       RobotCenters[Curseg2p->matcen_num].robot_flags[0] &= ~(1 << i);
+                       mprintf((0, "Segment %i, matcen = %i, Robot_flags %d\n", Cursegp - Segments, Curseg2p->matcen_num, RobotCenters[Curseg2p->matcen_num].robot_flags[0]));
                }
        }
        
@@ -206,8 +210,8 @@ void do_centers_window()
 //                     temp_text[i] = ' ';
 //             temp_text[i] = 0;
 
-//             Assert(Cursegp->special < MAX_CENTER_TYPES);
-//             strncpy(temp_text, Center_names[Cursegp->special], strlen(Center_names[Cursegp->special]));
+//             Assert(Curseg2p->special < MAX_CENTER_TYPES);
+//             strncpy(temp_text, Center_names[Curseg2p->special], strlen(Center_names[Curseg2p->special]));
 //             ui_wprintf_at( MainWindow, 12, 23, " Type: %s", temp_text );
                Update_flags |= UF_WORLD_CHANGED;
        }
index 397f434..2188437 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: editor.h,v 1.4 2004-12-19 14:52:48 btb Exp $ */
+/* $Id: editor.h,v 1.5 2004-12-24 05:17:09 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -163,6 +163,8 @@ extern int gamestate_not_restored;
 
 
 extern segment  *Cursegp;                              // Pointer to current segment in the mine, the one to which things happen.
+#define Curseg2p s2s2(Cursegp)          // Pointer to segment2 for Cursegp
+
 extern vms_vector Ed_view_target;              // what editor is looking at
 
 // -- extern   segment  New_segment;                   // The segment which can be added to the mine.
index d06852e..79e5627 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: eswitch.c,v 1.3 2004-12-19 15:21:11 btb Exp $ */
+/* $Id: eswitch.c,v 1.4 2004-12-24 05:17:09 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -19,7 +19,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  */
 
 #ifdef RCS
-static char rcsid[] = "$Id: eswitch.c,v 1.3 2004-12-19 15:21:11 btb Exp $";
+static char rcsid[] = "$Id: eswitch.c,v 1.4 2004-12-24 05:17:09 btb Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -190,7 +190,8 @@ int bind_matcen_to_trigger() {
                return 0;
        }
 
-       if (!(Cursegp->special & SEGMENT_IS_ROBOTMAKER)) {
+       if (!(Curseg2p->special & SEGMENT_IS_ROBOTMAKER))
+       {
                editor_status("No Matcen at Cursegp.");
                return 0;
        }
index 9169efb..daf610e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: group.c,v 1.3 2004-12-19 15:21:11 btb Exp $ */
+/* $Id: group.c,v 1.4 2004-12-24 05:17:09 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -19,7 +19,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  */
 
 #ifdef RCS
-static char rcsid[] = "$Id: group.c,v 1.3 2004-12-19 15:21:11 btb Exp $";
+static char rcsid[] = "$Id: group.c,v 1.4 2004-12-24 05:17:09 btb Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -628,8 +628,8 @@ int med_copy_group(int delta_flag, segment *base_seg, int base_side, segment *gr
 
        for (s=0; s<GroupList[new_current_group].num_segments; s++) {
                Segments[GroupList[new_current_group].segments[s]].group = new_current_group;
-               Segments[GroupList[new_current_group].segments[s]].special = SEGMENT_IS_NOTHING;
-               Segments[GroupList[new_current_group].segments[s]].matcen_num = -1;
+               Segment2s[GroupList[new_current_group].segments[s]].special = SEGMENT_IS_NOTHING;
+               Segment2s[GroupList[new_current_group].segments[s]].matcen_num = -1;
        }
 
        // Breaking connections between segments in the current group and segments not in the group.
@@ -1361,7 +1361,7 @@ int med_load_group( char *filename, short *vertex_ids, short *segment_ids, int *
                        Segments[segment_ids[i]] = tseg; 
                        Segments[segment_ids[i]].objects = -1;
 
-                       fuelcen_activate( &Segments[segment_ids[i]], Segments[segment_ids[i]].special );
+                       fuelcen_activate(&Segments[segment_ids[i]], Segment2s[segment_ids[i]].special);
                        }
 
                for (i=0;i<group_header.num_segments;i++) {
index 5d07cbf..4fad6fe 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: med.c,v 1.4 2004-12-21 11:58:14 btb Exp $ */
+/* $Id: med.c,v 1.5 2004-12-24 05:17:09 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -431,30 +431,30 @@ int SetPlayerFromCurseg()
 
 int fuelcen_create_from_curseg()
 {
-       Cursegp->special = SEGMENT_IS_FUELCEN;
-       fuelcen_activate( Cursegp, Cursegp->special);
+       Curseg2p->special = SEGMENT_IS_FUELCEN;
+       fuelcen_activate(Cursegp, Curseg2p->special);
        return 1;
 }
 
 int repaircen_create_from_curseg()
 {
        Int3(); //      -- no longer supported!
-//     Cursegp->special = SEGMENT_IS_REPAIRCEN;
-//     fuelcen_activate( Cursegp, Cursegp->special);
+//     Curseg2p->special = SEGMENT_IS_REPAIRCEN;
+//     fuelcen_activate(Cursegp, Curseg2p->special);
        return 1;
 }
 
 int controlcen_create_from_curseg()
 {
-       Cursegp->special = SEGMENT_IS_CONTROLCEN;
-       fuelcen_activate( Cursegp, Cursegp->special);
+       Curseg2p->special = SEGMENT_IS_CONTROLCEN;
+       fuelcen_activate(Cursegp, Curseg2p->special);
        return 1;
 }
 
 int robotmaker_create_from_curseg()
 {
-       Cursegp->special = SEGMENT_IS_ROBOTMAKER;
-       fuelcen_activate( Cursegp, Cursegp->special);
+       Curseg2p->special = SEGMENT_IS_ROBOTMAKER;
+       fuelcen_activate(Cursegp, Curseg2p->special);
        return 1;
 }
 
index 45faae0..6eb32d1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: meddraw.c,v 1.3 2004-12-19 15:21:11 btb Exp $ */
+/* $Id: meddraw.c,v 1.4 2004-12-24 05:17:09 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -19,7 +19,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  */
 
 #ifdef RCS
-static char rcsid[] = "$Id: meddraw.c,v 1.3 2004-12-19 15:21:11 btb Exp $";
+static char rcsid[] = "$Id: meddraw.c,v 1.4 2004-12-24 05:17:09 btb Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -693,7 +693,8 @@ void draw_special_segments(void)
        // Highlight matcens, fuelcens, etc.
        for (seg=0;seg<=Highest_segment_index;seg++)
                if (Segments[seg].segnum != -1)
-                       switch( Segments[seg].special ) {
+                       switch(Segment2s[seg].special)
+                       {
                        case SEGMENT_IS_FUELCEN:
                                color = BM_XRGB( 29, 27, 13 );
                                gr_setcolor(color);
index 0f5f00b..3db8130 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: medwall.c,v 1.3 2004-12-19 15:21:11 btb Exp $ */
+/* $Id: medwall.c,v 1.4 2004-12-24 05:17:09 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -19,7 +19,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  */
 
 #ifdef RCS
-static char rcsid[] = "$Id: medwall.c,v 1.3 2004-12-19 15:21:11 btb Exp $";
+static char rcsid[] = "$Id: medwall.c,v 1.4 2004-12-24 05:17:09 btb Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -1027,11 +1027,11 @@ int check_walls()
        for (seg=0;seg<=Highest_segment_index;seg++) 
                if (Segments[seg].segnum != -1) {
                        // Check fuelcenters
-                       matcen_num = Segments[seg].matcen_num;
+                       matcen_num = Segment2s[seg].matcen_num;
                        if (matcen_num == 0)
                                if (RobotCenters[0].segnum != seg) {
                                        mprintf((0,"Fixing Matcen 0\n"));
-                                       Segments[seg].matcen_num = -1;
+                                       Segment2s[seg].matcen_num = -1;
                                }
        
                        if (matcen_num > -1)
@@ -1123,7 +1123,7 @@ int check_walls()
                                mprintf((0,"No valid links on Matcen Trigger %d\n", t));
                        else
                                for (l=0;l<Triggers[t].num_links;l++) {
-                                       if (!Segments[Triggers[t].seg[l]].special & SEGMENT_IS_ROBOTMAKER)
+                                       if (!Segment2s[Triggers[t].seg[l]].special & SEGMENT_IS_ROBOTMAKER)
                                                mprintf((0,"Bogus Matcen trigger detected on Trigger %d, No matcen at seg %d\n", t, Triggers[t].seg[l]));
                                }
                  }
index c488fe4..4f26a89 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: mine.c,v 1.4 2004-12-21 11:58:14 btb Exp $ */
+/* $Id: mine.c,v 1.5 2004-12-24 05:17:09 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -19,7 +19,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  */
 
 #ifdef RCS
-static char rcsid[] = "$Id: mine.c,v 1.4 2004-12-21 11:58:14 btb Exp $";
+static char rcsid[] = "$Id: mine.c,v 1.5 2004-12-24 05:17:09 btb Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -314,15 +314,15 @@ int save_mine_data_compiled(FILE * SaveFile)
                cfwrite( &Segments[segnum].children, sizeof(short), MAX_SIDES_PER_SEGMENT, SaveFile );
                // Write short Segments[segnum].verts[MAX_VERTICES_PER_SEGMENT]
                cfwrite( &Segments[segnum].verts, sizeof(short), MAX_VERTICES_PER_SEGMENT, SaveFile );
-               // Write ubyte  Segments[segnum].special
-               cfwrite( &Segments[segnum].special, sizeof(ubyte), 1, SaveFile );
-               // Write byte   Segments[segnum].matcen_num
-               cfwrite( &Segments[segnum].matcen_num, sizeof(ubyte), 1, SaveFile );
-               // Write short  Segments[segnum].value
-               cfwrite( &Segments[segnum].value, sizeof(short), 1, SaveFile );
-               // Write fix    Segments[segnum].static_light (shift down 5 bits, write as short)
-               dump_fix_as_ushort( Segments[segnum].static_light, 4, SaveFile );
-               //cfwrite( &Segments[segnum].static_light , sizeof(fix), 1, SaveFile );
+               // Write ubyte Segment2s[segnum].special
+               cfwrite(&Segment2s[segnum].special, sizeof(ubyte), 1, SaveFile);
+               // Write byte Segment2s[segnum].matcen_num
+               cfwrite(&Segment2s[segnum].matcen_num, sizeof(ubyte), 1, SaveFile);
+               // Write short Segment2s[segnum].value
+               cfwrite(&Segment2s[segnum].value, sizeof(short), 1, SaveFile);
+               // Write fix Segment2s[segnum].static_light (shift down 5 bits, write as short)
+               dump_fix_as_ushort(Segment2s[segnum].static_light, 4, SaveFile);
+               //cfwrite(&Segment2s[segnum].static_light, sizeof(fix), 1, SaveFile);
        
                // Write the walls as a 6 byte array
                for (sidenum=0; sidenum<MAX_SIDES_PER_SEGMENT; sidenum++ )      {
@@ -397,7 +397,7 @@ int save_mine_data_compiled_new(FILE * SaveFile)
                                bit_mask |= (1 << sidenum);
                }
 
-               if ((Segments[segnum].special != 0) || (Segments[segnum].matcen_num != 0) || (Segments[segnum].value != 0))
+               if ((Segment2s[segnum].special != 0) || (Segment2s[segnum].matcen_num != 0) || (Segment2s[segnum].value != 0))
                        bit_mask |= (1 << MAX_SIDES_PER_SEGMENT);
 
                cfwrite( &bit_mask, sizeof(ubyte), 1, SaveFile );
@@ -410,12 +410,12 @@ int save_mine_data_compiled_new(FILE * SaveFile)
                cfwrite( &Segments[segnum].verts, sizeof(short), MAX_VERTICES_PER_SEGMENT, SaveFile );
 
                if (bit_mask & (1 << MAX_SIDES_PER_SEGMENT)) {
-                       cfwrite( &Segments[segnum].special, sizeof(ubyte), 1, SaveFile );
-                       cfwrite( &Segments[segnum].matcen_num, sizeof(ubyte), 1, SaveFile );
-                       cfwrite( &Segments[segnum].value, sizeof(short), 1, SaveFile );
+                       cfwrite(&Segment2s[segnum].special, sizeof(ubyte), 1, SaveFile);
+                       cfwrite(&Segment2s[segnum].matcen_num, sizeof(ubyte), 1, SaveFile);
+                       cfwrite(&Segment2s[segnum].value, sizeof(short), 1, SaveFile);
                }
 
-               dump_fix_as_ushort( Segments[segnum].static_light, 4, SaveFile );
+               dump_fix_as_ushort(Segment2s[segnum].static_light, 4, SaveFile);
        
                // Write the walls as a 6 byte array
                bit_mask = 0;
index 9f3bab1..c7be9d1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: seguvs.c,v 1.3 2004-12-19 15:21:11 btb Exp $ */
+/* $Id: seguvs.c,v 1.4 2004-12-24 05:17:09 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -19,7 +19,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  */
 
 #ifdef RCS
-static char rcsid[] = "$Id: seguvs.c,v 1.3 2004-12-19 15:21:11 btb Exp $";
+static char rcsid[] = "$Id: seguvs.c,v 1.4 2004-12-24 05:17:09 btb Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -1097,7 +1097,7 @@ void med_propagate_tmaps_to_segments(segment *base_seg,segment *con_seg, int uv_
                if (base_seg->children[s] == con_seg-Segments)
                        propagate_tmaps_to_segment_sides(base_seg, s, con_seg, find_connect_side(base_seg, con_seg), uv_only_flag);
 
-       con_seg->static_light = base_seg->static_light;
+       s2s2(con_seg)->static_light = s2s2(base_seg)->static_light;
 
        validate_uv_coordinates(con_seg);
 }
@@ -1116,7 +1116,7 @@ void copy_uvs_seg_to_seg(segment *destseg,segment *srcseg)
                destseg->sides[s].tmap_num2 = srcseg->sides[s].tmap_num2;
        }
 
-       destseg->static_light = srcseg->static_light;
+       s2s2(destseg)->static_light = s2s2(srcseg)->static_light;
 }
 
 //     _________________________________________________________________________________________________________________________
@@ -1328,7 +1328,7 @@ void calim_zero_light_values(void)
                        for (vertnum=0; vertnum<4; vertnum++)
                                sidep->uvls[vertnum].l = F1_0/64;       // Put a tiny bit of light here.
                }
-               Segments[segnum].static_light = F1_0/64;
+               Segment2s[segnum].static_light = F1_0 / 64;
        }
 }
 
@@ -1395,9 +1395,9 @@ void cast_light_from_side_to_center(segment *segp, int light_side, fix light_int
                                                        light_at_point = fixmul(light_at_point, light_intensity);
                                                        if (light_at_point >= F1_0)
                                                                light_at_point = F1_0-1;
-                                                       rsegp->static_light += light_at_point;
-                                                       if (segp->static_light < 0)     // if it went negative, saturate
-                                                               segp->static_light = 0;
+                                                       s2s2(rsegp)->static_light += light_at_point;
+                                                       if (s2s2(segp)->static_light < 0)       // if it went negative, saturate
+                                                               s2s2(segp)->static_light = 0;
                                                        break;
                                                case HIT_WALL:
                                                        break;
index cc70ce8..560847f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: segment.h,v 1.5 2004-08-28 23:17:45 schaffner Exp $ */
+/* $Id: segment.h,v 1.6 2004-12-24 05:17:09 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -174,6 +174,9 @@ extern segment2     Segment2s[];
 extern int          Num_segments;
 extern int          Num_vertices;
 
+// Get pointer to the segment2 for the given segment pointer
+#define s2s2(segp) (&Segment2s[(segp) - Segments])
+
 extern sbyte Side_to_verts[MAX_SIDES_PER_SEGMENT][4];       // Side_to_verts[my_side] is list of vertices forming side my_side.
 extern int  Side_to_verts_int[MAX_SIDES_PER_SEGMENT][4];    // Side_to_verts[my_side] is list of vertices forming side my_side.
 extern char Side_opposite[];                                // Side_opposite[my_side] returns side opposite cube from my_side.