diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-11-16 13:55:02 -0500 |
---|---|---|
committer | GriffinR <griffin.g.richards@gmail.com> | 2021-11-16 15:43:52 -0500 |
commit | 5d9c31a610d8a6680a44b772fc1b88135d3884c3 (patch) | |
tree | d776a819221dec62b96314d2b172a50bb743007d /src/slot_machine.c | |
parent | 63c5905914b40d33e45a6a3101ab5a7da4375918 (diff) |
Label slot machine ids, fix GetPriceReduction
Diffstat (limited to 'src/slot_machine.c')
-rw-r--r-- | src/slot_machine.c | 124 |
1 files changed, 88 insertions, 36 deletions
diff --git a/src/slot_machine.c b/src/slot_machine.c index 1c21f230d..6cbcd76fd 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -557,10 +557,10 @@ static struct SpriteFrameImage *sImageTables_DigitalDisplay[NUM_DIG_DISPLAY_SPRI // Const rom data. static const struct DigitalDisplaySprite *const sDigitalDisplayScenes[]; static const u16 sUnkPalette[]; -static const u8 sLuckyRoundProbabilities[][3]; +static const u8 sLuckyRoundProbabilities[NUM_SLOT_MACHINE_IDS][MAX_BET]; static const u8 sBiasTags[]; -static const u16 sLuckyFlagSettings_Top3[]; -static const u16 sLuckyFlagSettings_NotTop3[]; +static const u16 sLuckyFlagSettings_Top3[3]; +static const u16 sLuckyFlagSettings_NotTop3[5]; static const s16 sDigitalDisplay_SpriteCoords[][2]; static const SpriteCallback sDigitalDisplay_SpriteCallbacks[]; static const struct SpriteTemplate *const sSpriteTemplates_DigitalDisplay[NUM_DIG_DISPLAY_SPRITES]; @@ -582,8 +582,8 @@ static const struct SpriteSheet sSlotMachineSpriteSheets[22]; static const struct SpritePalette sSlotMachineSpritePalettes[]; static const u16 *const sDigitalDisplay_Pal; static const s16 sInitialReelPositions[NUM_REELS][2]; -static const u8 sLuckyFlagProbabilities_Top3[][6]; -static const u8 sLuckyFlagProbabilities_NotTop3[][6]; +static const u8 sLuckyFlagProbabilities_Top3[][NUM_SLOT_MACHINE_IDS]; +static const u8 sLuckyFlagProbabilities_NotTop3[][NUM_SLOT_MACHINE_IDS]; static const u8 sReeltimeProbabilities_UnluckyGame[][17]; static const u8 sReelTimeProbabilities_LuckyGame[][17]; static const u8 sSymToMatch[]; @@ -1651,22 +1651,18 @@ static void DrawLuckyFlags(void) if (IsThisRoundLucky()) { attempts = AttemptsAtLuckyFlags_Top3(); - if (attempts != 3) // if you found a lucky number + if (attempts != ARRAY_COUNT(sLuckyFlagSettings_Top3)) // if you found a lucky number { // attempts == 1: reelTime flag set sSlotMachine->luckyFlags |= sLuckyFlagSettings_Top3[attempts]; if (attempts != 1) - { return; - } } } // 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 - { + if (attempts != ARRAY_COUNT(sLuckyFlagSettings_NotTop3)) // if you found a lucky number sSlotMachine->luckyFlags |= sLuckyFlagSettings_NotTop3[attempts]; - } } } } @@ -1704,7 +1700,7 @@ static u8 AttemptsAtLuckyFlags_Top3(void) { s16 count; - for (count = 0; count < 3; count++) + for (count = 0; count < (int)ARRAY_COUNT(sLuckyFlagSettings_Top3); count++) { s16 rval = Random() & 0xff; s16 value = sLuckyFlagProbabilities_Top3[count][sSlotMachine->machineId]; @@ -1718,7 +1714,7 @@ static u8 AttemptsAtLuckyFlags_NotTop3(void) { s16 count; - for (count = 0; count < 5; count++) + for (count = 0; count < (int)ARRAY_COUNT(sLuckyFlagSettings_NotTop3); count++) { s16 rval = Random() & 0xff; // random byte s16 value = sLuckyFlagProbabilities_NotTop3[count][sSlotMachine->machineId]; @@ -4807,27 +4803,83 @@ static const s16 sInitialReelPositions[NUM_REELS][2] = { [RIGHT_REEL] = {0, 2} }; -static const u8 sLuckyRoundProbabilities[][3] = { - {1, 1, 12}, - {1, 1, 14}, - {2, 2, 14}, - {2, 2, 14}, - {2, 3, 16}, - {3, 3, 16} +static const u8 sLuckyRoundProbabilities[NUM_SLOT_MACHINE_IDS][MAX_BET] = { + [SLOT_MACHINE_UNLUCKIEST] = {1, 1, 12}, + [SLOT_MACHINE_UNLUCKIER] = {1, 1, 14}, + [SLOT_MACHINE_UNLUCKY] = {2, 2, 14}, + [SLOT_MACHINE_LUCKY] = {2, 2, 14}, + [SLOT_MACHINE_LUCKIER] = {2, 3, 16}, + [SLOT_MACHINE_LUCKIEST] = {3, 3, 16} }; -static const u8 sLuckyFlagProbabilities_Top3[][6] = { - {25, 25, 30, 40, 40, 50}, - {25, 25, 30, 30, 35, 35}, - {25, 25, 30, 25, 25, 30} -}; - -static const u8 sLuckyFlagProbabilities_NotTop3[][6] = { - {20, 25, 25, 20, 25, 25}, - {12, 15, 15, 18, 19, 22}, - {25, 25, 25, 30, 30, 40}, - {25, 25, 20, 20, 15, 15}, - {40, 40, 35, 35, 40, 40} +static const u8 sLuckyFlagProbabilities_Top3[][NUM_SLOT_MACHINE_IDS] = { + { // Probabilities for LUCKY_BIAS_777 + [SLOT_MACHINE_UNLUCKIEST] = 25, + [SLOT_MACHINE_UNLUCKIER] = 25, + [SLOT_MACHINE_UNLUCKY] = 30, + [SLOT_MACHINE_LUCKY] = 40, + [SLOT_MACHINE_LUCKIER] = 40, + [SLOT_MACHINE_LUCKIEST] = 50 + }, + { // Probabilities for LUCKY_BIAS_REELTIME + [SLOT_MACHINE_UNLUCKIEST] = 25, + [SLOT_MACHINE_UNLUCKIER] = 25, + [SLOT_MACHINE_UNLUCKY] = 30, + [SLOT_MACHINE_LUCKY] = 30, + [SLOT_MACHINE_LUCKIER] = 35, + [SLOT_MACHINE_LUCKIEST] = 35 + }, + { // Probabilities for LUCKY_BIAS_MIXED_777 + [SLOT_MACHINE_UNLUCKIEST] = 25, + [SLOT_MACHINE_UNLUCKIER] = 25, + [SLOT_MACHINE_UNLUCKY] = 30, + [SLOT_MACHINE_LUCKY] = 25, + [SLOT_MACHINE_LUCKIER] = 25, + [SLOT_MACHINE_LUCKIEST] = 30 + } +}; + +static const u8 sLuckyFlagProbabilities_NotTop3[][NUM_SLOT_MACHINE_IDS] = { + { // Probabilities for LUCKY_BIAS_POWER + [SLOT_MACHINE_UNLUCKIEST] = 20, + [SLOT_MACHINE_UNLUCKIER] = 25, + [SLOT_MACHINE_UNLUCKY] = 25, + [SLOT_MACHINE_LUCKY] = 20, + [SLOT_MACHINE_LUCKIER] = 25, + [SLOT_MACHINE_LUCKIEST] = 25 + }, + { // Probabilities for LUCKY_BIAS_AZURILL + [SLOT_MACHINE_UNLUCKIEST] = 12, + [SLOT_MACHINE_UNLUCKIER] = 15, + [SLOT_MACHINE_UNLUCKY] = 15, + [SLOT_MACHINE_LUCKY] = 18, + [SLOT_MACHINE_LUCKIER] = 19, + [SLOT_MACHINE_LUCKIEST] = 22 + }, + { // Probabilities for LUCKY_BIAS_LOTAD + [SLOT_MACHINE_UNLUCKIEST] = 25, + [SLOT_MACHINE_UNLUCKIER] = 25, + [SLOT_MACHINE_UNLUCKY] = 25, + [SLOT_MACHINE_LUCKY] = 30, + [SLOT_MACHINE_LUCKIER] = 30, + [SLOT_MACHINE_LUCKIEST] = 40 + }, + { // Probabilities for LUCKY_BIAS_CHERRY + [SLOT_MACHINE_UNLUCKIEST] = 25, + [SLOT_MACHINE_UNLUCKIER] = 25, + [SLOT_MACHINE_UNLUCKY] = 20, + [SLOT_MACHINE_LUCKY] = 20, + [SLOT_MACHINE_LUCKIER] = 15, + [SLOT_MACHINE_LUCKIEST] = 15 + }, + { // Probabilities for LUCKY_BIAS_REPLAY + [SLOT_MACHINE_UNLUCKIEST] = 40, + [SLOT_MACHINE_UNLUCKIER] = 40, + [SLOT_MACHINE_UNLUCKY] = 35, + [SLOT_MACHINE_LUCKY] = 35, + [SLOT_MACHINE_LUCKIER] = 40, + [SLOT_MACHINE_LUCKIEST] = 40 + } }; static const u8 sReeltimeProbabilities_UnluckyGame[][17] = { @@ -5708,7 +5760,7 @@ static const struct SpriteTemplate sSpriteTemplate_DigitalDisplay_Insert = static const struct SpriteTemplate sSpriteTemplate_DigitalDisplay_Stop = { - .tileTag = 18, + .tileTag = GFXTAG_STOP, .paletteTag = PALTAG_DIG_DISPLAY, .oam = &sOam_8x8, .anims = sAnims_SingleFrame, @@ -5741,7 +5793,7 @@ static const struct SpriteTemplate sSpriteTemplate_DigitalDisplay_Lose = static const struct SpriteTemplate sSpriteTemplate_DigitalDisplay_Bonus = { - .tileTag = 19, + .tileTag = GFXTAG_BONUS, .paletteTag = PALTAG_DIG_DISPLAY, .oam = &sOam_8x8, .anims = sAnims_SingleFrame, @@ -5752,7 +5804,7 @@ static const struct SpriteTemplate sSpriteTemplate_DigitalDisplay_Bonus = static const struct SpriteTemplate sSpriteTemplate_DigitalDisplay_Big = { - .tileTag = 20, + .tileTag = GFXTAG_BIG, .paletteTag = PALTAG_DIG_DISPLAY, .oam = &sOam_8x8, .anims = sAnims_SingleFrame, @@ -5763,7 +5815,7 @@ static const struct SpriteTemplate sSpriteTemplate_DigitalDisplay_Big = static const struct SpriteTemplate sSpriteTemplate_DigitalDisplay_Reg = { - .tileTag = 21, + .tileTag = GFXTAG_REG, .paletteTag = PALTAG_DIG_DISPLAY, .oam = &sOam_8x8, .anims = sAnims_SingleFrame, |