From baf95a8e7ab5bf295f10c4e30d043c9629f2d2a3 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 1 Mar 2019 00:08:37 +0100 Subject: [PATCH 01/14] get rid of ugly cast --- src/battle_anim_effects_2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 0c6f2ef11..ee6676e64 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -1417,7 +1417,7 @@ static void AnimTask_WithdrawStep(u8 taskId) } } -// Animates a "zap of energy" used in KINESIS. +// Animates a "zap of energy" used in KINESIS. // arg 0: x pixel offset // arg 1: y pixel offset // arg 2: vertical flip @@ -1592,7 +1592,7 @@ void sub_8103AA4(struct Sprite *sprite) sprite->data[3] = sub_8151534(sub_8151534(b, a), sub_8151624(0x1C0)); sprite->data[4] = sub_8151534(sub_8151534(c, a), sub_8151624(0x1C0)); sprite->callback = sub_8103A00; - } + } } static void sub_8103BE4(u8 taskId) @@ -3470,7 +3470,7 @@ void AnimOrbitFast(struct Sprite *sprite) static void AnimOrbitFastStep(struct Sprite *sprite) { - if ((u16)(sprite->data[1] - 64) < 128) + if (sprite->data[1] >= 64 && sprite->data[1] <= 191) sprite->subpriority = sprite->data[7] + 1; else sprite->subpriority = sprite->data[7] - 1; From 5c8cc5225ff7c11533f8421039e6e9e75adcee90 Mon Sep 17 00:00:00 2001 From: hondew Date: Thu, 7 Feb 2019 11:24:09 -0500 Subject: [PATCH 02/14] document slot machine --- data/slot_machine.s | 1144 ++++++++++++------------ include/slot_machine.h | 3 + include/task.h | 3 + include/tv.h | 9 +- src/roulette.c | 4 +- src/slot_machine.c | 1864 +++++++++++++++++++++------------------- src/task.c | 3 - src/tv.c | 16 +- 8 files changed, 1576 insertions(+), 1470 deletions(-) diff --git a/data/slot_machine.s b/data/slot_machine.s index 4a354d71c..adc65feec 100644 --- a/data/slot_machine.s +++ b/data/slot_machine.s @@ -1,841 +1,841 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" +.include "asm/macros.inc" +.include "constants/constants.inc" - .section .rodata +.section .rodata .align 2 gUnknown_085A7A3C:: @ 85A7A3C - .2byte 0 - .2byte 0 - .2byte 0 - .2byte 0 - +.2byte 0 +.2byte 0 +.2byte 0 +.2byte 0 + gUnknown_085A7A44:: @ 85A7A44 - .2byte 0x8000 - .2byte 0 - .2byte 0 - .2byte 0 +.2byte 0x8000 +.2byte 0 +.2byte 0 +.2byte 0 gUnknown_085A7A4C:: @ 85A7A4C - .2byte 0 - .2byte 0x4000 - .2byte 0 - .2byte 0 - +.2byte 0 +.2byte 0x4000 +.2byte 0 +.2byte 0 + gUnknown_085A7A54:: @ 85A7A54 - .2byte 0x8000 - .2byte 0x8000 - .2byte 0 - .2byte 0 - +.2byte 0x8000 +.2byte 0x8000 +.2byte 0 +.2byte 0 + gUnknown_085A7A5C:: @ 85A7A5C - .2byte 0 - .2byte 0x8000 - .2byte 0 - .2byte 0 +.2byte 0 +.2byte 0x8000 +.2byte 0 +.2byte 0 gUnknown_085A7A64:: @ 85A7A64 - .2byte 0x8000 - .2byte 0xC000 - .2byte 0 - .2byte 0 - +.2byte 0x8000 +.2byte 0xC000 +.2byte 0 +.2byte 0 + gUnknown_085A7A6C:: @ 85A7A6C - .2byte 0x4000 - .2byte 0xC000 - .2byte 0 - .2byte 0 +.2byte 0x4000 +.2byte 0xC000 +.2byte 0 +.2byte 0 gUnknown_085A7A74:: @ 85A7A74 - .2byte 0 - .2byte 0xC000 - .2byte 0 - .2byte 0 +.2byte 0 +.2byte 0xC000 +.2byte 0 +.2byte 0 gUnknown_085A7A7C:: @ 85A7A7C - .4byte gSlotMachineReelTimeNumber0 - .2byte 0x80 - .2byte 0 - .4byte gSlotMachineReelTimeNumber1 - .2byte 0x80 - .2byte 0 - .4byte gSlotMachineReelTimeNumber2 - .2byte 0x80 - .2byte 0 - .4byte gSlotMachineReelTimeNumber3 - .2byte 0x80 - .2byte 0 - .4byte gSlotMachineReelTimeNumber4 - .2byte 0x80 - .2byte 0 - .4byte gSlotMachineReelTimeNumber5 - .2byte 0x80 - .2byte 0 +.4byte gSlotMachineReelTimeNumber0 +.2byte 0x80 +.2byte 0 +.4byte gSlotMachineReelTimeNumber1 +.2byte 0x80 +.2byte 0 +.4byte gSlotMachineReelTimeNumber2 +.2byte 0x80 +.2byte 0 +.4byte gSlotMachineReelTimeNumber3 +.2byte 0x80 +.2byte 0 +.4byte gSlotMachineReelTimeNumber4 +.2byte 0x80 +.2byte 0 +.4byte gSlotMachineReelTimeNumber5 +.2byte 0x80 +.2byte 0 gUnknown_085A7AAC:: @ 85A7AAC - .4byte gSlotMachineReelTimeShadow - .2byte 0x200 - .2byte 0 +.4byte gSlotMachineReelTimeShadow +.2byte 0x200 +.2byte 0 gUnknown_085A7AB4:: @ 85A7AB4 - .4byte gUnknown_08DD1A18 - .2byte 0x40 - .2byte 0 +.4byte gUnknown_08DD1A18 +.2byte 0x40 +.2byte 0 gUnknown_085A7ABC:: @ 85A7ABC - .4byte gSlotMachineReelTimeLargeBolt0 - .2byte 0x100 - .2byte 0 - .4byte gSlotMachineReelTimeLargeBolt1 - .2byte 0x100 - .2byte 0 +.4byte gSlotMachineReelTimeLargeBolt0 +.2byte 0x100 +.2byte 0 +.4byte gSlotMachineReelTimeLargeBolt1 +.2byte 0x100 +.2byte 0 gUnknown_085A7ACC:: @ 85A7ACC - .4byte gSlotMachineReelTimePikaAura - .2byte 0x400 - .2byte 0 - +.4byte gSlotMachineReelTimePikaAura +.2byte 0x400 +.2byte 0 + gUnknown_085A7AD4:: @ 85A7CD4 - .4byte gSlotMachineReelTimeExplosion0 - .2byte 0x200 - .2byte 0 - .4byte gSlotMachineReelTimeExplosion1 - .2byte 0x200 - .2byte 0 +.4byte gSlotMachineReelTimeExplosion0 +.2byte 0x200 +.2byte 0 +.4byte gSlotMachineReelTimeExplosion1 +.2byte 0x200 +.2byte 0 gUnknown_085A7AE4:: @ 85A7AE4 - .4byte gSlotMachineReelTimeDuck - .4byte 32 +.4byte gSlotMachineReelTimeDuck +.4byte 32 gUnknown_085A7AEC:: @ 85A7AEC - .4byte gSlotMachineReelTimeSmoke - .4byte 0x80 - +.4byte gSlotMachineReelTimeSmoke +.4byte 0x80 + gUnknown_085A7AF4:: @ 85A7AF4 - .4byte gSlotMachineReelTimeBolt - .4byte 32 +.4byte gSlotMachineReelTimeBolt +.4byte 32 gUnknown_085A7AFC:: @ 85A7AFC - obj_image_anim_frame 0, 1 - obj_image_anim_end +obj_image_anim_frame 0, 1 +obj_image_anim_end gUnknown_085A7B04:: @ 85A7B04 - obj_image_anim_frame 0, 1 - obj_image_anim_jump 0 - +obj_image_anim_frame 0, 1 +obj_image_anim_jump 0 + gUnknown_085A7B0C:: @ 85A7B0C - obj_image_anim_frame 0, 16 - obj_image_anim_end +obj_image_anim_frame 0, 16 +obj_image_anim_end gUnknown_085A7B14:: @ 85A7B14 - obj_image_anim_frame 1, 16 - obj_image_anim_frame 0, 16 - obj_image_anim_jump 0 +obj_image_anim_frame 1, 16 +obj_image_anim_frame 0, 16 +obj_image_anim_jump 0 gUnknown_085A7B20:: @ 85A7B20 - obj_image_anim_frame 1, 8 - obj_image_anim_frame 0, 8 - obj_image_anim_jump 0 +obj_image_anim_frame 1, 8 +obj_image_anim_frame 0, 8 +obj_image_anim_jump 0 gUnknown_085A7B2C:: @ 85A7B2C - obj_image_anim_frame 1, 4 - obj_image_anim_frame 0, 4 - obj_image_anim_jump 0 +obj_image_anim_frame 1, 4 +obj_image_anim_frame 0, 4 +obj_image_anim_jump 0 gUnknown_085A7B38:: @ 85A7B38 - obj_image_anim_frame 2, 32 - obj_image_anim_frame 3, 32 - obj_image_anim_jump 0 +obj_image_anim_frame 2, 32 +obj_image_anim_frame 3, 32 +obj_image_anim_jump 0 gUnknown_085A7B44:: @ 85A7B44 - obj_image_anim_frame 4, 1 - obj_image_anim_end +obj_image_anim_frame 4, 1 +obj_image_anim_end gUnknown_085A7B4C:: @ 85A7B4C - obj_image_anim_frame 0, 1 - obj_image_anim_end +obj_image_anim_frame 0, 1 +obj_image_anim_end gUnknown_085A7B54:: @ 85A7B54 - obj_image_anim_frame 1, 1 - obj_image_anim_end +obj_image_anim_frame 1, 1 +obj_image_anim_end gUnknown_085A7B5C:: @ 85A7B5C - obj_image_anim_frame 2, 1 - obj_image_anim_end +obj_image_anim_frame 2, 1 +obj_image_anim_end gUnknown_085A7B64:: @ 85A7B64 - obj_image_anim_frame 3, 1 - obj_image_anim_end +obj_image_anim_frame 3, 1 +obj_image_anim_end gUnknown_085A7B6C:: @ 85A7B6C - obj_image_anim_frame 4, 1 - obj_image_anim_end +obj_image_anim_frame 4, 1 +obj_image_anim_end gUnknown_085A7B74:: @ 85A7B74 - obj_image_anim_frame 5, 1 - obj_image_anim_end +obj_image_anim_frame 5, 1 +obj_image_anim_end gUnknown_085A7B7C:: @ 85A7B7C - obj_image_anim_frame 0, 4 - obj_image_anim_frame 1, 4 - obj_image_anim_jump 0 +obj_image_anim_frame 0, 4 +obj_image_anim_frame 1, 4 +obj_image_anim_jump 0 gUnknown_085A7B88:: @ 85A7B88 - obj_image_anim_frame 0, 16 - obj_image_anim_frame 1, 16 - obj_image_anim_jump 0 +obj_image_anim_frame 0, 16 +obj_image_anim_frame 1, 16 +obj_image_anim_jump 0 gUnknown_085A7B94:: @ 85A7B94 - obj_image_anim_frame 0, 30 - obj_image_anim_frame 1, 30 - obj_image_anim_jump 0 +obj_image_anim_frame 0, 30 +obj_image_anim_frame 1, 30 +obj_image_anim_jump 0 gUnknown_085A7BA0:: @ 85A7BA0 - obj_image_anim_frame 1, 1 - obj_image_anim_end +obj_image_anim_frame 1, 1 +obj_image_anim_end gUnknown_085A7BA8:: @ 85A7BA8 - obj_image_anim_frame 0, 30 - obj_image_anim_frame 1, 30 - obj_image_anim_jump 0 +obj_image_anim_frame 0, 30 +obj_image_anim_frame 1, 30 +obj_image_anim_jump 0 gUnknown_085A7BB4:: @ 85A7BB4 - obj_image_anim_frame 0, 16 - obj_image_anim_frame 1, 16 - obj_image_anim_frame 0, 16 - obj_image_anim_frame 1, 80 - obj_image_anim_jump 0 +obj_image_anim_frame 0, 16 +obj_image_anim_frame 1, 16 +obj_image_anim_frame 0, 16 +obj_image_anim_frame 1, 80 +obj_image_anim_jump 0 gUnknown_085A7BC8:: @ 85A7BC8 - obj_image_anim_frame 0, 1 - obj_image_anim_end +obj_image_anim_frame 0, 1 +obj_image_anim_end gUnknown_085A7BD0:: @ 85A7BD0 - obj_image_anim_frame 0, 1 - obj_image_anim_end +obj_image_anim_frame 0, 1 +obj_image_anim_end gUnknown_085A7BD8:: @ 85A7BD8 - obj_image_anim_frame 1, 1 - obj_image_anim_end +obj_image_anim_frame 1, 1 +obj_image_anim_end gUnknown_085A7BE0:: @ 85A7BE0 - obj_image_anim_frame 2, 1 - obj_image_anim_end +obj_image_anim_frame 2, 1 +obj_image_anim_end gUnknown_085A7BE8:: @ 85A7BE8 - obj_image_anim_frame 3, 1 - obj_image_anim_end +obj_image_anim_frame 3, 1 +obj_image_anim_end gUnknown_085A7BF0:: @ 85A7BF0 - obj_image_anim_frame 4, 1 - obj_image_anim_end +obj_image_anim_frame 4, 1 +obj_image_anim_end gUnknown_085A7BF8:: @ 85A7BF8 - .4byte gUnknown_085A7AFC +.4byte gUnknown_085A7AFC gUnknown_085A7BFC:: @ 85A7BFC - .4byte gUnknown_085A7B04 +.4byte gUnknown_085A7B04 gUnknown_085A7C00:: @ 85A7C00 - .4byte gUnknown_085A7B0C - .4byte gUnknown_085A7B14 - .4byte gUnknown_085A7B20 - .4byte gUnknown_085A7B2C - .4byte gUnknown_085A7B38 - .4byte gUnknown_085A7B44 +.4byte gUnknown_085A7B0C +.4byte gUnknown_085A7B14 +.4byte gUnknown_085A7B20 +.4byte gUnknown_085A7B2C +.4byte gUnknown_085A7B38 +.4byte gUnknown_085A7B44 gUnknown_085A7C18:: @ 85A7C18 - .4byte gUnknown_085A7B4C - .4byte gUnknown_085A7B54 - .4byte gUnknown_085A7B5C - .4byte gUnknown_085A7B64 - .4byte gUnknown_085A7B6C - .4byte gUnknown_085A7B74 +.4byte gUnknown_085A7B4C +.4byte gUnknown_085A7B54 +.4byte gUnknown_085A7B5C +.4byte gUnknown_085A7B64 +.4byte gUnknown_085A7B6C +.4byte gUnknown_085A7B74 gUnknown_085A7C30:: @ 85A7C30 - .4byte gUnknown_085A7B7C +.4byte gUnknown_085A7B7C gUnknown_085A7C34:: @ 85A7C34 - .4byte gUnknown_085A7B88 - +.4byte gUnknown_085A7B88 + gUnknown_085A7C38:: @ 85A7C38 - .4byte gUnknown_085A7B94 - .4byte gUnknown_085A7BA0 - +.4byte gUnknown_085A7B94 +.4byte gUnknown_085A7BA0 + gUnknown_085A7C40:: @ 85A7C40 - .4byte gUnknown_085A7BA8 - +.4byte gUnknown_085A7BA8 + gUnknown_085A7C44:: @ 85A7C44 - .4byte gUnknown_085A7BB4 - .4byte gUnknown_085A7BC8 - +.4byte gUnknown_085A7BB4 +.4byte gUnknown_085A7BC8 + gUnknown_085A7C4C:: @ 85A7C4C - .4byte gUnknown_085A7BD0 - .4byte gUnknown_085A7BD8 - .4byte gUnknown_085A7BE0 - .4byte gUnknown_085A7BE8 - .4byte gUnknown_085A7BF0 +.4byte gUnknown_085A7BD0 +.4byte gUnknown_085A7BD8 +.4byte gUnknown_085A7BE0 +.4byte gUnknown_085A7BE8 +.4byte gUnknown_085A7BF0 gUnknown_085A7C60:: @ 85A7C60 - obj_rot_scal_anim_frame 16, 16, 0, 0 - obj_rot_scal_anim_loop 0 - obj_rot_scal_anim_frame 1, 1, 0, 1 - obj_rot_scal_anim_loop 0xFF - obj_rot_scal_anim_end - +obj_rot_scal_anim_frame 16, 16, 0, 0 +obj_rot_scal_anim_loop 0 +obj_rot_scal_anim_frame 1, 1, 0, 1 +obj_rot_scal_anim_loop 0xFF +obj_rot_scal_anim_end + gUnknown_085A7C88:: @ 85A7C88 - .4byte gUnknown_085A7C60 +.4byte gUnknown_085A7C60 gUnknown_085A7C8C:: @ 85A7C8C - obj_rot_scal_anim_frame 0, 0, 8, 32 - obj_rot_scal_anim_frame 0, 0, 6, 32 - obj_rot_scal_anim_frame 0, 0, 4, 16 - obj_rot_scal_anim_frame 0, 0, 12, 2 - obj_rot_scal_anim_frame 0, 0, -12, 4 - obj_rot_scal_anim_frame 0, 0, 12, 2 - obj_rot_scal_anim_frame 0, 0, 12, 2 - obj_rot_scal_anim_frame 0, 0, -12, 4 - obj_rot_scal_anim_frame 0, 0, 12, 2 - obj_rot_scal_anim_end +obj_rot_scal_anim_frame 0, 0, 8, 32 +obj_rot_scal_anim_frame 0, 0, 6, 32 +obj_rot_scal_anim_frame 0, 0, 4, 16 +obj_rot_scal_anim_frame 0, 0, 12, 2 +obj_rot_scal_anim_frame 0, 0, -12, 4 +obj_rot_scal_anim_frame 0, 0, 12, 2 +obj_rot_scal_anim_frame 0, 0, 12, 2 +obj_rot_scal_anim_frame 0, 0, -12, 4 +obj_rot_scal_anim_frame 0, 0, 12, 2 +obj_rot_scal_anim_end gUnknown_085A7CDC:: @ 85A7CDC - .4byte gUnknown_085A7C8C - +.4byte gUnknown_085A7C8C + gSpriteTemplate_83ED414:: @ 85A7CE0 - spr_template 0, 0, gUnknown_085A7A5C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, sub_8104F18 +spr_template 0, 0, gUnknown_085A7A5C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, sub_8104F18 gSpriteTemplate_83ED42C:: @ 85A7CF8 - spr_template 7, 4, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, sub_810506C +spr_template 7, 4, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, sub_810506C gSpriteTemplate_83ED444:: @ 85A7D10 - spr_template 17, 0, gUnknown_085A7A74, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy +spr_template 17, 0, gUnknown_085A7A74, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED45C:: @ 85A7D28 - spr_template 0xFFFF, 1, gUnknown_085A7A74, gUnknown_085A7C00, NULL, gDummySpriteAffineAnimTable, sub_8105170 +spr_template 0xFFFF, 1, gUnknown_085A7A74, gUnknown_085A7C00, NULL, gDummySpriteAffineAnimTable, sub_8105170 gSpriteTemplate_83ED474:: @ 85A7D40 - spr_template 0xFFFF, 2, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy +spr_template 0xFFFF, 2, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED48C:: @ 85A7D58 - spr_template 0xFFFF, 3, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy +spr_template 0xFFFF, 3, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED4A4:: @ 85A7D70 - spr_template 0xFFFF, 3, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy +spr_template 0xFFFF, 3, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED4BC:: @ 85A7D88 - spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7C18, gUnknown_085A7A7C, gDummySpriteAffineAnimTable, sub_810535C +spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7C18, gUnknown_085A7A7C, gDummySpriteAffineAnimTable, sub_810535C gSpriteTemplate_83ED4D4:: @ 85A7DA0 - spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AAC, gDummySpriteAffineAnimTable, SpriteCallbackDummy +spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AAC, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED4EC:: @ 85A7DB8 - spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AB4, gDummySpriteAffineAnimTable, SpriteCallbackDummy +spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AB4, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED504:: @ 85A7DD0 - spr_template 0xFFFF, 4, gUnknown_085A7A54, gUnknown_085A7C30, gUnknown_085A7ABC, gDummySpriteAffineAnimTable, sub_810562C +spr_template 0xFFFF, 4, gUnknown_085A7A54, gUnknown_085A7C30, gUnknown_085A7ABC, gDummySpriteAffineAnimTable, sub_810562C gSpriteTemplate_83ED51C:: @ 85A7DE8 - spr_template 0xFFFF, 7, gUnknown_085A7A64, gUnknown_085A7BF8, gUnknown_085A7ACC, gDummySpriteAffineAnimTable, sub_8105784 +spr_template 0xFFFF, 7, gUnknown_085A7A64, gUnknown_085A7BF8, gUnknown_085A7ACC, gDummySpriteAffineAnimTable, sub_8105784 gSpriteTemplate_83ED534:: @ 85A7E00 - spr_template 0xFFFF, 5, gUnknown_085A7A5C, gUnknown_085A7C34, gUnknown_085A7AD4, gDummySpriteAffineAnimTable, sub_8105894 +spr_template 0xFFFF, 5, gUnknown_085A7A5C, gUnknown_085A7C34, gUnknown_085A7AD4, gDummySpriteAffineAnimTable, sub_8105894 gSpriteTemplate_83ED54C:: @ 85A7E18 - spr_template 0xFFFF, 4, gUnknown_085A7A3C, gUnknown_085A7BFC, gUnknown_085A7AE4, gDummySpriteAffineAnimTable, sub_810594C +spr_template 0xFFFF, 4, gUnknown_085A7A3C, gUnknown_085A7BFC, gUnknown_085A7AE4, gDummySpriteAffineAnimTable, sub_810594C gSpriteTemplate_83ED564:: @ 85A7E30 - spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AEC, gUnknown_085A7C88, sub_8105A38 - +spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AEC, gUnknown_085A7C88, sub_8105A38 + gUnknown_085A7E48:: @ 85A7E48 - spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7E60:: @ 85A7E60 - spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7E78:: @ 85A7E78 - spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7E90:: @ 85A7E90 - spr_template 18, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 18, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7EA8:: @ 85A7EA8 - spr_template 0xFFFF, 6, gUnknown_085A7A6C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 0xFFFF, 6, gUnknown_085A7A6C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7EC0:: @ 85A7EC0 - spr_template 0xFFFF, 6, gUnknown_085A7A6C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy +spr_template 0xFFFF, 6, gUnknown_085A7A6C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7ED8:: @ 85A7ED8 - spr_template 19, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 19, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7EF0:: @ 85A7EF0 - spr_template 20, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 20, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7F08:: @ 85A7F08 - spr_template 21, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 21, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7F20:: @ 85A7F20 - spr_template 0xFFFF, 6, gUnknown_085A7A5C, gUnknown_085A7C38, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 0xFFFF, 6, gUnknown_085A7A5C, gUnknown_085A7C38, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7F38:: @ 85A7F38 - spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7F50:: @ 85A7F50 - spr_template 0xFFFF, 6, gUnknown_085A7A4C, gUnknown_085A7C4C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 0xFFFF, 6, gUnknown_085A7A4C, gUnknown_085A7C4C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7F68:: @ 85A7F68 - spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7C44, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7C44, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gUnknown_085A7F80:: @ 85A7F80 - spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7C40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - +spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7C40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + gSpriteTemplate_83ED6CC:: @ 85A7F98 - spr_template 0xFFFF, 4, gUnknown_085A7A3C, gUnknown_085A7BF8, gUnknown_085A7AF4, gUnknown_085A7CDC, sub_8105B70 - +spr_template 0xFFFF, 4, gUnknown_085A7A3C, gUnknown_085A7BF8, gUnknown_085A7AF4, gUnknown_085A7CDC, sub_8105B70 + gUnknown_085A7FB0:: @ 85A7FB0 - subsprite -64, -64, 3, 0, 64x64 - subsprite 0, -64, 3, 0, 64x64 - subsprite -64, 0, 3, 0, 64x64 - subsprite 0, 0, 3, 0, 64x64 +subsprite -64, -64, 3, 0, 64x64 +subsprite 0, -64, 3, 0, 64x64 +subsprite -64, 0, 3, 0, 64x64 +subsprite 0, 0, 3, 0, 64x64 gSubspriteTables_83ED704:: @ 85A7FC0 - .4byte 4, gUnknown_085A7FB0 - +.4byte 4, gUnknown_085A7FB0 + gUnknown_085A7FC8:: @ 85A7FC8 - subsprite -32, -12, 1, 0, 32x8 - subsprite 0, -12, 1, 4, 32x8 - subsprite -32, -4, 1, 8, 32x8 - subsprite 0, -4, 1, 12, 32x8 - subsprite -32, 4, 1, 16, 32x8 - subsprite 0, 4, 1, 20, 32x8 +subsprite -32, -12, 1, 0, 32x8 +subsprite 0, -12, 1, 4, 32x8 +subsprite -32, -4, 1, 8, 32x8 +subsprite 0, -4, 1, 12, 32x8 +subsprite -32, 4, 1, 16, 32x8 +subsprite 0, 4, 1, 20, 32x8 gSubspriteTables_83ED73C:: @ 85A7FE0 - .4byte 6, gUnknown_085A7FC8 +.4byte 6, gUnknown_085A7FC8 gUnknown_085A7FE8:: @ 85A7FE8 - subsprite -32, -20, 1, 0, 64x32 - subsprite -32, 12, 1, 32, 32x8 - subsprite 0, 12, 1, 36, 32x8 - +subsprite -32, -20, 1, 0, 64x32 +subsprite -32, 12, 1, 32, 32x8 +subsprite 0, 12, 1, 36, 32x8 + gSubspriteTables_83ED75C:: @ 85A7FF4 - .4byte 3, gUnknown_085A7FE8 +.4byte 3, gUnknown_085A7FE8 gUnknown_085A7FFC:: @ 85A7FFC - subsprite -32, -24, 1, 0, 64x32 - subsprite -32, 8, 1, 32, 32x8 - subsprite 0, 8, 1, 36, 32x8 - subsprite -32, 16, 1, 40, 32x8 - subsprite 0, 16, 1, 44, 32x8 - +subsprite -32, -24, 1, 0, 64x32 +subsprite -32, 8, 1, 32, 32x8 +subsprite 0, 8, 1, 36, 32x8 +subsprite -32, 16, 1, 40, 32x8 +subsprite 0, 16, 1, 44, 32x8 + gSubspriteTables_83ED78C:: @ 85A8010 - .4byte 5, gUnknown_085A7FFC - +.4byte 5, gUnknown_085A7FFC + gUnknown_085A8018:: @ 85A8018 - subsprite -32, -8, 1, 0, 32x8 - subsprite 0, -8, 1, 4, 32x8 - subsprite -32, 0, 1, 8, 32x8 - subsprite 0, 0, 1, 12, 32x8 +subsprite -32, -8, 1, 0, 32x8 +subsprite 0, -8, 1, 4, 32x8 +subsprite -32, 0, 1, 8, 32x8 +subsprite 0, 0, 1, 12, 32x8 gSubspriteTables_83ED7B4:: @ 85A8028 - .4byte 4, gUnknown_085A8018 - +.4byte 4, gUnknown_085A8018 + gUnknown_085A8030:: @ 85A8030 - subsprite -8, -12, 1, 0, 16x8 - subsprite -8, -4, 1, 0, 16x8 - subsprite -8, 4, 1, 0, 16x8 +subsprite -8, -12, 1, 0, 16x8 +subsprite -8, -4, 1, 0, 16x8 +subsprite -8, 4, 1, 0, 16x8 gSubspriteTables_83ED7D4:: @ 85A803C - .4byte 3, gUnknown_085A8030 +.4byte 3, gUnknown_085A8030 gUnknown_085A8044:: @ 85A8044 - subsprite -32, -24, 3, 0, 64x32 - subsprite -32, 8, 3, 32, 32x8 - subsprite 0, 8, 3, 36, 32x8 - subsprite -32, 16, 3, 40, 32x8 - subsprite 0, 16, 3, 44, 32x8 +subsprite -32, -24, 3, 0, 64x32 +subsprite -32, 8, 3, 32, 32x8 +subsprite 0, 8, 3, 36, 32x8 +subsprite -32, 16, 3, 40, 32x8 +subsprite 0, 16, 3, 44, 32x8 gUnknown_085A8058:: @ 85A8058 - .4byte 5, gUnknown_085A8044 +.4byte 5, gUnknown_085A8044 gUnknown_085A8060:: @ 85A8060 - subsprite -32, -8, 3, 0, 32x8 - subsprite 0, -8, 3, 4, 32x8 - subsprite -32, 0, 3, 8, 32x8 - subsprite 0, 0, 3, 12, 32x8 +subsprite -32, -8, 3, 0, 32x8 +subsprite 0, -8, 3, 4, 32x8 +subsprite -32, 0, 3, 8, 32x8 +subsprite 0, 0, 3, 12, 32x8 gUnknown_085A8070:: @ 85A8070 - .4byte 4, gUnknown_085A8060 +.4byte 4, gUnknown_085A8060 gUnknown_085A8078:: @ 85A8078 - subsprite -32, -8, 3, 0, 32x8 - subsprite 0, -8, 3, 4, 32x8 - subsprite -32, 0, 3, 8, 32x8 - subsprite 0, 0, 3, 12, 32x8 +subsprite -32, -8, 3, 0, 32x8 +subsprite 0, -8, 3, 4, 32x8 +subsprite -32, 0, 3, 8, 32x8 +subsprite 0, 0, 3, 12, 32x8 gUnknown_085A8088:: @ 85A8088 - .4byte 4, gUnknown_085A8078 - +.4byte 4, gUnknown_085A8078 + gUnknown_085A8090:: @ 85A8090 - subsprite -32, -8, 3, 0, 32x8 - subsprite 0, -8, 3, 4, 32x8 - subsprite -32, 0, 3, 8, 32x8 - subsprite 0, 0, 3, 12, 32x8 +subsprite -32, -8, 3, 0, 32x8 +subsprite 0, -8, 3, 4, 32x8 +subsprite -32, 0, 3, 8, 32x8 +subsprite 0, 0, 3, 12, 32x8 gUnknown_085A80A0:: @ 85A80A0 - .4byte 4, gUnknown_085A8090 - +.4byte 4, gUnknown_085A8090 + gUnknown_085A80A8:: @ 85A80A8 - subsprite -32, -12, 3, 0, 32x8 - subsprite 0, -12, 3, 4, 32x8 - subsprite -32, -4, 3, 8, 32x8 - subsprite 0, -4, 3, 12, 32x8 - subsprite -32, 4, 3, 16, 32x8 - subsprite 0, 4, 3, 20, 32x8 +subsprite -32, -12, 3, 0, 32x8 +subsprite 0, -12, 3, 4, 32x8 +subsprite -32, -4, 3, 8, 32x8 +subsprite 0, -4, 3, 12, 32x8 +subsprite -32, 4, 3, 16, 32x8 +subsprite 0, 4, 3, 20, 32x8 gUnknown_085A80C0:: @ 85A80C0 - .4byte 6, gUnknown_085A80A8 - +.4byte 6, gUnknown_085A80A8 + gUnknown_085A80C8:: @ 85A80C8 - subsprite -16, -16, 3, 0, 32x32 - +subsprite -16, -16, 3, 0, 32x32 + gUnknown_085A80CC:: @ 85A80CC - subsprite -8, -8, 3, 16, 16x16 +subsprite -8, -8, 3, 16, 16x16 gUnknown_085A80D0:: @ 85A80D0 - .4byte 1, gUnknown_085A80C8 - +.4byte 1, gUnknown_085A80C8 + gUnknown_085A80D8:: @ 85A80D8 - .4byte 1, gUnknown_085A80CC - +.4byte 1, gUnknown_085A80CC + gUnknown_085A80E0:: @ 85A80E0 - subsprite -24, -24, 3, 0, 32x8 - subsprite 8, -24, 3, 4, 16x8 - subsprite -24, -16, 3, 6, 32x8 - subsprite 8, -16, 3, 10, 16x8 - subsprite -24, -8, 3, 12, 32x8 - subsprite 8, -8, 3, 16, 16x8 - subsprite -24, 0, 3, 18, 32x8 - subsprite 8, 0, 3, 22, 16x8 - subsprite -24, 8, 3, 24, 32x8 - subsprite 8, 8, 3, 28, 16x8 - subsprite -24, 16, 3, 30, 32x8 - subsprite 8, 16, 3, 34, 16x8 +subsprite -24, -24, 3, 0, 32x8 +subsprite 8, -24, 3, 4, 16x8 +subsprite -24, -16, 3, 6, 32x8 +subsprite 8, -16, 3, 10, 16x8 +subsprite -24, -8, 3, 12, 32x8 +subsprite 8, -8, 3, 16, 16x8 +subsprite -24, 0, 3, 18, 32x8 +subsprite 8, 0, 3, 22, 16x8 +subsprite -24, 8, 3, 24, 32x8 +subsprite 8, 8, 3, 28, 16x8 +subsprite -24, 16, 3, 30, 32x8 +subsprite 8, 16, 3, 34, 16x8 gUnknown_085A8110:: @ 85A8110 - .4byte 12, gUnknown_085A80E0 - +.4byte 12, gUnknown_085A80E0 + gUnknown_085A8118:: @ 85A8118 - subsprite -16, -12, 3, 0, 32x16 - subsprite -16, 4, 3, 8, 16x8 - subsprite 0, 4, 3, 10, 16x8 - +subsprite -16, -12, 3, 0, 32x16 +subsprite -16, 4, 3, 8, 16x8 +subsprite 0, 4, 3, 10, 16x8 + gUnknown_085A8124:: @ 85A8124 - .4byte 3, gUnknown_085A8118 - +.4byte 3, gUnknown_085A8118 + gUnknown_085A812C:: @ 85A812C - subsprite -8, -8, 3, 0, 16x8 - subsprite -8, 0, 3, 8, 16x8 - +subsprite -8, -8, 3, 0, 16x8 +subsprite -8, 0, 3, 8, 16x8 + gUnknown_085A8134:: @ 85A8134 - .4byte 2, gUnknown_085A812C - +.4byte 2, gUnknown_085A812C + gUnknown_085A813C:: @ 85A813C - subsprite -8, -8, 3, 2, 16x8 - subsprite -8, 0, 3, 10, 16x8 - +subsprite -8, -8, 3, 2, 16x8 +subsprite -8, 0, 3, 10, 16x8 + gUnknown_085A8144:: @ 85A8144 - .4byte 2, gUnknown_085A813C - +.4byte 2, gUnknown_085A813C + gUnknown_085A814C:: @ 85A814C - subsprite -8, -8, 3, 4, 16x8 - subsprite -8, 0, 3, 12, 16x8 - +subsprite -8, -8, 3, 4, 16x8 +subsprite -8, 0, 3, 12, 16x8 + gUnknown_085A8154:: @ 85A8154 - .4byte 2, gUnknown_085A814C - +.4byte 2, gUnknown_085A814C + gUnknown_085A815C:: @ 85A815C - subsprite -8, -8, 3, 6, 16x8 - subsprite -8, 0, 3, 14, 16x8 - +subsprite -8, -8, 3, 6, 16x8 +subsprite -8, 0, 3, 14, 16x8 + gUnknown_085A8164:: @ 85A8164 - .4byte 2, gUnknown_085A815C - +.4byte 2, gUnknown_085A815C + gUnknown_085A816C:: @ 85A816C - subsprite -8, -8, 3, 0, 16x8 - subsprite -8, 0, 3, 8, 16x8 - +subsprite -8, -8, 3, 0, 16x8 +subsprite -8, 0, 3, 8, 16x8 + gUnknown_085A8174:: @ 85A8174 - .4byte 2, gUnknown_085A816C - +.4byte 2, gUnknown_085A816C + gUnknown_085A817C:: @ 85A817C - subsprite -4, -8, 3, 2, 8x8 - subsprite -4, 0, 3, 10, 8x8 - +subsprite -4, -8, 3, 2, 8x8 +subsprite -4, 0, 3, 10, 8x8 + gUnknown_085A8184:: @ 85A8184 - .4byte 2, gUnknown_085A817C - +.4byte 2, gUnknown_085A817C + gUnknown_085A818C:: @ 85A818C - subsprite -8, -8, 3, 3, 16x8 - subsprite -8, 0, 3, 11, 16x8 - +subsprite -8, -8, 3, 3, 16x8 +subsprite -8, 0, 3, 11, 16x8 + gUnknown_085A8194:: @ 85A8194 - .4byte 2, gUnknown_085A818C - +.4byte 2, gUnknown_085A818C + gUnknown_085A819C:: @ 85A819C - subsprite -4, -8, 3, 5, 8x8 - subsprite -4, 0, 3, 13, 8x8 - +subsprite -4, -8, 3, 5, 8x8 +subsprite -4, 0, 3, 13, 8x8 + gUnknown_085A81A4:: @ 85A81A4 - .4byte 2, gUnknown_085A819C - +.4byte 2, gUnknown_085A819C + gUnknown_085A81AC:: @ 85A81AC - subsprite -8, -8, 3, 6, 16x8 - subsprite -8, 0, 3, 14, 16x8 - +subsprite -8, -8, 3, 6, 16x8 +subsprite -8, 0, 3, 14, 16x8 + gUnknown_085A81B4:: @ 85A81B4 - .4byte 2, gUnknown_085A81AC - +.4byte 2, gUnknown_085A81AC + gUnknown_085A81BC:: @ 85A81BC - subsprite -12, -12, 3, 0, 16x8 - subsprite 4, -12, 3, 2, 8x8 - subsprite -12, -4, 3, 8, 16x8 - subsprite 4, -4, 3, 10, 8x8 - subsprite -12, 4, 3, 16, 16x8 - subsprite 4, 4, 3, 18, 8x8 - +subsprite -12, -12, 3, 0, 16x8 +subsprite 4, -12, 3, 2, 8x8 +subsprite -12, -4, 3, 8, 16x8 +subsprite 4, -4, 3, 10, 8x8 +subsprite -12, 4, 3, 16, 16x8 +subsprite 4, 4, 3, 18, 8x8 + gUnknown_085A81D4:: @ 85A81D4 - .4byte 6, gUnknown_085A81BC - +.4byte 6, gUnknown_085A81BC + gUnknown_085A81DC:: @ 85A81DC - subsprite -8, -12, 3, 3, 16x8 - subsprite -8, -4, 3, 11, 16x8 - subsprite -8, 4, 3, 19, 16x8 - +subsprite -8, -12, 3, 3, 16x8 +subsprite -8, -4, 3, 11, 16x8 +subsprite -8, 4, 3, 19, 16x8 + gUnknown_085A81E8:: @ 85A81E8 - .4byte 3, gUnknown_085A81DC - +.4byte 3, gUnknown_085A81DC + gUnknown_085A81F0:: @ 85A81F0 - subsprite -12, -12, 3, 5, 16x8 - subsprite 4, -12, 3, 7, 8x8 - subsprite -12, -4, 3, 13, 16x8 - subsprite 4, -4, 3, 15, 8x8 - subsprite -12, 4, 3, 21, 16x8 - subsprite 4, 4, 3, 0x17, 8x8 - +subsprite -12, -12, 3, 5, 16x8 +subsprite 4, -12, 3, 7, 8x8 +subsprite -12, -4, 3, 13, 16x8 +subsprite 4, -4, 3, 15, 8x8 +subsprite -12, 4, 3, 21, 16x8 +subsprite 4, 4, 3, 0x17, 8x8 + gUnknown_085A8208:: @ 85A8208 - .4byte 6, gUnknown_085A81F0 - +.4byte 6, gUnknown_085A81F0 + gUnknown_085A8210:: @ 85A8210 - subsprite -12, -12, 3, 0, 16x8 - subsprite 4, -12, 3, 2, 8x8 - subsprite -12, -4, 3, 8, 16x8 - subsprite 4, -4, 3, 10, 8x8 - subsprite -12, 4, 3, 16, 16x8 - subsprite 4, 4, 3, 18, 8x8 - +subsprite -12, -12, 3, 0, 16x8 +subsprite 4, -12, 3, 2, 8x8 +subsprite -12, -4, 3, 8, 16x8 +subsprite 4, -4, 3, 10, 8x8 +subsprite -12, 4, 3, 16, 16x8 +subsprite 4, 4, 3, 18, 8x8 + gUnknown_085A8228:: @ 85A8228 - .4byte 6, gUnknown_085A8210 - +.4byte 6, gUnknown_085A8210 + gUnknown_085A822C:: @ 85A822C - subsprite -8, -12, 3, 3, 16x8 - subsprite -8, -4, 3, 11, 16x8 - subsprite -8, 4, 3, 19, 16x8 - +subsprite -8, -12, 3, 3, 16x8 +subsprite -8, -4, 3, 11, 16x8 +subsprite -8, 4, 3, 19, 16x8 + gUnknown_085A823C:: @ 85A823C - .4byte 3, gUnknown_085A822C - +.4byte 3, gUnknown_085A822C + gUnknown_085A8244:: @ 85A8244 - subsprite -12, -12, 3, 5, 16x8 - subsprite 4, -12, 3, 7, 8x8 - subsprite -12, -4, 3, 13, 16x8 - subsprite 4, -4, 3, 15, 8x8 - subsprite -12, 4, 3, 21, 16x8 - subsprite 4, 4, 3, 23, 8x8 - +subsprite -12, -12, 3, 5, 16x8 +subsprite 4, -12, 3, 7, 8x8 +subsprite -12, -4, 3, 13, 16x8 +subsprite 4, -4, 3, 15, 8x8 +subsprite -12, 4, 3, 21, 16x8 +subsprite 4, 4, 3, 23, 8x8 + gUnknown_085A825C:: @ 85A825C - .4byte 6, gUnknown_085A8244 +.4byte 6, gUnknown_085A8244 gUnknown_083EDB5C:: @ 85A8264 - .4byte gUnknown_085A7E48 - .4byte gUnknown_085A7E60 - .4byte gUnknown_085A7E78 - .4byte gUnknown_085A7EA8 - .4byte gUnknown_085A7EC0 - .4byte gUnknown_085A7F20 - .4byte gUnknown_085A7F38 - .4byte gUnknown_085A7F50 - .4byte gUnknown_085A7F68 - .4byte gUnknown_085A7F80 - .4byte gUnknown_085A7E90 - .4byte gUnknown_085A7E90 - .4byte gUnknown_085A7E90 - .4byte gUnknown_085A7E90 - .4byte gUnknown_085A7ED8 - .4byte gUnknown_085A7ED8 - .4byte gUnknown_085A7ED8 - .4byte gUnknown_085A7ED8 - .4byte gUnknown_085A7ED8 - .4byte gUnknown_085A7EF0 - .4byte gUnknown_085A7EF0 - .4byte gUnknown_085A7EF0 - .4byte gUnknown_085A7F08 - .4byte gUnknown_085A7F08 - .4byte gUnknown_085A7F08 - .4byte gDummySpriteTemplate +.4byte gUnknown_085A7E48 +.4byte gUnknown_085A7E60 +.4byte gUnknown_085A7E78 +.4byte gUnknown_085A7EA8 +.4byte gUnknown_085A7EC0 +.4byte gUnknown_085A7F20 +.4byte gUnknown_085A7F38 +.4byte gUnknown_085A7F50 +.4byte gUnknown_085A7F68 +.4byte gUnknown_085A7F80 +.4byte gUnknown_085A7E90 +.4byte gUnknown_085A7E90 +.4byte gUnknown_085A7E90 +.4byte gUnknown_085A7E90 +.4byte gUnknown_085A7ED8 +.4byte gUnknown_085A7ED8 +.4byte gUnknown_085A7ED8 +.4byte gUnknown_085A7ED8 +.4byte gUnknown_085A7ED8 +.4byte gUnknown_085A7EF0 +.4byte gUnknown_085A7EF0 +.4byte gUnknown_085A7EF0 +.4byte gUnknown_085A7F08 +.4byte gUnknown_085A7F08 +.4byte gUnknown_085A7F08 +.4byte gDummySpriteTemplate gUnknown_083EDBC4:: @ 85A82CC - .4byte gUnknown_085A8058 - .4byte gUnknown_085A8070 - .4byte gUnknown_085A8088 - .4byte gUnknown_085A80C0 - .4byte NULL - .4byte NULL - .4byte gUnknown_085A80D0 - .4byte NULL - .4byte gUnknown_085A8110 - .4byte gUnknown_085A8124 - .4byte gUnknown_085A8134 - .4byte gUnknown_085A8144 - .4byte gUnknown_085A8154 - .4byte gUnknown_085A8164 - .4byte gUnknown_085A8174 - .4byte gUnknown_085A8184 - .4byte gUnknown_085A8194 - .4byte gUnknown_085A81A4 - .4byte gUnknown_085A81B4 - .4byte gUnknown_085A81D4 - .4byte gUnknown_085A81E8 - .4byte gUnknown_085A8208 - .4byte gUnknown_085A8228 - .4byte gUnknown_085A823C - .4byte gUnknown_085A825C - .4byte NULL +.4byte gUnknown_085A8058 +.4byte gUnknown_085A8070 +.4byte gUnknown_085A8088 +.4byte gUnknown_085A80C0 +.4byte NULL +.4byte NULL +.4byte gUnknown_085A80D0 +.4byte NULL +.4byte gUnknown_085A8110 +.4byte gUnknown_085A8124 +.4byte gUnknown_085A8134 +.4byte gUnknown_085A8144 +.4byte gUnknown_085A8154 +.4byte gUnknown_085A8164 +.4byte gUnknown_085A8174 +.4byte gUnknown_085A8184 +.4byte gUnknown_085A8194 +.4byte gUnknown_085A81A4 +.4byte gUnknown_085A81B4 +.4byte gUnknown_085A81D4 +.4byte gUnknown_085A81E8 +.4byte gUnknown_085A8208 +.4byte gUnknown_085A8228 +.4byte gUnknown_085A823C +.4byte gUnknown_085A825C +.4byte NULL - .align 2 +.align 2 sSlotMachineSpriteSheets:: @ 85A8334 - obj_tiles gSlotMachineReelSymbol1Tiles, 0x0200, 0x0000 - obj_tiles gSlotMachineReelSymbol2Tiles, 0x0200, 0x0001 - obj_tiles gSlotMachineReelSymbol3Tiles, 0x0200, 0x0002 - obj_tiles gSlotMachineReelSymbol4Tiles, 0x0200, 0x0003 - obj_tiles gSlotMachineReelSymbol5Tiles, 0x0200, 0x0004 - obj_tiles gSlotMachineReelSymbol6Tiles, 0x0200, 0x0005 - obj_tiles gSlotMachineReelSymbol7Tiles, 0x0200, 0x0006 - obj_tiles gSlotMachineNumber0Tiles, 0x0040, 0x0007 - obj_tiles gSlotMachineNumber1Tiles, 0x0040, 0x0008 - obj_tiles gSlotMachineNumber2Tiles, 0x0040, 0x0009 - obj_tiles gSlotMachineNumber3Tiles, 0x0040, 0x000A - obj_tiles gSlotMachineNumber4Tiles, 0x0040, 0x000B - obj_tiles gSlotMachineNumber5Tiles, 0x0040, 0x000C - obj_tiles gSlotMachineNumber6Tiles, 0x0040, 0x000D - obj_tiles gSlotMachineNumber7Tiles, 0x0040, 0x000E - obj_tiles gSlotMachineNumber8Tiles, 0x0040, 0x000F - obj_tiles gSlotMachineNumber9Tiles, 0x0040, 0x0010 +obj_tiles gSlotMachineReelSymbol1Tiles, 0x0200, 0x0000 +obj_tiles gSlotMachineReelSymbol2Tiles, 0x0200, 0x0001 +obj_tiles gSlotMachineReelSymbol3Tiles, 0x0200, 0x0002 +obj_tiles gSlotMachineReelSymbol4Tiles, 0x0200, 0x0003 +obj_tiles gSlotMachineReelSymbol5Tiles, 0x0200, 0x0004 +obj_tiles gSlotMachineReelSymbol6Tiles, 0x0200, 0x0005 +obj_tiles gSlotMachineReelSymbol7Tiles, 0x0200, 0x0006 +obj_tiles gSlotMachineNumber0Tiles, 0x0040, 0x0007 +obj_tiles gSlotMachineNumber1Tiles, 0x0040, 0x0008 +obj_tiles gSlotMachineNumber2Tiles, 0x0040, 0x0009 +obj_tiles gSlotMachineNumber3Tiles, 0x0040, 0x000A +obj_tiles gSlotMachineNumber4Tiles, 0x0040, 0x000B +obj_tiles gSlotMachineNumber5Tiles, 0x0040, 0x000C +obj_tiles gSlotMachineNumber6Tiles, 0x0040, 0x000D +obj_tiles gSlotMachineNumber7Tiles, 0x0040, 0x000E +obj_tiles gSlotMachineNumber8Tiles, 0x0040, 0x000F +obj_tiles gSlotMachineNumber9Tiles, 0x0040, 0x0010 - .align 2 - .byte 0, 0, 0, 0, 0, 2, 0x12, 0, 0, 0, 0, 0, 0, 2, 0x13, 0, 0, 0, 0, 0, 0, 3, 0x14, 0, 0, 0, 0, 0, 0, 3, 0x15, 0, 0, 0, 0, 0, 0, 0, 0, 0 +.align 2 +.byte 0, 0, 0, 0, 0, 2, 0x12, 0, 0, 0, 0, 0, 0, 2, 0x13, 0, 0, 0, 0, 0, 0, 3, 0x14, 0, 0, 0, 0, 0, 0, 3, 0x15, 0, 0, 0, 0, 0, 0, 0, 0, 0 gUnknown_083EDCDC:: @ 85A83E4 - .4byte gUnknown_08DD19F8 - @ might be a palette idk - .byte 0x7B, 0x6F, 0x68, 0x69, 0xAB, 0x36, 0xFF, 0x7F, 0x50, 0x57, 0xC0, 0x7E, 0xBA, 2, 0xBA, 2, 0xFD, 1, 0xFD, 1 - -gUnknown_085A83FC:: @ 85A83FC - .byte 0x91, 0x7F - -gUnknown_085A83FE:: @ 85A83FE - .byte 0xBF, 0x43 +.4byte gUnknown_08DD19F8 +@ might be a palette idk +.byte 0x7B, 0x6F, 0x68, 0x69, 0xAB, 0x36, 0xFF, 0x7F, 0x50, 0x57, 0xC0, 0x7E, 0xBA, 2, 0xBA, 2, 0xFD, 1, 0xFD, 1 + +gUnknown_085A83FC:: @ 85A83FC +.byte 0x91, 0x7F + +gUnknown_085A83FE:: @ 85A83FE +.byte 0xBF, 0x43 gUnknown_085A8400:: @ 85A8400 - .byte 0xBF, 0x43 - +.byte 0xBF, 0x43 + gUnknown_085A8402:: @ 85A8402 - .byte 0xBF, 0x4A - +.byte 0xBF, 0x4A + gUnknown_085A8404:: @ 85A8404 - .byte 0xBF, 0x4A, 0, 0 +.byte 0xBF, 0x4A, 0, 0 gUnknown_083EDD08:: @ 85A8408 - .4byte gUnknown_085A83FC - .4byte gUnknown_085A83FE - .4byte gUnknown_085A8400 - .4byte gUnknown_085A8402 - .4byte gUnknown_085A8404 +.4byte gUnknown_085A83FC +.4byte gUnknown_085A83FE +.4byte gUnknown_085A8400 +.4byte gUnknown_085A8402 +.4byte gUnknown_085A8404 gUnknown_083EDD1C:: @ 85A841C - .4byte gSlotMachineMenu_Pal + 0x94 - .4byte gSlotMachineMenu_Pal + 0x96 - .4byte gSlotMachineMenu_Pal + 0x98 - .4byte gSlotMachineMenu_Pal + 0x9A - .4byte gSlotMachineMenu_Pal + 0x9C +.4byte gSlotMachineMenu_Pal + 0x94 +.4byte gSlotMachineMenu_Pal + 0x96 +.4byte gSlotMachineMenu_Pal + 0x98 +.4byte gSlotMachineMenu_Pal + 0x9A +.4byte gSlotMachineMenu_Pal + 0x9C gUnknown_083EDD30:: @ 85A8430 - .byte 0x4A, 0x4B, 0x4C, 0x4E, 0x4D +.byte 0x4A, 0x4B, 0x4C, 0x4E, 0x4D -gUnknown_083EDD35:: @ 85A8435 - .byte 0, 0 - .byte 1, 2 - .byte 3, 4 +gBettingTilesId:: @ 85A8435 +.byte 0, 0 +.byte 1, 2 +.byte 3, 4 + +gNumberBettingTiles:: @ 85A843B +.byte 1, 2, 2 -gUnknown_083EDD3B:: @ 85A843B - .byte 1, 2, 2 - gUnknown_085A843E:: @ 85A843E - .incbin "graphics/slot_machine/85A843E.gbapal" - -gUnknown_085A845E:: @ 85A845E - .incbin "graphics/slot_machine/85A845E.gbapal" - -gUnknown_085A847E:: @ 85A847E - .incbin "graphics/slot_machine/85A847E.gbapal" +.incbin "graphics/slot_machine/85A843E.gbapal" - .align 2 +gUnknown_085A845E:: @ 85A845E +.incbin "graphics/slot_machine/85A845E.gbapal" + +gUnknown_085A847E:: @ 85A847E +.incbin "graphics/slot_machine/85A847E.gbapal" + +.align 2 gUnknown_083EDDA0:: @ 85A84A0 - .4byte gUnknown_085A843E - .4byte gUnknown_085A845E - .4byte gUnknown_085A847E +.4byte gUnknown_085A843E +.4byte gUnknown_085A845E +.4byte gUnknown_085A847E gUnknown_083EDDAC:: @ 85A84AC - .4byte gSlotMachineMenu_Pal + 0x20 - +.4byte gSlotMachineMenu_Pal + 0x20 + gUnknown_085A84B0:: @ 85A84B0 - .incbin "graphics/slot_machine/85A84B0.gbapal" - +.incbin "graphics/slot_machine/85A84B0.gbapal" + gUnknown_085A84D0:: @ 85A84D0 - .incbin "graphics/slot_machine/85A84D0.gbapal" - +.incbin "graphics/slot_machine/85A84D0.gbapal" + gUnknown_085A84F0:: @ 85A84F0 - .incbin "graphics/slot_machine/85A84F0.gbapal" +.incbin "graphics/slot_machine/85A84F0.gbapal" gUnknown_083EDE10:: @ 85A8510 - .4byte gUnknown_085A84B0 - .4byte gUnknown_085A84D0 - .4byte gUnknown_085A84F0 - .4byte gUnknown_08DCF230 +.4byte gUnknown_085A84B0 +.4byte gUnknown_085A84D0 +.4byte gUnknown_085A84F0 +.4byte gUnknown_08DCF230 gUnknown_083EDE20:: @ 85A8520 - .4byte gUnknown_08DCF230 +.4byte gUnknown_08DCF230 gPalette_83EDE24:: @ 85A8524 - .incbin "graphics/slot_machine/85A8524.bin" +.incbin "graphics/slot_machine/85A8524.bin" - .align 2 +.align 2 gSlotMachineSpritePalettes:: @ 85A8544 - obj_pal gUnknown_08DCF170, 0 - obj_pal gUnknown_08DCF190, 1 - obj_pal gUnknown_08DCF1B0, 2 - obj_pal gSlotMachineReelTime_Pal, 3 - obj_pal gUnknown_08DCF1F0, 4 - obj_pal gUnknown_08DCF210, 5 - obj_pal gUnknown_08DCF230, 6 - obj_pal gUnknown_08DCF1F0, 7 - null_obj_pal +obj_pal gUnknown_08DCF170, 0 +obj_pal gUnknown_08DCF190, 1 +obj_pal gUnknown_08DCF1B0, 2 +obj_pal gSlotMachineReelTime_Pal, 3 +obj_pal gUnknown_08DCF1F0, 4 +obj_pal gUnknown_08DCF210, 5 +obj_pal gUnknown_08DCF230, 6 +obj_pal gUnknown_08DCF1F0, 7 +null_obj_pal sReelTimeGfx:: @ 85A858C - .incbin "graphics/slot_machine/reel_time_gfx.4bpp.lz" +.incbin "graphics/slot_machine/reel_time_gfx.4bpp.lz" sReelTimeWindowTilemap:: @ 85A96E0 - @if anyone knows what this tilemap is please do share - .incbin "graphics/slot_machine/85A96E0.bin" +@if anyone knows what this tilemap is please do share +.incbin "graphics/slot_machine/85A96E0.bin" gUnknown_085A9898:: @ 85A9898 - .4byte NULL +.4byte NULL diff --git a/include/slot_machine.h b/include/slot_machine.h index 88bbbd91b..fae937834 100644 --- a/include/slot_machine.h +++ b/include/slot_machine.h @@ -1,6 +1,9 @@ #ifndef GUARD_SLOT_MACHINE_H #define GUARD_SLOT_MACHINE_H +#define REEL_NUM_TAGS 21 + + void PlaySlotMachine(u8, void (callback)(void)); #endif // GUARD_SLOT_MACHINE_H diff --git a/include/task.h b/include/task.h index a199ba128..4852571b4 100644 --- a/include/task.h +++ b/include/task.h @@ -1,6 +1,9 @@ #ifndef GUARD_TASK_H #define GUARD_TASK_H +#define HEAD_SENTINEL 0xFE +#define TAIL_SENTINEL 0xFF + #define NUM_TASKS 16 typedef void (*TaskFunc)(u8 taskId); diff --git a/include/tv.h b/include/tv.h index a7ef3daa8..0f50f2327 100644 --- a/include/tv.h +++ b/include/tv.h @@ -1,6 +1,9 @@ #ifndef GUARD_TV_H #define GUARD_TV_H +#define SLOT_MACHINE 0 +#define ROULETTE 1 + extern u8 *const gTVStringVarPtrs[3]; void ClearTVShowData(void); @@ -23,9 +26,9 @@ bool8 GetPriceReduction(u8 newsKind); void sub_80F14F8(TVShow *shows); size_t CountDigits(int value); u8 GetRibbonCount(struct Pokemon *pokemon); -void sub_80EDE70(u16 nCoinsSpent); -void sub_80EDE84(u16 nCoinsSpent); -void sub_80EDD78(u16 nCoinsPaidOut); +void reportPlayedSlotMachine(u16 nCoinsSpent); +void reportPlayedRoulette(u16 nCoinsSpent); +void reportNewCoinTotal(u16 nCoinsPaidOut); void sub_80EEA70(void); void sub_80EDB44(void); void sub_80EDC60(const u16 *words); diff --git a/src/roulette.c b/src/roulette.c index a6a020f39..b19750f2a 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -996,7 +996,7 @@ static void sub_81405CC(void) taskId = gUnknown_0203AB88->varA4 = CreateTask(sub_81408A8, 0); gTasks[taskId].data[6] = 6; gTasks[taskId].data[13] = GetCoins(); - sub_80EDE84(GetCoins()); + reportPlayedRoulette(GetCoins()); gUnknown_0203AB88->varA5 = CreateTask(sub_8140814, 1); SetMainCallback2(sub_8140238); return; @@ -1964,7 +1964,7 @@ static void sub_8141DE4(u8 taskId) gSpecialVar_0x8004 = TRUE; else gSpecialVar_0x8004 = FALSE; - sub_80EDD78(GetCoins()); + reportNewCoinTotal(GetCoins()); BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0); gTasks[taskId].func = sub_8141E7C; } diff --git a/src/slot_machine.c b/src/slot_machine.c index 0871506cd..7552e755c 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -59,34 +59,34 @@ enum struct SlotMachineEwramStruct { - /*0x00*/ u8 state; - /*0x01*/ u8 unk01; + /*0x00*/ u8 slotActionPtr; + /*0x01*/ u8 machineId; /*0x02*/ u8 pikaPower; - /*0x03*/ u8 unk03; - /*0x04*/ u8 unk04; - /*0x05*/ u8 unk05; - /*0x06*/ u8 unk06; - /*0x07*/ u8 unk07; + /*0x03*/ u8 luckyGame; + /*0x04*/ u8 luckyFlags; + /*0x05*/ u8 reelTimeDraw; + /*0x06*/ u8 isBiasTagMatchPossible; // tentative + /*0x07*/ u8 biasTag; /*0x08*/ u16 matchedSymbols; - /*0x0A*/ u8 unk0A; - /*0x0B*/ u8 unk0B; + /*0x0A*/ u8 fairRollsLeft; + /*0x0B*/ u8 fairRollsUsed; /*0x0C*/ s16 coins; /*0x0E*/ s16 payout; - /*0x10*/ s16 unk10; + /*0x10*/ s16 netCoinLoss; // coins lost to machine (but never goes below 0) /*0x12*/ s16 bet; - /*0x14*/ s16 unk14; - /*0x16*/ s16 unk16; - /*0x18*/ s16 unk18; - /*0x1A*/ s16 unk1A; - /*0x1C*/ s16 unk1C[3]; - /*0x22*/ u16 unk22[3]; + /*0x14*/ s16 reelTimePixelOffset; + /*0x16*/ s16 reelTimePosition; + /*0x18*/ s16 currReel; + /*0x1A*/ s16 reelIncrement; + /*0x1C*/ s16 reelPixelOffsets[3]; + /*0x22*/ u16 stopReelPixelOffset[3]; /*0x28*/ s16 reelPositions[3]; - /*0x2E*/ s16 unk2E[3]; - /*0x34*/ s16 unk34[3]; + /*0x2E*/ s16 reelExtraTurns[3]; + /*0x34*/ s16 biasTagFinalPositions[3]; /*0x3A*/ u8 reelTasks[3]; - /*0x3D*/ u8 unk3D; - /*0x3E*/ u8 unk3E; - /*0x3F*/ u8 unk3F; + /*0x3D*/ u8 unkTaskPointer3D; + /*0x3E*/ u8 unkTaskPointer; + /*0x3F*/ u8 reelTimeSprite3F; /*0x40*/ u8 unk40; /*0x41*/ u8 unk41; /*0x42*/ u8 unk42; @@ -95,8 +95,8 @@ struct SlotMachineEwramStruct /*0x49*/ u8 unk49[2]; /*0x49*/ u8 unk4B[3]; /*0x4E*/ u8 unk4E[2]; - /*0x50*/ u8 unk50[2]; - /*0x52*/ u8 unk52[2]; + /*0x50*/ u8 reelTimeSprites1[2]; + /*0x52*/ u8 reelTimeSprites2[2]; /*0x54*/ u8 unk54[4]; /*0x58*/ u16 win0h; /*0x5a*/ u16 win0v; @@ -117,7 +117,7 @@ struct UnkStruct1 /*static */void CB2_SlotMachineSetup(void); /*static */void CB2_SlotMachineLoop(void); -/*static */void PlaySlotMachine_Internal(u8 arg0, MainCallback cb); +/*static */void PlaySlotMachine_Internal(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinueScriptPlayMapMusic); /*static */void SlotMachineDummyTask(u8 taskId); /*static */void SlotMachineSetup_0_0(void); /*static */void SlotMachineSetup_6_2(void); @@ -133,88 +133,88 @@ struct UnkStruct1 /*static */void SlotMachineSetup_8_0(void); /*static */void SlotMachineSetup_9_0(void); /*static */void SlotMachineSetup_10_0(void); -/*static */void SlotMachineSetup_10_1(void); -/*static */void sub_8101D04(void); +/*static */void SlotMachineSetupGameplayTasks(void); +/*static */void GameplayTasks_Slot(void); /*static */void sub_8104DA4(void); -/*static */void sub_8101D24(u8 taskId); -/*static */bool8 sub_8101D5C(struct Task *task); -/*static */bool8 sub_8101D8C(struct Task *task); -/*static */bool8 sub_8101DB0(struct Task *task); -/*static */bool8 sub_8101DF4(struct Task *task); -/*static */bool8 sub_8101E10(struct Task *task); -/*static */bool8 sub_8101E3C(struct Task *task); -/*static */bool8 sub_8101F44(struct Task *task); -/*static */bool8 sub_8101F60(struct Task *task); -/*static */bool8 sub_8101F88(struct Task *task); -/*static */bool8 sub_8101FA4(struct Task *task); -/*static */bool8 sub_8102008(struct Task *task); -/*static */bool8 sub_8102034(struct Task *task); -/*static */bool8 sub_8102058(struct Task *task); -/*static */bool8 sub_8102090(struct Task *task); -/*static */bool8 sub_81020C8(struct Task *task); -/*static */bool8 sub_81021E0(struct Task *task); -/*static */bool8 sub_81021FC(struct Task *task); -/*static */bool8 sub_8102264(struct Task *task); -/*static */bool8 sub_81022A0(struct Task *task); -/*static */bool8 sub_81022CC(struct Task *task); -/*static */bool8 sub_81022F0(struct Task *task); -/*static */bool8 sub_8102318(struct Task *task); -/*static */bool8 sub_8102344(struct Task *task); -/*static */bool8 sub_810239C(struct Task *task); -/*static */bool8 sub_81023B8(struct Task *task); -/*static */bool8 sub_81023E0_(struct Task *task); -/*static */bool8 sub_81023FC(struct Task *task); -/*static */bool8 sub_8102424(struct Task *task); -/*static */bool8 sub_8102460(struct Task *task); -/*static */void sub_8102484(void); -/*static */void sub_81024F0(void); -/*static */bool8 sub_8102540_(void); -/*static */u8 sub_8102578(void); -/*static */u16 dp15_jump_random_unknown(void); -/*static */u8 sub_81025BC(void); +/*static */void RunSlotActions(u8 taskId); +/*static */bool8 SlotAction_UnfadeScreen(struct Task *task); +/*static */bool8 SlotAction_WaitForUnfade(struct Task *task); +/*static */bool8 SlotAction_SetSlotMachineVars(struct Task *task); +/*static */bool8 SlotAction3(struct Task *task); +/*static */bool8 SlotAction4(struct Task *task); +/*static */bool8 SlotAction_AwaitPlayerInput(struct Task *task); +/*static */bool8 SlotAction_PrintYouDontHaveThreeCoins(struct Task *task); +/*static */bool8 SlotAction_PlayerAcceptsNotHavingThreeCoins(struct Task *task); +/*static */bool8 SlotAction_GivingInformation(struct Task *task); +/*static */bool8 SlotAction9(struct Task *task); +/*static */bool8 SlotAction10(struct Task *task); +/*static */bool8 SlotAction11(struct Task *task); +/*static */bool8 SlotAction_AwaitReelStop(struct Task *task); +/*static */bool8 SlotAction_WaitForAllReelsToStop(struct Task *task); +/*static */bool8 SlotAction_CheckMatches(struct Task *task); +/*static */bool8 SlotAction_WaitForPayoutToBeAwarded(struct Task *task); +/*static */bool8 SlotAction_EndOfRoll(struct Task *task); +/*static */bool8 SlotAction17(struct Task *task); +/*static */bool8 SlotAction18(struct Task *task); +/*static */bool8 SlotAction_Loop(struct Task *task); +/*static */bool8 SlotAction_NoMatches(struct Task *task); +/*static */bool8 SlotAction_PrintQuitTheGame(struct Task *task); +/*static */bool8 SlotAction_SeeIfPlayerQuits(struct Task *task); +/*static */bool8 SlotAction_Print9999CoinMessage(struct Task *task); +/*static */bool8 SlotAction_Escape9999CoinMessage(struct Task *task); +/*static */bool8 SlotAction_PrintNoMoreCoins(struct Task *task); +/*static */bool8 SlotAction_EscapeNoMoreCoins(struct Task *task); +/*static */bool8 SlotAction_EndGame(struct Task *task); +/*static */bool8 SlotAction_FreeDataStructures(struct Task *task); +/*static */void DrawForLuckyFlags(void); +/*static */void AnyLuckyFlagsSet(void); +/*static */bool8 IsLuckyRound(void); +/*static */u8 AttemptsAtLuckiness1(void); +/*static */u16 DrawNewReelIncrement(void); +/*static */u8 AttemptsAtLuckiness2(void); /*static */void CheckMatch(void); /*static */void CheckMatch_CenterRow(void); /*static */void CheckMatch_TopAndBottom(void); /*static */void CheckMatch_Diagonals(void); /*static */u8 GetMatchFromSymbolsInRow(u8 c1, u8 c2, u8 c3); -/*static */void sub_8102A24(void); -/*static */void sub_8102A64(u8 taskId); -/*static */bool8 sub_8102A44(void); -/*static */bool8 sub_8102A9C(struct Task *task); -/*static */bool8 sub_8102AD0(struct Task *task); -/*static */bool8 sub_8102B80(struct Task *task); -/*static */u8 GetTagOfReelSymbolOnScreenAtPos(u8 x, s16 y); -/*static */void sub_8102DA8(void); -/*static */void sub_8102DEC(u8 a0); +/*static */void AwardPayout(void); +/*static */void RunAwardPayoutActions(u8 taskId); +/*static */bool8 IsFinalTask_RunAwardPayoutActions(void); +/*static */bool8 AwardPayoutAction1(struct Task *task); +/*static */bool8 AwardPayoutAction_GivePayoutToPlayer(struct Task *task); +/*static */bool8 AwardPayoutAction_FreeTask(struct Task *task); +/*static */u8 GetNearbyTag(u8 x, s16 y); +/*static */void GameplayTask_StopReel(void); +/*static */void ReelTasks_8102DEC(u8 a0); /*static */void sub_8102E1C(u8 a0); -/*static */bool8 sub_8102E40(u8 a0); -/*static */void sub_8102E68(u8 taskId); -/*static */bool8 sub_8102EA0(struct Task *task); -/*static */bool8 sub_8102EA4(struct Task *task); -/*static */bool8 sub_8102EC0(struct Task *task); -/*static */bool8 sub_8102F4C(struct Task *task); -/*static */bool8 sub_8103008(struct Task *task); -/*static */bool8 sub_810305C(void); -/*static */bool8 sub_8103154(u8 a0, u8 a1); -/*static */bool8 sub_81031B4(u8 a0, u8 a1); -/*static */bool8 sub_81032C0(void); -/*static */bool8 sub_81032E8(void); -/*static */bool8 sub_810333C(void); -/*static */bool8 sub_81033DC(void); -/*static */bool8 sub_810341C(u8 a0); -/*static */bool8 sub_810347C(u8 a0); -/*static */void sub_81034F4(void); -/*static */void sub_8103540(void); -/*static */void sub_8103564(void); -/*static */void j5_08111E84(void); -/*static */void sub_8103668(void); -/*static */void sub_810380C(void); +/*static */bool8 IsReelMoving(u8 a0); +/*static */void RunReelActions(u8 taskId); +/*static */bool8 ReelAction_StayStill(struct Task *task); +/*static */bool8 ReelAction_Spin(struct Task *task); +/*static */bool8 ReelAction_DecideWhereToStop(struct Task *task); +/*static */bool8 ReelAction_TurnToSelectedTag(struct Task *task); +/*static */bool8 ReelAction_OscillatingStop(struct Task *task); +/*static */bool8 DecideReelTurns_BiasTag_Reel1(void); +/*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet1(u8 a0, u8 a1); +/*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet2or3(u8 a0, u8 a1); +/*static */bool8 DecideReelTurns_BiasTag_Reel2(void); +/*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet1or2(void); +/*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet3(void); +/*static */bool8 DecideReelTurns_BiasTag_Reel3(void); +/*static */bool8 DecideReelTurns_BiasTag_Reel3_Bet1or2(u8 a0); +/*static */bool8 DecideReelTurns_BiasTag_Reel3_Bet3(u8 a0); +/*static */void DecideReelTurns_NoBiasTag_Reel1(void); +/*static */void DecideReelTurns_NoBiasTag_Reel2(void); +/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet1(void); +/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet2(void); +/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet3(void); +/*static */void DecideReelTurns_NoBiasTag_Reel3(void); /*static */void sub_8103830(void); /*static */void sub_8103910(void); /*static */void sub_8103A78(void); /*static */void sub_8103C14(u8 a0); /*static */void sub_8103C48(u8 taskId); -/*static */void sub_8103D50(u8 a0); +/*static */void LoadBetTiles(u8 a0); /*static */void sub_8103C78(struct Task *task, u8 taskId); /*static */void sub_8103CAC(struct Task *task, u8 taskId); /*static */void sub_8103CC8(struct Task *task, u8 taskId); @@ -229,50 +229,50 @@ struct UnkStruct1 /*static */bool8 sub_8103FA0(void); /*static */void sub_8103FE8_(u8 taskId); /*static */void sub_8104048(void); -/*static */void sub_8104064(u8 pikaPower); +/*static */void DisplayPikaPower(u8 pikaPower); /*static */bool8 sub_81040C8(void); /*static */void sub_81040E8(u8 taskId); /*static */void nullsub_68(struct Task *task); /*static */void sub_810411C(struct Task *task); /*static */void sub_8104144(struct Task *task); /*static */void sub_81041AC(struct Task *task); -/*static */void sub_812D394(struct Task *task); +/*static */void ClearTaskDataFields_2orHigher(struct Task *task); /*static */void sub_810423C(u8 pikaPower); -/*static */void sub_810430C(void); -/*static */bool8 sub_810432C(void); -/*static */void sub_810434C(u8 taskId); -/*static */void sub_810437C(struct Task *task); -/*static */void sub_81043EC(struct Task *task); -/*static */void sub_8104468(struct Task *task); -/*static */void sub_8104498(struct Task *task); -/*static */void sub_8104548(struct Task *task); -/*static */void sub_8104598(struct Task *task); -/*static */void sub_81045CC(struct Task *task); -/*static */void sub_810463C(struct Task *task); -/*static */void sub_81046C0(struct Task *task); -/*static */void sub_8104764(struct Task *task); -/*static */void sub_8104794(struct Task *task); -/*static */void sub_81047EC(struct Task *task); -/*static */void sub_8104860(struct Task *task); -/*static */void sub_81048A8(struct Task *task); -/*static */void sub_81048CC(struct Task *task); -/*static */void sub_8104940(struct Task *task); -/*static */void sub_81049C8(struct Task *task); -/*static */void sub_81049F8(struct Task *task); +/*static */void BeginReelTime(void); +/*static */bool8 IsFinalTask_RunReelTimeActions(void); +/*static */void RunReelTimeActions(u8 taskId); +/*static */void ReelTimeAction1(struct Task *task); +/*static */void ReelTimeAction2(struct Task *task); +/*static */void ReelTimeAction3(struct Task *task); +/*static */void ReelTimeAction4(struct Task *task); +/*static */void ReelTimeAction5(struct Task *task); +/*static */void ReelTimeAction6(struct Task *task); +/*static */void ReelTimeAction7(struct Task *task); +/*static */void ReelTimeAction_LandOnOutcome(struct Task *task); +/*static */void ReelTimeAction9(struct Task *task); +/*static */void ReelTimeAction10(struct Task *task); +/*static */void ReelTimeAction11(struct Task *task); +/*static */void ReelTimeAction12(struct Task *task); +/*static */void ReelTimeAction13(struct Task *task); +/*static */void ReelTimeAction14(struct Task *task); +/*static */void ReelTimeAction15(struct Task *task); +/*static */void ReelTimeAction16(struct Task *task); +/*static */void ReelTimeAction17(struct Task *task); +/*static */void ReelTimeAction18(struct Task *task); /*static */void sub_8104A40(s16 a0, s16 a1); /*static */void sub_8104A88(s16 a0); -/*static */void sub_8104AB8(u8 a0); -/*static */bool8 sub_8104AEC(void); -/*static */void sub_8104B0C(u8 taskId); -/*static */void sub_8104B3C(struct Task *task); -/*static */void sub_8104B60(struct Task *task); -/*static */void sub_8104B80(struct Task *task); -/*static */void sub_8104BC8(struct Task *task); -/*static */void sub_812DD78(struct Task *task); -/*static */void sub_8104BFC(struct Task *task); -/*static */void sub_812DE14(struct Task *task); -/*static */void sub_812DE30(struct Task *task); -/*static */void sub_8104C44(struct Task *task); +/*static */void OpenInfoBox(u8 a0); +/*static */bool8 ClosedInfoBox(void); +/*static */void RunInfoBoxActions(u8 taskId); +/*static */void InfoBox_FadeIn(struct Task *task); +/*static */void InfoBox_WaitForFade(struct Task *task); +/*static */void InfoBox_8104B80(struct Task *task); +/*static */void InfoBox_AwaitPlayerInput(struct Task *task); +/*static */void InfoBox_AddText(struct Task *task); +/*static */void InfoBox_8104BFC(struct Task *task); +/*static */void InfoBox_812DE14(struct Task *task); +/*static */void InfoBox_812DE30(struct Task *task); +/*static */void InfoBox_FreeTask(struct Task *task); /*static */void sub_8104C5C(void); /*static */void sub_8104CAC(u8 arg0); /*static */bool8 sub_8104E18(void); @@ -292,10 +292,10 @@ struct UnkStruct1 /*static */void sub_81054B8(void); /*static */void sub_8105524(void); /*static */void sub_8105554(void); -/*static */void sub_8105578(void); +/*static */void CreateReelTimeSprites1(void); /*static */void sub_8105688(s16 a0); /*static */void sub_81056C0(void); -/*static */void sub_81056F0(void); +/*static */void CreateReelTimeSprite2(void); /*static */void sub_81057E8(s16 a0); /*static */void sub_8105804(void); /*static */void sub_8105854(void); @@ -321,7 +321,7 @@ struct UnkStruct1 // Ewram variables static EWRAM_DATA u16 *gUnknown_0203AAC8 = NULL; -static EWRAM_DATA u16 *gUnknown_0203AACC = NULL; +static EWRAM_DATA u16 *selectedPikaPowerTile = NULL; static EWRAM_DATA u16 *gUnknown_0203AAD0 = NULL; static EWRAM_DATA u8 *gUnknown_0203AAD4 = NULL; static EWRAM_DATA u8 *gUnknown_0203AAD8 = NULL; @@ -355,10 +355,10 @@ static IWRAM_DATA struct SpriteFrameImage *gUnknown_03001188[26]; // Const rom data. extern const struct UnkStruct1 *const gUnknown_083ED048[]; extern const u16 gPalette_83EDE24[]; -extern const u8 gUnknown_083ECD04[][3]; -extern const u8 gUnknown_083ECE3A[]; -extern const u16 gUnknown_083ECE42[]; -extern const u16 gUnknown_083ECE48[]; +extern const u8 sSlotLuckinessTable1[][3]; +extern const u8 LuckyFlagTagOutput[]; +extern const u16 FlagsAttemptAtLuckiness1[]; +extern const u16 FlagsAttemptAtLuckiness2[]; extern const s16 gUnknown_083ECE7E[][2]; extern const SpriteCallback gUnknown_083ECF0C[]; extern const struct SpriteTemplate *const gUnknown_083EDB5C[]; @@ -369,10 +369,10 @@ extern const struct SpriteTemplate gSpriteTemplate_83ED54C; extern const struct SpriteTemplate gSpriteTemplate_83ED534; extern const u8 gUnknown_083ECC58[2]; extern const struct SpriteTemplate gSpriteTemplate_83ED51C; -extern const u16 gUnknown_083ECE12[]; +extern const u16 ProbabilityTable_SkipToReelTimeAction14[]; extern const u16 *const gUnknown_083EDE10[]; -extern const u16 gUnknown_083ECE1C[][2]; -extern const u16 gUnknown_083ECE30[]; +extern const u16 ReelIncrementTable[][2]; +extern const u16 ReelTimeBonusIncrementTable[]; extern const u16 sSlotMatchFlags[]; extern const u16 sSlotPayouts[]; extern const u8 *const gUnknown_083EDCE4; @@ -381,21 +381,21 @@ extern const u32 sReelTimeGfx[]; extern const struct SpriteSheet sSlotMachineSpriteSheets[]; extern const struct SpritePalette gSlotMachineSpritePalettes[]; extern const u16 *const gUnknown_083EDE20; -extern const s16 gUnknown_083ECCF8[][2]; +extern const s16 sInitialReelPositions[][2]; extern const struct BgTemplate gUnknown_085A7424[4]; extern const struct WindowTemplate gUnknown_085A7434[]; -extern const u8 gUnknown_083ECD16[][6]; -extern const u8 gUnknown_083ECD28[][6]; -extern const u8 gUnknown_083ECD46[][17]; -extern const u8 gUnknown_083ECDAC[][17]; +extern const u8 sSlotLuckinessTable2[][6]; +extern const u8 sSlotLuckinessTable3[][6]; +extern const u8 ReelTimeProbabilityTable0[][17]; +extern const u8 ReelTimeProbabilityTable1[][17]; extern const u8 sSym2Match[]; extern const u8 gUnknown_083ECCF1[]; -extern const u8 sReelSymbols[][21]; +extern const u8 sReelSymbols[][REEL_NUM_TAGS]; extern const u16 *const gUnknown_083EDD08[]; extern const u16 *const gUnknown_083EDD1C[]; extern const u8 gUnknown_083EDD30[]; -extern const u8 gUnknown_083EDD35[][2]; -extern const u8 gUnknown_083EDD3B[]; +extern const u8 gBettingTilesId[][2]; +extern const u8 gNumberBettingTiles[]; extern const u16 *const gUnknown_083EDDA0[]; extern const u16 *const gUnknown_083EDDAC; extern const u16 sReelTimeWindowTilemap[]; @@ -453,99 +453,101 @@ const struct WindowTemplate gUnknown_085A7444 = 0, 1, 3, 20, 13, 13, 1 }; -const u8 gUnknown_085A744C[] = {3, 1, 2, 0}; +const u8 gColors_ReelTimeHelp[] = {3, 1, 2, 0}; -bool8 (*const gUnknown_083ECAAC[])(struct Task *task) = +bool8 (*const SlotActions[])(struct Task *task) = { - sub_8101D5C, - sub_8101D8C, - sub_8101DB0, - sub_8101DF4, - sub_8101E10, - sub_8101E3C, - sub_8101F44, - sub_8101F60, - sub_8101F88, - sub_8101FA4, - sub_8102008, - sub_8102034, - sub_8102058, - sub_8102090, - sub_81020C8, - sub_81021E0, - sub_81021FC, - sub_8102264, - sub_81022A0, - sub_81022CC, - sub_81022F0, - sub_8102318, - sub_8102344, - sub_810239C, - sub_81023B8, - sub_81023E0_, - sub_81023FC, - sub_8102424, - sub_8102460, + SlotAction_UnfadeScreen, + SlotAction_WaitForUnfade, + SlotAction_SetSlotMachineVars, + SlotAction3, + SlotAction4, + SlotAction_AwaitPlayerInput, + SlotAction_PrintYouDontHaveThreeCoins, + SlotAction_PlayerAcceptsNotHavingThreeCoins, + SlotAction_GivingInformation, + SlotAction9, + SlotAction10, + SlotAction11, + SlotAction_AwaitReelStop, + SlotAction_WaitForAllReelsToStop, + SlotAction_CheckMatches, + SlotAction_WaitForPayoutToBeAwarded, + SlotAction_EndOfRoll, + SlotAction17, + SlotAction18, + SlotAction_Loop, + SlotAction_NoMatches, + SlotAction_PrintQuitTheGame, + SlotAction_SeeIfPlayerQuits, + SlotAction_Print9999CoinMessage, + SlotAction_Escape9999CoinMessage, + SlotAction_PrintNoMoreCoins, + SlotAction_EscapeNoMoreCoins, + SlotAction_EndGame, + SlotAction_FreeDataStructures, }; -bool8 (*const gUnknown_083ECB20[])(struct Task *task) = +bool8 (*const AwardPayoutActions[])(struct Task *task) = { - sub_8102A9C, - sub_8102AD0, - sub_8102B80 + AwardPayoutAction1, + AwardPayoutAction_GivePayoutToPlayer, + AwardPayoutAction_FreeTask }; -bool8 (*const gUnknown_083ECB2C[])(struct Task *task) = +bool8 (*const ReelActions[])(struct Task *task) = { - sub_8102EA0, - sub_8102EA4, - sub_8102EC0, - sub_8102F4C, - sub_8103008 + ReelAction_StayStill, + ReelAction_Spin, + ReelAction_DecideWhereToStop, + ReelAction_TurnToSelectedTag, + ReelAction_OscillatingStop }; -bool8 (*const gUnknown_083ECB40[])(void) = +// returns True if a match with the biasTag is possible in that reel +// also modifies data in sSlotMachine reel arrays to indicate how to get to the matching state +bool8 (*const DecideReelTurns_BiasTag[])(void) = { - sub_810305C, - sub_81032C0, - sub_81033DC + DecideReelTurns_BiasTag_Reel1, + DecideReelTurns_BiasTag_Reel2, + DecideReelTurns_BiasTag_Reel3 }; -void (*const gUnknown_083ECB4C[])(void) = +void (*const DecideReelTurns_NoBiasTag[])(void) = { - sub_81034F4, - sub_8103540, - sub_810380C + DecideReelTurns_NoBiasTag_Reel1, + DecideReelTurns_NoBiasTag_Reel2, + DecideReelTurns_NoBiasTag_Reel3 }; -const u16 gUnknown_085A74FC[] = {2, 4, 4, 4, 8}; +const u16 ReelStopShocks[] = {2, 4, 4, 4, 8}; -bool8 (*const gUnknown_083ECB64[])(u8 a0, u8 a1) = +bool8 (*const DecideReelTurns_BiasTag_Reel1_Bets[])(u8 tag1, u8 tag2) = { - sub_8103154, - sub_81031B4, - sub_81031B4 + DecideReelTurns_BiasTag_Reel1_Bet1, + DecideReelTurns_BiasTag_Reel1_Bet2or3, + DecideReelTurns_BiasTag_Reel1_Bet2or3 }; -bool8 (*const gUnknown_083ECB70[])(void) = +bool8 (*const DecideReelTurns_BiasTag_Reel2_Bets[])(void) = { - sub_81032E8, - sub_81032E8, - sub_810333C + DecideReelTurns_BiasTag_Reel2_Bet1or2, + DecideReelTurns_BiasTag_Reel2_Bet1or2, + DecideReelTurns_BiasTag_Reel2_Bet3 }; -bool8 (*const gUnknown_083ECB7C[])(u8 a0) = +bool8 (*const DecideReelTurns_BiasTag_Reel3_Bets[])(u8 biasTag) = { - sub_810341C, - sub_810341C, - sub_810347C + DecideReelTurns_BiasTag_Reel3_Bet1or2, + DecideReelTurns_BiasTag_Reel3_Bet1or2, + DecideReelTurns_BiasTag_Reel3_Bet3 }; -void (*const gUnknown_083ECB88[])(void) = +void (*const DecideReelTurns_NoBiasTag_Reel2_Bets[])(void) = { - sub_8103564, - j5_08111E84, - sub_8103668 + DecideReelTurns_NoBiasTag_Reel2_Bet1, + DecideReelTurns_NoBiasTag_Reel2_Bet2, + DecideReelTurns_NoBiasTag_Reel2_Bet3 }; void (*const gUnknown_083ECB94[])(void) = @@ -572,57 +574,57 @@ void (*const gUnknown_083ECBB4[])(struct Task *task) = sub_81041AC }; -const u16 gUnknown_083ECBC4[][2] = +const u16 pikaPowerTileTable[][2] = { - {0x9e, 0x6e}, - {0x9f, 0x6f}, - {0xaf, 0x7f}, + {0x9e, 0x6e}, // {0b10011110, 0b1101110} + {0x9f, 0x6f}, // {0b10011111, 0b1101111} + {0xaf, 0x7f}, // {0b10101111, 0b1111111} }; -void (*const gUnknown_083ECBD0[])(struct Task *task) = +void (*const ReelTimeActions[])(struct Task *task) = { - sub_810437C, - sub_81043EC, - sub_8104468, - sub_8104498, - sub_8104548, - sub_8104598, - sub_81045CC, - sub_810463C, - sub_81046C0, - sub_8104764, - sub_8104794, - sub_81047EC, - sub_8104860, - sub_81048A8, - sub_81048CC, - sub_8104940, - sub_81049C8, - sub_8104794, - sub_81049F8 + ReelTimeAction1, + ReelTimeAction2, + ReelTimeAction3, + ReelTimeAction4, + ReelTimeAction5, + ReelTimeAction6, + ReelTimeAction7, // does stuff with reel time data + ReelTimeAction_LandOnOutcome, + ReelTimeAction9, + ReelTimeAction10, + ReelTimeAction11, + ReelTimeAction12, + ReelTimeAction13, + ReelTimeAction14, + ReelTimeAction15, + ReelTimeAction16, + ReelTimeAction17, + ReelTimeAction11, + ReelTimeAction18 }; const u8 gUnknown_085A75C0[] = {1, 1, 2, 2}; const s16 gUnknown_085A75C4[] = {0x40, 0x30, 0x18, 0x08}; const s16 gUnknown_085A75CC[] = {10, 8, 6, 4}; -void (*const gUnknown_083ECC30[])(struct Task *task) = +void (*const InfoBoxActions[])(struct Task *task) = { - sub_8104B3C, - sub_8104B60, - sub_8104B80, - sub_8104B60, - sub_812DD78, - sub_8104B60, - sub_8104BC8, - sub_8104B60, - sub_812DE14, - sub_8104B60, - sub_812DE30, - sub_8104B60, - sub_8104BFC, - sub_8104B60, - sub_8104C44, + InfoBox_FadeIn, + InfoBox_WaitForFade, + InfoBox_8104B80, + InfoBox_WaitForFade, + InfoBox_AddText, + InfoBox_WaitForFade, + InfoBox_AwaitPlayerInput, + InfoBox_WaitForFade, + InfoBox_812DE14, + InfoBox_WaitForFade, + InfoBox_812DE30, + InfoBox_WaitForFade, + InfoBox_8104BFC, + InfoBox_WaitForFade, + InfoBox_FreeTask, }; void (*const gUnknown_083ECC54[])(struct Task *task) = @@ -669,12 +671,12 @@ extern const struct SpriteTemplate gSpriteTemplate_83ED45C; } } -void PlaySlotMachine(u8 arg0, MainCallback cb) +void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinueScriptPlayMapMusic) { u8 taskId; sSlotMachine = AllocZeroed(sizeof(*sSlotMachine)); - PlaySlotMachine_Internal(arg0, cb); + PlaySlotMachine_Internal(slotMachineIndex, CB2_ReturnToFieldContinueScriptPlayMapMusic); taskId = CreateTask(Task_FadeToSlotMachine, 0); gTasks[taskId].tState = 0; } @@ -733,7 +735,7 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) break; case 10: SlotMachineSetup_10_0(); - SlotMachineSetup_10_1(); + SlotMachineSetupGameplayTasks(); gMain.state++; break; case 11: @@ -761,17 +763,18 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) SetGpuReg(REG_OFFSET_WINOUT, sSlotMachine->winOut); } -/*static */void PlaySlotMachine_Internal(u8 arg0, MainCallback cb) +/*static */void PlaySlotMachine_Internal(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinueScriptPlayMapMusic) { struct Task *task = gTasks + CreateTask(SlotMachineDummyTask, 0xFF); - task->data[0] = arg0; - StoreWordInTwoHalfwords(task->data + 1, (intptr_t)cb); + task->data[0] = slotMachineIndex; + StoreWordInTwoHalfwords(task->data + 1, (intptr_t)CB2_ReturnToFieldContinueScriptPlayMapMusic); } + /*static */void sub_81019EC(void) { struct Task *task = gTasks + FindTaskIdByFunc(SlotMachineDummyTask); - sSlotMachine->unk01 = task->data[0]; + sSlotMachine->machineId = task->data[0]; LoadWordFromTwoHalfwords((u16 *)(task->data + 1), (u32 *)&sSlotMachine->prevMainCb); } @@ -827,37 +830,40 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(9, 8)); } +// set up initial state of slot machine /*static */void SlotMachineSetup_0_1(void) { u8 i; - sub_81019EC(); - sSlotMachine->state = 0; + sub_81019EC(); // assigns sSlotMachine->machineId and other stuff + sSlotMachine->slotActionPtr = 0; sSlotMachine->pikaPower = 0; - sSlotMachine->unk03 = Random() & 1; - sSlotMachine->unk04 = 0; + sSlotMachine->luckyGame = Random() & 1; + sSlotMachine->luckyFlags = 0; sSlotMachine->matchedSymbols = 0; - sSlotMachine->unk0A = 0; - sSlotMachine->unk0B = 0; + sSlotMachine->fairRollsLeft = 0; + sSlotMachine->fairRollsUsed = 0; sSlotMachine->coins = GetCoins(); sSlotMachine->payout = 0; - sSlotMachine->unk10 = 0; + sSlotMachine->netCoinLoss = 0; sSlotMachine->bet = 0; - sSlotMachine->unk18 = 0; - sSlotMachine->unk1A = 8; + sSlotMachine->currReel = 0; + sSlotMachine->reelIncrement = 8; sSlotMachine->win0h = 0xf0; sSlotMachine->win0v = 0xa0; sSlotMachine->winIn = 0x3f; sSlotMachine->winOut = 0x3f; sSlotMachine->backupMapMusic = GetCurrentMapMusic(); + + // for each reel... for (i = 0; i < 3; i++) { - sSlotMachine->unk22[i] = 0; - sSlotMachine->reelPositions[i] = gUnknown_083ECCF8[i][sSlotMachine->unk03] % 21; - sSlotMachine->unk1C[i] = 0x1f8 - sSlotMachine->reelPositions[i] * 24; - sSlotMachine->unk1C[i] %= 0x1f8; + sSlotMachine->stopReelPixelOffset[i] = 0; + sSlotMachine->reelPositions[i] = sInitialReelPositions[i][sSlotMachine->luckyGame] % REEL_NUM_TAGS; + sSlotMachine->reelPixelOffsets[i] = 0x1f8 - sSlotMachine->reelPositions[i] * 24; + sSlotMachine->reelPixelOffsets[i] %= 0x1f8; // 0x1f8 is 540 } - sub_80EDE70(GetCoins()); + reportPlayedSlotMachine(GetCoins()); } /*static */void SlotMachineSetup_3_0(void) @@ -871,10 +877,11 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) /*static */void SlotMachineSetup_4_0(void) { - gUnknown_0203AACC = Alloc(8); + selectedPikaPowerTile = Alloc(8); gUnknown_0203AAD0 = AllocZeroed(0xE); gUnknown_0203AADC = AllocZeroed(8); + // several of these are 1 bit off from each other gUnknown_0203AAD0[0] = 0x2051; gUnknown_0203AAD0[1] = 0x2851; gUnknown_0203AAD0[2] = 0x2061; @@ -884,6 +891,7 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) gUnknown_0203AAD0[6] = 0x20BF; } +// machine wheel stuff /*static */void SlotMachineSetup_5_0(void) { sub_8106448(); @@ -902,98 +910,100 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) sub_81050C4(); } -/*static */void SlotMachineSetup_10_1(void) +// create next gameplay task +/*static */void SlotMachineSetupGameplayTasks(void) { sub_8104048(); - sub_8102DA8(); + GameplayTask_StopReel(); sub_8104C5C(); - sub_8101D04(); + GameplayTasks_Slot(); } -/*static */void sub_8101D04(void) +/*static */void GameplayTasks_Slot(void) { - sub_8101D24(CreateTask(sub_8101D24, 0)); + RunSlotActions(CreateTask(RunSlotActions, 0)); } -/*static */void sub_8101D24(u8 taskId) +// task->data[0] is a timer +/*static */void RunSlotActions(u8 taskId) { - while (gUnknown_083ECAAC[sSlotMachine->state](gTasks + taskId)) + while (SlotActions[sSlotMachine->slotActionPtr](gTasks + taskId)) ; } -/*static */bool8 sub_8101D5C(struct Task *task) +/*static */bool8 SlotAction_UnfadeScreen(struct Task *task) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); sub_810423C(sSlotMachine->pikaPower); - sSlotMachine->state++; + sSlotMachine->slotActionPtr++; return FALSE; } -/*static */bool8 sub_8101D8C(struct Task *task) +/*static */bool8 SlotAction_WaitForUnfade(struct Task *task) { if (!gPaletteFade.active) - sSlotMachine->state++; + sSlotMachine->slotActionPtr++; return FALSE; } -/*static */bool8 sub_8101DB0(struct Task *task) +/*static */bool8 SlotAction_SetSlotMachineVars(struct Task *task) { sSlotMachine->payout = 0; sSlotMachine->bet = 0; - sSlotMachine->unk18 = 0; - sSlotMachine->unk04 &= 0xc0; - sSlotMachine->state = 4; + sSlotMachine->currReel = 0; + sSlotMachine->luckyFlags &= 0xc0; // discard all but top 2 flags + sSlotMachine->slotActionPtr = 4; if (sSlotMachine->coins <= 0) { - sSlotMachine->state = 25; + sSlotMachine->slotActionPtr = 25; } - else if (sSlotMachine->unk0A) + else if (sSlotMachine->fairRollsLeft) { - sSlotMachine->state = 3; + sSlotMachine->slotActionPtr = 3; sub_8104CAC(4); } return TRUE; } -/*static */bool8 sub_8101DF4(struct Task *task) +/*static */bool8 SlotAction3(struct Task *task) { if (sub_8104E18()) - sSlotMachine->state = 4; + sSlotMachine->slotActionPtr = 4; return FALSE; } -/*static */bool8 sub_8101E10(struct Task *task) +/*static */bool8 SlotAction4(struct Task *task) { sub_8104CAC(0); - sSlotMachine->state = 5; + sSlotMachine->slotActionPtr = 5; if (sSlotMachine->coins >= 9999) - sSlotMachine->state = 23; + sSlotMachine->slotActionPtr = 23; return TRUE; } -/*static */bool8 sub_8101E3C(struct Task *task) +/*static */bool8 SlotAction_AwaitPlayerInput(struct Task *task) { s16 i; if (gMain.newKeys & SELECT_BUTTON) { - sub_8104AB8(0); - sSlotMachine->state = 8; + OpenInfoBox(0); + sSlotMachine->slotActionPtr = 8; } - else if (gMain.newKeys & R_BUTTON) + else if (gMain.newKeys & R_BUTTON) // bet the max amount { if (sSlotMachine->coins - (3 - sSlotMachine->bet) >= 0) { for (i = sSlotMachine->bet; i < 3; i++) - sub_8103D50(i); + LoadBetTiles(i); sSlotMachine->coins -= (3 - sSlotMachine->bet); sSlotMachine->bet = 3; - sSlotMachine->state = 9; + sSlotMachine->slotActionPtr = 9; PlaySE(SE_REGI); } - else + else // you didn't have enough coins to bet the max { - sSlotMachine->state = 6; + sSlotMachine->slotActionPtr = 6; } } else @@ -1001,135 +1011,145 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) if (gMain.newKeys & DPAD_DOWN && sSlotMachine->coins != 0) { PlaySE(SE_REGI); - sub_8103D50(sSlotMachine->bet); + LoadBetTiles(sSlotMachine->bet); sSlotMachine->coins--; sSlotMachine->bet++; } + // if player maxed out or finished betting if (sSlotMachine->bet >= 3 || (sSlotMachine->bet != 0 && gMain.newKeys & A_BUTTON)) - sSlotMachine->state = 9; + sSlotMachine->slotActionPtr = 9; + // if player wants to quit if (gMain.newKeys & B_BUTTON) - sSlotMachine->state = 21; + sSlotMachine->slotActionPtr = 21; } return FALSE; } -/*static */bool8 sub_8101F44(struct Task *task) +/*static */bool8 SlotAction_PrintYouDontHaveThreeCoins(struct Task *task) { NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_YouDontHaveThreeCoins, 0, 1, 0, 0); CopyWindowToVram(0, 3); - sSlotMachine->state = 7; + sSlotMachine->slotActionPtr = 7; return FALSE; } -/*static */bool8 sub_8101F60(struct Task *task) +/*static */bool8 SlotAction_PlayerAcceptsNotHavingThreeCoins(struct Task *task) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { sub_8197434(0, TRUE); - sSlotMachine->state = 5; + sSlotMachine->slotActionPtr = 5; } return FALSE; } -/*static */bool8 sub_8101F88(struct Task *task) +/*static */bool8 SlotAction_GivingInformation(struct Task *task) { - if (sub_8104AEC()) - sSlotMachine->state = 5; + if (ClosedInfoBox()) + sSlotMachine->slotActionPtr = 5; return FALSE; } -/*static */bool8 sub_8101FA4(struct Task *task) +// probably make all the slots roll +/*static */bool8 SlotAction9(struct Task *task) { - sub_8102484(); + DrawForLuckyFlags(); sub_8104DA4(); - sub_8102DEC(0); - sub_8102DEC(1); - sub_8102DEC(2); - sub_80EEC80(); + // for each reel... + //...do a reel task + ReelTasks_8102DEC(0); + ReelTasks_8102DEC(1); + ReelTasks_8102DEC(2); + sub_80EEC80(); // something with daily slot variable task->data[0] = 0; - if (sSlotMachine->unk04 & 0x20) + if (sSlotMachine->luckyFlags & 0x20) // bit 5 of luckyFlag set { - sub_810430C(); - sSlotMachine->state = 10; + // enter into reel time + BeginReelTime(); + sSlotMachine->slotActionPtr = 10; } else { sub_8104CAC(1); - sSlotMachine->state = 11; + sSlotMachine->slotActionPtr = 11; } - sSlotMachine->unk1A = 8; - if (sSlotMachine->unk0A) - sSlotMachine->unk1A = dp15_jump_random_unknown(); + sSlotMachine->reelIncrement = 8; + if (sSlotMachine->fairRollsLeft) + // slow down the reel speed if you're really losing + sSlotMachine->reelIncrement = DrawNewReelIncrement(); return FALSE; } -/*static */bool8 sub_8102008(struct Task *task) +/*static */bool8 SlotAction10(struct Task *task) { - if (sub_810432C()) + if (IsFinalTask_RunReelTimeActions()) { sub_8104CAC(1); - sSlotMachine->unk04 &= 0xDF; - sSlotMachine->state = 11; + // unset enter reel time flag + sSlotMachine->luckyFlags &= 0xDF; + sSlotMachine->slotActionPtr = 11; } return FALSE; } -/*static */bool8 sub_8102034(struct Task *task) +/*static */bool8 SlotAction11(struct Task *task) { if (++task->data[0] >= 30) { - sub_81024F0(); - sSlotMachine->state = 12; + AnyLuckyFlagsSet(); + sSlotMachine->slotActionPtr = 12; } return FALSE; } -/*static */bool8 sub_8102058(struct Task *task) +/*static */bool8 SlotAction_AwaitReelStop(struct Task *task) { if (gMain.newKeys & A_BUTTON) { PlaySE(SE_JYUNI); - sub_8102E1C(sSlotMachine->unk18); - sub_8103C14(sSlotMachine->unk18); - sSlotMachine->state = 13; + sub_8102E1C(sSlotMachine->currReel); + sub_8103C14(sSlotMachine->currReel); + sSlotMachine->slotActionPtr = 13; } return FALSE; } -/*static */bool8 sub_8102090(struct Task *task) +/*static */bool8 SlotAction_WaitForAllReelsToStop(struct Task *task) { - if (!sub_8102E40(sSlotMachine->unk18)) + if (!IsReelMoving(sSlotMachine->currReel)) { - sSlotMachine->unk18++; - sSlotMachine->state = 12; - if (sSlotMachine->unk18 > 2) + sSlotMachine->currReel++; + sSlotMachine->slotActionPtr = 12; + if (sSlotMachine->currReel > 2) { - sSlotMachine->state = 14; + sSlotMachine->slotActionPtr = 14; } return TRUE; } return FALSE; } -/*static */bool8 sub_81020C8(struct Task *task) +// once all reels have stopped +/*static */bool8 SlotAction_CheckMatches(struct Task *task) { - sSlotMachine->unk04 &= 0xc0; + // keep top 2 bits of luckyFlags + sSlotMachine->luckyFlags &= 0xc0; CheckMatch(); - if (sSlotMachine->unk0A) + if (sSlotMachine->fairRollsLeft) { - sSlotMachine->unk0A--; - sSlotMachine->unk0B++; + sSlotMachine->fairRollsLeft--; + sSlotMachine->fairRollsUsed++; } if (sSlotMachine->matchedSymbols) { - sSlotMachine->state = 15; - sub_8102A24(); + sSlotMachine->slotActionPtr = 15; + AwardPayout(); sub_8103F70(); - if ((sSlotMachine->unk10 -= sSlotMachine->payout) < 0) + if ((sSlotMachine->netCoinLoss -= sSlotMachine->payout) < 0) { - sSlotMachine->unk10 = 0; + sSlotMachine->netCoinLoss = 0; } if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_BLUE) | (1 << SLOT_MACHINE_MATCHED_777_RED))) { @@ -1148,190 +1168,193 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) } if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_MIXED) | (1 << SLOT_MACHINE_MATCHED_777_BLUE) | (1 << SLOT_MACHINE_MATCHED_777_RED))) { - sSlotMachine->unk04 &= 0x3f; + // clear top bits 6 and 7 + sSlotMachine->luckyFlags &= 0x3f; if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_BLUE) | (1 << SLOT_MACHINE_MATCHED_777_RED))) { - sSlotMachine->unk0A = 0; - sSlotMachine->unk0B = 0; - sSlotMachine->unk03 = 0; + sSlotMachine->fairRollsLeft = 0; + sSlotMachine->fairRollsUsed = 0; + sSlotMachine->luckyGame = 0; if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_777_BLUE)) - sSlotMachine->unk03 = 1; + // this may be a bug, but if you get blue 777, the game becomes lucky + sSlotMachine->luckyGame = 1; } } if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_POWER) && sSlotMachine->pikaPower < 16) { sSlotMachine->pikaPower++; - sub_8104064(sSlotMachine->pikaPower); + DisplayPikaPower(sSlotMachine->pikaPower); } } else { sub_8104CAC(3); - sSlotMachine->state = 20; - if ((sSlotMachine->unk10 += sSlotMachine->bet) > 9999) - sSlotMachine->unk10 = 9999; + sSlotMachine->slotActionPtr = 20; + if ((sSlotMachine->netCoinLoss += sSlotMachine->bet) > 9999) + sSlotMachine->netCoinLoss = 9999; } return FALSE; } -/*static */bool8 sub_81021E0(struct Task *task) +/*static */bool8 SlotAction_WaitForPayoutToBeAwarded(struct Task *task) { - if (sub_8102A44()) - sSlotMachine->state = 16; + if (IsFinalTask_RunAwardPayoutActions()) + sSlotMachine->slotActionPtr = 16; return FALSE; } -/*static */bool8 sub_81021FC(struct Task *task) +/*static */bool8 SlotAction_EndOfRoll(struct Task *task) { if (sub_8103FA0()) { - sSlotMachine->state = 19; + sSlotMachine->slotActionPtr = 19; if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_RED) | (1 << SLOT_MACHINE_MATCHED_777_BLUE))) IncrementGameStat(GAME_STAT_SLOT_JACKPOTS); if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) { - sSlotMachine->unk18 = 0; - sSlotMachine->state = 9; + sSlotMachine->currReel = 0; + sSlotMachine->slotActionPtr = 9; } if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_POWER)) - sSlotMachine->state = 17; - if (sSlotMachine->unk0A && sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) + sSlotMachine->slotActionPtr = 17; + if (sSlotMachine->fairRollsLeft && sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) { sub_8104CAC(4); - sSlotMachine->state = 18; + sSlotMachine->slotActionPtr = 18; } } return FALSE; } -/*static */bool8 sub_8102264(struct Task *task) +/*static */bool8 SlotAction17(struct Task *task) { if (!sub_81040C8()) { - sSlotMachine->state = 19; + sSlotMachine->slotActionPtr = 19; if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) { - sSlotMachine->state = 9; - if (sSlotMachine->unk0A) + sSlotMachine->slotActionPtr = 9; + if (sSlotMachine->fairRollsLeft) { sub_8104CAC(4); - sSlotMachine->state = 18; + sSlotMachine->slotActionPtr = 18; } } } return FALSE; } -/*static */bool8 sub_81022A0(struct Task *task) +/*static */bool8 SlotAction18(struct Task *task) { if (sub_8104E18()) { - sSlotMachine->state = 19; + sSlotMachine->slotActionPtr = 19; if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) { - sSlotMachine->state = 9; + sSlotMachine->slotActionPtr = 9; } } return FALSE; } -/*static */bool8 sub_81022CC(struct Task *task) +/*static */bool8 SlotAction_Loop(struct Task *task) { sub_8103D8C(0); sub_8103D8C(1); sub_8103D8C(2); - sSlotMachine->state = 2; + sSlotMachine->slotActionPtr = 2; return FALSE; } -/*static */bool8 sub_81022F0(struct Task *task) +/*static */bool8 SlotAction_NoMatches(struct Task *task) { if (++task->data[1] > 64) { task->data[1] = 0; - sSlotMachine->state = 19; + sSlotMachine->slotActionPtr = 19; } return FALSE; } -/*static */bool8 sub_8102318(struct Task *task) +/*static */bool8 SlotAction_PrintQuitTheGame(struct Task *task) { NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_QuitTheGame, 0, 1, 0, 0); CopyWindowToVram(0, 3); CreateYesNoMenuParameterized(0x15, 7, 0x214, 0x180, 0xE, 0xF); - sSlotMachine->state = 22; + sSlotMachine->slotActionPtr = 22; return FALSE; } -/*static */bool8 sub_8102344(struct Task *task) +/*static */bool8 SlotAction_SeeIfPlayerQuits(struct Task *task) { s8 input = Menu_ProcessInputNoWrapClearOnChoose(); - if (input == 0) + if (input == 0) // player chooses to quit { sub_8197434(0, TRUE); sub_8103D8C(0); sub_8103D8C(1); sub_8103D8C(2); sSlotMachine->coins += sSlotMachine->bet; - sSlotMachine->state = 27; + sSlotMachine->slotActionPtr = 27; } - else if (input == 1 || input == -1) + else if (input == 1 || input == -1) // player chooses not to quit { sub_8197434(0, TRUE); - sSlotMachine->state = 5; + sSlotMachine->slotActionPtr = 5; } return FALSE; } -/*static */bool8 sub_810239C(struct Task *task) +/*static */bool8 SlotAction_Print9999CoinMessage(struct Task *task) { NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_YouveGot9999Coins, 0, 1, 0, 0); CopyWindowToVram(0, 3); - sSlotMachine->state = 24; + sSlotMachine->slotActionPtr = 24; return FALSE; } -/*static */bool8 sub_81023B8(struct Task *task) +/*static */bool8 SlotAction_Escape9999CoinMessage(struct Task *task) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { sub_8197434(0, TRUE); - sSlotMachine->state = 5; + sSlotMachine->slotActionPtr = 5; } return FALSE; } -/*static */bool8 sub_81023E0_(struct Task *task) +/*static */bool8 SlotAction_PrintNoMoreCoins(struct Task *task) { NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_YouveRunOutOfCoins, 0, 1, 0, 0); CopyWindowToVram(0, 3); - sSlotMachine->state = 26; + sSlotMachine->slotActionPtr = 26; return FALSE; } -/*static */bool8 sub_81023FC(struct Task *task) +/*static */bool8 SlotAction_EscapeNoMoreCoins(struct Task *task) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { sub_8197434(0, TRUE); - sSlotMachine->state = 27; + sSlotMachine->slotActionPtr = 27; } return FALSE; } -/*static */bool8 sub_8102424(struct Task *task) +// possibly end game +/*static */bool8 SlotAction_EndGame(struct Task *task) { SetCoins(sSlotMachine->coins); - sub_80EDD78(GetCoins()); + reportNewCoinTotal(GetCoins()); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); - sSlotMachine->state++; + sSlotMachine->slotActionPtr++; return FALSE; } -/*static */bool8 sub_8102460(struct Task *task) +/*static */bool8 SlotAction_FreeDataStructures(struct Task *task) { if (!gPaletteFade.active) { @@ -1359,7 +1382,7 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) if (gUnknown_0203AAF0 != NULL) FREE_AND_SET_NULL(gUnknown_0203AAF0); FREE_AND_SET_NULL(gUnknown_0203AAC8); - FREE_AND_SET_NULL(gUnknown_0203AACC); + FREE_AND_SET_NULL(selectedPikaPowerTile); FREE_AND_SET_NULL(gUnknown_0203AAD0); FREE_AND_SET_NULL(gUnknown_0203AAD4); FREE_AND_SET_NULL(gUnknown_0203AAD8); @@ -1373,157 +1396,161 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) return FALSE; } -/*static */void sub_8102484(void) +/*static */void DrawForLuckyFlags(void) { - u8 r3; + u8 luckyAttempts; - if (sSlotMachine->unk0A == 0) + if (sSlotMachine->fairRollsLeft == 0) { - if (!(sSlotMachine->unk04 & 0xc0)) + if (!(sSlotMachine->luckyFlags & 0xc0)) // top 2 flags set to 0 { - if (sub_8102540_()) + if (IsLuckyRound()) { - r3 = sub_8102578(); - if (r3 != 3) + luckyAttempts = AttemptsAtLuckiness1(); + if (luckyAttempts != 3) // if you found a lucky number { - sSlotMachine->unk04 |= gUnknown_083ECE42[r3]; - if (r3 != 1) + // luckyAttempts == 1: reelTime flag set + sSlotMachine->luckyFlags |= FlagsAttemptAtLuckiness1[luckyAttempts]; + if (luckyAttempts != 1) { return; } } } - r3 = sub_81025BC(); - if (r3 != 5) + // if you got it your first try, you get to try again for the lower lucky flags + luckyAttempts = AttemptsAtLuckiness2(); + if (luckyAttempts != 5) // if you found a lucky number { - sSlotMachine->unk04 |= gUnknown_083ECE48[r3]; + sSlotMachine->luckyFlags |= FlagsAttemptAtLuckiness2[luckyAttempts]; } } } } -/*static */void sub_81024F0(void) +/*static */void AnyLuckyFlagsSet(void) { - sSlotMachine->unk06 = 0; - if (sSlotMachine->unk04) - sSlotMachine->unk06 = 1; + sSlotMachine->isBiasTagMatchPossible = 0; + if (sSlotMachine->luckyFlags) + sSlotMachine->isBiasTagMatchPossible = 1; } -/*static */u8 sub_810250C(u8 a0) +/*static */u8 GetLuckyFlagTagOutput(u8 luckyFlags) { u8 i; for (i = 0; i < 8; i++) { - if (a0 & 1) - return gUnknown_083ECE3A[i]; - a0 >>= 1; + if (luckyFlags & 1) + return LuckyFlagTagOutput[i]; + luckyFlags >>= 1; } return 0; } -/*static */bool8 sub_8102540_(void) +/*static */bool8 IsLuckyRound(void) { u8 rval = Random(); - if (gUnknown_083ECD04[sSlotMachine->unk01][sSlotMachine->bet - 1] > rval) + if (sSlotLuckinessTable1[sSlotMachine->machineId][sSlotMachine->bet - 1] > rval) return TRUE; return FALSE; } -/*static */u8 sub_8102578(void) +/*static */u8 AttemptsAtLuckiness1(void) { - s16 i; + s16 countAttempts; - for (i = 0; i < 3; i++) + for (countAttempts = 0; countAttempts < 3; countAttempts++) { s16 rval = Random() & 0xff; - s16 value = gUnknown_083ECD16[i][sSlotMachine->unk01]; + s16 value = sSlotLuckinessTable2[countAttempts][sSlotMachine->machineId]; if (value > rval) break; } - return i; + return countAttempts; } -/*static */u8 sub_81025BC(void) +/*static */u8 AttemptsAtLuckiness2(void) { - s16 i; + s16 countAttempts; - for (i = 0; i < 5; i++) + for (countAttempts = 0; countAttempts < 5; countAttempts++) { - s16 rval = Random() & 0xff; - s16 r3 = gUnknown_083ECD28[i][sSlotMachine->unk01]; - if (i == 0 && sSlotMachine->unk03 == 1) + s16 rval = Random() & 0xff; // random byte + s16 value = sSlotLuckinessTable3[countAttempts][sSlotMachine->machineId]; + // make first attempt easier if it's a lucky game + if (countAttempts == 0 && sSlotMachine->luckyGame == 1) { - r3 += 10; - if (r3 > 0x100) - r3 = 0x100; + value += 10; + if (value > 0x100) + value = 0x100; } - else if (i == 4 && sSlotMachine->unk03 == 1) + // make last attempt harder if it's a lucky game + else if (countAttempts == 4 && sSlotMachine->luckyGame == 1) { - r3 -= 10; - if (r3 < 0) - r3 = 0; + value -= 10; + if (value < 0) + value = 0; } - if (r3 > rval) + if (value > rval) break; } - return i; + return countAttempts; } -/*static */u8 sub_810264C(u8 a0) +/*static */u8 GetReelTimeProbability(u8 reelTimeDraw) { - if (sSlotMachine->unk03 == 0) - return gUnknown_083ECD46[a0][sSlotMachine->pikaPower]; + if (sSlotMachine->luckyGame == 0) + return ReelTimeProbabilityTable0[reelTimeDraw][sSlotMachine->pikaPower]; else - return gUnknown_083ECDAC[a0][sSlotMachine->pikaPower]; + return ReelTimeProbabilityTable1[reelTimeDraw][sSlotMachine->pikaPower]; } -/*static */void sub_8102680(void) +/*static */void DrawReelTimeOutcome(void) { u8 rval; - s16 i; + s16 reelTimeDraw; - sSlotMachine->unk05 = 0; + sSlotMachine->reelTimeDraw = 0; rval = Random(); - if (rval < sub_810264C(0)) + if (rval < GetReelTimeProbability(0)) return; - for (i = 5; i > 0; i--) + for (reelTimeDraw = 5; reelTimeDraw > 0; reelTimeDraw--) { rval = Random(); - if (rval < sub_810264C(i)) + if (rval < GetReelTimeProbability(reelTimeDraw)) break; } - sSlotMachine->unk05 = i; + sSlotMachine->reelTimeDraw = reelTimeDraw; } -/*static */bool8 sub_81026DC(u16 a0) +/*static */bool8 SkipToReelTimeAction14(u16 i) { u16 rval = Random() & 0xff; - if (rval < gUnknown_083ECE12[a0]) + if (rval < ProbabilityTable_SkipToReelTimeAction14[i]) return TRUE; else return FALSE; } -/*static */u16 dp15_jump_random_unknown(void) +/*static */u16 DrawNewReelIncrement(void) { - u8 r4 = 0; + u8 i = 0; u8 rval; u8 value; - if (sSlotMachine->unk10 >= 300) - r4 = 4; - else if (sSlotMachine->unk10 >= 250) - r4 = 3; - else if (sSlotMachine->unk10 >= 200) - r4 = 2; - else if (sSlotMachine->unk10 >= 150) - r4 = 1; + if (sSlotMachine->netCoinLoss >= 300) + i = 4; + else if (sSlotMachine->netCoinLoss >= 250) + i = 3; + else if (sSlotMachine->netCoinLoss >= 200) + i = 2; + else if (sSlotMachine->netCoinLoss >= 150) + i = 1; rval = Random() % 100; - value = gUnknown_083ECE1C[r4][0]; + value = ReelIncrementTable[i][0]; if (rval < value) return 4; rval = Random() % 100; - value = gUnknown_083ECE1C[r4][1] + gUnknown_083ECE30[sSlotMachine->unk0B]; + value = ReelIncrementTable[i][1] + ReelTimeBonusIncrementTable[sSlotMachine->fairRollsUsed]; if (rval < value) return 2; return 8; @@ -1543,9 +1570,9 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) { u8 c1, c2, c3, match; - c1 = GetTagOfReelSymbolOnScreenAtPos(0, 2); - c2 = GetTagOfReelSymbolOnScreenAtPos(1, 2); - c3 = GetTagOfReelSymbolOnScreenAtPos(2, 2); + c1 = GetNearbyTag(0, 2); + c2 = GetNearbyTag(1, 2); + c3 = GetNearbyTag(2, 2); match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { @@ -1559,9 +1586,9 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) { u8 c1, c2, c3, match; - c1 = GetTagOfReelSymbolOnScreenAtPos(0, 1); - c2 = GetTagOfReelSymbolOnScreenAtPos(1, 1); - c3 = GetTagOfReelSymbolOnScreenAtPos(2, 1); + c1 = GetNearbyTag(0, 1); + c2 = GetNearbyTag(1, 1); + c3 = GetNearbyTag(2, 1); match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { @@ -1571,9 +1598,9 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) sSlotMachine->matchedSymbols |= sSlotMatchFlags[match]; sub_8103E04(1); } - c1 = GetTagOfReelSymbolOnScreenAtPos(0, 3); - c2 = GetTagOfReelSymbolOnScreenAtPos(1, 3); - c3 = GetTagOfReelSymbolOnScreenAtPos(2, 3); + c1 = GetNearbyTag(0, 3); + c2 = GetNearbyTag(1, 3); + c3 = GetNearbyTag(2, 3); match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { @@ -1589,9 +1616,9 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) { u8 c1, c2, c3, match; - c1 = GetTagOfReelSymbolOnScreenAtPos(0, 1); - c2 = GetTagOfReelSymbolOnScreenAtPos(1, 2); - c3 = GetTagOfReelSymbolOnScreenAtPos(2, 3); + c1 = GetNearbyTag(0, 1); + c2 = GetNearbyTag(1, 2); + c3 = GetNearbyTag(2, 3); match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { @@ -1602,9 +1629,9 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) } sub_8103E04(3); } - c1 = GetTagOfReelSymbolOnScreenAtPos(0, 3); - c2 = GetTagOfReelSymbolOnScreenAtPos(1, 2); - c3 = GetTagOfReelSymbolOnScreenAtPos(2, 1); + c1 = GetNearbyTag(0, 3); + c2 = GetNearbyTag(1, 2); + c3 = GetNearbyTag(2, 1); match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { @@ -1630,26 +1657,26 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) return SLOT_MACHINE_MATCHED_NONE; } -/*static */void sub_8102A24(void) +/*static */void AwardPayout(void) { - sub_8102A64(CreateTask(sub_8102A64, 4)); + RunAwardPayoutActions(CreateTask(RunAwardPayoutActions, 4)); } -/*static */bool8 sub_8102A44(void) +/*static */bool8 IsFinalTask_RunAwardPayoutActions(void) { - if (FindTaskIdByFunc(sub_8102A64) == 0xFF) + if (FindTaskIdByFunc(RunAwardPayoutActions) == TAIL_SENTINEL) return TRUE; else return FALSE; } -/*static */void sub_8102A64(u8 taskId) +/*static */void RunAwardPayoutActions(u8 taskId) { - while (gUnknown_083ECB20[gTasks[taskId].data[0]](gTasks + taskId)) + while (AwardPayoutActions[gTasks[taskId].data[0]](gTasks + taskId)) ; } -/*static */bool8 sub_8102A9C(struct Task *task) +/*static */bool8 AwardPayoutAction1(struct Task *task) { if (sub_8103E38()) { @@ -1662,8 +1689,8 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) } return FALSE; } - -/*static */bool8 sub_8102AD0(struct Task *task) +// task->data[1]: timer +/*static */bool8 AwardPayoutAction_GivePayoutToPlayer(struct Task *task) { if (!task->data[1]--) { @@ -1689,165 +1716,177 @@ void PlaySlotMachine(u8 arg0, MainCallback cb) return FALSE; } -/*static */bool8 sub_8102B80(struct Task *task) +/*static */bool8 AwardPayoutAction_FreeTask(struct Task *task) { if (sub_8103E7C()) - DestroyTask(FindTaskIdByFunc(sub_8102A64)); + DestroyTask(FindTaskIdByFunc(RunAwardPayoutActions)); return FALSE; } -/*static */u8 GetTagOfReelSymbolOnScreenAtPos(u8 x, s16 y) +/*static */u8 GetNearbyTag(u8 reelIndex, s16 posOffset) { - s16 offset = (sSlotMachine->reelPositions[x] + y) % 21; - if (offset < 0) - offset += 21; - return sReelSymbols[x][offset]; + /* + Returns the tag that is posOffset below the tag at the top of reelIndex's tape + */ + s16 tagIndex = (sSlotMachine->reelPositions[reelIndex] + posOffset) % REEL_NUM_TAGS; + if (tagIndex < 0) + tagIndex += REEL_NUM_TAGS; + return sReelSymbols[reelIndex][tagIndex]; } -/*static */u8 GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(u8 x, s16 y) +// TODO: find out how rounding works +/*static */u8 GetNearbyTag_PixelOffset(u8 reelIndex, s16 posOffset) { - s16 r6 = 0; - s16 result = sSlotMachine->unk1C[x] % 24; + s16 tagOffset = 0; + s16 result = sSlotMachine->reelPixelOffsets[reelIndex] % 24; if (result != 0) - r6 = -1; - return GetTagOfReelSymbolOnScreenAtPos(x, y + r6); + tagOffset = -1; // tag will be posOffset - 1 + return GetNearbyTag(reelIndex, posOffset + tagOffset); } -/*static */u8 sub_8102C48(s16 a0) +// TODO: make sure this is actually what's happening +/*static */u8 GetNthNextReelTimePosition(s16 n) { - s16 r1 = (sSlotMachine->unk16 + a0) % 6; - if (r1 < 0) - r1 += 6; - return gUnknown_083ECCF1[r1]; + s16 newPosition = (sSlotMachine->reelTimePosition + n) % 6; + if (newPosition < 0) + newPosition += 6; + return gUnknown_083ECCF1[newPosition]; } -/*static */void sub_8102C84(u8 a0, s16 a1) +/*static */void IncrementReelPixelOffset(u8 reelIndex, s16 value) { - sSlotMachine->unk1C[a0] += a1; - sSlotMachine->unk1C[a0] %= 504; - sSlotMachine->reelPositions[a0] = 21 - sSlotMachine->unk1C[a0] / 24; + sSlotMachine->reelPixelOffsets[reelIndex] += value; + sSlotMachine->reelPixelOffsets[reelIndex] %= 504; + sSlotMachine->reelPositions[reelIndex] = REEL_NUM_TAGS - sSlotMachine->reelPixelOffsets[reelIndex] / 24; } -s16 sub_8102CCC(u8 a0, s16 a1) +// TODO: make sure that's actually what's happening +s16 AdvanceReelNextTag(u8 reelIndex, s16 reelIncrement) { - s16 r1 = sSlotMachine->unk1C[a0] % 24; - if (r1 != 0) + s16 value = sSlotMachine->reelPixelOffsets[reelIndex] % 24; + if (value != 0) { - if (r1 < a1) - a1 = r1; - sub_8102C84(a0, a1); - r1 = sSlotMachine->unk1C[a0] % 24; + if (value < reelIncrement) + reelIncrement = value; + IncrementReelPixelOffset(reelIndex, reelIncrement); + value = sSlotMachine->reelPixelOffsets[reelIndex] % 24; } - return r1; + return value; } -/*static */void sub_8102D28(s16 a0) +/*static */void IncrementReelTimePixelOffset(s16 value) { - sSlotMachine->unk14 += a0; - sSlotMachine->unk14 %= 120; - sSlotMachine->unk16 = 6 - sSlotMachine->unk14 / 20; + sSlotMachine->reelTimePixelOffset += value; + sSlotMachine->reelTimePixelOffset %= 120; + sSlotMachine->reelTimePosition = 6 - sSlotMachine->reelTimePixelOffset / 20; } -s16 sub_8102D5C(s16 a0) +s16 AdvanceReelTimeNextNumber(s16 reelIncrement) { - s16 r1 = sSlotMachine->unk14 % 20; - if (r1 != 0) + s16 value = sSlotMachine->reelTimePixelOffset % 20; + if (value != 0) { - if (r1 < a0) - a0 = r1; - sub_8102D28(a0); - r1 = sSlotMachine->unk14 % 20; + if (value < reelIncrement) + reelIncrement = value; + IncrementReelTimePixelOffset(reelIncrement); + value = sSlotMachine->reelTimePixelOffset % 20; } - return r1; + return value; } -/*static */void sub_8102DA8(void) +/*static */void GameplayTask_StopReel(void) { u8 i; for (i = 0; i < 3; i++) { - u8 taskId = CreateTask(sub_8102E68, 2); + u8 taskId = CreateTask(RunReelActions, 2); gTasks[taskId].data[15] = i; sSlotMachine->reelTasks[i] = taskId; - sub_8102E68(taskId); + RunReelActions(taskId); } } -/*static */void sub_8102DEC(u8 a0) +/*static */void ReelTasks_8102DEC(u8 reelIndex) { - gTasks[sSlotMachine->reelTasks[a0]].data[0] = 1; - gTasks[sSlotMachine->reelTasks[a0]].data[14] = 1; + gTasks[sSlotMachine->reelTasks[reelIndex]].data[0] = 1; + gTasks[sSlotMachine->reelTasks[reelIndex]].data[14] = 1; } -/*static */void sub_8102E1C(u8 a0) +/*static */void sub_8102E1C(u8 reelIndex) { - gTasks[sSlotMachine->reelTasks[a0]].data[0] = 2; + gTasks[sSlotMachine->reelTasks[reelIndex]].data[0] = 2; } -/*static */bool8 sub_8102E40(u8 a0) +/*static */bool8 IsReelMoving(u8 reelIndex) { - return gTasks[sSlotMachine->reelTasks[a0]].data[14]; + return gTasks[sSlotMachine->reelTasks[reelIndex]].data[14]; } -/*static */void sub_8102E68(u8 taskId) +/*static */void RunReelActions(u8 taskId) { - while (gUnknown_083ECB2C[gTasks[taskId].data[0]](gTasks + taskId)) + while (ReelActions[gTasks[taskId].data[0]](gTasks + taskId)) ; } -/*static */bool8 sub_8102EA0(struct Task *task) +// task->data[1] reel turns +// task->data[15] reelIndex +/*static */bool8 ReelAction_StayStill(struct Task *task) { return FALSE; } -/*static */bool8 sub_8102EA4(struct Task *task) +/*static */bool8 ReelAction_Spin(struct Task *task) { - sub_8102C84(task->data[15], sSlotMachine->unk1A); + IncrementReelPixelOffset(task->data[15], sSlotMachine->reelIncrement); return FALSE; } -/*static */bool8 sub_8102EC0(struct Task *task) +/*static */bool8 ReelAction_DecideWhereToStop(struct Task *task) { task->data[0]++; - sSlotMachine->unk34[task->data[15]] = 0; - sSlotMachine->unk2E[task->data[15]] = 0; - if (sSlotMachine->unk0A == 0 && (sSlotMachine->unk04 == 0 || sSlotMachine->unk06 == 0 || !gUnknown_083ECB40[task->data[15]]())) + // initialize data for that reel --> these will be manipulated if biasTags can be lined up + sSlotMachine->biasTagFinalPositions[task->data[15]] = 0; + sSlotMachine->reelExtraTurns[task->data[15]] = 0; + + if (sSlotMachine->fairRollsLeft == 0 && (sSlotMachine->luckyFlags == 0 || sSlotMachine->isBiasTagMatchPossible == 0 || !DecideReelTurns_BiasTag[task->data[15]]())) { - sSlotMachine->unk06 = 0; - gUnknown_083ECB4C[task->data[15]](); + sSlotMachine->isBiasTagMatchPossible = 0; + DecideReelTurns_NoBiasTag[task->data[15]](); } - task->data[1] = sSlotMachine->unk2E[task->data[15]]; + task->data[1] = sSlotMachine->reelExtraTurns[task->data[15]]; return TRUE; } -/*static */bool8 sub_8102F4C(struct Task *task) +// go to next tag and then do any additional turns +/*static */bool8 ReelAction_TurnToSelectedTag(struct Task *task) { - u16 sp[ARRAY_COUNT(gUnknown_085A74FC)]; - s16 r2; + u16 reelStopShocks[ARRAY_COUNT(ReelStopShocks)]; + s16 reelPixelPos; - memcpy(sp, gUnknown_085A74FC, sizeof(gUnknown_085A74FC)); - r2 = sSlotMachine->unk1C[task->data[15]] % 24; - if (r2 != 0) - r2 = sub_8102CCC(task->data[15], sSlotMachine->unk1A); - else if (sSlotMachine->unk2E[task->data[15]]) + memcpy(reelStopShocks, ReelStopShocks, sizeof(ReelStopShocks)); + reelPixelPos = sSlotMachine->reelPixelOffsets[task->data[15]] % 24; + if (reelPixelPos != 0) + reelPixelPos = AdvanceReelNextTag(task->data[15], sSlotMachine->reelIncrement); + else if (sSlotMachine->reelExtraTurns[task->data[15]]) { - sSlotMachine->unk2E[task->data[15]]--; - sub_8102C84(task->data[15], sSlotMachine->unk1A); - r2 = sSlotMachine->unk1C[task->data[15]] % 24; + sSlotMachine->reelExtraTurns[task->data[15]]--; + IncrementReelPixelOffset(task->data[15], sSlotMachine->reelIncrement); + reelPixelPos = sSlotMachine->reelPixelOffsets[task->data[15]] % 24; } - if (r2 == 0 && sSlotMachine->unk2E[task->data[15]] == 0) + if (reelPixelPos == 0 && sSlotMachine->reelExtraTurns[task->data[15]] == 0) { task->data[0]++; - task->data[1] = sp[task->data[1]]; + task->data[1] = reelStopShocks[task->data[1]]; task->data[2] = 0; } return FALSE; } -/*static */bool8 sub_8103008(struct Task *task) +// make selected tag oscillate before it becomes still +/*static */bool8 ReelAction_OscillatingStop(struct Task *task) { - sSlotMachine->unk22[task->data[15]] = task->data[1]; + sSlotMachine->stopReelPixelOffset[task->data[15]] = task->data[1]; task->data[1] = -task->data[1]; task->data[2]++; if ((task->data[2] & 0x3) == 0) @@ -1856,103 +1895,111 @@ s16 sub_8102D5C(s16 a0) { task->data[0] = 0; task->data[14] = 0; - sSlotMachine->unk22[task->data[15]] = 0; + sSlotMachine->stopReelPixelOffset[task->data[15]] = 0; } return FALSE; } -/*static */bool8 sub_810305C(void) +/*static */bool8 DecideReelTurns_BiasTag_Reel1(void) { - u8 r3 = sub_810250C(sSlotMachine->unk04); - u8 r5 = r3; - if (sSlotMachine->unk04 & 0xc0) + u8 tag2 = GetLuckyFlagTagOutput(sSlotMachine->luckyFlags); + u8 tag1 = tag2; + if (sSlotMachine->luckyFlags & 0xc0) // if either of top 2 bits are set { - r5 = 0; - r3 = 1; + tag1 = SLOT_MACHINE_TAG_7_RED; + tag2 = SLOT_MACHINE_TAG_7_BLUE; } - return gUnknown_083ECB64[sSlotMachine->bet - 1](r5, r3); + return DecideReelTurns_BiasTag_Reel1_Bets[sSlotMachine->bet - 1](tag1, tag2); } -/*static */bool8 sub_81030A4(s16 y, u8 tag1, u8 tag2) +/*static */bool8 IsTag1orTag2AtPosInReel1(s16 pos, u8 tag1, u8 tag2) { - u8 tag = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, y); + u8 tag = GetNearbyTag_PixelOffset(0, pos); if (tag == tag1 || tag == tag2) { - sSlotMachine->unk07 = tag; + sSlotMachine->biasTag = tag; return TRUE; } return FALSE; } -/*static */bool8 sub_81030E0(s16 y) +/*static */bool8 AreCherriesOnScreen_Reel1(s16 offsetFromCenter) { - if (GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, 1 - y) == 4 || GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, 2 - y) == 4 || GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, 3 - y) == 4) + if (GetNearbyTag_PixelOffset(0, 1 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetNearbyTag_PixelOffset(0, 2 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetNearbyTag_PixelOffset(0, 3 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY) return TRUE; else return FALSE; } -/*static */bool8 sub_8103134(void) +/*static */bool8 LuckyFlags_BiasCherryOr7s(void) { - if (sSlotMachine->unk04 & 0xc2) + if (sSlotMachine->luckyFlags & 0xc2) // if any of bits 6, 7, or 1 are set return TRUE; else return FALSE; } -/*static */bool8 sub_8103154(u8 a0, u8 a1) +/*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet1(u8 tag1, u8 tag2) { s16 i; for (i = 0; i < 5; i++) { - if (sub_81030A4(2 - i, a0, a1)) + // if a lucky tag appears in the center row within the next 5 turns + if (IsTag1orTag2AtPosInReel1(2 - i, tag1, tag2)) { - sSlotMachine->unk34[0] = 2; - sSlotMachine->unk2E[0] = i; + sSlotMachine->biasTagFinalPositions[0] = 2; + sSlotMachine->reelExtraTurns[0] = i; return TRUE; } } return FALSE; } -/*static */bool8 sub_81031B4(u8 tag1, u8 tag2) +/*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet2or3(u8 tag1, u8 tag2) { s16 i; - bool8 r6 = sub_8103134(); - if (r6 || !sub_81030E0(0)) + bool8 areLuckyBitsSet = LuckyFlags_BiasCherryOr7s(); + // if lucky numbers or no cherries are currently on screen in reel 1... + if (areLuckyBitsSet || !AreCherriesOnScreen_Reel1(0)) { for (i = 1; i < 4; i++) { - if (sub_81030A4(i, tag1, tag2)) + //...and if a bias tag is currently on the screen + if (IsTag1orTag2AtPosInReel1(i, tag1, tag2)) { - sSlotMachine->unk34[0] = i; - sSlotMachine->unk2E[0] = 0; + sSlotMachine->biasTagFinalPositions[0] = i; + sSlotMachine->reelExtraTurns[0] = 0; return TRUE; } } } for (i = 1; i < 5; i++) { - bool8 r7 = r6; - if (r7 || !sub_81030E0(i)) + bool8 areLuckyBitsSetCopy = areLuckyBitsSet; // redundant + // if lucky numbers or if in the next 4 turns there is a screen with no cherries... + if (areLuckyBitsSetCopy || !AreCherriesOnScreen_Reel1(i)) { - if (sub_81030A4(1 - i, tag1, tag2)) + //...and if a bias tag is in top row of that screen + if (IsTag1orTag2AtPosInReel1(1 - i, tag1, tag2)) { - if (i == 1 && (r7 || !sub_81030E0(3))) + //...and if it only took 1 turn and the lucky tag could also be the bottom row of a screen with no cherries... + if (i == 1 && (areLuckyBitsSetCopy || !AreCherriesOnScreen_Reel1(3))) { - sSlotMachine->unk34[0] = 3; - sSlotMachine->unk2E[0] = 3; + sSlotMachine->biasTagFinalPositions[0] = 3; // maybe how many paths to check + sSlotMachine->reelExtraTurns[0] = 3; // maybe upper limit of turns to advance return TRUE; } - if (i < 4 && (r7 || !sub_81030E0(i + 1))) + //...or if it isn't the last turn and the lucky tag could be in the center row of a screen with no cherries... + if (i < 4 && (areLuckyBitsSetCopy || !AreCherriesOnScreen_Reel1(i + 1))) { - sSlotMachine->unk34[0] = 2; - sSlotMachine->unk2E[0] = i + 1; + sSlotMachine->biasTagFinalPositions[0] = 2; + sSlotMachine->reelExtraTurns[0] = i + 1; return TRUE; } - sSlotMachine->unk34[0] = 1; - sSlotMachine->unk2E[0] = i; + //...else + sSlotMachine->biasTagFinalPositions[0] = 1; + sSlotMachine->reelExtraTurns[0] = i; return TRUE; } } @@ -1960,55 +2007,61 @@ s16 sub_8102D5C(s16 a0) return FALSE; } -/*static */bool8 sub_81032C0(void) +/*static */bool8 DecideReelTurns_BiasTag_Reel2(void) { - return gUnknown_083ECB70[sSlotMachine->bet - 1](); + return DecideReelTurns_BiasTag_Reel2_Bets[sSlotMachine->bet - 1](); } -/*static */bool8 sub_81032E8(void) +/*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet1or2(void) { s16 i; - s16 unk34_0 = sSlotMachine->unk34[0]; + s16 reel1BiasTagFinalPos = sSlotMachine->biasTagFinalPositions[0]; for (i = 0; i < 5; i++) { - if (GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, unk34_0 - i) == sSlotMachine->unk07) + // if biasTag appears in the same row within 5 turns + if (GetNearbyTag_PixelOffset(1, reel1BiasTagFinalPos - i) == sSlotMachine->biasTag) { - sSlotMachine->unk34[1] = unk34_0; - sSlotMachine->unk2E[1] = i; + sSlotMachine->biasTagFinalPositions[1] = reel1BiasTagFinalPos; + sSlotMachine->reelExtraTurns[1] = i; return TRUE; } } return FALSE; } -/*static */bool8 sub_810333C(void) +/*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet3(void) { s16 i; - if (sub_81032E8()) + // if biasTag appears in the same row within 5 turns... + if (DecideReelTurns_BiasTag_Reel2_Bet1or2()) { - if (sSlotMachine->unk34[0] != 2 && sSlotMachine->unk2E[1] > 1 && sSlotMachine->unk2E[1] != 4) + //...and if the biasTag is not in row 2 of reel 1 and if it requires between either 2 or 3 turns to line up the biasTag in row 2... + if (sSlotMachine->biasTagFinalPositions[0] != 2 && sSlotMachine->reelExtraTurns[1] > 1 && sSlotMachine->reelExtraTurns[1] != 4) { for (i = 0; i < 5; i++) { - if (GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, 2 - i) == sSlotMachine->unk07) + //...and if the bias tag will appear in the center row within 5 turns + if (GetNearbyTag_PixelOffset(1, 2 - i) == sSlotMachine->biasTag) { - sSlotMachine->unk34[1] = 2; - sSlotMachine->unk2E[1] = i; + sSlotMachine->biasTagFinalPositions[1] = 2; + sSlotMachine->reelExtraTurns[1] = i; break; } } } return TRUE; } - if (sSlotMachine->unk34[0] != 2) + // else if the biasTag is not in row 2 of reel 1... + if (sSlotMachine->biasTagFinalPositions[0] != 2) { for (i = 0; i < 5; i++) { - if (GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, 2 - i) == sSlotMachine->unk07) + //...and if the biasTag will appear in the center row of reel 2 within 5 turns + if (GetNearbyTag_PixelOffset(1, 2 - i) == sSlotMachine->biasTag) { - sSlotMachine->unk34[1] = 2; - sSlotMachine->unk2E[1] = i; + sSlotMachine->biasTagFinalPositions[1] = 2; + sSlotMachine->reelExtraTurns[1] = i; return TRUE; } } @@ -2016,102 +2069,117 @@ s16 sub_8102D5C(s16 a0) return FALSE; } -/*static */bool8 sub_81033DC(void) +/*static */bool8 DecideReelTurns_BiasTag_Reel3(void) { - u8 r3 = sSlotMachine->unk07; - if (sSlotMachine->unk04 & 0x40) + u8 biasTag = sSlotMachine->biasTag; + // if bit 6 of luckyFlags is set... + if (sSlotMachine->luckyFlags & 0x40) { - r3 = 0; - if (sSlotMachine->unk07 == 0) + // make biasTag the opposite color of the 7 in sSlotMachine->biasTag + biasTag = 0; + if (sSlotMachine->biasTag == 0) { - r3 = 1; + biasTag = 1; } } - return gUnknown_083ECB7C[sSlotMachine->bet - 1](r3); + return DecideReelTurns_BiasTag_Reel3_Bets[sSlotMachine->bet - 1](biasTag); } -/*static */bool8 sub_810341C(u8 a0) +/*static */bool8 DecideReelTurns_BiasTag_Reel3_Bet1or2(u8 biasTag) { s16 i; - s16 unk34_1 = sSlotMachine->unk34[1]; + s16 reel2BiasTagPos = sSlotMachine->biasTagFinalPositions[1]; for (i = 0; i < 5; i++) { - if (GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(2, unk34_1 - i) == a0) + // if the biasTag appears in the same row as in reel 2 within 5 turns + if (GetNearbyTag_PixelOffset(2, reel2BiasTagPos - i) == biasTag) { - sSlotMachine->unk34[2] = unk34_1; - sSlotMachine->unk2E[2] = i; + sSlotMachine->biasTagFinalPositions[2] = reel2BiasTagPos; + sSlotMachine->reelExtraTurns[2] = i; return TRUE; } } return FALSE; } -/*static */bool8 sub_810347C(u8 a0) +/*static */bool8 DecideReelTurns_BiasTag_Reel3_Bet3(u8 biasTag) { s16 i; - s16 r8; - if (sSlotMachine->unk34[0] == sSlotMachine->unk34[1]) - return sub_810341C(a0); - if (sSlotMachine->unk34[0] == 1) - r8 = 3; + s16 biasTagFinalPos; + // if the final position of the biasTag matches in reel 1 and reel 2... + if (sSlotMachine->biasTagFinalPositions[0] == sSlotMachine->biasTagFinalPositions[1]) + //...then try to line it up in reel 3 + return DecideReelTurns_BiasTag_Reel3_Bet1or2(biasTag); + // else place it in the row opposite reel 1's + if (sSlotMachine->biasTagFinalPositions[0] == 1) + biasTagFinalPos = 3; else - r8 = 1; + biasTagFinalPos = 1; for (i = 0; i < 5; i++) { - if (GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(2, r8 - i) == a0) + // if in the biasTag lands in that position within the next 5 turns + if (GetNearbyTag_PixelOffset(2, biasTagFinalPos - i) == biasTag) { - sSlotMachine->unk2E[2] = i; - sSlotMachine->unk34[2] = r8; + sSlotMachine->reelExtraTurns[2] = i; + sSlotMachine->biasTagFinalPositions[2] = biasTagFinalPos; return TRUE; } } return FALSE; } -/*static */void sub_81034F4(void) +/* +Advance until there are no cherries on screen in reel 1 +*/ +/*static */void DecideReelTurns_NoBiasTag_Reel1(void) { s16 i = 0; - while (sub_81030E0(i) != 0) + while (AreCherriesOnScreen_Reel1(i) != 0) i++; - sSlotMachine->unk2E[0] = i; + sSlotMachine->reelExtraTurns[0] = i; } -/*static */bool8 sub_8103520(u8 *a0) +/*static */bool8 IsBiasTag7AndIfSoChangeColor(u8 *biasTagPtr) { - if (*a0 == 0) + if (*biasTagPtr == SLOT_MACHINE_TAG_7_RED) { - *a0 = 1; + *biasTagPtr = SLOT_MACHINE_TAG_7_BLUE; return TRUE; } - if (*a0 == 1) + if (*biasTagPtr == SLOT_MACHINE_TAG_7_BLUE) { - *a0 = 0; + *biasTagPtr = SLOT_MACHINE_TAG_7_RED; return TRUE; } return FALSE; } -/*static */void sub_8103540(void) +/*static */void DecideReelTurns_NoBiasTag_Reel2(void) { - gUnknown_083ECB88[sSlotMachine->bet - 1](); + DecideReelTurns_NoBiasTag_Reel2_Bets[sSlotMachine->bet - 1](); } -/*static */void sub_8103564(void) +// only does stuff if the biasTag is one of the 7's, plus other conditions +/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet1(void) { - if (sSlotMachine->unk34[0] != 0 && sSlotMachine->unk04 & 0x80) + // if reel 1 has a biasTag and bit 7 is set in luckyFlags... + if (sSlotMachine->biasTagFinalPositions[0] != 0 && sSlotMachine->luckyFlags & 0x80) { - u8 sp0 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, 2 - sSlotMachine->unk2E[0]); - if (sub_8103520(&sp0)) + u8 biasTag = GetNearbyTag_PixelOffset(0, 2 - sSlotMachine->reelExtraTurns[0]); + //...and if biasTag is one of the 7's... + if (IsBiasTag7AndIfSoChangeColor(&biasTag)) + //...swap the color of the 7... { s16 i; for (i = 0; i < 5; i++) { - if (sp0 == GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, 2 - i)) + //...and if the biasTag appears in the next 5 turns + if (biasTag == GetNearbyTag_PixelOffset(1, 2 - i)) { - sSlotMachine->unk34[1] = 2; - sSlotMachine->unk2E[1] = i; + sSlotMachine->biasTagFinalPositions[1] = 2; + sSlotMachine->reelExtraTurns[1] = i; break; } } @@ -2119,20 +2187,24 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void j5_08111E84(void) +/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet2(void) { - if (sSlotMachine->unk34[0] != 0 && sSlotMachine->unk04 & 0x80) + // if reel 1 has a biasTag and bit 7 is set in luckyFlags... + if (sSlotMachine->biasTagFinalPositions[0] != 0 && sSlotMachine->luckyFlags & 0x80) { - u8 sp0 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, sSlotMachine->unk34[0] - sSlotMachine->unk2E[0]); - if (sub_8103520(&sp0)) + u8 biasTag = GetNearbyTag_PixelOffset(0, sSlotMachine->biasTagFinalPositions[0] - sSlotMachine->reelExtraTurns[0]); + //...and if biasTag is one of the 7's... + if (IsBiasTag7AndIfSoChangeColor(&biasTag)) + //...swap the color of the 7... { s16 i; for (i = 0; i < 5; i++) { - if (sp0 == GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, sSlotMachine->unk34[0] - i)) + //...and if in the next 5 turns the biasTag appears in reel 2 + if (biasTag == GetNearbyTag_PixelOffset(1, sSlotMachine->biasTagFinalPositions[0] - i)) { - sSlotMachine->unk34[1] = sSlotMachine->unk34[0]; - sSlotMachine->unk2E[1] = i; + sSlotMachine->biasTagFinalPositions[1] = sSlotMachine->biasTagFinalPositions[0]; + sSlotMachine->reelExtraTurns[1] = i; break; } } @@ -2140,61 +2212,65 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void sub_8103668(void) +/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet3(void) { s16 i; s16 j; - if (sSlotMachine->unk34[0] != 0 && sSlotMachine->unk04 & 0x80) + // if reel 1 has a biasTag and bit 7 is set in luckyFlags... + if (sSlotMachine->biasTagFinalPositions[0] != 0 && sSlotMachine->luckyFlags & 0x80) { - if (sSlotMachine->unk34[0] == 2) + //...and if biasTag appeared in the center row of reel 1 + if (sSlotMachine->biasTagFinalPositions[0] == 2) { - j5_08111E84(); + DecideReelTurns_NoBiasTag_Reel2_Bet2(); } else { - u8 sp0 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, sSlotMachine->unk34[0] - sSlotMachine->unk2E[0]); - if (sub_8103520(&sp0)) + u8 biasTag = GetNearbyTag_PixelOffset(0, sSlotMachine->biasTagFinalPositions[0] - sSlotMachine->reelExtraTurns[0]); + //...and if biasTag is one of the 7's... + if (IsBiasTag7AndIfSoChangeColor(&biasTag)) + //...swap the color of the 7... { j = 2; - if (sSlotMachine->unk34[0] == 3) + if (sSlotMachine->biasTagFinalPositions[0] == 3) j = 3; for (i = 0; i < 2; i++, j--) { - if (sp0 == GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, j)) + if (biasTag == GetNearbyTag_PixelOffset(1, j)) { - sSlotMachine->unk34[1] = j; - sSlotMachine->unk2E[1] = 0; + sSlotMachine->biasTagFinalPositions[1] = j; + sSlotMachine->reelExtraTurns[1] = 0; return; } } for (j = 1; j < 5; j++) { - if (sp0 == GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, sSlotMachine->unk34[0] - j)) + if (biasTag == GetNearbyTag_PixelOffset(1, sSlotMachine->biasTagFinalPositions[0] - j)) { - if (sSlotMachine->unk34[0] == 1) + if (sSlotMachine->biasTagFinalPositions[0] == 1) { if (j < 3) { - sSlotMachine->unk34[1] = 2; - sSlotMachine->unk2E[1] = j + 1; + sSlotMachine->biasTagFinalPositions[1] = 2; + sSlotMachine->reelExtraTurns[1] = j + 1; } else { - sSlotMachine->unk34[1] = 1; - sSlotMachine->unk2E[1] = j; + sSlotMachine->biasTagFinalPositions[1] = 1; + sSlotMachine->reelExtraTurns[1] = j; } } else { if (j < 3) { - sSlotMachine->unk34[1] = 3; - sSlotMachine->unk2E[1] = j; + sSlotMachine->biasTagFinalPositions[1] = 3; + sSlotMachine->reelExtraTurns[1] = j; } else { - sSlotMachine->unk34[1] = 2; - sSlotMachine->unk2E[1] = j - 1; + sSlotMachine->biasTagFinalPositions[1] = 2; + sSlotMachine->reelExtraTurns[1] = j - 1; } } return; @@ -2234,7 +2310,7 @@ s16 sub_8102D5C(s16 a0) return TRUE; } -/*static */void sub_810380C(void) +/*static */void DecideReelTurns_NoBiasTag_Reel3(void) { gUnknown_083ECB94[sSlotMachine->bet - 1](); } @@ -2242,27 +2318,27 @@ s16 sub_8102D5C(s16 a0) /*static */void sub_8103830(void) { s16 i = 0; - u8 r5 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, 2 - sSlotMachine->unk2E[0]); - u8 r1 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, 2 - sSlotMachine->unk2E[1]); + u8 r5 = GetNearbyTag_PixelOffset(0, 2 - sSlotMachine->reelExtraTurns[0]); + u8 r1 = GetNearbyTag_PixelOffset(1, 2 - sSlotMachine->reelExtraTurns[1]); if (r5 == r1) { while (1) { u8 r0; - if (!(r5 == (r0 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(2, 2 - i)) || (r5 == 0 && r0 == 1) || (r5 == 1 && r0 == 0))) + if (!(r5 == (r0 = GetNearbyTag_PixelOffset(2, 2 - i)) || (r5 == 0 && r0 == 1) || (r5 == 1 && r0 == 0))) break; i++; } } else if (sub_8103764(r5, r1)) { - if (sSlotMachine->unk04 & 0x80) + if (sSlotMachine->luckyFlags & 0x80) { for (i = 0; i < 5; i++) { - if (r5 == GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(2, 2 - i)) + if (r5 == GetNearbyTag_PixelOffset(2, 2 - i)) { - sSlotMachine->unk2E[2] = i; + sSlotMachine->reelExtraTurns[2] = i; return; } } @@ -2270,12 +2346,12 @@ s16 sub_8102D5C(s16 a0) i = 0; while (1) { - if (r5 != GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(2, 2 - i)) + if (r5 != GetNearbyTag_PixelOffset(2, 2 - i)) break; i++; } } - sSlotMachine->unk2E[2] = i; + sSlotMachine->reelExtraTurns[2] = i; } /*static */void sub_8103910(void) @@ -2286,15 +2362,15 @@ s16 sub_8102D5C(s16 a0) u8 r6; u8 r4; - if (sSlotMachine->unk34[1] != 0 && sSlotMachine->unk34[0] == sSlotMachine->unk34[1] && sSlotMachine->unk04 & 0x80) + if (sSlotMachine->biasTagFinalPositions[1] != 0 && sSlotMachine->biasTagFinalPositions[0] == sSlotMachine->biasTagFinalPositions[1] && sSlotMachine->luckyFlags & 0x80) { - r7 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, sSlotMachine->unk34[0] - sSlotMachine->unk2E[0]); - r6 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, sSlotMachine->unk34[1] - sSlotMachine->unk2E[1]); + r7 = GetNearbyTag_PixelOffset(0, sSlotMachine->biasTagFinalPositions[0] - sSlotMachine->reelExtraTurns[0]); + r6 = GetNearbyTag_PixelOffset(1, sSlotMachine->biasTagFinalPositions[1] - sSlotMachine->reelExtraTurns[1]); if (sub_8103764(r7, r6)) { for (i = 0; i < 5; i++) { - r4 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(2, sSlotMachine->unk34[1] - i); + r4 = GetNearbyTag_PixelOffset(2, sSlotMachine->biasTagFinalPositions[1] - i); if (r7 == r4) { sp0 = i; @@ -2308,10 +2384,10 @@ s16 sub_8102D5C(s16 a0) s16 r8; for (i = 1, r8 = 0; i < 4; i++) { - r7 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, i - sSlotMachine->unk2E[0]); - r6 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, i - sSlotMachine->unk2E[1]); - r4 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(2, i - sp0); - if (!sub_81037BC(r7, r6, r4) && (!sub_810378C(r7, r6, r4) || !(sSlotMachine->unk04 & 0x80))) + r7 = GetNearbyTag_PixelOffset(0, i - sSlotMachine->reelExtraTurns[0]); + r6 = GetNearbyTag_PixelOffset(1, i - sSlotMachine->reelExtraTurns[1]); + r4 = GetNearbyTag_PixelOffset(2, i - sp0); + if (!sub_81037BC(r7, r6, r4) && (!sub_810378C(r7, r6, r4) || !(sSlotMachine->luckyFlags & 0x80))) { r8++; break; @@ -2321,7 +2397,7 @@ s16 sub_8102D5C(s16 a0) break; sp0++; } - sSlotMachine->unk2E[2] = sp0; + sSlotMachine->reelExtraTurns[2] = sp0; } /*static */void sub_8103A78(void) @@ -2333,21 +2409,21 @@ s16 sub_8102D5C(s16 a0) s16 i; sub_8103910(); - if (sSlotMachine->unk34[1] != 0 && sSlotMachine->unk34[0] != sSlotMachine->unk34[1] && sSlotMachine->unk04 & 0x80) + if (sSlotMachine->biasTagFinalPositions[1] != 0 && sSlotMachine->biasTagFinalPositions[0] != sSlotMachine->biasTagFinalPositions[1] && sSlotMachine->luckyFlags & 0x80) { - r6 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, sSlotMachine->unk34[0] - sSlotMachine->unk2E[0]); - r5 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, sSlotMachine->unk34[1] - sSlotMachine->unk2E[1]); + r6 = GetNearbyTag_PixelOffset(0, sSlotMachine->biasTagFinalPositions[0] - sSlotMachine->reelExtraTurns[0]); + r5 = GetNearbyTag_PixelOffset(1, sSlotMachine->biasTagFinalPositions[1] - sSlotMachine->reelExtraTurns[1]); if (sub_8103764(r6, r5)) { r8 = 1; - if (sSlotMachine->unk34[0] == 1) + if (sSlotMachine->biasTagFinalPositions[0] == 1) r8 = 3; for (i = 0; i < 5; i++) { - r4 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(2, r8 - (sSlotMachine->unk2E[2] + i)); + r4 = GetNearbyTag_PixelOffset(2, r8 - (sSlotMachine->reelExtraTurns[2] + i)); if (r6 == r4) { - sSlotMachine->unk2E[2] += i; + sSlotMachine->reelExtraTurns[2] += i; break; } } @@ -2355,21 +2431,21 @@ s16 sub_8102D5C(s16 a0) } while (1) { - r6 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, 1 - sSlotMachine->unk2E[0]); - r5 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, 2 - sSlotMachine->unk2E[1]); - r4 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(2, 3 - sSlotMachine->unk2E[2]); - if (sub_81037BC(r6, r5, r4) || (sub_810378C(r6, r5, r4) && sSlotMachine->unk04 & 0x80)) + r6 = GetNearbyTag_PixelOffset(0, 1 - sSlotMachine->reelExtraTurns[0]); + r5 = GetNearbyTag_PixelOffset(1, 2 - sSlotMachine->reelExtraTurns[1]); + r4 = GetNearbyTag_PixelOffset(2, 3 - sSlotMachine->reelExtraTurns[2]); + if (sub_81037BC(r6, r5, r4) || (sub_810378C(r6, r5, r4) && sSlotMachine->luckyFlags & 0x80)) break; - sSlotMachine->unk2E[2]++; + sSlotMachine->reelExtraTurns[2]++; } while (1) { - r6 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(0, 3 - sSlotMachine->unk2E[0]); - r5 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(1, 2 - sSlotMachine->unk2E[1]); - r4 = GetTagOfReelSymbolOnScreenAtPos_AdjustForPixelOffset(2, 1 - sSlotMachine->unk2E[2]); - if (sub_81037BC(r6, r5, r4) || (sub_810378C(r6, r5, r4) && sSlotMachine->unk04 & 0x80)) + r6 = GetNearbyTag_PixelOffset(0, 3 - sSlotMachine->reelExtraTurns[0]); + r5 = GetNearbyTag_PixelOffset(1, 2 - sSlotMachine->reelExtraTurns[1]); + r4 = GetNearbyTag_PixelOffset(2, 1 - sSlotMachine->reelExtraTurns[2]); + if (sub_81037BC(r6, r5, r4) || (sub_810378C(r6, r5, r4) && sSlotMachine->luckyFlags & 0x80)) break; - sSlotMachine->unk2E[2]++; + sSlotMachine->reelExtraTurns[2]++; } } @@ -2403,9 +2479,9 @@ s16 sub_8102D5C(s16 a0) DestroyTask(taskId); } -/*static */void sub_8103D00(u8 a0) +/*static */void LoadLightedTile(u8 tileId) { - LoadPalette(gUnknown_083EDD08[a0], gUnknown_083EDD30[a0], 2); + LoadPalette(gUnknown_083EDD08[tileId], gUnknown_083EDD30[tileId], 2); } /*static */void sub_8103D28(u8 a0) @@ -2413,18 +2489,19 @@ s16 sub_8102D5C(s16 a0) LoadPalette(gUnknown_083EDD1C[a0], gUnknown_083EDD30[a0], 2); } -/*static */void sub_8103D50(u8 a0) +// probably light the bet number +/*static */void LoadBetTiles(u8 betVal) { u8 i; - for (i = 0; i < gUnknown_083EDD3B[a0]; i++) - sub_8103D00(gUnknown_083EDD35[a0][i]); + for (i = 0; i < gNumberBettingTiles[betVal]; i++) + LoadLightedTile(gBettingTilesId[betVal][i]); } /*static */void sub_8103D8C(u8 a0) { u8 i; - for (i = 0; i < gUnknown_083EDD3B[a0]; i++) - sub_8103D28(gUnknown_083EDD35[a0][i]); + for (i = 0; i < gNumberBettingTiles[a0]; i++) + sub_8103D28(gBettingTilesId[a0][i]); } /*static */void sub_8103DC8(void) @@ -2449,6 +2526,7 @@ s16 sub_8102D5C(s16 a0) sprite->data[7] = 0; } +// something with payout digits /*static */bool8 sub_8103E38(void) { u8 i; @@ -2545,32 +2623,33 @@ s16 sub_8102D5C(s16 a0) /*static */void sub_8104048(void) { - sSlotMachine->unk3E = CreateTask(sub_81040E8, 8); + sSlotMachine->unkTaskPointer = CreateTask(sub_81040E8, 8); } -/*static */void sub_8104064(u8 pikaPower) +// possibly clear pikaPower +/*static */void DisplayPikaPower(u8 pikaPower) { - struct Task *task = gTasks + sSlotMachine->unk3E; - sub_812D394(task); + struct Task *task = gTasks + sSlotMachine->unkTaskPointer; + ClearTaskDataFields_2orHigher(task); task->data[0] = 1; task->data[1]++; - task->data[15] = 1; + task->data[15] = 1; // points to a reelIndex } /*static */void sub_8104098(void) { - struct Task *task = gTasks + sSlotMachine->unk3E; - sub_812D394(task); + struct Task *task = gTasks + sSlotMachine->unkTaskPointer; + ClearTaskDataFields_2orHigher(task); task->data[0] = 3; - task->data[15] = 1; + task->data[15] = 1; // points to a reelIndex } /*static */bool8 sub_81040C8(void) { - return gTasks[sSlotMachine->unk3E].data[15]; + return gTasks[sSlotMachine->unkTaskPointer].data[15]; } -/*static */void sub_81040E8(u8 taskId) +/*static */void sub_81040E8(u8 taskId) // debug to see if taskId is machineId { gUnknown_083ECBB4[gTasks[taskId].data[0]](gTasks + taskId); } @@ -2596,11 +2675,11 @@ s16 sub_8102D5C(s16 a0) r3 = 1, r2 = 1; else if (task->data[1] == 16) r3 = 2, r2 = 2; - gUnknown_0203AACC[r2] = gUnknown_083ECBC4[r3][0]; - LoadBgTilemap(2, &gUnknown_0203AACC[r2], 2, r5 + 0x40); + selectedPikaPowerTile[r2] = pikaPowerTileTable[r3][0]; + LoadBgTilemap(2, &selectedPikaPowerTile[r2], 2, r5 + 0x40); sub_8105B88(task->data[2]); task->data[0] = 0; - task->data[15] = 0; + task->data[15] = 0; // points to a reelIndex } } @@ -2615,8 +2694,8 @@ s16 sub_8102D5C(s16 a0) r3 = 2, r2 = 2; if (task->data[2] == 0) { - gUnknown_0203AACC[r2] = gUnknown_083ECBC4[r3][1]; - LoadBgTilemap(2, &gUnknown_0203AACC[r2], 2, r5 + 0x40); + selectedPikaPowerTile[r2] = pikaPowerTileTable[r3][1]; + LoadBgTilemap(2, &selectedPikaPowerTile[r2], 2, r5 + 0x40); task->data[1]--; } if (++task->data[2] >= 20) @@ -2628,7 +2707,7 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void sub_812D394(struct Task *task) +/*static */void ClearTaskDataFields_2orHigher(struct Task *task) { u8 i; @@ -2636,6 +2715,7 @@ s16 sub_8102D5C(s16 a0) task->data[i] = 0; } +// possibly load tiles for pika power meter /*static */void sub_810423C(u8 pikaPower) { s16 i; @@ -2646,10 +2726,10 @@ s16 sub_8102D5C(s16 a0) r3 = 0, r1 = 0; if (i == 0) r3 = 1, r1 = 1; - else if (i == 15) + else if (i == 15) // pikaPower meter is full r3 = 2, r1 = 2; - gUnknown_0203AACC[r1] = gUnknown_083ECBC4[r3][0]; - LoadBgTilemap(2, &gUnknown_0203AACC[r1], 2, r4 + 0x40); + selectedPikaPowerTile[r1] = pikaPowerTileTable[r3][0]; + LoadBgTilemap(2, &selectedPikaPowerTile[r1], 2, r4 + 0x40); } for (; i < 16; i++, r4++) { @@ -2658,35 +2738,39 @@ s16 sub_8102D5C(s16 a0) r3 = 1, r1 = 1; else if (i == 15) r3 = 2, r1 = 2; - gUnknown_0203AACC[r1] = gUnknown_083ECBC4[r3][1]; - LoadBgTilemap(2, &gUnknown_0203AACC[r1], 2, r4 + 0x40); + selectedPikaPowerTile[r1] = pikaPowerTileTable[r3][1]; + LoadBgTilemap(2, &selectedPikaPowerTile[r1], 2, r4 + 0x40); } - gTasks[sSlotMachine->unk3E].data[1] = pikaPower; + gTasks[sSlotMachine->unkTaskPointer].data[1] = pikaPower; } -/*static */void sub_810430C(void) +/*static */void BeginReelTime(void) { - u8 taskId = CreateTask(sub_810434C, 7); - sub_810434C(taskId); + u8 taskId = CreateTask(RunReelTimeActions, 7); + RunReelTimeActions(taskId); } -/*static */bool8 sub_810432C(void) +/*static */bool8 IsFinalTask_RunReelTimeActions(void) { - if (FindTaskIdByFunc(sub_810434C) == 0xFF) + if (FindTaskIdByFunc(RunReelTimeActions) == TAIL_SENTINEL) return TRUE; return FALSE; } -/*static */void sub_810434C(u8 taskId) +/*static */void RunReelTimeActions(u8 taskId) { - gUnknown_083ECBD0[gTasks[taskId].data[0]](gTasks + taskId); + // task.data[0] points to which ReelTimeAction to do, and starts at 0 + // task.data[1] has something to do with the threshold + // task.data[4] says how many pixels to advance the reel + // task.data[5] is a timer + ReelTimeActions[gTasks[taskId].data[0]](gTasks + taskId); } -/*static */void sub_810437C(struct Task *task) +/*static */void ReelTimeAction1(struct Task *task) { - sSlotMachine->unk0A = 0; - sSlotMachine->unk14 = 0; - sSlotMachine->unk16 = 0; + sSlotMachine->fairRollsLeft = 0; + sSlotMachine->reelTimePixelOffset = 0; + sSlotMachine->reelTimePosition = 0; task->data[0]++; task->data[1] = 0; task->data[2] = 30; @@ -2701,16 +2785,18 @@ s16 sub_8102D5C(s16 a0) sub_81052EC(); sub_81053A0(); sub_810545C(); - sub_8102680(); + DrawReelTimeOutcome(); StopMapMusic(); PlayNewMapMusic(MUS_BD_TIME); } -/*static */void sub_81043EC(struct Task *task) +/*static */void ReelTimeAction2(struct Task *task) { s16 r3; gSpriteCoordOffsetX -= 8; + // boost threshold by 8 task->data[1] += 8; + // only consider lower 8 bits, and then shift them right 3 r3 = ((task->data[1] + 240) & 0xff) >> 3; SetGpuReg(REG_OFFSET_BG1HOFS, task->data[1] & 0x1ff); if (r3 != task->data[2] && task->data[3] <= 18) @@ -2724,21 +2810,22 @@ s16 sub_8102D5C(s16 a0) task->data[0]++; task->data[3] = 0; } - sub_8102D28(task->data[4] >> 8); + // move ReelTime reel by the value in the upper 8 bits of task->data[4] + IncrementReelTimePixelOffset(task->data[4] >> 8); } -/*static */void sub_8104468(struct Task *task) +/*static */void ReelTimeAction3(struct Task *task) { - sub_8102D28(task->data[4] >> 8); + IncrementReelTimePixelOffset(task->data[4] >> 8); if (++task->data[5] >= 60) { task->data[0]++; - sub_8105578(); - sub_81056F0(); + CreateReelTimeSprites1(); + CreateReelTimeSprite2(); } } -/*static */void sub_8104498(struct Task *task) +/*static */void ReelTimeAction4(struct Task *task) { int r5; u8 sp0[ARRAY_COUNT(gUnknown_085A75C0)]; @@ -2749,12 +2836,14 @@ s16 sub_8102D5C(s16 a0) memcpy(sp4, gUnknown_085A75C4, sizeof(gUnknown_085A75C4)); memcpy(spC, gUnknown_085A75CC, sizeof(gUnknown_085A75CC)); - sub_8102D28(task->data[4] >> 8); + IncrementReelTimePixelOffset(task->data[4] >> 8); + // gradually slow down the reel task->data[4] -= 4; r5 = 4 - (task->data[4] >> 8); sub_8105688(sp4[r5]); sub_81057E8(spC[r5]); - StartSpriteAnimIfDifferent(gSprites + sSlotMachine->unk3F, sp0[r5]); + StartSpriteAnimIfDifferent(gSprites + sSlotMachine->reelTimeSprite3F, sp0[r5]); + // once speed goes below 256, go to next ReelTimeAction and keep the speed level if (task->data[4] <= 0x100) { task->data[0]++; @@ -2763,21 +2852,21 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void sub_8104548(struct Task *task) +/*static */void ReelTimeAction5(struct Task *task) { - sub_8102D28(task->data[4] >> 8); + IncrementReelTimePixelOffset(task->data[4] >> 8); if (++task->data[5] >= 80) { task->data[0]++; task->data[5] = 0; sub_81057E8(2); - StartSpriteAnimIfDifferent(gSprites + sSlotMachine->unk3F, 3); + StartSpriteAnimIfDifferent(gSprites + sSlotMachine->reelTimeSprite3F, 3); } } -/*static */void sub_8104598(struct Task *task) +/*static */void ReelTimeAction6(struct Task *task) { - sub_8102D28(task->data[4] >> 8); + IncrementReelTimePixelOffset(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x80; if (++task->data[5] >= 80) { @@ -2786,23 +2875,23 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void sub_81045CC(struct Task *task) +/*static */void ReelTimeAction7(struct Task *task) { - sub_8102D28(task->data[4] >> 8); + IncrementReelTimePixelOffset(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x40; if (++task->data[5] >= 40) { task->data[5] = 0; - if (sSlotMachine->unk05) - { - if (sSlotMachine->unk0A <= task->data[6]) + if (sSlotMachine->reelTimeDraw) + { // TODO: check if fairRollsLeft differs from reelTimeDraw + if (sSlotMachine->fairRollsLeft <= task->data[6]) task->data[0]++; } else if (task->data[6] > 3) { task->data[0]++; } - else if (sub_81026DC(task->data[6])) + else if (SkipToReelTimeAction14(task->data[6])) { task->data[0] = 14; } @@ -2810,28 +2899,28 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void sub_810463C(struct Task *task) +/*static */void ReelTimeAction_LandOnOutcome(struct Task *task) { - s16 r5 = sSlotMachine->unk14 % 20; - if (r5) + s16 reelTimePixelOffset = sSlotMachine->reelTimePixelOffset % 20; + if (reelTimePixelOffset) { - r5 = sub_8102D5C(task->data[4] >> 8); + reelTimePixelOffset = AdvanceReelTimeNextNumber(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x40; } - else if (sub_8102C48(1) != sSlotMachine->unk05) + else if (GetNthNextReelTimePosition(1) != sSlotMachine->reelTimeDraw) { - sub_8102D28(task->data[4] >> 8); - r5 = sSlotMachine->unk14 % 20; + IncrementReelTimePixelOffset(task->data[4] >> 8); + reelTimePixelOffset = sSlotMachine->reelTimePixelOffset % 20; task->data[4] = (u8)task->data[4] + 0x40; } - if (r5 == 0 && sub_8102C48(1) == sSlotMachine->unk05) + if (reelTimePixelOffset == 0 && GetNthNextReelTimePosition(1) == sSlotMachine->reelTimeDraw) { - task->data[4] = 0; + task->data[4] = 0; // stop moving task->data[0]++; } } -/*static */void sub_81046C0(struct Task *task) +/*static */void ReelTimeAction9(struct Task *task) { if (++task->data[4] >= 60) { @@ -2839,17 +2928,17 @@ s16 sub_8102D5C(s16 a0) sub_81056C0(); sub_8105804(); task->data[0]++; - if(sSlotMachine->unk05 == 0) + if(sSlotMachine->reelTimeDraw == 0) { task->data[4] = 0xa0; - StartSpriteAnimIfDifferent(gSprites + sSlotMachine->unk3F, 5); + StartSpriteAnimIfDifferent(gSprites + sSlotMachine->reelTimeSprite3F, 5); PlayFanfare(MUS_ME_ZANNEN); } else { task->data[4] = 0xc0; - StartSpriteAnimIfDifferent(gSprites + sSlotMachine->unk3F, 4); - gSprites[sSlotMachine->unk3F].animCmdIndex = 0; + StartSpriteAnimIfDifferent(gSprites + sSlotMachine->reelTimeSprite3F, 4); + gSprites[sSlotMachine->reelTimeSprite3F].animCmdIndex = 0; if (sSlotMachine->pikaPower) { sub_8104098(); @@ -2860,13 +2949,13 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void sub_8104764(struct Task *task) +/*static */void ReelTimeAction10(struct Task *task) { if ((task->data[4] == 0 || --task->data[4] == 0) && !sub_81040C8()) task->data[0]++; } -/*static */void sub_8104794(struct Task *task) +/*static */void ReelTimeAction11(struct Task *task) { s16 r4; gSpriteCoordOffsetX -= 8; @@ -2880,53 +2969,53 @@ s16 sub_8102D5C(s16 a0) task->data[0]++; } -/*static */void sub_81047EC(struct Task *task) +/*static */void ReelTimeAction12(struct Task *task) { - sSlotMachine->unk0B = 0; - sSlotMachine->unk0A = sSlotMachine->unk05; + sSlotMachine->fairRollsUsed = 0; + sSlotMachine->fairRollsLeft = sSlotMachine->reelTimeDraw; gSpriteCoordOffsetX = 0; SetGpuReg(REG_OFFSET_BG1HOFS, 0); - sSlotMachine->unk1A = 8; + sSlotMachine->reelIncrement = 8; sub_810514C(); sub_81054B8(); sub_8105524(); PlayNewMapMusic(sSlotMachine->backupMapMusic); - if (sSlotMachine->unk0A == 0) + if (sSlotMachine->fairRollsLeft == 0) { - DestroyTask(FindTaskIdByFunc(sub_810434C)); + DestroyTask(FindTaskIdByFunc(RunReelTimeActions)); } else { sub_8104CAC(4); - task->data[1] = dp15_jump_random_unknown(); + task->data[1] = DrawNewReelIncrement(); task->data[2] = 0; task->data[3] = 0; task->data[0]++; } } -/*static */void sub_8104860(struct Task *task) +/*static */void ReelTimeAction13(struct Task *task) { - if (sSlotMachine->unk1A == task->data[1]) + if (sSlotMachine->reelIncrement == task->data[1]) task->data[0]++; - else if (sSlotMachine->unk1C[0] % 24 == 0 && (++task->data[2]& 0x07) == 0) - sSlotMachine->unk1A >>= 1; + else if (sSlotMachine->reelPixelOffsets[0] % 24 == 0 && (++task->data[2]& 0x07) == 0) + sSlotMachine->reelIncrement >>= 1; } -/*static */void sub_81048A8(struct Task *task) +/*static */void ReelTimeAction14(struct Task *task) { if (sub_8104E18()) - DestroyTask(FindTaskIdByFunc(sub_810434C)); + DestroyTask(FindTaskIdByFunc(RunReelTimeActions)); } -/*static */void sub_81048CC(struct Task *task) +/*static */void ReelTimeAction15(struct Task *task) { sub_81054B8(); sub_81056C0(); sub_8105804(); sub_8105854(); gSprites[sSlotMachine->unk4E[0]].invisible = TRUE; - StartSpriteAnimIfDifferent(gSprites + sSlotMachine->unk3F, 5); + StartSpriteAnimIfDifferent(gSprites + sSlotMachine->reelTimeSprite3F, 5); task->data[0]++; task->data[4] = 4; task->data[5] = 0; @@ -2935,7 +3024,7 @@ s16 sub_8102D5C(s16 a0) PlaySE(SE_W153); } -/*static */void sub_8104940(struct Task *task) +/*static */void ReelTimeAction16(struct Task *task) { gSpriteCoordOffsetY = task->data[4]; SetGpuReg(REG_OFFSET_BG1VOFS, task->data[4]); @@ -2955,7 +3044,7 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void sub_81049C8(struct Task *task) +/*static */void ReelTimeAction17(struct Task *task) { gSpriteCoordOffsetY = 0; SetGpuReg(REG_OFFSET_BG1VOFS, 0); @@ -2966,7 +3055,7 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void sub_81049F8(struct Task *task) +/*static */void ReelTimeAction18(struct Task *task) { gSpriteCoordOffsetX = 0; SetGpuReg(REG_OFFSET_BG1HOFS, 0); @@ -2975,7 +3064,7 @@ s16 sub_8102D5C(s16 a0) sub_8105554(); sub_8105524(); sub_81059B8(); - DestroyTask(FindTaskIdByFunc(sub_810434C)); + DestroyTask(FindTaskIdByFunc(RunReelTimeActions)); } /*static */void sub_8104A40(s16 a0, s16 a1) @@ -2998,39 +3087,39 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void sub_8104AB8(u8 a0) +/*static */void OpenInfoBox(u8 seemsUnused) { - u8 taskId = CreateTask(sub_8104B0C, 1); - gTasks[taskId].data[1] = a0; - sub_8104B0C(taskId); + u8 taskId = CreateTask(RunInfoBoxActions, 1); + gTasks[taskId].data[1] = seemsUnused; + RunInfoBoxActions(taskId); } -/*static */bool8 sub_8104AEC(void) +/*static */bool8 ClosedInfoBox(void) { - if (FindTaskIdByFunc(sub_8104B0C) == 0xFF) + if (FindTaskIdByFunc(RunInfoBoxActions) == 0xFF) return TRUE; else return FALSE; } -/*static */void sub_8104B0C(u8 taskId) +/*static */void RunInfoBoxActions(u8 taskId) { - gUnknown_083ECC30[gTasks[taskId].data[0]](gTasks + taskId); + InfoBoxActions[gTasks[taskId].data[0]](gTasks + taskId); } -/*static */void sub_8104B3C(struct Task *task) +/*static */void InfoBox_FadeIn(struct Task *task) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); task->data[0]++; } -/*static */void sub_8104B60(struct Task *task) +/*static */void InfoBox_WaitForFade(struct Task *task) { if (!gPaletteFade.active) task->data[0]++; } -/*static */void sub_8104B80(struct Task *task) +/*static */void InfoBox_8104B80(struct Task *task) { sub_8104DA4(); sub_81065DC(); @@ -3040,15 +3129,15 @@ s16 sub_8102D5C(s16 a0) task->data[0]++; } -/*static */void sub_812DD78(struct Task *task) +/*static */void InfoBox_AddText(struct Task *task) { - AddTextPrinterParameterized3(1, 1, 2, 5, gUnknown_085A744C, 0, gText_ReelTimeHelp); + AddTextPrinterParameterized3(1, 1, 2, 5, gColors_ReelTimeHelp, 0, gText_ReelTimeHelp); CopyWindowToVram(1, 3); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); task->data[0]++; } -/*static */void sub_8104BC8(struct Task *task) +/*static */void InfoBox_AwaitPlayerInput(struct Task *task) { if (gMain.newKeys & (B_BUTTON | SELECT_BUTTON)) { @@ -3061,29 +3150,29 @@ s16 sub_8102D5C(s16 a0) } } -/*static */void sub_812DE14(struct Task *task) +/*static */void InfoBox_812DE14(struct Task *task) { sub_812F968(); ShowBg(3); task->data[0]++; } -/*static */void sub_812DE30(struct Task *task) +/*static */void InfoBox_812DE30(struct Task *task) { sub_8104CAC(task->data[1]); task->data[0]++; } -/*static */void sub_8104BFC(struct Task *task) +/*static */void InfoBox_8104BFC(struct Task *task) { sub_810423C(sSlotMachine->pikaPower); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); task->data[0]++; } -/*static */void sub_8104C44(struct Task *task) +/*static */void InfoBox_FreeTask(struct Task *task) { - DestroyTask(FindTaskIdByFunc(sub_8104B0C)); + DestroyTask(FindTaskIdByFunc(RunInfoBoxActions)); } /*static */void sub_8104C5C(void) @@ -3091,13 +3180,14 @@ s16 sub_8102D5C(s16 a0) u8 i; struct Task *task; i = CreateTask(sub_8104E74_, 3); - sSlotMachine->unk3D = i; + sSlotMachine->unkTaskPointer3D = i; task = gTasks + i; task->data[1] = -1; for (i = 4; i < 16; i++) task->data[i] = MAX_SPRITES; } +// possibly initialize each wheel /*static */void sub_8104CAC(u8 arg0) { u8 i; @@ -3105,7 +3195,7 @@ s16 sub_8102D5C(s16 a0) sub_8104DA4(); - task = gTasks + sSlotMachine->unk3D; + task = gTasks + sSlotMachine->unkTaskPointer3D; task->data[1] = arg0; for (i = 0; gUnknown_083ED048[arg0][i].unk00 != 0xFF; i++) @@ -3123,7 +3213,7 @@ s16 sub_8102D5C(s16 a0) /*static */void sub_8104D30(u8 a0, SpriteCallback a1, s16 a2, s16 a3, s16 a4) { u8 i; - struct Task *task = gTasks + sSlotMachine->unk3D; + struct Task *task = gTasks + sSlotMachine->unkTaskPointer3D; for (i = 4; i < 16; i++) { if (task->data[i] == MAX_SPRITES) @@ -3137,7 +3227,7 @@ s16 sub_8102D5C(s16 a0) /*static */void sub_8104DA4(void) { u8 i; - struct Task *task = gTasks + sSlotMachine->unk3D; + struct Task *task = gTasks + sSlotMachine->unkTaskPointer3D; if ((u16)task->data[1] != 0xFFFF) gUnknown_083ED064[task->data[1]](); for (i = 4; i < 16; i++) @@ -3153,7 +3243,7 @@ s16 sub_8102D5C(s16 a0) /*static */bool8 sub_8104E18(void) { u8 i; - struct Task *task = gTasks + sSlotMachine->unk3D; + struct Task *task = gTasks + sSlotMachine->unkTaskPointer3D; for (i = 4; i < 16; i++) { if (task->data[i] != MAX_SPRITES) @@ -3192,12 +3282,14 @@ s16 sub_8102D5C(s16 a0) } } +// debug this to find out what sprite->data[0] and sprite->data[2] are holding +// I would guess this updates the sprite location in the reel /*static */void sub_8104F18(struct Sprite *sprite) { - sprite->data[2] = sSlotMachine->unk1C[sprite->data[0]] + sprite->data[1]; + sprite->data[2] = sSlotMachine->reelPixelOffsets[sprite->data[0]] + sprite->data[1]; sprite->data[2] %= 120; - sprite->pos1.y = sSlotMachine->unk22[sprite->data[0]] + 28 + sprite->data[2]; - sprite->sheetTileStart = GetSpriteTileStartByTag(GetTagOfReelSymbolOnScreenAtPos(sprite->data[0], sprite->data[2] / 24)); + sprite->pos1.y = sSlotMachine->stopReelPixelOffset[sprite->data[0]] + 28 + sprite->data[2]; + sprite->sheetTileStart = GetSpriteTileStartByTag(GetNearbyTag(sprite->data[0], sprite->data[2] / 24)); SetSpriteSheetFrameTileNum(sprite); } @@ -3268,12 +3360,12 @@ s16 sub_8102D5C(s16 a0) spriteId = CreateSprite(&spriteTemplate, 280, 80, 1); gSprites[spriteId].oam.priority = 1; gSprites[spriteId].coordOffsetEnabled = TRUE; - sSlotMachine->unk3F = spriteId; + sSlotMachine->reelTimeSprite3F = spriteId; } /*static */void sub_810514C(void) { - DestroySprite(gSprites + sSlotMachine->unk3F); + DestroySprite(gSprites + sSlotMachine->reelTimeSprite3F); if (gUnknown_0203AAE4 != NULL) FREE_AND_SET_NULL(gUnknown_0203AAE4); } @@ -3362,10 +3454,10 @@ s16 sub_8102D5C(s16 a0) /*static */void sub_810535C(struct Sprite *sprite) { - s16 r0 = (u16)(sSlotMachine->unk14 + sprite->data[7]); + s16 r0 = (u16)(sSlotMachine->reelTimePixelOffset + sprite->data[7]); r0 %= 40; sprite->pos1.y = r0 + 59; - StartSpriteAnimIfDifferent(sprite, sub_8102C48(r0 / 20)); + StartSpriteAnimIfDifferent(sprite, GetNthNextReelTimePosition(r0 / 20)); } /*static */void sub_81053A0(void) @@ -3427,13 +3519,14 @@ s16 sub_8102D5C(s16 a0) FREE_AND_SET_NULL(gUnknown_0203AAF0); } -/*static */void sub_8105578(void) +// TODO: check if this is true +/*static */void CreateReelTimeSprites1(void) { u8 spriteId = CreateSprite(&gSpriteTemplate_83ED504, 0x98, 0x20, 5); struct Sprite *sprite = &gSprites[spriteId]; sprite->oam.priority = 1; sprite->hFlip = TRUE; - sSlotMachine->unk50[0] = spriteId; + sSlotMachine->reelTimeSprites1[0] = spriteId; sprite->data[0] = 8; sprite->data[1] = -1; sprite->data[2] = -1; @@ -3442,7 +3535,7 @@ s16 sub_8102D5C(s16 a0) spriteId = CreateSprite(&gSpriteTemplate_83ED504, 0xb8, 0x20, 5); sprite = &gSprites[spriteId]; sprite->oam.priority = 1; - sSlotMachine->unk50[1] = spriteId; + sSlotMachine->reelTimeSprites1[1] = spriteId; sprite->data[1] = 1; sprite->data[2] = -1; sprite->data[7] = 0x20; @@ -3472,8 +3565,8 @@ s16 sub_8102D5C(s16 a0) /*static */void sub_8105688(s16 a0) { - gSprites[sSlotMachine->unk50[0]].data[7] = a0; - gSprites[sSlotMachine->unk50[1]].data[7] = a0; + gSprites[sSlotMachine->reelTimeSprites1[0]].data[7] = a0; + gSprites[sSlotMachine->reelTimeSprites1[1]].data[7] = a0; } /*static */void sub_81056C0(void) @@ -3481,10 +3574,10 @@ s16 sub_8102D5C(s16 a0) u8 i; for (i = 0; i < 2; i++) - DestroySprite(&gSprites[sSlotMachine->unk50[i]]); + DestroySprite(&gSprites[sSlotMachine->reelTimeSprites1[i]]); } -/*static */void sub_81056F0(void) +/*static */void CreateReelTimeSprite2(void) { u8 spriteId = CreateSprite(&gSpriteTemplate_83ED51C, 0x48, 0x50, 3); gSprites[spriteId].oam.priority = 1; @@ -3492,12 +3585,12 @@ s16 sub_8102D5C(s16 a0) gSprites[spriteId].data[5] = 0; gSprites[spriteId].data[6] = 16; gSprites[spriteId].data[7] = 8; - sSlotMachine->unk52[0] = spriteId; + sSlotMachine->reelTimeSprites2[0] = spriteId; spriteId = CreateSprite(&gSpriteTemplate_83ED51C, 0x68, 0x50, 3); gSprites[spriteId].oam.priority = 1; gSprites[spriteId].hFlip = TRUE; - sSlotMachine->unk52[1] = spriteId; + sSlotMachine->reelTimeSprites2[1] = spriteId; } /*static */void sub_8105784(struct Sprite *sprite) @@ -3514,7 +3607,7 @@ s16 sub_8102D5C(s16 a0) /*static */void sub_81057E8(s16 a0) { - gSprites[sSlotMachine->unk52[0]].data[7] = a0; + gSprites[sSlotMachine->reelTimeSprites2[0]].data[7] = a0; } /*static */void sub_8105804(void) @@ -3522,7 +3615,7 @@ s16 sub_8102D5C(s16 a0) u8 i; MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(7) << 4) + 0x103, 0, 0, 0); for (i = 0; i < 2; i++) - DestroySprite(&gSprites[sSlotMachine->unk52[i]]); + DestroySprite(&gSprites[sSlotMachine->reelTimeSprites2[i]]); } /*static */void sub_8105854(void) @@ -3782,7 +3875,7 @@ s16 sub_8102D5C(s16 a0) switch (sprite->data[0]) { case 0: - StartSpriteAnim(sprite, sSlotMachine->unk0A - 1); + StartSpriteAnim(sprite, sSlotMachine->fairRollsLeft - 1); sprite->data[0]++; // fallthrough case 1: @@ -4271,7 +4364,7 @@ extern const u16 gSlotMachineMenu_Pal[]; gUnknown_0203AB28[1].size = 0x180; } -const u8 sReelSymbols[][21] = +const u8 sReelSymbols[][REEL_NUM_TAGS] = { { SLOT_MACHINE_TAG_7_RED, @@ -4348,13 +4441,13 @@ const u8 gUnknown_083ECCF1[] = { 1, 0, 5, 4, 3, 2 }; -const s16 gUnknown_083ECCF8[][2] = { +const s16 sInitialReelPositions[][2] = { {0, 6}, {0, 10}, {0, 2} }; -const u8 gUnknown_083ECD04[][3] = { +const u8 sSlotLuckinessTable1[][3] = { {1, 1, 12}, {1, 1, 14}, {2, 2, 14}, @@ -4363,13 +4456,13 @@ const u8 gUnknown_083ECD04[][3] = { {3, 3, 16} }; -const u8 gUnknown_083ECD16[][6] = { +const u8 sSlotLuckinessTable2[][6] = { {25, 25, 30, 40, 40, 50}, {25, 25, 30, 30, 35, 35}, {25, 25, 30, 25, 25, 30} }; -const u8 gUnknown_083ECD28[][6] = { +const u8 sSlotLuckinessTable3[][6] = { {20, 25, 25, 20, 25, 25}, {12, 15, 15, 18, 19, 22}, {25, 25, 25, 30, 30, 40}, @@ -4377,7 +4470,7 @@ const u8 gUnknown_083ECD28[][6] = { {40, 40, 35, 35, 40, 40} }; -const u8 gUnknown_083ECD46[][17] = { +const u8 ReelTimeProbabilityTable0[][17] = { {243, 243, 243, 80, 80, 80, 80, 40, 40, 40, 40, 40, 40, 5, 5, 5, 5}, { 5, 5, 5, 150, 150, 150, 150, 130, 130, 130, 130, 130, 130, 100, 100, 100, 5}, { 4, 4, 4, 20, 20, 20, 20, 80, 80, 80, 80, 80, 80, 100, 100, 100, 40}, @@ -4386,7 +4479,7 @@ const u8 gUnknown_083ECD46[][17] = { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6} }; -const u8 gUnknown_083ECDAC[][17] = { +const u8 ReelTimeProbabilityTable1[][17] = { { 243, 243, 243, 200, 200, 200, 200, 160, 160, 160, 160, 160, 160, 70, 70, 70, 5}, { 5, 5, 5, 25, 25, 25, 25, 5, 5, 5, 5, 5, 5, 2, 2, 2, 6}, { 4, 4, 4, 25, 25, 25, 25, 30, 30, 30, 30, 30, 30, 40, 40, 40, 35}, @@ -4395,11 +4488,11 @@ const u8 gUnknown_083ECDAC[][17] = { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 60} }; -const u16 gUnknown_083ECE12[] = { - 0x80, 0xaf, 0xc8, 0xe1, 0x100 +const u16 ProbabilityTable_SkipToReelTimeAction14[] = { + 128, 175, 200, 225, 256 }; -const u16 gUnknown_083ECE1C[][2] = { +const u16 ReelIncrementTable[][2] = { {10, 5}, {10, 10}, {10, 15}, @@ -4407,19 +4500,26 @@ const u16 gUnknown_083ECE1C[][2] = { {10, 35} }; -const u16 gUnknown_083ECE30[] = { +const u16 ReelTimeBonusIncrementTable[] = { 0, 5, 10, 15, 20 }; -const u8 gUnknown_083ECE3A[] = { - 6, 4, 3, 2, 5, 0, 0, 0 +// tentative name +const u8 LuckyFlagTagOutput[] = { + SLOT_MACHINE_TAG_REPLAY, SLOT_MACHINE_TAG_CHERRY, SLOT_MACHINE_TAG_LOTAD, SLOT_MACHINE_TAG_AZURILL, SLOT_MACHINE_TAG_POWER, SLOT_MACHINE_TAG_7_RED, SLOT_MACHINE_TAG_7_RED, SLOT_MACHINE_TAG_7_RED }; -const u16 gUnknown_083ECE42[] = { +/* +sSlotMachine->luckyFlags: 7, 6, 5, 4, 3, 2, 1, 0 +If you got Lucky2 in 1 attempt, flag 7 gets set. +If you got Lucky2 in 2 attempts, flag 5 gets set. +If you got Lucky2 in 3 attempts, flag 6 gets set. +*/ +const u16 FlagsAttemptAtLuckiness1[] = { // order seems buggy 0x80, 0x20, 0x40 }; -const u16 gUnknown_083ECE48[] = { +const u16 FlagsAttemptAtLuckiness2[] = { 0x10, 0x08, 0x04, 0x02, 0x01 }; diff --git a/src/task.c b/src/task.c index 14b97a361..a2df66de8 100644 --- a/src/task.c +++ b/src/task.c @@ -1,9 +1,6 @@ #include "global.h" #include "task.h" -#define HEAD_SENTINEL 0xFE -#define TAIL_SENTINEL 0xFF - struct Task gTasks[NUM_TASKS]; static void InsertTask(u8 newTaskId); diff --git a/src/tv.c b/src/tv.c index f282b09f0..cbeb189a8 100644 --- a/src/tv.c +++ b/src/tv.c @@ -62,7 +62,7 @@ IWRAM_DATA s8 sTVShowMixingCurSlot; EWRAM_DATA u16 sPokemonAnglerSpecies = 0; EWRAM_DATA u16 sPokemonAnglerAttemptCounters = 0; EWRAM_DATA u16 sFindThatGamerCoinsSpent = 0; -EWRAM_DATA bool8 sFindThatGamerWhichGame = FALSE; +EWRAM_DATA bool8 sFindThatGamerWhichGame = SLOT_MACHINE; EWRAM_DATA ALIGNED(4) u8 sRecordMixingPartnersWithoutShowsToShare = 0; EWRAM_DATA ALIGNED(4) u8 sTVShowState = 0; EWRAM_DATA u8 sTVSecretBaseSecretsRandomValues[3] = {}; @@ -2019,7 +2019,7 @@ void sub_80EDCE8(void) } } -void sub_80EDD78(u16 nCoinsPaidOut) +void reportNewCoinTotal(u16 nCoinsPaidOut) { TVShow *show; bool8 flag; @@ -2031,7 +2031,7 @@ void sub_80EDD78(u16 nCoinsPaidOut) flag = FALSE; switch (sFindThatGamerWhichGame) { - case FALSE: + case SLOT_MACHINE: if (nCoinsPaidOut >= sFindThatGamerCoinsSpent + 200) { flag = TRUE; @@ -2044,7 +2044,7 @@ void sub_80EDD78(u16 nCoinsPaidOut) break; } return; - case TRUE: + case ROULETTE: if (nCoinsPaidOut >= sFindThatGamerCoinsSpent + 50) { flag = TRUE; @@ -2072,15 +2072,15 @@ void sub_80EDD78(u16 nCoinsPaidOut) } } -void sub_80EDE70(u16 nCoinsSpent) +void reportPlayedSlotMachine(u16 nCoinsSpent) { - sFindThatGamerWhichGame = FALSE; + sFindThatGamerWhichGame = SLOT_MACHINE; sFindThatGamerCoinsSpent = nCoinsSpent; } -void sub_80EDE84(u16 nCoinsSpent) +void reportPlayedRoulette(u16 nCoinsSpent) { - sFindThatGamerWhichGame = TRUE; + sFindThatGamerWhichGame = ROULETTE; sFindThatGamerCoinsSpent = nCoinsSpent; } From 67fe781ed2fd5f09fdf47a9c8026177e740f3208 Mon Sep 17 00:00:00 2001 From: hondew Date: Thu, 7 Feb 2019 13:39:18 -0500 Subject: [PATCH 03/14] clean up slot machine until AwardPayout --- include/tv.h | 4 +- src/roulette.c | 2 +- src/slot_machine.c | 214 ++++++++++++++++++++++----------------------- src/tv.c | 4 +- 4 files changed, 112 insertions(+), 112 deletions(-) diff --git a/include/tv.h b/include/tv.h index 0f50f2327..a5c26af0c 100644 --- a/include/tv.h +++ b/include/tv.h @@ -26,8 +26,8 @@ bool8 GetPriceReduction(u8 newsKind); void sub_80F14F8(TVShow *shows); size_t CountDigits(int value); u8 GetRibbonCount(struct Pokemon *pokemon); -void reportPlayedSlotMachine(u16 nCoinsSpent); -void reportPlayedRoulette(u16 nCoinsSpent); +void AlertTVThatYouPlayedSlotMachine(u16 nCoinsSpent); +void AlertTVThatYouPlayedRoulette(u16 nCoinsSpent); void reportNewCoinTotal(u16 nCoinsPaidOut); void sub_80EEA70(void); void sub_80EDB44(void); diff --git a/src/roulette.c b/src/roulette.c index b19750f2a..fa2b6c579 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -996,7 +996,7 @@ static void sub_81405CC(void) taskId = gUnknown_0203AB88->varA4 = CreateTask(sub_81408A8, 0); gTasks[taskId].data[6] = 6; gTasks[taskId].data[13] = GetCoins(); - reportPlayedRoulette(GetCoins()); + AlertTVThatYouPlayedRoulette(GetCoins()); gUnknown_0203AB88->varA5 = CreateTask(sub_8140814, 1); SetMainCallback2(sub_8140238); return; diff --git a/src/slot_machine.c b/src/slot_machine.c index 7552e755c..9bb12df81 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -65,7 +65,7 @@ struct SlotMachineEwramStruct /*0x03*/ u8 luckyGame; /*0x04*/ u8 luckyFlags; /*0x05*/ u8 reelTimeDraw; - /*0x06*/ u8 isBiasTagMatchPossible; // tentative + /*0x06*/ u8 luckySpinsLeft; // tentative /*0x07*/ u8 biasTag; /*0x08*/ u16 matchedSymbols; /*0x0A*/ u8 fairRollsLeft; @@ -77,15 +77,15 @@ struct SlotMachineEwramStruct /*0x14*/ s16 reelTimePixelOffset; /*0x16*/ s16 reelTimePosition; /*0x18*/ s16 currReel; - /*0x1A*/ s16 reelIncrement; + /*0x1A*/ s16 reelIncrement; // speed of reel /*0x1C*/ s16 reelPixelOffsets[3]; /*0x22*/ u16 stopReelPixelOffset[3]; /*0x28*/ s16 reelPositions[3]; /*0x2E*/ s16 reelExtraTurns[3]; - /*0x34*/ s16 biasTagFinalPositions[3]; + /*0x34*/ s16 biasTagFinalPositions[3]; /*0x3A*/ u8 reelTasks[3]; /*0x3D*/ u8 unkTaskPointer3D; - /*0x3E*/ u8 unkTaskPointer; + /*0x3E*/ u8 unkTaskPointer3E; /*0x3F*/ u8 reelTimeSprite3F; /*0x40*/ u8 unk40; /*0x41*/ u8 unk41; @@ -134,7 +134,7 @@ struct UnkStruct1 /*static */void SlotMachineSetup_9_0(void); /*static */void SlotMachineSetup_10_0(void); /*static */void SlotMachineSetupGameplayTasks(void); -/*static */void GameplayTasks_Slot(void); +/*static */void GameplayTasks_Slots(void); /*static */void sub_8104DA4(void); /*static */void RunSlotActions(u8 taskId); /*static */bool8 SlotAction_UnfadeScreen(struct Task *task); @@ -144,34 +144,34 @@ struct UnkStruct1 /*static */bool8 SlotAction4(struct Task *task); /*static */bool8 SlotAction_AwaitPlayerInput(struct Task *task); /*static */bool8 SlotAction_PrintYouDontHaveThreeCoins(struct Task *task); -/*static */bool8 SlotAction_PlayerAcceptsNotHavingThreeCoins(struct Task *task); +/*static */bool8 SlotAction_ExitYouDontHaveThreeCoinsDialogue(struct Task *task); /*static */bool8 SlotAction_GivingInformation(struct Task *task); /*static */bool8 SlotAction9(struct Task *task); /*static */bool8 SlotAction10(struct Task *task); -/*static */bool8 SlotAction11(struct Task *task); +/*static */bool8 SlotAction_SetLuckySpins(struct Task *task); /*static */bool8 SlotAction_AwaitReelStop(struct Task *task); /*static */bool8 SlotAction_WaitForAllReelsToStop(struct Task *task); /*static */bool8 SlotAction_CheckMatches(struct Task *task); /*static */bool8 SlotAction_WaitForPayoutToBeAwarded(struct Task *task); /*static */bool8 SlotAction_EndOfRoll(struct Task *task); -/*static */bool8 SlotAction17(struct Task *task); +/*static */bool8 SlotAction_MatchedPower(struct Task *task); /*static */bool8 SlotAction18(struct Task *task); /*static */bool8 SlotAction_Loop(struct Task *task); /*static */bool8 SlotAction_NoMatches(struct Task *task); /*static */bool8 SlotAction_PrintQuitTheGame(struct Task *task); /*static */bool8 SlotAction_SeeIfPlayerQuits(struct Task *task); /*static */bool8 SlotAction_Print9999CoinMessage(struct Task *task); -/*static */bool8 SlotAction_Escape9999CoinMessage(struct Task *task); +/*static */bool8 SlotAction_Exit9999CoinMessage(struct Task *task); /*static */bool8 SlotAction_PrintNoMoreCoins(struct Task *task); -/*static */bool8 SlotAction_EscapeNoMoreCoins(struct Task *task); +/*static */bool8 SlotAction_ExitNoMoreCoinsMessage(struct Task *task); /*static */bool8 SlotAction_EndGame(struct Task *task); /*static */bool8 SlotAction_FreeDataStructures(struct Task *task); -/*static */void DrawForLuckyFlags(void); -/*static */void AnyLuckyFlagsSet(void); -/*static */bool8 IsLuckyRound(void); -/*static */u8 AttemptsAtLuckiness1(void); +/*static */void DrawLuckyFlags(void); +/*static */void SetLuckySpins(void); +/*static */bool8 IsThisRoundLucky(void); +/*static */u8 AttemptsAtLuckyflags_Top3(void); /*static */u16 DrawNewReelIncrement(void); -/*static */u8 AttemptsAtLuckiness2(void); +/*static */u8 AttemptsAtLuckyflags_NotTop3(void); /*static */void CheckMatch(void); /*static */void CheckMatch_CenterRow(void); /*static */void CheckMatch_TopAndBottom(void); @@ -185,7 +185,7 @@ struct UnkStruct1 /*static */bool8 AwardPayoutAction_FreeTask(struct Task *task); /*static */u8 GetNearbyTag(u8 x, s16 y); /*static */void GameplayTask_StopReel(void); -/*static */void ReelTasks_8102DEC(u8 a0); +/*static */void ReelTasks_SetUnkTaskData(u8 a0); /*static */void sub_8102E1C(u8 a0); /*static */bool8 IsReelMoving(u8 a0); /*static */void RunReelActions(u8 taskId); @@ -228,7 +228,7 @@ struct UnkStruct1 /*static */void sub_8103F70(void); /*static */bool8 sub_8103FA0(void); /*static */void sub_8103FE8_(u8 taskId); -/*static */void sub_8104048(void); +/*static */void GameplayTasks_PikaPower(void); /*static */void DisplayPikaPower(u8 pikaPower); /*static */bool8 sub_81040C8(void); /*static */void sub_81040E8(u8 taskId); @@ -262,7 +262,7 @@ struct UnkStruct1 /*static */void sub_8104A40(s16 a0, s16 a1); /*static */void sub_8104A88(s16 a0); /*static */void OpenInfoBox(u8 a0); -/*static */bool8 ClosedInfoBox(void); +/*static */bool8 IsInfoBoxClosed(void); /*static */void RunInfoBoxActions(u8 taskId); /*static */void InfoBox_FadeIn(struct Task *task); /*static */void InfoBox_WaitForFade(struct Task *task); @@ -355,10 +355,10 @@ static IWRAM_DATA struct SpriteFrameImage *gUnknown_03001188[26]; // Const rom data. extern const struct UnkStruct1 *const gUnknown_083ED048[]; extern const u16 gPalette_83EDE24[]; -extern const u8 sSlotLuckinessTable1[][3]; -extern const u8 LuckyFlagTagOutput[]; -extern const u16 FlagsAttemptAtLuckiness1[]; -extern const u16 FlagsAttemptAtLuckiness2[]; +extern const u8 LuckyRoundTable[][3]; +extern const u8 LuckyTags[]; +extern const u16 LuckyFlagSettings_Top3[]; +extern const u16 LuckyFlagSettings_NotTop3[]; extern const s16 gUnknown_083ECE7E[][2]; extern const SpriteCallback gUnknown_083ECF0C[]; extern const struct SpriteTemplate *const gUnknown_083EDB5C[]; @@ -384,10 +384,10 @@ extern const u16 *const gUnknown_083EDE20; extern const s16 sInitialReelPositions[][2]; extern const struct BgTemplate gUnknown_085A7424[4]; extern const struct WindowTemplate gUnknown_085A7434[]; -extern const u8 sSlotLuckinessTable2[][6]; -extern const u8 sSlotLuckinessTable3[][6]; -extern const u8 ReelTimeProbabilityTable0[][17]; -extern const u8 ReelTimeProbabilityTable1[][17]; +extern const u8 LuckyFlagsTable_Top3[][6]; +extern const u8 LuckyFlagsTable_NotTop3[][6]; +extern const u8 ReelTimeProbabilityTable_UnluckyGame[][17]; +extern const u8 ReelTimeProbabilityTable_LuckyGame[][17]; extern const u8 sSym2Match[]; extern const u8 gUnknown_083ECCF1[]; extern const u8 sReelSymbols[][REEL_NUM_TAGS]; @@ -464,26 +464,26 @@ bool8 (*const SlotActions[])(struct Task *task) = SlotAction4, SlotAction_AwaitPlayerInput, SlotAction_PrintYouDontHaveThreeCoins, - SlotAction_PlayerAcceptsNotHavingThreeCoins, + SlotAction_ExitYouDontHaveThreeCoinsDialogue, SlotAction_GivingInformation, SlotAction9, SlotAction10, - SlotAction11, + SlotAction_SetLuckySpins, SlotAction_AwaitReelStop, SlotAction_WaitForAllReelsToStop, SlotAction_CheckMatches, SlotAction_WaitForPayoutToBeAwarded, SlotAction_EndOfRoll, - SlotAction17, + SlotAction_MatchedPower, SlotAction18, SlotAction_Loop, SlotAction_NoMatches, SlotAction_PrintQuitTheGame, SlotAction_SeeIfPlayerQuits, SlotAction_Print9999CoinMessage, - SlotAction_Escape9999CoinMessage, + SlotAction_Exit9999CoinMessage, SlotAction_PrintNoMoreCoins, - SlotAction_EscapeNoMoreCoins, + SlotAction_ExitNoMoreCoinsMessage, SlotAction_EndGame, SlotAction_FreeDataStructures, }; @@ -863,7 +863,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sSlotMachine->reelPixelOffsets[i] = 0x1f8 - sSlotMachine->reelPositions[i] * 24; sSlotMachine->reelPixelOffsets[i] %= 0x1f8; // 0x1f8 is 540 } - reportPlayedSlotMachine(GetCoins()); + AlertTVThatYouPlayedSlotMachine(GetCoins()); } /*static */void SlotMachineSetup_3_0(void) @@ -891,7 +891,6 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue gUnknown_0203AAD0[6] = 0x20BF; } -// machine wheel stuff /*static */void SlotMachineSetup_5_0(void) { sub_8106448(); @@ -910,16 +909,16 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sub_81050C4(); } -// create next gameplay task +// create gameplay tasks /*static */void SlotMachineSetupGameplayTasks(void) { - sub_8104048(); + GameplayTasks_PikaPower(); GameplayTask_StopReel(); sub_8104C5C(); - GameplayTasks_Slot(); + GameplayTasks_Slots(); } -/*static */void GameplayTasks_Slot(void) +/*static */void GameplayTasks_Slots(void) { RunSlotActions(CreateTask(RunSlotActions, 0)); } @@ -1015,10 +1014,10 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sSlotMachine->coins--; sSlotMachine->bet++; } - // if player maxed out or finished betting + // player maxed out or finished betting if (sSlotMachine->bet >= 3 || (sSlotMachine->bet != 0 && gMain.newKeys & A_BUTTON)) sSlotMachine->slotActionPtr = 9; - // if player wants to quit + // player wants to quit if (gMain.newKeys & B_BUTTON) sSlotMachine->slotActionPtr = 21; } @@ -1034,7 +1033,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */bool8 SlotAction_PlayerAcceptsNotHavingThreeCoins(struct Task *task) +/*static */bool8 SlotAction_ExitYouDontHaveThreeCoinsDialogue(struct Task *task) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { @@ -1046,7 +1045,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue /*static */bool8 SlotAction_GivingInformation(struct Task *task) { - if (ClosedInfoBox()) + if (IsInfoBoxClosed()) sSlotMachine->slotActionPtr = 5; return FALSE; } @@ -1054,14 +1053,16 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue // probably make all the slots roll /*static */bool8 SlotAction9(struct Task *task) { - DrawForLuckyFlags(); + DrawLuckyFlags(); sub_8104DA4(); + // for each reel... - //...do a reel task - ReelTasks_8102DEC(0); - ReelTasks_8102DEC(1); - ReelTasks_8102DEC(2); + ReelTasks_SetUnkTaskData(0); + ReelTasks_SetUnkTaskData(1); + ReelTasks_SetUnkTaskData(2); + sub_80EEC80(); // something with daily slot variable + task->data[0] = 0; if (sSlotMachine->luckyFlags & 0x20) // bit 5 of luckyFlag set { @@ -1093,11 +1094,11 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */bool8 SlotAction11(struct Task *task) +/*static */bool8 SlotAction_SetLuckySpins(struct Task *task) { if (++task->data[0] >= 30) { - AnyLuckyFlagsSet(); + SetLuckySpins(); sSlotMachine->slotActionPtr = 12; } return FALSE; @@ -1166,6 +1167,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue PlayFanfare(MUS_ME_B_SMALL); sub_8104CAC(2); } + // if you matched 777... if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_MIXED) | (1 << SLOT_MACHINE_MATCHED_777_BLUE) | (1 << SLOT_MACHINE_MATCHED_777_RED))) { // clear top bits 6 and 7 @@ -1226,7 +1228,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */bool8 SlotAction17(struct Task *task) +/*static */bool8 SlotAction_MatchedPower(struct Task *task) { if (!sub_81040C8()) { @@ -1315,7 +1317,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */bool8 SlotAction_Escape9999CoinMessage(struct Task *task) +/*static */bool8 SlotAction_Exit9999CoinMessage(struct Task *task) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { @@ -1334,7 +1336,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */bool8 SlotAction_EscapeNoMoreCoins(struct Task *task) +/*static */bool8 SlotAction_ExitNoMoreCoinsMessage(struct Task *task) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { @@ -1344,7 +1346,6 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -// possibly end game /*static */bool8 SlotAction_EndGame(struct Task *task) { SetCoins(sSlotMachine->coins); @@ -1396,96 +1397,96 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */void DrawForLuckyFlags(void) +/*static */void DrawLuckyFlags(void) { - u8 luckyAttempts; + u8 attempts; if (sSlotMachine->fairRollsLeft == 0) { if (!(sSlotMachine->luckyFlags & 0xc0)) // top 2 flags set to 0 { - if (IsLuckyRound()) + if (IsThisRoundLucky()) { - luckyAttempts = AttemptsAtLuckiness1(); - if (luckyAttempts != 3) // if you found a lucky number + attempts = AttemptsAtLuckyflags_Top3(); + if (attempts != 3) // if you found a lucky number { - // luckyAttempts == 1: reelTime flag set - sSlotMachine->luckyFlags |= FlagsAttemptAtLuckiness1[luckyAttempts]; - if (luckyAttempts != 1) + // attempts == 1: reelTime flag set + sSlotMachine->luckyFlags |= LuckyFlagSettings_Top3[attempts]; + if (attempts != 1) { return; } } } // if you got it your first try, you get to try again for the lower lucky flags - luckyAttempts = AttemptsAtLuckiness2(); - if (luckyAttempts != 5) // if you found a lucky number + attempts = AttemptsAtLuckyflags_NotTop3(); + if (attempts != 5) // if you found a lucky number { - sSlotMachine->luckyFlags |= FlagsAttemptAtLuckiness2[luckyAttempts]; + sSlotMachine->luckyFlags |= LuckyFlagSettings_NotTop3[attempts]; } } } } -/*static */void AnyLuckyFlagsSet(void) +/*static */void SetLuckySpins(void) { - sSlotMachine->isBiasTagMatchPossible = 0; + sSlotMachine->luckySpinsLeft = 0; if (sSlotMachine->luckyFlags) - sSlotMachine->isBiasTagMatchPossible = 1; + sSlotMachine->luckySpinsLeft = 1; } -/*static */u8 GetLuckyFlagTagOutput(u8 luckyFlags) +/*static */u8 GetLuckyTag(u8 luckyFlags) { u8 i; for (i = 0; i < 8; i++) { if (luckyFlags & 1) - return LuckyFlagTagOutput[i]; + return LuckyTags[i]; luckyFlags >>= 1; } return 0; } -/*static */bool8 IsLuckyRound(void) +/*static */bool8 IsThisRoundLucky(void) { u8 rval = Random(); - if (sSlotLuckinessTable1[sSlotMachine->machineId][sSlotMachine->bet - 1] > rval) + if (LuckyRoundTable[sSlotMachine->machineId][sSlotMachine->bet - 1] > rval) return TRUE; return FALSE; } -/*static */u8 AttemptsAtLuckiness1(void) +/*static */u8 AttemptsAtLuckyflags_Top3(void) { - s16 countAttempts; + s16 count; - for (countAttempts = 0; countAttempts < 3; countAttempts++) + for (count = 0; count < 3; count++) { s16 rval = Random() & 0xff; - s16 value = sSlotLuckinessTable2[countAttempts][sSlotMachine->machineId]; + s16 value = LuckyFlagsTable_Top3[count][sSlotMachine->machineId]; if (value > rval) break; } - return countAttempts; + return count; } -/*static */u8 AttemptsAtLuckiness2(void) +/*static */u8 AttemptsAtLuckyflags_NotTop3(void) { - s16 countAttempts; + s16 count; - for (countAttempts = 0; countAttempts < 5; countAttempts++) + for (count = 0; count < 5; count++) { s16 rval = Random() & 0xff; // random byte - s16 value = sSlotLuckinessTable3[countAttempts][sSlotMachine->machineId]; + s16 value = LuckyFlagsTable_NotTop3[count][sSlotMachine->machineId]; // make first attempt easier if it's a lucky game - if (countAttempts == 0 && sSlotMachine->luckyGame == 1) + if (count == 0 && sSlotMachine->luckyGame == 1) { value += 10; if (value > 0x100) value = 0x100; } // make last attempt harder if it's a lucky game - else if (countAttempts == 4 && sSlotMachine->luckyGame == 1) + else if (count == 4 && sSlotMachine->luckyGame == 1) { value -= 10; if (value < 0) @@ -1494,15 +1495,15 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue if (value > rval) break; } - return countAttempts; + return count; } /*static */u8 GetReelTimeProbability(u8 reelTimeDraw) { if (sSlotMachine->luckyGame == 0) - return ReelTimeProbabilityTable0[reelTimeDraw][sSlotMachine->pikaPower]; + return ReelTimeProbabilityTable_UnluckyGame[reelTimeDraw][sSlotMachine->pikaPower]; else - return ReelTimeProbabilityTable1[reelTimeDraw][sSlotMachine->pikaPower]; + return ReelTimeProbabilityTable_LuckyGame[reelTimeDraw][sSlotMachine->pikaPower]; } /*static */void DrawReelTimeOutcome(void) @@ -1806,7 +1807,7 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) } } -/*static */void ReelTasks_8102DEC(u8 reelIndex) +/*static */void ReelTasks_SetUnkTaskData(u8 reelIndex) { gTasks[sSlotMachine->reelTasks[reelIndex]].data[0] = 1; gTasks[sSlotMachine->reelTasks[reelIndex]].data[14] = 1; @@ -1845,13 +1846,13 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) /*static */bool8 ReelAction_DecideWhereToStop(struct Task *task) { task->data[0]++; - // initialize data for that reel --> these will be manipulated if biasTags can be lined up + // initialize data for that reel --> these will be changed if biasTags can be lined up sSlotMachine->biasTagFinalPositions[task->data[15]] = 0; sSlotMachine->reelExtraTurns[task->data[15]] = 0; - if (sSlotMachine->fairRollsLeft == 0 && (sSlotMachine->luckyFlags == 0 || sSlotMachine->isBiasTagMatchPossible == 0 || !DecideReelTurns_BiasTag[task->data[15]]())) + if (sSlotMachine->fairRollsLeft == 0 && (sSlotMachine->luckyFlags == 0 || sSlotMachine->luckySpinsLeft == 0 || !DecideReelTurns_BiasTag[task->data[15]]())) { - sSlotMachine->isBiasTagMatchPossible = 0; + sSlotMachine->luckySpinsLeft = 0; DecideReelTurns_NoBiasTag[task->data[15]](); } task->data[1] = sSlotMachine->reelExtraTurns[task->data[15]]; @@ -1902,7 +1903,7 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) /*static */bool8 DecideReelTurns_BiasTag_Reel1(void) { - u8 tag2 = GetLuckyFlagTagOutput(sSlotMachine->luckyFlags); + u8 tag2 = GetLuckyTag(sSlotMachine->luckyFlags); u8 tag1 = tag2; if (sSlotMachine->luckyFlags & 0xc0) // if either of top 2 bits are set { @@ -2489,7 +2490,7 @@ Advance until there are no cherries on screen in reel 1 LoadPalette(gUnknown_083EDD1C[a0], gUnknown_083EDD30[a0], 2); } -// probably light the bet number +// light up the value bet by the player /*static */void LoadBetTiles(u8 betVal) { u8 i; @@ -2621,15 +2622,14 @@ Advance until there are no cherries on screen in reel 1 LoadPalette(gUnknown_083EDDA0[task->data[2]], 0x10, 0x20); } -/*static */void sub_8104048(void) +/*static */void GameplayTasks_PikaPower(void) { - sSlotMachine->unkTaskPointer = CreateTask(sub_81040E8, 8); + sSlotMachine->unkTaskPointer3E = CreateTask(sub_81040E8, 8); } -// possibly clear pikaPower /*static */void DisplayPikaPower(u8 pikaPower) { - struct Task *task = gTasks + sSlotMachine->unkTaskPointer; + struct Task *task = gTasks + sSlotMachine->unkTaskPointer3E; ClearTaskDataFields_2orHigher(task); task->data[0] = 1; task->data[1]++; @@ -2638,7 +2638,7 @@ Advance until there are no cherries on screen in reel 1 /*static */void sub_8104098(void) { - struct Task *task = gTasks + sSlotMachine->unkTaskPointer; + struct Task *task = gTasks + sSlotMachine->unkTaskPointer3E; ClearTaskDataFields_2orHigher(task); task->data[0] = 3; task->data[15] = 1; // points to a reelIndex @@ -2646,10 +2646,10 @@ Advance until there are no cherries on screen in reel 1 /*static */bool8 sub_81040C8(void) { - return gTasks[sSlotMachine->unkTaskPointer].data[15]; + return gTasks[sSlotMachine->unkTaskPointer3E].data[15]; } -/*static */void sub_81040E8(u8 taskId) // debug to see if taskId is machineId +/*static */void sub_81040E8(u8 taskId) { gUnknown_083ECBB4[gTasks[taskId].data[0]](gTasks + taskId); } @@ -2741,7 +2741,7 @@ Advance until there are no cherries on screen in reel 1 selectedPikaPowerTile[r1] = pikaPowerTileTable[r3][1]; LoadBgTilemap(2, &selectedPikaPowerTile[r1], 2, r4 + 0x40); } - gTasks[sSlotMachine->unkTaskPointer].data[1] = pikaPower; + gTasks[sSlotMachine->unkTaskPointer3E].data[1] = pikaPower; } /*static */void BeginReelTime(void) @@ -3094,7 +3094,7 @@ Advance until there are no cherries on screen in reel 1 RunInfoBoxActions(taskId); } -/*static */bool8 ClosedInfoBox(void) +/*static */bool8 IsInfoBoxClosed(void) { if (FindTaskIdByFunc(RunInfoBoxActions) == 0xFF) return TRUE; @@ -4447,7 +4447,7 @@ const s16 sInitialReelPositions[][2] = { {0, 2} }; -const u8 sSlotLuckinessTable1[][3] = { +const u8 LuckyRoundTable[][3] = { {1, 1, 12}, {1, 1, 14}, {2, 2, 14}, @@ -4456,13 +4456,13 @@ const u8 sSlotLuckinessTable1[][3] = { {3, 3, 16} }; -const u8 sSlotLuckinessTable2[][6] = { +const u8 LuckyFlagsTable_Top3[][6] = { {25, 25, 30, 40, 40, 50}, {25, 25, 30, 30, 35, 35}, {25, 25, 30, 25, 25, 30} }; -const u8 sSlotLuckinessTable3[][6] = { +const u8 LuckyFlagsTable_NotTop3[][6] = { {20, 25, 25, 20, 25, 25}, {12, 15, 15, 18, 19, 22}, {25, 25, 25, 30, 30, 40}, @@ -4470,7 +4470,7 @@ const u8 sSlotLuckinessTable3[][6] = { {40, 40, 35, 35, 40, 40} }; -const u8 ReelTimeProbabilityTable0[][17] = { +const u8 ReelTimeProbabilityTable_UnluckyGame[][17] = { {243, 243, 243, 80, 80, 80, 80, 40, 40, 40, 40, 40, 40, 5, 5, 5, 5}, { 5, 5, 5, 150, 150, 150, 150, 130, 130, 130, 130, 130, 130, 100, 100, 100, 5}, { 4, 4, 4, 20, 20, 20, 20, 80, 80, 80, 80, 80, 80, 100, 100, 100, 40}, @@ -4479,7 +4479,7 @@ const u8 ReelTimeProbabilityTable0[][17] = { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6} }; -const u8 ReelTimeProbabilityTable1[][17] = { +const u8 ReelTimeProbabilityTable_LuckyGame[][17] = { { 243, 243, 243, 200, 200, 200, 200, 160, 160, 160, 160, 160, 160, 70, 70, 70, 5}, { 5, 5, 5, 25, 25, 25, 25, 5, 5, 5, 5, 5, 5, 2, 2, 2, 6}, { 4, 4, 4, 25, 25, 25, 25, 30, 30, 30, 30, 30, 30, 40, 40, 40, 35}, @@ -4505,7 +4505,7 @@ const u16 ReelTimeBonusIncrementTable[] = { }; // tentative name -const u8 LuckyFlagTagOutput[] = { +const u8 LuckyTags[] = { SLOT_MACHINE_TAG_REPLAY, SLOT_MACHINE_TAG_CHERRY, SLOT_MACHINE_TAG_LOTAD, SLOT_MACHINE_TAG_AZURILL, SLOT_MACHINE_TAG_POWER, SLOT_MACHINE_TAG_7_RED, SLOT_MACHINE_TAG_7_RED, SLOT_MACHINE_TAG_7_RED }; @@ -4515,11 +4515,11 @@ If you got Lucky2 in 1 attempt, flag 7 gets set. If you got Lucky2 in 2 attempts, flag 5 gets set. If you got Lucky2 in 3 attempts, flag 6 gets set. */ -const u16 FlagsAttemptAtLuckiness1[] = { // order seems buggy +const u16 LuckyFlagSettings_Top3[] = { // order seems buggy 0x80, 0x20, 0x40 }; -const u16 FlagsAttemptAtLuckiness2[] = { +const u16 LuckyFlagSettings_NotTop3[] = { 0x10, 0x08, 0x04, 0x02, 0x01 }; diff --git a/src/tv.c b/src/tv.c index cbeb189a8..27f779c2d 100644 --- a/src/tv.c +++ b/src/tv.c @@ -2072,13 +2072,13 @@ void reportNewCoinTotal(u16 nCoinsPaidOut) } } -void reportPlayedSlotMachine(u16 nCoinsSpent) +void AlertTVThatYouPlayedSlotMachine(u16 nCoinsSpent) { sFindThatGamerWhichGame = SLOT_MACHINE; sFindThatGamerCoinsSpent = nCoinsSpent; } -void reportPlayedRoulette(u16 nCoinsSpent) +void AlertTVThatYouPlayedRoulette(u16 nCoinsSpent) { sFindThatGamerWhichGame = ROULETTE; sFindThatGamerCoinsSpent = nCoinsSpent; From f8f046c850697a86dae1d244fc80911497bd2d1c Mon Sep 17 00:00:00 2001 From: hondew Date: Thu, 7 Feb 2019 19:13:23 -0500 Subject: [PATCH 04/14] clean up slot machine more --- src/slot_machine.c | 423 ++++++++++++++++++++++----------------------- 1 file changed, 210 insertions(+), 213 deletions(-) diff --git a/src/slot_machine.c b/src/slot_machine.c index 9bb12df81..bb6925bd8 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -79,11 +79,11 @@ struct SlotMachineEwramStruct /*0x18*/ s16 currReel; /*0x1A*/ s16 reelIncrement; // speed of reel /*0x1C*/ s16 reelPixelOffsets[3]; - /*0x22*/ u16 stopReelPixelOffset[3]; - /*0x28*/ s16 reelPositions[3]; + /*0x22*/ u16 reelPixelOffsetsWhileStopping[3]; + /*0x28*/ s16 reelTagOffsets[3]; /*0x2E*/ s16 reelExtraTurns[3]; - /*0x34*/ s16 biasTagFinalPositions[3]; - /*0x3A*/ u8 reelTasks[3]; + /*0x34*/ s16 biasTagLocation[3]; + /*0x3A*/ u8 slotReelTasks[3]; /*0x3D*/ u8 unkTaskPointer3D; /*0x3E*/ u8 unkTaskPointer3E; /*0x3F*/ u8 reelTimeSprite3F; @@ -180,20 +180,20 @@ struct UnkStruct1 /*static */void AwardPayout(void); /*static */void RunAwardPayoutActions(u8 taskId); /*static */bool8 IsFinalTask_RunAwardPayoutActions(void); -/*static */bool8 AwardPayoutAction1(struct Task *task); +/*static */bool8 AwardPayoutAction0(struct Task *task); /*static */bool8 AwardPayoutAction_GivePayoutToPlayer(struct Task *task); /*static */bool8 AwardPayoutAction_FreeTask(struct Task *task); -/*static */u8 GetNearbyTag(u8 x, s16 y); -/*static */void GameplayTask_StopReel(void); +/*static */u8 GetNearbyTag_Quantized(u8 x, s16 y); +/*static */void GameplayTask_StopSlotReel(void); /*static */void ReelTasks_SetUnkTaskData(u8 a0); /*static */void sub_8102E1C(u8 a0); -/*static */bool8 IsReelMoving(u8 a0); -/*static */void RunReelActions(u8 taskId); -/*static */bool8 ReelAction_StayStill(struct Task *task); -/*static */bool8 ReelAction_Spin(struct Task *task); -/*static */bool8 ReelAction_DecideWhereToStop(struct Task *task); -/*static */bool8 ReelAction_TurnToSelectedTag(struct Task *task); -/*static */bool8 ReelAction_OscillatingStop(struct Task *task); +/*static */bool8 IsSlotReelMoving(u8 a0); +/*static */void RunSlotReelActions(u8 taskId); +/*static */bool8 SlotReelAction_StayStill(struct Task *task); +/*static */bool8 SlotReelAction_Spin(struct Task *task); +/*static */bool8 SlotReelAction_DecideWhereToStop(struct Task *task); +/*static */bool8 SlotReelAction_MoveToStop(struct Task *task); +/*static */bool8 SlotReelAction_OscillatingStop(struct Task *task); /*static */bool8 DecideReelTurns_BiasTag_Reel1(void); /*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet1(u8 a0, u8 a1); /*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet2or3(u8 a0, u8 a1); @@ -389,7 +389,7 @@ extern const u8 LuckyFlagsTable_NotTop3[][6]; extern const u8 ReelTimeProbabilityTable_UnluckyGame[][17]; extern const u8 ReelTimeProbabilityTable_LuckyGame[][17]; extern const u8 sSym2Match[]; -extern const u8 gUnknown_083ECCF1[]; +extern const u8 ReelTimeTags[]; extern const u8 sReelSymbols[][REEL_NUM_TAGS]; extern const u16 *const gUnknown_083EDD08[]; extern const u16 *const gUnknown_083EDD1C[]; @@ -490,18 +490,18 @@ bool8 (*const SlotActions[])(struct Task *task) = bool8 (*const AwardPayoutActions[])(struct Task *task) = { - AwardPayoutAction1, + AwardPayoutAction0, AwardPayoutAction_GivePayoutToPlayer, AwardPayoutAction_FreeTask }; -bool8 (*const ReelActions[])(struct Task *task) = +bool8 (*const SlotReelActions[])(struct Task *task) = { - ReelAction_StayStill, - ReelAction_Spin, - ReelAction_DecideWhereToStop, - ReelAction_TurnToSelectedTag, - ReelAction_OscillatingStop + SlotReelAction_StayStill, + SlotReelAction_Spin, + SlotReelAction_DecideWhereToStop, + SlotReelAction_MoveToStop, + SlotReelAction_OscillatingStop }; // returns True if a match with the biasTag is possible in that reel @@ -858,9 +858,9 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue // for each reel... for (i = 0; i < 3; i++) { - sSlotMachine->stopReelPixelOffset[i] = 0; - sSlotMachine->reelPositions[i] = sInitialReelPositions[i][sSlotMachine->luckyGame] % REEL_NUM_TAGS; - sSlotMachine->reelPixelOffsets[i] = 0x1f8 - sSlotMachine->reelPositions[i] * 24; + sSlotMachine->reelPixelOffsetsWhileStopping[i] = 0; + sSlotMachine->reelTagOffsets[i] = sInitialReelPositions[i][sSlotMachine->luckyGame] % REEL_NUM_TAGS; + sSlotMachine->reelPixelOffsets[i] = 0x1f8 - sSlotMachine->reelTagOffsets[i] * 24; sSlotMachine->reelPixelOffsets[i] %= 0x1f8; // 0x1f8 is 540 } AlertTVThatYouPlayedSlotMachine(GetCoins()); @@ -913,7 +913,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue /*static */void SlotMachineSetupGameplayTasks(void) { GameplayTasks_PikaPower(); - GameplayTask_StopReel(); + GameplayTask_StopSlotReel(); sub_8104C5C(); GameplayTasks_Slots(); } @@ -1118,7 +1118,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue /*static */bool8 SlotAction_WaitForAllReelsToStop(struct Task *task) { - if (!IsReelMoving(sSlotMachine->currReel)) + if (!IsSlotReelMoving(sSlotMachine->currReel)) { sSlotMachine->currReel++; sSlotMachine->slotActionPtr = 12; @@ -1571,9 +1571,9 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue { u8 c1, c2, c3, match; - c1 = GetNearbyTag(0, 2); - c2 = GetNearbyTag(1, 2); - c3 = GetNearbyTag(2, 2); + c1 = GetNearbyTag_Quantized(0, 2); + c2 = GetNearbyTag_Quantized(1, 2); + c3 = GetNearbyTag_Quantized(2, 2); match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { @@ -1587,9 +1587,9 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue { u8 c1, c2, c3, match; - c1 = GetNearbyTag(0, 1); - c2 = GetNearbyTag(1, 1); - c3 = GetNearbyTag(2, 1); + c1 = GetNearbyTag_Quantized(0, 1); + c2 = GetNearbyTag_Quantized(1, 1); + c3 = GetNearbyTag_Quantized(2, 1); match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { @@ -1599,9 +1599,9 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sSlotMachine->matchedSymbols |= sSlotMatchFlags[match]; sub_8103E04(1); } - c1 = GetNearbyTag(0, 3); - c2 = GetNearbyTag(1, 3); - c3 = GetNearbyTag(2, 3); + c1 = GetNearbyTag_Quantized(0, 3); + c2 = GetNearbyTag_Quantized(1, 3); + c3 = GetNearbyTag_Quantized(2, 3); match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { @@ -1617,9 +1617,9 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue { u8 c1, c2, c3, match; - c1 = GetNearbyTag(0, 1); - c2 = GetNearbyTag(1, 2); - c3 = GetNearbyTag(2, 3); + c1 = GetNearbyTag_Quantized(0, 1); + c2 = GetNearbyTag_Quantized(1, 2); + c3 = GetNearbyTag_Quantized(2, 3); match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { @@ -1630,9 +1630,9 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue } sub_8103E04(3); } - c1 = GetNearbyTag(0, 3); - c2 = GetNearbyTag(1, 2); - c3 = GetNearbyTag(2, 1); + c1 = GetNearbyTag_Quantized(0, 3); + c2 = GetNearbyTag_Quantized(1, 2); + c3 = GetNearbyTag_Quantized(2, 1); match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { @@ -1677,7 +1677,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue ; } -/*static */bool8 AwardPayoutAction1(struct Task *task) +/*static */bool8 AwardPayoutAction0(struct Task *task) { if (sub_8103E38()) { @@ -1724,130 +1724,130 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */u8 GetNearbyTag(u8 reelIndex, s16 posOffset) +/* +Returns the tag that is posOffset below the tag at the top of reelIndex's tape +*/ +/*static */u8 GetNearbyTag_Quantized(u8 reelIndex, s16 posOffset) { - /* - Returns the tag that is posOffset below the tag at the top of reelIndex's tape - */ - s16 tagIndex = (sSlotMachine->reelPositions[reelIndex] + posOffset) % REEL_NUM_TAGS; + s16 tagIndex = (sSlotMachine->reelTagOffsets[reelIndex] + posOffset) % REEL_NUM_TAGS; if (tagIndex < 0) tagIndex += REEL_NUM_TAGS; return sReelSymbols[reelIndex][tagIndex]; } -// TODO: find out how rounding works -/*static */u8 GetNearbyTag_PixelOffset(u8 reelIndex, s16 posOffset) +/* +Calculates GetNearbyTag_Quantized as if the reel was snapped downwards into place +/* +/*static */u8 GetNearbyTag(u8 reelIndex, s16 posOffset) { s16 tagOffset = 0; s16 result = sSlotMachine->reelPixelOffsets[reelIndex] % 24; if (result != 0) - tagOffset = -1; // tag will be posOffset - 1 - return GetNearbyTag(reelIndex, posOffset + tagOffset); + tagOffset = -1; + return GetNearbyTag_Quantized(reelIndex, posOffset + tagOffset); } -// TODO: make sure this is actually what's happening -/*static */u8 GetNthNextReelTimePosition(s16 n) +/*static */u8 GetNearbyReelTimeTag(s16 n) { s16 newPosition = (sSlotMachine->reelTimePosition + n) % 6; if (newPosition < 0) newPosition += 6; - return gUnknown_083ECCF1[newPosition]; + return ReelTimeTags[newPosition]; } -/*static */void IncrementReelPixelOffset(u8 reelIndex, s16 value) +/*static */void AdvanceSlotReel(u8 reelIndex, s16 value) { sSlotMachine->reelPixelOffsets[reelIndex] += value; sSlotMachine->reelPixelOffsets[reelIndex] %= 504; - sSlotMachine->reelPositions[reelIndex] = REEL_NUM_TAGS - sSlotMachine->reelPixelOffsets[reelIndex] / 24; + sSlotMachine->reelTagOffsets[reelIndex] = REEL_NUM_TAGS - sSlotMachine->reelPixelOffsets[reelIndex] / 24; } -// TODO: make sure that's actually what's happening -s16 AdvanceReelNextTag(u8 reelIndex, s16 reelIncrement) +s16 AdvanceSlotReelToNextTag(u8 reelIndex, s16 value) { - s16 value = sSlotMachine->reelPixelOffsets[reelIndex] % 24; - if (value != 0) + s16 offset = sSlotMachine->reelPixelOffsets[reelIndex] % 24; + if (offset != 0) { - if (value < reelIncrement) - reelIncrement = value; - IncrementReelPixelOffset(reelIndex, reelIncrement); - value = sSlotMachine->reelPixelOffsets[reelIndex] % 24; + if (offset < value) + value = offset; + AdvanceSlotReel(reelIndex, value); + offset = sSlotMachine->reelPixelOffsets[reelIndex] % 24; } - return value; + return offset; } -/*static */void IncrementReelTimePixelOffset(s16 value) +/*static */void AdvanceReeltimeReel(s16 value) { sSlotMachine->reelTimePixelOffset += value; sSlotMachine->reelTimePixelOffset %= 120; sSlotMachine->reelTimePosition = 6 - sSlotMachine->reelTimePixelOffset / 20; } -s16 AdvanceReelTimeNextNumber(s16 reelIncrement) +s16 AdvanceReeltimeReelToNextTag(s16 value) { - s16 value = sSlotMachine->reelTimePixelOffset % 20; - if (value != 0) + s16 offset = sSlotMachine->reelTimePixelOffset % 20; + if (offset != 0) { - if (value < reelIncrement) - reelIncrement = value; - IncrementReelTimePixelOffset(reelIncrement); - value = sSlotMachine->reelTimePixelOffset % 20; + if (offset < value) + value = offset; + AdvanceReeltimeReel(value); + offset = sSlotMachine->reelTimePixelOffset % 20; } - return value; + return offset; } -/*static */void GameplayTask_StopReel(void) +/*static */void GameplayTask_StopSlotReel(void) { u8 i; for (i = 0; i < 3; i++) { - u8 taskId = CreateTask(RunReelActions, 2); + u8 taskId = CreateTask(RunSlotReelActions, 2); gTasks[taskId].data[15] = i; - sSlotMachine->reelTasks[i] = taskId; - RunReelActions(taskId); + sSlotMachine->slotReelTasks[i] = taskId; + RunSlotReelActions(taskId); } } /*static */void ReelTasks_SetUnkTaskData(u8 reelIndex) { - gTasks[sSlotMachine->reelTasks[reelIndex]].data[0] = 1; - gTasks[sSlotMachine->reelTasks[reelIndex]].data[14] = 1; + gTasks[sSlotMachine->slotReelTasks[reelIndex]].data[0] = 1; + gTasks[sSlotMachine->slotReelTasks[reelIndex]].data[14] = 1; } /*static */void sub_8102E1C(u8 reelIndex) { - gTasks[sSlotMachine->reelTasks[reelIndex]].data[0] = 2; + gTasks[sSlotMachine->slotReelTasks[reelIndex]].data[0] = 2; } -/*static */bool8 IsReelMoving(u8 reelIndex) +/*static */bool8 IsSlotReelMoving(u8 reelIndex) { - return gTasks[sSlotMachine->reelTasks[reelIndex]].data[14]; + return gTasks[sSlotMachine->slotReelTasks[reelIndex]].data[14]; } -/*static */void RunReelActions(u8 taskId) +/*static */void RunSlotReelActions(u8 taskId) { - while (ReelActions[gTasks[taskId].data[0]](gTasks + taskId)) + while (SlotReelActions[gTasks[taskId].data[0]](gTasks + taskId)) ; } // task->data[1] reel turns // task->data[15] reelIndex -/*static */bool8 ReelAction_StayStill(struct Task *task) +/*static */bool8 SlotReelAction_StayStill(struct Task *task) { return FALSE; } -/*static */bool8 ReelAction_Spin(struct Task *task) +/*static */bool8 SlotReelAction_Spin(struct Task *task) { - IncrementReelPixelOffset(task->data[15], sSlotMachine->reelIncrement); + AdvanceSlotReel(task->data[15], sSlotMachine->reelIncrement); return FALSE; } - -/*static */bool8 ReelAction_DecideWhereToStop(struct Task *task) +// As in previous generations, the slot machine often doesn't stop exactly when you press stop +/*static */bool8 SlotReelAction_DecideWhereToStop(struct Task *task) { task->data[0]++; // initialize data for that reel --> these will be changed if biasTags can be lined up - sSlotMachine->biasTagFinalPositions[task->data[15]] = 0; + sSlotMachine->biasTagLocation[task->data[15]] = 0; sSlotMachine->reelExtraTurns[task->data[15]] = 0; if (sSlotMachine->fairRollsLeft == 0 && (sSlotMachine->luckyFlags == 0 || sSlotMachine->luckySpinsLeft == 0 || !DecideReelTurns_BiasTag[task->data[15]]())) @@ -1860,7 +1860,7 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) } // go to next tag and then do any additional turns -/*static */bool8 ReelAction_TurnToSelectedTag(struct Task *task) +/*static */bool8 SlotReelAction_MoveToStop(struct Task *task) { u16 reelStopShocks[ARRAY_COUNT(ReelStopShocks)]; s16 reelPixelPos; @@ -1868,11 +1868,11 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) memcpy(reelStopShocks, ReelStopShocks, sizeof(ReelStopShocks)); reelPixelPos = sSlotMachine->reelPixelOffsets[task->data[15]] % 24; if (reelPixelPos != 0) - reelPixelPos = AdvanceReelNextTag(task->data[15], sSlotMachine->reelIncrement); + reelPixelPos = AdvanceSlotReelToNextTag(task->data[15], sSlotMachine->reelIncrement); else if (sSlotMachine->reelExtraTurns[task->data[15]]) { sSlotMachine->reelExtraTurns[task->data[15]]--; - IncrementReelPixelOffset(task->data[15], sSlotMachine->reelIncrement); + AdvanceSlotReel(task->data[15], sSlotMachine->reelIncrement); reelPixelPos = sSlotMachine->reelPixelOffsets[task->data[15]] % 24; } if (reelPixelPos == 0 && sSlotMachine->reelExtraTurns[task->data[15]] == 0) @@ -1885,9 +1885,9 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) } // make selected tag oscillate before it becomes still -/*static */bool8 ReelAction_OscillatingStop(struct Task *task) +/*static */bool8 SlotReelAction_OscillatingStop(struct Task *task) { - sSlotMachine->stopReelPixelOffset[task->data[15]] = task->data[1]; + sSlotMachine->reelPixelOffsetsWhileStopping[task->data[15]] = task->data[1]; task->data[1] = -task->data[1]; task->data[2]++; if ((task->data[2] & 0x3) == 0) @@ -1896,7 +1896,7 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) { task->data[0] = 0; task->data[14] = 0; - sSlotMachine->stopReelPixelOffset[task->data[15]] = 0; + sSlotMachine->reelPixelOffsetsWhileStopping[task->data[15]] = 0; } return FALSE; } @@ -1913,9 +1913,9 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) return DecideReelTurns_BiasTag_Reel1_Bets[sSlotMachine->bet - 1](tag1, tag2); } -/*static */bool8 IsTag1orTag2AtPosInReel1(s16 pos, u8 tag1, u8 tag2) +/*static */bool8 AreTagsAtPosition_Reel1(s16 pos, u8 tag1, u8 tag2) { - u8 tag = GetNearbyTag_PixelOffset(0, pos); + u8 tag = GetNearbyTag(0, pos); if (tag == tag1 || tag == tag2) { sSlotMachine->biasTag = tag; @@ -1926,13 +1926,13 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) /*static */bool8 AreCherriesOnScreen_Reel1(s16 offsetFromCenter) { - if (GetNearbyTag_PixelOffset(0, 1 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetNearbyTag_PixelOffset(0, 2 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetNearbyTag_PixelOffset(0, 3 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY) + if (GetNearbyTag(0, 1 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetNearbyTag(0, 2 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetNearbyTag(0, 3 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY) return TRUE; else return FALSE; } -/*static */bool8 LuckyFlags_BiasCherryOr7s(void) +/*static */bool8 IsBiasTowardsCherryOr7s(void) { if (sSlotMachine->luckyFlags & 0xc2) // if any of bits 6, 7, or 1 are set return TRUE; @@ -1946,10 +1946,10 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) for (i = 0; i < 5; i++) { - // if a lucky tag appears in the center row within the next 5 turns - if (IsTag1orTag2AtPosInReel1(2 - i, tag1, tag2)) + // if a lucky tag appears in the center row within 4 turns + if (AreTagsAtPosition_Reel1(2 - i, tag1, tag2)) { - sSlotMachine->biasTagFinalPositions[0] = 2; + sSlotMachine->biasTagLocation[0] = 2; sSlotMachine->reelExtraTurns[0] = i; return TRUE; } @@ -1960,16 +1960,15 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) /*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet2or3(u8 tag1, u8 tag2) { s16 i; - bool8 areLuckyBitsSet = LuckyFlags_BiasCherryOr7s(); - // if lucky numbers or no cherries are currently on screen in reel 1... - if (areLuckyBitsSet || !AreCherriesOnScreen_Reel1(0)) + bool8 biased = IsBiasTowardsCherryOr7s(); + if (biased || !AreCherriesOnScreen_Reel1(0)) { for (i = 1; i < 4; i++) { - //...and if a bias tag is currently on the screen - if (IsTag1orTag2AtPosInReel1(i, tag1, tag2)) + // if a bias tag is currently on the screen + if (AreTagsAtPosition_Reel1(i, tag1, tag2)) { - sSlotMachine->biasTagFinalPositions[0] = i; + sSlotMachine->biasTagLocation[0] = i; sSlotMachine->reelExtraTurns[0] = 0; return TRUE; } @@ -1977,29 +1976,29 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) } for (i = 1; i < 5; i++) { - bool8 areLuckyBitsSetCopy = areLuckyBitsSet; // redundant - // if lucky numbers or if in the next 4 turns there is a screen with no cherries... - if (areLuckyBitsSetCopy || !AreCherriesOnScreen_Reel1(i)) + bool8 biasedCopy = biased; // redundant + // if biased or if in the next 4 turns there is a screen with no cherries... + if (biasedCopy || !AreCherriesOnScreen_Reel1(i)) { //...and if a bias tag is in top row of that screen - if (IsTag1orTag2AtPosInReel1(1 - i, tag1, tag2)) + if (AreTagsAtPosition_Reel1(1 - i, tag1, tag2)) { //...and if it only took 1 turn and the lucky tag could also be the bottom row of a screen with no cherries... - if (i == 1 && (areLuckyBitsSetCopy || !AreCherriesOnScreen_Reel1(3))) + if (i == 1 && (biasedCopy || !AreCherriesOnScreen_Reel1(3))) { - sSlotMachine->biasTagFinalPositions[0] = 3; // maybe how many paths to check - sSlotMachine->reelExtraTurns[0] = 3; // maybe upper limit of turns to advance + sSlotMachine->biasTagLocation[0] = 3; + sSlotMachine->reelExtraTurns[0] = 3; return TRUE; } //...or if it isn't the last turn and the lucky tag could be in the center row of a screen with no cherries... - if (i < 4 && (areLuckyBitsSetCopy || !AreCherriesOnScreen_Reel1(i + 1))) + if (i < 4 && (biasedCopy || !AreCherriesOnScreen_Reel1(i + 1))) { - sSlotMachine->biasTagFinalPositions[0] = 2; + sSlotMachine->biasTagLocation[0] = 2; sSlotMachine->reelExtraTurns[0] = i + 1; return TRUE; } //...else - sSlotMachine->biasTagFinalPositions[0] = 1; + sSlotMachine->biasTagLocation[0] = 1; sSlotMachine->reelExtraTurns[0] = i; return TRUE; } @@ -2016,14 +2015,14 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) /*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet1or2(void) { s16 i; - s16 reel1BiasTagFinalPos = sSlotMachine->biasTagFinalPositions[0]; + s16 biasTagLocation_Reel1 = sSlotMachine->biasTagLocation[0]; for (i = 0; i < 5; i++) { - // if biasTag appears in the same row within 5 turns - if (GetNearbyTag_PixelOffset(1, reel1BiasTagFinalPos - i) == sSlotMachine->biasTag) + // if biasTag appears in the same row within 4 turns + if (GetNearbyTag(1, biasTagLocation_Reel1 - i) == sSlotMachine->biasTag) { - sSlotMachine->biasTagFinalPositions[1] = reel1BiasTagFinalPos; + sSlotMachine->biasTagLocation[1] = biasTagLocation_Reel1; sSlotMachine->reelExtraTurns[1] = i; return TRUE; } @@ -2034,18 +2033,18 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) /*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet3(void) { s16 i; - // if biasTag appears in the same row within 5 turns... + // if biasTag appears in the same row within 4 turns... if (DecideReelTurns_BiasTag_Reel2_Bet1or2()) { - //...and if the biasTag is not in row 2 of reel 1 and if it requires between either 2 or 3 turns to line up the biasTag in row 2... - if (sSlotMachine->biasTagFinalPositions[0] != 2 && sSlotMachine->reelExtraTurns[1] > 1 && sSlotMachine->reelExtraTurns[1] != 4) + //...and if the biasTag is not in middle row of reel 1 and if biasTag appears in middle row of reel 2 in 2 or 3 turns... + if (sSlotMachine->biasTagLocation[0] != 2 && sSlotMachine->reelExtraTurns[1] > 1 && sSlotMachine->reelExtraTurns[1] != 4) { for (i = 0; i < 5; i++) { - //...and if the bias tag will appear in the center row within 5 turns - if (GetNearbyTag_PixelOffset(1, 2 - i) == sSlotMachine->biasTag) + //...and if the bias tag will appear in the middle row within 4 turns + if (GetNearbyTag(1, 2 - i) == sSlotMachine->biasTag) { - sSlotMachine->biasTagFinalPositions[1] = 2; + sSlotMachine->biasTagLocation[1] = 2; sSlotMachine->reelExtraTurns[1] = i; break; } @@ -2053,15 +2052,15 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) } return TRUE; } - // else if the biasTag is not in row 2 of reel 1... - if (sSlotMachine->biasTagFinalPositions[0] != 2) + // else if the biasTag is not in middle row of reel 1... + if (sSlotMachine->biasTagLocation[0] != 2) { for (i = 0; i < 5; i++) { - //...and if the biasTag will appear in the center row of reel 2 within 5 turns - if (GetNearbyTag_PixelOffset(1, 2 - i) == sSlotMachine->biasTag) + //...and if the biasTag will appear in the center row of reel 2 within 4 turns + if (GetNearbyTag(1, 2 - i) == sSlotMachine->biasTag) { - sSlotMachine->biasTagFinalPositions[1] = 2; + sSlotMachine->biasTagLocation[1] = 2; sSlotMachine->reelExtraTurns[1] = i; return TRUE; } @@ -2089,14 +2088,14 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) /*static */bool8 DecideReelTurns_BiasTag_Reel3_Bet1or2(u8 biasTag) { s16 i; - s16 reel2BiasTagPos = sSlotMachine->biasTagFinalPositions[1]; + s16 biasTagLocation_Reel2 = sSlotMachine->biasTagLocation[1]; for (i = 0; i < 5; i++) { - // if the biasTag appears in the same row as in reel 2 within 5 turns - if (GetNearbyTag_PixelOffset(2, reel2BiasTagPos - i) == biasTag) + // if the biasTag appears in the same row as in reel 2 within 4 turns + if (GetNearbyTag(2, biasTagLocation_Reel2 - i) == biasTag) { - sSlotMachine->biasTagFinalPositions[2] = reel2BiasTagPos; + sSlotMachine->biasTagLocation[2] = biasTagLocation_Reel2; sSlotMachine->reelExtraTurns[2] = i; return TRUE; } @@ -2109,21 +2108,21 @@ s16 AdvanceReelTimeNextNumber(s16 reelIncrement) s16 i; s16 biasTagFinalPos; // if the final position of the biasTag matches in reel 1 and reel 2... - if (sSlotMachine->biasTagFinalPositions[0] == sSlotMachine->biasTagFinalPositions[1]) + if (sSlotMachine->biasTagLocation[0] == sSlotMachine->biasTagLocation[1]) //...then try to line it up in reel 3 return DecideReelTurns_BiasTag_Reel3_Bet1or2(biasTag); // else place it in the row opposite reel 1's - if (sSlotMachine->biasTagFinalPositions[0] == 1) + if (sSlotMachine->biasTagLocation[0] == 1) biasTagFinalPos = 3; else biasTagFinalPos = 1; for (i = 0; i < 5; i++) { - // if in the biasTag lands in that position within the next 5 turns - if (GetNearbyTag_PixelOffset(2, biasTagFinalPos - i) == biasTag) + // if the biasTag lands in that position within 4 turns + if (GetNearbyTag(2, biasTagFinalPos - i) == biasTag) { sSlotMachine->reelExtraTurns[2] = i; - sSlotMachine->biasTagFinalPositions[2] = biasTagFinalPos; + sSlotMachine->biasTagLocation[2] = biasTagFinalPos; return TRUE; } } @@ -2142,7 +2141,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->reelExtraTurns[0] = i; } -/*static */bool8 IsBiasTag7AndIfSoChangeColor(u8 *biasTagPtr) +/*static */bool8 IsBiasTag7AndIfSoSColor(u8 *biasTagPtr) { if (*biasTagPtr == SLOT_MACHINE_TAG_7_RED) { @@ -2165,21 +2164,21 @@ Advance until there are no cherries on screen in reel 1 // only does stuff if the biasTag is one of the 7's, plus other conditions /*static */void DecideReelTurns_NoBiasTag_Reel2_Bet1(void) { - // if reel 1 has a biasTag and bit 7 is set in luckyFlags... - if (sSlotMachine->biasTagFinalPositions[0] != 0 && sSlotMachine->luckyFlags & 0x80) + // if biasTag is in reel 1 and bit 7 is set in luckyFlags... + if (sSlotMachine->biasTagLocation[0] != 0 && sSlotMachine->luckyFlags & 0x80) { - u8 biasTag = GetNearbyTag_PixelOffset(0, 2 - sSlotMachine->reelExtraTurns[0]); + u8 biasTag = GetNearbyTag(0, 2 - sSlotMachine->reelExtraTurns[0]); //...and if biasTag is one of the 7's... - if (IsBiasTag7AndIfSoChangeColor(&biasTag)) - //...swap the color of the 7... + if (IsBiasTag7AndIfSoSColor(&biasTag)) + //...swap color of biasTag... { s16 i; for (i = 0; i < 5; i++) { - //...and if the biasTag appears in the next 5 turns - if (biasTag == GetNearbyTag_PixelOffset(1, 2 - i)) + //...and if the biasTag appears within 4 turns + if (biasTag == GetNearbyTag(1, 2 - i)) { - sSlotMachine->biasTagFinalPositions[1] = 2; + sSlotMachine->biasTagLocation[1] = 2; sSlotMachine->reelExtraTurns[1] = i; break; } @@ -2191,20 +2190,20 @@ Advance until there are no cherries on screen in reel 1 /*static */void DecideReelTurns_NoBiasTag_Reel2_Bet2(void) { // if reel 1 has a biasTag and bit 7 is set in luckyFlags... - if (sSlotMachine->biasTagFinalPositions[0] != 0 && sSlotMachine->luckyFlags & 0x80) + if (sSlotMachine->biasTagLocation[0] != 0 && sSlotMachine->luckyFlags & 0x80) { - u8 biasTag = GetNearbyTag_PixelOffset(0, sSlotMachine->biasTagFinalPositions[0] - sSlotMachine->reelExtraTurns[0]); + u8 biasTag = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); //...and if biasTag is one of the 7's... - if (IsBiasTag7AndIfSoChangeColor(&biasTag)) - //...swap the color of the 7... + if (IsBiasTag7AndIfSoSColor(&biasTag)) + //...swap color of biasTag... { s16 i; for (i = 0; i < 5; i++) { - //...and if in the next 5 turns the biasTag appears in reel 2 - if (biasTag == GetNearbyTag_PixelOffset(1, sSlotMachine->biasTagFinalPositions[0] - i)) + //...and if the biasTag appears in same row in reel 2 within 4 turns + if (biasTag == GetNearbyTag(1, sSlotMachine->biasTagLocation[0] - i)) { - sSlotMachine->biasTagFinalPositions[1] = sSlotMachine->biasTagFinalPositions[0]; + sSlotMachine->biasTagLocation[1] = sSlotMachine->biasTagLocation[0]; sSlotMachine->reelExtraTurns[1] = i; break; } @@ -2218,46 +2217,46 @@ Advance until there are no cherries on screen in reel 1 s16 i; s16 j; // if reel 1 has a biasTag and bit 7 is set in luckyFlags... - if (sSlotMachine->biasTagFinalPositions[0] != 0 && sSlotMachine->luckyFlags & 0x80) + if (sSlotMachine->biasTagLocation[0] != 0 && sSlotMachine->luckyFlags & 0x80) { //...and if biasTag appeared in the center row of reel 1 - if (sSlotMachine->biasTagFinalPositions[0] == 2) + if (sSlotMachine->biasTagLocation[0] == 2) { DecideReelTurns_NoBiasTag_Reel2_Bet2(); } else { - u8 biasTag = GetNearbyTag_PixelOffset(0, sSlotMachine->biasTagFinalPositions[0] - sSlotMachine->reelExtraTurns[0]); + u8 biasTag = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); //...and if biasTag is one of the 7's... - if (IsBiasTag7AndIfSoChangeColor(&biasTag)) + if (IsBiasTag7AndIfSoSColor(&biasTag)) //...swap the color of the 7... { j = 2; - if (sSlotMachine->biasTagFinalPositions[0] == 3) + if (sSlotMachine->biasTagLocation[0] == 3) j = 3; for (i = 0; i < 2; i++, j--) { - if (biasTag == GetNearbyTag_PixelOffset(1, j)) + if (biasTag == GetNearbyTag(1, j)) { - sSlotMachine->biasTagFinalPositions[1] = j; + sSlotMachine->biasTagLocation[1] = j; sSlotMachine->reelExtraTurns[1] = 0; return; } } for (j = 1; j < 5; j++) { - if (biasTag == GetNearbyTag_PixelOffset(1, sSlotMachine->biasTagFinalPositions[0] - j)) + if (biasTag == GetNearbyTag(1, sSlotMachine->biasTagLocation[0] - j)) { - if (sSlotMachine->biasTagFinalPositions[0] == 1) + if (sSlotMachine->biasTagLocation[0] == 1) { if (j < 3) { - sSlotMachine->biasTagFinalPositions[1] = 2; + sSlotMachine->biasTagLocation[1] = 2; sSlotMachine->reelExtraTurns[1] = j + 1; } else { - sSlotMachine->biasTagFinalPositions[1] = 1; + sSlotMachine->biasTagLocation[1] = 1; sSlotMachine->reelExtraTurns[1] = j; } } @@ -2265,12 +2264,12 @@ Advance until there are no cherries on screen in reel 1 { if (j < 3) { - sSlotMachine->biasTagFinalPositions[1] = 3; + sSlotMachine->biasTagLocation[1] = 3; sSlotMachine->reelExtraTurns[1] = j; } else { - sSlotMachine->biasTagFinalPositions[1] = 2; + sSlotMachine->biasTagLocation[1] = 2; sSlotMachine->reelExtraTurns[1] = j - 1; } } @@ -2319,14 +2318,14 @@ Advance until there are no cherries on screen in reel 1 /*static */void sub_8103830(void) { s16 i = 0; - u8 r5 = GetNearbyTag_PixelOffset(0, 2 - sSlotMachine->reelExtraTurns[0]); - u8 r1 = GetNearbyTag_PixelOffset(1, 2 - sSlotMachine->reelExtraTurns[1]); + u8 r5 = GetNearbyTag(0, 2 - sSlotMachine->reelExtraTurns[0]); + u8 r1 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); if (r5 == r1) { while (1) { u8 r0; - if (!(r5 == (r0 = GetNearbyTag_PixelOffset(2, 2 - i)) || (r5 == 0 && r0 == 1) || (r5 == 1 && r0 == 0))) + if (!(r5 == (r0 = GetNearbyTag(2, 2 - i)) || (r5 == 0 && r0 == 1) || (r5 == 1 && r0 == 0))) break; i++; } @@ -2337,7 +2336,7 @@ Advance until there are no cherries on screen in reel 1 { for (i = 0; i < 5; i++) { - if (r5 == GetNearbyTag_PixelOffset(2, 2 - i)) + if (r5 == GetNearbyTag(2, 2 - i)) { sSlotMachine->reelExtraTurns[2] = i; return; @@ -2347,7 +2346,7 @@ Advance until there are no cherries on screen in reel 1 i = 0; while (1) { - if (r5 != GetNearbyTag_PixelOffset(2, 2 - i)) + if (r5 != GetNearbyTag(2, 2 - i)) break; i++; } @@ -2363,15 +2362,15 @@ Advance until there are no cherries on screen in reel 1 u8 r6; u8 r4; - if (sSlotMachine->biasTagFinalPositions[1] != 0 && sSlotMachine->biasTagFinalPositions[0] == sSlotMachine->biasTagFinalPositions[1] && sSlotMachine->luckyFlags & 0x80) + if (sSlotMachine->biasTagLocation[1] != 0 && sSlotMachine->biasTagLocation[0] == sSlotMachine->biasTagLocation[1] && sSlotMachine->luckyFlags & 0x80) { - r7 = GetNearbyTag_PixelOffset(0, sSlotMachine->biasTagFinalPositions[0] - sSlotMachine->reelExtraTurns[0]); - r6 = GetNearbyTag_PixelOffset(1, sSlotMachine->biasTagFinalPositions[1] - sSlotMachine->reelExtraTurns[1]); + r7 = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); + r6 = GetNearbyTag(1, sSlotMachine->biasTagLocation[1] - sSlotMachine->reelExtraTurns[1]); if (sub_8103764(r7, r6)) { for (i = 0; i < 5; i++) { - r4 = GetNearbyTag_PixelOffset(2, sSlotMachine->biasTagFinalPositions[1] - i); + r4 = GetNearbyTag(2, sSlotMachine->biasTagLocation[1] - i); if (r7 == r4) { sp0 = i; @@ -2385,9 +2384,9 @@ Advance until there are no cherries on screen in reel 1 s16 r8; for (i = 1, r8 = 0; i < 4; i++) { - r7 = GetNearbyTag_PixelOffset(0, i - sSlotMachine->reelExtraTurns[0]); - r6 = GetNearbyTag_PixelOffset(1, i - sSlotMachine->reelExtraTurns[1]); - r4 = GetNearbyTag_PixelOffset(2, i - sp0); + r7 = GetNearbyTag(0, i - sSlotMachine->reelExtraTurns[0]); + r6 = GetNearbyTag(1, i - sSlotMachine->reelExtraTurns[1]); + r4 = GetNearbyTag(2, i - sp0); if (!sub_81037BC(r7, r6, r4) && (!sub_810378C(r7, r6, r4) || !(sSlotMachine->luckyFlags & 0x80))) { r8++; @@ -2410,18 +2409,18 @@ Advance until there are no cherries on screen in reel 1 s16 i; sub_8103910(); - if (sSlotMachine->biasTagFinalPositions[1] != 0 && sSlotMachine->biasTagFinalPositions[0] != sSlotMachine->biasTagFinalPositions[1] && sSlotMachine->luckyFlags & 0x80) + if (sSlotMachine->biasTagLocation[1] != 0 && sSlotMachine->biasTagLocation[0] != sSlotMachine->biasTagLocation[1] && sSlotMachine->luckyFlags & 0x80) { - r6 = GetNearbyTag_PixelOffset(0, sSlotMachine->biasTagFinalPositions[0] - sSlotMachine->reelExtraTurns[0]); - r5 = GetNearbyTag_PixelOffset(1, sSlotMachine->biasTagFinalPositions[1] - sSlotMachine->reelExtraTurns[1]); + r6 = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); + r5 = GetNearbyTag(1, sSlotMachine->biasTagLocation[1] - sSlotMachine->reelExtraTurns[1]); if (sub_8103764(r6, r5)) { r8 = 1; - if (sSlotMachine->biasTagFinalPositions[0] == 1) + if (sSlotMachine->biasTagLocation[0] == 1) r8 = 3; for (i = 0; i < 5; i++) { - r4 = GetNearbyTag_PixelOffset(2, r8 - (sSlotMachine->reelExtraTurns[2] + i)); + r4 = GetNearbyTag(2, r8 - (sSlotMachine->reelExtraTurns[2] + i)); if (r6 == r4) { sSlotMachine->reelExtraTurns[2] += i; @@ -2432,18 +2431,18 @@ Advance until there are no cherries on screen in reel 1 } while (1) { - r6 = GetNearbyTag_PixelOffset(0, 1 - sSlotMachine->reelExtraTurns[0]); - r5 = GetNearbyTag_PixelOffset(1, 2 - sSlotMachine->reelExtraTurns[1]); - r4 = GetNearbyTag_PixelOffset(2, 3 - sSlotMachine->reelExtraTurns[2]); + r6 = GetNearbyTag(0, 1 - sSlotMachine->reelExtraTurns[0]); + r5 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); + r4 = GetNearbyTag(2, 3 - sSlotMachine->reelExtraTurns[2]); if (sub_81037BC(r6, r5, r4) || (sub_810378C(r6, r5, r4) && sSlotMachine->luckyFlags & 0x80)) break; sSlotMachine->reelExtraTurns[2]++; } while (1) { - r6 = GetNearbyTag_PixelOffset(0, 3 - sSlotMachine->reelExtraTurns[0]); - r5 = GetNearbyTag_PixelOffset(1, 2 - sSlotMachine->reelExtraTurns[1]); - r4 = GetNearbyTag_PixelOffset(2, 1 - sSlotMachine->reelExtraTurns[2]); + r6 = GetNearbyTag(0, 3 - sSlotMachine->reelExtraTurns[0]); + r5 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); + r4 = GetNearbyTag(2, 1 - sSlotMachine->reelExtraTurns[2]); if (sub_81037BC(r6, r5, r4) || (sub_810378C(r6, r5, r4) && sSlotMachine->luckyFlags & 0x80)) break; sSlotMachine->reelExtraTurns[2]++; @@ -2811,12 +2810,12 @@ Advance until there are no cherries on screen in reel 1 task->data[3] = 0; } // move ReelTime reel by the value in the upper 8 bits of task->data[4] - IncrementReelTimePixelOffset(task->data[4] >> 8); + AdvanceReeltimeReel(task->data[4] >> 8); } /*static */void ReelTimeAction3(struct Task *task) { - IncrementReelTimePixelOffset(task->data[4] >> 8); + AdvanceReeltimeReel(task->data[4] >> 8); if (++task->data[5] >= 60) { task->data[0]++; @@ -2836,7 +2835,7 @@ Advance until there are no cherries on screen in reel 1 memcpy(sp4, gUnknown_085A75C4, sizeof(gUnknown_085A75C4)); memcpy(spC, gUnknown_085A75CC, sizeof(gUnknown_085A75CC)); - IncrementReelTimePixelOffset(task->data[4] >> 8); + AdvanceReeltimeReel(task->data[4] >> 8); // gradually slow down the reel task->data[4] -= 4; r5 = 4 - (task->data[4] >> 8); @@ -2854,7 +2853,7 @@ Advance until there are no cherries on screen in reel 1 /*static */void ReelTimeAction5(struct Task *task) { - IncrementReelTimePixelOffset(task->data[4] >> 8); + AdvanceReeltimeReel(task->data[4] >> 8); if (++task->data[5] >= 80) { task->data[0]++; @@ -2866,7 +2865,7 @@ Advance until there are no cherries on screen in reel 1 /*static */void ReelTimeAction6(struct Task *task) { - IncrementReelTimePixelOffset(task->data[4] >> 8); + AdvanceReeltimeReel(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x80; if (++task->data[5] >= 80) { @@ -2877,7 +2876,7 @@ Advance until there are no cherries on screen in reel 1 /*static */void ReelTimeAction7(struct Task *task) { - IncrementReelTimePixelOffset(task->data[4] >> 8); + AdvanceReeltimeReel(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x40; if (++task->data[5] >= 40) { @@ -2904,16 +2903,16 @@ Advance until there are no cherries on screen in reel 1 s16 reelTimePixelOffset = sSlotMachine->reelTimePixelOffset % 20; if (reelTimePixelOffset) { - reelTimePixelOffset = AdvanceReelTimeNextNumber(task->data[4] >> 8); + reelTimePixelOffset = AdvanceReeltimeReelToNextTag(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x40; } - else if (GetNthNextReelTimePosition(1) != sSlotMachine->reelTimeDraw) + else if (GetNearbyReelTimeTag(1) != sSlotMachine->reelTimeDraw) { - IncrementReelTimePixelOffset(task->data[4] >> 8); + AdvanceReeltimeReel(task->data[4] >> 8); reelTimePixelOffset = sSlotMachine->reelTimePixelOffset % 20; task->data[4] = (u8)task->data[4] + 0x40; } - if (reelTimePixelOffset == 0 && GetNthNextReelTimePosition(1) == sSlotMachine->reelTimeDraw) + if (reelTimePixelOffset == 0 && GetNearbyReelTimeTag(1) == sSlotMachine->reelTimeDraw) { task->data[4] = 0; // stop moving task->data[0]++; @@ -3282,14 +3281,12 @@ Advance until there are no cherries on screen in reel 1 } } -// debug this to find out what sprite->data[0] and sprite->data[2] are holding -// I would guess this updates the sprite location in the reel /*static */void sub_8104F18(struct Sprite *sprite) { sprite->data[2] = sSlotMachine->reelPixelOffsets[sprite->data[0]] + sprite->data[1]; sprite->data[2] %= 120; - sprite->pos1.y = sSlotMachine->stopReelPixelOffset[sprite->data[0]] + 28 + sprite->data[2]; - sprite->sheetTileStart = GetSpriteTileStartByTag(GetNearbyTag(sprite->data[0], sprite->data[2] / 24)); + sprite->pos1.y = sSlotMachine->reelPixelOffsetsWhileStopping[sprite->data[0]] + 28 + sprite->data[2]; + sprite->sheetTileStart = GetSpriteTileStartByTag(GetNearbyTag_Quantized(sprite->data[0], sprite->data[2] / 24)); SetSpriteSheetFrameTileNum(sprite); } @@ -3457,7 +3454,7 @@ Advance until there are no cherries on screen in reel 1 s16 r0 = (u16)(sSlotMachine->reelTimePixelOffset + sprite->data[7]); r0 %= 40; sprite->pos1.y = r0 + 59; - StartSpriteAnimIfDifferent(sprite, GetNthNextReelTimePosition(r0 / 20)); + StartSpriteAnimIfDifferent(sprite, GetNearbyReelTimeTag(r0 / 20)); } /*static */void sub_81053A0(void) @@ -4437,7 +4434,7 @@ const u8 sReelSymbols[][REEL_NUM_TAGS] = }, }; -const u8 gUnknown_083ECCF1[] = { +const u8 ReelTimeTags[] = { 1, 0, 5, 4, 3, 2 }; From 47a3477ab103e7f25115ead0a8c1ab63578076c1 Mon Sep 17 00:00:00 2001 From: hondew Date: Thu, 14 Feb 2019 17:46:44 -0500 Subject: [PATCH 05/14] finish DecideReelTurns --- src/slot_machine.c | 162 ++++++++++++++++++++++++--------------------- 1 file changed, 88 insertions(+), 74 deletions(-) diff --git a/src/slot_machine.c b/src/slot_machine.c index bb6925bd8..96c9692b3 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -68,7 +68,7 @@ struct SlotMachineEwramStruct /*0x06*/ u8 luckySpinsLeft; // tentative /*0x07*/ u8 biasTag; /*0x08*/ u16 matchedSymbols; - /*0x0A*/ u8 fairRollsLeft; + /*0x0A*/ u8 fairRollsLeft; // only happens if you win reeltime /*0x0B*/ u8 fairRollsUsed; /*0x0C*/ s16 coins; /*0x0E*/ s16 payout; @@ -144,7 +144,7 @@ struct UnkStruct1 /*static */bool8 SlotAction4(struct Task *task); /*static */bool8 SlotAction_AwaitPlayerInput(struct Task *task); /*static */bool8 SlotAction_PrintYouDontHaveThreeCoins(struct Task *task); -/*static */bool8 SlotAction_ExitYouDontHaveThreeCoinsDialogue(struct Task *task); +/*static */bool8 SlotAction_ExitYouDontHaveThreeCoinsMessage(struct Task *task); /*static */bool8 SlotAction_GivingInformation(struct Task *task); /*static */bool8 SlotAction9(struct Task *task); /*static */bool8 SlotAction10(struct Task *task); @@ -209,9 +209,9 @@ struct UnkStruct1 /*static */void DecideReelTurns_NoBiasTag_Reel2_Bet2(void); /*static */void DecideReelTurns_NoBiasTag_Reel2_Bet3(void); /*static */void DecideReelTurns_NoBiasTag_Reel3(void); -/*static */void sub_8103830(void); -/*static */void sub_8103910(void); -/*static */void sub_8103A78(void); +/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet1(void); +/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet2(void); +/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet3(void); /*static */void sub_8103C14(u8 a0); /*static */void sub_8103C48(u8 taskId); /*static */void LoadBetTiles(u8 a0); @@ -464,7 +464,7 @@ bool8 (*const SlotActions[])(struct Task *task) = SlotAction4, SlotAction_AwaitPlayerInput, SlotAction_PrintYouDontHaveThreeCoins, - SlotAction_ExitYouDontHaveThreeCoinsDialogue, + SlotAction_ExitYouDontHaveThreeCoinsMessage, SlotAction_GivingInformation, SlotAction9, SlotAction10, @@ -550,11 +550,11 @@ void (*const DecideReelTurns_NoBiasTag_Reel2_Bets[])(void) = DecideReelTurns_NoBiasTag_Reel2_Bet3 }; -void (*const gUnknown_083ECB94[])(void) = +void (*const DecideReelTurns_NoBiasTag_Reel3_Bets[])(void) = { - sub_8103830, - sub_8103910, - sub_8103A78 + DecideReelTurns_NoBiasTag_Reel3_Bet1, + DecideReelTurns_NoBiasTag_Reel3_Bet2, + DecideReelTurns_NoBiasTag_Reel3_Bet3 }; void (*const gUnknown_083ECBA0[])(struct Task *task, u8 taskId) = @@ -1033,7 +1033,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */bool8 SlotAction_ExitYouDontHaveThreeCoinsDialogue(struct Task *task) +/*static */bool8 SlotAction_ExitYouDontHaveThreeCoinsMessage(struct Task *task) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { @@ -1961,6 +1961,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) { s16 i; bool8 biased = IsBiasTowardsCherryOr7s(); + // if lucky numbers or no cherries are currently on screen in reel 1... if (biased || !AreCherriesOnScreen_Reel1(0)) { for (i = 1; i < 4; i++) @@ -2281,29 +2282,30 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */bool8 sub_8103764(u8 a0, u8 a1) +/*static */bool8 AreTagsMixed7s_2Tags(u8 tag1, u8 tag2) { - if ((a0 == 0 && a1 == 1) || (a0 == 1 && a1 == 0)) + if ((tag1 == SLOT_MACHINE_TAG_7_RED && tag2 == SLOT_MACHINE_TAG_7_BLUE) || (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag2 == SLOT_MACHINE_TAG_7_RED)) return TRUE; else return FALSE; } -/*static */bool8 sub_810378C(u8 a0, u8 a1, u8 a2) +/*static */bool8 AreTagsMixed7s_3Tags(u8 tag1, u8 tag2, u8 tag3) { - if ((a0 == 0 && a1 == 1 && a2 == 0) || (a0 == 1 && a1 == 0 && a2 == 1)) + if ((tag1 == SLOT_MACHINE_TAG_7_RED && tag2 == SLOT_MACHINE_TAG_7_BLUE && tag3 == SLOT_MACHINE_TAG_7_RED) || + (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag2 == SLOT_MACHINE_TAG_7_RED && tag3 == SLOT_MACHINE_TAG_7_BLUE)) return TRUE; else return FALSE; } -/*static */bool8 sub_81037BC(u8 a0, u8 a1, u8 a2) +/*static */bool8 DoTagsNotMatchOrHaveAny7s(u8 tag1, u8 tag2, u8 tag3) { - if ((a0 == 0 && a1 == 1 && a2 == 0) || - (a0 == 1 && a1 == 0 && a2 == 1) || - (a0 == 0 && a1 == 0 && a2 == 1) || - (a0 == 1 && a1 == 1 && a2 == 0) || - (a0 == a1 && a0 == a2)) + if ((tag1 == SLOT_MACHINE_TAG_7_RED && tag2 == SLOT_MACHINE_TAG_7_BLUE && tag3 == SLOT_MACHINE_TAG_7_RED) || + (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag2 == SLOT_MACHINE_TAG_7_RED && tag3 == SLOT_MACHINE_TAG_7_BLUE) || + (tag1 == SLOT_MACHINE_TAG_7_RED && tag2 == SLOT_MACHINE_TAG_7_RED && tag3 == SLOT_MACHINE_TAG_7_BLUE) || + (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag2 == SLOT_MACHINE_TAG_7_BLUE && tag3 == SLOT_MACHINE_TAG_7_RED) || + (tag1 == tag2 && tag1 == tag3)) { return FALSE; } @@ -2312,41 +2314,46 @@ Advance until there are no cherries on screen in reel 1 /*static */void DecideReelTurns_NoBiasTag_Reel3(void) { - gUnknown_083ECB94[sSlotMachine->bet - 1](); + DecideReelTurns_NoBiasTag_Reel3_Bets[sSlotMachine->bet - 1](); } -/*static */void sub_8103830(void) +/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet1(void) { s16 i = 0; - u8 r5 = GetNearbyTag(0, 2 - sSlotMachine->reelExtraTurns[0]); - u8 r1 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); - if (r5 == r1) + u8 tag1 = GetNearbyTag(0, 2 - sSlotMachine->reelExtraTurns[0]); + u8 tag2 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); + // if tags match in first 2 reels... + if (tag1 == tag2) { + //...spin until you get non-matching tag while (1) { - u8 r0; - if (!(r5 == (r0 = GetNearbyTag(2, 2 - i)) || (r5 == 0 && r0 == 1) || (r5 == 1 && r0 == 0))) + u8 tag3; + if (!(tag1 == (tag3 = GetNearbyTag(2, 2 - i)) || (tag1 == SLOT_MACHINE_TAG_7_RED && tag3 == SLOT_MACHINE_TAG_7_BLUE) || (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag3 == SLOT_MACHINE_TAG_7_RED))) break; i++; } } - else if (sub_8103764(r5, r1)) + else if (AreTagsMixed7s_2Tags(tag1, tag2)) { + // if bit 7 of luckyFlags is set... if (sSlotMachine->luckyFlags & 0x80) { + //...see if you can match with reel 1 within 4 turns for (i = 0; i < 5; i++) { - if (r5 == GetNearbyTag(2, 2 - i)) + if (tag1 == GetNearbyTag(2, 2 - i)) { sSlotMachine->reelExtraTurns[2] = i; return; } } } + // turn until you aren't matching with reel 1 i = 0; while (1) { - if (r5 != GetNearbyTag(2, 2 - i)) + if (tag1 != GetNearbyTag(2, 2 - i)) break; i++; } @@ -2354,74 +2361,81 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->reelExtraTurns[2] = i; } -/*static */void sub_8103910(void) +/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet2(void) { - s16 sp0 = 0; + s16 extraTurns = 0; s16 i; - u8 r7; - u8 r6; - u8 r4; - + u8 tag1; + u8 tag2; + u8 tag3; + // if tags match in first 2 reels and bit 7 of luckyFlags is set... if (sSlotMachine->biasTagLocation[1] != 0 && sSlotMachine->biasTagLocation[0] == sSlotMachine->biasTagLocation[1] && sSlotMachine->luckyFlags & 0x80) { - r7 = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); - r6 = GetNearbyTag(1, sSlotMachine->biasTagLocation[1] - sSlotMachine->reelExtraTurns[1]); - if (sub_8103764(r7, r6)) + tag1 = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); + tag2 = GetNearbyTag(1, sSlotMachine->biasTagLocation[1] - sSlotMachine->reelExtraTurns[1]); + //...and if tags are mixed 7s... + if (AreTagsMixed7s_2Tags(tag1, tag2)) { + //...try to match with reel 1 within 4 turns for (i = 0; i < 5; i++) { - r4 = GetNearbyTag(2, sSlotMachine->biasTagLocation[1] - i); - if (r7 == r4) + tag3 = GetNearbyTag(2, sSlotMachine->biasTagLocation[1] - i); + if (tag1 == tag3) { - sp0 = i; + extraTurns = i; break; } } } } + // GUESS: spin until there's no possible match within 4 turns of you stopping while (1) { - s16 r8; - for (i = 1, r8 = 0; i < 4; i++) + s16 loopExit; + for (i = 1, loopExit = 0; i < 4; i++) { - r7 = GetNearbyTag(0, i - sSlotMachine->reelExtraTurns[0]); - r6 = GetNearbyTag(1, i - sSlotMachine->reelExtraTurns[1]); - r4 = GetNearbyTag(2, i - sp0); - if (!sub_81037BC(r7, r6, r4) && (!sub_810378C(r7, r6, r4) || !(sSlotMachine->luckyFlags & 0x80))) + tag1 = GetNearbyTag(0, i - sSlotMachine->reelExtraTurns[0]); // why does this update with i + tag2 = GetNearbyTag(1, i - sSlotMachine->reelExtraTurns[1]); + tag3 = GetNearbyTag(2, i - extraTurns); + // if bit 7 of luckyFlags is unset... + //...and if all 3 tags match and they're not mixed 7s + if (!DoTagsNotMatchOrHaveAny7s(tag1, tag2, tag3) && (!AreTagsMixed7s_3Tags(tag1, tag2, tag3) || !(sSlotMachine->luckyFlags & 0x80))) { - r8++; + loopExit++; break; } } - if (r8 == 0) + if (loopExit == 0) break; - sp0++; + extraTurns++; } - sSlotMachine->reelExtraTurns[2] = sp0; + sSlotMachine->reelExtraTurns[2] = extraTurns; } -/*static */void sub_8103A78(void) +/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet3(void) { - u8 r6; - u8 r5; - u8 r4; - s16 r8; + u8 tag1; + u8 tag2; + u8 tag3; + s16 j; s16 i; - sub_8103910(); + DecideReelTurns_NoBiasTag_Reel3_Bet2(); + // if tags don't match in first 2 reels and bit 7 of luckyFlags is set... if (sSlotMachine->biasTagLocation[1] != 0 && sSlotMachine->biasTagLocation[0] != sSlotMachine->biasTagLocation[1] && sSlotMachine->luckyFlags & 0x80) { - r6 = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); - r5 = GetNearbyTag(1, sSlotMachine->biasTagLocation[1] - sSlotMachine->reelExtraTurns[1]); - if (sub_8103764(r6, r5)) + tag1 = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); + tag2 = GetNearbyTag(1, sSlotMachine->biasTagLocation[1] - sSlotMachine->reelExtraTurns[1]); + //..and if tags are mixed 7s... + if (AreTagsMixed7s_2Tags(tag1, tag2)) { - r8 = 1; + j = 1; if (sSlotMachine->biasTagLocation[0] == 1) - r8 = 3; + j = 3; for (i = 0; i < 5; i++) { - r4 = GetNearbyTag(2, r8 - (sSlotMachine->reelExtraTurns[2] + i)); - if (r6 == r4) + tag3 = GetNearbyTag(2, j - (sSlotMachine->reelExtraTurns[2] + i)); + if (tag1 == tag3) { sSlotMachine->reelExtraTurns[2] += i; break; @@ -2431,19 +2445,19 @@ Advance until there are no cherries on screen in reel 1 } while (1) { - r6 = GetNearbyTag(0, 1 - sSlotMachine->reelExtraTurns[0]); - r5 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); - r4 = GetNearbyTag(2, 3 - sSlotMachine->reelExtraTurns[2]); - if (sub_81037BC(r6, r5, r4) || (sub_810378C(r6, r5, r4) && sSlotMachine->luckyFlags & 0x80)) + tag1 = GetNearbyTag(0, 1 - sSlotMachine->reelExtraTurns[0]); + tag2 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); + tag3 = GetNearbyTag(2, 3 - sSlotMachine->reelExtraTurns[2]); + if (DoTagsNotMatchOrHaveAny7s(tag1, tag2, tag3) || (AreTagsMixed7s_3Tags(tag1, tag2, tag3) && sSlotMachine->luckyFlags & 0x80)) break; sSlotMachine->reelExtraTurns[2]++; } while (1) { - r6 = GetNearbyTag(0, 3 - sSlotMachine->reelExtraTurns[0]); - r5 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); - r4 = GetNearbyTag(2, 1 - sSlotMachine->reelExtraTurns[2]); - if (sub_81037BC(r6, r5, r4) || (sub_810378C(r6, r5, r4) && sSlotMachine->luckyFlags & 0x80)) + tag1 = GetNearbyTag(0, 3 - sSlotMachine->reelExtraTurns[0]); + tag2 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); + tag3 = GetNearbyTag(2, 1 - sSlotMachine->reelExtraTurns[2]); + if (DoTagsNotMatchOrHaveAny7s(tag1, tag2, tag3) || (AreTagsMixed7s_3Tags(tag1, tag2, tag3) && sSlotMachine->luckyFlags & 0x80)) break; sSlotMachine->reelExtraTurns[2]++; } From a6eb879267ebad7510b91749e3bbb8b94cdf24d9 Mon Sep 17 00:00:00 2001 From: hondew Date: Thu, 14 Feb 2019 18:06:21 -0500 Subject: [PATCH 06/14] minor reeltime changes --- src/slot_machine.c | 183 ++++++++++++++++++++++----------------------- 1 file changed, 90 insertions(+), 93 deletions(-) diff --git a/src/slot_machine.c b/src/slot_machine.c index 96c9692b3..1d86c94c5 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -74,8 +74,8 @@ struct SlotMachineEwramStruct /*0x0E*/ s16 payout; /*0x10*/ s16 netCoinLoss; // coins lost to machine (but never goes below 0) /*0x12*/ s16 bet; - /*0x14*/ s16 reelTimePixelOffset; - /*0x16*/ s16 reelTimePosition; + /*0x14*/ s16 reeltimePixelOffset; + /*0x16*/ s16 reeltimePosition; /*0x18*/ s16 currReel; /*0x1A*/ s16 reelIncrement; // speed of reel /*0x1C*/ s16 reelPixelOffsets[3]; @@ -238,27 +238,27 @@ struct UnkStruct1 /*static */void sub_81041AC(struct Task *task); /*static */void ClearTaskDataFields_2orHigher(struct Task *task); /*static */void sub_810423C(u8 pikaPower); -/*static */void BeginReelTime(void); +/*static */void BeginReeltime(void); /*static */bool8 IsFinalTask_RunReelTimeActions(void); -/*static */void RunReelTimeActions(u8 taskId); -/*static */void ReelTimeAction1(struct Task *task); -/*static */void ReelTimeAction2(struct Task *task); -/*static */void ReelTimeAction3(struct Task *task); -/*static */void ReelTimeAction4(struct Task *task); -/*static */void ReelTimeAction5(struct Task *task); -/*static */void ReelTimeAction6(struct Task *task); -/*static */void ReelTimeAction7(struct Task *task); +/*static */void RunReeltimeActions(u8 taskId); +/*static */void ReeltimeAction0(struct Task *task); +/*static */void ReeltimeAction1(struct Task *task); +/*static */void ReeltimeAction2(struct Task *task); +/*static */void ReeltimeAction3(struct Task *task); +/*static */void ReeltimeAction4(struct Task *task); +/*static */void ReeltimeAction5(struct Task *task); +/*static */void ReeltimeAction6(struct Task *task); /*static */void ReelTimeAction_LandOnOutcome(struct Task *task); -/*static */void ReelTimeAction9(struct Task *task); -/*static */void ReelTimeAction10(struct Task *task); -/*static */void ReelTimeAction11(struct Task *task); -/*static */void ReelTimeAction12(struct Task *task); -/*static */void ReelTimeAction13(struct Task *task); -/*static */void ReelTimeAction14(struct Task *task); -/*static */void ReelTimeAction15(struct Task *task); -/*static */void ReelTimeAction16(struct Task *task); -/*static */void ReelTimeAction17(struct Task *task); -/*static */void ReelTimeAction18(struct Task *task); +/*static */void ReeltimeAction8(struct Task *task); +/*static */void ReeltimeAction9(struct Task *task); +/*static */void ReeltimeAction10(struct Task *task); +/*static */void ReeltimeAction11(struct Task *task); +/*static */void ReeltimeAction12(struct Task *task); +/*static */void ReeltimeAction13(struct Task *task); +/*static */void ReeltimeAction14(struct Task *task); +/*static */void ReeltimeAction15(struct Task *task); +/*static */void ReeltimeAction16(struct Task *task); +/*static */void ReeltimeAction17(struct Task *task); /*static */void sub_8104A40(s16 a0, s16 a1); /*static */void sub_8104A88(s16 a0); /*static */void OpenInfoBox(u8 a0); @@ -369,7 +369,7 @@ extern const struct SpriteTemplate gSpriteTemplate_83ED54C; extern const struct SpriteTemplate gSpriteTemplate_83ED534; extern const u8 gUnknown_083ECC58[2]; extern const struct SpriteTemplate gSpriteTemplate_83ED51C; -extern const u16 ProbabilityTable_SkipToReelTimeAction14[]; +extern const u16 ProbabilityTable_SkipToReeltimeAction14[]; extern const u16 *const gUnknown_083EDE10[]; extern const u16 ReelIncrementTable[][2]; extern const u16 ReelTimeBonusIncrementTable[]; @@ -581,27 +581,27 @@ const u16 pikaPowerTileTable[][2] = {0xaf, 0x7f}, // {0b10101111, 0b1111111} }; -void (*const ReelTimeActions[])(struct Task *task) = +void (*const ReeltimeActions[])(struct Task *task) = { - ReelTimeAction1, - ReelTimeAction2, - ReelTimeAction3, - ReelTimeAction4, - ReelTimeAction5, - ReelTimeAction6, - ReelTimeAction7, // does stuff with reel time data + ReeltimeAction0, + ReeltimeAction1, + ReeltimeAction2, + ReeltimeAction3, + ReeltimeAction4, + ReeltimeAction5, + ReeltimeAction6, // does stuff with reel time data ReelTimeAction_LandOnOutcome, - ReelTimeAction9, - ReelTimeAction10, - ReelTimeAction11, - ReelTimeAction12, - ReelTimeAction13, - ReelTimeAction14, - ReelTimeAction15, - ReelTimeAction16, - ReelTimeAction17, - ReelTimeAction11, - ReelTimeAction18 + ReeltimeAction8, + ReeltimeAction9, + ReeltimeAction10, + ReeltimeAction11, + ReeltimeAction12, + ReeltimeAction13, + ReeltimeAction14, + ReeltimeAction15, + ReeltimeAction16, + ReeltimeAction10, + ReeltimeAction17 }; const u8 gUnknown_085A75C0[] = {1, 1, 2, 2}; @@ -1067,7 +1067,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue if (sSlotMachine->luckyFlags & 0x20) // bit 5 of luckyFlag set { // enter into reel time - BeginReelTime(); + BeginReeltime(); sSlotMachine->slotActionPtr = 10; } else @@ -1506,7 +1506,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return ReelTimeProbabilityTable_LuckyGame[reelTimeDraw][sSlotMachine->pikaPower]; } -/*static */void DrawReelTimeOutcome(void) +/*static */void GetReeltimeDraw(void) { u8 rval; s16 reelTimeDraw; @@ -1524,10 +1524,10 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sSlotMachine->reelTimeDraw = reelTimeDraw; } -/*static */bool8 SkipToReelTimeAction14(u16 i) +/*static */bool8 SkipToReeltimeAction14(u16 i) { u16 rval = Random() & 0xff; - if (rval < ProbabilityTable_SkipToReelTimeAction14[i]) + if (rval < ProbabilityTable_SkipToReeltimeAction14[i]) return TRUE; else return FALSE; @@ -1749,7 +1749,7 @@ Calculates GetNearbyTag_Quantized as if the reel was snapped downwards into plac /*static */u8 GetNearbyReelTimeTag(s16 n) { - s16 newPosition = (sSlotMachine->reelTimePosition + n) % 6; + s16 newPosition = (sSlotMachine->reeltimePosition + n) % 6; if (newPosition < 0) newPosition += 6; return ReelTimeTags[newPosition]; @@ -1777,20 +1777,20 @@ s16 AdvanceSlotReelToNextTag(u8 reelIndex, s16 value) /*static */void AdvanceReeltimeReel(s16 value) { - sSlotMachine->reelTimePixelOffset += value; - sSlotMachine->reelTimePixelOffset %= 120; - sSlotMachine->reelTimePosition = 6 - sSlotMachine->reelTimePixelOffset / 20; + sSlotMachine->reeltimePixelOffset += value; + sSlotMachine->reeltimePixelOffset %= 120; + sSlotMachine->reeltimePosition = 6 - sSlotMachine->reeltimePixelOffset / 20; } s16 AdvanceReeltimeReelToNextTag(s16 value) { - s16 offset = sSlotMachine->reelTimePixelOffset % 20; + s16 offset = sSlotMachine->reeltimePixelOffset % 20; if (offset != 0) { if (offset < value) value = offset; AdvanceReeltimeReel(value); - offset = sSlotMachine->reelTimePixelOffset % 20; + offset = sSlotMachine->reeltimePixelOffset % 20; } return offset; } @@ -2757,37 +2757,37 @@ Advance until there are no cherries on screen in reel 1 gTasks[sSlotMachine->unkTaskPointer3E].data[1] = pikaPower; } -/*static */void BeginReelTime(void) +/*static */void BeginReeltime(void) { - u8 taskId = CreateTask(RunReelTimeActions, 7); - RunReelTimeActions(taskId); + u8 taskId = CreateTask(RunReeltimeActions, 7); + RunReeltimeActions(taskId); } /*static */bool8 IsFinalTask_RunReelTimeActions(void) { - if (FindTaskIdByFunc(RunReelTimeActions) == TAIL_SENTINEL) + if (FindTaskIdByFunc(RunReeltimeActions) == TAIL_SENTINEL) return TRUE; return FALSE; } -/*static */void RunReelTimeActions(u8 taskId) +/*static */void RunReeltimeActions(u8 taskId) { // task.data[0] points to which ReelTimeAction to do, and starts at 0 // task.data[1] has something to do with the threshold // task.data[4] says how many pixels to advance the reel // task.data[5] is a timer - ReelTimeActions[gTasks[taskId].data[0]](gTasks + taskId); + ReeltimeActions[gTasks[taskId].data[0]](gTasks + taskId); } -/*static */void ReelTimeAction1(struct Task *task) +/*static */void ReeltimeAction0(struct Task *task) { sSlotMachine->fairRollsLeft = 0; - sSlotMachine->reelTimePixelOffset = 0; - sSlotMachine->reelTimePosition = 0; + sSlotMachine->reeltimePixelOffset = 0; + sSlotMachine->reeltimePosition = 0; task->data[0]++; task->data[1] = 0; task->data[2] = 30; - task->data[4] = 1280; + task->data[4] = 1280; // reel speed gSpriteCoordOffsetX = 0; gSpriteCoordOffsetY = 0; SetGpuReg(REG_OFFSET_BG1HOFS, 0); @@ -2798,18 +2798,16 @@ Advance until there are no cherries on screen in reel 1 sub_81052EC(); sub_81053A0(); sub_810545C(); - DrawReelTimeOutcome(); + GetReeltimeDraw(); StopMapMusic(); PlayNewMapMusic(MUS_BD_TIME); } -/*static */void ReelTimeAction2(struct Task *task) +/*static */void ReeltimeAction1(struct Task *task) { s16 r3; gSpriteCoordOffsetX -= 8; - // boost threshold by 8 task->data[1] += 8; - // only consider lower 8 bits, and then shift them right 3 r3 = ((task->data[1] + 240) & 0xff) >> 3; SetGpuReg(REG_OFFSET_BG1HOFS, task->data[1] & 0x1ff); if (r3 != task->data[2] && task->data[3] <= 18) @@ -2823,11 +2821,10 @@ Advance until there are no cherries on screen in reel 1 task->data[0]++; task->data[3] = 0; } - // move ReelTime reel by the value in the upper 8 bits of task->data[4] AdvanceReeltimeReel(task->data[4] >> 8); } -/*static */void ReelTimeAction3(struct Task *task) +/*static */void ReeltimeAction2(struct Task *task) { AdvanceReeltimeReel(task->data[4] >> 8); if (++task->data[5] >= 60) @@ -2838,7 +2835,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReelTimeAction4(struct Task *task) +/*static */void ReeltimeAction3(struct Task *task) { int r5; u8 sp0[ARRAY_COUNT(gUnknown_085A75C0)]; @@ -2865,7 +2862,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReelTimeAction5(struct Task *task) +/*static */void ReeltimeAction4(struct Task *task) { AdvanceReeltimeReel(task->data[4] >> 8); if (++task->data[5] >= 80) @@ -2877,7 +2874,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReelTimeAction6(struct Task *task) +/*static */void ReeltimeAction5(struct Task *task) { AdvanceReeltimeReel(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x80; @@ -2888,7 +2885,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReelTimeAction7(struct Task *task) +/*static */void ReeltimeAction6(struct Task *task) { AdvanceReeltimeReel(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x40; @@ -2896,7 +2893,7 @@ Advance until there are no cherries on screen in reel 1 { task->data[5] = 0; if (sSlotMachine->reelTimeDraw) - { // TODO: check if fairRollsLeft differs from reelTimeDraw + { if (sSlotMachine->fairRollsLeft <= task->data[6]) task->data[0]++; } @@ -2904,7 +2901,7 @@ Advance until there are no cherries on screen in reel 1 { task->data[0]++; } - else if (SkipToReelTimeAction14(task->data[6])) + else if (SkipToReeltimeAction14(task->data[6])) { task->data[0] = 14; } @@ -2914,26 +2911,26 @@ Advance until there are no cherries on screen in reel 1 /*static */void ReelTimeAction_LandOnOutcome(struct Task *task) { - s16 reelTimePixelOffset = sSlotMachine->reelTimePixelOffset % 20; - if (reelTimePixelOffset) + s16 reeltimePixelOffset = sSlotMachine->reeltimePixelOffset % 20; + if (reeltimePixelOffset) { - reelTimePixelOffset = AdvanceReeltimeReelToNextTag(task->data[4] >> 8); + reeltimePixelOffset = AdvanceReeltimeReelToNextTag(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x40; } else if (GetNearbyReelTimeTag(1) != sSlotMachine->reelTimeDraw) { AdvanceReeltimeReel(task->data[4] >> 8); - reelTimePixelOffset = sSlotMachine->reelTimePixelOffset % 20; + reeltimePixelOffset = sSlotMachine->reeltimePixelOffset % 20; task->data[4] = (u8)task->data[4] + 0x40; } - if (reelTimePixelOffset == 0 && GetNearbyReelTimeTag(1) == sSlotMachine->reelTimeDraw) + if (reeltimePixelOffset == 0 && GetNearbyReelTimeTag(1) == sSlotMachine->reelTimeDraw) { task->data[4] = 0; // stop moving task->data[0]++; } } -/*static */void ReelTimeAction9(struct Task *task) +/*static */void ReeltimeAction8(struct Task *task) { if (++task->data[4] >= 60) { @@ -2962,13 +2959,13 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReelTimeAction10(struct Task *task) +/*static */void ReeltimeAction9(struct Task *task) { if ((task->data[4] == 0 || --task->data[4] == 0) && !sub_81040C8()) task->data[0]++; } -/*static */void ReelTimeAction11(struct Task *task) +/*static */void ReeltimeAction10(struct Task *task) { s16 r4; gSpriteCoordOffsetX -= 8; @@ -2982,7 +2979,7 @@ Advance until there are no cherries on screen in reel 1 task->data[0]++; } -/*static */void ReelTimeAction12(struct Task *task) +/*static */void ReeltimeAction11(struct Task *task) { sSlotMachine->fairRollsUsed = 0; sSlotMachine->fairRollsLeft = sSlotMachine->reelTimeDraw; @@ -2995,7 +2992,7 @@ Advance until there are no cherries on screen in reel 1 PlayNewMapMusic(sSlotMachine->backupMapMusic); if (sSlotMachine->fairRollsLeft == 0) { - DestroyTask(FindTaskIdByFunc(RunReelTimeActions)); + DestroyTask(FindTaskIdByFunc(RunReeltimeActions)); } else { @@ -3007,7 +3004,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReelTimeAction13(struct Task *task) +/*static */void ReeltimeAction12(struct Task *task) { if (sSlotMachine->reelIncrement == task->data[1]) task->data[0]++; @@ -3015,13 +3012,13 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->reelIncrement >>= 1; } -/*static */void ReelTimeAction14(struct Task *task) +/*static */void ReeltimeAction13(struct Task *task) { if (sub_8104E18()) - DestroyTask(FindTaskIdByFunc(RunReelTimeActions)); + DestroyTask(FindTaskIdByFunc(RunReeltimeActions)); } -/*static */void ReelTimeAction15(struct Task *task) +/*static */void ReeltimeAction14(struct Task *task) { sub_81054B8(); sub_81056C0(); @@ -3037,7 +3034,7 @@ Advance until there are no cherries on screen in reel 1 PlaySE(SE_W153); } -/*static */void ReelTimeAction16(struct Task *task) +/*static */void ReeltimeAction15(struct Task *task) { gSpriteCoordOffsetY = task->data[4]; SetGpuReg(REG_OFFSET_BG1VOFS, task->data[4]); @@ -3057,7 +3054,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReelTimeAction17(struct Task *task) +/*static */void ReeltimeAction16(struct Task *task) { gSpriteCoordOffsetY = 0; SetGpuReg(REG_OFFSET_BG1VOFS, 0); @@ -3068,7 +3065,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReelTimeAction18(struct Task *task) +/*static */void ReeltimeAction17(struct Task *task) { gSpriteCoordOffsetX = 0; SetGpuReg(REG_OFFSET_BG1HOFS, 0); @@ -3077,7 +3074,7 @@ Advance until there are no cherries on screen in reel 1 sub_8105554(); sub_8105524(); sub_81059B8(); - DestroyTask(FindTaskIdByFunc(RunReelTimeActions)); + DestroyTask(FindTaskIdByFunc(RunReeltimeActions)); } /*static */void sub_8104A40(s16 a0, s16 a1) @@ -3465,7 +3462,7 @@ Advance until there are no cherries on screen in reel 1 /*static */void sub_810535C(struct Sprite *sprite) { - s16 r0 = (u16)(sSlotMachine->reelTimePixelOffset + sprite->data[7]); + s16 r0 = (u16)(sSlotMachine->reeltimePixelOffset + sprite->data[7]); r0 %= 40; sprite->pos1.y = r0 + 59; StartSpriteAnimIfDifferent(sprite, GetNearbyReelTimeTag(r0 / 20)); @@ -4499,7 +4496,7 @@ const u8 ReelTimeProbabilityTable_LuckyGame[][17] = { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 60} }; -const u16 ProbabilityTable_SkipToReelTimeAction14[] = { +const u16 ProbabilityTable_SkipToReeltimeAction14[] = { 128, 175, 200, 225, 256 }; From f965f1b13dd30293b99307c869ef5f6f382a374f Mon Sep 17 00:00:00 2001 From: hondew Date: Thu, 14 Feb 2019 23:44:18 -0500 Subject: [PATCH 07/14] label luckyFlags --- include/slot_machine.h | 16 +++++ src/slot_machine.c | 160 +++++++++++++++++++---------------------- 2 files changed, 88 insertions(+), 88 deletions(-) diff --git a/include/slot_machine.h b/include/slot_machine.h index fae937834..2eb00d92b 100644 --- a/include/slot_machine.h +++ b/include/slot_machine.h @@ -3,6 +3,22 @@ #define REEL_NUM_TAGS 21 +// Lucky Flags +#define LUCKY_BIAS_REPLAY 0x0001 +#define LUCKY_BIAS_CHERRY 0x0002 +#define LUCKY_BIAS_LOTAD 0x0004 +#define LUCKY_BIAS_AZURRILL 0x0008 +#define LUCKY_BIAS_POWER 0x0010 +#define LUCKY_BIAS_REELTIME 0x0020 +#define LUCKY_BIAS_MIXED_777 0x0040 +#define LUCKY_BIAS_777 0x0080 + +// Rows +#define SLOT_TOP_ROW 0x0001 +#define SLOT_MIDDLE_ROW 0x0002 +#define SLOT_BOTTOM_ROW 0x0003 + + void PlaySlotMachine(u8, void (callback)(void)); diff --git a/src/slot_machine.c b/src/slot_machine.c index 1d86c94c5..af162b264 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -82,7 +82,7 @@ struct SlotMachineEwramStruct /*0x22*/ u16 reelPixelOffsetsWhileStopping[3]; /*0x28*/ s16 reelTagOffsets[3]; /*0x2E*/ s16 reelExtraTurns[3]; - /*0x34*/ s16 biasTagLocation[3]; + /*0x34*/ s16 winnerRows[3]; /*0x3A*/ u8 slotReelTasks[3]; /*0x3D*/ u8 unkTaskPointer3D; /*0x3E*/ u8 unkTaskPointer3E; @@ -950,7 +950,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sSlotMachine->payout = 0; sSlotMachine->bet = 0; sSlotMachine->currReel = 0; - sSlotMachine->luckyFlags &= 0xc0; // discard all but top 2 flags + sSlotMachine->luckyFlags &= (LUCKY_BIAS_777 | LUCKY_BIAS_MIXED_777); sSlotMachine->slotActionPtr = 4; if (sSlotMachine->coins <= 0) { @@ -1064,7 +1064,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sub_80EEC80(); // something with daily slot variable task->data[0] = 0; - if (sSlotMachine->luckyFlags & 0x20) // bit 5 of luckyFlag set + if (sSlotMachine->luckyFlags & LUCKY_BIAS_REELTIME) { // enter into reel time BeginReeltime(); @@ -1087,8 +1087,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue if (IsFinalTask_RunReelTimeActions()) { sub_8104CAC(1); - // unset enter reel time flag - sSlotMachine->luckyFlags &= 0xDF; + sSlotMachine->luckyFlags &= ~LUCKY_BIAS_REELTIME; sSlotMachine->slotActionPtr = 11; } return FALSE; @@ -1134,8 +1133,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue // once all reels have stopped /*static */bool8 SlotAction_CheckMatches(struct Task *task) { - // keep top 2 bits of luckyFlags - sSlotMachine->luckyFlags &= 0xc0; + sSlotMachine->luckyFlags &= (LUCKY_BIAS_777 | LUCKY_BIAS_MIXED_777); CheckMatch(); if (sSlotMachine->fairRollsLeft) { @@ -1170,8 +1168,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue // if you matched 777... if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_MIXED) | (1 << SLOT_MACHINE_MATCHED_777_BLUE) | (1 << SLOT_MACHINE_MATCHED_777_RED))) { - // clear top bits 6 and 7 - sSlotMachine->luckyFlags &= 0x3f; + sSlotMachine->luckyFlags &= ~(LUCKY_BIAS_777 | LUCKY_BIAS_MIXED_777); if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_BLUE) | (1 << SLOT_MACHINE_MATCHED_777_RED))) { sSlotMachine->fairRollsLeft = 0; @@ -1403,7 +1400,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue if (sSlotMachine->fairRollsLeft == 0) { - if (!(sSlotMachine->luckyFlags & 0xc0)) // top 2 flags set to 0 + if (!(sSlotMachine->luckyFlags & (LUCKY_BIAS_777 | LUCKY_BIAS_MIXED_777))) { if (IsThisRoundLucky()) { @@ -1847,7 +1844,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) { task->data[0]++; // initialize data for that reel --> these will be changed if biasTags can be lined up - sSlotMachine->biasTagLocation[task->data[15]] = 0; + sSlotMachine->winnerRows[task->data[15]] = 0; sSlotMachine->reelExtraTurns[task->data[15]] = 0; if (sSlotMachine->fairRollsLeft == 0 && (sSlotMachine->luckyFlags == 0 || sSlotMachine->luckySpinsLeft == 0 || !DecideReelTurns_BiasTag[task->data[15]]())) @@ -1905,7 +1902,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) { u8 tag2 = GetLuckyTag(sSlotMachine->luckyFlags); u8 tag1 = tag2; - if (sSlotMachine->luckyFlags & 0xc0) // if either of top 2 bits are set + if (sSlotMachine->luckyFlags & (LUCKY_BIAS_777 | LUCKY_BIAS_MIXED_777)) { tag1 = SLOT_MACHINE_TAG_7_RED; tag2 = SLOT_MACHINE_TAG_7_BLUE; @@ -1934,7 +1931,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) /*static */bool8 IsBiasTowardsCherryOr7s(void) { - if (sSlotMachine->luckyFlags & 0xc2) // if any of bits 6, 7, or 1 are set + if (sSlotMachine->luckyFlags & (LUCKY_BIAS_777 | LUCKY_BIAS_MIXED_777 | LUCKY_BIAS_CHERRY)) return TRUE; else return FALSE; @@ -1949,7 +1946,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) // if a lucky tag appears in the center row within 4 turns if (AreTagsAtPosition_Reel1(2 - i, tag1, tag2)) { - sSlotMachine->biasTagLocation[0] = 2; + sSlotMachine->winnerRows[0] = 2; sSlotMachine->reelExtraTurns[0] = i; return TRUE; } @@ -1969,7 +1966,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) // if a bias tag is currently on the screen if (AreTagsAtPosition_Reel1(i, tag1, tag2)) { - sSlotMachine->biasTagLocation[0] = i; + sSlotMachine->winnerRows[0] = i; sSlotMachine->reelExtraTurns[0] = 0; return TRUE; } @@ -1987,19 +1984,19 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) //...and if it only took 1 turn and the lucky tag could also be the bottom row of a screen with no cherries... if (i == 1 && (biasedCopy || !AreCherriesOnScreen_Reel1(3))) { - sSlotMachine->biasTagLocation[0] = 3; + sSlotMachine->winnerRows[0] = 3; sSlotMachine->reelExtraTurns[0] = 3; return TRUE; } //...or if it isn't the last turn and the lucky tag could be in the center row of a screen with no cherries... if (i < 4 && (biasedCopy || !AreCherriesOnScreen_Reel1(i + 1))) { - sSlotMachine->biasTagLocation[0] = 2; + sSlotMachine->winnerRows[0] = 2; sSlotMachine->reelExtraTurns[0] = i + 1; return TRUE; } //...else - sSlotMachine->biasTagLocation[0] = 1; + sSlotMachine->winnerRows[0] = 1; sSlotMachine->reelExtraTurns[0] = i; return TRUE; } @@ -2016,14 +2013,14 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) /*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet1or2(void) { s16 i; - s16 biasTagLocation_Reel1 = sSlotMachine->biasTagLocation[0]; + s16 biasTagLocation_Reel1 = sSlotMachine->winnerRows[0]; for (i = 0; i < 5; i++) { // if biasTag appears in the same row within 4 turns if (GetNearbyTag(1, biasTagLocation_Reel1 - i) == sSlotMachine->biasTag) { - sSlotMachine->biasTagLocation[1] = biasTagLocation_Reel1; + sSlotMachine->winnerRows[1] = biasTagLocation_Reel1; sSlotMachine->reelExtraTurns[1] = i; return TRUE; } @@ -2038,14 +2035,14 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) if (DecideReelTurns_BiasTag_Reel2_Bet1or2()) { //...and if the biasTag is not in middle row of reel 1 and if biasTag appears in middle row of reel 2 in 2 or 3 turns... - if (sSlotMachine->biasTagLocation[0] != 2 && sSlotMachine->reelExtraTurns[1] > 1 && sSlotMachine->reelExtraTurns[1] != 4) + if (sSlotMachine->winnerRows[0] != 2 && sSlotMachine->reelExtraTurns[1] > 1 && sSlotMachine->reelExtraTurns[1] != 4) { for (i = 0; i < 5; i++) { //...and if the bias tag will appear in the middle row within 4 turns if (GetNearbyTag(1, 2 - i) == sSlotMachine->biasTag) { - sSlotMachine->biasTagLocation[1] = 2; + sSlotMachine->winnerRows[1] = 2; sSlotMachine->reelExtraTurns[1] = i; break; } @@ -2054,14 +2051,14 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return TRUE; } // else if the biasTag is not in middle row of reel 1... - if (sSlotMachine->biasTagLocation[0] != 2) + if (sSlotMachine->winnerRows[0] != 2) { for (i = 0; i < 5; i++) { //...and if the biasTag will appear in the center row of reel 2 within 4 turns if (GetNearbyTag(1, 2 - i) == sSlotMachine->biasTag) { - sSlotMachine->biasTagLocation[1] = 2; + sSlotMachine->winnerRows[1] = 2; sSlotMachine->reelExtraTurns[1] = i; return TRUE; } @@ -2073,14 +2070,12 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) /*static */bool8 DecideReelTurns_BiasTag_Reel3(void) { u8 biasTag = sSlotMachine->biasTag; - // if bit 6 of luckyFlags is set... - if (sSlotMachine->luckyFlags & 0x40) + if (sSlotMachine->luckyFlags & LUCKY_BIAS_MIXED_777) { - // make biasTag the opposite color of the 7 in sSlotMachine->biasTag - biasTag = 0; - if (sSlotMachine->biasTag == 0) + biasTag = SLOT_MACHINE_TAG_7_RED; + if (sSlotMachine->biasTag == SLOT_MACHINE_TAG_7_RED) { - biasTag = 1; + biasTag = SLOT_MACHINE_TAG_7_BLUE; } } return DecideReelTurns_BiasTag_Reel3_Bets[sSlotMachine->bet - 1](biasTag); @@ -2089,14 +2084,14 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) /*static */bool8 DecideReelTurns_BiasTag_Reel3_Bet1or2(u8 biasTag) { s16 i; - s16 biasTagLocation_Reel2 = sSlotMachine->biasTagLocation[1]; + s16 biasTagLocation_Reel2 = sSlotMachine->winnerRows[1]; for (i = 0; i < 5; i++) { // if the biasTag appears in the same row as in reel 2 within 4 turns if (GetNearbyTag(2, biasTagLocation_Reel2 - i) == biasTag) { - sSlotMachine->biasTagLocation[2] = biasTagLocation_Reel2; + sSlotMachine->winnerRows[2] = biasTagLocation_Reel2; sSlotMachine->reelExtraTurns[2] = i; return TRUE; } @@ -2109,11 +2104,11 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) s16 i; s16 biasTagFinalPos; // if the final position of the biasTag matches in reel 1 and reel 2... - if (sSlotMachine->biasTagLocation[0] == sSlotMachine->biasTagLocation[1]) + if (sSlotMachine->winnerRows[0] == sSlotMachine->winnerRows[1]) //...then try to line it up in reel 3 return DecideReelTurns_BiasTag_Reel3_Bet1or2(biasTag); // else place it in the row opposite reel 1's - if (sSlotMachine->biasTagLocation[0] == 1) + if (sSlotMachine->winnerRows[0] == 1) biasTagFinalPos = 3; else biasTagFinalPos = 1; @@ -2123,7 +2118,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) if (GetNearbyTag(2, biasTagFinalPos - i) == biasTag) { sSlotMachine->reelExtraTurns[2] = i; - sSlotMachine->biasTagLocation[2] = biasTagFinalPos; + sSlotMachine->winnerRows[2] = biasTagFinalPos; return TRUE; } } @@ -2142,7 +2137,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->reelExtraTurns[0] = i; } -/*static */bool8 IsBiasTag7AndIfSoSColor(u8 *biasTagPtr) +/*static */bool8 IsBiasTag777_SwitchColor(u8 *biasTagPtr) { if (*biasTagPtr == SLOT_MACHINE_TAG_7_RED) { @@ -2165,12 +2160,11 @@ Advance until there are no cherries on screen in reel 1 // only does stuff if the biasTag is one of the 7's, plus other conditions /*static */void DecideReelTurns_NoBiasTag_Reel2_Bet1(void) { - // if biasTag is in reel 1 and bit 7 is set in luckyFlags... - if (sSlotMachine->biasTagLocation[0] != 0 && sSlotMachine->luckyFlags & 0x80) + if (sSlotMachine->winnerRows[0] != 0 && sSlotMachine->luckyFlags & LUCKY_BIAS_777) { u8 biasTag = GetNearbyTag(0, 2 - sSlotMachine->reelExtraTurns[0]); //...and if biasTag is one of the 7's... - if (IsBiasTag7AndIfSoSColor(&biasTag)) + if (IsBiasTag777_SwitchColor(&biasTag)) //...swap color of biasTag... { s16 i; @@ -2179,7 +2173,7 @@ Advance until there are no cherries on screen in reel 1 //...and if the biasTag appears within 4 turns if (biasTag == GetNearbyTag(1, 2 - i)) { - sSlotMachine->biasTagLocation[1] = 2; + sSlotMachine->winnerRows[1] = 2; sSlotMachine->reelExtraTurns[1] = i; break; } @@ -2190,21 +2184,20 @@ Advance until there are no cherries on screen in reel 1 /*static */void DecideReelTurns_NoBiasTag_Reel2_Bet2(void) { - // if reel 1 has a biasTag and bit 7 is set in luckyFlags... - if (sSlotMachine->biasTagLocation[0] != 0 && sSlotMachine->luckyFlags & 0x80) + if (sSlotMachine->winnerRows[0] != 0 && sSlotMachine->luckyFlags & LUCKY_BIAS_777) { - u8 biasTag = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); + u8 biasTag = GetNearbyTag(0, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]); //...and if biasTag is one of the 7's... - if (IsBiasTag7AndIfSoSColor(&biasTag)) + if (IsBiasTag777_SwitchColor(&biasTag)) //...swap color of biasTag... { s16 i; for (i = 0; i < 5; i++) { //...and if the biasTag appears in same row in reel 2 within 4 turns - if (biasTag == GetNearbyTag(1, sSlotMachine->biasTagLocation[0] - i)) + if (biasTag == GetNearbyTag(1, sSlotMachine->winnerRows[0] - i)) { - sSlotMachine->biasTagLocation[1] = sSlotMachine->biasTagLocation[0]; + sSlotMachine->winnerRows[1] = sSlotMachine->winnerRows[0]; sSlotMachine->reelExtraTurns[1] = i; break; } @@ -2218,46 +2211,46 @@ Advance until there are no cherries on screen in reel 1 s16 i; s16 j; // if reel 1 has a biasTag and bit 7 is set in luckyFlags... - if (sSlotMachine->biasTagLocation[0] != 0 && sSlotMachine->luckyFlags & 0x80) + if (sSlotMachine->winnerRows[0] != 0 && sSlotMachine->luckyFlags & LUCKY_BIAS_777) { //...and if biasTag appeared in the center row of reel 1 - if (sSlotMachine->biasTagLocation[0] == 2) + if (sSlotMachine->winnerRows[0] == 2) { DecideReelTurns_NoBiasTag_Reel2_Bet2(); } else { - u8 biasTag = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); + u8 biasTag = GetNearbyTag(0, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]); //...and if biasTag is one of the 7's... - if (IsBiasTag7AndIfSoSColor(&biasTag)) + if (IsBiasTag777_SwitchColor(&biasTag)) //...swap the color of the 7... { j = 2; - if (sSlotMachine->biasTagLocation[0] == 3) + if (sSlotMachine->winnerRows[0] == 3) j = 3; for (i = 0; i < 2; i++, j--) { if (biasTag == GetNearbyTag(1, j)) { - sSlotMachine->biasTagLocation[1] = j; + sSlotMachine->winnerRows[1] = j; sSlotMachine->reelExtraTurns[1] = 0; return; } } for (j = 1; j < 5; j++) { - if (biasTag == GetNearbyTag(1, sSlotMachine->biasTagLocation[0] - j)) + if (biasTag == GetNearbyTag(1, sSlotMachine->winnerRows[0] - j)) { - if (sSlotMachine->biasTagLocation[0] == 1) + if (sSlotMachine->winnerRows[0] == 1) { if (j < 3) { - sSlotMachine->biasTagLocation[1] = 2; + sSlotMachine->winnerRows[1] = 2; sSlotMachine->reelExtraTurns[1] = j + 1; } else { - sSlotMachine->biasTagLocation[1] = 1; + sSlotMachine->winnerRows[1] = 1; sSlotMachine->reelExtraTurns[1] = j; } } @@ -2265,12 +2258,12 @@ Advance until there are no cherries on screen in reel 1 { if (j < 3) { - sSlotMachine->biasTagLocation[1] = 3; + sSlotMachine->winnerRows[1] = 3; sSlotMachine->reelExtraTurns[1] = j; } else { - sSlotMachine->biasTagLocation[1] = 2; + sSlotMachine->winnerRows[1] = 2; sSlotMachine->reelExtraTurns[1] = j - 1; } } @@ -2282,7 +2275,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */bool8 AreTagsMixed7s_2Tags(u8 tag1, u8 tag2) +/*static */bool8 AreTagsMixed77(u8 tag1, u8 tag2) { if ((tag1 == SLOT_MACHINE_TAG_7_RED && tag2 == SLOT_MACHINE_TAG_7_BLUE) || (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag2 == SLOT_MACHINE_TAG_7_RED)) return TRUE; @@ -2290,7 +2283,7 @@ Advance until there are no cherries on screen in reel 1 return FALSE; } -/*static */bool8 AreTagsMixed7s_3Tags(u8 tag1, u8 tag2, u8 tag3) +/*static */bool8 AreTagsMixed777(u8 tag1, u8 tag2, u8 tag3) { if ((tag1 == SLOT_MACHINE_TAG_7_RED && tag2 == SLOT_MACHINE_TAG_7_BLUE && tag3 == SLOT_MACHINE_TAG_7_RED) || (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag2 == SLOT_MACHINE_TAG_7_RED && tag3 == SLOT_MACHINE_TAG_7_BLUE)) @@ -2299,7 +2292,7 @@ Advance until there are no cherries on screen in reel 1 return FALSE; } -/*static */bool8 DoTagsNotMatchOrHaveAny7s(u8 tag1, u8 tag2, u8 tag3) +/*static */bool8 TagsDontMatchOrHaveAny7s(u8 tag1, u8 tag2, u8 tag3) { if ((tag1 == SLOT_MACHINE_TAG_7_RED && tag2 == SLOT_MACHINE_TAG_7_BLUE && tag3 == SLOT_MACHINE_TAG_7_RED) || (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag2 == SLOT_MACHINE_TAG_7_RED && tag3 == SLOT_MACHINE_TAG_7_BLUE) || @@ -2334,10 +2327,9 @@ Advance until there are no cherries on screen in reel 1 i++; } } - else if (AreTagsMixed7s_2Tags(tag1, tag2)) + else if (AreTagsMixed77(tag1, tag2)) { - // if bit 7 of luckyFlags is set... - if (sSlotMachine->luckyFlags & 0x80) + if (sSlotMachine->luckyFlags & LUCKY_BIAS_777) { //...see if you can match with reel 1 within 4 turns for (i = 0; i < 5; i++) @@ -2368,18 +2360,17 @@ Advance until there are no cherries on screen in reel 1 u8 tag1; u8 tag2; u8 tag3; - // if tags match in first 2 reels and bit 7 of luckyFlags is set... - if (sSlotMachine->biasTagLocation[1] != 0 && sSlotMachine->biasTagLocation[0] == sSlotMachine->biasTagLocation[1] && sSlotMachine->luckyFlags & 0x80) + if (sSlotMachine->winnerRows[1] != 0 && sSlotMachine->winnerRows[0] == sSlotMachine->winnerRows[1] && sSlotMachine->luckyFlags & LUCKY_BIAS_777) { - tag1 = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); - tag2 = GetNearbyTag(1, sSlotMachine->biasTagLocation[1] - sSlotMachine->reelExtraTurns[1]); + tag1 = GetNearbyTag(0, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]); + tag2 = GetNearbyTag(1, sSlotMachine->winnerRows[1] - sSlotMachine->reelExtraTurns[1]); //...and if tags are mixed 7s... - if (AreTagsMixed7s_2Tags(tag1, tag2)) + if (AreTagsMixed77(tag1, tag2)) { //...try to match with reel 1 within 4 turns for (i = 0; i < 5; i++) { - tag3 = GetNearbyTag(2, sSlotMachine->biasTagLocation[1] - i); + tag3 = GetNearbyTag(2, sSlotMachine->winnerRows[1] - i); if (tag1 == tag3) { extraTurns = i; @@ -2399,7 +2390,7 @@ Advance until there are no cherries on screen in reel 1 tag3 = GetNearbyTag(2, i - extraTurns); // if bit 7 of luckyFlags is unset... //...and if all 3 tags match and they're not mixed 7s - if (!DoTagsNotMatchOrHaveAny7s(tag1, tag2, tag3) && (!AreTagsMixed7s_3Tags(tag1, tag2, tag3) || !(sSlotMachine->luckyFlags & 0x80))) + if (!TagsDontMatchOrHaveAny7s(tag1, tag2, tag3) && (!AreTagsMixed777(tag1, tag2, tag3) || !(sSlotMachine->luckyFlags & LUCKY_BIAS_777))) { loopExit++; break; @@ -2421,16 +2412,15 @@ Advance until there are no cherries on screen in reel 1 s16 i; DecideReelTurns_NoBiasTag_Reel3_Bet2(); - // if tags don't match in first 2 reels and bit 7 of luckyFlags is set... - if (sSlotMachine->biasTagLocation[1] != 0 && sSlotMachine->biasTagLocation[0] != sSlotMachine->biasTagLocation[1] && sSlotMachine->luckyFlags & 0x80) + if (sSlotMachine->winnerRows[1] != 0 && sSlotMachine->winnerRows[0] != sSlotMachine->winnerRows[1] && sSlotMachine->luckyFlags & LUCKY_BIAS_777) { - tag1 = GetNearbyTag(0, sSlotMachine->biasTagLocation[0] - sSlotMachine->reelExtraTurns[0]); - tag2 = GetNearbyTag(1, sSlotMachine->biasTagLocation[1] - sSlotMachine->reelExtraTurns[1]); + tag1 = GetNearbyTag(0, sSlotMachine->winnerRows[0] - sSlotMachine->reelExtraTurns[0]); + tag2 = GetNearbyTag(1, sSlotMachine->winnerRows[1] - sSlotMachine->reelExtraTurns[1]); //..and if tags are mixed 7s... - if (AreTagsMixed7s_2Tags(tag1, tag2)) + if (AreTagsMixed77(tag1, tag2)) { j = 1; - if (sSlotMachine->biasTagLocation[0] == 1) + if (sSlotMachine->winnerRows[0] == 1) j = 3; for (i = 0; i < 5; i++) { @@ -2448,7 +2438,7 @@ Advance until there are no cherries on screen in reel 1 tag1 = GetNearbyTag(0, 1 - sSlotMachine->reelExtraTurns[0]); tag2 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); tag3 = GetNearbyTag(2, 3 - sSlotMachine->reelExtraTurns[2]); - if (DoTagsNotMatchOrHaveAny7s(tag1, tag2, tag3) || (AreTagsMixed7s_3Tags(tag1, tag2, tag3) && sSlotMachine->luckyFlags & 0x80)) + if (TagsDontMatchOrHaveAny7s(tag1, tag2, tag3) || (AreTagsMixed777(tag1, tag2, tag3) && sSlotMachine->luckyFlags & LUCKY_BIAS_777)) break; sSlotMachine->reelExtraTurns[2]++; } @@ -2457,7 +2447,7 @@ Advance until there are no cherries on screen in reel 1 tag1 = GetNearbyTag(0, 3 - sSlotMachine->reelExtraTurns[0]); tag2 = GetNearbyTag(1, 2 - sSlotMachine->reelExtraTurns[1]); tag3 = GetNearbyTag(2, 1 - sSlotMachine->reelExtraTurns[2]); - if (DoTagsNotMatchOrHaveAny7s(tag1, tag2, tag3) || (AreTagsMixed7s_3Tags(tag1, tag2, tag3) && sSlotMachine->luckyFlags & 0x80)) + if (TagsDontMatchOrHaveAny7s(tag1, tag2, tag3) || (AreTagsMixed777(tag1, tag2, tag3) && sSlotMachine->luckyFlags & LUCKY_BIAS_777)) break; sSlotMachine->reelExtraTurns[2]++; } @@ -4517,18 +4507,12 @@ const u8 LuckyTags[] = { SLOT_MACHINE_TAG_REPLAY, SLOT_MACHINE_TAG_CHERRY, SLOT_MACHINE_TAG_LOTAD, SLOT_MACHINE_TAG_AZURILL, SLOT_MACHINE_TAG_POWER, SLOT_MACHINE_TAG_7_RED, SLOT_MACHINE_TAG_7_RED, SLOT_MACHINE_TAG_7_RED }; -/* -sSlotMachine->luckyFlags: 7, 6, 5, 4, 3, 2, 1, 0 -If you got Lucky2 in 1 attempt, flag 7 gets set. -If you got Lucky2 in 2 attempts, flag 5 gets set. -If you got Lucky2 in 3 attempts, flag 6 gets set. -*/ -const u16 LuckyFlagSettings_Top3[] = { // order seems buggy - 0x80, 0x20, 0x40 +const u16 LuckyFlagSettings_Top3[] = { + LUCKY_BIAS_777, LUCKY_BIAS_REELTIME, LUCKY_BIAS_MIXED_777 }; const u16 LuckyFlagSettings_NotTop3[] = { - 0x10, 0x08, 0x04, 0x02, 0x01 + LUCKY_BIAS_POWER, LUCKY_BIAS_AZURRILL, LUCKY_BIAS_LOTAD, LUCKY_BIAS_CHERRY, LUCKY_BIAS_REPLAY }; const u8 sSym2Match[] = { From dd8ecabe26e5e525306047507d33bc1640040871 Mon Sep 17 00:00:00 2001 From: hondew Date: Fri, 22 Feb 2019 16:03:35 -0500 Subject: [PATCH 08/14] fix mistakes and bad formatting --- include/slot_machine.h | 8 +- include/tv.h | 6 +- src/roulette.c | 4 +- src/slot_machine.c | 1144 ++++++++++++++++++++-------------------- src/tv.c | 8 +- 5 files changed, 582 insertions(+), 588 deletions(-) diff --git a/include/slot_machine.h b/include/slot_machine.h index 2eb00d92b..bd0af49af 100644 --- a/include/slot_machine.h +++ b/include/slot_machine.h @@ -1,13 +1,15 @@ #ifndef GUARD_SLOT_MACHINE_H #define GUARD_SLOT_MACHINE_H -#define REEL_NUM_TAGS 21 +#define NUM_REELS 3 +#define REEL_NUM_TAGS 21 +#define REEL_TAG_HEIGHT 24 // Lucky Flags #define LUCKY_BIAS_REPLAY 0x0001 #define LUCKY_BIAS_CHERRY 0x0002 #define LUCKY_BIAS_LOTAD 0x0004 -#define LUCKY_BIAS_AZURRILL 0x0008 +#define LUCKY_BIAS_AZURILL 0x0008 #define LUCKY_BIAS_POWER 0x0010 #define LUCKY_BIAS_REELTIME 0x0020 #define LUCKY_BIAS_MIXED_777 0x0040 @@ -18,8 +20,6 @@ #define SLOT_MIDDLE_ROW 0x0002 #define SLOT_BOTTOM_ROW 0x0003 - - void PlaySlotMachine(u8, void (callback)(void)); #endif // GUARD_SLOT_MACHINE_H diff --git a/include/tv.h b/include/tv.h index a5c26af0c..ec01717e2 100644 --- a/include/tv.h +++ b/include/tv.h @@ -26,9 +26,9 @@ bool8 GetPriceReduction(u8 newsKind); void sub_80F14F8(TVShow *shows); size_t CountDigits(int value); u8 GetRibbonCount(struct Pokemon *pokemon); -void AlertTVThatYouPlayedSlotMachine(u16 nCoinsSpent); -void AlertTVThatYouPlayedRoulette(u16 nCoinsSpent); -void reportNewCoinTotal(u16 nCoinsPaidOut); +void AlertTVThatPlayerPlayedSlotMachine(u16 nCoinsSpent); +void AlertTVThatPlayerPlayedRoulette(u16 nCoinsSpent); +void AlertTVOfNewCointTotal(u16 nCoinsPaidOut); void sub_80EEA70(void); void sub_80EDB44(void); void sub_80EDC60(const u16 *words); diff --git a/src/roulette.c b/src/roulette.c index fa2b6c579..93678fa1c 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -996,7 +996,7 @@ static void sub_81405CC(void) taskId = gUnknown_0203AB88->varA4 = CreateTask(sub_81408A8, 0); gTasks[taskId].data[6] = 6; gTasks[taskId].data[13] = GetCoins(); - AlertTVThatYouPlayedRoulette(GetCoins()); + AlertTVThatPlayerPlayedRoulette(GetCoins()); gUnknown_0203AB88->varA5 = CreateTask(sub_8140814, 1); SetMainCallback2(sub_8140238); return; @@ -1964,7 +1964,7 @@ static void sub_8141DE4(u8 taskId) gSpecialVar_0x8004 = TRUE; else gSpecialVar_0x8004 = FALSE; - reportNewCoinTotal(GetCoins()); + AlertTVOfNewCointTotal(GetCoins()); BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0); gTasks[taskId].func = sub_8141E7C; } diff --git a/src/slot_machine.c b/src/slot_machine.c index af162b264..9c07a96f2 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -59,7 +59,7 @@ enum struct SlotMachineEwramStruct { - /*0x00*/ u8 slotActionPtr; + /*0x00*/ u8 state; /*0x01*/ u8 machineId; /*0x02*/ u8 pikaPower; /*0x03*/ u8 luckyGame; @@ -115,209 +115,209 @@ struct UnkStruct1 #define SLOTMACHINE_GFX_TILES 233 -/*static */void CB2_SlotMachineSetup(void); -/*static */void CB2_SlotMachineLoop(void); -/*static */void PlaySlotMachine_Internal(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinueScriptPlayMapMusic); -/*static */void SlotMachineDummyTask(u8 taskId); -/*static */void SlotMachineSetup_0_0(void); -/*static */void SlotMachineSetup_6_2(void); -/*static */void SlotMachineSetup_1_0(void); -/*static */void SlotMachineSetup_2_0(void); -/*static */void SlotMachineSetup_2_1(void); -/*static */void SlotMachineSetup_0_1(void); -/*static */void SlotMachineSetup_3_0(void); -/*static */void SlotMachineSetup_4_0(void); -/*static */void SlotMachineSetup_5_0(void); -/*static */void SlotMachineSetup_6_0(void); -/*static */void SlotMachineSetup_6_1(void); -/*static */void SlotMachineSetup_8_0(void); -/*static */void SlotMachineSetup_9_0(void); -/*static */void SlotMachineSetup_10_0(void); -/*static */void SlotMachineSetupGameplayTasks(void); -/*static */void GameplayTasks_Slots(void); -/*static */void sub_8104DA4(void); -/*static */void RunSlotActions(u8 taskId); -/*static */bool8 SlotAction_UnfadeScreen(struct Task *task); -/*static */bool8 SlotAction_WaitForUnfade(struct Task *task); -/*static */bool8 SlotAction_SetSlotMachineVars(struct Task *task); -/*static */bool8 SlotAction3(struct Task *task); -/*static */bool8 SlotAction4(struct Task *task); -/*static */bool8 SlotAction_AwaitPlayerInput(struct Task *task); -/*static */bool8 SlotAction_PrintYouDontHaveThreeCoins(struct Task *task); -/*static */bool8 SlotAction_ExitYouDontHaveThreeCoinsMessage(struct Task *task); -/*static */bool8 SlotAction_GivingInformation(struct Task *task); -/*static */bool8 SlotAction9(struct Task *task); -/*static */bool8 SlotAction10(struct Task *task); -/*static */bool8 SlotAction_SetLuckySpins(struct Task *task); -/*static */bool8 SlotAction_AwaitReelStop(struct Task *task); -/*static */bool8 SlotAction_WaitForAllReelsToStop(struct Task *task); -/*static */bool8 SlotAction_CheckMatches(struct Task *task); -/*static */bool8 SlotAction_WaitForPayoutToBeAwarded(struct Task *task); -/*static */bool8 SlotAction_EndOfRoll(struct Task *task); -/*static */bool8 SlotAction_MatchedPower(struct Task *task); -/*static */bool8 SlotAction18(struct Task *task); -/*static */bool8 SlotAction_Loop(struct Task *task); -/*static */bool8 SlotAction_NoMatches(struct Task *task); -/*static */bool8 SlotAction_PrintQuitTheGame(struct Task *task); -/*static */bool8 SlotAction_SeeIfPlayerQuits(struct Task *task); -/*static */bool8 SlotAction_Print9999CoinMessage(struct Task *task); -/*static */bool8 SlotAction_Exit9999CoinMessage(struct Task *task); -/*static */bool8 SlotAction_PrintNoMoreCoins(struct Task *task); -/*static */bool8 SlotAction_ExitNoMoreCoinsMessage(struct Task *task); -/*static */bool8 SlotAction_EndGame(struct Task *task); -/*static */bool8 SlotAction_FreeDataStructures(struct Task *task); -/*static */void DrawLuckyFlags(void); -/*static */void SetLuckySpins(void); -/*static */bool8 IsThisRoundLucky(void); -/*static */u8 AttemptsAtLuckyflags_Top3(void); -/*static */u16 DrawNewReelIncrement(void); -/*static */u8 AttemptsAtLuckyflags_NotTop3(void); -/*static */void CheckMatch(void); -/*static */void CheckMatch_CenterRow(void); -/*static */void CheckMatch_TopAndBottom(void); -/*static */void CheckMatch_Diagonals(void); -/*static */u8 GetMatchFromSymbolsInRow(u8 c1, u8 c2, u8 c3); -/*static */void AwardPayout(void); -/*static */void RunAwardPayoutActions(u8 taskId); -/*static */bool8 IsFinalTask_RunAwardPayoutActions(void); -/*static */bool8 AwardPayoutAction0(struct Task *task); -/*static */bool8 AwardPayoutAction_GivePayoutToPlayer(struct Task *task); -/*static */bool8 AwardPayoutAction_FreeTask(struct Task *task); -/*static */u8 GetNearbyTag_Quantized(u8 x, s16 y); -/*static */void GameplayTask_StopSlotReel(void); -/*static */void ReelTasks_SetUnkTaskData(u8 a0); -/*static */void sub_8102E1C(u8 a0); -/*static */bool8 IsSlotReelMoving(u8 a0); -/*static */void RunSlotReelActions(u8 taskId); -/*static */bool8 SlotReelAction_StayStill(struct Task *task); -/*static */bool8 SlotReelAction_Spin(struct Task *task); -/*static */bool8 SlotReelAction_DecideWhereToStop(struct Task *task); -/*static */bool8 SlotReelAction_MoveToStop(struct Task *task); -/*static */bool8 SlotReelAction_OscillatingStop(struct Task *task); -/*static */bool8 DecideReelTurns_BiasTag_Reel1(void); -/*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet1(u8 a0, u8 a1); -/*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet2or3(u8 a0, u8 a1); -/*static */bool8 DecideReelTurns_BiasTag_Reel2(void); -/*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet1or2(void); -/*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet3(void); -/*static */bool8 DecideReelTurns_BiasTag_Reel3(void); -/*static */bool8 DecideReelTurns_BiasTag_Reel3_Bet1or2(u8 a0); -/*static */bool8 DecideReelTurns_BiasTag_Reel3_Bet3(u8 a0); -/*static */void DecideReelTurns_NoBiasTag_Reel1(void); -/*static */void DecideReelTurns_NoBiasTag_Reel2(void); -/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet1(void); -/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet2(void); -/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet3(void); -/*static */void DecideReelTurns_NoBiasTag_Reel3(void); -/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet1(void); -/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet2(void); -/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet3(void); -/*static */void sub_8103C14(u8 a0); -/*static */void sub_8103C48(u8 taskId); -/*static */void LoadBetTiles(u8 a0); -/*static */void sub_8103C78(struct Task *task, u8 taskId); -/*static */void sub_8103CAC(struct Task *task, u8 taskId); -/*static */void sub_8103CC8(struct Task *task, u8 taskId); -/*static */void sub_8103D8C(u8 a0); -/*static */void sub_8103DC8(void); -/*static */void sub_8103E04(u8 a0); -/*static */bool8 sub_8103E38(void); -/*static */bool8 sub_8103E7C(void); -/*static */bool8 sub_8103EAC(u8 spriteId); -/*static */void sub_8103EE4(struct Sprite *sprite); -/*static */void sub_8103F70(void); -/*static */bool8 sub_8103FA0(void); -/*static */void sub_8103FE8_(u8 taskId); -/*static */void GameplayTasks_PikaPower(void); -/*static */void DisplayPikaPower(u8 pikaPower); -/*static */bool8 sub_81040C8(void); -/*static */void sub_81040E8(u8 taskId); -/*static */void nullsub_68(struct Task *task); -/*static */void sub_810411C(struct Task *task); -/*static */void sub_8104144(struct Task *task); -/*static */void sub_81041AC(struct Task *task); -/*static */void ClearTaskDataFields_2orHigher(struct Task *task); -/*static */void sub_810423C(u8 pikaPower); -/*static */void BeginReeltime(void); -/*static */bool8 IsFinalTask_RunReelTimeActions(void); -/*static */void RunReeltimeActions(u8 taskId); -/*static */void ReeltimeAction0(struct Task *task); -/*static */void ReeltimeAction1(struct Task *task); -/*static */void ReeltimeAction2(struct Task *task); -/*static */void ReeltimeAction3(struct Task *task); -/*static */void ReeltimeAction4(struct Task *task); -/*static */void ReeltimeAction5(struct Task *task); -/*static */void ReeltimeAction6(struct Task *task); -/*static */void ReelTimeAction_LandOnOutcome(struct Task *task); -/*static */void ReeltimeAction8(struct Task *task); -/*static */void ReeltimeAction9(struct Task *task); -/*static */void ReeltimeAction10(struct Task *task); -/*static */void ReeltimeAction11(struct Task *task); -/*static */void ReeltimeAction12(struct Task *task); -/*static */void ReeltimeAction13(struct Task *task); -/*static */void ReeltimeAction14(struct Task *task); -/*static */void ReeltimeAction15(struct Task *task); -/*static */void ReeltimeAction16(struct Task *task); -/*static */void ReeltimeAction17(struct Task *task); -/*static */void sub_8104A40(s16 a0, s16 a1); -/*static */void sub_8104A88(s16 a0); -/*static */void OpenInfoBox(u8 a0); -/*static */bool8 IsInfoBoxClosed(void); -/*static */void RunInfoBoxActions(u8 taskId); -/*static */void InfoBox_FadeIn(struct Task *task); -/*static */void InfoBox_WaitForFade(struct Task *task); -/*static */void InfoBox_8104B80(struct Task *task); -/*static */void InfoBox_AwaitPlayerInput(struct Task *task); -/*static */void InfoBox_AddText(struct Task *task); -/*static */void InfoBox_8104BFC(struct Task *task); -/*static */void InfoBox_812DE14(struct Task *task); -/*static */void InfoBox_812DE30(struct Task *task); -/*static */void InfoBox_FreeTask(struct Task *task); -/*static */void sub_8104C5C(void); -/*static */void sub_8104CAC(u8 arg0); -/*static */bool8 sub_8104E18(void); -/*static */void nullsub_69(struct Task *task); -/*static */void sub_8104E74_(u8 taskId); -/*static */void sub_8104EA8(void); -/*static */void sub_8104F8C(void); -/*static */void sub_8104FF4(s16 x, s16 y, u8 a2, s16 a3); -/*static */void sub_81050C4(void); -/*static */void sub_8105100(void); -/*static */void sub_810514C(void); -/*static */void sub_81051C0(void); -/*static */void sub_8105284_(void); -/*static */void sub_81052EC(void); -/*static */void sub_81053A0(void); -/*static */void sub_810545C(void); -/*static */void sub_81054B8(void); -/*static */void sub_8105524(void); -/*static */void sub_8105554(void); -/*static */void CreateReelTimeSprites1(void); -/*static */void sub_8105688(s16 a0); -/*static */void sub_81056C0(void); -/*static */void CreateReelTimeSprite2(void); -/*static */void sub_81057E8(s16 a0); -/*static */void sub_8105804(void); -/*static */void sub_8105854(void); -/*static */void sub_81058A0(void); -/*static */void sub_81058C4(void); -/*static */void sub_81059B8(void); -/*static */void sub_81059E8(void); -/*static */bool8 sub_8105ACC(void); -/*static */void sub_8105AEC(void); -/*static */u8 sub_8105B1C(s16 x, s16 y); -/*static */void sub_8105B88(u8 spriteId); -/*static */u8 sub_8105BF8(u8 templateIdx, void (*callback)(struct Sprite*), s16 x, s16 y, s16 a4); -/*static */void sub_81063C0(void); -/*static */void sub_8106404(void); -/*static */void sub_8106448(void); -/*static */void sub_81064B8(void); -/*static */void sub_81065A8(s16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); -/*static */void sub_81065DC(void); -/*static */void sub_812F958(void); -/*static */void sub_812F968(void); -/*static */void LoadSlotMachineWheelOverlay(void); -/*static */u8 sub_8105BB4(u8 templateIdx, u8 cbAndCoordsIdx, s16 a2); +static void CB2_SlotMachineSetup(void); +static void CB2_SlotMachineLoop(void); +static void PlaySlotMachine_Internal(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinueScriptPlayMapMusic); +static void SlotMachineDummyTask(u8 taskId); +static void SlotMachineSetup_0_0(void); +static void SlotMachineSetup_6_2(void); +static void SlotMachineSetup_1_0(void); +static void SlotMachineSetup_2_0(void); +static void SlotMachineSetup_2_1(void); +static void SlotMachineSetup_0_1(void); +static void SlotMachineSetup_3_0(void); +static void SlotMachineSetup_4_0(void); +static void SlotMachineSetup_5_0(void); +static void SlotMachineSetup_6_0(void); +static void SlotMachineSetup_6_1(void); +static void SlotMachineSetup_8_0(void); +static void SlotMachineSetup_9_0(void); +static void SlotMachineSetup_10_0(void); +static void SlotMachineSetupGameplayTasks(void); +static void GameplayTasks_Slots(void); +static void sub_8104DA4(void); +static void RunSlotActions(u8 taskId); +static bool8 SlotAction_UnfadeScreen(struct Task *task); +static bool8 SlotAction_WaitForUnfade(struct Task *task); +static bool8 SlotAction_SetSlotMachineVars(struct Task *task); +static bool8 SlotAction3(struct Task *task); +static bool8 SlotAction4(struct Task *task); +static bool8 SlotAction_AwaitPlayerInput(struct Task *task); +static bool8 SlotAction_PrintYouDontHaveThreeCoins(struct Task *task); +static bool8 SlotAction_ExitYouDontHaveThreeCoinsMessage(struct Task *task); +static bool8 SlotAction_GivingInformation(struct Task *task); +static bool8 SlotAction9(struct Task *task); +static bool8 SlotAction10(struct Task *task); +static bool8 SlotAction_SetLuckySpins(struct Task *task); +static bool8 SlotAction_AwaitReelStop(struct Task *task); +static bool8 SlotAction_WaitForAllReelsToStop(struct Task *task); +static bool8 SlotAction_CheckMatches(struct Task *task); +static bool8 SlotAction_WaitForPayoutToBeAwarded(struct Task *task); +static bool8 SlotAction_EndOfRoll(struct Task *task); +static bool8 SlotAction_MatchedPower(struct Task *task); +static bool8 SlotAction18(struct Task *task); +static bool8 SlotAction_Loop(struct Task *task); +static bool8 SlotAction_NoMatches(struct Task *task); +static bool8 SlotAction_PrintQuitTheGame(struct Task *task); +static bool8 SlotAction_SeeIfPlayerQuits(struct Task *task); +static bool8 SlotAction_PrintMessage_9999Coins(struct Task *task); +static bool8 SlotAction_ExitMessage_9999Coins(struct Task *task); +static bool8 SlotAction_PrintMessage_NoMoreCoins(struct Task *task); +static bool8 SlotAction_ExitMessage_NoMoreCoins(struct Task *task); +static bool8 SlotAction_EndGame(struct Task *task); +static bool8 SlotAction_FreeDataStructures(struct Task *task); +static void DrawLuckyFlags(void); +static void SetLuckySpins(void); +static bool8 IsThisRoundLucky(void); +static u8 AttemptsAtLuckyflags_Top3(void); +static u16 SlowReelSpeed(void); +static u8 AttemptsAtLuckyflags_NotTop3(void); +static void CheckMatch(void); +static void CheckMatch_CenterRow(void); +static void CheckMatch_TopAndBottom(void); +static void CheckMatch_Diagonals(void); +static u8 GetMatchFromSymbolsInRow(u8 c1, u8 c2, u8 c3); +static void AwardPayout(void); +static void RunAwardPayoutActions(u8 taskId); +static bool8 IsFinalTask_RunAwardPayoutActions(void); +static bool8 AwardPayoutAction0(struct Task *task); +static bool8 AwardPayoutAction_GivePayoutToPlayer(struct Task *task); +static bool8 AwardPayoutAction_FreeTask(struct Task *task); +static u8 GetNearbyTag_Quantized(u8 x, s16 y); +static void GameplayTask_StopSlotReel(void); +static void ReelTasks_SetUnkTaskData(u8 a0); +static void sub_8102E1C(u8 a0); +static bool8 IsSlotReelMoving(u8 a0); +static void RunSlotReelActions(u8 taskId); +static bool8 SlotReelAction_StayStill(struct Task *task); +static bool8 SlotReelAction_Spin(struct Task *task); +static bool8 SlotReelAction_DecideWhereToStop(struct Task *task); +static bool8 SlotReelAction_MoveToStop(struct Task *task); +static bool8 SlotReelAction_OscillatingStop(struct Task *task); +static bool8 DecideReelTurns_BiasTag_Reel1(void); +static bool8 DecideReelTurns_BiasTag_Reel1_Bet1(u8 a0, u8 a1); +static bool8 DecideReelTurns_BiasTag_Reel1_Bet2or3(u8 a0, u8 a1); +static bool8 DecideReelTurns_BiasTag_Reel2(void); +static bool8 DecideReelTurns_BiasTag_Reel2_Bet1or2(void); +static bool8 DecideReelTurns_BiasTag_Reel2_Bet3(void); +static bool8 DecideReelTurns_BiasTag_Reel3(void); +static bool8 DecideReelTurns_BiasTag_Reel3_Bet1or2(u8 a0); +static bool8 DecideReelTurns_BiasTag_Reel3_Bet3(u8 a0); +static void DecideReelTurns_NoBiasTag_Reel1(void); +static void DecideReelTurns_NoBiasTag_Reel2(void); +static void DecideReelTurns_NoBiasTag_Reel2_Bet1(void); +static void DecideReelTurns_NoBiasTag_Reel2_Bet2(void); +static void DecideReelTurns_NoBiasTag_Reel2_Bet3(void); +static void DecideReelTurns_NoBiasTag_Reel3(void); +static void DecideReelTurns_NoBiasTag_Reel3_Bet1(void); +static void DecideReelTurns_NoBiasTag_Reel3_Bet2(void); +static void DecideReelTurns_NoBiasTag_Reel3_Bet3(void); +static void sub_8103C14(u8 a0); +static void sub_8103C48(u8 taskId); +static void LoadBetTiles(u8 a0); +static void sub_8103C78(struct Task *task, u8 taskId); +static void sub_8103CAC(struct Task *task, u8 taskId); +static void sub_8103CC8(struct Task *task, u8 taskId); +static void sub_8103D8C(u8 a0); +static void sub_8103DC8(void); +static void sub_8103E04(u8 a0); +static bool8 sub_8103E38(void); +static bool8 sub_8103E7C(void); +static bool8 sub_8103EAC(u8 spriteId); +static void sub_8103EE4(struct Sprite *sprite); +static void sub_8103F70(void); +static bool8 sub_8103FA0(void); +static void sub_8103FE8_(u8 taskId); +static void GameplayTask_PikaPower(void); +static void DisplayPikaPower(u8 pikaPower); +static bool8 sub_81040C8(void); +static void sub_81040E8(u8 taskId); +static void nullsub_68(struct Task *task); +static void sub_810411C(struct Task *task); +static void sub_8104144(struct Task *task); +static void sub_81041AC(struct Task *task); +static void ClearTaskDataFields_2orHigher(struct Task *task); +static void sub_810423C(u8 pikaPower); +static void BeginReeltime(void); +static bool8 IsFinalTask_RunReelTimeActions(void); +static void RunReeltimeActions(u8 taskId); +static void ReeltimeAction0(struct Task *task); +static void ReeltimeAction1(struct Task *task); +static void ReeltimeAction2(struct Task *task); +static void ReeltimeAction3(struct Task *task); +static void ReeltimeAction4(struct Task *task); +static void ReeltimeAction5(struct Task *task); +static void ReeltimeAction6(struct Task *task); +static void ReelTimeAction_LandOnOutcome(struct Task *task); +static void ReeltimeAction8(struct Task *task); +static void ReeltimeAction9(struct Task *task); +static void ReeltimeAction10(struct Task *task); +static void ReeltimeAction11(struct Task *task); +static void ReeltimeAction12(struct Task *task); +static void ReeltimeAction13(struct Task *task); +static void ReeltimeAction14(struct Task *task); +static void ReeltimeAction15(struct Task *task); +static void ReeltimeAction16(struct Task *task); +static void ReeltimeAction17(struct Task *task); +static void sub_8104A40(s16 a0, s16 a1); +static void sub_8104A88(s16 a0); +static void OpenInfoBox(u8 a0); +static bool8 IsInfoBoxClosed(void); +static void RunInfoBoxActions(u8 taskId); +static void InfoBox_FadeIn(struct Task *task); +static void InfoBox_WaitForFade(struct Task *task); +static void InfoBox_8104B80(struct Task *task); +static void InfoBox_AwaitPlayerInput(struct Task *task); +static void InfoBox_AddText(struct Task *task); +static void InfoBox_8104BFC(struct Task *task); +static void InfoBox_812DE14(struct Task *task); +static void InfoBox_812DE30(struct Task *task); +static void InfoBox_FreeTask(struct Task *task); +static void sub_8104C5C(void); +static void sub_8104CAC(u8 arg0); +static bool8 sub_8104E18(void); +static void nullsub_69(struct Task *task); +static void sub_8104E74_(u8 taskId); +static void sub_8104EA8(void); +static void sub_8104F8C(void); +static void sub_8104FF4(s16 x, s16 y, u8 a2, s16 a3); +static void sub_81050C4(void); +static void sub_8105100(void); +static void sub_810514C(void); +static void sub_81051C0(void); +static void sub_8105284_(void); +static void sub_81052EC(void); +static void sub_81053A0(void); +static void sub_810545C(void); +static void sub_81054B8(void); +static void sub_8105524(void); +static void sub_8105554(void); +static void CreateReelTimeSprites1(void); +static void sub_8105688(s16 a0); +static void sub_81056C0(void); +static void CreateReelTimeSprite2(void); +static void sub_81057E8(s16 a0); +static void sub_8105804(void); +static void sub_8105854(void); +static void sub_81058A0(void); +static void sub_81058C4(void); +static void sub_81059B8(void); +static void sub_81059E8(void); +static bool8 sub_8105ACC(void); +static void sub_8105AEC(void); +static u8 sub_8105B1C(s16 x, s16 y); +static void sub_8105B88(u8 spriteId); +static u8 sub_8105BF8(u8 templateIdx, void (*callback)(struct Sprite*), s16 x, s16 y, s16 a4); +static void sub_81063C0(void); +static void sub_8106404(void); +static void sub_8106448(void); +static void sub_81064B8(void); +static void sub_81065A8(s16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); +static void sub_81065DC(void); +static void sub_812F958(void); +static void sub_812F968(void); +static void LoadSlotMachineWheelOverlay(void); +static u8 sub_8105BB4(u8 templateIdx, u8 cbAndCoordsIdx, s16 a2); // Ewram variables static EWRAM_DATA u16 *gUnknown_0203AAC8 = NULL; @@ -356,7 +356,7 @@ static IWRAM_DATA struct SpriteFrameImage *gUnknown_03001188[26]; extern const struct UnkStruct1 *const gUnknown_083ED048[]; extern const u16 gPalette_83EDE24[]; extern const u8 LuckyRoundTable[][3]; -extern const u8 LuckyTags[]; +extern const u8 BiasTags[]; extern const u16 LuckyFlagSettings_Top3[]; extern const u16 LuckyFlagSettings_NotTop3[]; extern const s16 gUnknown_083ECE7E[][2]; @@ -453,39 +453,39 @@ const struct WindowTemplate gUnknown_085A7444 = 0, 1, 3, 20, 13, 13, 1 }; -const u8 gColors_ReelTimeHelp[] = {3, 1, 2, 0}; +const u8 gColors_ReeltimeHelp[] = {3, 1, 2, 0}; bool8 (*const SlotActions[])(struct Task *task) = { - SlotAction_UnfadeScreen, - SlotAction_WaitForUnfade, - SlotAction_SetSlotMachineVars, - SlotAction3, - SlotAction4, - SlotAction_AwaitPlayerInput, - SlotAction_PrintYouDontHaveThreeCoins, - SlotAction_ExitYouDontHaveThreeCoinsMessage, - SlotAction_GivingInformation, - SlotAction9, - SlotAction10, - SlotAction_SetLuckySpins, - SlotAction_AwaitReelStop, - SlotAction_WaitForAllReelsToStop, - SlotAction_CheckMatches, - SlotAction_WaitForPayoutToBeAwarded, - SlotAction_EndOfRoll, - SlotAction_MatchedPower, - SlotAction18, - SlotAction_Loop, - SlotAction_NoMatches, - SlotAction_PrintQuitTheGame, - SlotAction_SeeIfPlayerQuits, - SlotAction_Print9999CoinMessage, - SlotAction_Exit9999CoinMessage, - SlotAction_PrintNoMoreCoins, - SlotAction_ExitNoMoreCoinsMessage, - SlotAction_EndGame, - SlotAction_FreeDataStructures, + SlotAction_UnfadeScreen, // 0 + SlotAction_WaitForUnfade, // 1 + SlotAction_SetSlotMachineVars, // 2 + SlotAction3, // 3 + SlotAction4, // 4 + SlotAction_AwaitPlayerInput, // 5 + SlotAction_PrintYouDontHaveThreeCoins, // 6 + SlotAction_ExitYouDontHaveThreeCoinsMessage, // 7 + SlotAction_GivingInformation, // 8 + SlotAction9, // 9 + SlotAction10, // 10 + SlotAction_SetLuckySpins, // 11 + SlotAction_AwaitReelStop, // 12 + SlotAction_WaitForAllReelsToStop, // 13 + SlotAction_CheckMatches, // 14 + SlotAction_WaitForPayoutToBeAwarded, // 15 + SlotAction_EndOfRoll, // 16 + SlotAction_MatchedPower, // 17 + SlotAction18, // 18 + SlotAction_Loop, // 19 + SlotAction_NoMatches, // 20 + SlotAction_PrintQuitTheGame, // 21 + SlotAction_SeeIfPlayerQuits, // 22 + SlotAction_PrintMessage_9999Coins, // 23 + SlotAction_ExitMessage_9999Coins, // 24 + SlotAction_PrintMessage_NoMoreCoins, // 25 + SlotAction_ExitMessage_NoMoreCoins, // 26 + SlotAction_EndGame, // 27 + SlotAction_FreeDataStructures, // 28 }; bool8 (*const AwardPayoutActions[])(struct Task *task) = @@ -576,9 +576,9 @@ void (*const gUnknown_083ECBB4[])(struct Task *task) = const u16 pikaPowerTileTable[][2] = { - {0x9e, 0x6e}, // {0b10011110, 0b1101110} - {0x9f, 0x6f}, // {0b10011111, 0b1101111} - {0xaf, 0x7f}, // {0b10101111, 0b1111111} + {0x9e, 0x6e}, + {0x9f, 0x6f}, + {0xaf, 0x7f}, }; void (*const ReeltimeActions[])(struct Task *task) = @@ -589,7 +589,7 @@ void (*const ReeltimeActions[])(struct Task *task) = ReeltimeAction3, ReeltimeAction4, ReeltimeAction5, - ReeltimeAction6, // does stuff with reel time data + ReeltimeAction6, ReelTimeAction_LandOnOutcome, ReeltimeAction8, ReeltimeAction9, @@ -653,7 +653,7 @@ extern const struct SpriteTemplate gSpriteTemplate_83ED45C; // code #define tState data[0] -/*static */void Task_FadeToSlotMachine(u8 taskId) +static void Task_FadeToSlotMachine(u8 taskId) { switch (gTasks[taskId].tState) { @@ -671,19 +671,19 @@ extern const struct SpriteTemplate gSpriteTemplate_83ED45C; } } -void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinueScriptPlayMapMusic) +void PlaySlotMachine(u8 slotMachineIndex, MainCallback cb) { u8 taskId; sSlotMachine = AllocZeroed(sizeof(*sSlotMachine)); - PlaySlotMachine_Internal(slotMachineIndex, CB2_ReturnToFieldContinueScriptPlayMapMusic); + PlaySlotMachine_Internal(slotMachineIndex, cb); taskId = CreateTask(Task_FadeToSlotMachine, 0); gTasks[taskId].tState = 0; } #undef tState -/*static */void CB2_SlotMachineSetup(void) +static void CB2_SlotMachineSetup(void) { switch (gMain.state) { @@ -744,7 +744,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue } } -/*static */void CB2_SlotMachineLoop(void) +static void CB2_SlotMachineLoop(void) { RunTasks(); AnimateSprites(); @@ -752,7 +752,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue UpdatePaletteFade(); } -/*static */void SlotMachine_VBlankCallback(void) +static void SlotMachine_VBlankCallback(void) { LoadOam(); ProcessSpriteCopyRequests(); @@ -763,26 +763,26 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue SetGpuReg(REG_OFFSET_WINOUT, sSlotMachine->winOut); } -/*static */void PlaySlotMachine_Internal(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinueScriptPlayMapMusic) +static void PlaySlotMachine_Internal(u8 slotMachineIndex, MainCallback cb) { - struct Task *task = gTasks + CreateTask(SlotMachineDummyTask, 0xFF); + struct Task *task = &gTasks[CreateTask(SlotMachineDummyTask, 0xFF)]; task->data[0] = slotMachineIndex; - StoreWordInTwoHalfwords(task->data + 1, (intptr_t)CB2_ReturnToFieldContinueScriptPlayMapMusic); + StoreWordInTwoHalfwords(task->data + 1, (intptr_t)cb); } -/*static */void sub_81019EC(void) +static void sub_81019EC(void) { - struct Task *task = gTasks + FindTaskIdByFunc(SlotMachineDummyTask); + struct Task *task = &gTasks[FindTaskIdByFunc(SlotMachineDummyTask)]; sSlotMachine->machineId = task->data[0]; LoadWordFromTwoHalfwords((u16 *)(task->data + 1), (u32 *)&sSlotMachine->prevMainCb); } -/*static */void SlotMachineDummyTask(u8 taskId) +static void SlotMachineDummyTask(u8 taskId) { } -/*static */void SlotMachineSetup_0_0(void) +static void SlotMachineSetup_0_0(void) { SetVBlankCallback(NULL); SetHBlankCallback(NULL); @@ -793,24 +793,24 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue DeactivateAllTextPrinters(); } -/*static */void SlotMachineSetup_6_0(void) +static void SlotMachineSetup_6_0(void) { SetVBlankCallback(SlotMachine_VBlankCallback); EnableInterrupts(INTR_FLAG_VBLANK); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON); } -/*static */void SlotMachineSetup_1_0(void) +static void SlotMachineSetup_1_0(void) { DmaClearLarge16(3, (u16 *)(BG_VRAM), BG_VRAM_SIZE, 0x1000); } -/*static */void SlotMachineSetup_2_0(void) +static void SlotMachineSetup_2_0(void) { DmaClear16(3, (u16 *)OAM, OAM_SIZE); } -/*static */void SlotMachineSetup_2_1(void) +static void SlotMachineSetup_2_1(void) { SetGpuReg(REG_OFFSET_BG0CNT, 0); SetGpuReg(REG_OFFSET_BG1CNT, 0); @@ -831,12 +831,12 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue } // set up initial state of slot machine -/*static */void SlotMachineSetup_0_1(void) +static void SlotMachineSetup_0_1(void) { u8 i; - sub_81019EC(); // assigns sSlotMachine->machineId and other stuff - sSlotMachine->slotActionPtr = 0; + sub_81019EC(); // assigns sSlotMachine->machineId, etc. + sSlotMachine->state = 0; sSlotMachine->pikaPower = 0; sSlotMachine->luckyGame = Random() & 1; sSlotMachine->luckyFlags = 0; @@ -855,18 +855,17 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sSlotMachine->winOut = 0x3f; sSlotMachine->backupMapMusic = GetCurrentMapMusic(); - // for each reel... - for (i = 0; i < 3; i++) + for (i = 0; i < NUM_REELS; i++) { sSlotMachine->reelPixelOffsetsWhileStopping[i] = 0; sSlotMachine->reelTagOffsets[i] = sInitialReelPositions[i][sSlotMachine->luckyGame] % REEL_NUM_TAGS; - sSlotMachine->reelPixelOffsets[i] = 0x1f8 - sSlotMachine->reelTagOffsets[i] * 24; - sSlotMachine->reelPixelOffsets[i] %= 0x1f8; // 0x1f8 is 540 + sSlotMachine->reelPixelOffsets[i] = REEL_NUM_TAGS * REEL_TAG_HEIGHT - sSlotMachine->reelTagOffsets[i] * REEL_TAG_HEIGHT; + sSlotMachine->reelPixelOffsets[i] %= REEL_NUM_TAGS * REEL_TAG_HEIGHT; } - AlertTVThatYouPlayedSlotMachine(GetCoins()); + AlertTVThatPlayerPlayedSlotMachine(GetCoins()); } -/*static */void SlotMachineSetup_3_0(void) +static void SlotMachineSetup_3_0(void) { ResetPaletteFade(); ResetSpriteData(); @@ -875,7 +874,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue ResetTasks(); } -/*static */void SlotMachineSetup_4_0(void) +static void SlotMachineSetup_4_0(void) { selectedPikaPowerTile = Alloc(8); gUnknown_0203AAD0 = AllocZeroed(0xE); @@ -891,7 +890,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue gUnknown_0203AAD0[6] = 0x20BF; } -/*static */void SlotMachineSetup_5_0(void) +static void SlotMachineSetup_5_0(void) { sub_8106448(); sub_81064B8(); @@ -901,7 +900,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue PutWindowTilemap(0); } -/*static */void SlotMachineSetup_10_0(void) +static void SlotMachineSetup_10_0(void) { sub_8104EA8(); sub_8104F8C(); @@ -910,84 +909,84 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue } // create gameplay tasks -/*static */void SlotMachineSetupGameplayTasks(void) +static void SlotMachineSetupGameplayTasks(void) { - GameplayTasks_PikaPower(); + GameplayTask_PikaPower(); GameplayTask_StopSlotReel(); sub_8104C5C(); GameplayTasks_Slots(); } -/*static */void GameplayTasks_Slots(void) +static void GameplayTasks_Slots(void) { RunSlotActions(CreateTask(RunSlotActions, 0)); } // task->data[0] is a timer -/*static */void RunSlotActions(u8 taskId) +static void RunSlotActions(u8 taskId) { - while (SlotActions[sSlotMachine->slotActionPtr](gTasks + taskId)) + while (SlotActions[sSlotMachine->state](&gTasks[taskId])) ; } -/*static */bool8 SlotAction_UnfadeScreen(struct Task *task) +static bool8 SlotAction_UnfadeScreen(struct Task *task) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); sub_810423C(sSlotMachine->pikaPower); - sSlotMachine->slotActionPtr++; + sSlotMachine->state++; return FALSE; } -/*static */bool8 SlotAction_WaitForUnfade(struct Task *task) +static bool8 SlotAction_WaitForUnfade(struct Task *task) { if (!gPaletteFade.active) - sSlotMachine->slotActionPtr++; + sSlotMachine->state++; return FALSE; } -/*static */bool8 SlotAction_SetSlotMachineVars(struct Task *task) +static bool8 SlotAction_SetSlotMachineVars(struct Task *task) { sSlotMachine->payout = 0; sSlotMachine->bet = 0; sSlotMachine->currReel = 0; sSlotMachine->luckyFlags &= (LUCKY_BIAS_777 | LUCKY_BIAS_MIXED_777); - sSlotMachine->slotActionPtr = 4; + sSlotMachine->state = 4; if (sSlotMachine->coins <= 0) { - sSlotMachine->slotActionPtr = 25; + sSlotMachine->state = 25; } else if (sSlotMachine->fairRollsLeft) { - sSlotMachine->slotActionPtr = 3; + sSlotMachine->state = 3; sub_8104CAC(4); } return TRUE; } -/*static */bool8 SlotAction3(struct Task *task) +static bool8 SlotAction3(struct Task *task) { if (sub_8104E18()) - sSlotMachine->slotActionPtr = 4; + sSlotMachine->state = 4; return FALSE; } -/*static */bool8 SlotAction4(struct Task *task) +static bool8 SlotAction4(struct Task *task) { sub_8104CAC(0); - sSlotMachine->slotActionPtr = 5; + sSlotMachine->state = 5; if (sSlotMachine->coins >= 9999) - sSlotMachine->slotActionPtr = 23; + sSlotMachine->state = 23; return TRUE; } -/*static */bool8 SlotAction_AwaitPlayerInput(struct Task *task) +static bool8 SlotAction_AwaitPlayerInput(struct Task *task) { s16 i; if (gMain.newKeys & SELECT_BUTTON) { OpenInfoBox(0); - sSlotMachine->slotActionPtr = 8; + sSlotMachine->state = 8; } else if (gMain.newKeys & R_BUTTON) // bet the max amount { @@ -997,12 +996,12 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue LoadBetTiles(i); sSlotMachine->coins -= (3 - sSlotMachine->bet); sSlotMachine->bet = 3; - sSlotMachine->slotActionPtr = 9; + sSlotMachine->state = 9; PlaySE(SE_REGI); } else // you didn't have enough coins to bet the max { - sSlotMachine->slotActionPtr = 6; + sSlotMachine->state = 6; } } else @@ -1016,42 +1015,42 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue } // player maxed out or finished betting if (sSlotMachine->bet >= 3 || (sSlotMachine->bet != 0 && gMain.newKeys & A_BUTTON)) - sSlotMachine->slotActionPtr = 9; + sSlotMachine->state = 9; // player wants to quit if (gMain.newKeys & B_BUTTON) - sSlotMachine->slotActionPtr = 21; + sSlotMachine->state = 21; } return FALSE; } -/*static */bool8 SlotAction_PrintYouDontHaveThreeCoins(struct Task *task) +static bool8 SlotAction_PrintYouDontHaveThreeCoins(struct Task *task) { NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_YouDontHaveThreeCoins, 0, 1, 0, 0); CopyWindowToVram(0, 3); - sSlotMachine->slotActionPtr = 7; + sSlotMachine->state = 7; return FALSE; } -/*static */bool8 SlotAction_ExitYouDontHaveThreeCoinsMessage(struct Task *task) +static bool8 SlotAction_ExitYouDontHaveThreeCoinsMessage(struct Task *task) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { sub_8197434(0, TRUE); - sSlotMachine->slotActionPtr = 5; + sSlotMachine->state = 5; } return FALSE; } -/*static */bool8 SlotAction_GivingInformation(struct Task *task) +static bool8 SlotAction_GivingInformation(struct Task *task) { if (IsInfoBoxClosed()) - sSlotMachine->slotActionPtr = 5; + sSlotMachine->state = 5; return FALSE; } // probably make all the slots roll -/*static */bool8 SlotAction9(struct Task *task) +static bool8 SlotAction9(struct Task *task) { DrawLuckyFlags(); sub_8104DA4(); @@ -1066,64 +1065,62 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue task->data[0] = 0; if (sSlotMachine->luckyFlags & LUCKY_BIAS_REELTIME) { - // enter into reel time BeginReeltime(); - sSlotMachine->slotActionPtr = 10; + sSlotMachine->state = 10; } else { sub_8104CAC(1); - sSlotMachine->slotActionPtr = 11; + sSlotMachine->state = 11; } sSlotMachine->reelIncrement = 8; if (sSlotMachine->fairRollsLeft) - // slow down the reel speed if you're really losing - sSlotMachine->reelIncrement = DrawNewReelIncrement(); + sSlotMachine->reelIncrement = SlowReelSpeed(); return FALSE; } -/*static */bool8 SlotAction10(struct Task *task) +static bool8 SlotAction10(struct Task *task) { if (IsFinalTask_RunReelTimeActions()) { sub_8104CAC(1); sSlotMachine->luckyFlags &= ~LUCKY_BIAS_REELTIME; - sSlotMachine->slotActionPtr = 11; + sSlotMachine->state = 11; } return FALSE; } -/*static */bool8 SlotAction_SetLuckySpins(struct Task *task) +static bool8 SlotAction_SetLuckySpins(struct Task *task) { if (++task->data[0] >= 30) { SetLuckySpins(); - sSlotMachine->slotActionPtr = 12; + sSlotMachine->state = 12; } return FALSE; } -/*static */bool8 SlotAction_AwaitReelStop(struct Task *task) +static bool8 SlotAction_AwaitReelStop(struct Task *task) { if (gMain.newKeys & A_BUTTON) { PlaySE(SE_JYUNI); sub_8102E1C(sSlotMachine->currReel); sub_8103C14(sSlotMachine->currReel); - sSlotMachine->slotActionPtr = 13; + sSlotMachine->state = 13; } return FALSE; } -/*static */bool8 SlotAction_WaitForAllReelsToStop(struct Task *task) +static bool8 SlotAction_WaitForAllReelsToStop(struct Task *task) { if (!IsSlotReelMoving(sSlotMachine->currReel)) { sSlotMachine->currReel++; - sSlotMachine->slotActionPtr = 12; + sSlotMachine->state = 12; if (sSlotMachine->currReel > 2) { - sSlotMachine->slotActionPtr = 14; + sSlotMachine->state = 14; } return TRUE; } @@ -1131,7 +1128,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue } // once all reels have stopped -/*static */bool8 SlotAction_CheckMatches(struct Task *task) +static bool8 SlotAction_CheckMatches(struct Task *task) { sSlotMachine->luckyFlags &= (LUCKY_BIAS_777 | LUCKY_BIAS_MIXED_777); CheckMatch(); @@ -1143,7 +1140,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue if (sSlotMachine->matchedSymbols) { - sSlotMachine->slotActionPtr = 15; + sSlotMachine->state = 15; AwardPayout(); sub_8103F70(); if ((sSlotMachine->netCoinLoss -= sSlotMachine->payout) < 0) @@ -1175,7 +1172,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sSlotMachine->fairRollsUsed = 0; sSlotMachine->luckyGame = 0; if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_777_BLUE)) - // this may be a bug, but if you get blue 777, the game becomes lucky + // this may be an error, but if you get blue 777, the game becomes lucky sSlotMachine->luckyGame = 1; } } @@ -1188,104 +1185,104 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue else { sub_8104CAC(3); - sSlotMachine->slotActionPtr = 20; + sSlotMachine->state = 20; if ((sSlotMachine->netCoinLoss += sSlotMachine->bet) > 9999) sSlotMachine->netCoinLoss = 9999; } return FALSE; } -/*static */bool8 SlotAction_WaitForPayoutToBeAwarded(struct Task *task) +static bool8 SlotAction_WaitForPayoutToBeAwarded(struct Task *task) { if (IsFinalTask_RunAwardPayoutActions()) - sSlotMachine->slotActionPtr = 16; + sSlotMachine->state = 16; return FALSE; } -/*static */bool8 SlotAction_EndOfRoll(struct Task *task) +static bool8 SlotAction_EndOfRoll(struct Task *task) { if (sub_8103FA0()) { - sSlotMachine->slotActionPtr = 19; + sSlotMachine->state = 19; if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_RED) | (1 << SLOT_MACHINE_MATCHED_777_BLUE))) IncrementGameStat(GAME_STAT_SLOT_JACKPOTS); if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) { sSlotMachine->currReel = 0; - sSlotMachine->slotActionPtr = 9; + sSlotMachine->state = 9; } if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_POWER)) - sSlotMachine->slotActionPtr = 17; + sSlotMachine->state = 17; if (sSlotMachine->fairRollsLeft && sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) { sub_8104CAC(4); - sSlotMachine->slotActionPtr = 18; + sSlotMachine->state = 18; } } return FALSE; } -/*static */bool8 SlotAction_MatchedPower(struct Task *task) +static bool8 SlotAction_MatchedPower(struct Task *task) { if (!sub_81040C8()) { - sSlotMachine->slotActionPtr = 19; + sSlotMachine->state = 19; if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) { - sSlotMachine->slotActionPtr = 9; + sSlotMachine->state = 9; if (sSlotMachine->fairRollsLeft) { sub_8104CAC(4); - sSlotMachine->slotActionPtr = 18; + sSlotMachine->state = 18; } } } return FALSE; } -/*static */bool8 SlotAction18(struct Task *task) +static bool8 SlotAction18(struct Task *task) { if (sub_8104E18()) { - sSlotMachine->slotActionPtr = 19; + sSlotMachine->state = 19; if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) { - sSlotMachine->slotActionPtr = 9; + sSlotMachine->state = 9; } } return FALSE; } -/*static */bool8 SlotAction_Loop(struct Task *task) +static bool8 SlotAction_Loop(struct Task *task) { sub_8103D8C(0); sub_8103D8C(1); sub_8103D8C(2); - sSlotMachine->slotActionPtr = 2; + sSlotMachine->state = 2; return FALSE; } -/*static */bool8 SlotAction_NoMatches(struct Task *task) +static bool8 SlotAction_NoMatches(struct Task *task) { if (++task->data[1] > 64) { task->data[1] = 0; - sSlotMachine->slotActionPtr = 19; + sSlotMachine->state = 19; } return FALSE; } -/*static */bool8 SlotAction_PrintQuitTheGame(struct Task *task) +static bool8 SlotAction_PrintQuitTheGame(struct Task *task) { NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_QuitTheGame, 0, 1, 0, 0); CopyWindowToVram(0, 3); CreateYesNoMenuParameterized(0x15, 7, 0x214, 0x180, 0xE, 0xF); - sSlotMachine->slotActionPtr = 22; + sSlotMachine->state = 22; return FALSE; } -/*static */bool8 SlotAction_SeeIfPlayerQuits(struct Task *task) +static bool8 SlotAction_SeeIfPlayerQuits(struct Task *task) { s8 input = Menu_ProcessInputNoWrapClearOnChoose(); if (input == 0) // player chooses to quit @@ -1295,64 +1292,64 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sub_8103D8C(1); sub_8103D8C(2); sSlotMachine->coins += sSlotMachine->bet; - sSlotMachine->slotActionPtr = 27; + sSlotMachine->state = 27; } else if (input == 1 || input == -1) // player chooses not to quit { sub_8197434(0, TRUE); - sSlotMachine->slotActionPtr = 5; + sSlotMachine->state = 5; } return FALSE; } -/*static */bool8 SlotAction_Print9999CoinMessage(struct Task *task) +static bool8 SlotAction_PrintMessage_9999Coins(struct Task *task) { NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_YouveGot9999Coins, 0, 1, 0, 0); CopyWindowToVram(0, 3); - sSlotMachine->slotActionPtr = 24; + sSlotMachine->state = 24; return FALSE; } -/*static */bool8 SlotAction_Exit9999CoinMessage(struct Task *task) +static bool8 SlotAction_ExitMessage_9999Coins(struct Task *task) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { sub_8197434(0, TRUE); - sSlotMachine->slotActionPtr = 5; + sSlotMachine->state = 5; } return FALSE; } -/*static */bool8 SlotAction_PrintNoMoreCoins(struct Task *task) +static bool8 SlotAction_PrintMessage_NoMoreCoins(struct Task *task) { NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_YouveRunOutOfCoins, 0, 1, 0, 0); CopyWindowToVram(0, 3); - sSlotMachine->slotActionPtr = 26; + sSlotMachine->state = 26; return FALSE; } -/*static */bool8 SlotAction_ExitNoMoreCoinsMessage(struct Task *task) +static bool8 SlotAction_ExitMessage_NoMoreCoins(struct Task *task) { if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { sub_8197434(0, TRUE); - sSlotMachine->slotActionPtr = 27; + sSlotMachine->state = 27; } return FALSE; } -/*static */bool8 SlotAction_EndGame(struct Task *task) +static bool8 SlotAction_EndGame(struct Task *task) { SetCoins(sSlotMachine->coins); - reportNewCoinTotal(GetCoins()); + AlertTVOfNewCointTotal(GetCoins()); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); - sSlotMachine->slotActionPtr++; + sSlotMachine->state++; return FALSE; } -/*static */bool8 SlotAction_FreeDataStructures(struct Task *task) +static bool8 SlotAction_FreeDataStructures(struct Task *task) { if (!gPaletteFade.active) { @@ -1394,7 +1391,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */void DrawLuckyFlags(void) +static void DrawLuckyFlags(void) { u8 attempts; @@ -1425,27 +1422,27 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue } } -/*static */void SetLuckySpins(void) +static void SetLuckySpins(void) { sSlotMachine->luckySpinsLeft = 0; if (sSlotMachine->luckyFlags) sSlotMachine->luckySpinsLeft = 1; } -/*static */u8 GetLuckyTag(u8 luckyFlags) +static u8 GetBiasTag(u8 luckyFlags) { u8 i; for (i = 0; i < 8; i++) { if (luckyFlags & 1) - return LuckyTags[i]; + return BiasTags[i]; luckyFlags >>= 1; } return 0; } -/*static */bool8 IsThisRoundLucky(void) +static bool8 IsThisRoundLucky(void) { u8 rval = Random(); if (LuckyRoundTable[sSlotMachine->machineId][sSlotMachine->bet - 1] > rval) @@ -1453,7 +1450,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */u8 AttemptsAtLuckyflags_Top3(void) +static u8 AttemptsAtLuckyflags_Top3(void) { s16 count; @@ -1467,7 +1464,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return count; } -/*static */u8 AttemptsAtLuckyflags_NotTop3(void) +static u8 AttemptsAtLuckyflags_NotTop3(void) { s16 count; @@ -1495,7 +1492,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return count; } -/*static */u8 GetReelTimeProbability(u8 reelTimeDraw) +static u8 GetReelTimeProbability(u8 reelTimeDraw) { if (sSlotMachine->luckyGame == 0) return ReelTimeProbabilityTable_UnluckyGame[reelTimeDraw][sSlotMachine->pikaPower]; @@ -1503,7 +1500,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return ReelTimeProbabilityTable_LuckyGame[reelTimeDraw][sSlotMachine->pikaPower]; } -/*static */void GetReeltimeDraw(void) +static void GetReeltimeDraw(void) { u8 rval; s16 reelTimeDraw; @@ -1521,7 +1518,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue sSlotMachine->reelTimeDraw = reelTimeDraw; } -/*static */bool8 SkipToReeltimeAction14(u16 i) +static bool8 SkipToReeltimeAction14(u16 i) { u16 rval = Random() & 0xff; if (rval < ProbabilityTable_SkipToReeltimeAction14[i]) @@ -1530,7 +1527,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */u16 DrawNewReelIncrement(void) +static u16 SlowReelSpeed(void) { u8 i = 0; u8 rval; @@ -1554,7 +1551,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return 8; } -/*static */void CheckMatch(void) +static void CheckMatch(void) { sSlotMachine->matchedSymbols = 0; CheckMatch_CenterRow(); @@ -1564,7 +1561,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue CheckMatch_Diagonals(); } -/*static */void CheckMatch_CenterRow(void) +static void CheckMatch_CenterRow(void) { u8 c1, c2, c3, match; @@ -1580,7 +1577,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue } } -/*static */void CheckMatch_TopAndBottom(void) +static void CheckMatch_TopAndBottom(void) { u8 c1, c2, c3, match; @@ -1610,7 +1607,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue } } -/*static */void CheckMatch_Diagonals(void) +static void CheckMatch_Diagonals(void) { u8 c1, c2, c3, match; @@ -1642,7 +1639,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue } } -/*static */u8 GetMatchFromSymbolsInRow(u8 c1, u8 c2, u8 c3) +static u8 GetMatchFromSymbolsInRow(u8 c1, u8 c2, u8 c3) { if (c1 == c2 && c1 == c3) return sSym2Match[c1]; @@ -1655,12 +1652,12 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return SLOT_MACHINE_MATCHED_NONE; } -/*static */void AwardPayout(void) +static void AwardPayout(void) { RunAwardPayoutActions(CreateTask(RunAwardPayoutActions, 4)); } -/*static */bool8 IsFinalTask_RunAwardPayoutActions(void) +static bool8 IsFinalTask_RunAwardPayoutActions(void) { if (FindTaskIdByFunc(RunAwardPayoutActions) == TAIL_SENTINEL) return TRUE; @@ -1668,13 +1665,13 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */void RunAwardPayoutActions(u8 taskId) +static void RunAwardPayoutActions(u8 taskId) { - while (AwardPayoutActions[gTasks[taskId].data[0]](gTasks + taskId)) + while (AwardPayoutActions[gTasks[taskId].data[0]](&gTasks[taskId])) ; } -/*static */bool8 AwardPayoutAction0(struct Task *task) +static bool8 AwardPayoutAction0(struct Task *task) { if (sub_8103E38()) { @@ -1688,7 +1685,7 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } // task->data[1]: timer -/*static */bool8 AwardPayoutAction_GivePayoutToPlayer(struct Task *task) +static bool8 AwardPayoutAction_GivePayoutToPlayer(struct Task *task) { if (!task->data[1]--) { @@ -1714,17 +1711,16 @@ void PlaySlotMachine(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinue return FALSE; } -/*static */bool8 AwardPayoutAction_FreeTask(struct Task *task) +static bool8 AwardPayoutAction_FreeTask(struct Task *task) { if (sub_8103E7C()) DestroyTask(FindTaskIdByFunc(RunAwardPayoutActions)); return FALSE; } -/* -Returns the tag that is posOffset below the tag at the top of reelIndex's tape -*/ -/*static */u8 GetNearbyTag_Quantized(u8 reelIndex, s16 posOffset) + +// Returns the tag that is posOffset below the tag at the top of reelIndex's tape +static u8 GetNearbyTag_Quantized(u8 reelIndex, s16 posOffset) { s16 tagIndex = (sSlotMachine->reelTagOffsets[reelIndex] + posOffset) % REEL_NUM_TAGS; if (tagIndex < 0) @@ -1732,10 +1728,9 @@ Returns the tag that is posOffset below the tag at the top of reelIndex's tape return sReelSymbols[reelIndex][tagIndex]; } -/* -Calculates GetNearbyTag_Quantized as if the reel was snapped downwards into place -/* -/*static */u8 GetNearbyTag(u8 reelIndex, s16 posOffset) + +// Calculates GetNearbyTag_Quantized as if the reel was snapped downwards into place +static u8 GetNearbyTag(u8 reelIndex, s16 posOffset) { s16 tagOffset = 0; s16 result = sSlotMachine->reelPixelOffsets[reelIndex] % 24; @@ -1744,7 +1739,7 @@ Calculates GetNearbyTag_Quantized as if the reel was snapped downwards into plac return GetNearbyTag_Quantized(reelIndex, posOffset + tagOffset); } -/*static */u8 GetNearbyReelTimeTag(s16 n) +static u8 GetNearbyReelTimeTag(s16 n) { s16 newPosition = (sSlotMachine->reeltimePosition + n) % 6; if (newPosition < 0) @@ -1752,7 +1747,7 @@ Calculates GetNearbyTag_Quantized as if the reel was snapped downwards into plac return ReelTimeTags[newPosition]; } -/*static */void AdvanceSlotReel(u8 reelIndex, s16 value) +static void AdvanceSlotReel(u8 reelIndex, s16 value) { sSlotMachine->reelPixelOffsets[reelIndex] += value; sSlotMachine->reelPixelOffsets[reelIndex] %= 504; @@ -1772,7 +1767,7 @@ s16 AdvanceSlotReelToNextTag(u8 reelIndex, s16 value) return offset; } -/*static */void AdvanceReeltimeReel(s16 value) +static void AdvanceReeltimeReel(s16 value) { sSlotMachine->reeltimePixelOffset += value; sSlotMachine->reeltimePixelOffset %= 120; @@ -1792,7 +1787,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return offset; } -/*static */void GameplayTask_StopSlotReel(void) +static void GameplayTask_StopSlotReel(void) { u8 i; for (i = 0; i < 3; i++) @@ -1804,43 +1799,43 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) } } -/*static */void ReelTasks_SetUnkTaskData(u8 reelIndex) +static void ReelTasks_SetUnkTaskData(u8 reelIndex) { gTasks[sSlotMachine->slotReelTasks[reelIndex]].data[0] = 1; gTasks[sSlotMachine->slotReelTasks[reelIndex]].data[14] = 1; } -/*static */void sub_8102E1C(u8 reelIndex) +static void sub_8102E1C(u8 reelIndex) { gTasks[sSlotMachine->slotReelTasks[reelIndex]].data[0] = 2; } -/*static */bool8 IsSlotReelMoving(u8 reelIndex) +static bool8 IsSlotReelMoving(u8 reelIndex) { return gTasks[sSlotMachine->slotReelTasks[reelIndex]].data[14]; } -/*static */void RunSlotReelActions(u8 taskId) +static void RunSlotReelActions(u8 taskId) { - while (SlotReelActions[gTasks[taskId].data[0]](gTasks + taskId)) + while (SlotReelActions[gTasks[taskId].data[0]](&gTasks[taskId])) ; } // task->data[1] reel turns // task->data[15] reelIndex -/*static */bool8 SlotReelAction_StayStill(struct Task *task) +static bool8 SlotReelAction_StayStill(struct Task *task) { return FALSE; } -/*static */bool8 SlotReelAction_Spin(struct Task *task) +static bool8 SlotReelAction_Spin(struct Task *task) { AdvanceSlotReel(task->data[15], sSlotMachine->reelIncrement); return FALSE; } // As in previous generations, the slot machine often doesn't stop exactly when you press stop -/*static */bool8 SlotReelAction_DecideWhereToStop(struct Task *task) +static bool8 SlotReelAction_DecideWhereToStop(struct Task *task) { task->data[0]++; // initialize data for that reel --> these will be changed if biasTags can be lined up @@ -1857,7 +1852,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) } // go to next tag and then do any additional turns -/*static */bool8 SlotReelAction_MoveToStop(struct Task *task) +static bool8 SlotReelAction_MoveToStop(struct Task *task) { u16 reelStopShocks[ARRAY_COUNT(ReelStopShocks)]; s16 reelPixelPos; @@ -1882,7 +1877,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) } // make selected tag oscillate before it becomes still -/*static */bool8 SlotReelAction_OscillatingStop(struct Task *task) +static bool8 SlotReelAction_OscillatingStop(struct Task *task) { sSlotMachine->reelPixelOffsetsWhileStopping[task->data[15]] = task->data[1]; task->data[1] = -task->data[1]; @@ -1898,9 +1893,9 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return FALSE; } -/*static */bool8 DecideReelTurns_BiasTag_Reel1(void) +static bool8 DecideReelTurns_BiasTag_Reel1(void) { - u8 tag2 = GetLuckyTag(sSlotMachine->luckyFlags); + u8 tag2 = GetBiasTag(sSlotMachine->luckyFlags); u8 tag1 = tag2; if (sSlotMachine->luckyFlags & (LUCKY_BIAS_777 | LUCKY_BIAS_MIXED_777)) { @@ -1910,7 +1905,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return DecideReelTurns_BiasTag_Reel1_Bets[sSlotMachine->bet - 1](tag1, tag2); } -/*static */bool8 AreTagsAtPosition_Reel1(s16 pos, u8 tag1, u8 tag2) +static bool8 AreTagsAtPosition_Reel1(s16 pos, u8 tag1, u8 tag2) { u8 tag = GetNearbyTag(0, pos); if (tag == tag1 || tag == tag2) @@ -1921,7 +1916,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return FALSE; } -/*static */bool8 AreCherriesOnScreen_Reel1(s16 offsetFromCenter) +static bool8 AreCherriesOnScreen_Reel1(s16 offsetFromCenter) { if (GetNearbyTag(0, 1 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetNearbyTag(0, 2 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY || GetNearbyTag(0, 3 - offsetFromCenter) == SLOT_MACHINE_TAG_CHERRY) return TRUE; @@ -1929,7 +1924,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return FALSE; } -/*static */bool8 IsBiasTowardsCherryOr7s(void) +static bool8 IsBiasTowardsCherryOr7s(void) { if (sSlotMachine->luckyFlags & (LUCKY_BIAS_777 | LUCKY_BIAS_MIXED_777 | LUCKY_BIAS_CHERRY)) return TRUE; @@ -1937,7 +1932,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return FALSE; } -/*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet1(u8 tag1, u8 tag2) +static bool8 DecideReelTurns_BiasTag_Reel1_Bet1(u8 tag1, u8 tag2) { s16 i; @@ -1954,7 +1949,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return FALSE; } -/*static */bool8 DecideReelTurns_BiasTag_Reel1_Bet2or3(u8 tag1, u8 tag2) +static bool8 DecideReelTurns_BiasTag_Reel1_Bet2or3(u8 tag1, u8 tag2) { s16 i; bool8 biased = IsBiasTowardsCherryOr7s(); @@ -2005,12 +2000,12 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return FALSE; } -/*static */bool8 DecideReelTurns_BiasTag_Reel2(void) +static bool8 DecideReelTurns_BiasTag_Reel2(void) { return DecideReelTurns_BiasTag_Reel2_Bets[sSlotMachine->bet - 1](); } -/*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet1or2(void) +static bool8 DecideReelTurns_BiasTag_Reel2_Bet1or2(void) { s16 i; s16 biasTagLocation_Reel1 = sSlotMachine->winnerRows[0]; @@ -2028,7 +2023,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return FALSE; } -/*static */bool8 DecideReelTurns_BiasTag_Reel2_Bet3(void) +static bool8 DecideReelTurns_BiasTag_Reel2_Bet3(void) { s16 i; // if biasTag appears in the same row within 4 turns... @@ -2067,7 +2062,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return FALSE; } -/*static */bool8 DecideReelTurns_BiasTag_Reel3(void) +static bool8 DecideReelTurns_BiasTag_Reel3(void) { u8 biasTag = sSlotMachine->biasTag; if (sSlotMachine->luckyFlags & LUCKY_BIAS_MIXED_777) @@ -2081,7 +2076,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return DecideReelTurns_BiasTag_Reel3_Bets[sSlotMachine->bet - 1](biasTag); } -/*static */bool8 DecideReelTurns_BiasTag_Reel3_Bet1or2(u8 biasTag) +static bool8 DecideReelTurns_BiasTag_Reel3_Bet1or2(u8 biasTag) { s16 i; s16 biasTagLocation_Reel2 = sSlotMachine->winnerRows[1]; @@ -2099,7 +2094,7 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return FALSE; } -/*static */bool8 DecideReelTurns_BiasTag_Reel3_Bet3(u8 biasTag) +static bool8 DecideReelTurns_BiasTag_Reel3_Bet3(u8 biasTag) { s16 i; s16 biasTagFinalPos; @@ -2125,10 +2120,9 @@ s16 AdvanceReeltimeReelToNextTag(s16 value) return FALSE; } -/* -Advance until there are no cherries on screen in reel 1 -*/ -/*static */void DecideReelTurns_NoBiasTag_Reel1(void) +// Advance until there are no cherries on screen in reel 1 + +static void DecideReelTurns_NoBiasTag_Reel1(void) { s16 i = 0; @@ -2137,7 +2131,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->reelExtraTurns[0] = i; } -/*static */bool8 IsBiasTag777_SwitchColor(u8 *biasTagPtr) +static bool8 IsBiasTag777_SwitchColor(u8 *biasTagPtr) { if (*biasTagPtr == SLOT_MACHINE_TAG_7_RED) { @@ -2152,13 +2146,13 @@ Advance until there are no cherries on screen in reel 1 return FALSE; } -/*static */void DecideReelTurns_NoBiasTag_Reel2(void) +static void DecideReelTurns_NoBiasTag_Reel2(void) { DecideReelTurns_NoBiasTag_Reel2_Bets[sSlotMachine->bet - 1](); } // only does stuff if the biasTag is one of the 7's, plus other conditions -/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet1(void) +static void DecideReelTurns_NoBiasTag_Reel2_Bet1(void) { if (sSlotMachine->winnerRows[0] != 0 && sSlotMachine->luckyFlags & LUCKY_BIAS_777) { @@ -2182,7 +2176,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet2(void) +static void DecideReelTurns_NoBiasTag_Reel2_Bet2(void) { if (sSlotMachine->winnerRows[0] != 0 && sSlotMachine->luckyFlags & LUCKY_BIAS_777) { @@ -2206,7 +2200,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void DecideReelTurns_NoBiasTag_Reel2_Bet3(void) +static void DecideReelTurns_NoBiasTag_Reel2_Bet3(void) { s16 i; s16 j; @@ -2275,7 +2269,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */bool8 AreTagsMixed77(u8 tag1, u8 tag2) +static bool8 AreTagsMixed77(u8 tag1, u8 tag2) { if ((tag1 == SLOT_MACHINE_TAG_7_RED && tag2 == SLOT_MACHINE_TAG_7_BLUE) || (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag2 == SLOT_MACHINE_TAG_7_RED)) return TRUE; @@ -2283,7 +2277,7 @@ Advance until there are no cherries on screen in reel 1 return FALSE; } -/*static */bool8 AreTagsMixed777(u8 tag1, u8 tag2, u8 tag3) +static bool8 AreTagsMixed777(u8 tag1, u8 tag2, u8 tag3) { if ((tag1 == SLOT_MACHINE_TAG_7_RED && tag2 == SLOT_MACHINE_TAG_7_BLUE && tag3 == SLOT_MACHINE_TAG_7_RED) || (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag2 == SLOT_MACHINE_TAG_7_RED && tag3 == SLOT_MACHINE_TAG_7_BLUE)) @@ -2292,7 +2286,7 @@ Advance until there are no cherries on screen in reel 1 return FALSE; } -/*static */bool8 TagsDontMatchOrHaveAny7s(u8 tag1, u8 tag2, u8 tag3) +static bool8 TagsDontMatchOrHaveAny7s(u8 tag1, u8 tag2, u8 tag3) { if ((tag1 == SLOT_MACHINE_TAG_7_RED && tag2 == SLOT_MACHINE_TAG_7_BLUE && tag3 == SLOT_MACHINE_TAG_7_RED) || (tag1 == SLOT_MACHINE_TAG_7_BLUE && tag2 == SLOT_MACHINE_TAG_7_RED && tag3 == SLOT_MACHINE_TAG_7_BLUE) || @@ -2305,12 +2299,12 @@ Advance until there are no cherries on screen in reel 1 return TRUE; } -/*static */void DecideReelTurns_NoBiasTag_Reel3(void) +static void DecideReelTurns_NoBiasTag_Reel3(void) { DecideReelTurns_NoBiasTag_Reel3_Bets[sSlotMachine->bet - 1](); } -/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet1(void) +static void DecideReelTurns_NoBiasTag_Reel3_Bet1(void) { s16 i = 0; u8 tag1 = GetNearbyTag(0, 2 - sSlotMachine->reelExtraTurns[0]); @@ -2353,7 +2347,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->reelExtraTurns[2] = i; } -/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet2(void) +static void DecideReelTurns_NoBiasTag_Reel3_Bet2(void) { s16 extraTurns = 0; s16 i; @@ -2403,7 +2397,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->reelExtraTurns[2] = extraTurns; } -/*static */void DecideReelTurns_NoBiasTag_Reel3_Bet3(void) +static void DecideReelTurns_NoBiasTag_Reel3_Bet3(void) { u8 tag1; u8 tag2; @@ -2453,62 +2447,62 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8103C14(u8 a0) +static void sub_8103C14(u8 a0) { u8 taskId = CreateTask(sub_8103C48, 5); gTasks[taskId].data[15] = a0; sub_8103C48(taskId); } -/*static */void sub_8103C48(u8 taskId) +static void sub_8103C48(u8 taskId) { - gUnknown_083ECBA0[gTasks[taskId].data[0]](gTasks + taskId, taskId); + gUnknown_083ECBA0[gTasks[taskId].data[0]](&gTasks[taskId], taskId); } -/*static */void sub_8103C78(struct Task *task, u8 taskId) +static void sub_8103C78(struct Task *task, u8 taskId) { sub_81065A8(gUnknown_083ECBAC[task->data[15]], 0x62, 0x63, 0x72, 0x73); task->data[0]++; } -/*static */void sub_8103CAC(struct Task *task, u8 taskId) +static void sub_8103CAC(struct Task *task, u8 taskId) { if (++task->data[1] > 11) task->data[0]++; } -/*static */void sub_8103CC8(struct Task *task, u8 taskId) +static void sub_8103CC8(struct Task *task, u8 taskId) { sub_81065A8(gUnknown_083ECBAC[task->data[15]], 0x42, 0x43, 0x52, 0x53); DestroyTask(taskId); } -/*static */void LoadLightedTile(u8 tileId) +static void LoadLitTile(u8 tileId) { LoadPalette(gUnknown_083EDD08[tileId], gUnknown_083EDD30[tileId], 2); } -/*static */void sub_8103D28(u8 a0) +static void sub_8103D28(u8 a0) { LoadPalette(gUnknown_083EDD1C[a0], gUnknown_083EDD30[a0], 2); } // light up the value bet by the player -/*static */void LoadBetTiles(u8 betVal) +static void LoadBetTiles(u8 betVal) { u8 i; for (i = 0; i < gNumberBettingTiles[betVal]; i++) - LoadLightedTile(gBettingTilesId[betVal][i]); + LoadLitTile(gBettingTilesId[betVal][i]); } -/*static */void sub_8103D8C(u8 a0) +static void sub_8103D8C(u8 a0) { u8 i; for (i = 0; i < gNumberBettingTiles[a0]; i++) sub_8103D28(gBettingTilesId[a0][i]); } -/*static */void sub_8103DC8(void) +static void sub_8103DC8(void) { u8 i; for (i = 0; i < 5; i++) @@ -2519,7 +2513,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8103E04(u8 a0) +static void sub_8103E04(u8 a0) { struct Sprite *sprite = gSprites + sSlotMachine->unk44[a0]; sprite->data[1] = 1; @@ -2531,7 +2525,7 @@ Advance until there are no cherries on screen in reel 1 } // something with payout digits -/*static */bool8 sub_8103E38(void) +static bool8 sub_8103E38(void) { u8 i; for (i = 0; i < 5; i++) @@ -2543,7 +2537,7 @@ Advance until there are no cherries on screen in reel 1 return TRUE; } -/*static */bool8 sub_8103E7C(void) +static bool8 sub_8103E7C(void) { u8 i; for (i = 0; i < 5; i++) @@ -2554,7 +2548,7 @@ Advance until there are no cherries on screen in reel 1 return TRUE; } -/*static */bool8 sub_8103EAC(u8 spriteId) +static bool8 sub_8103EAC(u8 spriteId) { struct Sprite *sprite = gSprites + spriteId; if (!sprite->data[1]) @@ -2564,7 +2558,7 @@ Advance until there are no cherries on screen in reel 1 return sprite->data[7]; } -/*static */void sub_8103EE4(struct Sprite *sprite) +static void sub_8103EE4(struct Sprite *sprite) { s16 r4; if (sprite->data[1]) @@ -2593,14 +2587,14 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8103F70(void) +static void sub_8103F70(void) { u8 taskId = CreateTask(sub_8103FE8_, 6); gTasks[taskId].data[3] = 1; sub_8103FE8_(taskId); } -/*static */bool8 sub_8103FA0(void) +static bool8 sub_8103FA0(void) { u8 taskId = FindTaskIdByFunc(sub_8103FE8_); if (!gTasks[taskId].data[2]) @@ -2612,9 +2606,9 @@ Advance until there are no cherries on screen in reel 1 return FALSE; } -/*static */void sub_8103FE8_(u8 taskId) +static void sub_8103FE8_(u8 taskId) { - struct Task *task = gTasks + taskId; + struct Task *task = &gTasks[taskId]; if (!task->data[1]--) { task->data[1] = 4; @@ -2625,49 +2619,49 @@ Advance until there are no cherries on screen in reel 1 LoadPalette(gUnknown_083EDDA0[task->data[2]], 0x10, 0x20); } -/*static */void GameplayTasks_PikaPower(void) +static void GameplayTask_PikaPower(void) { sSlotMachine->unkTaskPointer3E = CreateTask(sub_81040E8, 8); } -/*static */void DisplayPikaPower(u8 pikaPower) +static void DisplayPikaPower(u8 pikaPower) { - struct Task *task = gTasks + sSlotMachine->unkTaskPointer3E; + struct Task *task = &gTasks[sSlotMachine->unkTaskPointer3E]; ClearTaskDataFields_2orHigher(task); task->data[0] = 1; task->data[1]++; task->data[15] = 1; // points to a reelIndex } -/*static */void sub_8104098(void) +static void sub_8104098(void) { - struct Task *task = gTasks + sSlotMachine->unkTaskPointer3E; + struct Task *task = &gTasks[sSlotMachine->unkTaskPointer3E]; ClearTaskDataFields_2orHigher(task); task->data[0] = 3; task->data[15] = 1; // points to a reelIndex } -/*static */bool8 sub_81040C8(void) +static bool8 sub_81040C8(void) { return gTasks[sSlotMachine->unkTaskPointer3E].data[15]; } -/*static */void sub_81040E8(u8 taskId) +static void sub_81040E8(u8 taskId) { - gUnknown_083ECBB4[gTasks[taskId].data[0]](gTasks + taskId); + gUnknown_083ECBB4[gTasks[taskId].data[0]](&gTasks[taskId]); } -/*static */void nullsub_68(struct Task *task) +static void nullsub_68(struct Task *task) { } -/*static */void sub_810411C(struct Task *task) +static void sub_810411C(struct Task *task) { task->data[2] = sub_8105B1C((task->data[1] << 3) + 20, 20); task->data[0]++; } -/*static */void sub_8104144(struct Task *task) +static void sub_8104144(struct Task *task) { if (gSprites[task->data[2]].data[7]) { @@ -2686,7 +2680,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_81041AC(struct Task *task) +static void sub_81041AC(struct Task *task) { s16 r5 = task->data[1] + 2; s16 r3 = 0; @@ -2710,7 +2704,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ClearTaskDataFields_2orHigher(struct Task *task) +static void ClearTaskDataFields_2orHigher(struct Task *task) { u8 i; @@ -2719,7 +2713,7 @@ Advance until there are no cherries on screen in reel 1 } // possibly load tiles for pika power meter -/*static */void sub_810423C(u8 pikaPower) +static void sub_810423C(u8 pikaPower) { s16 i; s16 r3 = 0, r1 = 0; @@ -2747,29 +2741,29 @@ Advance until there are no cherries on screen in reel 1 gTasks[sSlotMachine->unkTaskPointer3E].data[1] = pikaPower; } -/*static */void BeginReeltime(void) +static void BeginReeltime(void) { u8 taskId = CreateTask(RunReeltimeActions, 7); RunReeltimeActions(taskId); } -/*static */bool8 IsFinalTask_RunReelTimeActions(void) +static bool8 IsFinalTask_RunReelTimeActions(void) { if (FindTaskIdByFunc(RunReeltimeActions) == TAIL_SENTINEL) return TRUE; return FALSE; } -/*static */void RunReeltimeActions(u8 taskId) +static void RunReeltimeActions(u8 taskId) { // task.data[0] points to which ReelTimeAction to do, and starts at 0 // task.data[1] has something to do with the threshold // task.data[4] says how many pixels to advance the reel // task.data[5] is a timer - ReeltimeActions[gTasks[taskId].data[0]](gTasks + taskId); + ReeltimeActions[gTasks[taskId].data[0]](&gTasks[taskId]); } -/*static */void ReeltimeAction0(struct Task *task) +static void ReeltimeAction0(struct Task *task) { sSlotMachine->fairRollsLeft = 0; sSlotMachine->reeltimePixelOffset = 0; @@ -2793,7 +2787,7 @@ Advance until there are no cherries on screen in reel 1 PlayNewMapMusic(MUS_BD_TIME); } -/*static */void ReeltimeAction1(struct Task *task) +static void ReeltimeAction1(struct Task *task) { s16 r3; gSpriteCoordOffsetX -= 8; @@ -2814,7 +2808,7 @@ Advance until there are no cherries on screen in reel 1 AdvanceReeltimeReel(task->data[4] >> 8); } -/*static */void ReeltimeAction2(struct Task *task) +static void ReeltimeAction2(struct Task *task) { AdvanceReeltimeReel(task->data[4] >> 8); if (++task->data[5] >= 60) @@ -2825,7 +2819,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReeltimeAction3(struct Task *task) +static void ReeltimeAction3(struct Task *task) { int r5; u8 sp0[ARRAY_COUNT(gUnknown_085A75C0)]; @@ -2852,7 +2846,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReeltimeAction4(struct Task *task) +static void ReeltimeAction4(struct Task *task) { AdvanceReeltimeReel(task->data[4] >> 8); if (++task->data[5] >= 80) @@ -2864,7 +2858,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReeltimeAction5(struct Task *task) +static void ReeltimeAction5(struct Task *task) { AdvanceReeltimeReel(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x80; @@ -2875,7 +2869,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReeltimeAction6(struct Task *task) +static void ReeltimeAction6(struct Task *task) { AdvanceReeltimeReel(task->data[4] >> 8); task->data[4] = (u8)task->data[4] + 0x40; @@ -2899,7 +2893,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReelTimeAction_LandOnOutcome(struct Task *task) +static void ReelTimeAction_LandOnOutcome(struct Task *task) { s16 reeltimePixelOffset = sSlotMachine->reeltimePixelOffset % 20; if (reeltimePixelOffset) @@ -2920,7 +2914,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReeltimeAction8(struct Task *task) +static void ReeltimeAction8(struct Task *task) { if (++task->data[4] >= 60) { @@ -2949,13 +2943,13 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReeltimeAction9(struct Task *task) +static void ReeltimeAction9(struct Task *task) { if ((task->data[4] == 0 || --task->data[4] == 0) && !sub_81040C8()) task->data[0]++; } -/*static */void ReeltimeAction10(struct Task *task) +static void ReeltimeAction10(struct Task *task) { s16 r4; gSpriteCoordOffsetX -= 8; @@ -2969,7 +2963,7 @@ Advance until there are no cherries on screen in reel 1 task->data[0]++; } -/*static */void ReeltimeAction11(struct Task *task) +static void ReeltimeAction11(struct Task *task) { sSlotMachine->fairRollsUsed = 0; sSlotMachine->fairRollsLeft = sSlotMachine->reelTimeDraw; @@ -2987,14 +2981,14 @@ Advance until there are no cherries on screen in reel 1 else { sub_8104CAC(4); - task->data[1] = DrawNewReelIncrement(); + task->data[1] = SlowReelSpeed(); task->data[2] = 0; task->data[3] = 0; task->data[0]++; } } -/*static */void ReeltimeAction12(struct Task *task) +static void ReeltimeAction12(struct Task *task) { if (sSlotMachine->reelIncrement == task->data[1]) task->data[0]++; @@ -3002,13 +2996,13 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->reelIncrement >>= 1; } -/*static */void ReeltimeAction13(struct Task *task) +static void ReeltimeAction13(struct Task *task) { if (sub_8104E18()) DestroyTask(FindTaskIdByFunc(RunReeltimeActions)); } -/*static */void ReeltimeAction14(struct Task *task) +static void ReeltimeAction14(struct Task *task) { sub_81054B8(); sub_81056C0(); @@ -3024,7 +3018,7 @@ Advance until there are no cherries on screen in reel 1 PlaySE(SE_W153); } -/*static */void ReeltimeAction15(struct Task *task) +static void ReeltimeAction15(struct Task *task) { gSpriteCoordOffsetY = task->data[4]; SetGpuReg(REG_OFFSET_BG1VOFS, task->data[4]); @@ -3044,7 +3038,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReeltimeAction16(struct Task *task) +static void ReeltimeAction16(struct Task *task) { gSpriteCoordOffsetY = 0; SetGpuReg(REG_OFFSET_BG1VOFS, 0); @@ -3055,7 +3049,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void ReeltimeAction17(struct Task *task) +static void ReeltimeAction17(struct Task *task) { gSpriteCoordOffsetX = 0; SetGpuReg(REG_OFFSET_BG1HOFS, 0); @@ -3067,7 +3061,7 @@ Advance until there are no cherries on screen in reel 1 DestroyTask(FindTaskIdByFunc(RunReeltimeActions)); } -/*static */void sub_8104A40(s16 a0, s16 a1) +static void sub_8104A40(s16 a0, s16 a1) { s16 i; @@ -3077,7 +3071,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8104A88(s16 a0) +static void sub_8104A88(s16 a0) { u8 i; @@ -3087,14 +3081,14 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void OpenInfoBox(u8 seemsUnused) +static void OpenInfoBox(u8 seemsUnused) { u8 taskId = CreateTask(RunInfoBoxActions, 1); gTasks[taskId].data[1] = seemsUnused; RunInfoBoxActions(taskId); } -/*static */bool8 IsInfoBoxClosed(void) +static bool8 IsInfoBoxClosed(void) { if (FindTaskIdByFunc(RunInfoBoxActions) == 0xFF) return TRUE; @@ -3102,24 +3096,24 @@ Advance until there are no cherries on screen in reel 1 return FALSE; } -/*static */void RunInfoBoxActions(u8 taskId) +static void RunInfoBoxActions(u8 taskId) { - InfoBoxActions[gTasks[taskId].data[0]](gTasks + taskId); + InfoBoxActions[gTasks[taskId].data[0]](&gTasks[taskId]); } -/*static */void InfoBox_FadeIn(struct Task *task) +static void InfoBox_FadeIn(struct Task *task) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); task->data[0]++; } -/*static */void InfoBox_WaitForFade(struct Task *task) +static void InfoBox_WaitForFade(struct Task *task) { if (!gPaletteFade.active) task->data[0]++; } -/*static */void InfoBox_8104B80(struct Task *task) +static void InfoBox_8104B80(struct Task *task) { sub_8104DA4(); sub_81065DC(); @@ -3129,15 +3123,15 @@ Advance until there are no cherries on screen in reel 1 task->data[0]++; } -/*static */void InfoBox_AddText(struct Task *task) +static void InfoBox_AddText(struct Task *task) { - AddTextPrinterParameterized3(1, 1, 2, 5, gColors_ReelTimeHelp, 0, gText_ReelTimeHelp); + AddTextPrinterParameterized3(1, 1, 2, 5, gColors_ReeltimeHelp, 0, gText_ReelTimeHelp); CopyWindowToVram(1, 3); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); task->data[0]++; } -/*static */void InfoBox_AwaitPlayerInput(struct Task *task) +static void InfoBox_AwaitPlayerInput(struct Task *task) { if (gMain.newKeys & (B_BUTTON | SELECT_BUTTON)) { @@ -3150,52 +3144,52 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void InfoBox_812DE14(struct Task *task) +static void InfoBox_812DE14(struct Task *task) { sub_812F968(); ShowBg(3); task->data[0]++; } -/*static */void InfoBox_812DE30(struct Task *task) +static void InfoBox_812DE30(struct Task *task) { sub_8104CAC(task->data[1]); task->data[0]++; } -/*static */void InfoBox_8104BFC(struct Task *task) +static void InfoBox_8104BFC(struct Task *task) { sub_810423C(sSlotMachine->pikaPower); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); task->data[0]++; } -/*static */void InfoBox_FreeTask(struct Task *task) +static void InfoBox_FreeTask(struct Task *task) { DestroyTask(FindTaskIdByFunc(RunInfoBoxActions)); } -/*static */void sub_8104C5C(void) +static void sub_8104C5C(void) { u8 i; struct Task *task; i = CreateTask(sub_8104E74_, 3); sSlotMachine->unkTaskPointer3D = i; - task = gTasks + i; + task = &gTasks[i]; task->data[1] = -1; for (i = 4; i < 16; i++) task->data[i] = MAX_SPRITES; } // possibly initialize each wheel -/*static */void sub_8104CAC(u8 arg0) +static void sub_8104CAC(u8 arg0) { u8 i; struct Task *task; sub_8104DA4(); - task = gTasks + sSlotMachine->unkTaskPointer3D; + task = &gTasks[sSlotMachine->unkTaskPointer3D]; task->data[1] = arg0; for (i = 0; gUnknown_083ED048[arg0][i].unk00 != 0xFF; i++) @@ -3210,10 +3204,10 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8104D30(u8 a0, SpriteCallback a1, s16 a2, s16 a3, s16 a4) +static void sub_8104D30(u8 a0, SpriteCallback a1, s16 a2, s16 a3, s16 a4) { u8 i; - struct Task *task = gTasks + sSlotMachine->unkTaskPointer3D; + struct Task *task = &gTasks[sSlotMachine->unkTaskPointer3D]; for (i = 4; i < 16; i++) { if (task->data[i] == MAX_SPRITES) @@ -3224,10 +3218,10 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8104DA4(void) +static void sub_8104DA4(void) { u8 i; - struct Task *task = gTasks + sSlotMachine->unkTaskPointer3D; + struct Task *task = &gTasks[sSlotMachine->unkTaskPointer3D]; if ((u16)task->data[1] != 0xFFFF) gUnknown_083ED064[task->data[1]](); for (i = 4; i < 16; i++) @@ -3240,10 +3234,10 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */bool8 sub_8104E18(void) +static bool8 sub_8104E18(void) { u8 i; - struct Task *task = gTasks + sSlotMachine->unkTaskPointer3D; + struct Task *task = &gTasks[sSlotMachine->unkTaskPointer3D]; for (i = 4; i < 16; i++) { if (task->data[i] != MAX_SPRITES) @@ -3255,16 +3249,16 @@ Advance until there are no cherries on screen in reel 1 return TRUE; } -/*static */void sub_8104E74_(u8 taskId) +static void sub_8104E74_(u8 taskId) { - gUnknown_083ECC54[gTasks[taskId].data[0]](gTasks + taskId); + gUnknown_083ECC54[gTasks[taskId].data[0]](&gTasks[taskId]); } -/*static */void nullsub_69(struct Task *task) +static void nullsub_69(struct Task *task) { } -/*static */void sub_8104EA8(void) +static void sub_8104EA8(void) { s16 i; s16 j; @@ -3291,7 +3285,7 @@ Advance until there are no cherries on screen in reel 1 SetSpriteSheetFrameTileNum(sprite); } -/*static */void sub_8104F8C(void) +static void sub_8104F8C(void) { s16 i; s16 x; @@ -3302,7 +3296,7 @@ Advance until there are no cherries on screen in reel 1 sub_8104FF4(x, 23, 1, i); } -/*static */void sub_8104FF4(s16 x, s16 y, u8 a2, s16 a3) +static void sub_8104FF4(s16 x, s16 y, u8 a2, s16 a3) { struct Sprite *sprite = gSprites + CreateSprite(&gSpriteTemplate_83ED42C, x, y, 13); sprite->oam.priority = 2; @@ -3328,14 +3322,14 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_81050C4(void) +static void sub_81050C4(void) { u8 spriteId = CreateSprite(&gSpriteTemplate_83ED444, 0x58, 0x48, 15); gSprites[spriteId].oam.priority = 3; SetSubspriteTables(gSprites + spriteId, gSubspriteTables_83ED704); } -/*static */void sub_8105100(void) +static void sub_8105100(void) { struct SpriteTemplate spriteTemplate; u8 spriteId; @@ -3361,7 +3355,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->reelTimeSprite3F = spriteId; } -/*static */void sub_810514C(void) +static void sub_810514C(void) { DestroySprite(gSprites + sSlotMachine->reelTimeSprite3F); if (gUnknown_0203AAE4 != NULL) @@ -3379,7 +3373,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_81051C0(void) +static void sub_81051C0(void) { struct SpriteTemplate spriteTemplate; u8 spriteId; @@ -3414,7 +3408,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->unk49[1] = spriteId; } -/*static */void sub_8105284_(void) +static void sub_8105284_(void) { struct SpriteTemplate spriteTemplate; u8 spriteId; @@ -3435,7 +3429,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->unk42 = spriteId; } -/*static */void sub_81052EC(void) +static void sub_81052EC(void) { u8 i; s16 r5; @@ -3458,7 +3452,7 @@ Advance until there are no cherries on screen in reel 1 StartSpriteAnimIfDifferent(sprite, GetNearbyReelTimeTag(r0 / 20)); } -/*static */void sub_81053A0(void) +static void sub_81053A0(void) { u8 spriteId = CreateSprite(&gSpriteTemplate_83ED4D4, 0x170, 0x64, 9); struct Sprite *sprite = &gSprites[spriteId]; @@ -3475,7 +3469,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->unk4E[1] = spriteId; } -/*static */void sub_810545C(void) +static void sub_810545C(void) { u8 spriteId = CreateSprite(&gSpriteTemplate_83ED4EC, 0x170, 0x4c, 11); struct Sprite *sprite = &gSprites[spriteId]; @@ -3485,7 +3479,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->unk40 = spriteId; } -/*static */void sub_81054B8(void) +static void sub_81054B8(void) { u8 i; @@ -3502,7 +3496,7 @@ Advance until there are no cherries on screen in reel 1 DestroySprite(&gSprites[sSlotMachine->unk4B[i]]); } -/*static */void sub_8105524(void) +static void sub_8105524(void) { u8 i; @@ -3510,7 +3504,7 @@ Advance until there are no cherries on screen in reel 1 DestroySprite(&gSprites[sSlotMachine->unk4E[i]]); } -/*static */void sub_8105554(void) +static void sub_8105554(void) { DestroySprite(&gSprites[sSlotMachine->unk42]); if (gUnknown_0203AAF0 != NULL) @@ -3518,7 +3512,7 @@ Advance until there are no cherries on screen in reel 1 } // TODO: check if this is true -/*static */void CreateReelTimeSprites1(void) +static void CreateReelTimeSprites1(void) { u8 spriteId = CreateSprite(&gSpriteTemplate_83ED504, 0x98, 0x20, 5); struct Sprite *sprite = &gSprites[spriteId]; @@ -3561,13 +3555,13 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8105688(s16 a0) +static void sub_8105688(s16 a0) { gSprites[sSlotMachine->reelTimeSprites1[0]].data[7] = a0; gSprites[sSlotMachine->reelTimeSprites1[1]].data[7] = a0; } -/*static */void sub_81056C0(void) +static void sub_81056C0(void) { u8 i; @@ -3575,7 +3569,7 @@ Advance until there are no cherries on screen in reel 1 DestroySprite(&gSprites[sSlotMachine->reelTimeSprites1[i]]); } -/*static */void CreateReelTimeSprite2(void) +static void CreateReelTimeSprite2(void) { u8 spriteId = CreateSprite(&gSpriteTemplate_83ED51C, 0x48, 0x50, 3); gSprites[spriteId].oam.priority = 1; @@ -3603,12 +3597,12 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_81057E8(s16 a0) +static void sub_81057E8(s16 a0) { gSprites[sSlotMachine->reelTimeSprites2[0]].data[7] = a0; } -/*static */void sub_8105804(void) +static void sub_8105804(void) { u8 i; MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(7) << 4) + 0x103, 0, 0, 0); @@ -3616,7 +3610,7 @@ Advance until there are no cherries on screen in reel 1 DestroySprite(&gSprites[sSlotMachine->reelTimeSprites2[i]]); } -/*static */void sub_8105854(void) +static void sub_8105854(void) { u8 spriteId = CreateSprite(&gSpriteTemplate_83ED534, 0xa8, 0x50, 6); gSprites[spriteId].oam.priority = 1; @@ -3628,12 +3622,12 @@ Advance until there are no cherries on screen in reel 1 sprite->pos2.y = gSpriteCoordOffsetY; } -/*static */void sub_81058A0(void) +static void sub_81058A0(void) { DestroySprite(&gSprites[sSlotMachine->unk41]); } -/*static */void sub_81058C4(void) +static void sub_81058C4(void) { u8 i; u16 sp[] = {0x0, 0x40, 0x80, 0xC0}; @@ -3666,7 +3660,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_81059B8(void) +static void sub_81059B8(void) { u8 i; for (i = 0; i < 4; i++) @@ -3675,7 +3669,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_81059E8(void) +static void sub_81059E8(void) { u8 spriteId = CreateSprite(&gSpriteTemplate_83ED564, 0xa8, 0x3c, 8); struct Sprite *sprite = &gSprites[spriteId]; @@ -3712,19 +3706,19 @@ Advance until there are no cherries on screen in reel 1 sprite->pos2.y -= (sprite->data[1] >> 8); } -/*static */u8 sub_8105ACC(void) +static u8 sub_8105ACC(void) { return gSprites[sSlotMachine->unk43].data[7]; } -/*static */void sub_8105AEC(void) +static void sub_8105AEC(void) { struct Sprite *sprite = &gSprites[sSlotMachine->unk43]; FreeOamMatrix(sprite->oam.matrixNum); DestroySprite(sprite); } -/*static */u8 sub_8105B1C(s16 x, s16 y) +static u8 sub_8105B1C(s16 x, s16 y) { u8 spriteId = CreateSprite(&gSpriteTemplate_83ED6CC, x, y, 12); struct Sprite *sprite = &gSprites[spriteId]; @@ -3740,19 +3734,19 @@ Advance until there are no cherries on screen in reel 1 sprite->data[7] = 1; } -/*static */void sub_8105B88(u8 spriteId) +static void sub_8105B88(u8 spriteId) { struct Sprite *sprite = &gSprites[spriteId]; FreeOamMatrix(sprite->oam.matrixNum); DestroySprite(sprite); } -/*static */u8 sub_8105BB4(u8 templateIdx, u8 cbAndCoordsIdx, s16 a2) +static u8 sub_8105BB4(u8 templateIdx, u8 cbAndCoordsIdx, s16 a2) { return sub_8105BF8(templateIdx, gUnknown_083ECF0C[cbAndCoordsIdx], gUnknown_083ECE7E[cbAndCoordsIdx][0], gUnknown_083ECE7E[cbAndCoordsIdx][1], a2); } -/*static */u8 sub_8105BF8(u8 templateIdx, SpriteCallback callback, s16 x, s16 y, s16 a4) +static u8 sub_8105BF8(u8 templateIdx, SpriteCallback callback, s16 x, s16 y, s16 a4) { struct SpriteTemplate spriteTemplate; u8 spriteId; @@ -3771,12 +3765,12 @@ Advance until there are no cherries on screen in reel 1 return spriteId; } -/*static */void sub_8105C64(struct Sprite *sprite) +static void sub_8105C64(struct Sprite *sprite) { sprite->data[7] = 0; } -/*static */void sub_8105C6C(struct Sprite *sprite) +static void sub_8105C6C(struct Sprite *sprite) { s16 sp0[] = {4, -4, 4, -4}; s16 sp8[] = {4, 4, -4, -4}; @@ -3795,26 +3789,26 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8105CF0(struct Sprite *sprite) +static void sub_8105CF0(struct Sprite *sprite) { sprite->hFlip = TRUE; sub_8105C6C(sprite); } -/*static */void sub_8105D08(struct Sprite *sprite) +static void sub_8105D08(struct Sprite *sprite) { sprite->vFlip = TRUE; sub_8105C6C(sprite); } -/*static */void sub_8105D20(struct Sprite *sprite) +static void sub_8105D20(struct Sprite *sprite) { sprite->hFlip = TRUE; sprite->vFlip = TRUE; sub_8105C6C(sprite); } -/*static */void sub_8105D3C(struct Sprite *sprite) +static void sub_8105D3C(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -3841,7 +3835,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8105DA4(struct Sprite *sprite) +static void sub_8105DA4(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -3868,7 +3862,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8105E08(struct Sprite *sprite) +static void sub_8105E08(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -3906,7 +3900,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8105EB4(struct Sprite *sprite) +static void sub_8105EB4(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -3946,7 +3940,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8105F54(struct Sprite *sprite) +static void sub_8105F54(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -3966,7 +3960,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8105F9C(struct Sprite *sprite) +static void sub_8105F9C(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -4000,7 +3994,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_8106058(struct Sprite *sprite) +static void sub_8106058(struct Sprite *sprite) { if (sprite->data[1] < 3) { @@ -4024,7 +4018,7 @@ Advance until there are no cherries on screen in reel 1 sprite->data[7] = 0; } -/*static */void sub_81060FC(struct Sprite *sprite) +static void sub_81060FC(struct Sprite *sprite) { s16 sp00[] = {0, -40, 0, 0, 48, 0, 24, 0}; s16 sp10[] = {-32, 0, -32, -48, 0, -48, 0, -48}; @@ -4059,7 +4053,7 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void sub_81061C8(struct Sprite *sprite) +static void sub_81061C8(struct Sprite *sprite) { s16 sp0[] = {160, 192, 224, 104, 80, 64, 48, 24}; @@ -4074,7 +4068,7 @@ Advance until there are no cherries on screen in reel 1 sprite->data[1]--; } -/*static */void sub_8106230(struct Sprite *sprite) +static void sub_8106230(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -4128,21 +4122,21 @@ Advance until there are no cherries on screen in reel 1 } } -/*static */void nullsub_70(void) +static void nullsub_70(void) { } -/*static */void sub_8106364(void) +static void sub_8106364(void) { SetGpuReg(REG_OFFSET_MOSAIC, 0); } -/*static */void sub_8106370(void) +static void sub_8106370(void) { LoadPalette(gUnknown_083EDE20, (IndexOfSpritePaletteTag(6) << 4) + 0x100, 0x20); } -/*static */void sub_810639C(void) +static void sub_810639C(void) { sSlotMachine->win0h = 0xf0; sSlotMachine->win0v = 0xa0; @@ -4150,7 +4144,7 @@ Advance until there are no cherries on screen in reel 1 sSlotMachine->winOut = 0x3f; } -/*static */void sub_81063C0(void) +static void sub_81063C0(void) { u8 i; @@ -4174,7 +4168,7 @@ Advance until there are no cherries on screen in reel 1 LoadSpritePalettes(gSlotMachineSpritePalettes); } -/*static */void sub_8106404(void) +static void sub_8106404(void) { u8 *dest; u8 i, j; @@ -4198,7 +4192,7 @@ extern const u16 gSlotMachineMenu_Tilemap[]; extern const u16 gUnknown_08DCEC70[]; extern const u16 gSlotMachineMenu_Pal[]; -/*static */void sub_8106448(void) +static void sub_8106448(void) { gUnknown_0203AAC8 = Alloc(0x2200); LZDecompressWram(gSlotMachineMenu_Gfx, gUnknown_0203AAC8); @@ -4207,18 +4201,18 @@ extern const u16 gSlotMachineMenu_Pal[]; LoadPalette(gPalette_83EDE24, 208, 32); } -/*static */void sub_81064B8(void) +static void sub_81064B8(void) { sub_812F968(); LoadSlotMachineWheelOverlay(); } -/*static */void sub_812F968(void) +static void sub_812F968(void) { LoadBgTilemap(2, gSlotMachineMenu_Tilemap, 0x500, 0); } -/*static */void LoadSlotMachineWheelOverlay(void) +static void LoadSlotMachineWheelOverlay(void) { s16 x, y, dx; @@ -4240,7 +4234,7 @@ extern const u16 gSlotMachineMenu_Pal[]; } } -/*static */void sub_81065A8(s16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4) +static void sub_81065A8(s16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4) { gUnknown_0203AADC[0] = arg1; gUnknown_0203AADC[1] = arg2; @@ -4253,13 +4247,13 @@ extern const u16 gSlotMachineMenu_Pal[]; LoadBgTilemap(2, gUnknown_0203AADC + 3, 2, 16 * 32 + 1 + arg0); } -/*static */void sub_81065DC(void) +static void sub_81065DC(void) { LoadBgTilemap(2, gUnknown_08DCEC70, 0x500, 0); HideBg(3); } -/*static */void SlotMachineSetup_9_0(void) +static void SlotMachineSetup_9_0(void) { gUnknown_03001188[0] = gUnknown_0203AAF4; gUnknown_03001188[1] = gUnknown_0203AAF8; @@ -4289,7 +4283,7 @@ extern const u16 gSlotMachineMenu_Pal[]; gUnknown_03001188[25] = NULL; } -/*static */void SlotMachineSetup_8_0(void) +static void SlotMachineSetup_8_0(void) { gUnknown_0203AAF4 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); gUnknown_0203AAF4[0].data = gUnknown_0203AAD4; @@ -4503,7 +4497,7 @@ const u16 ReelTimeBonusIncrementTable[] = { }; // tentative name -const u8 LuckyTags[] = { +const u8 BiasTags[] = { SLOT_MACHINE_TAG_REPLAY, SLOT_MACHINE_TAG_CHERRY, SLOT_MACHINE_TAG_LOTAD, SLOT_MACHINE_TAG_AZURILL, SLOT_MACHINE_TAG_POWER, SLOT_MACHINE_TAG_7_RED, SLOT_MACHINE_TAG_7_RED, SLOT_MACHINE_TAG_7_RED }; @@ -4512,7 +4506,7 @@ const u16 LuckyFlagSettings_Top3[] = { }; const u16 LuckyFlagSettings_NotTop3[] = { - LUCKY_BIAS_POWER, LUCKY_BIAS_AZURRILL, LUCKY_BIAS_LOTAD, LUCKY_BIAS_CHERRY, LUCKY_BIAS_REPLAY + LUCKY_BIAS_POWER, LUCKY_BIAS_AZURILL, LUCKY_BIAS_LOTAD, LUCKY_BIAS_CHERRY, LUCKY_BIAS_REPLAY }; const u8 sSym2Match[] = { diff --git a/src/tv.c b/src/tv.c index 27f779c2d..4b8ff8664 100644 --- a/src/tv.c +++ b/src/tv.c @@ -62,7 +62,7 @@ IWRAM_DATA s8 sTVShowMixingCurSlot; EWRAM_DATA u16 sPokemonAnglerSpecies = 0; EWRAM_DATA u16 sPokemonAnglerAttemptCounters = 0; EWRAM_DATA u16 sFindThatGamerCoinsSpent = 0; -EWRAM_DATA bool8 sFindThatGamerWhichGame = SLOT_MACHINE; +EWRAM_DATA u8 sFindThatGamerWhichGame = SLOT_MACHINE; EWRAM_DATA ALIGNED(4) u8 sRecordMixingPartnersWithoutShowsToShare = 0; EWRAM_DATA ALIGNED(4) u8 sTVShowState = 0; EWRAM_DATA u8 sTVSecretBaseSecretsRandomValues[3] = {}; @@ -2019,7 +2019,7 @@ void sub_80EDCE8(void) } } -void reportNewCoinTotal(u16 nCoinsPaidOut) +void AlertTVOfNewCointTotal(u16 nCoinsPaidOut) { TVShow *show; bool8 flag; @@ -2072,13 +2072,13 @@ void reportNewCoinTotal(u16 nCoinsPaidOut) } } -void AlertTVThatYouPlayedSlotMachine(u16 nCoinsSpent) +void AlertTVThatPlayerPlayedSlotMachine(u16 nCoinsSpent) { sFindThatGamerWhichGame = SLOT_MACHINE; sFindThatGamerCoinsSpent = nCoinsSpent; } -void AlertTVThatYouPlayedRoulette(u16 nCoinsSpent) +void AlertTVThatPlayerPlayedRoulette(u16 nCoinsSpent) { sFindThatGamerWhichGame = ROULETTE; sFindThatGamerCoinsSpent = nCoinsSpent; From 1dc0d346d949f858e2aae602ebf60eb81bf6b7d7 Mon Sep 17 00:00:00 2001 From: hondew Date: Fri, 22 Feb 2019 16:12:37 -0500 Subject: [PATCH 09/14] fix spelling error --- include/tv.h | 2 +- src/roulette.c | 2 +- src/slot_machine.c | 2 +- src/tv.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/tv.h b/include/tv.h index ec01717e2..ec7ac1e89 100644 --- a/include/tv.h +++ b/include/tv.h @@ -28,7 +28,7 @@ size_t CountDigits(int value); u8 GetRibbonCount(struct Pokemon *pokemon); void AlertTVThatPlayerPlayedSlotMachine(u16 nCoinsSpent); void AlertTVThatPlayerPlayedRoulette(u16 nCoinsSpent); -void AlertTVOfNewCointTotal(u16 nCoinsPaidOut); +void AlertTVOfNewCoinTotal(u16 nCoinsPaidOut); void sub_80EEA70(void); void sub_80EDB44(void); void sub_80EDC60(const u16 *words); diff --git a/src/roulette.c b/src/roulette.c index 93678fa1c..4c20bd0fe 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -1964,7 +1964,7 @@ static void sub_8141DE4(u8 taskId) gSpecialVar_0x8004 = TRUE; else gSpecialVar_0x8004 = FALSE; - AlertTVOfNewCointTotal(GetCoins()); + AlertTVOfNewCoinTotal(GetCoins()); BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0); gTasks[taskId].func = sub_8141E7C; } diff --git a/src/slot_machine.c b/src/slot_machine.c index 9c07a96f2..9b345af1e 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -1343,7 +1343,7 @@ static bool8 SlotAction_ExitMessage_NoMoreCoins(struct Task *task) static bool8 SlotAction_EndGame(struct Task *task) { SetCoins(sSlotMachine->coins); - AlertTVOfNewCointTotal(GetCoins()); + AlertTVOfNewCoinTotal(GetCoins()); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); sSlotMachine->state++; return FALSE; diff --git a/src/tv.c b/src/tv.c index 4b8ff8664..ee3614e83 100644 --- a/src/tv.c +++ b/src/tv.c @@ -2019,7 +2019,7 @@ void sub_80EDCE8(void) } } -void AlertTVOfNewCointTotal(u16 nCoinsPaidOut) +void AlertTVOfNewCoinTotal(u16 nCoinsPaidOut) { TVShow *show; bool8 flag; From 6a4202cdbd139a4c81609748fd2df522eff93e56 Mon Sep 17 00:00:00 2001 From: hondew Date: Fri, 22 Feb 2019 16:27:49 -0500 Subject: [PATCH 10/14] tidied lucky flags --- include/slot_machine.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/slot_machine.h b/include/slot_machine.h index bd0af49af..84622d914 100644 --- a/include/slot_machine.h +++ b/include/slot_machine.h @@ -6,14 +6,14 @@ #define REEL_TAG_HEIGHT 24 // Lucky Flags -#define LUCKY_BIAS_REPLAY 0x0001 -#define LUCKY_BIAS_CHERRY 0x0002 -#define LUCKY_BIAS_LOTAD 0x0004 -#define LUCKY_BIAS_AZURILL 0x0008 -#define LUCKY_BIAS_POWER 0x0010 -#define LUCKY_BIAS_REELTIME 0x0020 -#define LUCKY_BIAS_MIXED_777 0x0040 -#define LUCKY_BIAS_777 0x0080 +#define LUCKY_BIAS_REPLAY (1 << 0) +#define LUCKY_BIAS_CHERRY (1 << 1) +#define LUCKY_BIAS_LOTAD (1 << 2) +#define LUCKY_BIAS_AZURILL (1 << 3) +#define LUCKY_BIAS_POWER (1 << 4) +#define LUCKY_BIAS_REELTIME (1 << 5) +#define LUCKY_BIAS_MIXED_777 (1 << 6) +#define LUCKY_BIAS_777 (1 << 7) // Rows #define SLOT_TOP_ROW 0x0001 From 53d7e21332c24b253eea090cf9ba58968b56af8c Mon Sep 17 00:00:00 2001 From: hondew Date: Thu, 28 Feb 2019 18:56:07 -0500 Subject: [PATCH 11/14] fix formatting in slot_machine.c --- src/slot_machine.c | 619 +++++++++++++++++++++++---------------------- 1 file changed, 310 insertions(+), 309 deletions(-) diff --git a/src/slot_machine.c b/src/slot_machine.c index 9b345af1e..fb1c88097 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -117,7 +117,7 @@ struct UnkStruct1 static void CB2_SlotMachineSetup(void); static void CB2_SlotMachineLoop(void); -static void PlaySlotMachine_Internal(u8 slotMachineIndex, MainCallback CB2_ReturnToFieldContinueScriptPlayMapMusic); +static void PlaySlotMachine_Internal(u8 slotMachineIndex, MainCallback cb); static void SlotMachineDummyTask(u8 taskId); static void SlotMachineSetup_0_0(void); static void SlotMachineSetup_6_2(void); @@ -169,9 +169,9 @@ static bool8 SlotAction_FreeDataStructures(struct Task *task); static void DrawLuckyFlags(void); static void SetLuckySpins(void); static bool8 IsThisRoundLucky(void); -static u8 AttemptsAtLuckyflags_Top3(void); +static u8 AttemptsAtLuckyFlags_Top3(void); static u16 SlowReelSpeed(void); -static u8 AttemptsAtLuckyflags_NotTop3(void); +static u8 AttemptsAtLuckyFlags_NotTop3(void); static void CheckMatch(void); static void CheckMatch_CenterRow(void); static void CheckMatch_TopAndBottom(void); @@ -320,33 +320,33 @@ static void LoadSlotMachineWheelOverlay(void); static u8 sub_8105BB4(u8 templateIdx, u8 cbAndCoordsIdx, s16 a2); // Ewram variables -static EWRAM_DATA u16 *gUnknown_0203AAC8 = NULL; -static EWRAM_DATA u16 *selectedPikaPowerTile = NULL; -static EWRAM_DATA u16 *gUnknown_0203AAD0 = NULL; -static EWRAM_DATA u8 *gUnknown_0203AAD4 = NULL; -static EWRAM_DATA u8 *gUnknown_0203AAD8 = NULL; -static EWRAM_DATA u16 *gUnknown_0203AADC = NULL; -static EWRAM_DATA u8 *gUnknown_0203AAE0 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AAE4 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AAE8 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AAEC = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AAF0 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AAF4 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AAF8 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AAFC = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB00 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB04 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB08 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB0C = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB10 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB14 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB18 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB1C = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB20 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB24 = NULL; -static EWRAM_DATA struct SpriteFrameImage *gUnknown_0203AB28 = NULL; -static EWRAM_DATA struct SpriteSheet *gUnknown_0203AB2C = NULL; -static EWRAM_DATA struct SpriteSheet *gUnknown_0203AB30 = NULL; +static EWRAM_DATA u16 *sUnknown_0203AAC8 = NULL; +static EWRAM_DATA u16 *sSelectedPikaPowerTile = NULL; +static EWRAM_DATA u16 *sUnknown_0203AAD0 = NULL; +static EWRAM_DATA u8 *sUnknown_0203AAD4 = NULL; +static EWRAM_DATA u8 *sUnknown_0203AAD8 = NULL; +static EWRAM_DATA u16 *sUnknown_0203AADC = NULL; +static EWRAM_DATA u8 *sUnknown_0203AAE0 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AAE4 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AAE8 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AAEC = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AAF0 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AAF4 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AAF8 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AAFC = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB00 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB04 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB08 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB0C = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB10 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB14 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB18 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB1C = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB20 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB24 = NULL; +static EWRAM_DATA struct SpriteFrameImage *sUnknown_0203AB28 = NULL; +static EWRAM_DATA struct SpriteSheet *sUnknown_0203AB2C = NULL; +static EWRAM_DATA struct SpriteSheet *sUnknown_0203AB30 = NULL; static EWRAM_DATA struct SlotMachineEwramStruct *sSlotMachine = NULL; // IWRAM bss @@ -355,10 +355,10 @@ static IWRAM_DATA struct SpriteFrameImage *gUnknown_03001188[26]; // Const rom data. extern const struct UnkStruct1 *const gUnknown_083ED048[]; extern const u16 gPalette_83EDE24[]; -extern const u8 LuckyRoundTable[][3]; -extern const u8 BiasTags[]; -extern const u16 LuckyFlagSettings_Top3[]; -extern const u16 LuckyFlagSettings_NotTop3[]; +extern const u8 gLuckyRoundProbabilities[][3]; +extern const u8 gBiasTags[]; +extern const u16 gLuckyFlagSettings_Top3[]; +extern const u16 gLuckyFlagSettings_NotTop3[]; extern const s16 gUnknown_083ECE7E[][2]; extern const SpriteCallback gUnknown_083ECF0C[]; extern const struct SpriteTemplate *const gUnknown_083EDB5C[]; @@ -369,28 +369,28 @@ extern const struct SpriteTemplate gSpriteTemplate_83ED54C; extern const struct SpriteTemplate gSpriteTemplate_83ED534; extern const u8 gUnknown_083ECC58[2]; extern const struct SpriteTemplate gSpriteTemplate_83ED51C; -extern const u16 ProbabilityTable_SkipToReeltimeAction14[]; +extern const u16 gProbabilityTable_SkipToReeltimeAction14[]; extern const u16 *const gUnknown_083EDE10[]; -extern const u16 ReelIncrementTable[][2]; -extern const u16 ReelTimeBonusIncrementTable[]; -extern const u16 sSlotMatchFlags[]; -extern const u16 sSlotPayouts[]; +extern const u16 gReelIncrementTable[][2]; +extern const u16 gReelTimeBonusIncrementTable[]; +extern const u16 gSlotMatchFlags[]; +extern const u16 gSlotPayouts[]; extern const u8 *const gUnknown_083EDCE4; extern const u8 *const gUnknown_083EDCDC; -extern const u32 sReelTimeGfx[]; -extern const struct SpriteSheet sSlotMachineSpriteSheets[]; +extern const u32 gReelTimeGfx[]; +extern const struct SpriteSheet gSlotMachineSpriteSheets[]; extern const struct SpritePalette gSlotMachineSpritePalettes[]; extern const u16 *const gUnknown_083EDE20; -extern const s16 sInitialReelPositions[][2]; +extern const s16 gInitialReelPositions[][2]; extern const struct BgTemplate gUnknown_085A7424[4]; extern const struct WindowTemplate gUnknown_085A7434[]; -extern const u8 LuckyFlagsTable_Top3[][6]; -extern const u8 LuckyFlagsTable_NotTop3[][6]; -extern const u8 ReelTimeProbabilityTable_UnluckyGame[][17]; -extern const u8 ReelTimeProbabilityTable_LuckyGame[][17]; -extern const u8 sSym2Match[]; -extern const u8 ReelTimeTags[]; -extern const u8 sReelSymbols[][REEL_NUM_TAGS]; +extern const u8 gLuckyFlagProbabilities_Top3[][6]; +extern const u8 gLuckyFlagProbabilities_NotTop3[][6]; +extern const u8 gReeltimeProbabilities_UnluckyGame[][17]; +extern const u8 gReelTimeProbabilities_LuckyGame[][17]; +extern const u8 gSym2Match[]; +extern const u8 gReelTimeTags[]; +extern const u8 gReelSymbols[][REEL_NUM_TAGS]; extern const u16 *const gUnknown_083EDD08[]; extern const u16 *const gUnknown_083EDD1C[]; extern const u8 gUnknown_083EDD30[]; @@ -398,7 +398,7 @@ extern const u8 gBettingTilesId[][2]; extern const u8 gNumberBettingTiles[]; extern const u16 *const gUnknown_083EDDA0[]; extern const u16 *const gUnknown_083EDDAC; -extern const u16 sReelTimeWindowTilemap[]; +extern const u16 gReelTimeWindowTilemap[]; extern const u16 gUnknown_085A9898[]; extern void (*const gUnknown_083ED064[])(void); @@ -858,7 +858,7 @@ static void SlotMachineSetup_0_1(void) for (i = 0; i < NUM_REELS; i++) { sSlotMachine->reelPixelOffsetsWhileStopping[i] = 0; - sSlotMachine->reelTagOffsets[i] = sInitialReelPositions[i][sSlotMachine->luckyGame] % REEL_NUM_TAGS; + sSlotMachine->reelTagOffsets[i] = gInitialReelPositions[i][sSlotMachine->luckyGame] % REEL_NUM_TAGS; sSlotMachine->reelPixelOffsets[i] = REEL_NUM_TAGS * REEL_TAG_HEIGHT - sSlotMachine->reelTagOffsets[i] * REEL_TAG_HEIGHT; sSlotMachine->reelPixelOffsets[i] %= REEL_NUM_TAGS * REEL_TAG_HEIGHT; } @@ -876,18 +876,18 @@ static void SlotMachineSetup_3_0(void) static void SlotMachineSetup_4_0(void) { - selectedPikaPowerTile = Alloc(8); - gUnknown_0203AAD0 = AllocZeroed(0xE); - gUnknown_0203AADC = AllocZeroed(8); + sSelectedPikaPowerTile = Alloc(8); + sUnknown_0203AAD0 = AllocZeroed(0xE); + sUnknown_0203AADC = AllocZeroed(8); // several of these are 1 bit off from each other - gUnknown_0203AAD0[0] = 0x2051; - gUnknown_0203AAD0[1] = 0x2851; - gUnknown_0203AAD0[2] = 0x2061; - gUnknown_0203AAD0[3] = 0x2861; - gUnknown_0203AAD0[4] = 0x20BE; - gUnknown_0203AAD0[5] = 0x28BE; - gUnknown_0203AAD0[6] = 0x20BF; + sUnknown_0203AAD0[0] = 0x2051; + sUnknown_0203AAD0[1] = 0x2851; + sUnknown_0203AAD0[2] = 0x2061; + sUnknown_0203AAD0[3] = 0x2861; + sUnknown_0203AAD0[4] = 0x20BE; + sUnknown_0203AAD0[5] = 0x28BE; + sUnknown_0203AAD0[6] = 0x20BF; } static void SlotMachineSetup_5_0(void) @@ -1170,10 +1170,10 @@ static bool8 SlotAction_CheckMatches(struct Task *task) { sSlotMachine->fairRollsLeft = 0; sSlotMachine->fairRollsUsed = 0; - sSlotMachine->luckyGame = 0; + sSlotMachine->luckyGame = FALSE; if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_777_BLUE)) // this may be an error, but if you get blue 777, the game becomes lucky - sSlotMachine->luckyGame = 1; + sSlotMachine->luckyGame = TRUE; } } if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_POWER) && sSlotMachine->pikaPower < 16) @@ -1354,37 +1354,37 @@ static bool8 SlotAction_FreeDataStructures(struct Task *task) if (!gPaletteFade.active) { SetMainCallback2(sSlotMachine->prevMainCb); - FREE_AND_SET_NULL(gUnknown_0203AAF4); - FREE_AND_SET_NULL(gUnknown_0203AAF8); - FREE_AND_SET_NULL(gUnknown_0203AAFC); - FREE_AND_SET_NULL(gUnknown_0203AB00); - FREE_AND_SET_NULL(gUnknown_0203AB04); - FREE_AND_SET_NULL(gUnknown_0203AB08); - FREE_AND_SET_NULL(gUnknown_0203AB0C); - FREE_AND_SET_NULL(gUnknown_0203AB10); - FREE_AND_SET_NULL(gUnknown_0203AB14); - FREE_AND_SET_NULL(gUnknown_0203AB18); - FREE_AND_SET_NULL(gUnknown_0203AB1C); - FREE_AND_SET_NULL(gUnknown_0203AB20); - FREE_AND_SET_NULL(gUnknown_0203AB24); - FREE_AND_SET_NULL(gUnknown_0203AB28); - if (gUnknown_0203AAE4 != NULL) - FREE_AND_SET_NULL(gUnknown_0203AAE4); - if (gUnknown_0203AAE8 != NULL) - FREE_AND_SET_NULL(gUnknown_0203AAE8); - if (gUnknown_0203AAEC != NULL) - FREE_AND_SET_NULL(gUnknown_0203AAEC); - if (gUnknown_0203AAF0 != NULL) - FREE_AND_SET_NULL(gUnknown_0203AAF0); - FREE_AND_SET_NULL(gUnknown_0203AAC8); - FREE_AND_SET_NULL(selectedPikaPowerTile); - FREE_AND_SET_NULL(gUnknown_0203AAD0); - FREE_AND_SET_NULL(gUnknown_0203AAD4); - FREE_AND_SET_NULL(gUnknown_0203AAD8); - FREE_AND_SET_NULL(gUnknown_0203AADC); - FREE_AND_SET_NULL(gUnknown_0203AAE0); - FREE_AND_SET_NULL(gUnknown_0203AB2C); - FREE_AND_SET_NULL(gUnknown_0203AB30); + FREE_AND_SET_NULL(sUnknown_0203AAF4); + FREE_AND_SET_NULL(sUnknown_0203AAF8); + FREE_AND_SET_NULL(sUnknown_0203AAFC); + FREE_AND_SET_NULL(sUnknown_0203AB00); + FREE_AND_SET_NULL(sUnknown_0203AB04); + FREE_AND_SET_NULL(sUnknown_0203AB08); + FREE_AND_SET_NULL(sUnknown_0203AB0C); + FREE_AND_SET_NULL(sUnknown_0203AB10); + FREE_AND_SET_NULL(sUnknown_0203AB14); + FREE_AND_SET_NULL(sUnknown_0203AB18); + FREE_AND_SET_NULL(sUnknown_0203AB1C); + FREE_AND_SET_NULL(sUnknown_0203AB20); + FREE_AND_SET_NULL(sUnknown_0203AB24); + FREE_AND_SET_NULL(sUnknown_0203AB28); + if (sUnknown_0203AAE4 != NULL) + FREE_AND_SET_NULL(sUnknown_0203AAE4); + if (sUnknown_0203AAE8 != NULL) + FREE_AND_SET_NULL(sUnknown_0203AAE8); + if (sUnknown_0203AAEC != NULL) + FREE_AND_SET_NULL(sUnknown_0203AAEC); + if (sUnknown_0203AAF0 != NULL) + FREE_AND_SET_NULL(sUnknown_0203AAF0); + FREE_AND_SET_NULL(sUnknown_0203AAC8); + FREE_AND_SET_NULL(sSelectedPikaPowerTile); + FREE_AND_SET_NULL(sUnknown_0203AAD0); + FREE_AND_SET_NULL(sUnknown_0203AAD4); + FREE_AND_SET_NULL(sUnknown_0203AAD8); + FREE_AND_SET_NULL(sUnknown_0203AADC); + FREE_AND_SET_NULL(sUnknown_0203AAE0); + FREE_AND_SET_NULL(sUnknown_0203AB2C); + FREE_AND_SET_NULL(sUnknown_0203AB30); FREE_AND_SET_NULL(sSlotMachine); } @@ -1401,22 +1401,22 @@ static void DrawLuckyFlags(void) { if (IsThisRoundLucky()) { - attempts = AttemptsAtLuckyflags_Top3(); + attempts = AttemptsAtLuckyFlags_Top3(); if (attempts != 3) // if you found a lucky number { // attempts == 1: reelTime flag set - sSlotMachine->luckyFlags |= LuckyFlagSettings_Top3[attempts]; + sSlotMachine->luckyFlags |= gLuckyFlagSettings_Top3[attempts]; if (attempts != 1) { return; } } } - // if you got it your first try, you get to try again for the lower lucky flags - attempts = AttemptsAtLuckyflags_NotTop3(); + // if it's not a lucky round or you got reel time, roll for the lower lucky flags + attempts = AttemptsAtLuckyFlags_NotTop3(); if (attempts != 5) // if you found a lucky number { - sSlotMachine->luckyFlags |= LuckyFlagSettings_NotTop3[attempts]; + sSlotMachine->luckyFlags |= gLuckyFlagSettings_NotTop3[attempts]; } } } @@ -1436,51 +1436,52 @@ static u8 GetBiasTag(u8 luckyFlags) for (i = 0; i < 8; i++) { if (luckyFlags & 1) - return BiasTags[i]; + return gBiasTags[i]; luckyFlags >>= 1; } return 0; } +// you have way more luck betting 3 coins than anything lower static bool8 IsThisRoundLucky(void) { u8 rval = Random(); - if (LuckyRoundTable[sSlotMachine->machineId][sSlotMachine->bet - 1] > rval) + if (gLuckyRoundProbabilities[sSlotMachine->machineId][sSlotMachine->bet - 1] > rval) return TRUE; return FALSE; } -static u8 AttemptsAtLuckyflags_Top3(void) +static u8 AttemptsAtLuckyFlags_Top3(void) { s16 count; for (count = 0; count < 3; count++) { s16 rval = Random() & 0xff; - s16 value = LuckyFlagsTable_Top3[count][sSlotMachine->machineId]; + s16 value = gLuckyFlagProbabilities_Top3[count][sSlotMachine->machineId]; if (value > rval) break; } return count; } -static u8 AttemptsAtLuckyflags_NotTop3(void) +static u8 AttemptsAtLuckyFlags_NotTop3(void) { s16 count; for (count = 0; count < 5; count++) { s16 rval = Random() & 0xff; // random byte - s16 value = LuckyFlagsTable_NotTop3[count][sSlotMachine->machineId]; + s16 value = gLuckyFlagProbabilities_NotTop3[count][sSlotMachine->machineId]; // make first attempt easier if it's a lucky game - if (count == 0 && sSlotMachine->luckyGame == 1) + if (count == 0 && sSlotMachine->luckyGame == TRUE) { value += 10; if (value > 0x100) value = 0x100; } // make last attempt harder if it's a lucky game - else if (count == 4 && sSlotMachine->luckyGame == 1) + else if (count == 4 && sSlotMachine->luckyGame == TRUE) { value -= 10; if (value < 0) @@ -1494,10 +1495,10 @@ static u8 AttemptsAtLuckyflags_NotTop3(void) static u8 GetReelTimeProbability(u8 reelTimeDraw) { - if (sSlotMachine->luckyGame == 0) - return ReelTimeProbabilityTable_UnluckyGame[reelTimeDraw][sSlotMachine->pikaPower]; + if (sSlotMachine->luckyGame == FALSE) + return gReeltimeProbabilities_UnluckyGame[reelTimeDraw][sSlotMachine->pikaPower]; else - return ReelTimeProbabilityTable_LuckyGame[reelTimeDraw][sSlotMachine->pikaPower]; + return gReelTimeProbabilities_LuckyGame[reelTimeDraw][sSlotMachine->pikaPower]; } static void GetReeltimeDraw(void) @@ -1521,7 +1522,7 @@ static void GetReeltimeDraw(void) static bool8 SkipToReeltimeAction14(u16 i) { u16 rval = Random() & 0xff; - if (rval < ProbabilityTable_SkipToReeltimeAction14[i]) + if (rval < gProbabilityTable_SkipToReeltimeAction14[i]) return TRUE; else return FALSE; @@ -1541,11 +1542,11 @@ static u16 SlowReelSpeed(void) else if (sSlotMachine->netCoinLoss >= 150) i = 1; rval = Random() % 100; - value = ReelIncrementTable[i][0]; + value = gReelIncrementTable[i][0]; if (rval < value) return 4; rval = Random() % 100; - value = ReelIncrementTable[i][1] + ReelTimeBonusIncrementTable[sSlotMachine->fairRollsUsed]; + value = gReelIncrementTable[i][1] + gReelTimeBonusIncrementTable[sSlotMachine->fairRollsUsed]; if (rval < value) return 2; return 8; @@ -1571,8 +1572,8 @@ static void CheckMatch_CenterRow(void) match = GetMatchFromSymbolsInRow(c1, c2, c3); if (match != SLOT_MACHINE_MATCHED_NONE) { - sSlotMachine->payout += sSlotPayouts[match]; - sSlotMachine->matchedSymbols |= sSlotMatchFlags[match]; + sSlotMachine->payout += gSlotPayouts[match]; + sSlotMachine->matchedSymbols |= gSlotMatchFlags[match]; sub_8103E04(0); } } @@ -1589,8 +1590,8 @@ static void CheckMatch_TopAndBottom(void) { if (match == SLOT_MACHINE_MATCHED_1CHERRY) match = SLOT_MACHINE_MATCHED_2CHERRY; - sSlotMachine->payout += sSlotPayouts[match]; - sSlotMachine->matchedSymbols |= sSlotMatchFlags[match]; + sSlotMachine->payout += gSlotPayouts[match]; + sSlotMachine->matchedSymbols |= gSlotMatchFlags[match]; sub_8103E04(1); } c1 = GetNearbyTag_Quantized(0, 3); @@ -1601,8 +1602,8 @@ static void CheckMatch_TopAndBottom(void) { if (match == SLOT_MACHINE_MATCHED_1CHERRY) match = SLOT_MACHINE_MATCHED_2CHERRY; - sSlotMachine->payout += sSlotPayouts[match]; - sSlotMachine->matchedSymbols |= sSlotMatchFlags[match]; + sSlotMachine->payout += gSlotPayouts[match]; + sSlotMachine->matchedSymbols |= gSlotMatchFlags[match]; sub_8103E04(2); } } @@ -1619,8 +1620,8 @@ static void CheckMatch_Diagonals(void) { if (match != SLOT_MACHINE_MATCHED_1CHERRY) { - sSlotMachine->payout += sSlotPayouts[match]; - sSlotMachine->matchedSymbols |= sSlotMatchFlags[match]; + sSlotMachine->payout += gSlotPayouts[match]; + sSlotMachine->matchedSymbols |= gSlotMatchFlags[match]; } sub_8103E04(3); } @@ -1632,8 +1633,8 @@ static void CheckMatch_Diagonals(void) { if (match != SLOT_MACHINE_MATCHED_1CHERRY) { - sSlotMachine->payout += sSlotPayouts[match]; - sSlotMachine->matchedSymbols |= sSlotMatchFlags[match]; + sSlotMachine->payout += gSlotPayouts[match]; + sSlotMachine->matchedSymbols |= gSlotMatchFlags[match]; } sub_8103E04(4); } @@ -1642,7 +1643,7 @@ static void CheckMatch_Diagonals(void) static u8 GetMatchFromSymbolsInRow(u8 c1, u8 c2, u8 c3) { if (c1 == c2 && c1 == c3) - return sSym2Match[c1]; + return gSym2Match[c1]; if (c1 == SLOT_MACHINE_TAG_7_RED && c2 == SLOT_MACHINE_TAG_7_RED && c3 == SLOT_MACHINE_TAG_7_BLUE) return SLOT_MACHINE_MATCHED_777_MIXED; if (c1 == SLOT_MACHINE_TAG_7_BLUE && c2 == SLOT_MACHINE_TAG_7_BLUE && c3 == SLOT_MACHINE_TAG_7_RED) @@ -1725,7 +1726,7 @@ static u8 GetNearbyTag_Quantized(u8 reelIndex, s16 posOffset) s16 tagIndex = (sSlotMachine->reelTagOffsets[reelIndex] + posOffset) % REEL_NUM_TAGS; if (tagIndex < 0) tagIndex += REEL_NUM_TAGS; - return sReelSymbols[reelIndex][tagIndex]; + return gReelSymbols[reelIndex][tagIndex]; } @@ -1744,7 +1745,7 @@ static u8 GetNearbyReelTimeTag(s16 n) s16 newPosition = (sSlotMachine->reeltimePosition + n) % 6; if (newPosition < 0) newPosition += 6; - return ReelTimeTags[newPosition]; + return gReelTimeTags[newPosition]; } static void AdvanceSlotReel(u8 reelIndex, s16 value) @@ -1838,7 +1839,7 @@ static bool8 SlotReelAction_Spin(struct Task *task) static bool8 SlotReelAction_DecideWhereToStop(struct Task *task) { task->data[0]++; - // initialize data for that reel --> these will be changed if biasTags can be lined up + // initialize data for that reel --> these will be changed if gBiasTags can be lined up sSlotMachine->winnerRows[task->data[15]] = 0; sSlotMachine->reelExtraTurns[task->data[15]] = 0; @@ -2672,8 +2673,8 @@ static void sub_8104144(struct Task *task) r3 = 1, r2 = 1; else if (task->data[1] == 16) r3 = 2, r2 = 2; - selectedPikaPowerTile[r2] = pikaPowerTileTable[r3][0]; - LoadBgTilemap(2, &selectedPikaPowerTile[r2], 2, r5 + 0x40); + sSelectedPikaPowerTile[r2] = pikaPowerTileTable[r3][0]; + LoadBgTilemap(2, &sSelectedPikaPowerTile[r2], 2, r5 + 0x40); sub_8105B88(task->data[2]); task->data[0] = 0; task->data[15] = 0; // points to a reelIndex @@ -2691,8 +2692,8 @@ static void sub_81041AC(struct Task *task) r3 = 2, r2 = 2; if (task->data[2] == 0) { - selectedPikaPowerTile[r2] = pikaPowerTileTable[r3][1]; - LoadBgTilemap(2, &selectedPikaPowerTile[r2], 2, r5 + 0x40); + sSelectedPikaPowerTile[r2] = pikaPowerTileTable[r3][1]; + LoadBgTilemap(2, &sSelectedPikaPowerTile[r2], 2, r5 + 0x40); task->data[1]--; } if (++task->data[2] >= 20) @@ -2725,8 +2726,8 @@ static void sub_810423C(u8 pikaPower) r3 = 1, r1 = 1; else if (i == 15) // pikaPower meter is full r3 = 2, r1 = 2; - selectedPikaPowerTile[r1] = pikaPowerTileTable[r3][0]; - LoadBgTilemap(2, &selectedPikaPowerTile[r1], 2, r4 + 0x40); + sSelectedPikaPowerTile[r1] = pikaPowerTileTable[r3][0]; + LoadBgTilemap(2, &sSelectedPikaPowerTile[r1], 2, r4 + 0x40); } for (; i < 16; i++, r4++) { @@ -2735,8 +2736,8 @@ static void sub_810423C(u8 pikaPower) r3 = 1, r1 = 1; else if (i == 15) r3 = 2, r1 = 2; - selectedPikaPowerTile[r1] = pikaPowerTileTable[r3][1]; - LoadBgTilemap(2, &selectedPikaPowerTile[r1], 2, r4 + 0x40); + sSelectedPikaPowerTile[r1] = pikaPowerTileTable[r3][1]; + LoadBgTilemap(2, &sSelectedPikaPowerTile[r1], 2, r4 + 0x40); } gTasks[sSlotMachine->unkTaskPointer3E].data[1] = pikaPower; } @@ -3067,7 +3068,7 @@ static void sub_8104A40(s16 a0, s16 a1) for (i = 4; i < 15; i++) { - LoadBgTilemap(1, &sReelTimeWindowTilemap[a1 + (i - 4) * 20], 2, 32 * i + a0); + LoadBgTilemap(1, &gReelTimeWindowTilemap[a1 + (i - 4) * 20], 2, 32 * i + a0); } } @@ -3228,7 +3229,7 @@ static void sub_8104DA4(void) { if (task->data[i] != MAX_SPRITES) { - DestroySprite(gSprites + task->data[i]); + DestroySprite(&gSprites[task->data[i]]); task->data[i] = MAX_SPRITES; } } @@ -3333,22 +3334,22 @@ static void sub_8105100(void) { struct SpriteTemplate spriteTemplate; u8 spriteId; - if (gUnknown_0203AAE4 == NULL) - gUnknown_0203AAE4 = AllocZeroed(sizeof(struct SpriteFrameImage) * 5); + if (sUnknown_0203AAE4 == NULL) + sUnknown_0203AAE4 = AllocZeroed(sizeof(struct SpriteFrameImage) * 5); - gUnknown_0203AAE4[0].data = gUnknown_0203AAD8 + (0 * 0x800); - gUnknown_0203AAE4[0].size = 0x800; - gUnknown_0203AAE4[1].data = gUnknown_0203AAD8 + (1 * 0x800); - gUnknown_0203AAE4[1].size = 0x800; - gUnknown_0203AAE4[2].data = gUnknown_0203AAD8 + (2 * 0x800); - gUnknown_0203AAE4[2].size = 0x800; - gUnknown_0203AAE4[3].data = gUnknown_0203AAD8 + (3 * 0x800); - gUnknown_0203AAE4[3].size = 0x800; - gUnknown_0203AAE4[4].data = gUnknown_0203AAD8 + (4 * 0x800); - gUnknown_0203AAE4[4].size = 0x800; + sUnknown_0203AAE4[0].data = sUnknown_0203AAD8 + (0 * 0x800); + sUnknown_0203AAE4[0].size = 0x800; + sUnknown_0203AAE4[1].data = sUnknown_0203AAD8 + (1 * 0x800); + sUnknown_0203AAE4[1].size = 0x800; + sUnknown_0203AAE4[2].data = sUnknown_0203AAD8 + (2 * 0x800); + sUnknown_0203AAE4[2].size = 0x800; + sUnknown_0203AAE4[3].data = sUnknown_0203AAD8 + (3 * 0x800); + sUnknown_0203AAE4[3].size = 0x800; + sUnknown_0203AAE4[4].data = sUnknown_0203AAD8 + (4 * 0x800); + sUnknown_0203AAE4[4].size = 0x800; spriteTemplate = gSpriteTemplate_83ED45C; - spriteTemplate.images = gUnknown_0203AAE4; + spriteTemplate.images = sUnknown_0203AAE4; spriteId = CreateSprite(&spriteTemplate, 280, 80, 1); gSprites[spriteId].oam.priority = 1; gSprites[spriteId].coordOffsetEnabled = TRUE; @@ -3358,8 +3359,8 @@ static void sub_8105100(void) static void sub_810514C(void) { DestroySprite(gSprites + sSlotMachine->reelTimeSprite3F); - if (gUnknown_0203AAE4 != NULL) - FREE_AND_SET_NULL(gUnknown_0203AAE4); + if (sUnknown_0203AAE4 != NULL) + FREE_AND_SET_NULL(sUnknown_0203AAE4); } /*static */void sub_8105170(struct Sprite *sprite) @@ -3379,13 +3380,13 @@ static void sub_81051C0(void) u8 spriteId; struct Sprite *sprite; - if (gUnknown_0203AAE8 == NULL) - gUnknown_0203AAE8 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + if (sUnknown_0203AAE8 == NULL) + sUnknown_0203AAE8 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AAE8[0].data = gUnknown_0203AAD8 + 0x2800; - gUnknown_0203AAE8[0].size = 0x300; + sUnknown_0203AAE8[0].data = sUnknown_0203AAD8 + 0x2800; + sUnknown_0203AAE8[0].size = 0x300; spriteTemplate = gSpriteTemplate_83ED474; - spriteTemplate.images = gUnknown_0203AAE8; + spriteTemplate.images = sUnknown_0203AAE8; spriteId = CreateSprite(&spriteTemplate, 368, 52, 7); sprite = &gSprites[spriteId]; sprite->oam.priority = 1; @@ -3393,13 +3394,13 @@ static void sub_81051C0(void) SetSubspriteTables(sprite, gSubspriteTables_83ED73C); sSlotMachine->unk49[0] = spriteId; - if (gUnknown_0203AAEC == NULL) - gUnknown_0203AAEC = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + if (sUnknown_0203AAEC == NULL) + sUnknown_0203AAEC = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AAEC[0].data = gUnknown_0203AAD8 + 0x2800 + 0x300; - gUnknown_0203AAEC[0].size = 0x500; + sUnknown_0203AAEC[0].data = sUnknown_0203AAD8 + 0x2800 + 0x300; + sUnknown_0203AAEC[0].size = 0x500; spriteTemplate = gSpriteTemplate_83ED48C; - spriteTemplate.images = gUnknown_0203AAEC; + spriteTemplate.images = sUnknown_0203AAEC; spriteId = CreateSprite(&spriteTemplate, 368, 84, 7); sprite = &gSprites[spriteId]; sprite->oam.priority = 1; @@ -3414,13 +3415,13 @@ static void sub_8105284_(void) u8 spriteId; struct Sprite *sprite; - if (gUnknown_0203AAF0 == NULL) - gUnknown_0203AAF0 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + if (sUnknown_0203AAF0 == NULL) + sUnknown_0203AAF0 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AAF0[0].data = gUnknown_0203AAD8 + 0x3000; - gUnknown_0203AAF0[0].size = 0x600; + sUnknown_0203AAF0[0].data = sUnknown_0203AAD8 + 0x3000; + sUnknown_0203AAF0[0].size = 0x600; spriteTemplate = gSpriteTemplate_83ED4A4; - spriteTemplate.images = gUnknown_0203AAF0; + spriteTemplate.images = sUnknown_0203AAF0; spriteId = CreateSprite(&spriteTemplate, 0xa8 - gSpriteCoordOffsetX, 0x50, 7); sprite = &gSprites[spriteId]; sprite->oam.priority = 1; @@ -3487,10 +3488,10 @@ static void sub_81054B8(void) for (i = 0; i < 2; i++) DestroySprite(&gSprites[sSlotMachine->unk49[i]]); - if (gUnknown_0203AAE8 != NULL) - FREE_AND_SET_NULL(gUnknown_0203AAE8); - if (gUnknown_0203AAEC != NULL) - FREE_AND_SET_NULL(gUnknown_0203AAEC); + if (sUnknown_0203AAE8 != NULL) + FREE_AND_SET_NULL(sUnknown_0203AAE8); + if (sUnknown_0203AAEC != NULL) + FREE_AND_SET_NULL(sUnknown_0203AAEC); for (i = 0; i < 3; i++) DestroySprite(&gSprites[sSlotMachine->unk4B[i]]); @@ -3507,8 +3508,8 @@ static void sub_8105524(void) static void sub_8105554(void) { DestroySprite(&gSprites[sSlotMachine->unk42]); - if (gUnknown_0203AAF0 != NULL) - FREE_AND_SET_NULL(gUnknown_0203AAF0); + if (sUnknown_0203AAF0 != NULL) + FREE_AND_SET_NULL(sUnknown_0203AAF0); } // TODO: check if this is true @@ -4149,22 +4150,22 @@ static void sub_81063C0(void) u8 i; sub_8106404(); - gUnknown_0203AAD4 = Alloc(0x3200); - LZDecompressWram(gSlotMachineReelTime_Gfx, gUnknown_0203AAD4); - gUnknown_0203AAD8 = Alloc(0x3600); - LZDecompressWram(sReelTimeGfx, gUnknown_0203AAD8); - gUnknown_0203AB30 = AllocZeroed(sizeof(struct SpriteSheet) * 22); + sUnknown_0203AAD4 = Alloc(0x3200); + LZDecompressWram(gSlotMachineReelTime_Gfx, sUnknown_0203AAD4); + sUnknown_0203AAD8 = Alloc(0x3600); + LZDecompressWram(gReelTimeGfx, sUnknown_0203AAD8); + sUnknown_0203AB30 = AllocZeroed(sizeof(struct SpriteSheet) * 22); for (i = 0; i < 22; i++) { - gUnknown_0203AB30[i].data = sSlotMachineSpriteSheets[i].data; - gUnknown_0203AB30[i].size = sSlotMachineSpriteSheets[i].size; - gUnknown_0203AB30[i].tag = sSlotMachineSpriteSheets[i].tag; + sUnknown_0203AB30[i].data = gSlotMachineSpriteSheets[i].data; + sUnknown_0203AB30[i].size = gSlotMachineSpriteSheets[i].size; + sUnknown_0203AB30[i].tag = gSlotMachineSpriteSheets[i].tag; } - gUnknown_0203AB30[17].data = gUnknown_0203AAD4 + 0xA00; - gUnknown_0203AB30[18].data = gUnknown_0203AAD4 + 0x1400; - gUnknown_0203AB30[19].data = gUnknown_0203AAD4 + 0x1600; - gUnknown_0203AB30[20].data = gUnknown_0203AAD4 + 0x1900; - LoadSpriteSheets(gUnknown_0203AB30); + sUnknown_0203AB30[17].data = sUnknown_0203AAD4 + 0xA00; + sUnknown_0203AB30[18].data = sUnknown_0203AAD4 + 0x1400; + sUnknown_0203AB30[19].data = sUnknown_0203AAD4 + 0x1600; + sUnknown_0203AB30[20].data = sUnknown_0203AAD4 + 0x1900; + LoadSpriteSheets(sUnknown_0203AB30); LoadSpritePalettes(gSlotMachineSpritePalettes); } @@ -4173,18 +4174,18 @@ static void sub_8106404(void) u8 *dest; u8 i, j; - gUnknown_0203AB2C = AllocZeroed(sizeof(struct SpriteSheet)); - gUnknown_0203AAE0 = AllocZeroed(0x2000); - dest = gUnknown_0203AAE0; + sUnknown_0203AB2C = AllocZeroed(sizeof(struct SpriteSheet)); + sUnknown_0203AAE0 = AllocZeroed(0x2000); + dest = sUnknown_0203AAE0; for (i = 0; i < 0x40; i++) { for (j = 0; j < 0x20; j++, dest++) *dest = gUnknown_083EDCDC[j]; } - gUnknown_0203AB2C->data = gUnknown_0203AAE0; - gUnknown_0203AB2C->size = 0x800; - gUnknown_0203AB2C->tag = 0x11; - LoadSpriteSheet(gUnknown_0203AB2C); + sUnknown_0203AB2C->data = sUnknown_0203AAE0; + sUnknown_0203AB2C->size = 0x800; + sUnknown_0203AB2C->tag = 0x11; + LoadSpriteSheet(sUnknown_0203AB2C); } extern const u32 gSlotMachineMenu_Gfx[]; @@ -4194,9 +4195,9 @@ extern const u16 gSlotMachineMenu_Pal[]; static void sub_8106448(void) { - gUnknown_0203AAC8 = Alloc(0x2200); - LZDecompressWram(gSlotMachineMenu_Gfx, gUnknown_0203AAC8); - LoadBgTiles(2, gUnknown_0203AAC8, 0x2200, 0); + sUnknown_0203AAC8 = Alloc(0x2200); + LZDecompressWram(gSlotMachineMenu_Gfx, sUnknown_0203AAC8); + LoadBgTiles(2, sUnknown_0203AAC8, 0x2200, 0); LoadPalette(gSlotMachineMenu_Pal, 0, 160); LoadPalette(gPalette_83EDE24, 208, 32); } @@ -4220,31 +4221,31 @@ static void LoadSlotMachineWheelOverlay(void) { for (dx = 0; dx < 4; dx++) { - LoadBgTilemap(3, gUnknown_0203AAD0, 2, x + dx + 5 * 32); - LoadBgTilemap(3, gUnknown_0203AAD0 + 1, 2, x + dx + 13 * 32); - LoadBgTilemap(3, gUnknown_0203AAD0 + 2, 2, x + dx + 6 * 32); - LoadBgTilemap(3, gUnknown_0203AAD0 + 3, 2, x + dx + 12 * 32); + LoadBgTilemap(3, sUnknown_0203AAD0, 2, x + dx + 5 * 32); + LoadBgTilemap(3, sUnknown_0203AAD0 + 1, 2, x + dx + 13 * 32); + LoadBgTilemap(3, sUnknown_0203AAD0 + 2, 2, x + dx + 6 * 32); + LoadBgTilemap(3, sUnknown_0203AAD0 + 3, 2, x + dx + 12 * 32); } - LoadBgTilemap(3, gUnknown_0203AAD0 + 4, 2, x + 6 * 32); - LoadBgTilemap(3, gUnknown_0203AAD0 + 5, 2, x + 12 * 32); + LoadBgTilemap(3, sUnknown_0203AAD0 + 4, 2, x + 6 * 32); + LoadBgTilemap(3, sUnknown_0203AAD0 + 5, 2, x + 12 * 32); for (y = 7; y <= 11; y++) - LoadBgTilemap(3, gUnknown_0203AAD0 + 6, 2, x + y * 32); + LoadBgTilemap(3, sUnknown_0203AAD0 + 6, 2, x + y * 32); } } static void sub_81065A8(s16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4) { - gUnknown_0203AADC[0] = arg1; - gUnknown_0203AADC[1] = arg2; - gUnknown_0203AADC[2] = arg3; - gUnknown_0203AADC[3] = arg4; + sUnknown_0203AADC[0] = arg1; + sUnknown_0203AADC[1] = arg2; + sUnknown_0203AADC[2] = arg3; + sUnknown_0203AADC[3] = arg4; - LoadBgTilemap(2, gUnknown_0203AADC, 2, 15 * 32 + arg0); - LoadBgTilemap(2, gUnknown_0203AADC + 1, 2, 15 * 32 + 1 + arg0); - LoadBgTilemap(2, gUnknown_0203AADC + 2, 2, 16 * 32 + arg0); - LoadBgTilemap(2, gUnknown_0203AADC + 3, 2, 16 * 32 + 1 + arg0); + LoadBgTilemap(2, sUnknown_0203AADC, 2, 15 * 32 + arg0); + LoadBgTilemap(2, sUnknown_0203AADC + 1, 2, 15 * 32 + 1 + arg0); + LoadBgTilemap(2, sUnknown_0203AADC + 2, 2, 16 * 32 + arg0); + LoadBgTilemap(2, sUnknown_0203AADC + 3, 2, 16 * 32 + 1 + arg0); } static void sub_81065DC(void) @@ -4255,108 +4256,108 @@ static void sub_81065DC(void) static void SlotMachineSetup_9_0(void) { - gUnknown_03001188[0] = gUnknown_0203AAF4; - gUnknown_03001188[1] = gUnknown_0203AAF8; - gUnknown_03001188[2] = gUnknown_0203AAFC; - gUnknown_03001188[3] = gUnknown_0203AB04; - gUnknown_03001188[4] = gUnknown_0203AB08; - gUnknown_03001188[5] = gUnknown_0203AB18; - gUnknown_03001188[6] = gUnknown_0203AB1C; - gUnknown_03001188[7] = gUnknown_0203AB20; - gUnknown_03001188[8] = gUnknown_0203AB24; - gUnknown_03001188[9] = gUnknown_0203AB28; - gUnknown_03001188[10] = gUnknown_0203AB00; - gUnknown_03001188[11] = gUnknown_0203AB00; - gUnknown_03001188[12] = gUnknown_0203AB00; - gUnknown_03001188[13] = gUnknown_0203AB00; - gUnknown_03001188[14] = gUnknown_0203AB0C; - gUnknown_03001188[15] = gUnknown_0203AB0C; - gUnknown_03001188[16] = gUnknown_0203AB0C; - gUnknown_03001188[17] = gUnknown_0203AB0C; - gUnknown_03001188[18] = gUnknown_0203AB0C; - gUnknown_03001188[19] = gUnknown_0203AB10; - gUnknown_03001188[20] = gUnknown_0203AB10; - gUnknown_03001188[21] = gUnknown_0203AB10; - gUnknown_03001188[22] = gUnknown_0203AB14; - gUnknown_03001188[23] = gUnknown_0203AB14; - gUnknown_03001188[24] = gUnknown_0203AB14; + gUnknown_03001188[0] = sUnknown_0203AAF4; + gUnknown_03001188[1] = sUnknown_0203AAF8; + gUnknown_03001188[2] = sUnknown_0203AAFC; + gUnknown_03001188[3] = sUnknown_0203AB04; + gUnknown_03001188[4] = sUnknown_0203AB08; + gUnknown_03001188[5] = sUnknown_0203AB18; + gUnknown_03001188[6] = sUnknown_0203AB1C; + gUnknown_03001188[7] = sUnknown_0203AB20; + gUnknown_03001188[8] = sUnknown_0203AB24; + gUnknown_03001188[9] = sUnknown_0203AB28; + gUnknown_03001188[10] = sUnknown_0203AB00; + gUnknown_03001188[11] = sUnknown_0203AB00; + gUnknown_03001188[12] = sUnknown_0203AB00; + gUnknown_03001188[13] = sUnknown_0203AB00; + gUnknown_03001188[14] = sUnknown_0203AB0C; + gUnknown_03001188[15] = sUnknown_0203AB0C; + gUnknown_03001188[16] = sUnknown_0203AB0C; + gUnknown_03001188[17] = sUnknown_0203AB0C; + gUnknown_03001188[18] = sUnknown_0203AB0C; + gUnknown_03001188[19] = sUnknown_0203AB10; + gUnknown_03001188[20] = sUnknown_0203AB10; + gUnknown_03001188[21] = sUnknown_0203AB10; + gUnknown_03001188[22] = sUnknown_0203AB14; + gUnknown_03001188[23] = sUnknown_0203AB14; + gUnknown_03001188[24] = sUnknown_0203AB14; gUnknown_03001188[25] = NULL; } static void SlotMachineSetup_8_0(void) { - gUnknown_0203AAF4 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AAF4[0].data = gUnknown_0203AAD4; - gUnknown_0203AAF4[0].size = 0x600; + sUnknown_0203AAF4 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + sUnknown_0203AAF4[0].data = sUnknown_0203AAD4; + sUnknown_0203AAF4[0].size = 0x600; - gUnknown_0203AAF8 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AAF8[0].data = gUnknown_0203AAD4 + 0x600; - gUnknown_0203AAF8[0].size = 0x200; + sUnknown_0203AAF8 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + sUnknown_0203AAF8[0].data = sUnknown_0203AAD4 + 0x600; + sUnknown_0203AAF8[0].size = 0x200; - gUnknown_0203AAFC = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AAFC[0].data = gUnknown_0203AAD4 + 0x800; - gUnknown_0203AAFC[0].size = 0x200; + sUnknown_0203AAFC = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + sUnknown_0203AAFC[0].data = sUnknown_0203AAD4 + 0x800; + sUnknown_0203AAFC[0].size = 0x200; - gUnknown_0203AB00 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AB00[0].data = gUnknown_0203AAD4 + 0xA00; - gUnknown_0203AB00[0].size = 0x200; + sUnknown_0203AB00 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + sUnknown_0203AB00[0].data = sUnknown_0203AAD4 + 0xA00; + sUnknown_0203AB00[0].size = 0x200; - gUnknown_0203AB04 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AB04[0].data = gUnknown_0203AAD4 + 0xC00; - gUnknown_0203AB04[0].size = 0x300; + sUnknown_0203AB04 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + sUnknown_0203AB04[0].data = sUnknown_0203AAD4 + 0xC00; + sUnknown_0203AB04[0].size = 0x300; - gUnknown_0203AB08 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AB08[0].data = gUnknown_0203AAD4 + 0x1000; - gUnknown_0203AB08[0].size = 0x400; + sUnknown_0203AB08 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + sUnknown_0203AB08[0].data = sUnknown_0203AAD4 + 0x1000; + sUnknown_0203AB08[0].size = 0x400; - gUnknown_0203AB0C = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AB0C[0].data = gUnknown_0203AAD4 + 0x1400; - gUnknown_0203AB0C[0].size = 0x200; + sUnknown_0203AB0C = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + sUnknown_0203AB0C[0].data = sUnknown_0203AAD4 + 0x1400; + sUnknown_0203AB0C[0].size = 0x200; - gUnknown_0203AB10 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AB10[0].data = gUnknown_0203AAD4 + 0x1600; - gUnknown_0203AB10[0].size = 0x300; + sUnknown_0203AB10 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + sUnknown_0203AB10[0].data = sUnknown_0203AAD4 + 0x1600; + sUnknown_0203AB10[0].size = 0x300; - gUnknown_0203AB14 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AB14[0].data = gUnknown_0203AAD4 + 0x1900; - gUnknown_0203AB14[0].size = 0x300; + sUnknown_0203AB14 = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + sUnknown_0203AB14[0].data = sUnknown_0203AAD4 + 0x1900; + sUnknown_0203AB14[0].size = 0x300; - gUnknown_0203AB18 = AllocZeroed(sizeof(struct SpriteFrameImage) * 2); - gUnknown_0203AB18[0].data = gUnknown_0203AAD4 + 0x1C00; - gUnknown_0203AB18[0].size = 0x200; - gUnknown_0203AB18[1].data = gUnknown_0203AAD4 + 0x1E00; - gUnknown_0203AB18[1].size = 0x200; + sUnknown_0203AB18 = AllocZeroed(sizeof(struct SpriteFrameImage) * 2); + sUnknown_0203AB18[0].data = sUnknown_0203AAD4 + 0x1C00; + sUnknown_0203AB18[0].size = 0x200; + sUnknown_0203AB18[1].data = sUnknown_0203AAD4 + 0x1E00; + sUnknown_0203AB18[1].size = 0x200; - gUnknown_0203AB1C = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); - gUnknown_0203AB1C[0].data = gUnknown_0203AAD4 + 0x2000; - gUnknown_0203AB1C[0].size = 640; + sUnknown_0203AB1C = AllocZeroed(sizeof(struct SpriteFrameImage) * 1); + sUnknown_0203AB1C[0].data = sUnknown_0203AAD4 + 0x2000; + sUnknown_0203AB1C[0].size = 640; - gUnknown_0203AB20 = AllocZeroed(sizeof(struct SpriteFrameImage) * 5); - gUnknown_0203AB20[0].data = gUnknown_0203AAD4 + 0x2280; - gUnknown_0203AB20[0].size = 0x80; - gUnknown_0203AB20[1].data = gUnknown_0203AAD4 + 0x2300; - gUnknown_0203AB20[1].size = 0x80; - gUnknown_0203AB20[2].data = gUnknown_0203AAD4 + 0x2380; - gUnknown_0203AB20[2].size = 0x80; - gUnknown_0203AB20[3].data = gUnknown_0203AAD4 + 0x2400; - gUnknown_0203AB20[3].size = 0x80; - gUnknown_0203AB20[4].data = gUnknown_0203AAD4 + 0x2480; - gUnknown_0203AB20[4].size = 0x80; + sUnknown_0203AB20 = AllocZeroed(sizeof(struct SpriteFrameImage) * 5); + sUnknown_0203AB20[0].data = sUnknown_0203AAD4 + 0x2280; + sUnknown_0203AB20[0].size = 0x80; + sUnknown_0203AB20[1].data = sUnknown_0203AAD4 + 0x2300; + sUnknown_0203AB20[1].size = 0x80; + sUnknown_0203AB20[2].data = sUnknown_0203AAD4 + 0x2380; + sUnknown_0203AB20[2].size = 0x80; + sUnknown_0203AB20[3].data = sUnknown_0203AAD4 + 0x2400; + sUnknown_0203AB20[3].size = 0x80; + sUnknown_0203AB20[4].data = sUnknown_0203AAD4 + 0x2480; + sUnknown_0203AB20[4].size = 0x80; - gUnknown_0203AB24 = AllocZeroed(sizeof(struct SpriteFrameImage) * 2); - gUnknown_0203AB24[0].data = gUnknown_0203AAD4 + 0x2600; - gUnknown_0203AB24[0].size = 0x480; - gUnknown_0203AB24[1].data = gUnknown_0203AAD4 + 10880; - gUnknown_0203AB24[1].size = 0x480; + sUnknown_0203AB24 = AllocZeroed(sizeof(struct SpriteFrameImage) * 2); + sUnknown_0203AB24[0].data = sUnknown_0203AAD4 + 0x2600; + sUnknown_0203AB24[0].size = 0x480; + sUnknown_0203AB24[1].data = sUnknown_0203AAD4 + 10880; + sUnknown_0203AB24[1].size = 0x480; - gUnknown_0203AB28 = AllocZeroed(sizeof(struct SpriteFrameImage) * 2); - gUnknown_0203AB28[0].data = gUnknown_0203AAD4 + 0x2F00; - gUnknown_0203AB28[0].size = 0x180; - gUnknown_0203AB28[1].data = gUnknown_0203AAD4 + 0x3080; - gUnknown_0203AB28[1].size = 0x180; + sUnknown_0203AB28 = AllocZeroed(sizeof(struct SpriteFrameImage) * 2); + sUnknown_0203AB28[0].data = sUnknown_0203AAD4 + 0x2F00; + sUnknown_0203AB28[0].size = 0x180; + sUnknown_0203AB28[1].data = sUnknown_0203AAD4 + 0x3080; + sUnknown_0203AB28[1].size = 0x180; } -const u8 sReelSymbols[][REEL_NUM_TAGS] = +const u8 gReelSymbols[][REEL_NUM_TAGS] = { { SLOT_MACHINE_TAG_7_RED, @@ -4429,17 +4430,17 @@ const u8 sReelSymbols[][REEL_NUM_TAGS] = }, }; -const u8 ReelTimeTags[] = { +const u8 gReelTimeTags[] = { 1, 0, 5, 4, 3, 2 }; -const s16 sInitialReelPositions[][2] = { +const s16 gInitialReelPositions[][2] = { {0, 6}, {0, 10}, {0, 2} }; -const u8 LuckyRoundTable[][3] = { +const u8 gLuckyRoundProbabilities[][3] = { {1, 1, 12}, {1, 1, 14}, {2, 2, 14}, @@ -4448,13 +4449,13 @@ const u8 LuckyRoundTable[][3] = { {3, 3, 16} }; -const u8 LuckyFlagsTable_Top3[][6] = { +const u8 gLuckyFlagProbabilities_Top3[][6] = { {25, 25, 30, 40, 40, 50}, {25, 25, 30, 30, 35, 35}, {25, 25, 30, 25, 25, 30} }; -const u8 LuckyFlagsTable_NotTop3[][6] = { +const u8 gLuckyFlagProbabilities_NotTop3[][6] = { {20, 25, 25, 20, 25, 25}, {12, 15, 15, 18, 19, 22}, {25, 25, 25, 30, 30, 40}, @@ -4462,7 +4463,7 @@ const u8 LuckyFlagsTable_NotTop3[][6] = { {40, 40, 35, 35, 40, 40} }; -const u8 ReelTimeProbabilityTable_UnluckyGame[][17] = { +const u8 gReeltimeProbabilities_UnluckyGame[][17] = { {243, 243, 243, 80, 80, 80, 80, 40, 40, 40, 40, 40, 40, 5, 5, 5, 5}, { 5, 5, 5, 150, 150, 150, 150, 130, 130, 130, 130, 130, 130, 100, 100, 100, 5}, { 4, 4, 4, 20, 20, 20, 20, 80, 80, 80, 80, 80, 80, 100, 100, 100, 40}, @@ -4471,7 +4472,7 @@ const u8 ReelTimeProbabilityTable_UnluckyGame[][17] = { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6} }; -const u8 ReelTimeProbabilityTable_LuckyGame[][17] = { +const u8 gReelTimeProbabilities_LuckyGame[][17] = { { 243, 243, 243, 200, 200, 200, 200, 160, 160, 160, 160, 160, 160, 70, 70, 70, 5}, { 5, 5, 5, 25, 25, 25, 25, 5, 5, 5, 5, 5, 5, 2, 2, 2, 6}, { 4, 4, 4, 25, 25, 25, 25, 30, 30, 30, 30, 30, 30, 40, 40, 40, 35}, @@ -4480,11 +4481,11 @@ const u8 ReelTimeProbabilityTable_LuckyGame[][17] = { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 60} }; -const u16 ProbabilityTable_SkipToReeltimeAction14[] = { +const u16 gProbabilityTable_SkipToReeltimeAction14[] = { 128, 175, 200, 225, 256 }; -const u16 ReelIncrementTable[][2] = { +const u16 gReelIncrementTable[][2] = { {10, 5}, {10, 10}, {10, 15}, @@ -4492,24 +4493,24 @@ const u16 ReelIncrementTable[][2] = { {10, 35} }; -const u16 ReelTimeBonusIncrementTable[] = { +const u16 gReelTimeBonusIncrementTable[] = { 0, 5, 10, 15, 20 }; // tentative name -const u8 BiasTags[] = { +const u8 gBiasTags[] = { SLOT_MACHINE_TAG_REPLAY, SLOT_MACHINE_TAG_CHERRY, SLOT_MACHINE_TAG_LOTAD, SLOT_MACHINE_TAG_AZURILL, SLOT_MACHINE_TAG_POWER, SLOT_MACHINE_TAG_7_RED, SLOT_MACHINE_TAG_7_RED, SLOT_MACHINE_TAG_7_RED }; -const u16 LuckyFlagSettings_Top3[] = { +const u16 gLuckyFlagSettings_Top3[] = { LUCKY_BIAS_777, LUCKY_BIAS_REELTIME, LUCKY_BIAS_MIXED_777 }; -const u16 LuckyFlagSettings_NotTop3[] = { +const u16 gLuckyFlagSettings_NotTop3[] = { LUCKY_BIAS_POWER, LUCKY_BIAS_AZURILL, LUCKY_BIAS_LOTAD, LUCKY_BIAS_CHERRY, LUCKY_BIAS_REPLAY }; -const u8 sSym2Match[] = { +const u8 gSym2Match[] = { SLOT_MACHINE_MATCHED_777_RED, SLOT_MACHINE_MATCHED_777_BLUE, SLOT_MACHINE_MATCHED_AZURILL, @@ -4519,7 +4520,7 @@ const u8 sSym2Match[] = { SLOT_MACHINE_MATCHED_REPLAY }; -const u16 sSlotMatchFlags[] = { +const u16 gSlotMatchFlags[] = { 1 << SLOT_MACHINE_MATCHED_1CHERRY, 1 << SLOT_MACHINE_MATCHED_2CHERRY, 1 << SLOT_MACHINE_MATCHED_REPLAY, @@ -4531,7 +4532,7 @@ const u16 sSlotMatchFlags[] = { 1 << SLOT_MACHINE_MATCHED_777_BLUE }; -const u16 sSlotPayouts[] = { +const u16 gSlotPayouts[] = { 2, 4, 0, 6, 12, 3, 90, 300, 300 }; From 9ed0f775289d574a792f20ec37fe24f26e765117 Mon Sep 17 00:00:00 2001 From: hondew Date: Thu, 28 Feb 2019 18:58:35 -0500 Subject: [PATCH 12/14] fixed issues in data and include dirs --- data/slot_machine.s | 976 ++++++++++++++++++++--------------------- include/slot_machine.h | 5 - 2 files changed, 488 insertions(+), 493 deletions(-) mode change 100644 => 100755 data/slot_machine.s diff --git a/data/slot_machine.s b/data/slot_machine.s old mode 100644 new mode 100755 index adc65feec..a3d502dcc --- a/data/slot_machine.s +++ b/data/slot_machine.s @@ -1,841 +1,841 @@ -.include "asm/macros.inc" -.include "constants/constants.inc" + .include "asm/macros.inc" + .include "constants/constants.inc" -.section .rodata + .section .rodata .align 2 gUnknown_085A7A3C:: @ 85A7A3C -.2byte 0 -.2byte 0 -.2byte 0 -.2byte 0 + .2byte 0 + .2byte 0 + .2byte 0 + .2byte 0 gUnknown_085A7A44:: @ 85A7A44 -.2byte 0x8000 -.2byte 0 -.2byte 0 -.2byte 0 + .2byte 0x8000 + .2byte 0 + .2byte 0 + .2byte 0 gUnknown_085A7A4C:: @ 85A7A4C -.2byte 0 -.2byte 0x4000 -.2byte 0 -.2byte 0 + .2byte 0 + .2byte 0x4000 + .2byte 0 + .2byte 0 gUnknown_085A7A54:: @ 85A7A54 -.2byte 0x8000 -.2byte 0x8000 -.2byte 0 -.2byte 0 + .2byte 0x8000 + .2byte 0x8000 + .2byte 0 + .2byte 0 gUnknown_085A7A5C:: @ 85A7A5C -.2byte 0 -.2byte 0x8000 -.2byte 0 -.2byte 0 + .2byte 0 + .2byte 0x8000 + .2byte 0 + .2byte 0 gUnknown_085A7A64:: @ 85A7A64 -.2byte 0x8000 -.2byte 0xC000 -.2byte 0 -.2byte 0 + .2byte 0x8000 + .2byte 0xC000 + .2byte 0 + .2byte 0 gUnknown_085A7A6C:: @ 85A7A6C -.2byte 0x4000 -.2byte 0xC000 -.2byte 0 -.2byte 0 + .2byte 0x4000 + .2byte 0xC000 + .2byte 0 + .2byte 0 gUnknown_085A7A74:: @ 85A7A74 -.2byte 0 -.2byte 0xC000 -.2byte 0 -.2byte 0 + .2byte 0 + .2byte 0xC000 + .2byte 0 + .2byte 0 gUnknown_085A7A7C:: @ 85A7A7C -.4byte gSlotMachineReelTimeNumber0 -.2byte 0x80 -.2byte 0 -.4byte gSlotMachineReelTimeNumber1 -.2byte 0x80 -.2byte 0 -.4byte gSlotMachineReelTimeNumber2 -.2byte 0x80 -.2byte 0 -.4byte gSlotMachineReelTimeNumber3 -.2byte 0x80 -.2byte 0 -.4byte gSlotMachineReelTimeNumber4 -.2byte 0x80 -.2byte 0 -.4byte gSlotMachineReelTimeNumber5 -.2byte 0x80 -.2byte 0 + .4byte gSlotMachineReelTimeNumber0 + .2byte 0x80 + .2byte 0 + .4byte gSlotMachineReelTimeNumber1 + .2byte 0x80 + .2byte 0 + .4byte gSlotMachineReelTimeNumber2 + .2byte 0x80 + .2byte 0 + .4byte gSlotMachineReelTimeNumber3 + .2byte 0x80 + .2byte 0 + .4byte gSlotMachineReelTimeNumber4 + .2byte 0x80 + .2byte 0 + .4byte gSlotMachineReelTimeNumber5 + .2byte 0x80 + .2byte 0 gUnknown_085A7AAC:: @ 85A7AAC -.4byte gSlotMachineReelTimeShadow -.2byte 0x200 -.2byte 0 + .4byte gSlotMachineReelTimeShadow + .2byte 0x200 + .2byte 0 gUnknown_085A7AB4:: @ 85A7AB4 -.4byte gUnknown_08DD1A18 -.2byte 0x40 -.2byte 0 + .4byte gUnknown_08DD1A18 + .2byte 0x40 + .2byte 0 gUnknown_085A7ABC:: @ 85A7ABC -.4byte gSlotMachineReelTimeLargeBolt0 -.2byte 0x100 -.2byte 0 -.4byte gSlotMachineReelTimeLargeBolt1 -.2byte 0x100 -.2byte 0 + .4byte gSlotMachineReelTimeLargeBolt0 + .2byte 0x100 + .2byte 0 + .4byte gSlotMachineReelTimeLargeBolt1 + .2byte 0x100 + .2byte 0 gUnknown_085A7ACC:: @ 85A7ACC -.4byte gSlotMachineReelTimePikaAura -.2byte 0x400 -.2byte 0 + .4byte gSlotMachineReelTimePikaAura + .2byte 0x400 + .2byte 0 gUnknown_085A7AD4:: @ 85A7CD4 -.4byte gSlotMachineReelTimeExplosion0 -.2byte 0x200 -.2byte 0 -.4byte gSlotMachineReelTimeExplosion1 -.2byte 0x200 -.2byte 0 + .4byte gSlotMachineReelTimeExplosion0 + .2byte 0x200 + .2byte 0 + .4byte gSlotMachineReelTimeExplosion1 + .2byte 0x200 + .2byte 0 gUnknown_085A7AE4:: @ 85A7AE4 -.4byte gSlotMachineReelTimeDuck -.4byte 32 + .4byte gSlotMachineReelTimeDuck + .4byte 32 gUnknown_085A7AEC:: @ 85A7AEC -.4byte gSlotMachineReelTimeSmoke -.4byte 0x80 + .4byte gSlotMachineReelTimeSmoke + .4byte 0x80 gUnknown_085A7AF4:: @ 85A7AF4 -.4byte gSlotMachineReelTimeBolt -.4byte 32 + .4byte gSlotMachineReelTimeBolt + .4byte 32 gUnknown_085A7AFC:: @ 85A7AFC -obj_image_anim_frame 0, 1 -obj_image_anim_end + obj_image_anim_frame 0, 1 + obj_image_anim_end gUnknown_085A7B04:: @ 85A7B04 -obj_image_anim_frame 0, 1 -obj_image_anim_jump 0 + obj_image_anim_frame 0, 1 + obj_image_anim_jump 0 gUnknown_085A7B0C:: @ 85A7B0C -obj_image_anim_frame 0, 16 -obj_image_anim_end + obj_image_anim_frame 0, 16 + obj_image_anim_end gUnknown_085A7B14:: @ 85A7B14 -obj_image_anim_frame 1, 16 -obj_image_anim_frame 0, 16 -obj_image_anim_jump 0 + obj_image_anim_frame 1, 16 + obj_image_anim_frame 0, 16 + obj_image_anim_jump 0 gUnknown_085A7B20:: @ 85A7B20 -obj_image_anim_frame 1, 8 -obj_image_anim_frame 0, 8 -obj_image_anim_jump 0 + obj_image_anim_frame 1, 8 + obj_image_anim_frame 0, 8 + obj_image_anim_jump 0 gUnknown_085A7B2C:: @ 85A7B2C -obj_image_anim_frame 1, 4 -obj_image_anim_frame 0, 4 -obj_image_anim_jump 0 + obj_image_anim_frame 1, 4 + obj_image_anim_frame 0, 4 + obj_image_anim_jump 0 gUnknown_085A7B38:: @ 85A7B38 -obj_image_anim_frame 2, 32 -obj_image_anim_frame 3, 32 -obj_image_anim_jump 0 + obj_image_anim_frame 2, 32 + obj_image_anim_frame 3, 32 + obj_image_anim_jump 0 gUnknown_085A7B44:: @ 85A7B44 -obj_image_anim_frame 4, 1 -obj_image_anim_end + obj_image_anim_frame 4, 1 + obj_image_anim_end gUnknown_085A7B4C:: @ 85A7B4C -obj_image_anim_frame 0, 1 -obj_image_anim_end + obj_image_anim_frame 0, 1 + obj_image_anim_end gUnknown_085A7B54:: @ 85A7B54 -obj_image_anim_frame 1, 1 -obj_image_anim_end + obj_image_anim_frame 1, 1 + obj_image_anim_end gUnknown_085A7B5C:: @ 85A7B5C -obj_image_anim_frame 2, 1 -obj_image_anim_end + obj_image_anim_frame 2, 1 + obj_image_anim_end gUnknown_085A7B64:: @ 85A7B64 -obj_image_anim_frame 3, 1 -obj_image_anim_end + obj_image_anim_frame 3, 1 + obj_image_anim_end gUnknown_085A7B6C:: @ 85A7B6C -obj_image_anim_frame 4, 1 -obj_image_anim_end + obj_image_anim_frame 4, 1 + obj_image_anim_end gUnknown_085A7B74:: @ 85A7B74 -obj_image_anim_frame 5, 1 -obj_image_anim_end + obj_image_anim_frame 5, 1 + obj_image_anim_end gUnknown_085A7B7C:: @ 85A7B7C -obj_image_anim_frame 0, 4 -obj_image_anim_frame 1, 4 -obj_image_anim_jump 0 + obj_image_anim_frame 0, 4 + obj_image_anim_frame 1, 4 + obj_image_anim_jump 0 gUnknown_085A7B88:: @ 85A7B88 -obj_image_anim_frame 0, 16 -obj_image_anim_frame 1, 16 -obj_image_anim_jump 0 + obj_image_anim_frame 0, 16 + obj_image_anim_frame 1, 16 + obj_image_anim_jump 0 gUnknown_085A7B94:: @ 85A7B94 -obj_image_anim_frame 0, 30 -obj_image_anim_frame 1, 30 -obj_image_anim_jump 0 + obj_image_anim_frame 0, 30 + obj_image_anim_frame 1, 30 + obj_image_anim_jump 0 gUnknown_085A7BA0:: @ 85A7BA0 -obj_image_anim_frame 1, 1 -obj_image_anim_end + obj_image_anim_frame 1, 1 + obj_image_anim_end gUnknown_085A7BA8:: @ 85A7BA8 -obj_image_anim_frame 0, 30 -obj_image_anim_frame 1, 30 -obj_image_anim_jump 0 + obj_image_anim_frame 0, 30 + obj_image_anim_frame 1, 30 + obj_image_anim_jump 0 gUnknown_085A7BB4:: @ 85A7BB4 -obj_image_anim_frame 0, 16 -obj_image_anim_frame 1, 16 -obj_image_anim_frame 0, 16 -obj_image_anim_frame 1, 80 -obj_image_anim_jump 0 + obj_image_anim_frame 0, 16 + obj_image_anim_frame 1, 16 + obj_image_anim_frame 0, 16 + obj_image_anim_frame 1, 80 + obj_image_anim_jump 0 gUnknown_085A7BC8:: @ 85A7BC8 -obj_image_anim_frame 0, 1 -obj_image_anim_end + obj_image_anim_frame 0, 1 + obj_image_anim_end gUnknown_085A7BD0:: @ 85A7BD0 -obj_image_anim_frame 0, 1 -obj_image_anim_end + obj_image_anim_frame 0, 1 + obj_image_anim_end gUnknown_085A7BD8:: @ 85A7BD8 -obj_image_anim_frame 1, 1 -obj_image_anim_end + obj_image_anim_frame 1, 1 + obj_image_anim_end gUnknown_085A7BE0:: @ 85A7BE0 -obj_image_anim_frame 2, 1 -obj_image_anim_end + obj_image_anim_frame 2, 1 + obj_image_anim_end gUnknown_085A7BE8:: @ 85A7BE8 -obj_image_anim_frame 3, 1 -obj_image_anim_end + obj_image_anim_frame 3, 1 + obj_image_anim_end gUnknown_085A7BF0:: @ 85A7BF0 -obj_image_anim_frame 4, 1 -obj_image_anim_end + obj_image_anim_frame 4, 1 + obj_image_anim_end gUnknown_085A7BF8:: @ 85A7BF8 -.4byte gUnknown_085A7AFC + .4byte gUnknown_085A7AFC gUnknown_085A7BFC:: @ 85A7BFC -.4byte gUnknown_085A7B04 + .4byte gUnknown_085A7B04 gUnknown_085A7C00:: @ 85A7C00 -.4byte gUnknown_085A7B0C -.4byte gUnknown_085A7B14 -.4byte gUnknown_085A7B20 -.4byte gUnknown_085A7B2C -.4byte gUnknown_085A7B38 -.4byte gUnknown_085A7B44 + .4byte gUnknown_085A7B0C + .4byte gUnknown_085A7B14 + .4byte gUnknown_085A7B20 + .4byte gUnknown_085A7B2C + .4byte gUnknown_085A7B38 + .4byte gUnknown_085A7B44 gUnknown_085A7C18:: @ 85A7C18 -.4byte gUnknown_085A7B4C -.4byte gUnknown_085A7B54 -.4byte gUnknown_085A7B5C -.4byte gUnknown_085A7B64 -.4byte gUnknown_085A7B6C -.4byte gUnknown_085A7B74 + .4byte gUnknown_085A7B4C + .4byte gUnknown_085A7B54 + .4byte gUnknown_085A7B5C + .4byte gUnknown_085A7B64 + .4byte gUnknown_085A7B6C + .4byte gUnknown_085A7B74 gUnknown_085A7C30:: @ 85A7C30 -.4byte gUnknown_085A7B7C + .4byte gUnknown_085A7B7C gUnknown_085A7C34:: @ 85A7C34 -.4byte gUnknown_085A7B88 + .4byte gUnknown_085A7B88 gUnknown_085A7C38:: @ 85A7C38 -.4byte gUnknown_085A7B94 -.4byte gUnknown_085A7BA0 + .4byte gUnknown_085A7B94 + .4byte gUnknown_085A7BA0 gUnknown_085A7C40:: @ 85A7C40 -.4byte gUnknown_085A7BA8 + .4byte gUnknown_085A7BA8 gUnknown_085A7C44:: @ 85A7C44 -.4byte gUnknown_085A7BB4 -.4byte gUnknown_085A7BC8 + .4byte gUnknown_085A7BB4 + .4byte gUnknown_085A7BC8 gUnknown_085A7C4C:: @ 85A7C4C -.4byte gUnknown_085A7BD0 -.4byte gUnknown_085A7BD8 -.4byte gUnknown_085A7BE0 -.4byte gUnknown_085A7BE8 -.4byte gUnknown_085A7BF0 + .4byte gUnknown_085A7BD0 + .4byte gUnknown_085A7BD8 + .4byte gUnknown_085A7BE0 + .4byte gUnknown_085A7BE8 + .4byte gUnknown_085A7BF0 gUnknown_085A7C60:: @ 85A7C60 -obj_rot_scal_anim_frame 16, 16, 0, 0 -obj_rot_scal_anim_loop 0 -obj_rot_scal_anim_frame 1, 1, 0, 1 -obj_rot_scal_anim_loop 0xFF -obj_rot_scal_anim_end + obj_rot_scal_anim_frame 16, 16, 0, 0 + obj_rot_scal_anim_loop 0 + obj_rot_scal_anim_frame 1, 1, 0, 1 + obj_rot_scal_anim_loop 0xFF + obj_rot_scal_anim_end gUnknown_085A7C88:: @ 85A7C88 -.4byte gUnknown_085A7C60 + .4byte gUnknown_085A7C60 gUnknown_085A7C8C:: @ 85A7C8C -obj_rot_scal_anim_frame 0, 0, 8, 32 -obj_rot_scal_anim_frame 0, 0, 6, 32 -obj_rot_scal_anim_frame 0, 0, 4, 16 -obj_rot_scal_anim_frame 0, 0, 12, 2 -obj_rot_scal_anim_frame 0, 0, -12, 4 -obj_rot_scal_anim_frame 0, 0, 12, 2 -obj_rot_scal_anim_frame 0, 0, 12, 2 -obj_rot_scal_anim_frame 0, 0, -12, 4 -obj_rot_scal_anim_frame 0, 0, 12, 2 -obj_rot_scal_anim_end + obj_rot_scal_anim_frame 0, 0, 8, 32 + obj_rot_scal_anim_frame 0, 0, 6, 32 + obj_rot_scal_anim_frame 0, 0, 4, 16 + obj_rot_scal_anim_frame 0, 0, 12, 2 + obj_rot_scal_anim_frame 0, 0, -12, 4 + obj_rot_scal_anim_frame 0, 0, 12, 2 + obj_rot_scal_anim_frame 0, 0, 12, 2 + obj_rot_scal_anim_frame 0, 0, -12, 4 + obj_rot_scal_anim_frame 0, 0, 12, 2 + obj_rot_scal_anim_end gUnknown_085A7CDC:: @ 85A7CDC -.4byte gUnknown_085A7C8C + .4byte gUnknown_085A7C8C gSpriteTemplate_83ED414:: @ 85A7CE0 -spr_template 0, 0, gUnknown_085A7A5C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, sub_8104F18 + spr_template 0, 0, gUnknown_085A7A5C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, sub_8104F18 gSpriteTemplate_83ED42C:: @ 85A7CF8 -spr_template 7, 4, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, sub_810506C + spr_template 7, 4, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, sub_810506C gSpriteTemplate_83ED444:: @ 85A7D10 -spr_template 17, 0, gUnknown_085A7A74, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 17, 0, gUnknown_085A7A74, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED45C:: @ 85A7D28 -spr_template 0xFFFF, 1, gUnknown_085A7A74, gUnknown_085A7C00, NULL, gDummySpriteAffineAnimTable, sub_8105170 + spr_template 0xFFFF, 1, gUnknown_085A7A74, gUnknown_085A7C00, NULL, gDummySpriteAffineAnimTable, sub_8105170 gSpriteTemplate_83ED474:: @ 85A7D40 -spr_template 0xFFFF, 2, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 2, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED48C:: @ 85A7D58 -spr_template 0xFFFF, 3, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 3, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED4A4:: @ 85A7D70 -spr_template 0xFFFF, 3, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 3, gUnknown_085A7A44, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED4BC:: @ 85A7D88 -spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7C18, gUnknown_085A7A7C, gDummySpriteAffineAnimTable, sub_810535C + spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7C18, gUnknown_085A7A7C, gDummySpriteAffineAnimTable, sub_810535C gSpriteTemplate_83ED4D4:: @ 85A7DA0 -spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AAC, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AAC, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED4EC:: @ 85A7DB8 -spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AB4, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AB4, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED504:: @ 85A7DD0 -spr_template 0xFFFF, 4, gUnknown_085A7A54, gUnknown_085A7C30, gUnknown_085A7ABC, gDummySpriteAffineAnimTable, sub_810562C + spr_template 0xFFFF, 4, gUnknown_085A7A54, gUnknown_085A7C30, gUnknown_085A7ABC, gDummySpriteAffineAnimTable, sub_810562C gSpriteTemplate_83ED51C:: @ 85A7DE8 -spr_template 0xFFFF, 7, gUnknown_085A7A64, gUnknown_085A7BF8, gUnknown_085A7ACC, gDummySpriteAffineAnimTable, sub_8105784 + spr_template 0xFFFF, 7, gUnknown_085A7A64, gUnknown_085A7BF8, gUnknown_085A7ACC, gDummySpriteAffineAnimTable, sub_8105784 gSpriteTemplate_83ED534:: @ 85A7E00 -spr_template 0xFFFF, 5, gUnknown_085A7A5C, gUnknown_085A7C34, gUnknown_085A7AD4, gDummySpriteAffineAnimTable, sub_8105894 + spr_template 0xFFFF, 5, gUnknown_085A7A5C, gUnknown_085A7C34, gUnknown_085A7AD4, gDummySpriteAffineAnimTable, sub_8105894 gSpriteTemplate_83ED54C:: @ 85A7E18 -spr_template 0xFFFF, 4, gUnknown_085A7A3C, gUnknown_085A7BFC, gUnknown_085A7AE4, gDummySpriteAffineAnimTable, sub_810594C + spr_template 0xFFFF, 4, gUnknown_085A7A3C, gUnknown_085A7BFC, gUnknown_085A7AE4, gDummySpriteAffineAnimTable, sub_810594C gSpriteTemplate_83ED564:: @ 85A7E30 -spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AEC, gUnknown_085A7C88, sub_8105A38 + spr_template 0xFFFF, 4, gUnknown_085A7A4C, gUnknown_085A7BF8, gUnknown_085A7AEC, gUnknown_085A7C88, sub_8105A38 gUnknown_085A7E48:: @ 85A7E48 -spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7E60:: @ 85A7E60 -spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7E78:: @ 85A7E78 -spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7E90:: @ 85A7E90 -spr_template 18, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 18, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7EA8:: @ 85A7EA8 -spr_template 0xFFFF, 6, gUnknown_085A7A6C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 6, gUnknown_085A7A6C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7EC0:: @ 85A7EC0 -spr_template 0xFFFF, 6, gUnknown_085A7A6C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 6, gUnknown_085A7A6C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7ED8:: @ 85A7ED8 -spr_template 19, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 19, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7EF0:: @ 85A7EF0 -spr_template 20, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 20, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7F08:: @ 85A7F08 -spr_template 21, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 21, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7F20:: @ 85A7F20 -spr_template 0xFFFF, 6, gUnknown_085A7A5C, gUnknown_085A7C38, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 6, gUnknown_085A7A5C, gUnknown_085A7C38, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7F38:: @ 85A7F38 -spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7BF8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7F50:: @ 85A7F50 -spr_template 0xFFFF, 6, gUnknown_085A7A4C, gUnknown_085A7C4C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 6, gUnknown_085A7A4C, gUnknown_085A7C4C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7F68:: @ 85A7F68 -spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7C44, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7C44, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gUnknown_085A7F80:: @ 85A7F80 -spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7C40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + spr_template 0xFFFF, 6, gUnknown_085A7A3C, gUnknown_085A7C40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy gSpriteTemplate_83ED6CC:: @ 85A7F98 -spr_template 0xFFFF, 4, gUnknown_085A7A3C, gUnknown_085A7BF8, gUnknown_085A7AF4, gUnknown_085A7CDC, sub_8105B70 + spr_template 0xFFFF, 4, gUnknown_085A7A3C, gUnknown_085A7BF8, gUnknown_085A7AF4, gUnknown_085A7CDC, sub_8105B70 gUnknown_085A7FB0:: @ 85A7FB0 -subsprite -64, -64, 3, 0, 64x64 -subsprite 0, -64, 3, 0, 64x64 -subsprite -64, 0, 3, 0, 64x64 -subsprite 0, 0, 3, 0, 64x64 + subsprite -64, -64, 3, 0, 64x64 + subsprite 0, -64, 3, 0, 64x64 + subsprite -64, 0, 3, 0, 64x64 + subsprite 0, 0, 3, 0, 64x64 gSubspriteTables_83ED704:: @ 85A7FC0 -.4byte 4, gUnknown_085A7FB0 + .4byte 4, gUnknown_085A7FB0 gUnknown_085A7FC8:: @ 85A7FC8 -subsprite -32, -12, 1, 0, 32x8 -subsprite 0, -12, 1, 4, 32x8 -subsprite -32, -4, 1, 8, 32x8 -subsprite 0, -4, 1, 12, 32x8 -subsprite -32, 4, 1, 16, 32x8 -subsprite 0, 4, 1, 20, 32x8 + subsprite -32, -12, 1, 0, 32x8 + subsprite 0, -12, 1, 4, 32x8 + subsprite -32, -4, 1, 8, 32x8 + subsprite 0, -4, 1, 12, 32x8 + subsprite -32, 4, 1, 16, 32x8 + subsprite 0, 4, 1, 20, 32x8 gSubspriteTables_83ED73C:: @ 85A7FE0 -.4byte 6, gUnknown_085A7FC8 + .4byte 6, gUnknown_085A7FC8 gUnknown_085A7FE8:: @ 85A7FE8 -subsprite -32, -20, 1, 0, 64x32 -subsprite -32, 12, 1, 32, 32x8 -subsprite 0, 12, 1, 36, 32x8 + subsprite -32, -20, 1, 0, 64x32 + subsprite -32, 12, 1, 32, 32x8 + subsprite 0, 12, 1, 36, 32x8 gSubspriteTables_83ED75C:: @ 85A7FF4 -.4byte 3, gUnknown_085A7FE8 + .4byte 3, gUnknown_085A7FE8 gUnknown_085A7FFC:: @ 85A7FFC -subsprite -32, -24, 1, 0, 64x32 -subsprite -32, 8, 1, 32, 32x8 -subsprite 0, 8, 1, 36, 32x8 -subsprite -32, 16, 1, 40, 32x8 -subsprite 0, 16, 1, 44, 32x8 + subsprite -32, -24, 1, 0, 64x32 + subsprite -32, 8, 1, 32, 32x8 + subsprite 0, 8, 1, 36, 32x8 + subsprite -32, 16, 1, 40, 32x8 + subsprite 0, 16, 1, 44, 32x8 gSubspriteTables_83ED78C:: @ 85A8010 -.4byte 5, gUnknown_085A7FFC + .4byte 5, gUnknown_085A7FFC gUnknown_085A8018:: @ 85A8018 -subsprite -32, -8, 1, 0, 32x8 -subsprite 0, -8, 1, 4, 32x8 -subsprite -32, 0, 1, 8, 32x8 -subsprite 0, 0, 1, 12, 32x8 + subsprite -32, -8, 1, 0, 32x8 + subsprite 0, -8, 1, 4, 32x8 + subsprite -32, 0, 1, 8, 32x8 + subsprite 0, 0, 1, 12, 32x8 gSubspriteTables_83ED7B4:: @ 85A8028 -.4byte 4, gUnknown_085A8018 + .4byte 4, gUnknown_085A8018 gUnknown_085A8030:: @ 85A8030 -subsprite -8, -12, 1, 0, 16x8 -subsprite -8, -4, 1, 0, 16x8 -subsprite -8, 4, 1, 0, 16x8 + subsprite -8, -12, 1, 0, 16x8 + subsprite -8, -4, 1, 0, 16x8 + subsprite -8, 4, 1, 0, 16x8 gSubspriteTables_83ED7D4:: @ 85A803C -.4byte 3, gUnknown_085A8030 + .4byte 3, gUnknown_085A8030 gUnknown_085A8044:: @ 85A8044 -subsprite -32, -24, 3, 0, 64x32 -subsprite -32, 8, 3, 32, 32x8 -subsprite 0, 8, 3, 36, 32x8 -subsprite -32, 16, 3, 40, 32x8 -subsprite 0, 16, 3, 44, 32x8 + subsprite -32, -24, 3, 0, 64x32 + subsprite -32, 8, 3, 32, 32x8 + subsprite 0, 8, 3, 36, 32x8 + subsprite -32, 16, 3, 40, 32x8 + subsprite 0, 16, 3, 44, 32x8 gUnknown_085A8058:: @ 85A8058 -.4byte 5, gUnknown_085A8044 + .4byte 5, gUnknown_085A8044 gUnknown_085A8060:: @ 85A8060 -subsprite -32, -8, 3, 0, 32x8 -subsprite 0, -8, 3, 4, 32x8 -subsprite -32, 0, 3, 8, 32x8 -subsprite 0, 0, 3, 12, 32x8 + subsprite -32, -8, 3, 0, 32x8 + subsprite 0, -8, 3, 4, 32x8 + subsprite -32, 0, 3, 8, 32x8 + subsprite 0, 0, 3, 12, 32x8 gUnknown_085A8070:: @ 85A8070 -.4byte 4, gUnknown_085A8060 + .4byte 4, gUnknown_085A8060 gUnknown_085A8078:: @ 85A8078 -subsprite -32, -8, 3, 0, 32x8 -subsprite 0, -8, 3, 4, 32x8 -subsprite -32, 0, 3, 8, 32x8 -subsprite 0, 0, 3, 12, 32x8 + subsprite -32, -8, 3, 0, 32x8 + subsprite 0, -8, 3, 4, 32x8 + subsprite -32, 0, 3, 8, 32x8 + subsprite 0, 0, 3, 12, 32x8 gUnknown_085A8088:: @ 85A8088 -.4byte 4, gUnknown_085A8078 + .4byte 4, gUnknown_085A8078 gUnknown_085A8090:: @ 85A8090 -subsprite -32, -8, 3, 0, 32x8 -subsprite 0, -8, 3, 4, 32x8 -subsprite -32, 0, 3, 8, 32x8 -subsprite 0, 0, 3, 12, 32x8 + subsprite -32, -8, 3, 0, 32x8 + subsprite 0, -8, 3, 4, 32x8 + subsprite -32, 0, 3, 8, 32x8 + subsprite 0, 0, 3, 12, 32x8 gUnknown_085A80A0:: @ 85A80A0 -.4byte 4, gUnknown_085A8090 + .4byte 4, gUnknown_085A8090 gUnknown_085A80A8:: @ 85A80A8 -subsprite -32, -12, 3, 0, 32x8 -subsprite 0, -12, 3, 4, 32x8 -subsprite -32, -4, 3, 8, 32x8 -subsprite 0, -4, 3, 12, 32x8 -subsprite -32, 4, 3, 16, 32x8 -subsprite 0, 4, 3, 20, 32x8 + subsprite -32, -12, 3, 0, 32x8 + subsprite 0, -12, 3, 4, 32x8 + subsprite -32, -4, 3, 8, 32x8 + subsprite 0, -4, 3, 12, 32x8 + subsprite -32, 4, 3, 16, 32x8 + subsprite 0, 4, 3, 20, 32x8 gUnknown_085A80C0:: @ 85A80C0 -.4byte 6, gUnknown_085A80A8 + .4byte 6, gUnknown_085A80A8 gUnknown_085A80C8:: @ 85A80C8 -subsprite -16, -16, 3, 0, 32x32 + subsprite -16, -16, 3, 0, 32x32 gUnknown_085A80CC:: @ 85A80CC -subsprite -8, -8, 3, 16, 16x16 + subsprite -8, -8, 3, 16, 16x16 gUnknown_085A80D0:: @ 85A80D0 -.4byte 1, gUnknown_085A80C8 + .4byte 1, gUnknown_085A80C8 gUnknown_085A80D8:: @ 85A80D8 -.4byte 1, gUnknown_085A80CC + .4byte 1, gUnknown_085A80CC gUnknown_085A80E0:: @ 85A80E0 -subsprite -24, -24, 3, 0, 32x8 -subsprite 8, -24, 3, 4, 16x8 -subsprite -24, -16, 3, 6, 32x8 -subsprite 8, -16, 3, 10, 16x8 -subsprite -24, -8, 3, 12, 32x8 -subsprite 8, -8, 3, 16, 16x8 -subsprite -24, 0, 3, 18, 32x8 -subsprite 8, 0, 3, 22, 16x8 -subsprite -24, 8, 3, 24, 32x8 -subsprite 8, 8, 3, 28, 16x8 -subsprite -24, 16, 3, 30, 32x8 -subsprite 8, 16, 3, 34, 16x8 + subsprite -24, -24, 3, 0, 32x8 + subsprite 8, -24, 3, 4, 16x8 + subsprite -24, -16, 3, 6, 32x8 + subsprite 8, -16, 3, 10, 16x8 + subsprite -24, -8, 3, 12, 32x8 + subsprite 8, -8, 3, 16, 16x8 + subsprite -24, 0, 3, 18, 32x8 + subsprite 8, 0, 3, 22, 16x8 + subsprite -24, 8, 3, 24, 32x8 + subsprite 8, 8, 3, 28, 16x8 + subsprite -24, 16, 3, 30, 32x8 + subsprite 8, 16, 3, 34, 16x8 gUnknown_085A8110:: @ 85A8110 -.4byte 12, gUnknown_085A80E0 + .4byte 12, gUnknown_085A80E0 gUnknown_085A8118:: @ 85A8118 -subsprite -16, -12, 3, 0, 32x16 -subsprite -16, 4, 3, 8, 16x8 -subsprite 0, 4, 3, 10, 16x8 + subsprite -16, -12, 3, 0, 32x16 + subsprite -16, 4, 3, 8, 16x8 + subsprite 0, 4, 3, 10, 16x8 gUnknown_085A8124:: @ 85A8124 -.4byte 3, gUnknown_085A8118 + .4byte 3, gUnknown_085A8118 gUnknown_085A812C:: @ 85A812C -subsprite -8, -8, 3, 0, 16x8 -subsprite -8, 0, 3, 8, 16x8 + subsprite -8, -8, 3, 0, 16x8 + subsprite -8, 0, 3, 8, 16x8 gUnknown_085A8134:: @ 85A8134 -.4byte 2, gUnknown_085A812C + .4byte 2, gUnknown_085A812C gUnknown_085A813C:: @ 85A813C -subsprite -8, -8, 3, 2, 16x8 -subsprite -8, 0, 3, 10, 16x8 + subsprite -8, -8, 3, 2, 16x8 + subsprite -8, 0, 3, 10, 16x8 gUnknown_085A8144:: @ 85A8144 -.4byte 2, gUnknown_085A813C + .4byte 2, gUnknown_085A813C gUnknown_085A814C:: @ 85A814C -subsprite -8, -8, 3, 4, 16x8 -subsprite -8, 0, 3, 12, 16x8 + subsprite -8, -8, 3, 4, 16x8 + subsprite -8, 0, 3, 12, 16x8 gUnknown_085A8154:: @ 85A8154 -.4byte 2, gUnknown_085A814C + .4byte 2, gUnknown_085A814C gUnknown_085A815C:: @ 85A815C -subsprite -8, -8, 3, 6, 16x8 -subsprite -8, 0, 3, 14, 16x8 + subsprite -8, -8, 3, 6, 16x8 + subsprite -8, 0, 3, 14, 16x8 gUnknown_085A8164:: @ 85A8164 -.4byte 2, gUnknown_085A815C + .4byte 2, gUnknown_085A815C gUnknown_085A816C:: @ 85A816C -subsprite -8, -8, 3, 0, 16x8 -subsprite -8, 0, 3, 8, 16x8 + subsprite -8, -8, 3, 0, 16x8 + subsprite -8, 0, 3, 8, 16x8 gUnknown_085A8174:: @ 85A8174 -.4byte 2, gUnknown_085A816C + .4byte 2, gUnknown_085A816C gUnknown_085A817C:: @ 85A817C -subsprite -4, -8, 3, 2, 8x8 -subsprite -4, 0, 3, 10, 8x8 + subsprite -4, -8, 3, 2, 8x8 + subsprite -4, 0, 3, 10, 8x8 gUnknown_085A8184:: @ 85A8184 -.4byte 2, gUnknown_085A817C + .4byte 2, gUnknown_085A817C gUnknown_085A818C:: @ 85A818C -subsprite -8, -8, 3, 3, 16x8 -subsprite -8, 0, 3, 11, 16x8 + subsprite -8, -8, 3, 3, 16x8 + subsprite -8, 0, 3, 11, 16x8 gUnknown_085A8194:: @ 85A8194 -.4byte 2, gUnknown_085A818C + .4byte 2, gUnknown_085A818C gUnknown_085A819C:: @ 85A819C -subsprite -4, -8, 3, 5, 8x8 -subsprite -4, 0, 3, 13, 8x8 + subsprite -4, -8, 3, 5, 8x8 + subsprite -4, 0, 3, 13, 8x8 gUnknown_085A81A4:: @ 85A81A4 -.4byte 2, gUnknown_085A819C + .4byte 2, gUnknown_085A819C gUnknown_085A81AC:: @ 85A81AC -subsprite -8, -8, 3, 6, 16x8 -subsprite -8, 0, 3, 14, 16x8 + subsprite -8, -8, 3, 6, 16x8 + subsprite -8, 0, 3, 14, 16x8 gUnknown_085A81B4:: @ 85A81B4 -.4byte 2, gUnknown_085A81AC + .4byte 2, gUnknown_085A81AC gUnknown_085A81BC:: @ 85A81BC -subsprite -12, -12, 3, 0, 16x8 -subsprite 4, -12, 3, 2, 8x8 -subsprite -12, -4, 3, 8, 16x8 -subsprite 4, -4, 3, 10, 8x8 -subsprite -12, 4, 3, 16, 16x8 -subsprite 4, 4, 3, 18, 8x8 + subsprite -12, -12, 3, 0, 16x8 + subsprite 4, -12, 3, 2, 8x8 + subsprite -12, -4, 3, 8, 16x8 + subsprite 4, -4, 3, 10, 8x8 + subsprite -12, 4, 3, 16, 16x8 + subsprite 4, 4, 3, 18, 8x8 gUnknown_085A81D4:: @ 85A81D4 -.4byte 6, gUnknown_085A81BC + .4byte 6, gUnknown_085A81BC gUnknown_085A81DC:: @ 85A81DC -subsprite -8, -12, 3, 3, 16x8 -subsprite -8, -4, 3, 11, 16x8 -subsprite -8, 4, 3, 19, 16x8 + subsprite -8, -12, 3, 3, 16x8 + subsprite -8, -4, 3, 11, 16x8 + subsprite -8, 4, 3, 19, 16x8 gUnknown_085A81E8:: @ 85A81E8 -.4byte 3, gUnknown_085A81DC + .4byte 3, gUnknown_085A81DC gUnknown_085A81F0:: @ 85A81F0 -subsprite -12, -12, 3, 5, 16x8 -subsprite 4, -12, 3, 7, 8x8 -subsprite -12, -4, 3, 13, 16x8 -subsprite 4, -4, 3, 15, 8x8 -subsprite -12, 4, 3, 21, 16x8 -subsprite 4, 4, 3, 0x17, 8x8 + subsprite -12, -12, 3, 5, 16x8 + subsprite 4, -12, 3, 7, 8x8 + subsprite -12, -4, 3, 13, 16x8 + subsprite 4, -4, 3, 15, 8x8 + subsprite -12, 4, 3, 21, 16x8 + subsprite 4, 4, 3, 0x17, 8x8 gUnknown_085A8208:: @ 85A8208 -.4byte 6, gUnknown_085A81F0 + .4byte 6, gUnknown_085A81F0 gUnknown_085A8210:: @ 85A8210 -subsprite -12, -12, 3, 0, 16x8 -subsprite 4, -12, 3, 2, 8x8 -subsprite -12, -4, 3, 8, 16x8 -subsprite 4, -4, 3, 10, 8x8 -subsprite -12, 4, 3, 16, 16x8 -subsprite 4, 4, 3, 18, 8x8 + subsprite -12, -12, 3, 0, 16x8 + subsprite 4, -12, 3, 2, 8x8 + subsprite -12, -4, 3, 8, 16x8 + subsprite 4, -4, 3, 10, 8x8 + subsprite -12, 4, 3, 16, 16x8 + subsprite 4, 4, 3, 18, 8x8 gUnknown_085A8228:: @ 85A8228 -.4byte 6, gUnknown_085A8210 + .4byte 6, gUnknown_085A8210 gUnknown_085A822C:: @ 85A822C -subsprite -8, -12, 3, 3, 16x8 -subsprite -8, -4, 3, 11, 16x8 -subsprite -8, 4, 3, 19, 16x8 + subsprite -8, -12, 3, 3, 16x8 + subsprite -8, -4, 3, 11, 16x8 + subsprite -8, 4, 3, 19, 16x8 gUnknown_085A823C:: @ 85A823C -.4byte 3, gUnknown_085A822C + .4byte 3, gUnknown_085A822C gUnknown_085A8244:: @ 85A8244 -subsprite -12, -12, 3, 5, 16x8 -subsprite 4, -12, 3, 7, 8x8 -subsprite -12, -4, 3, 13, 16x8 -subsprite 4, -4, 3, 15, 8x8 -subsprite -12, 4, 3, 21, 16x8 -subsprite 4, 4, 3, 23, 8x8 + subsprite -12, -12, 3, 5, 16x8 + subsprite 4, -12, 3, 7, 8x8 + subsprite -12, -4, 3, 13, 16x8 + subsprite 4, -4, 3, 15, 8x8 + subsprite -12, 4, 3, 21, 16x8 + subsprite 4, 4, 3, 23, 8x8 gUnknown_085A825C:: @ 85A825C -.4byte 6, gUnknown_085A8244 + .4byte 6, gUnknown_085A8244 gUnknown_083EDB5C:: @ 85A8264 -.4byte gUnknown_085A7E48 -.4byte gUnknown_085A7E60 -.4byte gUnknown_085A7E78 -.4byte gUnknown_085A7EA8 -.4byte gUnknown_085A7EC0 -.4byte gUnknown_085A7F20 -.4byte gUnknown_085A7F38 -.4byte gUnknown_085A7F50 -.4byte gUnknown_085A7F68 -.4byte gUnknown_085A7F80 -.4byte gUnknown_085A7E90 -.4byte gUnknown_085A7E90 -.4byte gUnknown_085A7E90 -.4byte gUnknown_085A7E90 -.4byte gUnknown_085A7ED8 -.4byte gUnknown_085A7ED8 -.4byte gUnknown_085A7ED8 -.4byte gUnknown_085A7ED8 -.4byte gUnknown_085A7ED8 -.4byte gUnknown_085A7EF0 -.4byte gUnknown_085A7EF0 -.4byte gUnknown_085A7EF0 -.4byte gUnknown_085A7F08 -.4byte gUnknown_085A7F08 -.4byte gUnknown_085A7F08 -.4byte gDummySpriteTemplate + .4byte gUnknown_085A7E48 + .4byte gUnknown_085A7E60 + .4byte gUnknown_085A7E78 + .4byte gUnknown_085A7EA8 + .4byte gUnknown_085A7EC0 + .4byte gUnknown_085A7F20 + .4byte gUnknown_085A7F38 + .4byte gUnknown_085A7F50 + .4byte gUnknown_085A7F68 + .4byte gUnknown_085A7F80 + .4byte gUnknown_085A7E90 + .4byte gUnknown_085A7E90 + .4byte gUnknown_085A7E90 + .4byte gUnknown_085A7E90 + .4byte gUnknown_085A7ED8 + .4byte gUnknown_085A7ED8 + .4byte gUnknown_085A7ED8 + .4byte gUnknown_085A7ED8 + .4byte gUnknown_085A7ED8 + .4byte gUnknown_085A7EF0 + .4byte gUnknown_085A7EF0 + .4byte gUnknown_085A7EF0 + .4byte gUnknown_085A7F08 + .4byte gUnknown_085A7F08 + .4byte gUnknown_085A7F08 + .4byte gDummySpriteTemplate gUnknown_083EDBC4:: @ 85A82CC -.4byte gUnknown_085A8058 -.4byte gUnknown_085A8070 -.4byte gUnknown_085A8088 -.4byte gUnknown_085A80C0 -.4byte NULL -.4byte NULL -.4byte gUnknown_085A80D0 -.4byte NULL -.4byte gUnknown_085A8110 -.4byte gUnknown_085A8124 -.4byte gUnknown_085A8134 -.4byte gUnknown_085A8144 -.4byte gUnknown_085A8154 -.4byte gUnknown_085A8164 -.4byte gUnknown_085A8174 -.4byte gUnknown_085A8184 -.4byte gUnknown_085A8194 -.4byte gUnknown_085A81A4 -.4byte gUnknown_085A81B4 -.4byte gUnknown_085A81D4 -.4byte gUnknown_085A81E8 -.4byte gUnknown_085A8208 -.4byte gUnknown_085A8228 -.4byte gUnknown_085A823C -.4byte gUnknown_085A825C -.4byte NULL + .4byte gUnknown_085A8058 + .4byte gUnknown_085A8070 + .4byte gUnknown_085A8088 + .4byte gUnknown_085A80C0 + .4byte NULL + .4byte NULL + .4byte gUnknown_085A80D0 + .4byte NULL + .4byte gUnknown_085A8110 + .4byte gUnknown_085A8124 + .4byte gUnknown_085A8134 + .4byte gUnknown_085A8144 + .4byte gUnknown_085A8154 + .4byte gUnknown_085A8164 + .4byte gUnknown_085A8174 + .4byte gUnknown_085A8184 + .4byte gUnknown_085A8194 + .4byte gUnknown_085A81A4 + .4byte gUnknown_085A81B4 + .4byte gUnknown_085A81D4 + .4byte gUnknown_085A81E8 + .4byte gUnknown_085A8208 + .4byte gUnknown_085A8228 + .4byte gUnknown_085A823C + .4byte gUnknown_085A825C + .4byte NULL -.align 2 -sSlotMachineSpriteSheets:: @ 85A8334 -obj_tiles gSlotMachineReelSymbol1Tiles, 0x0200, 0x0000 -obj_tiles gSlotMachineReelSymbol2Tiles, 0x0200, 0x0001 -obj_tiles gSlotMachineReelSymbol3Tiles, 0x0200, 0x0002 -obj_tiles gSlotMachineReelSymbol4Tiles, 0x0200, 0x0003 -obj_tiles gSlotMachineReelSymbol5Tiles, 0x0200, 0x0004 -obj_tiles gSlotMachineReelSymbol6Tiles, 0x0200, 0x0005 -obj_tiles gSlotMachineReelSymbol7Tiles, 0x0200, 0x0006 -obj_tiles gSlotMachineNumber0Tiles, 0x0040, 0x0007 -obj_tiles gSlotMachineNumber1Tiles, 0x0040, 0x0008 -obj_tiles gSlotMachineNumber2Tiles, 0x0040, 0x0009 -obj_tiles gSlotMachineNumber3Tiles, 0x0040, 0x000A -obj_tiles gSlotMachineNumber4Tiles, 0x0040, 0x000B -obj_tiles gSlotMachineNumber5Tiles, 0x0040, 0x000C -obj_tiles gSlotMachineNumber6Tiles, 0x0040, 0x000D -obj_tiles gSlotMachineNumber7Tiles, 0x0040, 0x000E -obj_tiles gSlotMachineNumber8Tiles, 0x0040, 0x000F -obj_tiles gSlotMachineNumber9Tiles, 0x0040, 0x0010 + .align 2 +gSlotMachineSpriteSheets:: @ 85A8334 + obj_tiles gSlotMachineReelSymbol1Tiles, 0x0200, 0x0000 + obj_tiles gSlotMachineReelSymbol2Tiles, 0x0200, 0x0001 + obj_tiles gSlotMachineReelSymbol3Tiles, 0x0200, 0x0002 + obj_tiles gSlotMachineReelSymbol4Tiles, 0x0200, 0x0003 + obj_tiles gSlotMachineReelSymbol5Tiles, 0x0200, 0x0004 + obj_tiles gSlotMachineReelSymbol6Tiles, 0x0200, 0x0005 + obj_tiles gSlotMachineReelSymbol7Tiles, 0x0200, 0x0006 + obj_tiles gSlotMachineNumber0Tiles, 0x0040, 0x0007 + obj_tiles gSlotMachineNumber1Tiles, 0x0040, 0x0008 + obj_tiles gSlotMachineNumber2Tiles, 0x0040, 0x0009 + obj_tiles gSlotMachineNumber3Tiles, 0x0040, 0x000A + obj_tiles gSlotMachineNumber4Tiles, 0x0040, 0x000B + obj_tiles gSlotMachineNumber5Tiles, 0x0040, 0x000C + obj_tiles gSlotMachineNumber6Tiles, 0x0040, 0x000D + obj_tiles gSlotMachineNumber7Tiles, 0x0040, 0x000E + obj_tiles gSlotMachineNumber8Tiles, 0x0040, 0x000F + obj_tiles gSlotMachineNumber9Tiles, 0x0040, 0x0010 -.align 2 -.byte 0, 0, 0, 0, 0, 2, 0x12, 0, 0, 0, 0, 0, 0, 2, 0x13, 0, 0, 0, 0, 0, 0, 3, 0x14, 0, 0, 0, 0, 0, 0, 3, 0x15, 0, 0, 0, 0, 0, 0, 0, 0, 0 + .align 2 + .byte 0, 0, 0, 0, 0, 2, 0x12, 0, 0, 0, 0, 0, 0, 2, 0x13, 0, 0, 0, 0, 0, 0, 3, 0x14, 0, 0, 0, 0, 0, 0, 3, 0x15, 0, 0, 0, 0, 0, 0, 0, 0, 0 gUnknown_083EDCDC:: @ 85A83E4 -.4byte gUnknown_08DD19F8 -@ might be a palette idk -.byte 0x7B, 0x6F, 0x68, 0x69, 0xAB, 0x36, 0xFF, 0x7F, 0x50, 0x57, 0xC0, 0x7E, 0xBA, 2, 0xBA, 2, 0xFD, 1, 0xFD, 1 + .4byte gUnknown_08DD19F8 + @ might be a palette idk + .byte 0x7B, 0x6F, 0x68, 0x69, 0xAB, 0x36, 0xFF, 0x7F, 0x50, 0x57, 0xC0, 0x7E, 0xBA, 2, 0xBA, 2, 0xFD, 1, 0xFD, 1 gUnknown_085A83FC:: @ 85A83FC -.byte 0x91, 0x7F + .byte 0x91, 0x7F gUnknown_085A83FE:: @ 85A83FE -.byte 0xBF, 0x43 + .byte 0xBF, 0x43 gUnknown_085A8400:: @ 85A8400 -.byte 0xBF, 0x43 + .byte 0xBF, 0x43 gUnknown_085A8402:: @ 85A8402 -.byte 0xBF, 0x4A + .byte 0xBF, 0x4A gUnknown_085A8404:: @ 85A8404 -.byte 0xBF, 0x4A, 0, 0 + .byte 0xBF, 0x4A, 0, 0 gUnknown_083EDD08:: @ 85A8408 -.4byte gUnknown_085A83FC -.4byte gUnknown_085A83FE -.4byte gUnknown_085A8400 -.4byte gUnknown_085A8402 -.4byte gUnknown_085A8404 + .4byte gUnknown_085A83FC + .4byte gUnknown_085A83FE + .4byte gUnknown_085A8400 + .4byte gUnknown_085A8402 + .4byte gUnknown_085A8404 gUnknown_083EDD1C:: @ 85A841C -.4byte gSlotMachineMenu_Pal + 0x94 -.4byte gSlotMachineMenu_Pal + 0x96 -.4byte gSlotMachineMenu_Pal + 0x98 -.4byte gSlotMachineMenu_Pal + 0x9A -.4byte gSlotMachineMenu_Pal + 0x9C + .4byte gSlotMachineMenu_Pal + 0x94 + .4byte gSlotMachineMenu_Pal + 0x96 + .4byte gSlotMachineMenu_Pal + 0x98 + .4byte gSlotMachineMenu_Pal + 0x9A + .4byte gSlotMachineMenu_Pal + 0x9C gUnknown_083EDD30:: @ 85A8430 -.byte 0x4A, 0x4B, 0x4C, 0x4E, 0x4D + .byte 0x4A, 0x4B, 0x4C, 0x4E, 0x4D gBettingTilesId:: @ 85A8435 -.byte 0, 0 -.byte 1, 2 -.byte 3, 4 + .byte 0, 0 + .byte 1, 2 + .byte 3, 4 gNumberBettingTiles:: @ 85A843B -.byte 1, 2, 2 + .byte 1, 2, 2 gUnknown_085A843E:: @ 85A843E -.incbin "graphics/slot_machine/85A843E.gbapal" + .incbin "graphics/slot_machine/85A843E.gbapal" gUnknown_085A845E:: @ 85A845E -.incbin "graphics/slot_machine/85A845E.gbapal" + .incbin "graphics/slot_machine/85A845E.gbapal" gUnknown_085A847E:: @ 85A847E -.incbin "graphics/slot_machine/85A847E.gbapal" + .incbin "graphics/slot_machine/85A847E.gbapal" -.align 2 + .align 2 gUnknown_083EDDA0:: @ 85A84A0 -.4byte gUnknown_085A843E -.4byte gUnknown_085A845E -.4byte gUnknown_085A847E + .4byte gUnknown_085A843E + .4byte gUnknown_085A845E + .4byte gUnknown_085A847E gUnknown_083EDDAC:: @ 85A84AC -.4byte gSlotMachineMenu_Pal + 0x20 + .4byte gSlotMachineMenu_Pal + 0x20 gUnknown_085A84B0:: @ 85A84B0 -.incbin "graphics/slot_machine/85A84B0.gbapal" + .incbin "graphics/slot_machine/85A84B0.gbapal" gUnknown_085A84D0:: @ 85A84D0 -.incbin "graphics/slot_machine/85A84D0.gbapal" + .incbin "graphics/slot_machine/85A84D0.gbapal" gUnknown_085A84F0:: @ 85A84F0 -.incbin "graphics/slot_machine/85A84F0.gbapal" + .incbin "graphics/slot_machine/85A84F0.gbapal" gUnknown_083EDE10:: @ 85A8510 -.4byte gUnknown_085A84B0 -.4byte gUnknown_085A84D0 -.4byte gUnknown_085A84F0 -.4byte gUnknown_08DCF230 + .4byte gUnknown_085A84B0 + .4byte gUnknown_085A84D0 + .4byte gUnknown_085A84F0 + .4byte gUnknown_08DCF230 gUnknown_083EDE20:: @ 85A8520 -.4byte gUnknown_08DCF230 + .4byte gUnknown_08DCF230 gPalette_83EDE24:: @ 85A8524 -.incbin "graphics/slot_machine/85A8524.bin" + .incbin "graphics/slot_machine/85A8524.bin" -.align 2 + .align 2 gSlotMachineSpritePalettes:: @ 85A8544 -obj_pal gUnknown_08DCF170, 0 -obj_pal gUnknown_08DCF190, 1 -obj_pal gUnknown_08DCF1B0, 2 -obj_pal gSlotMachineReelTime_Pal, 3 -obj_pal gUnknown_08DCF1F0, 4 -obj_pal gUnknown_08DCF210, 5 -obj_pal gUnknown_08DCF230, 6 -obj_pal gUnknown_08DCF1F0, 7 -null_obj_pal + obj_pal gUnknown_08DCF170, 0 + obj_pal gUnknown_08DCF190, 1 + obj_pal gUnknown_08DCF1B0, 2 + obj_pal gSlotMachineReelTime_Pal, 3 + obj_pal gUnknown_08DCF1F0, 4 + obj_pal gUnknown_08DCF210, 5 + obj_pal gUnknown_08DCF230, 6 + obj_pal gUnknown_08DCF1F0, 7 + null_obj_pal -sReelTimeGfx:: @ 85A858C -.incbin "graphics/slot_machine/reel_time_gfx.4bpp.lz" +gReelTimeGfx:: @ 85A858C + .incbin "graphics/slot_machine/reel_time_gfx.4bpp.lz" -sReelTimeWindowTilemap:: @ 85A96E0 -@if anyone knows what this tilemap is please do share -.incbin "graphics/slot_machine/85A96E0.bin" +gReelTimeWindowTilemap:: @ 85A96E0 + @if anyone knows what this tilemap is please do share + .incbin "graphics/slot_machine/85A96E0.bin" gUnknown_085A9898:: @ 85A9898 -.4byte NULL + .4byte NULL diff --git a/include/slot_machine.h b/include/slot_machine.h index 84622d914..d441b7411 100644 --- a/include/slot_machine.h +++ b/include/slot_machine.h @@ -15,11 +15,6 @@ #define LUCKY_BIAS_MIXED_777 (1 << 6) #define LUCKY_BIAS_777 (1 << 7) -// Rows -#define SLOT_TOP_ROW 0x0001 -#define SLOT_MIDDLE_ROW 0x0002 -#define SLOT_BOTTOM_ROW 0x0003 - void PlaySlotMachine(u8, void (callback)(void)); #endif // GUARD_SLOT_MACHINE_H From 189d387f01104a715d788690fbc76d987ea3d6e1 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Fri, 22 Feb 2019 03:08:48 -0500 Subject: [PATCH 13/14] Add macros for metatile manipulation --- asm/macros/event.inc | 4 ++-- include/global.fieldmap.h | 11 +++++++++-- src/battle_pyramid.c | 4 ++-- src/bg.c | 4 ++-- src/decoration.c | 16 ++++++++-------- src/field_effect.c | 2 +- src/field_specials.c | 12 ++++++------ src/fieldmap.c | 37 +++++++++++++++++++------------------ src/fldeff_escalator.c | 14 +++++++------- src/scrcmd.c | 6 +++--- src/secret_base.c | 16 ++++++++-------- src/tv.c | 5 +++-- 12 files changed, 70 insertions(+), 61 deletions(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index fa0b3fa06..fa27d049e 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -1163,12 +1163,12 @@ .endm @ Changes the metatile at (x, y) on the current map. - .macro setmetatile x:req, y:req, metatile_number:req, tile_attrib:req + .macro setmetatile x:req, y:req, metatile_number:req, is_impassable:req .byte 0xa2 .2byte \x .2byte \y .2byte \metatile_number - .2byte \tile_attrib + .2byte \is_impassable .endm @ Queues a weather change to the default weather for the map. diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 74a8363bb..2b85a02d1 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -1,6 +1,13 @@ #ifndef GUARD_GLOBAL_FIELDMAP_H #define GUARD_GLOBAL_FIELDMAP_H +#define MAP_IMPASSABLE_MASK 0x0C00 +#define MAP_METATILE_ID_MASK 0x03FF +#define MAP_UNDEFINED_METATILE_ID 0x03FF +#define MAP_TILE_ELEVATION_SHIFT 12 +#define MAP_IMPASSABLE_SHIFT 10 +#define MAP_TILE_ELEVATION_MASK 0xF000 + enum { CONNECTION_SOUTH = 1, @@ -19,8 +26,8 @@ struct Tileset /*0x01*/ bool8 isSecondary; /*0x04*/ void *tiles; /*0x08*/ void *palettes; - /*0x0c*/ void *metatiles; - /*0x10*/ void *metatileAttributes; + /*0x0c*/ u16 *metatiles; + /*0x10*/ u16 *metatileAttributes; /*0x14*/ TilesetCB callback; }; diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 340c17c59..92ff257b0 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -1267,7 +1267,7 @@ static u8 GetPostBattleDirectionHintTextIndex(int *hintType, u8 minDistanceForEx { for (x = 0; x < 32; x++) { - if ((map[x] & 0x3FF) == FLOOR_EXIT_METATILE) + if ((map[x] & MAP_METATILE_ID_MASK) == FLOOR_EXIT_METATILE) { x += 7 - gEventObjects[gSelectedEventObject].initialCoords.x; y += 7 - gEventObjects[gSelectedEventObject].initialCoords.y; @@ -1568,7 +1568,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio { for (x = 0; x < mapLayout->width; x++) { - if ((layoutMap[x] & 0x3FF) != FLOOR_EXIT_METATILE) + if ((layoutMap[x] & MAP_METATILE_ID_MASK) != FLOOR_EXIT_METATILE) { map[x] = layoutMap[x]; } diff --git a/src/bg.c b/src/bg.c index f73f5998d..571518650 100644 --- a/src/bg.c +++ b/src/bg.c @@ -1056,7 +1056,7 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt for (x16 = x; x16 < (x + width); x16++) { CopyTileMapEntry(&firstTileNum, &((u16*)sGpuBgConfigs2[bg].tilemap)[(u16)GetTileMapIndexFromCoords(x16, y16, attribute, mode, mode2)], paletteSlot, 0, 0); - firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & 0x3FF); + firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & MAP_METATILE_ID_MASK); } } break; @@ -1067,7 +1067,7 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt for (x16 = x; x16 < (x + width); x16++) { ((u8*)sGpuBgConfigs2[bg].tilemap)[(y16 * mode3) + x16] = firstTileNum; - firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & 0x3FF); + firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & MAP_METATILE_ID_MASK); } } break; diff --git a/src/decoration.c b/src/decoration.c index 2ac49b98c..e5f3b6d46 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -1158,7 +1158,7 @@ void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor) u16 i; u16 j; u16 behavior; - u16 flags; + u16 impassableFlag; u16 v0; u16 v1; s16 decLeft; @@ -1173,11 +1173,11 @@ void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor) behavior = GetBehaviorByMetatileId(0x200 + gDecorations[decor].tiles[i * decWidth + j]); if (MetatileBehavior_IsSecretBaseImpassable(behavior) == TRUE || (gDecorations[decor].permission != DECORPERM_PASS_FLOOR && (behavior >> 12))) { - flags = 0xc00; + impassableFlag = MAP_IMPASSABLE_MASK; } else { - flags = 0x000; + impassableFlag = 0x000; } if (gDecorations[decor].permission != DECORPERM_NA_WALL && MetatileBehavior_IsSecretBaseNorthWall(MapGridGetMetatileBehaviorAt(decLeft, decBottom)) == TRUE) { @@ -1190,11 +1190,11 @@ void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor) v1 = sub_8127B54(gDecorations[decor].id, i * decWidth + j); if (v1 != 0xFFFF) { - MapGridSetMetatileEntryAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | flags | v1); + MapGridSetMetatileEntryAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | impassableFlag | v1); } else { - MapGridSetMetatileIdAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | flags); + MapGridSetMetatileIdAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | impassableFlag); } } } @@ -1502,7 +1502,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration) { curX = gTasks[taskId].data[0] + j; behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY); - behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & 0xf000; + behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & MAP_TILE_ELEVATION_MASK; if (!sub_81284F4(behaviorAt, decoration)) { return FALSE; @@ -1527,7 +1527,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration) { curX = gTasks[taskId].data[0] + j; behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY); - behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & 0xf000; + behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & MAP_TILE_ELEVATION_MASK; if (!MetatileBehavior_IsNormal(behaviorAt) && !sub_8128484(behaviorAt, behaviorBy)) { return FALSE; @@ -1547,7 +1547,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration) { curX = gTasks[taskId].data[0] + j; behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY); - behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[j]) & 0xf000; + behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[j]) & MAP_TILE_ELEVATION_MASK; if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsSecretBaseNorthWall(behaviorAt)) { return FALSE; diff --git a/src/field_effect.c b/src/field_effect.c index e7c0b39b9..07a7f9caf 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -2620,7 +2620,7 @@ static void sub_80B8874(u16 offs) dest = (u16 *)(VRAM + 0x140 + offs); for (i = 0; i < 0x140; i++, dest++) { - *dest = gFieldMoveStreaksTilemap[i] | 0xf000; + *dest = gFieldMoveStreaksTilemap[i] | MAP_TILE_ELEVATION_MASK; } } diff --git a/src/field_specials.c b/src/field_specials.c index 307f81399..c7d1f4367 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -887,8 +887,8 @@ static void PetalburgGymFunc(u8 a0, u16 a1) } for (i = 0; i < nDoors; i++) { - MapGridSetMetatileIdAt(x[i] + 7, y[i] + 7, a1 | 0xc00); - MapGridSetMetatileIdAt(x[i] + 7, y[i] + 8, (a1 + 8) | 0xc00); + MapGridSetMetatileIdAt(x[i] + 7, y[i] + 7, a1 | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x[i] + 7, y[i] + 8, (a1 + 8) | MAP_IMPASSABLE_MASK); } DrawWholeMapView(); } @@ -1100,7 +1100,7 @@ static void PCTurnOnEffect_1(s16 flag, s8 dx, s8 dy) tileId = 0x27e; } } - MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | 0xc00); + MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | MAP_IMPASSABLE_MASK); } void DoPCTurnOffEffect(void) @@ -1141,7 +1141,7 @@ static void PCTurnOffEffect(void) { tileId = 0x259; } - MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | 0xc00); + MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | MAP_IMPASSABLE_MASK); DrawWholeMapView(); } @@ -1892,7 +1892,7 @@ static void sub_8139C80(u8 taskId) { for (x = 0; x < 3; x++) { - MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2BF4[y][data[0] % 3] | 0xC00); + MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2BF4[y][data[0] % 3] | MAP_IMPASSABLE_MASK); } } } @@ -1902,7 +1902,7 @@ static void sub_8139C80(u8 taskId) { for (x = 0; x < 3; x++) { - MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2C06[y][data[0] % 3] | 0xC00); + MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2C06[y][data[0] % 3] | MAP_IMPASSABLE_MASK); } } } diff --git a/src/fieldmap.c b/src/fieldmap.c index cf5f0356e..8131fb01b 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -383,15 +383,15 @@ u8 MapGridGetZCoordAt(int x, int y) i = (x + 1) & 1; i += ((y + 1) & 1) * 2; block = gMapHeader.mapLayout->border[i]; - block |= 0xc00; + block |= MAP_IMPASSABLE_MASK; } - if (block == 0x3ff) + if (block == MAP_UNDEFINED_METATILE_ID) { return 0; } - return block >> 12; + return block >> MAP_TILE_ELEVATION_SHIFT; } u8 MapGridIsImpassableAt(int x, int y) @@ -411,13 +411,13 @@ u8 MapGridIsImpassableAt(int x, int y) i = (x + 1) & 1; i += ((y + 1) & 1) * 2; block = gMapHeader.mapLayout->border[i]; - block |= 0xc00; + block |= MAP_IMPASSABLE_MASK; } - if (block == 0x3ff) + if (block == MAP_UNDEFINED_METATILE_ID) { return 1; } - return (block & 0xc00) >> 10; + return (block & MAP_IMPASSABLE_MASK) >> MAP_IMPASSABLE_SHIFT; } u32 MapGridGetMetatileIdAt(int x, int y) @@ -439,18 +439,19 @@ u32 MapGridGetMetatileIdAt(int x, int y) mapLayout = gMapHeader.mapLayout; i = (x + 1) & 1; i += ((y + 1) & 1) * 2; - block = mapLayout->border[i] | 0xc00; + block = mapLayout->border[i] | MAP_IMPASSABLE_MASK; } - if (block == 0x3ff) + if (block == MAP_UNDEFINED_METATILE_ID) { border = gMapHeader.mapLayout->border; j = (x + 1) & 1; j += ((y + 1) & 1) * 2; block2 = gMapHeader.mapLayout->border[j]; - block2 |= 0xc00; - return block2 & block; + // This OR is completely pointless. + block2 |= MAP_IMPASSABLE_MASK; + return block2 & MAP_METATILE_ID_MASK; } - return block & 0x3ff; + return block & MAP_METATILE_ID_MASK; } u32 MapGridGetMetatileBehaviorAt(int x, int y) @@ -464,7 +465,7 @@ u8 MapGridGetMetatileLayerTypeAt(int x, int y) { u16 metatile; metatile = MapGridGetMetatileIdAt(x, y); - return (GetBehaviorByMetatileId(metatile) & 0xf000) >> 12; + return (GetBehaviorByMetatileId(metatile) & MAP_TILE_ELEVATION_MASK) >> MAP_TILE_ELEVATION_SHIFT; } void MapGridSetMetatileIdAt(int x, int y, u16 metatile) @@ -474,7 +475,7 @@ void MapGridSetMetatileIdAt(int x, int y, u16 metatile) && y >= 0 && y < gBackupMapLayout.height) { i = x + y * gBackupMapLayout.width; - gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & 0xf000) | (metatile & 0xfff); + gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & MAP_TILE_ELEVATION_MASK) | (metatile & ~MAP_TILE_ELEVATION_MASK); } } @@ -654,7 +655,7 @@ int GetMapBorderIdAt(int x, int y) i = gBackupMapLayout.width; i *= y; block = gBackupMapLayout.map[x + i]; - if (block == 0x3ff) + if (block == MAP_UNDEFINED_METATILE_ID) { goto fail; } @@ -664,8 +665,8 @@ int GetMapBorderIdAt(int x, int y) mapLayout = gMapHeader.mapLayout; j = (x + 1) & 1; j += ((y + 1) & 1) * 2; - block2 = 0xc00 | mapLayout->border[j]; - if (block2 == 0x3ff) + block2 = MAP_IMPASSABLE_MASK | mapLayout->border[j]; + if (block2 == MAP_UNDEFINED_METATILE_ID) { goto fail; } @@ -921,7 +922,7 @@ void sub_8088B94(int x, int y, int a2) if (x >= 0 && x < gBackupMapLayout.width && y >= 0 && y < gBackupMapLayout.height) { if (a2 != 0) - gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= 0xC00; + gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= MAP_IMPASSABLE_MASK; else gBackupMapLayout.map[x + gBackupMapLayout.width * y] &= 0xF3FF; } @@ -937,7 +938,7 @@ static bool8 SkipCopyingMetatileFromSavedMap(u16* mapMetatilePtr, u16 mapWidth, else mapMetatilePtr += mapWidth; - if (sub_80FADE4(*mapMetatilePtr & 0x3FF, yMode) == 1) + if (sub_80FADE4(*mapMetatilePtr & MAP_METATILE_ID_MASK, yMode) == 1) return TRUE; return FALSE; } diff --git a/src/fldeff_escalator.c b/src/fldeff_escalator.c index 3d00fb162..4a1fb0fd5 100644 --- a/src/fldeff_escalator.c +++ b/src/fldeff_escalator.c @@ -7,7 +7,7 @@ static EWRAM_DATA u8 sEscalatorAnim_TaskId = 0; -static void sub_80E12E8(u8 taskId, const s16 *list, u16 c) +static void sub_80E12E8(u8 taskId, const s16 *list, u16 isImpassableFlag) { s16 r5 = gTasks[taskId].data[4] - 1; s16 r3 = gTasks[taskId].data[5] - 1; @@ -26,9 +26,9 @@ static void sub_80E12E8(u8 taskId, const s16 *list, u16 c) if (list[r4] == metatileId) { if (r4 != 2) - MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[r4 + 1]); + MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[r4 + 1]); else - MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[0]); + MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[0]); } } } @@ -44,9 +44,9 @@ static void sub_80E12E8(u8 taskId, const s16 *list, u16 c) if (list[2 - r4] == metatileId) { if (r4 != 2) - MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[1 - r4]); + MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[1 - r4]); else - MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[2]); + MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[2]); } } } @@ -76,13 +76,13 @@ static void sub_80E1444(u8 taskId) sub_80E12E8(taskId, gUnknown_08589AC0, 0); break; case 2: - sub_80E12E8(taskId, gUnknown_08589AC6, 0xC00); + sub_80E12E8(taskId, gUnknown_08589AC6, MAP_IMPASSABLE_MASK); break; case 3: sub_80E12E8(taskId, gUnknown_08589ACC, 0); break; case 4: - sub_80E12E8(taskId, gUnknown_08589AD2, 0xC00); + sub_80E12E8(taskId, gUnknown_08589AD2, MAP_IMPASSABLE_MASK); break; case 5: sub_80E12E8(taskId, gUnknown_08589AD8, 0); diff --git a/src/scrcmd.c b/src/scrcmd.c index 51d96ff2e..9bafac41a 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -2028,14 +2028,14 @@ bool8 ScrCmd_setmetatile(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); u16 tileId = VarGet(ScriptReadHalfword(ctx)); - u16 v8 = VarGet(ScriptReadHalfword(ctx)); + u16 isImpassable = VarGet(ScriptReadHalfword(ctx)); x += 7; y += 7; - if (!v8) + if (!isImpassable) MapGridSetMetatileIdAt(x, y, tileId); else - MapGridSetMetatileIdAt(x, y, tileId | 0xC00); + MapGridSetMetatileIdAt(x, y, tileId | MAP_IMPASSABLE_MASK); return FALSE; } diff --git a/src/secret_base.c b/src/secret_base.c index adcab9cbc..488f49377 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -259,7 +259,7 @@ void sub_80E8CB0(s16 *xPtr, s16 *yPtr, u16 tile) { for (x = 0; x < mapLayout->width; x ++) { - if ((mapLayout->map[y * mapLayout->width + x] & 0x3ff) == tile) + if ((mapLayout->map[y * mapLayout->width + x] & MAP_METATILE_ID_MASK) == tile) { *xPtr = x; *yPtr = y; @@ -282,7 +282,7 @@ void sub_80E8D4C(void) { if (gUnknown_0858CFCC[i].tile1 == tile) { - MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | 0xC00); + MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | MAP_IMPASSABLE_MASK); CurrentMapDrawMetatileAt(x, y); return; } @@ -291,7 +291,7 @@ void sub_80E8D4C(void) { if (gUnknown_0858CFCC[i].tile2 == tile) { - MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile1 | 0xC00); + MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile1 | MAP_IMPASSABLE_MASK); CurrentMapDrawMetatileAt(x, y); return; } @@ -352,7 +352,7 @@ void sub_80E8EE0(struct MapEvents const *events) { if (gUnknown_0858CFCC[i].tile1 == tile_id) { - MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | 0xc00); + MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | MAP_IMPASSABLE_MASK); break; } } @@ -434,7 +434,7 @@ void sub_80E9108(void) sub_80E8CB0(&x, &y, 0x220); x += 7; y += 7; - MapGridSetMetatileIdAt(x, y, 0x220 | 0xC00); + MapGridSetMetatileIdAt(x, y, 0x220 | MAP_IMPASSABLE_MASK); CurrentMapDrawMetatileAt(x, y); pal_fill_black(); CreateTask(sub_80E90C8, 0); @@ -492,12 +492,12 @@ void sub_80E9238(u8 flagIn) if (curBaseId != 0) { sub_80E8CB0(&x, &y, 0x220); - MapGridSetMetatileIdAt(x + 7, y + 7, 0x221 | 0xc00); + MapGridSetMetatileIdAt(x + 7, y + 7, 0x221 | MAP_IMPASSABLE_MASK); } else if (flagIn == 1 && VarGet(VAR_0x4089) == 1) { sub_80E8CB0(&x, &y, 0x220); - MapGridSetMetatileIdAt(x + 7, y + 7, 0x20a | 0xc00); + MapGridSetMetatileIdAt(x + 7, y + 7, 0x20a | MAP_IMPASSABLE_MASK); } } } @@ -791,7 +791,7 @@ void sub_80E9AD0(void) { if (gUnknown_0858CFCC[j].tile2 == tile) { - MapGridSetMetatileIdAt(events->bgEvents[i].x + 7, events->bgEvents[i].y + 7, gUnknown_0858CFCC[j].tile1 | 0xc00); + MapGridSetMetatileIdAt(events->bgEvents[i].x + 7, events->bgEvents[i].y + 7, gUnknown_0858CFCC[j].tile1 | MAP_IMPASSABLE_MASK); break; } } diff --git a/src/tv.c b/src/tv.c index ee3614e83..6ab91ac07 100644 --- a/src/tv.c +++ b/src/tv.c @@ -39,6 +39,7 @@ #include "tv.h" #include "data2.h" #include "constants/layouts.h" +#include "constants/metatile_behaviors.h" // Static type declarations @@ -853,9 +854,9 @@ void SetTVMetatilesOnMap(int width, int height, u16 tileId) { for (x = 0; x < width; x ++) { - if (MapGridGetMetatileBehaviorAt(x, y) == 0x86) // is this tile a TV? + if (MapGridGetMetatileBehaviorAt(x, y) == MB_TELEVISION) { - MapGridSetMetatileIdAt(x, y, tileId | 0xc00); + MapGridSetMetatileIdAt(x, y, tileId | MAP_IMPASSABLE_MASK); } } } From da0687987d8d4f6cb9a331f30553ffb806e74165 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 26 Feb 2019 22:56:22 -0500 Subject: [PATCH 14/14] Pick better names for constants --- asm/macros/event.inc | 4 ++-- include/global.fieldmap.h | 12 ++++++------ src/battle_pyramid.c | 4 ++-- src/bg.c | 4 ++-- src/decoration.c | 8 ++++---- src/field_effect.c | 2 +- src/field_specials.c | 12 ++++++------ src/fieldmap.c | 38 +++++++++++++++++++------------------- src/fldeff_escalator.c | 4 ++-- src/scrcmd.c | 2 +- src/secret_base.c | 16 ++++++++-------- src/tv.c | 2 +- 12 files changed, 54 insertions(+), 54 deletions(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index fa27d049e..708861e32 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -1163,12 +1163,12 @@ .endm @ Changes the metatile at (x, y) on the current map. - .macro setmetatile x:req, y:req, metatile_number:req, is_impassable:req + .macro setmetatile x:req, y:req, metatile_number:req, has_collision:req .byte 0xa2 .2byte \x .2byte \y .2byte \metatile_number - .2byte \is_impassable + .2byte \has_collision .endm @ Queues a weather change to the default weather for the map. diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 2b85a02d1..e35d900d8 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -1,12 +1,12 @@ #ifndef GUARD_GLOBAL_FIELDMAP_H #define GUARD_GLOBAL_FIELDMAP_H -#define MAP_IMPASSABLE_MASK 0x0C00 -#define MAP_METATILE_ID_MASK 0x03FF -#define MAP_UNDEFINED_METATILE_ID 0x03FF -#define MAP_TILE_ELEVATION_SHIFT 12 -#define MAP_IMPASSABLE_SHIFT 10 -#define MAP_TILE_ELEVATION_MASK 0xF000 +#define METATILE_COLLISION_MASK 0x0C00 +#define METATILE_ID_MASK 0x03FF +#define METATILE_ID_UNDEFINED 0x03FF +#define METATILE_ELEVATION_SHIFT 12 +#define METATILE_COLLISION_SHIFT 10 +#define METATILE_ELEVATION_MASK 0xF000 enum { diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 92ff257b0..34da3a25d 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -1267,7 +1267,7 @@ static u8 GetPostBattleDirectionHintTextIndex(int *hintType, u8 minDistanceForEx { for (x = 0; x < 32; x++) { - if ((map[x] & MAP_METATILE_ID_MASK) == FLOOR_EXIT_METATILE) + if ((map[x] & METATILE_ID_MASK) == FLOOR_EXIT_METATILE) { x += 7 - gEventObjects[gSelectedEventObject].initialCoords.x; y += 7 - gEventObjects[gSelectedEventObject].initialCoords.y; @@ -1568,7 +1568,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio { for (x = 0; x < mapLayout->width; x++) { - if ((layoutMap[x] & MAP_METATILE_ID_MASK) != FLOOR_EXIT_METATILE) + if ((layoutMap[x] & METATILE_ID_MASK) != FLOOR_EXIT_METATILE) { map[x] = layoutMap[x]; } diff --git a/src/bg.c b/src/bg.c index 571518650..1826f9a28 100644 --- a/src/bg.c +++ b/src/bg.c @@ -1056,7 +1056,7 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt for (x16 = x; x16 < (x + width); x16++) { CopyTileMapEntry(&firstTileNum, &((u16*)sGpuBgConfigs2[bg].tilemap)[(u16)GetTileMapIndexFromCoords(x16, y16, attribute, mode, mode2)], paletteSlot, 0, 0); - firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & MAP_METATILE_ID_MASK); + firstTileNum = (firstTileNum & (METATILE_COLLISION_MASK | METATILE_ELEVATION_MASK)) + ((firstTileNum + tileNumDelta) & METATILE_ID_MASK); } } break; @@ -1067,7 +1067,7 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt for (x16 = x; x16 < (x + width); x16++) { ((u8*)sGpuBgConfigs2[bg].tilemap)[(y16 * mode3) + x16] = firstTileNum; - firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & MAP_METATILE_ID_MASK); + firstTileNum = (firstTileNum & (METATILE_COLLISION_MASK | METATILE_ELEVATION_MASK)) + ((firstTileNum + tileNumDelta) & METATILE_ID_MASK); } } break; diff --git a/src/decoration.c b/src/decoration.c index e5f3b6d46..83ec4bc34 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -1173,7 +1173,7 @@ void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor) behavior = GetBehaviorByMetatileId(0x200 + gDecorations[decor].tiles[i * decWidth + j]); if (MetatileBehavior_IsSecretBaseImpassable(behavior) == TRUE || (gDecorations[decor].permission != DECORPERM_PASS_FLOOR && (behavior >> 12))) { - impassableFlag = MAP_IMPASSABLE_MASK; + impassableFlag = METATILE_COLLISION_MASK; } else { @@ -1502,7 +1502,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration) { curX = gTasks[taskId].data[0] + j; behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY); - behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & MAP_TILE_ELEVATION_MASK; + behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK; if (!sub_81284F4(behaviorAt, decoration)) { return FALSE; @@ -1527,7 +1527,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration) { curX = gTasks[taskId].data[0] + j; behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY); - behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & MAP_TILE_ELEVATION_MASK; + behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK; if (!MetatileBehavior_IsNormal(behaviorAt) && !sub_8128484(behaviorAt, behaviorBy)) { return FALSE; @@ -1547,7 +1547,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration) { curX = gTasks[taskId].data[0] + j; behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY); - behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[j]) & MAP_TILE_ELEVATION_MASK; + behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[j]) & METATILE_ELEVATION_MASK; if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsSecretBaseNorthWall(behaviorAt)) { return FALSE; diff --git a/src/field_effect.c b/src/field_effect.c index 07a7f9caf..7f11a8e58 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -2620,7 +2620,7 @@ static void sub_80B8874(u16 offs) dest = (u16 *)(VRAM + 0x140 + offs); for (i = 0; i < 0x140; i++, dest++) { - *dest = gFieldMoveStreaksTilemap[i] | MAP_TILE_ELEVATION_MASK; + *dest = gFieldMoveStreaksTilemap[i] | METATILE_ELEVATION_MASK; } } diff --git a/src/field_specials.c b/src/field_specials.c index c7d1f4367..639d86e68 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -887,8 +887,8 @@ static void PetalburgGymFunc(u8 a0, u16 a1) } for (i = 0; i < nDoors; i++) { - MapGridSetMetatileIdAt(x[i] + 7, y[i] + 7, a1 | MAP_IMPASSABLE_MASK); - MapGridSetMetatileIdAt(x[i] + 7, y[i] + 8, (a1 + 8) | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x[i] + 7, y[i] + 7, a1 | METATILE_COLLISION_MASK); + MapGridSetMetatileIdAt(x[i] + 7, y[i] + 8, (a1 + 8) | METATILE_COLLISION_MASK); } DrawWholeMapView(); } @@ -1100,7 +1100,7 @@ static void PCTurnOnEffect_1(s16 flag, s8 dx, s8 dy) tileId = 0x27e; } } - MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | METATILE_COLLISION_MASK); } void DoPCTurnOffEffect(void) @@ -1141,7 +1141,7 @@ static void PCTurnOffEffect(void) { tileId = 0x259; } - MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | METATILE_COLLISION_MASK); DrawWholeMapView(); } @@ -1892,7 +1892,7 @@ static void sub_8139C80(u8 taskId) { for (x = 0; x < 3; x++) { - MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2BF4[y][data[0] % 3] | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2BF4[y][data[0] % 3] | METATILE_COLLISION_MASK); } } } @@ -1902,7 +1902,7 @@ static void sub_8139C80(u8 taskId) { for (x = 0; x < 3; x++) { - MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2C06[y][data[0] % 3] | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2C06[y][data[0] % 3] | METATILE_COLLISION_MASK); } } } diff --git a/src/fieldmap.c b/src/fieldmap.c index 8131fb01b..a96b71c0f 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -383,15 +383,15 @@ u8 MapGridGetZCoordAt(int x, int y) i = (x + 1) & 1; i += ((y + 1) & 1) * 2; block = gMapHeader.mapLayout->border[i]; - block |= MAP_IMPASSABLE_MASK; + block |= METATILE_COLLISION_MASK; } - if (block == MAP_UNDEFINED_METATILE_ID) + if (block == METATILE_ID_UNDEFINED) { return 0; } - return block >> MAP_TILE_ELEVATION_SHIFT; + return block >> METATILE_ELEVATION_SHIFT; } u8 MapGridIsImpassableAt(int x, int y) @@ -411,13 +411,13 @@ u8 MapGridIsImpassableAt(int x, int y) i = (x + 1) & 1; i += ((y + 1) & 1) * 2; block = gMapHeader.mapLayout->border[i]; - block |= MAP_IMPASSABLE_MASK; + block |= METATILE_COLLISION_MASK; } - if (block == MAP_UNDEFINED_METATILE_ID) + if (block == METATILE_ID_UNDEFINED) { return 1; } - return (block & MAP_IMPASSABLE_MASK) >> MAP_IMPASSABLE_SHIFT; + return (block & METATILE_COLLISION_MASK) >> METATILE_COLLISION_SHIFT; } u32 MapGridGetMetatileIdAt(int x, int y) @@ -439,19 +439,19 @@ u32 MapGridGetMetatileIdAt(int x, int y) mapLayout = gMapHeader.mapLayout; i = (x + 1) & 1; i += ((y + 1) & 1) * 2; - block = mapLayout->border[i] | MAP_IMPASSABLE_MASK; + block = mapLayout->border[i] | METATILE_COLLISION_MASK; } - if (block == MAP_UNDEFINED_METATILE_ID) + if (block == METATILE_ID_UNDEFINED) { border = gMapHeader.mapLayout->border; j = (x + 1) & 1; j += ((y + 1) & 1) * 2; block2 = gMapHeader.mapLayout->border[j]; // This OR is completely pointless. - block2 |= MAP_IMPASSABLE_MASK; - return block2 & MAP_METATILE_ID_MASK; + block2 |= METATILE_COLLISION_MASK; + return block2 & METATILE_ID_MASK; } - return block & MAP_METATILE_ID_MASK; + return block & METATILE_ID_MASK; } u32 MapGridGetMetatileBehaviorAt(int x, int y) @@ -465,7 +465,7 @@ u8 MapGridGetMetatileLayerTypeAt(int x, int y) { u16 metatile; metatile = MapGridGetMetatileIdAt(x, y); - return (GetBehaviorByMetatileId(metatile) & MAP_TILE_ELEVATION_MASK) >> MAP_TILE_ELEVATION_SHIFT; + return (GetBehaviorByMetatileId(metatile) & METATILE_ELEVATION_MASK) >> METATILE_ELEVATION_SHIFT; } void MapGridSetMetatileIdAt(int x, int y, u16 metatile) @@ -475,7 +475,7 @@ void MapGridSetMetatileIdAt(int x, int y, u16 metatile) && y >= 0 && y < gBackupMapLayout.height) { i = x + y * gBackupMapLayout.width; - gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & MAP_TILE_ELEVATION_MASK) | (metatile & ~MAP_TILE_ELEVATION_MASK); + gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & METATILE_ELEVATION_MASK) | (metatile & ~METATILE_ELEVATION_MASK); } } @@ -655,7 +655,7 @@ int GetMapBorderIdAt(int x, int y) i = gBackupMapLayout.width; i *= y; block = gBackupMapLayout.map[x + i]; - if (block == MAP_UNDEFINED_METATILE_ID) + if (block == METATILE_ID_UNDEFINED) { goto fail; } @@ -665,8 +665,8 @@ int GetMapBorderIdAt(int x, int y) mapLayout = gMapHeader.mapLayout; j = (x + 1) & 1; j += ((y + 1) & 1) * 2; - block2 = MAP_IMPASSABLE_MASK | mapLayout->border[j]; - if (block2 == MAP_UNDEFINED_METATILE_ID) + block2 = METATILE_COLLISION_MASK | mapLayout->border[j]; + if (block2 == METATILE_ID_UNDEFINED) { goto fail; } @@ -922,9 +922,9 @@ void sub_8088B94(int x, int y, int a2) if (x >= 0 && x < gBackupMapLayout.width && y >= 0 && y < gBackupMapLayout.height) { if (a2 != 0) - gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= MAP_IMPASSABLE_MASK; + gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= METATILE_COLLISION_MASK; else - gBackupMapLayout.map[x + gBackupMapLayout.width * y] &= 0xF3FF; + gBackupMapLayout.map[x + gBackupMapLayout.width * y] &= ~METATILE_COLLISION_MASK; } } @@ -938,7 +938,7 @@ static bool8 SkipCopyingMetatileFromSavedMap(u16* mapMetatilePtr, u16 mapWidth, else mapMetatilePtr += mapWidth; - if (sub_80FADE4(*mapMetatilePtr & MAP_METATILE_ID_MASK, yMode) == 1) + if (sub_80FADE4(*mapMetatilePtr & METATILE_ID_MASK, yMode) == 1) return TRUE; return FALSE; } diff --git a/src/fldeff_escalator.c b/src/fldeff_escalator.c index 4a1fb0fd5..7ab2db4db 100644 --- a/src/fldeff_escalator.c +++ b/src/fldeff_escalator.c @@ -76,13 +76,13 @@ static void sub_80E1444(u8 taskId) sub_80E12E8(taskId, gUnknown_08589AC0, 0); break; case 2: - sub_80E12E8(taskId, gUnknown_08589AC6, MAP_IMPASSABLE_MASK); + sub_80E12E8(taskId, gUnknown_08589AC6, METATILE_COLLISION_MASK); break; case 3: sub_80E12E8(taskId, gUnknown_08589ACC, 0); break; case 4: - sub_80E12E8(taskId, gUnknown_08589AD2, MAP_IMPASSABLE_MASK); + sub_80E12E8(taskId, gUnknown_08589AD2, METATILE_COLLISION_MASK); break; case 5: sub_80E12E8(taskId, gUnknown_08589AD8, 0); diff --git a/src/scrcmd.c b/src/scrcmd.c index 9bafac41a..b80b2baed 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -2035,7 +2035,7 @@ bool8 ScrCmd_setmetatile(struct ScriptContext *ctx) if (!isImpassable) MapGridSetMetatileIdAt(x, y, tileId); else - MapGridSetMetatileIdAt(x, y, tileId | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x, y, tileId | METATILE_COLLISION_MASK); return FALSE; } diff --git a/src/secret_base.c b/src/secret_base.c index 488f49377..3e591eba2 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -259,7 +259,7 @@ void sub_80E8CB0(s16 *xPtr, s16 *yPtr, u16 tile) { for (x = 0; x < mapLayout->width; x ++) { - if ((mapLayout->map[y * mapLayout->width + x] & MAP_METATILE_ID_MASK) == tile) + if ((mapLayout->map[y * mapLayout->width + x] & METATILE_ID_MASK) == tile) { *xPtr = x; *yPtr = y; @@ -282,7 +282,7 @@ void sub_80E8D4C(void) { if (gUnknown_0858CFCC[i].tile1 == tile) { - MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | METATILE_COLLISION_MASK); CurrentMapDrawMetatileAt(x, y); return; } @@ -291,7 +291,7 @@ void sub_80E8D4C(void) { if (gUnknown_0858CFCC[i].tile2 == tile) { - MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile1 | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile1 | METATILE_COLLISION_MASK); CurrentMapDrawMetatileAt(x, y); return; } @@ -352,7 +352,7 @@ void sub_80E8EE0(struct MapEvents const *events) { if (gUnknown_0858CFCC[i].tile1 == tile_id) { - MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | METATILE_COLLISION_MASK); break; } } @@ -434,7 +434,7 @@ void sub_80E9108(void) sub_80E8CB0(&x, &y, 0x220); x += 7; y += 7; - MapGridSetMetatileIdAt(x, y, 0x220 | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x, y, 0x220 | METATILE_COLLISION_MASK); CurrentMapDrawMetatileAt(x, y); pal_fill_black(); CreateTask(sub_80E90C8, 0); @@ -492,12 +492,12 @@ void sub_80E9238(u8 flagIn) if (curBaseId != 0) { sub_80E8CB0(&x, &y, 0x220); - MapGridSetMetatileIdAt(x + 7, y + 7, 0x221 | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x + 7, y + 7, 0x221 | METATILE_COLLISION_MASK); } else if (flagIn == 1 && VarGet(VAR_0x4089) == 1) { sub_80E8CB0(&x, &y, 0x220); - MapGridSetMetatileIdAt(x + 7, y + 7, 0x20a | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x + 7, y + 7, 0x20a | METATILE_COLLISION_MASK); } } } @@ -791,7 +791,7 @@ void sub_80E9AD0(void) { if (gUnknown_0858CFCC[j].tile2 == tile) { - MapGridSetMetatileIdAt(events->bgEvents[i].x + 7, events->bgEvents[i].y + 7, gUnknown_0858CFCC[j].tile1 | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(events->bgEvents[i].x + 7, events->bgEvents[i].y + 7, gUnknown_0858CFCC[j].tile1 | METATILE_COLLISION_MASK); break; } } diff --git a/src/tv.c b/src/tv.c index 6ab91ac07..cfa49d7df 100644 --- a/src/tv.c +++ b/src/tv.c @@ -856,7 +856,7 @@ void SetTVMetatilesOnMap(int width, int height, u16 tileId) { if (MapGridGetMetatileBehaviorAt(x, y) == MB_TELEVISION) { - MapGridSetMetatileIdAt(x, y, tileId | MAP_IMPASSABLE_MASK); + MapGridSetMetatileIdAt(x, y, tileId | METATILE_COLLISION_MASK); } } }