Fix crash in packet_spawn_star
This commit is contained in:
parent
521854e481
commit
c2f591b930
|
@ -37,9 +37,12 @@ void network_receive_spawn_star(struct Packet* p) {
|
||||||
packet_read(p, &behParams, sizeof(u32));
|
packet_read(p, &behParams, sizeof(u32));
|
||||||
packet_read(p, &networkPlayerIndex, sizeof(u8));
|
packet_read(p, &networkPlayerIndex, sizeof(u8));
|
||||||
|
|
||||||
|
struct Object* oldObject = gCurrentObject;
|
||||||
|
struct Object* o = NULL;
|
||||||
|
gCurrentObject = gMarioStates[0].marioObj;
|
||||||
|
if (gCurrentObject) {
|
||||||
u32 oldBehParams = gCurrentObject->oBehParams;
|
u32 oldBehParams = gCurrentObject->oBehParams;
|
||||||
gCurrentObject->oBehParams = behParams;
|
gCurrentObject->oBehParams = behParams;
|
||||||
struct Object* o = NULL;
|
|
||||||
switch (starType) {
|
switch (starType) {
|
||||||
case 0: o = spawn_default_star(x, y, z); break;
|
case 0: o = spawn_default_star(x, y, z); break;
|
||||||
case 1: o = spawn_red_coin_cutscene_star(x, y, z); break;
|
case 1: o = spawn_red_coin_cutscene_star(x, y, z); break;
|
||||||
|
@ -47,6 +50,8 @@ void network_receive_spawn_star(struct Packet* p) {
|
||||||
default: LOG_ERROR("UNKNOWN SPAWN STAR %d", starType);
|
default: LOG_ERROR("UNKNOWN SPAWN STAR %d", starType);
|
||||||
}
|
}
|
||||||
gCurrentObject->oBehParams = oldBehParams;
|
gCurrentObject->oBehParams = oldBehParams;
|
||||||
|
}
|
||||||
|
gCurrentObject = oldObject;
|
||||||
|
|
||||||
if (o != NULL) {
|
if (o != NULL) {
|
||||||
packet_read(p, &o->oPosX, sizeof(u32) * 3);
|
packet_read(p, &o->oPosX, sizeof(u32) * 3);
|
||||||
|
|
Loading…
Reference in New Issue