diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-01-17 23:09:49 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-01-17 23:09:49 +0000 |
| commit | 57c47659930c5e01ae5d3e8cef51c06d28d20508 (patch) | |
| tree | e67a413ec70dbf4562178ad3603619f7b2b825c2 /src/game/editor/ed_layer_quads.cpp | |
| parent | 253a5639ae170a16055e2c8a76d12335342f6d51 (diff) | |
| download | zcatch-57c47659930c5e01ae5d3e8cef51c06d28d20508.tar.gz zcatch-57c47659930c5e01ae5d3e8cef51c06d28d20508.zip | |
editor update and other stuff
Diffstat (limited to 'src/game/editor/ed_layer_quads.cpp')
| -rw-r--r-- | src/game/editor/ed_layer_quads.cpp | 141 |
1 files changed, 27 insertions, 114 deletions
diff --git a/src/game/editor/ed_layer_quads.cpp b/src/game/editor/ed_layer_quads.cpp index ee75a503..ca84ffe8 100644 --- a/src/game/editor/ed_layer_quads.cpp +++ b/src/game/editor/ed_layer_quads.cpp @@ -14,13 +14,20 @@ LAYER_QUADS::~LAYER_QUADS() { } +static void envelope_eval(float time_offset, int env, float *channels) +{ + ENVELOPE *e = editor.map.envelopes[env]; + float t = editor.animate_time+time_offset; + e->eval(t, channels); +} + void LAYER_QUADS::render() { gfx_texture_set(-1); if(image >= 0 && image < editor.map.images.len()) gfx_texture_set(editor.map.images[image]->tex_id); - render_quads(quads.getptr(), quads.len()); + render_quads(quads.getptr(), quads.len(), envelope_eval); } QUAD *LAYER_QUADS::new_quad() @@ -160,123 +167,29 @@ extern int selected_points; int LAYER_QUADS::render_properties(RECT *toolbox) { // layer props - if(editor.props == PROPS_LAYER) + enum { - enum - { - PROP_IMAGE=0, - NUM_PROPS, - }; - - PROPERTY props[] = { - {"Image", image, PROPTYPE_IMAGE, -1, 0}, - {0}, - }; - - static int ids[NUM_PROPS] = {0}; - int new_val = 0; - int prop = editor.do_properties(toolbox, props, ids, &new_val); - - if(prop == PROP_IMAGE) - { - if(new_val >= 0) - image = new_val%editor.map.images.len(); - else - image = -1; - } - } - - // quad props - QUAD *quad = editor.get_selected_quad(); - if(editor.props == PROPS_QUAD) - { - if(quad) - { - RECT slot; - ui_hsplit_t(toolbox, 15.0f, &slot, toolbox); - ui_do_label(&slot, "Quad Props", 12.0f, -1, -1); - - enum - { - PROP_POS_ENV=0, - PROP_POS_ENV_OFFSET, - PROP_COLOR_ENV, - PROP_COLOR_ENV_OFFSET, - NUM_PROPS, - }; - - PROPERTY props[] = { - {"Pos. Env", quad->pos_env, PROPTYPE_INT_STEP, -1, editor.map.envelopes.len()}, - {"Pos. TO", quad->pos_env_offset, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - {"Color Env", quad->color_env, PROPTYPE_INT_STEP, -1, editor.map.envelopes.len()}, - {"Color TO", quad->color_env_offset, PROPTYPE_INT_SCROLL, -1000000, 1000000}, - - {0}, - }; - - static int ids[NUM_PROPS] = {0}; - int new_val = 0; - int prop = editor.do_properties(toolbox, props, ids, &new_val); - - if(prop == PROP_POS_ENV) quad->pos_env = new_val; - if(prop == PROP_POS_ENV_OFFSET) quad->pos_env_offset = new_val; - if(prop == PROP_COLOR_ENV) quad->color_env = new_val; - if(prop == PROP_COLOR_ENV_OFFSET) quad->color_env_offset = new_val; - } - } + PROP_IMAGE=0, + NUM_PROPS, + }; - // point props - if(editor.props == PROPS_QUAD_POINT && quad && selected_points) - { - RECT slot; - ui_hsplit_t(toolbox, 15.0f, &slot, toolbox); - ui_do_label(&slot, "Point Props", 14.0f, -1, -1); - - enum - { - PROP_COLOR=0, - NUM_PROPS, - }; - - int color = 0; + PROPERTY props[] = { + {"Image", image, PROPTYPE_IMAGE, -1, 0}, + {0}, + }; - for(int v = 0; v < 4; v++) - { - if(selected_points&(1<<v)) - { - color = 0; - color |= quad->colors[v].r<<24; - color |= quad->colors[v].g<<16; - color |= quad->colors[v].b<<8; - color |= quad->colors[v].a; - } - } - - - PROPERTY props[] = { - {"Color", color, PROPTYPE_COLOR, -1, editor.map.envelopes.len()}, - {0}, - }; - - static int ids[NUM_PROPS] = {0}; - int new_val = 0; - int prop = editor.do_properties(toolbox, props, ids, &new_val); - if(prop == PROP_COLOR) - { - for(int v = 0; v < 4; v++) - { - if(selected_points&(1<<v)) - { - color = 0; - quad->colors[v].r = (new_val>>24)&0xff; - quad->colors[v].g = (new_val>>16)&0xff; - quad->colors[v].b = (new_val>>8)&0xff; - quad->colors[v].a = new_val&0xff; - } - } - } - } + static int ids[NUM_PROPS] = {0}; + int new_val = 0; + int prop = editor.do_properties(toolbox, props, ids, &new_val); + if(prop == PROP_IMAGE) + { + if(new_val >= 0) + image = new_val%editor.map.images.len(); + else + image = -1; + } + return 0; } |