slot_machine through sub_81401B4

This commit is contained in:
PikalaxALT 2019-05-21 08:45:03 -04:00
parent 6d05c777d2
commit ce20a69eec
2 changed files with 54 additions and 110 deletions

View File

@ -5,108 +5,6 @@
.text
thumb_func_start sub_8140148
sub_8140148: @ 8140148
push {r4,lr}
movs r2, 0
ldr r4, _08140168 @ =sSlotMachineState
movs r3, 0x1
_08140150:
ldr r0, [r4]
lsls r1, r2, 2
adds r0, 0x14
adds r0, r1
str r3, [r0]
adds r2, 0x1
cmp r2, 0x2
ble _08140150
pop {r4}
pop {r0}
bx r0
.align 2, 0
_08140168: .4byte sSlotMachineState
thumb_func_end sub_8140148
thumb_func_start sub_814016C
sub_814016C: @ 814016C
push {lr}
lsls r0, 16
lsrs r0, 16
lsls r1, 16
lsrs r1, 16
adds r2, r1, 0
cmp r1, 0x1
beq _08140192
cmp r1, 0x1
bgt _08140186
cmp r1, 0
beq _0814018C
b _0814019C
_08140186:
cmp r2, 0x2
beq _08140198
b _0814019C
_0814018C:
bl sub_81401F0
b _0814019C
_08140192:
bl sub_81403BC
b _0814019C
_08140198:
bl sub_81404B8
_0814019C:
pop {r0}
bx r0
thumb_func_end sub_814016C
thumb_func_start sub_81401A0
sub_81401A0: @ 81401A0
lsls r0, 16
ldr r1, _081401B0 @ =sSlotMachineState
ldr r1, [r1]
lsrs r0, 14
adds r1, 0x14
adds r1, r0
ldr r0, [r1]
bx lr
.align 2, 0
_081401B0: .4byte sSlotMachineState
thumb_func_end sub_81401A0
thumb_func_start sub_81401B4
sub_81401B4: @ 81401B4
push {lr}
lsls r0, 16
ldr r1, _081401E8 @ =sSlotMachineState
ldr r2, [r1]
lsrs r0, 15
adds r1, r2, 0
adds r1, 0x20
adds r1, r0
ldrh r1, [r1]
adds r2, 0x26
adds r2, r0
movs r3, 0
ldrsh r0, [r2, r3]
cmp r0, 0
beq _081401E0
lsls r0, r1, 16
ldr r1, _081401EC @ =0xffff0000
adds r0, r1
lsrs r1, r0, 16
cmp r0, 0
bge _081401E0
movs r1, 0x14
_081401E0:
lsls r0, r1, 16
asrs r0, 16
pop {r1}
bx r1
.align 2, 0
_081401E8: .4byte sSlotMachineState
_081401EC: .4byte 0xffff0000
thumb_func_end sub_81401B4
thumb_func_start sub_81401F0
sub_81401F0: @ 81401F0
push {r4-r7,lr}

View File

@ -22,7 +22,7 @@ struct SlotMachineState
u16 bet;
u8 field_10;
u8 field_11;
TaskFunc field_14[3];
bool32 field_14[3];
s16 field_20[3];
s16 field_26[3];
s16 field_2C[3];
@ -46,7 +46,10 @@ void MainTask_ExitSlots(u8 taskId);
static void SetMainTask(TaskFunc taskFunc);
void sub_8140060(u8 taskId);
void sub_8140148(void);
void sub_814016C(u16, u16);
void sub_814016C(u16 whichPosition, u16 whichReel);
void sub_81401F0(u16 whichPosition);
void sub_81403BC(u16 whichPosition);
void sub_81404B8(u16 whichPosition);
bool32 sub_81401A0(u16);
void sub_81409B4(void);
void sub_8140A70(void);
@ -85,10 +88,10 @@ void sub_813F84C(struct SlotMachineState * ptr)
// for whatever reason, the loop does not use the ptr param
for (i = 0; i < 3; i++)
{
sSlotMachineState->field_14[i] = NULL;
sSlotMachineState->field_20[i] = 0;
sSlotMachineState->field_26[i] = 0;
sSlotMachineState->field_2C[i] = 21;
sSlotMachineState->field_14[i] = FALSE;
sSlotMachineState->field_20[i] = 0;
sSlotMachineState->field_26[i] = 0;
sSlotMachineState->field_2C[i] = 21;
}
}
@ -476,7 +479,7 @@ void sub_8140060(u8 taskId)
for (i = 0; i < 3; i++)
{
if (sSlotMachineState->field_14[i] != NULL || sSlotMachineState->field_26[i] != 0)
if (sSlotMachineState->field_14[i] || sSlotMachineState->field_26[i] != 0)
{
if (sSlotMachineState->field_26[i] != 0 || sSlotMachineState->field_20[i] != sSlotMachineState->field_2C[i])
{
@ -492,8 +495,51 @@ void sub_8140060(u8 taskId)
continue;
}
sSlotMachineState->field_2C[i] = 21;
sSlotMachineState->field_14[i] = NULL;
sSlotMachineState->field_14[i] = FALSE;
}
}
sub_8140D7C(sSlotMachineState->field_20, sSlotMachineState->field_26);
}
void sub_8140148(void)
{
s32 i;
for (i = 0; i < 3; i++)
{
sSlotMachineState->field_14[i] = TRUE;
}
}
void sub_814016C(u16 whichPosition, u16 whichReel)
{
switch (whichReel)
{
case 0:
sub_81401F0(whichPosition);
break;
case 1:
sub_81403BC(whichPosition);
break;
case 2:
sub_81404B8(whichPosition);
break;
}
}
bool32 sub_81401A0(u16 whichReel)
{
return sSlotMachineState->field_14[whichReel];
}
s16 sub_81401B4(u16 whichReel)
{
s16 position = sSlotMachineState->field_20[whichReel];
if (sSlotMachineState->field_26[whichReel] != 0)
{
position--;
if (position < 0)
position = 20;
}
return position;
}