mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-19 17:01:46 +00:00
allow non-const expressions for the frame number and make sure the time
step is a float (for state expressions)
This commit is contained in:
parent
afdbd90bc1
commit
1c090c38a3
1 changed files with 11 additions and 2 deletions
|
@ -554,16 +554,25 @@ opt_state_expr
|
|||
{
|
||||
$$ = 0;
|
||||
}
|
||||
| '[' const ',' { $<type>$ = &type_function; } def_name opt_step ']'
|
||||
| '[' fexpr ',' { $<type>$ = &type_function; } def_name opt_step ']'
|
||||
{
|
||||
if ($2->type == ex_integer)
|
||||
convert_int ($2);
|
||||
else if ($2->type == ex_uinteger)
|
||||
convert_uint ($2);
|
||||
if ($2->type != ex_float)
|
||||
if (!type_assignable (&type_float, get_type ($2)))
|
||||
error ($2, "invalid type for frame number");
|
||||
$2 = cast_expr (&type_float, $2);
|
||||
if ($5->type->type != ev_func)
|
||||
error ($2, "invalid type for think");
|
||||
if ($6) {
|
||||
if ($6->type == ex_integer)
|
||||
convert_int ($6);
|
||||
else if ($6->type == ex_uinteger)
|
||||
convert_uint ($6);
|
||||
if (!type_assignable (&type_float, get_type ($6)))
|
||||
error ($6, "invalid type for time step");
|
||||
}
|
||||
|
||||
$$ = new_state_expr ($2, new_def_expr ($5), $6);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue