1 // CampaignTreeView.h : header file
4 #include "missioncampaign.h"
7 #define MAX_CAMPAIGN_TREE_LINKS 300
9 typedef struct campaign_tree_element {
10 int from_links; // total branches from this mission
11 int to_links; // total branches that lead to this mission
12 CRect box; // coordinates of drawn box
13 } campaign_tree_element;
15 typedef struct campaign_tree_link {
16 int from; // index of source mission
17 int to; // index of mission link leads to
18 int sexp; // sexp index of condition that allows this branch
19 int node; // node tracker when link is in sexp tree window
20 int from_pos; // from link drawing offset
21 int to_pos; // to link drawing offset
22 bool mission_loop; // whether link leads to mission loop
23 char *mission_loop_txt; // text describing mission loop
24 char *mission_loop_brief_anim; // filename of anim to play in the brief
25 char *mission_loop_brief_sound; // filename of anim to play in the brief
26 CPoint p1; // coordinates of line last draw for link, from p1 to p2
30 extern int Total_links;
31 extern int Level_counts[MAX_LEVELS];
32 extern int Sorted[MAX_CAMPAIGN_MISSIONS];
33 extern campaign_tree_element Elements[MAX_CAMPAIGN_MISSIONS];
34 extern campaign_tree_link Links[MAX_CAMPAIGN_TREE_LINKS];
36 /////////////////////////////////////////////////////////////////////////////
37 // campaign_tree_view view
39 class campaign_tree_view : public CScrollView
42 campaign_tree_view(); // protected constructor used by dynamic creation
43 DECLARE_DYNCREATE(campaign_tree_view)
47 void drop_mission(int m, CPoint point);
48 int add_link(int from, int to);
49 void remove_mission(int m);
50 void delete_link(int num);
51 int get_root_mission();
52 void horizontally_align_mission(int num, int dir);
53 void correct_position(int num);
56 int query_alternate_pos(const CPoint& p);
57 int query_pos(const CPoint& p);
58 int query_level(const CPoint& p);
63 campaign_tree_link *first_link;
67 void construct_tree();
71 // ClassWizard generated virtual function overrides
72 //{{AFX_VIRTUAL(campaign_tree_view)
74 virtual void OnInitialUpdate();
76 virtual void OnDraw(CDC* pDC); // overridden to draw this view
81 virtual ~campaign_tree_view();
83 virtual void AssertValid() const;
84 virtual void Dump(CDumpContext& dc) const;
87 // Generated message map functions
89 //{{AFX_MSG(campaign_tree_view)
90 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
91 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
92 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
93 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
94 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
95 afx_msg void OnRemoveMission();
96 afx_msg void OnDeleteRow();
97 afx_msg void OnInsertRow();
98 afx_msg void OnAddRepeat();
99 afx_msg void OnEndOfCampaign();
101 DECLARE_MESSAGE_MAP()
104 /////////////////////////////////////////////////////////////////////////////
106 extern campaign_tree_view *Campaign_tree_viewp;