Commit graph

3420 commits

Author SHA1 Message Date
khreathor
31fa7a81ef Fix for single skin being marked as skingroup 2019-08-16 21:38:29 +09:00
khreathor
94c3c8c2cb Skingroup image export order based on texture node position (height) in shader editor. Nodes with higher position are exported first. 2019-08-16 21:38:29 +09:00
khreathor
4f29f57e77 Proper node positioning after import 2019-08-16 21:38:29 +09:00
khreathor
a13c382969 Skingroup images import order fix 2019-08-16 21:38:29 +09:00
khreathor
4d1f05186b Skingroups export added 2019-08-16 21:38:29 +09:00
khreathor
17e76149a1 Adjust playback range on import, to fit mdl's animation length 2019-08-16 21:38:29 +09:00
khreathor
66fe862a87 Import skingroups as separate materials with skins as textures 2019-08-16 21:38:29 +09:00
khreathor
ae86790e6c Initial Blender 2.8 changes - it works, now it's time for improvements 2019-08-16 21:38:29 +09:00
khreathor
8112c4e8b6 Moved MDL settings from Object tab to export options/presets 2019-08-16 21:38:29 +09:00
khreathor
90a707f7f9 Export animation range selected with start/end playback range in Timeline Editor 2019-08-16 21:38:29 +09:00
Bill Currie
4e4d1b99b4 Clean up all the system shutdown calls
I added Sys_RegisterShutdown years ago and never really did anything
with it: now any system that needs to be shutdown can ensure it gets
shutdown on program exit, and in the correct order (ie, reverse to init
order).
2019-07-12 23:15:26 +09:00
Bill Currie
c3fa78ef4d Include test for 2d vector expressions 2019-07-06 14:49:28 +09:00
Bill Currie
8caf2eb584 Mark some new functions as pure 2019-06-27 21:37:48 +09:00
Bill Currie
a5ee58cebb Support 2d vector expressions
[x, y] expands to [x, y, 0] (for now, might add a 2d vector type).
2019-06-18 11:54:45 +09:00
Bill Currie
83fac13a0c Fix debug line numbers for vector expressions 2019-06-18 11:53:58 +09:00
Bill Currie
b37c331e76 Catch taking size of null type
This should help catch similar errors in the future.
2019-06-18 10:39:17 +09:00
Bill Currie
0f1f477e64 Set up temp aliases correctly
Fixes vector expressions as sub-expresses. I really don't know why I did
the temp alias setup that way.
2019-06-18 10:38:19 +09:00
Bill Currie
fc50376297 Fix a minor error check mistake 2019-06-18 08:54:18 +09:00
Bill Currie
fe73547f43 Update alias type sameness check
This one seems to be fairly robust. Fixes alias being used to cast
pointers (maybe a better way, but this works for now).
2019-06-18 08:53:05 +09:00
Bill Currie
f7825fe7cf Print types properly in pointer value expressions 2019-06-18 00:22:24 +09:00
Bill Currie
b996fb7aa4 Make operand->type actual type instead of low-level
And clean up the resulting mess. This fixes struct copy, but uncovers
another bug :/
2019-06-17 23:38:34 +09:00
Bill Currie
e0c8285f07 Extend nested struct test to cover struct copy
Fails :P
2019-06-17 22:57:40 +09:00
Bill Currie
dd52b7fea1 Merge aliased alias expressions
This comes up when accessing struct fields nested in another struct.
Fixes the nested struct fields test.
2019-06-17 22:48:42 +09:00
Bill Currie
e9c24dbf1c Test case for accessing nested struct fields
Currently fails.
2019-06-17 22:47:44 +09:00
Bill Currie
ec128ffeee Leave a FIXME for daglabel_t.live 2019-06-16 19:24:19 +09:00
Bill Currie
d6d3027411 Mark the correct operand as live
This fixes vecexpr (and possibly other cases).
2019-06-16 19:21:02 +09:00
Bill Currie
6e21c3ae2e Treat func statements similarly to flow statements
func statements need their operands marked live like flow statements do
because usage is more indirect.
2019-06-16 19:20:21 +09:00
Bill Currie
db4a7a139e Use the alias code when making vars live
Not sure the live forcing flag is needed anymore (need to test).
2019-06-16 19:17:45 +09:00
Bill Currie
2977c145d0 Clean up dag live alias code a little
Mainly, this makes it possible to reuse the alias code.
2019-06-16 19:17:01 +09:00
Bill Currie
82b334e919 Number dot dumps to help identify order 2019-06-16 19:12:18 +09:00
Bill Currie
c40f4194e9 Use tempop_visit_all for flow and dags
Fixes t3 of vecexpr, but t2 is broken (lost first assignment).
2019-06-16 16:56:39 +09:00
Bill Currie
3c4903245a Fix some curly space 2019-06-16 16:55:54 +09:00
Bill Currie
bc271d8a02 Add tempop_visit_all
Works the same as def_visit_all, but for temp operands.
2019-06-16 16:52:49 +09:00
Bill Currie
fa69aeef0f Improve handling of temp aliases
This makes all tests pass when not optimizing. More work needs to be
done in dags.
2019-06-12 00:37:02 +09:00
Bill Currie
b18a744288 Use offset alias expressions
They are not quite working yet as the operand generator does not use the
offset yet.
2019-06-10 23:55:16 +09:00
Bill Currie
cc27949a34 Ensure pointer values always have a type
The dags generator was creating a pointer value with no type which
caused print_statement to segfault.
2019-06-10 23:52:39 +09:00
Bill Currie
ee1f5f9478 Add support for binary alias expressions
Doesn't quite work yet.
2019-06-10 23:48:58 +09:00
Bill Currie
913b9f52e0 Add an offset alias expression
This should make dealing with def elements (vector etc) easier.
2019-06-10 18:13:28 +09:00
Bill Currie
efdfc7436f Move ev_types into types.[ch]
No wonder I couldn't find it the other day...
2019-06-10 18:04:25 +09:00
Bill Currie
08ab42fc15 Handle vector expressions as sub-expressions
Now my little game builds again :)
2019-06-10 15:50:35 +09:00
Bill Currie
49ed4310fd Fix assigning int to enum or enum to int
Or float, for v6 progs.
2019-06-10 08:46:40 +09:00
Bill Currie
83fb588727 Support vector/quaternion division by float
Implemented via v*(1/f) or q*(1/f) to give CSE a chance to optimize the
division if necessary as otherwise the engine would have to divide every
time.
2019-06-10 08:44:36 +09:00
Bill Currie
7dc1a0640a Delay creating actual enum symbols
In order to keep enumerator type and enum type the same, the values need
to have their type set after the enum type is finalized, and then the
appropriate symbols created in the parent scope. This fixes the infinite
recursion when assigning an enum value to its own type.
2019-06-10 07:44:23 +09:00
Bill Currie
f81484a068 Test compiling enums
It turns out the enumerator type and enum type wind up with different
instances of the same type (due to the way type chaining works). This
results in infinite recursion in assign_expr and check_types_compatible.
2019-06-10 07:17:41 +09:00
Bill Currie
ef4ad52239 Make binary_expr fold constants
This is where constant folding should have happened all along. While
unary_expr should fold constants too, it seems to already try to do so
and it's a bit much of a mess to clean up right now.
2019-06-10 00:36:13 +09:00
Bill Currie
bf0543f7fb Be paranoid about temp var sizes
Prevents array index errors.
2019-06-10 00:19:48 +09:00
Bill Currie
28a2b96800 Implement automatic array sizing from initializer 2019-06-09 23:11:38 +09:00
Bill Currie
00f12263ca Fix casting arrays to pointers 2019-06-09 22:55:38 +09:00
Bill Currie
3196bcc851 Allow fold_constants to handle some math identities
Such as x*0 -> 0, x*1 -> x, x+0 ->x, etc.
2019-06-09 22:34:23 +09:00
Bill Currie
c98d1ff08c Document some problems with nil
While he's a pretty cool character in HZD, he seems to have some
identity problems when in a compiler.
2019-06-09 22:29:51 +09:00
Bill Currie
439cd15620 Do type promotion for short
fold_constants used to do this when it was overly aggressive. Fixes the
ICE when accessing an array in a struct via a pointer.
2019-06-09 22:27:53 +09:00
Bill Currie
227ac46ffe Clean up array expression processing
And make sure constants are folded since fold_constants is no longer
recursive.
2019-06-09 22:25:55 +09:00
Bill Currie
f70801fa52 Add a test for accessing an array in a struct
That's accessed via a pointer. Whee. However, at this stage, the problem
is really a promotion issue for short -> integer.
2019-06-09 21:44:58 +09:00
Bill Currie
e46a44d9c6 Update TODO 2019-06-09 21:37:46 +09:00
Bill Currie
6253623e9b Remove some weird dereference code
It appears to have been an attempt at optimizing dereferences, but it
instead just utterly mangled them.
2019-06-09 21:37:46 +09:00
Bill Currie
f49303e774 Emit code for address expressions
It helps if the necessary code is actually emitted in the first place.
2019-06-09 21:37:46 +09:00
Bill Currie
8cef85e5de Cast scalar types when necessary on assignment
This fixes type promotion errors that broke some tests.
2019-06-09 20:12:50 +09:00
Bill Currie
e849c2d1ce Mark block expr result as rvalue when used as one
At least for return. There may be other cases that need it, but this
fixes comma-expr.r (minus int->float promotion issues).
2019-06-09 19:29:21 +09:00
Bill Currie
d9c9686288 Make initialized globals non-constant
This is for modern code. Traditional code still treats initialized
globals as constant and nosave. This will make a bit of a mess of
modern code that expects traditional behavior.
2019-06-09 19:23:23 +09:00
Bill Currie
b7b6a89b91 Simplify fold_constants
While this does break automatic type promotion, it does stop
fold_constants recursing through complex expressions: only the top level
expression needs to be folded, and then only if both sides are actually
constant.
2019-06-09 19:20:35 +09:00
Bill Currie
2ee36e8b99 Rename qfot_type_t.ty to meta
When I did up a ruamoko implementation of a type encoding dumper, I
named the field meta, which feels much better than ty.
2019-06-09 18:10:07 +09:00
Bill Currie
f093516962 Move qfo type encoding structs
This makes them available to the gamecode VM, and thus the debugger.
2019-06-09 18:07:58 +09:00
Bill Currie
7fce68649a Implement comma expressions
Doesn't quite work (attempt to suppress warning for return a = 3, 5;
failed).
2019-06-09 16:56:20 +09:00
Bill Currie
689d1ad3ec Remove some debug prints 2019-06-09 16:45:01 +09:00
Bill Currie
33c2eb430f Stop bison complaining about %expect
And make sure warnings get fixed.
2019-06-09 16:19:27 +09:00
Bill Currie
1db600548e Fix for decl test scope issue 2019-06-09 13:55:07 +09:00
Bill Currie
ec89149b29 Build for loop decl inits correctly
The multiple expressions are chained together and evaluate in left to
right order.
2019-06-09 13:54:03 +09:00
Bill Currie
d29ea55826 Add a test for for loop declarations
I think the compiler segfaulting indicates a test failure.
2019-06-09 13:02:36 +09:00
Bill Currie
625e767684 Update qf dependency stuff for recent automake
Not sure just what version of automake broke things, but I do remember
having a bad time getting the dependencies to work in the first place.
At least now they should be more reliable (until automake changes
things).
2019-06-09 13:00:55 +09:00
Bill Currie
5bd3c8c985 Allow variable declarations in for loops
Matches C, C++ and C#
2019-06-08 21:52:17 +09:00
Bill Currie
be4c3a82a2 Detect redefinitions of structs and unions
While the redefinition was being detected, it was misreported as the tag
being wrong, and on the wrong line, too.
2019-06-08 19:25:25 +09:00
Bill Currie
f2102187b9 Clean up emit_protocol_list
Now it uses emit_structure, which will make it easier should things go
wrong.
2019-06-08 19:23:49 +09:00
Bill Currie
6acbdcb3e5 Correct a typo 2019-06-08 19:23:10 +09:00
Bill Currie
df0316bb13 Clean up some comment FIXMEs 2019-06-08 19:22:29 +09:00
Bill Currie
e217bdd55f Assign vector expressions to a temp for return
Rather than direct to .return, allowing return of vector expressions
with function calls without trashing the vector.
2019-06-08 13:36:03 +09:00
Bill Currie
ebab6574b9 Allow taking the address of a temporary variable 2019-06-08 13:35:47 +09:00
Bill Currie
e27da9c7db Avoid folding constants in assign_expr
This prevents fold_constants from complaining about attempts to take
the address of a vector.
2019-06-08 13:31:30 +09:00
Bill Currie
398e1cf83a Use output file as base for dot files
Ensures the output goes not go into the source directory when using a
separate build tree.
2019-06-08 13:30:06 +09:00
Bill Currie
3327127e36 Fix a typo in a comment 2019-06-08 13:28:29 +09:00
Bill Currie
4ef4a7e955 Start work on simple names in symbol tables
I don't remember what the goal was (stopped working on it eight months
ago), but some possibilities include:
 - better handling of nil (have trouble with assigning into struts)
 - automatic forward declarations ala C# and jai (I was watching vids
   about jai at the time)
 - something for pascal
 - simply that the default symbol type should not be var (in which case,
   goal accomplished)
