diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2017-12-20 20:09:48 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2017-12-20 20:09:48 -0500 |
commit | 9c9c31b1e15014d7cfeb3856717d9b29715d46a5 (patch) | |
tree | 27faee7dca09bb53dd038b160d0acaa1b9d66344 /src | |
parent | f0957176bc96aef3bac673ac520ba55832957ba8 (diff) |
through sub_8101D8C
Diffstat (limited to 'src')
-rw-r--r-- | src/field/slot_machine.c | 162 |
1 files changed, 145 insertions, 17 deletions
diff --git a/src/field/slot_machine.c b/src/field/slot_machine.c index 60f8a58ff..cb1326151 100644 --- a/src/field/slot_machine.c +++ b/src/field/slot_machine.c @@ -1,26 +1,16 @@ #include "global.h" +#include "random.h" +#include "sound.h" #include "main.h" #include "slot_machine.h" #include "decompress.h" #include "palette.h" #include "task.h" #include "util.h" +#include "text.h" +#include "menu.h" #include "ewram.h" -struct SlotMachineEwramStruct { - /*0x00*/ u8 unk00; - /*0x01*/ u8 unk01; - /*0x02*/ u8 filler02[59]; - /*0x3D*/ u8 unk3D; - /*0x3E*/ u8 filler3E[26]; - /*0x58*/ u16 win0h; - /*0x5a*/ u16 win0v; - /*0x5c*/ u16 winIn; - /*0x5e*/ u16 winOut; - /*0x60*/ u8 filler_60[4]; - /*0x64*/ void *unk64; -}; - struct UnkStruct1 { /*0x00*/ u8 unk00; /*0x01*/ u8 unk01; @@ -47,17 +37,30 @@ void sub_8101954(void); void sub_81019B0(u8 arg0, void *ptr); void nullsub_67(u8 taskId); void sub_8101A28(void); -void sub_8101BA4(void); +void sub_8101A44(void); void sub_8101A8C(void); void sub_8101AE0(void); void sub_8101B04(void); +void sub_8101BA4(void); void sub_8101C84(void); void sub_8101CA0(void); void sub_8101CC0(void); void sub_8101CD4(void); void sub_8101CEC(void); -void sub_8101A44(void); - +void sub_8101D04(void); +void sub_8101D24(u8 taskId); + +void sub_8102DA8(void); +void sub_8103DC8(void); +void sub_8104048(void); +void sub_810423C(u8 a0); +void sub_8104C5C(void); +void sub_8104EA8(void); +void sub_8104F8C(void); +void sub_81050C4(void); +void sub_8106448(void); +void sub_81064B8(void); +void sub_81063C0(void); void PlaySlotMachine(u8 arg0, void *ptr) { @@ -170,6 +173,131 @@ void sub_8101AE0(void) DmaClear16(3, (u16 *)OAM, OAM_SIZE); } +void sub_8101B04(void) +{ + REG_BG0CNT = 0; + REG_BG1CNT = 0; + REG_BG2CNT = 0; + REG_BG3CNT = 0; + REG_BG0HOFS = 0; + REG_BG0VOFS = 0; + REG_BG1HOFS = 0; + REG_BG1VOFS = 0; + REG_BG2HOFS = 0; + REG_BG2VOFS = 0; + REG_BG3HOFS = 0; + REG_BG3VOFS = 0; + REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_SCREENBASE(31) | BGCNT_CHARBASE(2); + REG_BG1CNT = BGCNT_PRIORITY(1) | BGCNT_SCREENBASE(28); + REG_BG2CNT = BGCNT_PRIORITY(2) | BGCNT_SCREENBASE(29); + REG_BG3CNT = BGCNT_PRIORITY(2) | BGCNT_SCREENBASE(30); + REG_WININ = 0x3f; + REG_WINOUT = 0x3f; + REG_BLDCNT = BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_OBJ; + REG_BLDALPHA = 0x809; +} + +extern const s16 gUnknown_083ECCF8[3][2]; + +void sub_8101BA4(void) +{ + u8 i; + + sub_81019EC(); + eSlotMachine->unk00 = 0; + eSlotMachine->unk02 = 0; + eSlotMachine->unk03 = Random() & 1; + eSlotMachine->unk04 = 0; + eSlotMachine->unk08 = 0; + eSlotMachine->unk0A = 0; + eSlotMachine->unk0B = 0; + eSlotMachine->coins = gSaveBlock1.coins; + eSlotMachine->unk0E = 0; + eSlotMachine->unk10 = 0; + eSlotMachine->unk12 = 0; + eSlotMachine->unk18 = 0; + eSlotMachine->unk1A = 8; + eSlotMachine->win0h = 0xf0; + eSlotMachine->win0v = 0xa0; + eSlotMachine->winIn = 0x3f; + eSlotMachine->winOut = 0x3f; + eSlotMachine->backupMapMusic = GetCurrentMapMusic(); + for (i = 0; i < 3; i++) + { + eSlotMachine->unk22[i] = 0; + eSlotMachine->unk28[i] = gUnknown_083ECCF8[i][eSlotMachine->unk03] % 21; + eSlotMachine->unk1C[i] = 0x1f8 - eSlotMachine->unk28[i] * 24; + eSlotMachine->unk1C[i] %= 0x1f8; + } +} + +void sub_8101C84(void) +{ + SetUpWindowConfig(&gWindowConfig_81E7128); + InitMenuWindow(&gWindowConfig_81E7128); +} + +void sub_8101CA0(void) +{ + ResetPaletteFade(); + ResetSpriteData(); + gOamLimit = 128; + FreeAllSpritePalettes(); + ResetTasks(); +} + +void sub_8101CC0(void) +{ + sub_8106448(); + sub_81064B8(); + sub_81063C0(); +} + +void sub_8101CD4(void) +{ + sub_8104EA8(); + sub_8104F8C(); + sub_8103DC8(); + sub_81050C4(); +} + +void sub_8101CEC(void) +{ + sub_8104048(); + sub_8102DA8(); + sub_8104C5C(); + sub_8101D04(); +} + +extern bool8 (*const gUnknown_083ECAAC[])(struct Task *task); + +void sub_8101D04(void) +{ + sub_8101D24(CreateTask(sub_8101D24, 0)); +} + +void sub_8101D24(u8 taskId) +{ + while (gUnknown_083ECAAC[eSlotMachine->unk00](gTasks + taskId)); +} + +bool8 sub_8101D5C(struct Task *task) +{ + BeginNormalPaletteFade(-1, 0, 16, 0, 0); + sub_810423C(eSlotMachine->unk02); + eSlotMachine->unk00++; + return FALSE; +} + +bool8 sub_8101D8C(struct Task *task) +{ + if (!gPaletteFade.active) + { + eSlotMachine->unk00++; + } + return FALSE; +} + asm(".section .text_a"); static void LoadSlotMachineWheelOverlay(void); |