diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2019-04-08 13:22:57 -0400 |
---|---|---|
committer | huderlem <huderlem@gmail.com> | 2019-04-08 17:33:35 -0500 |
commit | 9ee4f4d65ab18c98660311c85d2553d28b90fb05 (patch) | |
tree | fceffe9aa84d57d311c77893887b157dcf56404d /src | |
parent | af4cb5879810a7bbe8960879594fa8ee606394fa (diff) |
sub_80C42C0
Diffstat (limited to 'src')
-rw-r--r-- | src/battle/contest_link_80C2020.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/battle/contest_link_80C2020.c b/src/battle/contest_link_80C2020.c index cbef4f9b7..72f78ead5 100644 --- a/src/battle/contest_link_80C2020.c +++ b/src/battle/contest_link_80C2020.c @@ -2478,3 +2478,75 @@ void sub_80C40D4(u8 arg0, u8 arg1) "_080C42BC: .4byte gSharedMem + 0x18000"); } #endif //NONMATCHING + +void sub_80C42C0(u8 taskId /*r12*/) +{ + bool32 r6 = FALSE; + bool32 r9 = FALSE; + u8 r5 = gTasks[taskId].data[0]; + s16 r7 = gTasks[taskId].data[1]; + s16 r1 = gTasks[taskId].data[2]; + s32 i; + + if (r1 != 0) + { + if (eContestLink80C2020Struct2018000.unk_0c[r5] <= 0) + r6 = TRUE; + } + else + { + if (eContestLink80C2020Struct2018000.unk_0c[r5] >= 88) + r6 = TRUE; + } + if (eContestLink80C2020Struct2018000.unk_0c[r5] == r7) + r9 = TRUE; + + if (!r9) + { + if (r6) + { + eContestLink80C2020Struct2018000.unk_0c[r5] = r7; + } + else if (r1 != 0) + { + eContestLink80C2020Struct2018000.unk_0c[r5]--; + } + else + { + eContestLink80C2020Struct2018000.unk_0c[r5]++; + } + } + if (!r6) + { + if (!r9) + { + for (i = 0; i < 11; i++) + { + u8 r0; + u16 tile; + if (eContestLink80C2020Struct2018000.unk_0c[r5] >= 8 * (i + 1)) + { + r0 = 8; + } + else if (eContestLink80C2020Struct2018000.unk_0c[r5] >= 8 * i) + { + r0 = eContestLink80C2020Struct2018000.unk_0c[r5] % 8; + } + else + { + r0 = 0; + } + if (r0 < 4) + tile = 0x504C + r0; + else + tile = 0x5057 + r0; + *(vu16 *)(0x0600E18E + 2 * (96 * r5 + i)) = tile; + } + } + } + if (r9) + { + eContestLink80C2020Struct2018000.unk_14--; + DestroyTask(taskId); + } +} |