From 86c9bbf67227fe80e1b8751c95052ec5619b39a3 Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 10 Sep 2020 09:43:32 -0700 Subject: [PATCH] Fixed small crimes against C --- src/engine/surface_load.c | 7 +++++-- src/game/area.c | 1 + src/game/mario_misc.c | 2 +- src/pc/network/network.c | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/engine/surface_load.c b/src/engine/surface_load.c index 4da31873..e575c418 100644 --- a/src/engine/surface_load.c +++ b/src/engine/surface_load.c @@ -769,11 +769,9 @@ void load_object_collision_model(void) { f32 tangibleDist = gCurrentObject->oCollisionDistance; u8 anyPlayerInTangibleRange = FALSE; - u8 anyPlayerInDrawRange = FALSE; for (int i = 0; i < MAX_PLAYERS; i++) { f32 dist = dist_between_objects(gCurrentObject, gMarioStates[i].marioObj); if (dist < tangibleDist) { anyPlayerInTangibleRange = TRUE; } - if (dist < gCurrentObject->oDrawingDistance) { anyPlayerInDrawRange = TRUE; } } // If the object collision is supposed to be loaded more than the @@ -796,6 +794,11 @@ void load_object_collision_model(void) { } #ifndef NODRAWINGDISTANCE + u8 anyPlayerInDrawRange = FALSE; + for (int i = 0; i < MAX_PLAYERS; i++) { + f32 dist = dist_between_objects(gCurrentObject, gMarioStates[i].marioObj); + if (dist < gCurrentObject->oDrawingDistance) { anyPlayerInDrawRange = TRUE; } + } if (anyPlayerInDrawRange) { #endif gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE; diff --git a/src/game/area.c b/src/game/area.c index d5633c6e..312571d7 100644 --- a/src/game/area.c +++ b/src/game/area.c @@ -23,6 +23,7 @@ #include "level_table.h" #include "gfx_dimensions.h" #include "game/ingame_menu.h" +#include "pc/network/network.h" struct SpawnInfo gPlayerSpawnInfos[MAX_PLAYERS]; struct GraphNode *D_8033A160[0x100]; diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c index 425f1798..91f6b5f6 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_misc.c @@ -612,7 +612,7 @@ Gfx* geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode* b, Mat4* // This is why it won't update during a pause buffered hitstun or when the camera is very far // away. get_pos_from_transform_mtx(marioState->marioBodyState->heldObjLastPosition, *curTransform, - gCurGraphNodeCamera->matrixPtr); + (f32(*)[4])gCurGraphNodeCamera->matrixPtr); } return NULL; } diff --git a/src/pc/network/network.c b/src/pc/network/network.c index d702eafe..6aec4456 100644 --- a/src/pc/network/network.c +++ b/src/pc/network/network.c @@ -9,7 +9,7 @@ extern s16 sCurrPlayMode; enum NetworkType gNetworkType = NT_NONE; -static SOCKET gSocket = NULL; +static SOCKET gSocket = 0; struct sockaddr_in txAddr = { 0 }; #define LOADING_LEVEL_THRESHOLD 10