2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
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
9 // CampaignTreeView.h : header file
12 #include "missioncampaign.h"
14 #define MAX_LEVELS 100
15 #define MAX_CAMPAIGN_TREE_LINKS 300
17 typedef struct campaign_tree_element {
18 int from_links; // total branches from this mission
19 int to_links; // total branches that lead to this mission
20 CRect box; // coordinates of drawn box
21 } campaign_tree_element;
23 typedef struct campaign_tree_link {
24 int from; // index of source mission
25 int to; // index of mission link leads to
26 int sexp; // sexp index of condition that allows this branch
27 int node; // node tracker when link is in sexp tree window
28 int from_pos; // from link drawing offset
29 int to_pos; // to link drawing offset
30 bool mission_loop; // whether link leads to mission loop
31 char *mission_loop_txt; // text describing mission loop
32 char *mission_loop_brief_anim; // filename of anim to play in the brief
33 char *mission_loop_brief_sound; // filename of anim to play in the brief
34 CPoint p1; // coordinates of line last draw for link, from p1 to p2
38 extern int Total_links;
39 extern int Level_counts[MAX_LEVELS];
40 extern int Sorted[MAX_CAMPAIGN_MISSIONS];
41 extern campaign_tree_element Elements[MAX_CAMPAIGN_MISSIONS];
42 extern campaign_tree_link Links[MAX_CAMPAIGN_TREE_LINKS];
44 /////////////////////////////////////////////////////////////////////////////
45 // campaign_tree_view view
47 class campaign_tree_view : public CScrollView
50 campaign_tree_view(); // protected constructor used by dynamic creation
51 DECLARE_DYNCREATE(campaign_tree_view)
55 void drop_mission(int m, CPoint point);
56 int add_link(int from, int to);
57 void remove_mission(int m);
58 void delete_link(int num);
59 int get_root_mission();
60 void horizontally_align_mission(int num, int dir);
61 void correct_position(int num);
64 int query_alternate_pos(const CPoint& p);
65 int query_pos(const CPoint& p);
66 int query_level(const CPoint& p);
71 campaign_tree_link *first_link;
75 void construct_tree();
79 // ClassWizard generated virtual function overrides
80 //{{AFX_VIRTUAL(campaign_tree_view)
82 virtual void OnInitialUpdate();
84 virtual void OnDraw(CDC* pDC); // overridden to draw this view
89 virtual ~campaign_tree_view();
91 virtual void AssertValid() const;
92 virtual void Dump(CDumpContext& dc) const;
95 // Generated message map functions
97 //{{AFX_MSG(campaign_tree_view)
98 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
99 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
100 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
101 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
102 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
103 afx_msg void OnRemoveMission();
104 afx_msg void OnDeleteRow();
105 afx_msg void OnInsertRow();
106 afx_msg void OnAddRepeat();
107 afx_msg void OnEndOfCampaign();
109 DECLARE_MESSAGE_MAP()
112 /////////////////////////////////////////////////////////////////////////////
114 extern campaign_tree_view *Campaign_tree_viewp;