Commit graph

472 commits

Author SHA1 Message Date
Rémi Verschelde 6163343118 Make that Whole New World great again
Fix regression from 5dbf180 that broke Windows build.
2017-03-05 19:12:22 +01:00
Rémi Verschelde 5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Rémi Verschelde e1c1d7d1d7 Add a bunch of missing Godot headers in own files 2017-03-05 15:47:28 +01:00
Rémi Verschelde 49c065d29c Refactoring: rename tools/editor/ to editor/
The other subfolders of tools/ had already been moved to either
editor/, misc/ or thirdparty/, so the hiding the editor code that
deep was no longer meaningful.
2017-03-05 14:21:25 +01:00
Ferenc Arn 790611ef26 Added missing FIXMEs in PR #7878 2017-03-02 16:13:01 -06:00
Rémi Verschelde a1cbe8e22b Merge pull request #7878 from RebelliousX/else
Bunch of missing `else` statements and general logic
2017-02-28 23:03:10 +01:00
Saracen 5e938f0001 Inf and NaN support added to GDScript. 2017-02-28 21:52:33 +00:00
Thaer Razeq f50488a361 Various fixes detected using PVS-Studio static analyzer.
- Add FIXME tags comments to some unfixed potential bugs
- Remove some checks (always false: unsigned never < 0)
- Fix some if statements based on reviews.
- Bunch of missing `else` statements
2017-02-28 07:52:02 -06:00
Rémi Verschelde 1ec8b9fb7d Merge pull request #7851 from shlomif/fix-some-compilation-warnings
Get rid of some compilation warnings.
2017-02-26 20:22:48 +01:00
Rémi Verschelde 0f12d0a924 Merge pull request #7827 from volzhs/libwebp-0.6.0
Update libwebp to 0.6.0
2017-02-26 20:13:31 +01:00
Rémi Verschelde a78c314b0e Merge pull request #7809 from hpvb/fix-6798
Allow preload to accept a const string.
2017-02-26 20:12:36 +01:00
Shlomi Fish 0a2c387d5c Fix some compilation warnings.
Redone the commit based on the input in
https://github.com/godotengine/godot/pull/7851 . Not all warnings were
fixed but it's a start.
2017-02-21 11:59:19 +02:00
Juan Linietsky de0045cf1b -renamed globals.h to global_config.cpp (this seems to have caused a few modified files)
-.pck and .zip exporting redone, seems to be working..
2017-02-21 00:06:30 -03:00
volzhs 6de3defe72 Update libwebp to 0.6.0 2017-02-17 23:49:40 +09:00
Hein-Pieter van Braam b696beea65 Correct hash behavior for floating point numbers
This fixes HashMap where a key or part of a key is a floating point
number. To fix this the following has been done:

* HashMap now takes an extra template argument Comparator. This class
gets used to compare keys. The default Comperator now works correctly
for common types and floating point numbets.

* Variant implements ::hash_compare() now. This function implements
nan-safe comparison for all types with components that contain floating
point numbers.

* Variant now has a VariantComparator which uses Variant::hash_compare()
safely compare floating point components of variant's types.

* The hash functions for floating point numbers will now normalize NaN
values so that all floating point numbers that are NaN hash to the same
value.

C++ module writers that want to use HashMap internally in their modules
can now also safeguard against this crash by defining their on
Comperator class that safely compares their types.

GDScript users, or writers of modules that don't use HashMap internally
in their modules don't need to do anything.

This fixes #7354 and fixes #6947.
2017-02-16 18:44:29 +01:00
Hein-Pieter van Braam 3e5743ca36 Allow preload to accept a const string.
In preload() parsing this code will lookup the identifier in the local
constant database. If the identifier corresponds to a string constant
it is used as the path for preload().

Currently this does not work for global constants, only constants
declared in the same class as the preload is happening. We can implement
a full fix too. Maybe we can use this PR to discuss the possibilities.

This (partially) fixes #6798
2017-02-16 14:29:18 +01:00
Juan Linietsky da11d6d9e8 Many fixes to make exported scenes work better, still buggy. 2017-02-15 08:34:02 -03:00
Juan Linietsky d7fd86d51a -begin of export work, not done yet
-fixes to make scenes exported from godot 2.x work
2017-02-15 08:30:32 -03:00
Hein-Pieter van Braam e8611966de Remove bounds check when resuming from yield.
The code would get a pointer to the beginning of the call_args by using
operator[] at the stack Vector. This does bound checking. When there are
no call_args this bound check fails and the error mentioned in #7796
gets triggered.

This bound check is actually not necessary as call_args just gets set to
NULL and never dereferenced. This new code will just unconditionally set
the pointer to the place where the call_args are if there are any. There
is no NULL check for call_args anywhere so this is safe.

Fixes #7796
2017-02-13 21:59:05 +01:00
Hein-Pieter van Braam 411ee71b4d Rename the _MD macro to D_METHOD
This new name also makes its purpose a little clearer

This is a step towards fixing #56
2017-02-13 12:50:02 +01:00
Hein-Pieter van Braam 0f687f0ccb Remove use of _SCS from ADD_METHOD
This saves typing and is a step towards fixing #56
2017-02-13 10:37:47 +01:00
Rémi Verschelde 530de920d4 Merge pull request #7723 from lonesurvivor/gdscript-range-fix
Fix parsing bug which causes range(variable) to crash the engine
2017-02-12 23:13:08 +01:00
Juan Linietsky 6f2e16306a Several bugfixes, improving the import workflow 2017-02-06 00:38:39 -03:00
lonesurvivor c71a6c6d71 Fix parsing bug which causes range(variable) to crash the engine
problem was a segmentation fault caused by trying to access Vector constants[0] which isn't there if op->arguments.size() is not bigger than one.

