Move segment handling from editor.h

This commit is contained in:
Kp 2013-03-16 03:10:55 +00:00
parent 8ff1613c2a
commit 2a3524cd66
35 changed files with 114 additions and 35 deletions

View file

@ -31,6 +31,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "editor.h"
#include "u_mem.h"
#include "ui.h"
#include "strutil.h"
#define AUTOSAVE_PERIOD 5 // Number of minutes for timed autosave

View file

@ -27,6 +27,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "editor/esegment.h"
#include "timer.h"
#include "objpage.h"
#include "fix.h"

View file

@ -28,6 +28,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "gr.h"
#include "key.h"
#include "editor.h"
#include "editor/esegment.h"
#include "gameseg.h"
#include "console.h"
#define ONE_OVER_SQRT2 F1_0 * 0.707106781

View file

@ -21,6 +21,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "editor/esegment.h"
#include "seguvs.h"
#include "wall.h"
#include "textures.h"

View file

@ -26,6 +26,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "editor/esegment.h"
#include "objpage.h"
#include "fix.h"

View file

@ -24,6 +24,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "editor.h"
#include "editor/esegment.h"
#include "eswitch.h"
#include "segment.h"
#include "dxxerror.h"

View file

@ -26,6 +26,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "editor/esegment.h"
#include "dxxerror.h"
#include "gameseg.h"

View file

@ -25,6 +25,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "segment.h"
#include "editor/editor.h"
#include "editor/esegment.h"
#include "dxxerror.h"
#include "gamemine.h"
#include "gameseg.h"

View file

@ -30,6 +30,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "gr.h"
#include "ui.h"
#include "editor.h"
#include "editor/esegment.h"
#include "dxxerror.h"
#include "textures.h"
#include "object.h"

View file

@ -20,6 +20,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <string.h>
#include "inferno.h"
#include "editor/editor.h"
#include "editor/esegment.h"
#include "gameseg.h"
#include "gamesave.h"

View file

@ -22,6 +22,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "editor.h"
#include "editor/esegment.h"
#include "kdefs.h"
static fix r1scale, r4scale;

View file

@ -24,6 +24,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "strutil.h"
#include "inferno.h"
#include "editor.h"
#include "editor/esegment.h"
#include "ui.h"
#include "texpage.h" // For texpage_goto_first
#include "segment.h"

View file

@ -25,6 +25,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "editor.h"
#include "editor/esegment.h"
// -- old -- int SegOrientCommon(fixang *ang, fix val)
// -- old -- {

View file

@ -22,6 +22,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "editor/editor.h"
#include "editor/esegment.h"
// ---------------------------------------------------------------------------------------

View file

@ -20,8 +20,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <stdlib.h>
#include "inferno.h"
#include "editor.h"
#include "editor/esegment.h"
#include "dxxerror.h"
#include "segment.h"
#include "gameseg.h"
#define XDIM 0

View file

@ -20,6 +20,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <string.h>
#include "inferno.h"
#include "editor.h"
#include "editor/esegment.h"
#include "kdefs.h"
// Assign CurrentTexture to Curside in *Cursegp

View file

@ -20,6 +20,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "editor.h"
#include "editor/esegment.h"
// ---------- zoom control on current window ----------
int ZoomIn()

View file

@ -37,6 +37,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "messagebox.h"
#include "ui.h"
#include "editor.h"
#include "editor/esegment.h"
#include "gamesave.h"
#include "gameseg.h"
#include "key.h"

View file

@ -28,6 +28,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "gr.h"
#include "ui.h"
#include "editor/editor.h"
#include "editor/esegment.h"
#include "wall.h"
#include "switch.h"
#include "key.h"

View file

@ -31,6 +31,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "func.h"
#include "inferno.h"
#include "editor/editor.h"
#include "editor/esegment.h"
#include "segment.h"
#include "render.h"
#include "screens.h"

View file