2019-06-06 07:01:44 +09:00
Bill Currie
7e31704ebe Be more informative for pass by value size errors 2019-06-06 06:46:38 +09:00
Bill Currie
a5da8da1dc Be more informative for symbol type internal errors 2019-06-06 06:45:48 +09:00
Bill Currie
d00a2ef82d Convert constant vector expressions in binary expressions
Fixes not being able to compare with eg [1, 2, 3]
2019-06-06 06:44:19 +09:00
Bill Currie
319ecfbbfa Create a usable dot for vector expressions
It leaves a lot to be desired, but it beats "FIXME".
2019-06-06 06:42:31 +09:00
Bill Currie
607ec3124e More dead code removal.
I have no idea why this hung around. It appears to be old array/struct
initialization.
2018-10-15 22:12:40 +09:00
Bill Currie
ff5c1cd4c2 Clean up redundant type parameter to initialize_def. 2018-10-15 22:11:20 +09:00
Bill Currie
1746ce3af5 Make int type name reflect its keyword.
Makes qc error messages make more sense.
2018-10-15 20:54:05 +09:00
Bill Currie
302934a1e4 Remove some dead code. 2018-10-15 20:52:46 +09:00
Bill Currie
2a2754e581 More ways to break qfcc :/ 2018-10-15 19:48:19 +09:00
Bill Currie
6c53be928b Support returning vector expressions.
Currently fails due to a scheduling problem when the vector expression
contains functions.
2018-10-13 23:32:53 +09:00
Bill Currie
aaab18c9a7 Nuke a dead field.
It looks like ex_temp_t.expr was never really used, and I have no idea
what I had intended (not surprising after ~17 years).
2018-10-13 12:07:50 +09:00
Bill Currie
2f2edae43b Make error, warning and notice give compiler file/line too.
But only when verbosity > 1 (-vv).
2018-10-13 09:31:00 +09:00
Bill Currie
4828934e50 Fix a equality check typo.
Fixes bad code generation when assigning to vector.x in a function with no
parameters and the vector is the first local var.
2018-10-12 23:39:05 +09:00
Bill Currie
78e0a8dc52 Support assigning non-constant vector expressions. 2018-10-12 22:05:17 +09:00
Bill Currie
e03dfa29b4 Clean up the module .ctor construction a little. 2018-10-12 21:09:36 +09:00
Bill Currie
f56d25cda6 Don't double print messages. 2018-10-12 20:46:45 +09:00
Bill Currie
668896aa82 More diagnostic improvements. 2018-10-12 16:01:11 +09:00
Bill Currie
71b3d30aa1 Make the ice a little more informative. 2018-10-12 14:51:39 +09:00
Bill Currie
f58c2fef5a Switch QF's quaterions from wxyz to xyzw.
After messing with SIMD stuff for a little, I think I now understand why
the industry went with xyzw instead of the mathematical wxyz. Anyway, this
will make for less pain in the future (assuming I got everything).
2018-10-12 14:33:55 +09:00
Bill Currie
b7aa5bb8fe Fix an oops messing up edict size. 2018-10-12 14:33:26 +09:00