- the changed OR condition didn't make sense (always true), should be AND
- changes the "constant" variable to be false per default and gets set to true when there is actually something pushed to "constants"
2017-02-04 20:57:39 +01:00
Juan Linietsky d2b2d6801f Changed OGG Vorbis type to be imported, so it's possible to specify loop 2017-02-03 08:55:29 -03:00
Juan Linietsky 96de0141cc Removed import/export system, will start new one from scratch. 2017-01-25 21:57:08 -03:00
Rémi Verschelde 5027799c13 Merge pull request #7583 from karroffel/wildcard
made _ a special token in GDScript
2017-01-23 07:55:11 +01:00
Juan Linietsky 0aa7242624 WIP new AudioServer, with buses, effects, etc. 2017-01-21 19:01:00 -03:00
karroffel c24c739da5 made _ a special token in GDScript 2017-01-20 09:26:55 +01:00
Ferenc Arn 6f4f9aa6de Overloaded basic math funcs (double and float variants). Use real_t rather than float or double in generic functions (core/math) whenever possible.
Also inlined some more math functions.
2017-01-16 13:36:33 -06:00
Rémi Verschelde bf05dab74f Merge pull request #7532 from tagcup/pcg_prng
Replace the existing PRNG (Xorshift31) with (minimal) PCG-32.
2017-01-16 20:06:54 +01:00
Rémi Verschelde 2a0ddc1e89 Style: Various fixes to play nice with clang-format 2017-01-16 08:49:52 +01:00
Rémi Verschelde f44ee891be Style: Fix statements ending with ';;' 2017-01-16 08:49:52 +01:00
Rémi Verschelde 40323407df Style: No break before list brace
clang-format does not handle that well *at all*.

For the reference, found the relevant pieces of code with:
`ag "=[ "$'\t'"]?"$'\n'"[ "$'\t'"]?{" --ignore=thirdparty`
2017-01-16 08:48:24 +01:00
Rémi Verschelde 3890256fc5 Style: Cleanups, added headers, renamed files
Made sure files in core/ and tools/ have a proper Godot license header
when written by us. Also renamed aabb.{cpp,h} and object_type_db.{cpp,h}
to rect3.{cpp,h} and class_db.{cpp,h} respectively.

Also added a proper header to core/io/base64.{c,h} after clarifying
the licensing with the original author (public domain).
2017-01-16 08:04:23 +01:00
Ferenc Arn 4c9004671a Replace the existing PRNG (Xorshift31) with (minimal) PCG (XSH-RR variant with 32-bit output, 64-bit state).
PCG is better than many alternatives by many metrics (see www.pcg-random.org) including statistical quality with good speed.
2017-01-15 19:15:16 -06:00
Juan Linietsky b400c69cd4 Oops! Audio engine has vanished :D 2017-01-15 16:07:51 -03:00
Rémi Verschelde e0faf8a51b Style: Cosmetic fixes to play nice with clang-format 2017-01-15 16:42:17 +01:00
James Mintram dab73c701a Compile error when duplicate key in dictionery literal #7034 2017-01-14 22:08:49 +01:00
Juan Linietsky 4261880c94 Merge pull request #6845 from karroffel/master
Adds pattern matching to GDScript
2017-01-14 17:08:10 -03:00
Juan Linietsky 7924f08a6a Merge pull request #4918 from jjay/f/error_on_redefine
Redefine var results in an error
2017-01-14 17:07:08 -03:00
Juan Linietsky dcb95ec147 removed duplicated functions in class hierarchy that were bound more than once
added a check to detect this case in the future
2017-01-14 11:10:42 -03:00
Rémi Verschelde 93ab45b6b5 Style: Fix whole-line commented code
They do not play well with clang-format which aligns the `//` part
with the rest of the code block, thus producing badly indented commented code.
2017-01-14 14:52:23 +01:00
Juan Linietsky d9d77291bc rename String.extension() -> String.get_extension() / String.basename() -> String.get_basename() 2017-01-14 00:51:09 -03:00
Juan Linietsky a97551902e rename Input.get_mouse_speed() to Input.get_last_mouse_speed() 2017-01-13 19:24:28 -03:00
Juan Linietsky a2903fc51d Must now register with set_transform_notify() to get NOTIFICATION_TRANSFORM_CHANGED 2017-01-12 20:35:46 -03:00
Juan Linietsky da477b76a9 some class renames
TextureFrame -> TextureRect
Patch9Frame -> NinePatchRect
ColorFrame -> ColorRect
2017-01-12 18:28:12 -03:00
Juan Linietsky 6dd7d2c1f7 Implicit inheritance now defaults to Resource, will error for node scripts if extends not used. 2017-01-12 16:00:57 -03:00
Juan Linietsky bfef8de1bc More efficient iteration syntax, and range() is converted behind the scenes to it. 2017-01-11 20:10:23 -03:00
Rémi Verschelde 42802ab9dc Merge pull request #6930 from bojidar-bg/gdscript-export-array-hint
Allow typing hints for Array class (in GDScript and Inspector)
2017-01-11 14:46:38 +01:00