Commit Graph

9228 Commits (092a23c2f7a39bbb45c8ad321699f2425c3fe438)
 

Author SHA1 Message Date
Nicolas Hake 092a23c2f7 Aul: Parse scripts into an AST, then generate bytecode from that
This commit contains a fairly substantial rewrite of the C4Script code
generator. Instead of generating bytecode while parsing the script,
we're now parsing the script into a syntax tree, and have any further
processing happen on that instead of the raw source.

At this time, the code generator emits the same bytecode as the old
parser; there are several optimization opportunities that arise from the
new possibility to emit code out of order from its specification by the
author.

Compared to the old compiler, this one is still rather deficient when
dealing with incorrect code; it's also not emitting several warnings
that used to be diagnosed.
2016-05-12 19:43:48 +02:00
Nicolas Hake 78e5f8528d C4PropList::GetParent: make const 2016-05-12 18:47:53 +02:00
Nicolas Hake be2fdaaae3 C4Particles: Fix build with MSVC memory tracing 2016-05-12 18:47:52 +02:00
David Dormagen 771bd802f0 particles: re-added missing intialization of ibo_size
Thanks to ck, who noticed. Apparently it got lost when reverting some changes back and forth for testing, because I had one revision where I didn't need it anymore but I reverted most of that.
2016-05-12 10:03:02 +02:00
Nicolas Hake 13e02bb418 C4Random: Fix build with MSVC memory tracing 2016-05-11 17:15:47 +02:00
Nicolas Hake 5872b5e8ae C4AulFunc::GetFullName: make const 2016-05-11 17:15:47 +02:00
Nicolas Hake 10abb1bbdb Remove unused C4AUL_CodeBufSize 2016-05-11 17:15:47 +02:00
Nicolas Hake a100b93e7f DEBUG_BYTECODE_DUMP: Allow setting from build system 2016-05-11 17:15:47 +02:00
Nicolas Hake 16641d3841 C4AulScriptFunc::DumpByteCode: properly align BCC names
The old code just appended eight spaces when the type of the BCC was
shorter than eight chars.
2016-05-11 17:15:47 +02:00
David Dormagen a20b7834c0 OneMillionParticles.ocs: removed some randomness in the amount of particles in the final test
It's easier to compare runs this way.
2016-05-10 22:29:30 +02:00
David Dormagen 6bacdfcbb6 particles: fixed some particles not rendering under certain conditions
Some particles were visibly missing. The reason was apparently that the VAO was initialized with an IBO that was yet too small (because not all particles were created yet).
To be honest, I don't know why the IBO needs to be rebound as the identifier itself does not change(?) but maybe OpenGL optimizes some stuff and needs the size fixed?

Steps to reproduce: In OneMillionParticles.ocs, make Test3 be the first test (otherwise the IBO would have been large enough). You would now not see all of the fireworks.

