]> icculus.org git repositories - taylor/freespace2.git/blob - include/campaigntreeview.h
rendering functions mostly done; more complete shader setup
[taylor/freespace2.git] / include / campaigntreeview.h
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
6  * the source.
7  */
8
9 // CampaignTreeView.h : header file
10 //
11
12 #include "missioncampaign.h"
13
14 #define MAX_LEVELS      100
15 #define MAX_CAMPAIGN_TREE_LINKS 300
16
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;
22
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
35         CPoint p2;
36 } campaign_tree_link;
37
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];
43
44 /////////////////////////////////////////////////////////////////////////////
45 // campaign_tree_view view
46
47 class campaign_tree_view : public CScrollView
48 {
49 protected:
50         campaign_tree_view();           // protected constructor used by dynamic creation
51         DECLARE_DYNCREATE(campaign_tree_view)
52
53 // Attributes
54 public:
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);
62         void free_links();
63         void sort_elements();
64         int query_alternate_pos(const CPoint& p);
65         int query_pos(const CPoint& p);
66         int query_level(const CPoint& p);
67         void sort_links();
68         void realign_tree();
69         int total_levels;
70         int total_width;
71         campaign_tree_link *first_link;
72
73 // Operations
74 public:
75         void construct_tree();
76         void initialize();
77
78 // Overrides
79         // ClassWizard generated virtual function overrides
80         //{{AFX_VIRTUAL(campaign_tree_view)
81         public:
82         virtual void OnInitialUpdate();
83         protected:
84         virtual void OnDraw(CDC* pDC);      // overridden to draw this view
85         //}}AFX_VIRTUAL
86
87 // Implementation
88 protected:
89         virtual ~campaign_tree_view();
90 #ifdef _DEBUG
91         virtual void AssertValid() const;
92         virtual void Dump(CDumpContext& dc) const;
93 #endif
94
95         // Generated message map functions
96 protected:
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();
108         //}}AFX_MSG
109         DECLARE_MESSAGE_MAP()
110 };
111
112 /////////////////////////////////////////////////////////////////////////////
113
114 extern campaign_tree_view *Campaign_tree_viewp;
115