@ -26,6 +26,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "editor/esegment.h"
#include "timer.h"
#include "objpage.h"
#include "fix.h"

View file

@ -28,6 +28,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "u_mem.h"
#include "inferno.h"
#include "editor.h"
#include "editor/esegment.h"
#include "segment.h"
#include "object.h"

View file

@ -24,6 +24,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "editor/medwall.h"
#include "inferno.h"
#include "editor/editor.h"
#include "editor/esegment.h"
#include "segment.h"
#include "dxxerror.h"
#include "gameseg.h"

View file

@ -28,6 +28,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "editor/esegment.h"
#include "dxxerror.h"
#include "textures.h"
#include "object.h"

View file

@ -26,6 +26,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "segment.h"
#include "editor.h"
#include "editor/esegment.h"
#include "dxxerror.h"
#include "object.h"
#include "gameseg.h"

View file

@ -25,6 +25,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "segment.h"
#include "editor/editor.h"
#include "editor/esegment.h"
#include "gameseg.h"
#include "fix.h"
#include "dxxerror.h"

View file

@ -26,6 +26,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "segment.h"
#include "seguvs.h"
#include "editor.h"
#include "editor/esegment.h"
#include "fix.h"
#include "dxxerror.h"
#include "kdefs.h"

View file

@ -21,12 +21,13 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define _EDITOR_H
#include "vecmat.h"
#include "segment.h"
#include "inferno.h"
#include "gr.h"
#include "ui.h"
struct window;
struct segment;
typedef struct segment segment;
/*
* Constants
@ -162,43 +163,10 @@ extern int Found_seg_index; // Index in Found_segs corresponding to Cursegp
extern int gamestate_not_restored;
extern grs_font *editor_font;
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.
#define New_segment (Segments[MAX_SEGMENTS-1])
extern int Curside; // Side index in 0..MAX_SIDES_PER_SEGMENT of active side.
extern int Curedge; // Current edge on current side, in 0..3
extern int Curvert; // Current vertex on current side, in 0..3
extern int AttachSide; // Side on segment to attach
extern int Draw_all_segments; // Set to 1 means draw_world draws all segments in Segments, else draw only connected segments
extern segment *Markedsegp; // Marked segment, used in conjunction with *Cursegp to form joints.
extern int Markedside; // Marked side on Markedsegp.
extern sbyte Vertex_active[MAX_VERTICES]; // !0 means vertex is in use, 0 means not in use.
extern struct window *Pad_info; // Keypad text
// The extra group in the following arrays is used for group rotation.
extern group GroupList[MAX_GROUPS+1];
extern segment *Groupsegp[MAX_GROUPS+1];
extern int Groupside[MAX_GROUPS+1];
extern int current_group;
extern int num_groups;
extern int Current_group;
extern short Found_segs[]; // List of segment numbers "found" under cursor click
extern int N_found_segs; // Number of segments found at Found_segs
extern int N_selected_segs; // Number of segments found at Selected_segs
extern short Selected_segs[]; // List of segment numbers currently selected
extern int N_warning_segs; // Number of segments warning-worthy, such as a concave segment
extern short Warning_segs[]; // List of warning-worthy segments
extern int Show_axes_flag; // 0 = don't show, !0 = do show coordinate axes in *Cursegp orientation
extern int Autosave_count; // Current counter for which autosave mine we are "on"

79
include/editor/esegment.h Normal file
View file

@ -0,0 +1,79 @@
#pragma once
#include "segment.h"
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 segment New_segment; // The segment which can be added to the mine.
#define New_segment (Segments[MAX_SEGMENTS-1])
extern int Curside; // Side index in 0..MAX_SIDES_PER_SEGMENT of active side.
extern int Curedge; // Current edge on current side, in 0..3
extern int Curvert; // Current vertex on current side, in 0..3
extern int AttachSide; // Side on segment to attach
extern int Draw_all_segments; // Set to 1 means draw_world draws all segments in Segments, else draw only connected segments
extern segment *Markedsegp; // Marked segment, used in conjunction with *Cursegp to form joints.
extern int Markedside; // Marked side on Markedsegp.
extern sbyte Vertex_active[MAX_VERTICES]; // !0 means vertex is in use, 0 means not in use.
// The extra group in the following arrays is used for group rotation.
extern group GroupList[MAX_GROUPS+1];
extern segment *Groupsegp[MAX_GROUPS+1];
extern int Groupside[MAX_GROUPS+1];
extern int current_group;
extern int num_groups;
extern int Current_group;
extern short Found_segs[]; // List of segment numbers "found" under cursor click
extern int N_found_segs; // Number of segments found at Found_segs
extern int N_selected_segs; // Number of segments found at Selected_segs
extern short Selected_segs[]; // List of segment numbers currently selected
extern int N_warning_segs; // Number of segments warning-worthy, such as a concave segment
extern short Warning_segs[]; // List of warning-worthy segments
extern int Groupside[MAX_GROUPS+1];
extern int current_group;
extern int num_groups;
extern int Current_group;
// Returns true if vertex vi is contained in exactly one segment, else returns false.
extern int is_free_vertex(int vi);
// Set existing vertex vnum to value *vp.
extern int med_set_vertex(int vnum,vms_vector *vp);
extern void med_combine_duplicate_vertices(sbyte *vlp);
// Attach side newside of newseg to side destside of destseg.
// Copies *newseg into global array Segments, increments Num_segments.
// Forms a weld between the two segments by making the new segment fit to the old segment.
// Updates number of faces per side if necessitated by new vertex coordinates.
// Return value:
// 0 = successful attach
// 1 = No room in Segments[].
// 2 = No room in Vertices[].
extern int med_attach_segment(segment *destseg, segment *newseg, int destside, int newside);
// Delete a segment.
// Deletes a segment from the global array Segments.
// Updates Cursegp to be the segment to which the deleted segment was connected. If there is
// more than one connected segment, the new Cursegp will be the segment with the highest index
// of connection in the deleted segment (highest index = front)
// Return value:
// 0 = successful deletion
// 1 = unable to delete
extern int med_delete_segment(segment *sp);
// Rotate the segment *seg by the pitch, bank, heading defined by *rot, destructively
// modifying its four free vertices in the global array Vertices.
// It is illegal to rotate a segment which has MAX_SIDES_PER_SEGMENT != 1.
// Pitch, bank, heading are about the point which is the average of the four points
// forming the side of connection.
// Return value:
// 0 = successful rotation
// 1 = MAX_SIDES_PER_SEGMENT makes rotation illegal (connected to 0 or 2+ segments)
// 2 = Rotation causes degeneracy, such as self-intersecting segment.
extern int med_rotate_segment(segment *seg, vms_matrix *rotmat);
extern int med_rotate_segment_ang(segment *seg, vms_angvec *ang);

View file

@ -60,6 +60,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#ifdef EDITOR
#include "editor/editor.h"
#include "editor/esegment.h"
#include "editor/kdefs.h"
#endif

View file

@ -34,6 +34,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "wall.h"
#ifdef EDITOR
#include "editor/editor.h"
#include "editor/esegment.h"
#endif
#include "player.h"
#include "fireball.h"

View file

@ -100,6 +100,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#ifdef EDITOR
#include "editor/editor.h"
#include "editor/esegment.h"
#endif

View file

@ -37,6 +37,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "newmenu.h"
#ifdef EDITOR
#include "editor/editor.h"
#include "editor/esegment.h"
#endif
#include "fuelcen.h"
#include "hash.h"

View file

@ -29,6 +29,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#ifdef EDITOR
#include "editor/editor.h"
#include "editor/esegment.h"
#endif
#include "dxxerror.h"
#include "object.h"

View file

@ -60,6 +60,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#ifdef EDITOR
#include "editor/editor.h"
#include "editor/esegment.h"
#endif
// (former) "detail level" values