1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#pragma once
#include "../gui/base.h"
#include "../util/file.h"
#include "../game/world/map.h"
const F32 EDITOR_DEFAULT_SPRITE_SIZE = 32.f;
enum EditorTools_t {
EDITOR_TOOL_NONE,
EDITOR_TOOL_SELECT,
EDITOR_TOOL_WALL,
EDITOR_TOOL_POLY,
EDITOR_TOOL_SPRITE,
EDITOR_TOOL_ENT
};
enum EditorSelectType_t {
EDITOR_SELECT_NONE,
EDITOR_SELECT_WALL,
EDITOR_SELECT_POLY,
EDITOR_SELECT_WVERTEX, // wall vertex
EDITOR_SELECT_PVERTEX, // polygon vertex
EDITOR_SELECT_SPRITE,
EDITOR_SELECT_ENT,
EDITOR_SELECT_ORIGIN,
EDITOR_SELECT_SURFPROPS
};
struct GAME_EDITOR {
GAME_DATA* game;
struct WORLD_MAP* map;
struct GUI_EDITORWINDOW* wnd;
struct EDITOR_GUI {
struct GUI_WINDOW* new_map_popup;
struct GUI_EDITOR_2DVIEW* v2d;
struct GUI_EDITOR_3DVIEW* v3d;
struct GUI_LABEL* toollabel;
struct GUI_LABEL* gridlabel;
struct GUI_EDITOR_PROPVIEW* props;
I32 map_select{};
} gui;
U8 wireframe{};
U8 tool{};
F32 grid{};
U8 propgrid{};
F32 spritesize{};
U8 drawbsp{};
LIST<GUI_LIST_ENTRY> map_list{};
};
extern GAME_EDITOR* editor_create( struct GAME_DATA* game );
extern void editor_destroy( GAME_EDITOR* editor );
extern STAT editor_load_map( GAME_EDITOR* e, const char* mapname );
extern STAT editor_save_map( GAME_EDITOR* e );
extern STAT editor_new_map( GAME_EDITOR* e, const char* mapname );
extern STAT editor_close( GAME_EDITOR* e );
extern LIST<GUI_LIST_ENTRY>* editor_get_map_list( GAME_EDITOR* e );
extern void editor_load_map_cb( void* );
extern void editor_new_map_cb( void* );
extern void editor_create_map_view( GAME_EDITOR* e );
extern void editor_update_properties_column( GAME_EDITOR* e );
struct GUI_EDITORWINDOW : GUI_WINDOW {};
struct GUI_EDITOR_3DVIEW : GUI_VIEW {
U8 heldoutbounds;
};
struct GUI_EDITOR_2DVIEW : GUI_VIEW {
F32 scale;
F32 posx, posy;
I32 moffx, moffy;
F32 voffx, voffy;
U8 dragheld;
U8 held;
U8 heldoutbounds;
I32 oldmx, oldmy;
F32 mremainx, mremainy;
void* curselect;
U8 seltype;
void* curdrag;
U8 dragtype;
U8 dragmoved;
};
struct GUI_EDITOR_PROPVIEW : GUI_VIEW {
void* curselect;
U8 seltype;
GUI_VIEW* itemview;
};
struct GUI_EDITOR_TEXTUREPICKER : GUI_WINDOW {
struct GL_TEX2D** target;
struct GL_TEX2D* curselect;
I32 scrolloff;
LIST<FILE_ENTRY> files;
LIST<struct GL_TEX2D*> textures;
I32 scrollheight;
U32 rowcount;
char search[256];
U32 curload;
U8 loaded;
GL_TEX2D* heldselect;
GUI_LABEL* densitylabel;
GUI_CALLBACK cb;
};
extern GUI_EDITORWINDOW* gui_editorwindow( I32 w, I32 h );
extern GUI_EDITOR_2DVIEW* gui_editor_2dview( I32 x, I32 y, I32 w, I32 h );
extern GUI_EDITOR_3DVIEW* gui_editor_3dview( I32 x, I32 y, I32 w, I32 h );
extern GUI_EDITOR_PROPVIEW* gui_editor_propview( I32 x, I32 y, I32 w, I32 h );
extern GUI_EDITOR_TEXTUREPICKER* gui_editor_texturepicker( I32 x, I32 y, I32 w, I32 h, GL_TEX2D** target );
extern void gui_editor_propview_select( GUI_EDITOR_PROPVIEW* e, void* what, U8 seltype );
extern void gui_editor_propview_update( GUI_EDITOR_PROPVIEW* e );
extern GAME_EDITOR* editor;
|