Closed abalfoort closed 1 year ago
The games can be divided into three groups:
3zb2 falls into the later group. I hacked this "port" in two hours. I did just enough changes that it builds with a modern toolchain and works good enough for multiplayer testing.
In file included from /home/arjen/dev/Q2RTX/workingdir/_yquake2/3zb2/src/g_ctf.c:1:
/home/arjen/dev/Q2RTX/workingdir/_yquake2/3zb2/src/g_ctf.c: In function ‘SelectCTFSpawnPoint’:
/home/arjen/dev/Q2RTX/workingdir/_yquake2/3zb2/src/header/local.h:537:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
537 | #define FOFS(x) (int)&(((edict_t *)0)->x)
| ^
/home/arjen/dev/Q2RTX/workingdir/_yquake2/3zb2/src/g_ctf.c:410:31: note: in expansion of macro ‘FOFS’
410 | while ((spot = G_Find (spot, FOFS(classname), cname)) != NULL)
| ^~~~
This means that the code isn't 64 bit clean. On x86 / i386 pointers and integers were 32 bit long. It was a common pattern to cast pointers into integers, the code exactly does this. It cannot work on 64 bit platforms like Linux and Unix were pointers are 64 bit and integers stayed at 32 bits. In this case you can properly use size_t
instead: https://github.com/yquake2/xatrix/blob/master/src/header/local.h#L493
3zb2 is under the SDK license which is incompatible to the GPL. You can copy code from the other addons but not from the GPL licensed YQ2 itself and ctf.
note that the warnings should be harmless - an unused variable doesn't matter at all, and the FOFS macro is used to calculate the offset of a member of the edict_t struct within that struct, which will easily fit into a 32bit int (as sizeof(edict_t)
is a lot smaller than 2GB). Would probably be cleaner to use offsetof()
than hacking a custom offsetof-like thing, but it should work anyway..
I suspected it would be a 32-bit/64-bit issue as it was mentioned on stackoverflow but your explanations I can work with. Thanks.
Building 3zb2 on Debian 12 there are lots of warnings. Most of them are easy to remedy:
But this one I don't know how to resolve:
I've been searching on stackoverflow.com but couldn't find something that could help in this case.
Anybody has an idea?