fixed instance loading forget to append basepath.. other path fixes (windows)
[csRadar.git] / csRadar.h
1 #include <stdint.h>
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <math.h>
6 #include <time.h>
7 #include <stdarg.h>
8
9 // CSR lib
10 #include "csrLog.h" // Y
11 #include "csrOpt.h" // Y
12 #include "csrTypes.h" // Y
13 #include "csrMath.h" // Y
14 #include "csrMem.h" // Y
15 #include "csrIO.h" // Y
16 #include "csrComb.h" // Y
17 #include "csrPlatform.h" // Y
18
19 // Valve formats
20 #include "vdf.h" // Y
21 #include "vpk.h" // Y
22 #include "vfilesys.h" // Y
23
24 #include "vmdl.h" // Y
25 #include "vmf.h" // Y
26
27 // Drawing
28 #ifdef CSR_EXECUTABLE
29 #include "csr32f.h"
30 #include "csrTga.h"
31 #endif
32
33 #include "csrDraw.h" // Y
34
35 static const u32 csr_build = 3;
36 static const u32 csr_api_version = 1;
37
38 typedef struct csr_api csr_api;
39 typedef struct csr_opt_str csr_opt_str;
40
41 struct csr_api
42 {
43 // Floating arguments from main's argv
44 struct csr_opt_str
45 {
46 char *str;
47
48 enum inferred_type
49 {
50 k_iftype_vmf,
51 k_iftype_visgroup,
52 k_iftype_classname
53 }
54 type;
55 }
56 strings[ 20 ];
57
58 int num_strings;
59
60 float padding;
61 u32 resolution;
62 int write_txt;
63 char output_path[ 512 ]; // Full path to output eg. /home/harry/output
64 char vmf_name[ 128 ]; // Just the base name eg. my_map
65 char vmf_folder[ 512 ]; // Just the folder to the map eg. /home/harry/
66 EMSAA sampling_mode;
67
68 float min_z;
69 float max_z;
70
71 // Main API interface
72 vmf_map *map;
73 csr_target target;
74
75 u32 api_version;
76 };
77
78 void csr_filter_update_from_strings( csr_filter *filter, csr_opt_str *opt );
79
80 #ifdef CSR_EXECUTABLE
81 void csr_filter_update_from_strings( csr_filter *filter, csr_opt_str *opt )
82 {
83 if( opt->type == k_iftype_visgroup )
84 {
85 filter->visgroup = opt->str;
86 filter->classname = NULL;
87 }
88 else
89 {
90 filter->classname = opt->str;
91 filter->visgroup = NULL;
92 }
93 }
94 #endif
95
96 #ifndef CSR_EXECUTABLE
97 static int csr_init( csr_api *api )
98 {
99 if( api->api_version > csr_api_version )
100 {
101 log_warn( "API Version out of date. Host: %u, Plugin: %u\n", api->api_version, csr_api_version );
102 return 0;
103 }
104
105 return 1;
106 }
107 #endif