more work on w02|roulette.c

This commit is contained in:
M0liusX 2024-02-01 16:26:46 -06:00
parent 369307cf6b
commit 84108deeed
2 changed files with 139 additions and 2 deletions

View file

@ -455,8 +455,8 @@ s32 fn_1_1128(void) {
BoardDiceDigit2DShowSet(1);
}
void fn_1_121C(u32 arg0) {
BoardWinCreate(2, arg0, 4);
void fn_1_121C(u32 mesg) {
BoardWinCreate(2, mesg, 4);
BoardWinWait();
BoardWinKill();
}

View file

@ -1,14 +1,31 @@
#include "REL/w02Dll.h"
#define ROULETTE_CHOICE_YES 0
#define ROULETTE_CHOICE_NO 1
#define ROULETTE_CHOICE_MAP 2
#define BRIBE_CHOICE_20 0
#define BRIBE_CHOICE_10 1
#define BRIBE_CHOICE_5 2
#define BRIBE_CHOICE_NVM 3
#define BRIBE_CHOICE_INVALID -1
/* RODATA */
extern f32 lbl_1_rodata_408;
extern f32 lbl_1_rodata_40C;
extern f32 lbl_1_rodata_410;
extern f32 lbl_1_rodata_414;
extern f32 lbl_1_rodata_490;
/* BSS */
extern s32 lbl_1_bss_38C;
extern s16 lbl_1_bss_388;
extern f32 lbl_1_bss_380;
//Function Externs
extern void BoardComKeySetDown();
extern void BoardComKeySetUp();
/* FUNCTIONS */
@ -60,4 +77,124 @@ void fn_1_BCFC(void) {
while(TRUE) {
HuPrcVSleep();
}
}
s32 fn_1_BE74(void) {
lbl_1_bss_38C = 0;
}
s32 fn_1_BE88(void) {
s32 coinAmount;
s32 var_r30;
s16 playerCoinRegion;
s32 bribeChoice;
s32 i;
s32 rouletteChoice;
s32 mesg;
var_r30 = -1;
coinAmount = BoardPlayerCoinsGet((s32) lbl_1_bss_388);
if (coinAmount < 5) {
return var_r30;
}
fn_1_121C(0x130002);
do {
BoardWinCreateChoice(2, 0x13001DU, 4, 0);
/* COM has 50% to bribe goomba */
if (GWPlayer[lbl_1_bss_388].com) {
if (frand() & 1) {
BoardComKeySetRight();
} else {
BoardComKeySetLeft();
}
}
BoardWinWait();
BoardWinKill();
rouletteChoice = BoardWinChoiceGet();
// If chose to play roulette
if (rouletteChoice == ROULETTE_CHOICE_YES) {
BoardWinCreateChoice(1, 0x130003U, 4, 0);
playerCoinRegion = 3;
if (coinAmount < 0x14) {
BoardWinChoiceDisable(0);
playerCoinRegion--;
}
if (coinAmount < 0xA) {
BoardWinChoiceDisable(1);
playerCoinRegion--;
}
/* COM always bribes max unless it has 20 or
more coins. Then 50% max, 50% 10 coin bribe. */
if (GWPlayer[lbl_1_bss_388].com) {
if (playerCoinRegion < 2) {
BoardComKeySetUp();
} else if (frand() & 1) {
BoardComKeySetUp();
} else {
BoardComKeySetDown();
}
}
BoardWinWait();
BoardWinKill();
bribeChoice = BoardWinChoiceGet();
if (bribeChoice == BRIBE_CHOICE_INVALID ||
bribeChoice == BRIBE_CHOICE_NVM) {
continue;
}
// Coin amount is now the bribe amount in coins
switch (bribeChoice) {
case BRIBE_CHOICE_20:
mesg = 0x130004;
coinAmount = 0x14;
var_r30 = 0x5A;
break;
case BRIBE_CHOICE_10:
mesg = 0x130005;
coinAmount = 0xA;
var_r30 = 0x3C;
break;
case BRIBE_CHOICE_5:
mesg = 0x130006;
coinAmount = 5;
var_r30 = 0x1E;
break;
}
fn_1_121C(mesg);
for (i = 0; i < coinAmount; i++) {
BoardPlayerCoinsAdd(lbl_1_bss_388, -1);
HuAudFXPlay(0xE);
HuPrcSleep(6);
}
HuAudFXPlay(0xF);
// If chose to view map
} else if (rouletteChoice == ROULETTE_CHOICE_MAP) {
BoardViewMapExec(lbl_1_bss_388);
}
} while (rouletteChoice == ROULETTE_CHOICE_MAP); // While viewing map
if (var_r30 == -1) {
fn_1_121C(0x130007);
}
return var_r30;
}
// https://decomp.me/scratch/rctvo
// fn_1_C108 (98.34%)
/* Rotate (yaw) of model 4 */
void fn_1_E310(f32 degrees) {
Point3d spC;
lbl_1_bss_380 += degrees;
if (lbl_1_bss_380 >= lbl_1_rodata_490) {
lbl_1_bss_380 -= lbl_1_rodata_490;
}
if (lbl_1_bss_380 < lbl_1_rodata_410) {
lbl_1_bss_380 += lbl_1_rodata_490;
}
BoardModelRotGet(lbl_1_bss_30[4], &spC);
spC.y = lbl_1_bss_380;
BoardModelRotSetV(lbl_1_bss_30[4], &spC);
}