From 6f0279d8dfb9db1824b2a037569e17bb0d49659a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 16 Jul 2019 21:36:23 +0200 Subject: Put all attribute values in a struct --- src/lightctx.c | 96 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'src/lightctx.c') diff --git a/src/lightctx.c b/src/lightctx.c index 21c0c03..c66e4a7 100644 --- a/src/lightctx.c +++ b/src/lightctx.c @@ -45,24 +45,24 @@ struct fixture *create_fixture(struct lightctx *nl, struct fixture_class *cls, fix->cls = cls; fix->flags = flags; - fix->intensity = 0.0; - fix->cyan = 0.0; - fix->magenta = 0.0; - fix->yellow = 0.0; - fix->red = 0.0; - fix->green = 0.0; - fix->blue = 0.0; - fix->pan = 0.0; - fix->tilt = 0.0; - fix->gobo = 0; - fix->gobo_rotate = 0.0; - fix->gobo_spin = 0.0; - fix->prism = 0; - fix->prism_rotate = 0.0; - fix->prism_spin = 0.0; - fix->focus = 0.5; - fix->zoom = 0.5; - fix->frost = 0.0; + fix->v.intensity = 0.0; + fix->v.cyan = 0.0; + fix->v.magenta = 0.0; + fix->v.yellow = 0.0; + fix->v.red = 0.0; + fix->v.green = 0.0; + fix->v.blue = 0.0; + fix->v.pan = 0.0; + fix->v.tilt = 0.0; + fix->v.gobo = 0; + fix->v.gobo_rotate = 0.0; + fix->v.gobo_spin = 0.0; + fix->v.prism = 0; + fix->v.prism_rotate = 0.0; + fix->v.prism_spin = 0.0; + fix->v.focus = 0.5; + fix->v.zoom = 0.5; + fix->v.frost = 0.0; return fix; } @@ -83,8 +83,8 @@ void attr_movex(struct lightctx *nl, signed int d, int fine) for ( i=0; in_sel; i++ ) { struct fixture *fix = &nl->fixtures[nl->selection[i]]; if ( !(fix->cls->attributes & PANTILT) ) continue; - fix->pan += chg; - cap_value(&fix->pan, -1.0, 1.0); + fix->v.pan += chg; + cap_value(&fix->v.pan, -1.0, 1.0); } } @@ -99,65 +99,65 @@ void attr_movey(struct lightctx *nl, signed int d, int fine) switch ( nl->sel_attr ) { case INTENSITY : - fix->intensity += chg; - cap_value(&fix->intensity, 0.0, 1.0); + fix->v.intensity += chg; + cap_value(&fix->v.intensity, 0.0, 1.0); break; case PANTILT : - fix->tilt += chg; - cap_value(&fix->tilt, -1.0, 1.0); + fix->v.tilt += chg; + cap_value(&fix->v.tilt, -1.0, 1.0); break; case FOCUS : - fix->focus += chg; - cap_value(&fix->focus, 0.0, 1.0); + fix->v.focus += chg; + cap_value(&fix->v.focus, 0.0, 1.0); break; case ZOOM : - fix->zoom += chg; - cap_value(&fix->zoom, 0.0, 1.0); + fix->v.zoom += chg; + cap_value(&fix->v.zoom, 0.0, 1.0); break; case FROST : - fix->frost += chg; - cap_value(&fix->frost, 0.0, 1.0); + fix->v.frost += chg; + cap_value(&fix->v.frost, 0.0, 1.0); break; case IRIS : - fix->iris += chg; - cap_value(&fix->iris, 0.0, 1.0); + fix->v.iris += chg; + cap_value(&fix->v.iris, 0.0, 1.0); break; case GOBO : - if ( (fix->gobo == 0) && (d<0) ) continue; - if ( (fix->gobo == fix->cls->n_gobos-1) && (d>0) ) continue; - fix->gobo += d; + if ( (fix->v.gobo == 0) && (d<0) ) continue; + if ( (fix->v.gobo == fix->cls->n_gobos-1) && (d>0) ) continue; + fix->v.gobo += d; break; case GOBO_ROTATE : - fix->gobo_rotate += chg; - cap_value(&fix->gobo_rotate, -1.0, 1.0); + fix->v.gobo_rotate += chg; + cap_value(&fix->v.gobo_rotate, -1.0, 1.0); break; case GOBO_SPIN : - fix->gobo_spin += chg; - cap_value(&fix->gobo_spin, -1.0, 1.0); + fix->v.gobo_spin += chg; + cap_value(&fix->v.gobo_spin, -1.0, 1.0); break; case PRISM : - if ( (fix->prism == 0) && (d<0) ) continue; - if ( (fix->prism == fix->cls->n_prisms-1) && (d>0) ) continue; - fix->prism += d; + if ( (fix->v.prism == 0) && (d<0) ) continue; + if ( (fix->v.prism == fix->cls->n_prisms-1) && (d>0) ) continue; + fix->v.prism += d; break; case PRISM_ROTATE : - fix->prism_rotate += chg; - cap_value(&fix->prism_rotate, -1.0, 1.0); + fix->v.prism_rotate += chg; + cap_value(&fix->v.prism_rotate, -1.0, 1.0); break; case PRISM_SPIN : - fix->prism_spin += chg; - cap_value(&fix->prism_spin, -1.0, 1.0); + fix->v.prism_spin += chg; + cap_value(&fix->v.prism_spin, -1.0, 1.0); break; } @@ -173,10 +173,10 @@ int any_selected_fixture_has(struct lightctx *nl, int attr) struct fixture *fix = &nl->fixtures[nl->selection[i]]; if ( fix->cls->attributes & attr ) return 1; if ( fix->cls->attributes & GOBO ) { - if ( fix->cls->gobo_flags[fix->gobo] & attr ) return 1; + if ( fix->cls->gobo_flags[fix->v.gobo] & attr ) return 1; } if ( fix->cls->attributes & PRISM ) { - if ( fix->cls->prism_flags[fix->prism] & attr ) return 1; + if ( fix->cls->prism_flags[fix->v.prism] & attr ) return 1; } } return 0; -- cgit v1.2.3