Commit graph

11838 commits

Author SHA1 Message Date
Robert Müller 3dc577f24e Fix demo seeking not working anymore when menu is not active 2022-08-28 12:23:03 +02:00
Robert Müller 7cbca53d48 Deactivate "Follow" spectator mode in global server demos
As there is no spectator to follow, the follow mode does not work in global server demos.

Player server demos are unaffected and support the follow mode.
2022-08-27 17:48:04 +02:00
Robert Müller 939b3e5538 Fix free-view button state when following a free-view spectator
When following a spectator that is using free-view mode, the free-view button was active at the same time as the follow button.
2022-08-27 17:45:56 +02:00
bors[bot] 8ac260a3a9
Merge #5777
5777: Add period/comma hotkeys to skip one tick forward/backward, various other improvements to demo skipping r=Jupeyy a=Robyt3

Mostly from upstream https://github.com/teeworlds/teeworlds/pull/2904, with some more fixes and refactorings.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-08-27 12:40:09 +00:00
bors[bot] b42627f807
Merge #5748
5748: Remove the need for sprite icon images; update Icons file r=Jupeyy a=VoxelDoesCode

It felt like that it was very unoptimized to have two images for the demo buttons. Initially, I wanted to merge it into one image, but it was a much better choice to have it so that we use the Icons font file for the sprites instead. Turns out, considering how the typeface is rendered, it looks much smoother and crisper. The contrast between the squares and the symbols is much clearer alongside!

