Better c89 compatibility

This commit is contained in:
UnknownShadow200 2025-05-12 19:54:00 +10:00
parent b3d94e6abe
commit 9c9aa11d77
6 changed files with 11 additions and 5 deletions

View File

@ -307,6 +307,8 @@ static void OnHacksChanged(void* obj) {
void Camera_CycleActive(void) { void Camera_CycleActive(void) {
struct LocalPlayer* p = &LocalPlayer_Instances[0]; struct LocalPlayer* p = &LocalPlayer_Instances[0];
int cycle = 0;
if (Game_ClassicMode) return; if (Game_ClassicMode) return;
Camera.Active = Camera.Active->next; Camera.Active = Camera.Active->next;
@ -315,7 +317,6 @@ void Camera_CycleActive(void) {
} }
cam_isForwardThird = Camera.Active == &cam_ForwardThird; cam_isForwardThird = Camera.Active == &cam_ForwardThird;
int cycle = 0;
if (Camera.Active == &cam_FirstPerson) cycle = 0; if (Camera.Active == &cam_FirstPerson) cycle = 0;
else if (Camera.Active == &cam_ThirdPerson) cycle = 1; else if (Camera.Active == &cam_ThirdPerson) cycle = 1;
else if (cam_isForwardThird) cycle = 2; else if (cam_isForwardThird) cycle = 2;

View File

@ -802,6 +802,7 @@ static void LocalPlayers_OnNewMap(void) {
static cc_bool LocalPlayer_IsSolidCollide(BlockID b) { return Blocks.Collide[b] == COLLIDE_SOLID; } static cc_bool LocalPlayer_IsSolidCollide(BlockID b) { return Blocks.Collide[b] == COLLIDE_SOLID; }
static void LocalPlayer_DoRespawn(struct LocalPlayer* p) { static void LocalPlayer_DoRespawn(struct LocalPlayer* p) {
struct EntityLocation* prev;
struct LocationUpdate update; struct LocationUpdate update;
struct AABB bb; struct AABB bb;
Vec3 spawn = p->Spawn; Vec3 spawn = p->Spawn;
@ -830,7 +831,7 @@ static void LocalPlayer_DoRespawn(struct LocalPlayer* p) {
} }
} }
struct EntityLocation* prev = &p->Base.prev; prev = &p->Base.prev;
CPE_SendNotifyPositionAction(3, prev->pos.x, prev->pos.y, prev->pos.z); CPE_SendNotifyPositionAction(3, prev->pos.x, prev->pos.y, prev->pos.z);
/* Adjust the position to be slightly above the ground, so that */ /* Adjust the position to be slightly above the ground, so that */

View File

@ -91,7 +91,7 @@ extern const struct UpdaterInfo {
/* Number of compiled builds available for this platform */ /* Number of compiled builds available for this platform */
int numBuilds; int numBuilds;
/* Metadata for the compiled builds available for this platform */ /* Metadata for the compiled builds available for this platform */
const struct UpdaterBuild builds[2]; // TODO name and path const struct UpdaterBuild builds[2]; /* TODO name and path */
} Updater_Info; } Updater_Info;
/* Whether updating is supported by the platform */ /* Whether updating is supported by the platform */
extern cc_bool Updater_Supported; extern cc_bool Updater_Supported;

View File

@ -1,6 +1,7 @@
#include "Core.h" #include "Core.h"
#if defined PLAT_PS2 #if defined PLAT_PS2
#define CC_XTEA_ENCRYPTION
#define LIBCGLUE_SYS_SOCKET_ALIASES 0 #define LIBCGLUE_SYS_SOCKET_ALIASES 0
#define LIBCGLUE_SYS_SOCKET_NO_ALIASES #define LIBCGLUE_SYS_SOCKET_NO_ALIASES
#define LIBCGLUE_ARPA_INET_NO_ALIASES #define LIBCGLUE_ARPA_INET_NO_ALIASES

View File

@ -1320,14 +1320,16 @@ cc_bool DynamicLib_DescribeError(cc_string* dst) {
*#########################################################################################################################*/ *#########################################################################################################################*/
static void Platform_InitPosix(void) { static void Platform_InitPosix(void) {
struct sigaction sa = { 0 }; struct sigaction sa = { 0 };
cc_uintptr addr;
sa.sa_handler = SIG_IGN; sa.sa_handler = SIG_IGN;
sigaction(SIGCHLD, &sa, NULL); sigaction(SIGCHLD, &sa, NULL);
/* So writing to closed socket doesn't raise SIGPIPE */ /* So writing to closed socket doesn't raise SIGPIPE */
sigaction(SIGPIPE, &sa, NULL); sigaction(SIGPIPE, &sa, NULL);
/* Log runtime address to ease investigating crashes */ /* Log runtime address of a known function to ease investigating crashes */
cc_uintptr addr = (cc_uintptr)Process_Exit; /* (on platforms with ASLR, function addresses change every time when run) */
addr = (cc_uintptr)Process_Exit;
Platform_Log1("Process_Exit addr: %x", &addr); Platform_Log1("Process_Exit addr: %x", &addr);
} }
void Platform_Free(void) { } void Platform_Free(void) { }

View File

@ -1,6 +1,7 @@
#include "Core.h" #include "Core.h"
#if defined PLAT_SATURN #if defined PLAT_SATURN
#define CC_XTEA_ENCRYPTION
#include "_PlatformBase.h" #include "_PlatformBase.h"
#include "Stream.h" #include "Stream.h"
#include "ExtMath.h" #include "ExtMath.h"