| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#ifndef _TABLE_FILE_FILTER_MNG_H_ |
| 20 |
#define _TABLE_FILE_FILTER_MNG_H_ |
| 21 |
|
| 22 |
#include "pstypes.h" |
| 23 |
#include "manage.h" |
| 24 |
|
| 25 |
#define SOURCE_TABLE_FILENAME "F:\\Descent3\\data\\tables\\table.gam" |
| 26 |
|
| 27 |
#define DEFAULT_TABLEPARSE_FNAME "main\\table_parse.out" |
| 28 |
|
| 29 |
|
| 30 |
#define PAGE_NAME_COLUMN 0 |
| 31 |
#define PAGE_TYPE_COLUMN 1 |
| 32 |
|
| 33 |
#define PAGE_NAME_COLUMN_WIDTH 0.7 |
| 34 |
#define PAGE_TYPE_COLUMN_WIDTH 0.3 |
| 35 |
|
| 36 |
|
| 37 |
#define ADDED_FOR_LEVEL_FLAG 0x01 |
| 38 |
#define ADDED_FOR_USER_FLAG 0x02 |
| 39 |
#define PAGE_WRITTEN_FLAG 0x04 |
| 40 |
|
| 41 |
|
| 42 |
#define ADD_PAGES 0 |
| 43 |
#define REMOVE_PAGES 1 |
| 44 |
|
| 45 |
#define ALWAYS_WRITE_GAMEFILE_PAGES 0 |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
class PageDataNode { |
| 51 |
friend class PageDataList; |
| 52 |
|
| 53 |
private: |
| 54 |
PageDataNode *prev; |
| 55 |
PageDataNode *next; |
| 56 |
|
| 57 |
|
| 58 |
uint8_t type; |
| 59 |
char name[PAGENAME_LEN]; |
| 60 |
|
| 61 |
int flags; |
| 62 |
int tag_count; |
| 63 |
|
| 64 |
public: |
| 65 |
PageDataNode::PageDataNode(); |
| 66 |
PageDataNode::~PageDataNode(); |
| 67 |
|
| 68 |
bool operator<(const PageDataNode &node); |
| 69 |
|
| 70 |
bool Load(CFILE *infile); |
| 71 |
bool Save(CFILE *outfile); |
| 72 |
}; |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
#define MAX_LEVEL_FILENAMES 256 |
| 79 |
|
| 80 |
class PageDataList { |
| 81 |
private: |
| 82 |
PageDataNode *m_head; |
| 83 |
PageDataNode *m_tail; |
| 84 |
int m_size; |
| 85 |
|
| 86 |
char m_LevelFilenames[MAX_LEVEL_FILENAMES][_MAX_PATH]; |
| 87 |
int m_NumLevelFilenames; |
| 88 |
|
| 89 |
|
| 90 |
CDialog *m_Dlg; |
| 91 |
CEdit *m_TableParseFile; |
| 92 |
CListCtrl *m_PageDataListCtrl; |
| 93 |
CListBox *m_LevelListBox; |
| 94 |
CString *m_NumPagesText; |
| 95 |
CString *m_StatusText; |
| 96 |
|
| 97 |
CString m_DataListFilename; |
| 98 |
bool m_DataListLoaded; |
| 99 |
bool m_DataListModified; |
| 100 |
|
| 101 |
public: |
| 102 |
PageDataList::PageDataList(); |
| 103 |
PageDataList::~PageDataList(); |
| 104 |
|
| 105 |
void SetModified(bool mMod) { m_DataListModified = mMod; } |
| 106 |
bool IsModified(void) { return (m_DataListModified); } |
| 107 |
bool IsLoaded(void) { return (m_DataListLoaded); } |
| 108 |
bool FilenameSpecified(void) { return (!m_DataListFilename.IsEmpty()); } |
| 109 |
|
| 110 |
void ClearList(void); |
| 111 |
bool AddToList(PageDataNode *node); |
| 112 |
bool AddToList(char *page_name, uint8_t page_type, int page_flags); |
| 113 |
bool RemoveFromList(PageDataNode *goner_node); |
| 114 |
bool RemoveFromList(char *page_name, uint8_t page_type); |
| 115 |
PageDataNode *FindNode(char *page_name, uint8_t page_type); |
| 116 |
|
| 117 |
bool LoadList(char *list_filename); |
| 118 |
bool SaveList(char *list_filename); |
| 119 |
|
| 120 |
bool AddLevelFilename(char *level_filename); |
| 121 |
bool RemoveSelLevelFilename(void); |
| 122 |
|
| 123 |
bool ProcessPagesForLevel(char *level_filename, int process_type); |
| 124 |
bool DetermineRequiredPages(int process_type); |
| 125 |
bool ProcessPage(char *page_name, uint8_t page_type, int process_type, int flags = ADDED_FOR_LEVEL_FLAG); |
| 126 |
|
| 127 |
void AddTexturePage(int id, int process_type); |
| 128 |
void AddSoundPage(int id, int process_type); |
| 129 |
void AddGenericPage(int id, int process_type); |
| 130 |
void AddWeaponPage(int id, int process_type); |
| 131 |
void AddDoorPage(int id, int process_type); |
| 132 |
void AddShipPage(int id, int process_type); |
| 133 |
|
| 134 |
bool AddPageFromUser(char *page_name, uint8_t page_type); |
| 135 |
bool ProcessPagesInTextFile(char *filename, int process_type); |
| 136 |
bool ProcessPageFromFile(char *page_name, uint8_t page_type, int process_type); |
| 137 |
uint8_t GetPageTypeFromString(char *text); |
| 138 |
|
| 139 |
bool CreateNewTableFile(char *new_table_filename, char *src_table_filename); |
| 140 |
|
| 141 |
|
| 142 |
void BindDlg(CDialog *dlg) { m_Dlg = dlg; } |
| 143 |
void BindOutputFileEdit(CEdit *edit) { m_TableParseFile = edit; } |
| 144 |
void BindPageDataListCtrl(CListCtrl *list) { m_PageDataListCtrl = list; } |
| 145 |
void BindLevelListBox(CListBox *box) { m_LevelListBox = box; } |
| 146 |
void BindNumPagesText(CString *str) { m_NumPagesText = str; } |
| 147 |
void BindStatusText(CString *str) { m_StatusText = str; } |
| 148 |
|
| 149 |
bool AddAllGamefilePages(void); |
| 150 |
|
| 151 |
bool AddToListCtrl(int index, PageDataNode *node); |
| 152 |
bool RemoveSelFromListCtrl(void); |
| 153 |
|
| 154 |
int ModifiedPrompt(void); |
| 155 |
void SetTitleString(void); |
| 156 |
}; |
| 157 |
|
| 158 |
#endif |