FS2_Open
Open source remastering of the Freespace 2 engine
campaigntreeview.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 // CampaignTreeView.h : header file
11 //
12 
14 
15 #define MAX_LEVELS 100
16 #define MAX_CAMPAIGN_TREE_LINKS 300
17 
18 typedef struct campaign_tree_element {
19  int from_links; // total branches from this mission
20  int to_links; // total branches that lead to this mission
21  CRect box; // coordinates of drawn box
23 
24 typedef struct campaign_tree_link {
25  int from; // index of source mission
26  int to; // index of mission link leads to
27  int sexp; // sexp index of condition that allows this branch
28  int node; // node tracker when link is in sexp tree window
29  int from_pos; // from link drawing offset
30  int to_pos; // to link drawing offset
31  bool is_mission_loop; // whether link leads to mission loop
32  bool is_mission_fork; // whether link leads to mission fork
33  char *mission_branch_txt; // text describing mission loop
34  char *mission_branch_brief_anim; // filename of anim to play in the brief
35  char *mission_branch_brief_sound; // filename of anim to play in the brief
36  CPoint p1; // coordinates of line last draw for link, from p1 to p2
37  CPoint p2;
39 
40 extern int Total_links;
41 extern int Level_counts[MAX_LEVELS];
42 extern int Sorted[MAX_CAMPAIGN_MISSIONS];
45 
47 // campaign_tree_view view
48 
49 class campaign_tree_view : public CScrollView
50 {
51 protected:
52  campaign_tree_view(); // protected constructor used by dynamic creation
53  DECLARE_DYNCREATE(campaign_tree_view)
54 
55 // Attributes
56 public:
57  void drop_mission(int m, CPoint point);
58  int add_link(int from, int to);
59  void remove_mission(int m);
60  void delete_link(int num);
61  int get_root_mission();
62  void horizontally_align_mission(int num, int dir);
63  void correct_position(int num);
64  void free_links();
65  void sort_elements();
66  int query_alternate_pos(const CPoint& p);
67  int query_pos(const CPoint& p);
68  int query_level(const CPoint& p);
69  void sort_links();
70  void realign_tree();
74 
75 // Operations
76 public:
77  void construct_tree();
78  void initialize();
79 
80 // Overrides
81  // ClassWizard generated virtual function overrides
82  //{{AFX_VIRTUAL(campaign_tree_view)
83  public:
84  virtual void OnInitialUpdate();
85  protected:
86  virtual void OnDraw(CDC* pDC); // overridden to draw this view
87  //}}AFX_VIRTUAL
88 
89 // Implementation
90 protected:
91  virtual ~campaign_tree_view();
92 #ifdef _DEBUG
93  virtual void AssertValid() const;
94  virtual void Dump(CDumpContext& dc) const;
95 #endif
96 
97  // Generated message map functions
98 protected:
99  //{{AFX_MSG(campaign_tree_view)
100  afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
101  afx_msg void OnMouseMove(UINT nFlags, CPoint point);
102  afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
103  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
104  afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
105  afx_msg void OnRemoveMission();
106  afx_msg void OnDeleteRow();
107  afx_msg void OnInsertRow();
108  afx_msg void OnAddRepeat();
109  afx_msg void OnEndOfCampaign();
110  //}}AFX_MSG
111  DECLARE_MESSAGE_MAP()
112 };
113 
115 
afx_msg void OnRemoveMission()
int add_link(int from, int to)
void correct_position(int num)
afx_msg void OnDeleteRow()
int query_alternate_pos(const CPoint &p)
int Level_counts[MAX_LEVELS]
campaign_tree_link * first_link
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
virtual void OnInitialUpdate()
unsigned int UINT
Definition: config.h:82
int query_level(const CPoint &p)
struct campaign_tree_element campaign_tree_element
afx_msg void OnContextMenu(CWnd *pWnd, CPoint point)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
int Sorted[MAX_CAMPAIGN_MISSIONS]
struct campaign_tree_link campaign_tree_link
virtual void OnDraw(CDC *pDC)
campaign_tree_link Links[MAX_CAMPAIGN_TREE_LINKS]
campaign_tree_view * Campaign_tree_viewp
GLuint GLuint num
Definition: Glext.h:9089
#define MAX_LEVELS
GLfloat GLfloat p
Definition: Glext.h:8373
afx_msg void OnInsertRow()
const GLfloat * m
Definition: Glext.h:10319
afx_msg void OnAddRepeat()
#define MAX_CAMPAIGN_MISSIONS
afx_msg void OnEndOfCampaign()
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
void horizontally_align_mission(int num, int dir)
int Total_links
void drop_mission(int m, CPoint point)
#define MAX_CAMPAIGN_TREE_LINKS
campaign_tree_element Elements[MAX_CAMPAIGN_MISSIONS]
afx_msg void OnMouseMove(UINT nFlags, CPoint point)
int query_pos(const CPoint &p)