Widescreen support (aka multi-room rendering)

Open-source port of PoP that runs natively on Windows, Linux, etc.
FluffyQuack
Vizier
Vizier
Posts: 80
Joined: June 6th, 2004, 7:05 pm

Re: Widescreen support (aka multi-room rendering)

Post by FluffyQuack »

David wrote: December 18th, 2021, 8:39 pm When compiling with Dev-C++, I get these warnings:

1. [Warning] passing argument 2 of '_wstat' from incompatible pointer type
on this line:

Code: Select all

	int result = _wstat(filename_UTF16, _Stat); //Fluffy: Replaced call to wstat() with _wstat(). Is that safe?
In Dev-C++, the stat functions are defined as:

Code: Select all

(in <sys/stat.h>)
int __cdecl stat(const char *_Filename,struct stat *_Stat);
int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat);
  int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat);

(in <_mingw_stat64.h>)
#define _wstat _wstat64i32
I see you use MSVC.
MSVC has no wstat(), but defines _wstat() with the same type of second argument as regular stat().
(source).

You could use something like this:

Code: Select all

#ifdef _MSC_VER
	int result = _wstat(filename_UTF16, _Stat);
#else
	int result = wstat(filename_UTF16, _Stat);
#endif
2. [Warning] implicit declaration of function 'pow' [-Wimplicit-function-declaration]
To fix this, add #include <math.h> .

3. Not a warning, but a related thing in seg000.c:

Code: Select all

#include <math.h>

//Fluffy: Added this since we got compile error due to missing M_PI
#ifndef M_PI
#define M_PI  3.14159265358979323846264f  // from CRC
#endif
I looked it up, in MSVC you need to #define _USE_MATH_DEFINES to get M_PI from math.h.
(source)



In SDLPoP.ini these values let me play in full screen:

Code: Select all

pop_window_width = 1536
pop_window_height = 864
Windows multiplies them by 1.25, because scaling is set to 125%.
The result is a 1920×1080 window, which matches the desktop resolution I use.
Thanks for the info! I'll try to get these changes implemented. That said, I don't think I'll do more work with improving or adding features to my fork. I was toying with the idea of getting proper multiplayer implemented (as in, the state of the gameplay world being in sync between all players), but I realized more and more that's pretty tricky to properly implement with how the original POP code is structured (for instance, guards being defined in two different ways makes it a bit of headache without doing major refactoring). So, I started working on my own POP engine where the code is better suited for a netcode: viewtopic.php?f=69&t=4865

You're the main guy behind SDL-PoP, right? Would you be interested in PRs that replace some magic numbers in the code with defines, simplifies some code, or more comments that explain what parts of the code do? The SDL-PoP code (alongside the original Apple II source code) has been an extremely good reference when writing my engine, but parts of the code are pretty hard to parse.

For instance, you've got a line like this:

Code: Select all

coll_tile_left_xpos += 14;
It may not be immediately obvious the 14 number is the horizontal tile size using the original Apple II coordinate system. So, it would be more understandable if it was like this instead:

Code: Select all

coll_tile_left_xpos += TILE_SIZEX;
The define would be in types.h and I'd replace every instance of the tile size being referenced as a magic number using the define instead.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Widescreen support (aka multi-room rendering)

Post by David »

FluffyQuack wrote: September 21st, 2022, 1:22 pm You're the main guy behind SDL-PoP, right?
Yes, I am.
FluffyQuack wrote: September 21st, 2022, 1:22 pm Would you be interested in PRs that replace some magic numbers in the code with defines, simplifies some code, or more comments that explain what parts of the code do?
Yes, thank you!
Post Reply