Make players invincible to pvp attacks on area load

This commit is contained in:
MysterD 2022-03-24 18:16:26 -07:00
parent 8bc0abb6a2
commit bac952c370
4 changed files with 11 additions and 0 deletions

View File

@ -251,6 +251,7 @@ void clear_area_graph_nodes(void) {
void load_area(s32 index) {
if (gCurrentArea == NULL && gAreaData[index].unk04 != NULL) {
gCurrentArea = &gAreaData[index];
gCurrentArea->localAreaTimer = 0;
gCurrAreaIndex = gCurrentArea->index;
if (gCurrentArea->terrainData != NULL) {

View File

@ -81,6 +81,7 @@ struct Area
/*0x38*/ u16 musicParam2;
/*????*/ u8 cachedBehaviors[256];
/*????*/ Vec3f cachedPositions[256];
/*????*/ u32 localAreaTimer;
};
// All the transition data to be used in screen_transition.c

View File

@ -1346,6 +1346,11 @@ u32 interact_player(struct MarioState* m, UNUSED u32 interactType, struct Object
return FALSE;
}
// don't attack each other on level load
if (gCurrentArea == NULL || gCurrentArea->localAreaTimer < 60) {
return FALSE;
}
u32 interaction = determine_interaction(m, o);
// attacked

View File

@ -1309,6 +1309,10 @@ s32 update_level(void) {
return changeLevel;
}
if (gCurrentArea != NULL) {
gCurrentArea->localAreaTimer++;
}
switch (sCurrPlayMode) {
case PLAY_MODE_NORMAL:
changeLevel = play_mode_normal();