The issue was introduced in e13cda4bd0
2016-05-10 22:26:34 +02:00
David Dormagen 29333ef87a particles: initialize primitive restart index IBO lazily
Otherwise the IBO is created from scratch for every particle that is e.g. created in a for loop. This is extremely slow and unnecessary.
The symptoms was that OneMillionParticles appeared to 'freeze' on the non-batch creation test. (Hint: it didn't freeze, it just took forever).
2016-05-10 21:46:32 +02:00
Nicolas Hake 26334cb4d7 Aul: Join AB_INT + AB_Neg 2016-05-09 12:33:59 +02:00
Nicolas Hake 34556e3e81 Aul: Join AB_STRING+AB_ARRAYA to AB_PROP 2016-05-09 12:33:58 +02:00
Nicolas Hake f2bf34ff3e Add missing semicolons to CreateEffect tests 2016-05-09 12:33:56 +02:00
Nicolas Hake 33f7fb935f C4AulCompiler: Rename iStack to stack_height 2016-05-09 12:33:51 +02:00
Nicolas Hake 41000a8f9a C4AulCompiler: Rename pLoopStack to active_loops 2016-05-09 12:21:33 +02:00
Nicolas Hake d0dbe05876 C4AulCompiler: Rename fJump to at_jump_target
You have no idea how much I hate systems hungarian.
2016-05-09 12:21:33 +02:00
Nicolas Hake f0b4ef46a5 GetStackValue: Remove "default: /* unreachable */"
Without an explicit default case, the compiler can warn about unhandled
enum values inside the switch.
2016-05-09 12:21:33 +02:00
Nicolas Hake 7a135a060f C4AulParse: Take GetTokenName out of public interface 2016-05-09 12:21:33 +02:00
Nicolas Hake 0a3b31e735 C4AulParse::AddVarAccess: Move to C4AulCompiler 2016-05-09 12:21:33 +02:00
Nicolas Hake 0342711cd4 C4AulCompiler: Take GetStackValue out of public interface 2016-05-09 12:21:33 +02:00
Nicolas Hake 792e12adad C4AulCompiler: Split into separate file 2016-05-09 12:21:33 +02:00
Nicolas Hake c8d71d47c0 C4CodeGen: Rename to C4AulCompiler
I need to split up C4CodeGen into smaller parts, and having the bit that
actually generates the bytecode named C4CodeGenCodeGen would be silly.
2016-05-09 12:21:33 +02:00
Nicolas Hake 86729ea536 Declare C4AulBCC as class instead of struct
The C++ standard says that it doesn't matter whether you forward declare
something as struct or class and then define it using the other keyword.
Unfortunately MSVC adds those keywords to its name mangling scheme,
which breaks things.
2016-05-09 12:21:33 +02:00
Lukas Werling 042e3c9602 SDL: Fix crash when opening resolution selector 2016-05-07 22:03:25 +02:00
Lukas Werling 9fa16c5e14 SDL: Enable multisampling
Unfortunately, there doesn't seem to be an easy way to apply
multisampling changes in SDL. As a workaround, a message requesting the
player to restart the game is shown.
2016-05-07 12:25:11 +02:00
Lukas Werling 1919d81f9d SDL: Implement FlashWindow for X11 2016-05-07 00:33:26 +02:00
Julius Michaelis 30bb12164b gtk_window_set_urgency_hint 2016-05-05 22:20:52 +02:00
Günther Brammer 06b5f0e5ce convert_cr_to_oc: Don't bother writing out empty Script.c 2016-05-03 02:13:14 +02:00
kpone33 77e5fb7acf Added Offshore to Music.ocg 2016-05-01 20:06:07 +02:00
Lukas Werling c9aa07ee60 Add more documentation for Mod() (#1735) 2016-05-01 19:52:22 +02:00
Mark 4f9d8afa93 Merge branch 'liquid_container'
Added liquid objects for acid, lava, water and the new material oil. Expanded power system unit test and added some more unit tests for the producer system and liquid containers.
2016-05-01 19:44:33 +02:00
Mark 7d5d97b0d6 Merge remote-tracking branch 'origin/master' into liquid_container 2016-05-01 19:43:10 +02:00
Lukas Werling dd48a759d7 Add mathematical modulo helper function Mod(a, b) 2016-05-01 19:25:12 +02:00
Lukas Werling 60e9383a42 Improve seeding of UnsyncedRandomRng 2016-05-01 19:21:09 +02:00
Mark b96b183007 Merge 'master' into liquid_container 2016-05-01 18:54:38 +02:00
Maikel de Vries 3907281933 fix script error when striking sword (#1731) 2016-05-01 16:54:05 +02:00
Mark 853af2c155 Merge 'master' into liquid_container 2016-05-01 08:43:05 +02:00
Günther Brammer 9741af42fd Replace all usages of the old local variables list with properties 2016-05-01 00:28:37 +02:00
Günther Brammer 7792acdff0 Script: Check for functions before keywords
This unifies the lookup for local variables and functions. Its slightly
awkward that global functions can overload if and Par now, but local
variables already could.
2016-05-01 00:28:37 +02:00
Günther Brammer 30f7457d89 Remove unused macros leftover from removed script features 2016-05-01 00:28:37 +02:00
Günther Brammer b8f2d0ca87 Script: Repeat the parser error message when executing a broken function 2016-05-01 00:28:37 +02:00
Günther Brammer 17b18da26c Make bytecode dump work again
Dumping the bytecode before adding EOFN while depending on that to signal
the end isn't such a hot idea.
2016-05-01 00:28:37 +02:00
Maikel de Vries f4ae76454b rename player control callback for specified id's to silence warning
It is better to have different names for different callbacks.
2016-04-29 21:51:58 +02:00
Günther Brammer 904bf78d68 Don't crash when deserializing an effect with object command target (#1730) 2016-04-29 00:16:20 +02:00
Günther Brammer 4092911349 Move code generation into its own class 2016-04-28 03:25:47 +02:00
Günther Brammer b00b8554ab Merge branch script 2016-04-28 03:25:44 +02:00
Günther Brammer d45ac946fe Add C4AulParseError constructor and cease reusing it for warnings
The nontrivial code that formats the position is now a function of
C4AulParse used by both warnings and errors.
2016-04-28 02:59:12 +02:00
Nicolas Hake a8f4bd3960 C4AulParseError: Avoid the second string parameter
While I'm not a big fan of hiding flow control in a function, Error()
handles formatting and saves me from calling FormatString().getData() a
lot.
2016-04-28 02:59:12 +02:00