Removed two-player hacks for packet_spawn_objects

This commit is contained in:
MysterD 2020-10-14 00:15:56 -07:00
parent 28ad7f91ed
commit 85c05e7d56
3 changed files with 0 additions and 28 deletions

View File

@ -1930,7 +1930,6 @@ s32 execute_mario_action(UNUSED struct Object *o) {
// drop held object if someone else is holding it
if (gMarioState->playerIndex == 0 && gMarioState->heldObj != NULL) {
u8 inCutscene = ((gMarioState->action & ACT_GROUP_MASK) != ACT_GROUP_CUTSCENE);
u8 higherPriorityPlayerHolding = FALSE;
if (!inCutscene && gMarioState->heldObj->heldByPlayerIndex != 0) {
drop_and_set_mario_action(gMarioState, ACT_IDLE, 0);
}
@ -2134,7 +2133,6 @@ void init_mario(void) {
}
static void init_mario_single_from_save_file(struct MarioState* m, u16 index) {
// two-player hack
m->playerIndex = index;
m->flags = 0;
m->action = 0;

View File

@ -190,7 +190,6 @@ void check_player_object_collision(void) {
sp18 = (struct Object *) sp18->header.next;
}
// two-player hack ?
extern struct MarioState gMarioStates[];
for (int i = 1; i < MAX_PLAYERS; i++) {
detect_player_hitbox_overlap(&gMarioStates[0], &gMarioStates[i]);

View File

@ -6,14 +6,6 @@
#include "behavior_data.h"
#include "behavior_table.h"
static u8 localSpawnId = 1;
// two-player hack: the remoteSpawnId stuff is only valid for the one remote player
// will need to be extended if MAX_PLAYERS is ever increased
#define MAX_REMOTE_SPAWN_IDS 16
static u8 remoteSpawnIds[MAX_REMOTE_SPAWN_IDS] = { 0 };
static u8 onRemoteSpawnId = 0;
#define MAX_SPAWN_OBJECTS_PER_PACKET 8
struct SpawnObjectData {
@ -47,7 +39,6 @@ void network_send_spawn_objects(struct Object* objects[], u32 models[], u8 objec
struct Packet p;
packet_init(&p, PACKET_SPAWN_OBJECTS, true, true);
packet_write(&p, &localSpawnId, sizeof(u8));
packet_write(&p, &objectCount, sizeof(u8));
for (u8 i = 0; i < objectCount; i++) {
@ -66,29 +57,13 @@ void network_send_spawn_objects(struct Object* objects[], u32 models[], u8 objec
}
network_send(&p);
localSpawnId++;
if (localSpawnId == 0) { localSpawnId++; }
}
void network_receive_spawn_objects(struct Packet* p) {
u8 remoteSpawnId = 0;
u8 objectCount = 0;
packet_read(p, &remoteSpawnId, sizeof(u8));
packet_read(p, &objectCount, sizeof(u8));
// check if remote spawn id has already been seen
for (u16 i = 0; i < MAX_REMOTE_SPAWN_IDS; i++) {
if (remoteSpawnIds[i] == remoteSpawnId) {
// we already saw this event!
return;
}
}
// cache the seen id
remoteSpawnIds[onRemoteSpawnId] = remoteSpawnId;
onRemoteSpawnId = (onRemoteSpawnId + 1) % MAX_REMOTE_SPAWN_IDS;
// two-player hack
u8 reserveId = (gNetworkLevelLoaded && gNetworkType == NT_SERVER) ? 1 : 0;
bool receivedReservedSyncObject = false;