Page 2 of 2

Re: Screenshotting and mapmaking

Posted: February 17th, 2018, 7:06 am
by YURA
Help, please!
How to get to the 24th room or in zero - I cannot understand from the schematic map?

Re: Screenshotting and mapmaking

Posted: February 17th, 2018, 11:27 am
by Norbert
YURA wrote: February 17th, 2018, 7:06 am Help, please!
How to get to the 24th room or in zero - I cannot understand from the schematic map?
Solution here.

Re: Screenshotting and mapmaking

Posted: April 7th, 2018, 11:12 am
by YURA
Screenshotting and mapmaking!!!
How to arrive with invisible rooms??? Their program - does not see in general. Example of MOD-186_14 level. Where the broken rooms.

Re: Screenshotting and mapmaking

Posted: April 8th, 2018, 8:34 am
by David
YURA wrote: April 7th, 2018, 11:12 am Screenshotting and mapmaking!!!
How to arrive with invisible rooms??? Their program - does not see in general. Example of MOD-186_14 level. Where the broken rooms.
Yes, if there are broken links in the level then some of the rooms may not be on the map because SDLPoP doesn't know where to put them.

Falcury, Norbert, do you have ideas on how to solve this?

Re: Screenshotting and mapmaking

Posted: April 8th, 2018, 11:35 am
by Norbert
David wrote: April 8th, 2018, 8:34 amFalcury, Norbert, do you have ideas on how to solve this?
Well, while drawing the rooms, you should notice you cannot draw certain rooms because they would be attached at locations where you already drew a room. (Where a room already exists.) You could keep a list of all such rooms. Then, at the very end, check which of these rooms you never drew. Put these in a row somewhere below the map, all separate from each other, with room link arrows inside them.

Re: Screenshotting and mapmaking

Posted: April 30th, 2018, 10:02 pm
by Norbert
Maybe the screenshot filename could get some kind of auto-increasing number, as DOSBox has (..._nnn.png/avi).
Currently, to, for instance, make multiple screenshots when frame-skipping with ESC (after disabling the menu), the user has to move/rename screenshot.png before each F12 press.
(Also, the menu doesn't mention screenshotting, and there's no visual feedback - especially when SDLPoP is not launched from console, e.g. from apoplexy.)

Re: Screenshotting and mapmaking

Posted: May 1st, 2018, 1:00 pm
by David
Norbert wrote: April 30th, 2018, 10:02 pm Maybe the screenshot filename could get some kind of auto-increasing number, as DOSBox has (..._nnn.png/avi).
Currently, to, for instance, make multiple screenshots when frame-skipping with ESC (after disabling the menu), the user has to move/rename screenshot.png before each F12 press.
(Also, the menu doesn't mention screenshotting, and there's no visual feedback - especially when SDLPoP is not launched from console, e.g. from apoplexy.)
Done both numbering and feedback: https://github.com/NagyD/SDLPoP/commit/ ... a94a5a1f8f

I also added a check whether IMG_SavePNG() could indeed save the image.
As a side note, the official documentation does not mention IMG_SavePNG() at all: https://libsdl.org/projects/SDL_image/d ... image.html (version 1.2.8!?)
Therefore I had to guess what are its possible return values.

Re: Screenshotting and mapmaking

Posted: May 1st, 2018, 7:15 pm
by Norbert
David wrote: May 1st, 2018, 1:00 pmDone both numbering and feedback: https://github.com/NagyD/SDLPoP/commit/ ... a94a5a1f8f
Nice, thanks!
Maybe update ChangeLog.txt?
David wrote: May 1st, 2018, 1:00 pmTherefore I had to guess what are its possible return values.
You could check the source. ;)
In its IMG_png.c it does "if (dst) { return IMG_SavePNG_RW (...); } else { return -1; }", so maybe use "if (result != -1)" for SDLPoP.
Although you might enter a maze with IMG_SavePNG_RW(), if it calls stuff that calls stuff, etc. :|

Re: Screenshotting and mapmaking

Posted: May 5th, 2018, 6:31 pm
by David
Norbert wrote: May 1st, 2018, 7:15 pm Maybe update ChangeLog.txt?
Done: https://github.com/NagyD/SDLPoP/commit/ ... a27efeb5b5
Norbert wrote: May 1st, 2018, 7:15 pm You could check the source. ;)
In its IMG_png.c it does "if (dst) { return IMG_SavePNG_RW (...); } else { return -1; }", so maybe use "if (result != -1)" for SDLPoP.
Although you might enter a maze with IMG_SavePNG_RW(), if it calls stuff that calls stuff, etc. :|
Fortunately it's not so bad in this case:
IMG_SavePNG_RW() calls either IMG_SavePNG_RW_libpng() or IMG_SavePNG_RW_miniz() (through a pointer).
IMG_SavePNG_RW_libpng() has two kinds of return statements: "return -1;" and "return 0;".
IMG_SavePNG_RW_miniz() has a single return at the end, "return result;", where "result" can be -1 or 0.

Re: Screenshotting and mapmaking

Posted: September 29th, 2019, 2:00 pm
by Norbert
This code suggests a small improvement of screenshot.c.

And I also have a related question.
Why is the compiler complaining about drawn_room which is size 2 (+ maybe \0 when used with snprintf) and not about other_room which is size 4?

Code: Select all

/* This program demonstrates that
 * char room_num[4];
 * on line 367 of screenshot.c
 * should be
 * char room_num[6];
 * to get rid of the format truncation compilation warning.
 *
 * The output of this program is:
 * room_num: 4 (4294967295), other_room: 4 (4294967295), drawn_room: 2 (65535)
 * -1
 * [4]: 655
 * [5]: 6553
 * [6]: 65535
 *
 * Public domain code by Norbert.
 */

#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>

typedef Uint16 word;

/*** https://stackoverflow.com/a/12762101 ***/
#define IS_TYPE_SIGNED(a) ((a-1) < 0)
#define MAX_VALUE_UNSIGNED(a) (((unsigned long long)1 << \
	(sizeof(a) * CHAR_BIT)) - 1)
#define MAX_VALUE_SIGNED(a) (MAX_VALUE_UNSIGNED(a) >> 1)
#define MAX_VALUE(a) (IS_TYPE_SIGNED(a) ? \
	MAX_VALUE_SIGNED(a) : MAX_VALUE_UNSIGNED(a))

int main ()
{
	char room_num[4];
	char room_num_test1[5];
	char room_num_test2[6];
	int other_room;
	word drawn_room;

	other_room = 4294967295;
	drawn_room = 65535;

	printf ("room_num: %lu (%llu),"
		" other_room: %lu (%llu),"
		" drawn_room: %lu (%llu)\n",
		sizeof (room_num), MAX_VALUE (room_num),
		sizeof (other_room), MAX_VALUE (other_room),
		sizeof (drawn_room), MAX_VALUE (drawn_room));

	snprintf (room_num, sizeof (room_num), "%d", other_room);
	printf ("%s\n", room_num);

	snprintf (room_num, sizeof (room_num), "%d", drawn_room);
	printf ("[4]: %s\n", room_num);
	snprintf (room_num_test1, sizeof (room_num_test1), "%d", drawn_room);
	printf ("[5]: %s\n", room_num_test1);
	snprintf (room_num_test2, sizeof (room_num_test2), "%d", drawn_room);
	printf ("[6]: %s\n", room_num_test2);

	return 0;
}