0415518def2d26fd5fdc036b17363d0d26bf936a
[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 eg. /home/harry/my_map.vmf
64 char vmf_name[ 128 ]; // Just the base name eg. my_map
65 EMSAA sampling_mode;
66
67 float min_z;
68 float max_z;
69
70 // Main API interface
71 vmf_map *map;
72 csr_target target;
73
74 u32 api_version;
75 };
76
77 void csr_filter_update_from_strings( csr_filter *filter, csr_opt_str *opt );
78
79 #ifdef CSR_EXECUTABLE
80 void csr_filter_update_from_strings( csr_filter *filter, csr_opt_str *opt )
81 {
82 if( opt->type == k_iftype_visgroup )
83 {
84 filter->visgroup = opt->str;
85 filter->classname = NULL;
86 }
87 else
88 {
89 filter->classname = opt->str;
90 filter->visgroup = NULL;
91 }
92 }
93 #endif
94
95 #ifndef CSR_EXECUTABLE
96 static int csr_init( csr_api *api )
97 {
98 if( api->api_version > csr_api_version )
99 {
100 log_warn( "API Version out of date. Host: %u, Plugin: %u\n", api->api_version, csr_api_version );
101 return 0;
102 }
103
104 return 1;
105 }
106 #endif