5773: Various fixes for server demo recording and playback r=def- a=Robyt3
Closes#5362.
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [X] Tested in combination with possibly related configuration options
- [X] Written a unit test (especially base/) or added coverage to integration test
- [X] 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>
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.
5772: Fix memset compilation r=Jupeyy a=def-
```
/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 |
```
<!-- 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: Dennis Felsing <dennis@felsin9.de>
/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 |
5766: Added map_create_pixelart tool r=def- a=sctt
works as shown in screenshot below:
![mcp_poc](https://user-images.githubusercontent.com/3328841/186209061-2dd0aa21-73a5-4ef8-8fcc-7b5645df9db7.png)
Usage: map_create_pixelart <image.png> <img_pixelsize> <input_map> <layergroup_id> <layer_id> <pos_x> <pos_y> <quad_pixelsize> <output_map> [optimize=0|1] [centralize=0|1]"
Notes:
- use destination layer tiles as a reference for positions and pixels for sizes.
- set img_pixelsize to 0 to consider the largest possible size.
- set quad_pixelsize to 0 to consider the same value of img_pixelsize.
- if image.png has not a perfect pixelart grid, result might be unexpected (manually fix img_pixelsize to get it better or just fix the image, or enable optimize).
Options:
- optimize tries to reduce the total number of quads, default: 1. (mappers say sometimes this is not useful, as they might want to add different envs/to per pixel)
- centralize places all pivots at the same position, default: 0. (mappers say this might be useful for spinning animations)
Co-authored-by: “sctt” <“sctt@sctt.it”>
Co-authored-by: sctt <scottistefano91@gmail.com>
5765: Add libpng dylib to mac dmg (fixes#5764) r=Jupeyy a=def-
<!-- 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: Dennis Felsing <dennis@felsin9.de>
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>
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>
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>
5758: Add `CWindowsComLifecycle` RAII wrapper for Windows COM library r=def- a=Robyt3
I can't reproduce the crash/hang from #5744, so I don't know if this fixes the issue.
## 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>