summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2019-05-22 17:48:56 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2019-05-22 17:48:56 -0400
commitd3aa5a0b97e08c7824eea6b38b2904e443267eab (patch)
treeb73c1fe4a4fe5d7ccef03b06721263c202f8d577
parent8d6eac996f0e69666b47aefb3dadb37eb1f40e74 (diff)
slot_machine sub_8140CA0
-rw-r--r--asm/slot_machine.s108
-rw-r--r--data/slot_machine.s17
-rw-r--r--src/slot_machine.c60
3 files changed, 57 insertions, 128 deletions
diff --git a/asm/slot_machine.s b/asm/slot_machine.s
index 9229072da..f79f658ae 100644
--- a/asm/slot_machine.s
+++ b/asm/slot_machine.s
@@ -5,114 +5,6 @@
.text
- thumb_func_start sub_8140CA0
-sub_8140CA0: @ 8140CA0
- push {r4-r7,lr}
- mov r7, r10
- mov r6, r9
- mov r5, r8
- push {r5-r7}
- sub sp, 0x4
- movs r7, 0
-_08140CAE:
- movs r6, 0
- lsls r0, r7, 2
- adds r1, r7, 0x1
- str r1, [sp]
- adds r0, r7
- mov r10, r0
- mov r2, r10
- lsls r2, 2
- mov r8, r2
- movs r3, 0xB0
- lsls r3, 14
- mov r9, r3
-_08140CC6:
- mov r0, r10
- lsls r1, r0, 19
- movs r2, 0xA0
- lsls r2, 15
- adds r1, r2
- mov r3, r9
- asrs r2, r3, 16
- ldr r0, _08140D64 @ =gUnknown_84657E4
- asrs r1, 16
- movs r3, 0x2
- bl CreateSprite
- lsls r0, 24
- lsrs r0, 24
- ldr r2, _08140D68 @ =gUnknown_8464926
- mov r3, r8
- adds r1, r3, r7
- adds r1, r6, r1
- adds r1, r2
- ldrb r4, [r1]
- lsls r5, r0, 4
- adds r5, r0
- lsls r5, 2
- ldr r0, _08140D6C @ =gSprites
- adds r5, r0
- adds r0, r5, 0
- adds r1, r4, 0
- bl StartSpriteAnim
- ldr r0, _08140D70 @ =gUnknown_8465608
- lsls r4, 1
- adds r4, r0
- ldrh r0, [r4]
- bl IndexOfSpritePaletteTag
- lsls r0, 4
- ldrb r2, [r5, 0x5]
- movs r1, 0xF
- ands r1, r2
- orrs r1, r0
- strb r1, [r5, 0x5]
- movs r0, 0
- strh r7, [r5, 0x2E]
- strh r6, [r5, 0x30]
- strh r6, [r5, 0x32]
- strh r0, [r5, 0x34]
- ldrb r0, [r5, 0x3]
- movs r2, 0x3F
- negs r2, r2
- adds r1, r2, 0
- ands r0, r1
- strb r0, [r5, 0x3]
- ldr r0, _08140D74 @ =gUnknown_203F3A4
- ldr r2, [r0]
- lsls r1, r6, 2
- add r1, r8
- adds r0, r2, 0
- adds r0, 0xC
- adds r0, r1
- str r5, [r0]
- ldr r0, _08140D78 @ =0x07000006
- str r0, [r2, 0x70]
- movs r3, 0xC0
- lsls r3, 13
- add r9, r3
- adds r6, 0x1
- cmp r6, 0x4
- ble _08140CC6
- ldr r7, [sp]
- cmp r7, 0x2
- ble _08140CAE
- add sp, 0x4
- pop {r3-r5}
- mov r8, r3
- mov r9, r4
- mov r10, r5
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_08140D64: .4byte gUnknown_84657E4
-_08140D68: .4byte gUnknown_8464926
-_08140D6C: .4byte gSprites
-_08140D70: .4byte gUnknown_8465608
-_08140D74: .4byte gUnknown_203F3A4
-_08140D78: .4byte 0x07000006
- thumb_func_end sub_8140CA0
-
thumb_func_start sub_8140D7C
sub_8140D7C: @ 8140D7C
push {r4-r7,lr}
diff --git a/data/slot_machine.s b/data/slot_machine.s
index 6a53f4426..25b5a6817 100644
--- a/data/slot_machine.s
+++ b/data/slot_machine.s
@@ -2,23 +2,6 @@
.include "constants/constants.inc"
.section .rodata
- .align 1
-gUnknown_8465608:: @ 8465608
- .2byte 0x0002, 0x0002, 0x0000, 0x0000, 0x0002, 0x0004, 0x0003
-
-gUnknown_8465616:: @ 8465616
- .2byte 0x0120, 0x011f, 0x011e, 0x011d, 0x011c, 0x011b, 0x011a, 0x0119, 0x0118, 0x0117, 0x0116, 0x0115, 0x0114, 0x0113, 0x0112, 0x0111
- .2byte 0x0110, 0x010f, 0x010e, 0x010d, 0x010c, 0x010b, 0x010a, 0x0109, 0x0108, 0x0107, 0x0106, 0x0105, 0x0104, 0x0103, 0x0102, 0x0101
- .2byte 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100
- .2byte 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100
- .2byte 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, 0x010f, 0x0110
- .2byte 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, 0x011f, 0x0120
-
-gUnknown_84656D6:: @ 84656D6
- .byte 0x10, 0x10, 0x10, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0c, 0x0b, 0x0a, 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06, 0x05, 0x04, 0x04, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x09, 0x09, 0x0a, 0x0b, 0x0c, 0x0c, 0x0d, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f
-
.align 2
gUnknown_8465738::
.4byte 0x80000100, 0x00000c00
diff --git a/src/slot_machine.c b/src/slot_machine.c
index 129d9b79a..7010bd969 100644
--- a/src/slot_machine.c
+++ b/src/slot_machine.c
@@ -37,8 +37,9 @@ struct SlotMachineState
struct SlotMachineGfxManager
{
u32 field_00[3];
- u32 field_0C[3][5];
- u8 filler_4C[0x2C];
+ struct Sprite * field_0C[3][5];
+ u8 filler_4C[0x28];
+ u32 field_70;
};
EWRAM_DATA struct SlotMachineState * sSlotMachineState = NULL;
@@ -168,6 +169,33 @@ const struct SpritePalette gUnknown_84655C8[] = {
{NULL}
};
+const u16 gUnknown_8465608[] = {
+ 2,
+ 2,
+ 0,
+ 0,
+ 2,
+ 4,
+ 3
+};
+
+const u16 gUnknown_8465616[] = {
+ 0x0120, 0x011f, 0x011e, 0x011d, 0x011c, 0x011b, 0x011a, 0x0119, 0x0118, 0x0117, 0x0116, 0x0115, 0x0114, 0x0113, 0x0112, 0x0111,
+ 0x0110, 0x010f, 0x010e, 0x010d, 0x010c, 0x010b, 0x010a, 0x0109, 0x0108, 0x0107, 0x0106, 0x0105, 0x0104, 0x0103, 0x0102, 0x0101,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, 0x010f, 0x0110,
+ 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, 0x011f, 0x0120
+};
+
+const u8 gUnknown_84656D6[] = {
+ 0x10, 0x10, 0x10, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0c, 0x0b, 0x0a, 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06, 0x05, 0x04, 0x04, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x09, 0x09, 0x0a, 0x0b, 0x0c, 0x0c, 0x0d, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f
+};
+
+extern const struct SpriteTemplate gUnknown_84657E4;
+
void PlaySlotMachine(u16 machineIdx, MainCallback savedCallback)
{
ResetTasks();
@@ -1408,7 +1436,33 @@ void sub_8140C6C(struct SlotMachineGfxManager * manager)
manager->field_00[i] = 0;
for (j = 0; j < 5; j++)
{
- manager->field_0C[i][j] = 0;
+ manager->field_0C[i][j] = NULL;
+ }
+ }
+}
+
+void sub_8140CA0(void)
+{
+ struct Sprite * sprite;
+ s32 i, j;
+ s32 spriteId;
+ s32 animId;
+ for (i = 0; i < 3; i++)
+ {
+ for (j = 0; j < 5; j++)
+ {
+ spriteId = CreateSprite(&gUnknown_84657E4, 80 + 40 * i, 44 + 24 * j, 2);
+ animId = gUnknown_8464926[i][j];
+ sprite = &gSprites[spriteId];
+ StartSpriteAnim(sprite, animId);
+ sprite->oam.paletteNum = IndexOfSpritePaletteTag(gUnknown_8465608[animId]);
+ sprite->data[0] = i;
+ sprite->data[1] = j;
+ sprite->data[2] = j;
+ sprite->data[3] = 0;
+ sprite->oam.matrixNum = 0;
+ gUnknown_203F3A4->field_0C[i][j] = sprite;
+ gUnknown_203F3A4->field_70 = 0x07000006;
}
}
}