void Script_Orbit(itemDef_t *item, qboolean *bAbort, char **args) { const char *name = NULL; if (String_Parse(args, &name)) { float cx = 0.0f, cy = 0.0f, x = 0.0f, y = 0.0f; int time = 0; if (Float_Parse(args, &x) && Float_Parse(args, &y) && Float_Parse(args, &cx) && Float_Parse(args, &cy) && Int_Parse(args, &time)) { Menu_OrbitItemByName(item->parent, name, x, y, cx, cy, time); } } }
/* ================= Rect_Parse ================= */ bool Rect_Parse( const char **p, rectDef_t *r ) { if ( Float_Parse( p, &r->x ) ) { if ( Float_Parse( p, &r->y ) ) { if ( Float_Parse( p, &r->w ) ) { if ( Float_Parse( p, &r->h ) ) { return true; } } } } return false; }
qboolean Rect_Parse(char **p, rectDef_t *r) { if (Float_Parse(p, &r->x)) { if (Float_Parse(p, &r->y)) { if (Float_Parse(p, &r->w)) { if (Float_Parse(p, &r->h)) { return qtrue; } } } } return qfalse; }
/* ================= Color_Parse ================= */ bool Color_Parse( const char **p, Color::Color* c ) { int i; float f; for ( i = 0; i < 4; i++ ) { if ( !Float_Parse( p, &f ) ) { return false; } c->ToArray()[ i ] = f; } return true; }
qboolean Color_Parse(char **p, vec4_t *c) { int i; float f = 0.0f; for (i = 0; i < 4; i++) { if (!Float_Parse(p, &f)) { return qfalse; } (*c)[i] = f; } return qtrue; }
void Script_SetColor(itemDef_t *item, qboolean *bAbort, char **args) { const char *name = NULL; // expecting type of color to set and 4 args for the color if (String_Parse(args, &name)) { vec4_t *out = NULL; if (Q_stricmp(name, "backcolor") == 0) { out = &item->window.backColor; item->window.flags |= WINDOW_BACKCOLORSET; } else if (Q_stricmp(name, "forecolor") == 0) { out = &item->window.foreColor; item->window.flags |= WINDOW_FORECOLORSET; } else if (Q_stricmp(name, "bordercolor") == 0) { out = &item->window.borderColor; } if (out) { float f = 0.0f; int i; for (i = 0; i < 4; i++) { if (!Float_Parse(args, &f)) { return; } (*out)[i] = f; } } } }
void Script_Transition(itemDef_t *item, qboolean *bAbort, char **args) { const char *name = NULL; if (String_Parse(args, &name)) { rectDef_t rectFrom, rectTo; float amt = 0.0f; int time = 0; if (Rect_Parse(args, &rectFrom) && Rect_Parse(args, &rectTo) && Int_Parse(args, &time) && Float_Parse(args, &amt)) { Menu_TransitionItemByName(item->parent, name, rectFrom, rectTo, time, amt); } } }