Commit graph

34 commits

Author SHA1 Message Date
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
bruvzg 25cd29ae66 Fix loading RLE compressed TGA files.
Fix memory reads outside of input buffer when loading invalid TGA files.
2021-06-14 13:55:39 +03:00
Marcel Admiraal da5d7db610 Rename File::get_len() get_length() 2021-05-25 11:54:28 +01:00
Pedro J. Estébanez 469fa47e06
Make all file access 64-bit (uint64_t)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-17 15:06:19 +02:00
Rafał Mikrut f7209b459b Initialize class/struct variables with default values in modules/ 2021-02-08 10:57:18 +01:00
Hein-Pieter van Braam-Stewart 403e4fd08b Fix a crash in the TGA loader with malformed input 2021-02-04 13:09:21 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Hugo Locurcio 0209e3790e
Add Image.load_bmp_from_buffer() for run-time BMP image loading
This partially addresses
https://github.com/godotengine/godot-proposals/issues/676.
2020-10-20 23:52:45 +02:00
Paul Herman 7d4b3e6587 Expose loading TGA images in Image. 2020-05-21 16:02:53 +02:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde dcd1151d77 Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2020-05-14 13:45:01 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Rémi Verschelde cd4e46ee65 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.
2020-03-30 09:05:53 +02:00
Rajat Goswami 2ecf928ae3 Adding missing include guards to header files identified by LGTM.
This addresses the issue godotengine/godot#37143
2020-03-23 04:52:36 -04:00
Juan Linietsky 3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Ibrahn Sahir 4e4697b1c4 Added release function to PoolVector::Access.
For clarity, assign-to-release idiom for PoolVector::Read/Write
replaced with a function call.
Existing uses replaced (or removed if already handled by scope)
2019-07-06 12:04:27 +01:00
Andrii Doroshenko (Xrayez) d0f0f1f1cb Fix TGA indexed images loaded with flipped color table
This fixes incorrect color table lookup where red and blue channels were flipped.
2019-04-21 16:05:00 +03:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Saracen 115f6d14a0 Fix bits_per_pixel validation in BMP and TGA loader modules. 2018-07-08 18:51:20 +01:00
Rémi Verschelde 3334209a73 SCons: Pass env to modules can_build method
This allows to disable modules based on the environment,
in particular `env[tools]` which tells us if we are
building the editor or not.
2018-05-30 19:11:36 +02:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Rémi Verschelde 677e95d8d1 doc: Make all module docs self-contained 2017-11-15 21:29:33 +01:00
letheed 5ad9be4c24 Rename pos to position in user facing methods and variables
Rename user facing methods and variables as well as the corresponding
C++ methods according to the folloming changes:

* pos -> position
* rot -> rotation
* loc -> location

C++ variables are left as is.
2017-09-20 13:11:10 +02:00
Rémi Verschelde dac150108a Merge pull request #10846 from hpvb/fix-sign-compare
Fix signed and unsigned comparisons
2017-09-01 21:52:55 +02:00
Poommetee Ketson ed606ded52 Fix files header 2017-09-01 21:07:55 +07:00
Hein-Pieter van Braam f9467ec1ea Fix signed and unsigned comparisons
The first in my quest to make Godot 3.x compile with -Werror on GCC7
2017-09-01 08:13:12 +02:00
Rémi Verschelde bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Daniel J. Ramirez da8fecf25e Added support for SVG 2017-08-20 13:53:02 -05:00
Juan Linietsky 871ceeb0fe TGA support based on SaracenOne's work. 2017-06-07 19:46:36 -03:00