Before the change:
![unknown](https://user-images.githubusercontent.com/95713843/185066728-45b6c5d7-00c5-4e03-9f89-4dfc89df6ec1.png)
After the change:
![unknown](https://user-images.githubusercontent.com/95713843/185066759-bd5f8169-7e9e-488d-9af7-0ab34bff9d54.png)

Note that there is a few compromises that had to be made with the limited symbol choices. As of publishing this there is not a symbol for a crossed out keyboard, but I hope the eye works just fine for now.


## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: VoxelDoesCode <bluheadcat@gmail.com>
2022-08-27 12:24:36 +00:00
Robert Müller a24ac108ce Always suppress events and update envelopes when skipping 2022-08-27 13:23:06 +02:00
Robert Müller bf16875a6f Add period/comma hotkeys to skip one tick forward/backward 2022-08-27 12:49:32 +02:00
Robert Müller 76cefa1c85 Faster and more precise demo skipping
- Approximate index of wanted keyframe to decrease linear search time.
- Only apply the magic `-5` to the Keyframe calculation, to make seeking with the mouse more accurate.
- After the method returns, the specified tick will be the _next_ tick being played instead of being the current tick.
2022-08-27 12:49:32 +02:00
Robert Müller 334bdad922 Fix demo intratick times not being updated when paused 2022-08-27 12:49:32 +02:00
Robert Müller 3ec4075ddb Move variable declarations closer to usages 2022-08-27 12:49:32 +02:00
Robert Müller d6628fe028 Rename variable LastSpeedChange to s_LastSpeedChange 2022-08-27 12:49:32 +02:00
Robert Müller 091f3b3e34 Rename variable PrevAmount to s_PrevAmount 2022-08-27 12:49:32 +02:00
Robert Müller 6f101f54af Rename method CDemoPlayer::time to Time 2022-08-27 12:49:32 +02:00
Robert Müller 64f326d626 Remove unused CDemoPlayer::NextFrame method 2022-08-27 11:39:03 +02:00
VoxelDoesCode 20e70b3172 Demo Tooltips, in courtesy of Chairn 2022-08-26 02:07:58 -04:00
VoxelDoesCode 0392f6655d Added an icon for Parent Directories 2022-08-25 18:44:27 -04:00
Robert Müller d369a5b693 Write messages to all active demo recorders 2022-08-25 17:57:04 +02:00
Robert Müller 63d0c8e170 Improve error message when map for demo cannot be found
Previously the playback did not start and no error messages was shown, when the map file cannot be found and no map data is embedded in the demo file.

Minor refactoring: Replace instances of `return pError` with semantically identical `return nullptr` to improve readability.
2022-08-25 17:57:04 +02:00
Robert Müller 3f1b702b90 Fix demos recorded without mapdata not being loadable
As the demo player skips the map data when loading the demo, the size of the map specified in the demo must be zero when no map data is embedded.
2022-08-25 17:57:04 +02:00
Robert Müller 5c2f162da2 Remove unused DemoRecorder_IsRecording method 2022-08-25 17:57:03 +02:00
Robert Müller 8d3351f046 Also record tunings for player demos 2022-08-25 17:57:03 +02:00
Robert Müller c7ddb0ac47 Pad player demo filename with zeros instead of spaces 2022-08-25 17:57:03 +02:00
Dennis Felsing 2ccca3a50a Fix memset compilation
/home/deen/isos/ddnet/ddnet-source/src/tools/map_create_pixelart.cpp: In function ‘int InsertPixelArtQuads(CQuad*, int&, const CImageInfo&, const int*, const int*, const bool*)’:
/home/deen/isos/ddnet/ddnet-source/src/tools/map_create_pixelart.cpp:110:9: error: ‘memset’ was not declared in this scope
  110 |         memset(aVisitedPixels, 0, sizeof(bool) * Img.m_Height * Img.m_Width);
      |         ^~~~~~
/home/deen/isos/ddnet/ddnet-source/src/tools/map_create_pixelart.cpp:8:1: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    7 | #include <game/mapitems.h>
  +++ |+#include <cstring>
    8 |
2022-08-25 14:07:49 +02:00
VoxelDoesCode 216d4421ce Clang Format 2022-08-24 16:17:04 -04:00
“sctt” ff2c513ddc removed debug 2022-08-23 19:42:29 +02:00
“sctt” f066cca33a CICD fixes 2 for map_create_pixelart 2022-08-23 19:40:13 +02:00
“sctt” cb9680eaff Merge branch 'master' of https://github.com/sctt/ddnet 2022-08-23 19:17:19 +02:00
“sctt” 4013c0f68a CICD fixes for map_create_pixelart 2022-08-23 19:14:42 +02:00
sctt 9101a4f5ce
Merge branch 'ddnet:master' into master 2022-08-23 18:13:50 +02:00
“sctt” 0f14d76a69 Added map_create_pixelart tool 2022-08-23 18:12:15 +02:00
Robert Müller 638559b648 Refactor scrollable controls settings using CScrollRegion
Replace hacky usage of `UiDoListboxStart` with `CScrollRegion`.
2022-08-23 10:08:46 +02:00
Robert Müller 7c496dd5b4 Make ingame server info MOTD scrollable using CScrollRegion 2022-08-23 10:08:46 +02:00
Robert Müller 713b6584f0 Add str_countchr to count occurrences of a char in a string 2022-08-23 10:08:46 +02:00
Robert Müller 359beffff3 Refactor editor sound list using CScrollRegion 2022-08-23 10:08:46 +02:00
Robert Müller 5dc6c90a50 Refactor editor image list using CScrollRegion, split method 2022-08-23 10:08:45 +02:00
Robert Müller 9f01c6fe66 Refactor editor layer list using CScrollRegion 2022-08-23 10:08:45 +02:00
Robert Müller ad8f49fe79 Remove unnecessary indentation/scope 2022-08-23 10:08:42 +02:00
Robert Müller 4cdd36aed3 Remove redundant m_GuiActive checks
This condition is already checked before calling the methods.
2022-08-23 10:01:29 +02:00
Robert Müller 7b80ad1982 Refactor editor layer image selection popup using CScrollRegion
The width of the popup and list are also slightly increased to better support images with longer names.
2022-08-23 10:01:28 +02:00
Robert Müller f451a33361 Port CScrollRegion from upstream with some minor refactorings
Co-authored-by: LordSk <lordskelethom@gmail.com>
2022-08-23 10:01:28 +02:00
Robert Müller 9cbca642ea Rename CUIElement::Get to Rect
This makes it clear that the method is a getter for the rects.
2022-08-23 10:01:27 +02:00
Robert Müller 991b045a11 Remove unused CUIElement::m_ElementTime 2022-08-23 10:01:26 +02:00
bors[bot] 49bed71932
Merge #5696
5696: Add option for parallax-aware zoom r=def- a=Fireball-Teeworlds

## How this works

Currently we have parallax X and Y parameters that control how far away a layer feels. Currently it's only taken into account for camera moving sideways.

This pull request makes zoom behave as if the camera was moving closer or further away, taking into account the distance to the layer.

In order to provide flexibility, this behaviour is using a separate parallax value, similar to how we have separate values for X and Y. Para Zoom will default to the minimum of parallax X, Y, clamped to be between 0 and 100. This seems to look well on most maps.

This pull request also introduces two new features to the Editor:
* Controls for configuring per-group Para Zoom value. If Custom Zoom is set to No, Para Zoom will automatically keep following to the default value described above, so that people new to the feature don't have to figure out how it works.
* Zoom button that previews the zoom behavior (next to Proof at the top).

## Editor Screenshots

### Para Zoom controls

![screenshot_2022-08-22_21-38-04](https://user-images.githubusercontent.com/68162181/186014490-f7b91245-460f-405f-8d5c-3f91db2a1b9a.png)

![screenshot_2022-08-22_21-37-58](https://user-images.githubusercontent.com/68162181/186014522-03b6e814-4dd9-4d07-9af9-7db5fb434a56.png)

### Zoom Button

![screenshot_2022-08-22_21-40-46](https://user-images.githubusercontent.com/68162181/186014856-2d1d499d-9011-439c-b217-536957e0c1e3.png)

![screenshot_2022-08-22_21-40-50](https://user-images.githubusercontent.com/68162181/186014874-6d2939d3-00ff-4327-a790-414b5151ba31.png)

## In-Game Screenshots

Video: https://youtu.be/W7eXQN0gRFI

This is an older version of the pull request that had an option to disable the new behaviour. The current version can only be disabled in map editor for a particular map.

### Springlobe 3

With new feature:
![screenshot_2022-08-02_04-28-19](https://user-images.githubusercontent.com/68162181/182286371-b67cee1c-73d8-4a24-a9c3-1b28340a3b42.png)

Without:
![screenshot_2022-08-02_04-28-25](https://user-images.githubusercontent.com/68162181/182286367-24555381-1700-4ff1-80c7-39e5dce63820.png)

### Beyond Dreams

With new feature:
![screenshot_2022-08-02_04-28-59](https://user-images.githubusercontent.com/68162181/182286322-114ecb90-0860-462c-9012-bb2f3ff848fb.png)

Without:
![screenshot_2022-08-02_04-28-55](https://user-images.githubusercontent.com/68162181/182286654-f34da72b-7991-4f42-89ad-679279fcb83e.png)

## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [X] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [X] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [X] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Fireball <fireball.teeworlds@gmail.com>
2022-08-22 21:15:41 +00:00
Dennis Felsing 83d26ff48c Version 16.3.1 2022-08-22 15:42:34 +02:00
bors[bot] 7765171559
Merge #5733
5733: Added map_find_env tool r=def- a=sctt


a simple tool which given an envelope id returns a list of all quads associated with that envelope, screenshot attached below.
![Screenshot from 2022-08-13 18-48-41](https://user-images.githubusercontent.com/3328841/184503762-521ff3c7-2c0f-47df-a0e6-e4b30f2826ec.png)

p.s.
deen told me its not a problem to commit these kind of map tools to ddnet

Co-authored-by: sctt <scottistefano91@gmail.com>
2022-08-22 09:07:40 +00:00
bors[bot] d2523d9053
Merge #5761
5761: Replace `POPUP_PURE` with generic `PopupMessage` r=def- a=Robyt3

Minor refactoring, as the popup just shows generic text with an Ok-button.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-08-21 15:02:55 +00:00
def 13cc5d08d9 Version 16.3 2022-08-21 17:00:23 +02:00
Robert Müller d3c9311156 Replace POPUP_PURE with generic PopupMessage 2022-08-21 13:25:06 +02:00
bors[bot] f355a3467f
Merge #5760
5760: Fix variable shadow warnings with MinGW r=def- a=Robyt3

```
ddnet/src/base/system.cpp: In function 'int byteval(const char*, unsigned char*)':
ddnet/src/base/system.cpp:3044:32: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3044 | static int byteval(const char *byte, unsigned char *dst)
      |                    ~~~~~~~~~~~~^~~~
In file included from msys64/mingw64/include/objbase.h:8,
                 from ddnet/src/base/system.cpp:68:
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
ddnet/src/base/system.cpp: In function 'unsigned char str_byte_next(const char**)':
ddnet/src/base/system.cpp:3557:23: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3557 |         unsigned char byte = **ptr;
      |                       ^~~~
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
ddnet/src/base/system.cpp: In function 'int str_utf8_decode(const char**)':
ddnet/src/base/system.cpp:3577:31: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3577 |                 unsigned char byte = str_byte_next(ptr);
      |                               ^~~~
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
```

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-08-21 09:08:57 +00:00
Robert Müller 64042d29df Fix variable shadow warnings with MinGW
```
ddnet/src/base/system.cpp: In function 'int byteval(const char*, unsigned char*)':
ddnet/src/base/system.cpp:3044:32: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3044 | static int byteval(const char *byte, unsigned char *dst)
      |                    ~~~~~~~~~~~~^~~~
In file included from msys64/mingw64/include/objbase.h:8,
                 from ddnet/src/base/system.cpp:68:
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
ddnet/src/base/system.cpp: In function 'unsigned char str_byte_next(const char**)':
ddnet/src/base/system.cpp:3557:23: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3557 |         unsigned char byte = **ptr;
      |                       ^~~~
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
ddnet/src/base/system.cpp: In function 'int str_utf8_decode(const char**)':
ddnet/src/base/system.cpp:3577:31: warning: declaration of 'byte' shadows a global declaration [-Wshadow]
 3577 |                 unsigned char byte = str_byte_next(ptr);
      |                               ^~~~
msys64/mingw64/include/rpcndr.h:63:25: note: shadowed declaration is here
   63 |   typedef unsigned char byte;
      |                         ^~~~
```
2022-08-21 10:44:08 +02:00