Decompile w02dll dice and gamble

This commit is contained in:
gamemasterplc 2024-06-10 17:25:35 -05:00
parent 42e933819f
commit f77ef40a9f
5 changed files with 861 additions and 139 deletions

View file

@ -1,49 +1,5 @@
#include "REL/w02Dll.h"
/* DATA */
extern char lbl_1_data_2A8[0x12];
extern char lbl_1_data_2BA[0x0D];
extern char lbl_1_data_2C8[0x10];
/* RODATA*/
extern f32 lbl_1_rodata_38;
extern f32 lbl_1_rodata_3C;
extern f32 lbl_1_rodata_40;
extern f32 lbl_1_rodata_44;
extern f32 lbl_1_rodata_48;
extern f32 lbl_1_rodata_4C;
/* STRUCTS*/
typedef struct {
/* 0x00 */ s16 unk00;
/* 0x02 */ s16 unk02;
/* 0x04 */ s32 unk04;
/* 0x08 */ u8 unk08[0x04];
/* 0x0C */ Vec unk0C;
/* 0x18 */ s16 unk18;
/* 0x1A */ s16 unk1A;
/* 0x1C */ u8 unk1C[0x6];
/* 0x22 */ s16 unk22;
/* 0x24 */ f32 unk24;
/* 0x28 */ s16 unk28;
/* 0x2A */ u8 unk2A[0x2];
/* 0x2C */ Process* unk2C;
/* 0x30 */ s16 unk30[3];
/* 0x36 */ s16 unk36[3];
/* 0x3C */ omObjData* unk3C[3];
/* 0x48 */ s16 unk48[3];
/* 0x4E */ u8 unk4E[0x2];
/* 0x50 */ s32 unk50[3];
/* 0x5C */ u8 unk5C[0x08];
/* 0x64 */ Vec unk64;
/* 0x70 */ Vec unk70;
/* 0x7C */ Vec unk7C;
/* 0x88 */ s32 unk88[3];
/* 0x94 */ s16 unk94;
/* 0x96 */ s16 unk96;
/* 0x98 */ f32 unk98;
/* 0x9C */ s16 unk9C;
} unkW02Dice;
#include "ext_math.h"
typedef struct {
union {
@ -59,27 +15,31 @@ typedef struct {
/* 0x01 */ u8 unk01;
/* 0x02 */ u8 unk02;
/* 0x03 */ u8 unk03;
/* 0x04 */ u16 unk04;
} unkW02DiceBitfields;
/* 0x04 */ s16 unk04;
/* 0x06 */ s16 unk06;
} WorkDice;
/* EXTERN FUNCTIONS */
void fn_1_13D0(void);
void fn_1_1574(unkW02Dice*); /* extern */
void fn_1_1794(unkW02Dice*); /* extern */
void fn_1_1850(omObjData*); /* extern */
void fn_1_2030(unkW02Dice*); /* extern */
void fn_1_2220(unkW02Dice*); /* extern */
s32 fn_1_233C(unkW02Dice*); /* extern */
void fn_1_23B4(unkW02Dice*, s32 i); /* extern */
void fn_1_272C(unkW02Dice*); /* extern */
void fn_1_1574(m02Dice *arg0);
void fn_1_1794(m02Dice *arg0);
void fn_1_1850(omObjData *object);
void fn_1_1F94(m02Dice* arg0, s32 arg1);
void fn_1_2030(m02Dice *arg0);
void fn_1_2100(m02Dice *arg0, s32 arg1);
void fn_1_2220(m02Dice *arg0);
s32 fn_1_233C(m02Dice *arg0);
void fn_1_23FC(m02Dice *arg0, s32 arg1);
void fn_1_23B4(m02Dice *arg0, s32 arg1);
void fn_1_272C(m02Dice *arg0);
/* LOCAL FUNCTIONS */
void fn_1_1254(unkW02Dice* arg0) {
void fn_1_1254(m02Dice* arg0) {
Vec sp8;
s32 i;
OSReport(lbl_1_data_2A8);
arg0->unk2C = HuPrcChildCreate(&fn_1_13D0, 0x2005, 0x2000, 0, boardMainProc);
OSReport("m02GenDiceCreate\n");
arg0->unk2C = HuPrcChildCreate(fn_1_13D0, 0x2005, 0x2000, 0, boardMainProc);
arg0->unk2C->user_data = arg0;
arg0->unk94 = 0;
arg0->unk9C = 0;
@ -87,9 +47,9 @@ void fn_1_1254(unkW02Dice* arg0) {
Hu3D3Dto2D(&arg0->unk0C, 1, &sp8);
/* Initialize Matrix */
arg0->unk64 = arg0->unk70 = arg0->unk7C = sp8;
arg0->unk7C.y = arg0->unk70.y = arg0->unk64.y = lbl_1_rodata_38;
arg0->unk7C.z = arg0->unk70.z = arg0->unk64.z = lbl_1_rodata_3C;
arg0->unk64[0] = arg0->unk64[1] = arg0->unk7C = sp8;
arg0->unk7C.y = arg0->unk64[1].y = arg0->unk64[0].y = 155;
arg0->unk7C.z = arg0->unk64[1].z = arg0->unk64[0].z = 1400;
arg0->unk96 = -1;
for (i = 0; i < 3; i++) {
@ -105,7 +65,7 @@ void fn_1_13D0(void) {
s32 var_r29;
s32 i;
s32 var_r30_2;
unkW02Dice* temp_r31;
m02Dice* temp_r31;
temp_r31 = HuPrcCurrentGet()->user_data;
temp_r31->unk36[0] = temp_r31->unk36[1] = temp_r31->unk36[2] = 0;
@ -127,7 +87,7 @@ void fn_1_13D0(void) {
for ( i = 0; i < temp_r31->unk00; i++) {
var_r29 += temp_r31->unk36[i];
}
OSReport(lbl_1_data_2BA, var_r29);
OSReport("Dice res: %d\n", var_r29);
while (fn_1_233C(temp_r31) == 0) {
HuPrcVSleep();
@ -146,8 +106,8 @@ void fn_1_13D0(void) {
}
}
void fn_1_1518(unkW02Dice* arg0) {
OSReport(lbl_1_data_2C8);
void fn_1_1518(m02Dice* arg0) {
OSReport("m02GenDiceKill\n");
if (arg0->unk2C) {
HuPrcKill(arg0->unk2C);
}
@ -155,21 +115,21 @@ void fn_1_1518(unkW02Dice* arg0) {
fn_1_272C(arg0);
}
void fn_1_1574(unkW02Dice* arg0) {
void fn_1_1574(m02Dice* arg0) {
Vec sp8;
f32 temp_f0;
omObjData* temp_r3;
s32 temp_r28;
unkW02DiceBitfields* temp_r29;
WorkDice* temp_r29;
temp_r28 = arg0->unk96;
arg0->unk30[temp_r28] = BoardModelCreate(arg0->unk04, NULL, 0);
arg0->unk98 = lbl_1_rodata_40 + BoardRandMod(arg0->unk1A);
arg0->unk98 = 0.5f + BoardRandMod(arg0->unk1A);
BoardModelMotionStart(arg0->unk30[temp_r28], 0, 0x40000001U);
BoardModelMotionSpeedSet(arg0->unk30[temp_r28], lbl_1_rodata_44);
BoardModelMotionSpeedSet(arg0->unk30[temp_r28], 0);
BoardModelMotionTimeSet(arg0->unk30[temp_r28], arg0->unk98);
temp_r3 = omAddObjEx(boardObjMan, 0x102, 0U, 0U, -1, fn_1_1850);
temp_r29 = (unkW02DiceBitfields*) temp_r3->work;
temp_r29 = (WorkDice*) temp_r3->work;
temp_r29->unk7 = 0;
temp_r29->unk6 = 0;
@ -182,39 +142,156 @@ void fn_1_1574(unkW02Dice* arg0) {
temp_r3->unk10 = (u32) arg0;
arg0->unk3C[temp_r28] = temp_r3;
sp8 = arg0->unk0C;
sp8.y += (lbl_1_rodata_48 * arg0->unk24);
sp8.y += (250.0f * arg0->unk24);
temp_r3->trans.x = sp8.x;
temp_r3->trans.y = sp8.y;
temp_r3->trans.z = sp8.z;
temp_r3->scale.x = lbl_1_rodata_44;
temp_r3->scale.y = lbl_1_rodata_44;
temp_r3->scale.z = lbl_1_rodata_44;
sp8.z += lbl_1_rodata_4C;
temp_r3->scale.x = 0;
temp_r3->scale.y = 0;
temp_r3->scale.z = 0;
sp8.z += 70.0f;
HuAudFXPlay(0x302);
}
void fn_1_1794(unkW02Dice* arg0) {
unkW02DiceBitfields* temp_r30;
void fn_1_1794(m02Dice* arg0) {
WorkDice* temp_r30;
temp_r30 = (unkW02DiceBitfields*) arg0->unk3C[arg0->unk96]->work;
temp_r30 = OM_GET_WORK_PTR(arg0->unk3C[arg0->unk96], WorkDice);
while (temp_r30->unk3 != 1) {
HuPrcVSleep();
}
}
s32 fn_1_17F4(unkW02Dice* arg0) {
unkW02DiceBitfields* temp;
s32 fn_1_17F4(m02Dice* arg0)
{
WorkDice* temp;
if ( arg0->unk96 < 0) {
return 0;
}
temp = (unkW02DiceBitfields*) arg0->unk3C[arg0->unk96]->work;
temp = OM_GET_WORK_PTR(arg0->unk3C[arg0->unk96], WorkDice);
if (temp->unk3 != 1) {
return 0;
}
return 1;
}
void fn_1_1F94(unkW02Dice* arg0, s32 arg1) {
void fn_1_1850(omObjData *object)
{
WorkDice *temp_r29;
m02Dice *temp_r27;
s16 temp_r26;
s16 temp_r25;
float temp_f29;
float temp_f28;
float temp_f27;
temp_r27 = (m02Dice *)object->unk10;
temp_r29 = OM_GET_WORK_PTR(object, WorkDice);
if(temp_r29->unk7 || BoardIsKill()) {
fn_1_1F94(temp_r27, temp_r29->unk1);
temp_r27->unk3C[temp_r29->unk1] = NULL;
omDelObjEx(HuPrcCurrentGet(), object);
return;
}
if(BoardPauseActiveCheck()) {
return;
}
switch(temp_r29->unk3) {
case 0:
if(temp_r29->unk06 >= 1080) {
temp_r29->unk3 = 1;
object->scale.x = object->scale.y = object->scale.z = 1;
object->rot.y = temp_r29->unk04 = 0;
} else {
if(!temp_r29->unk04 && temp_r27->unk88[temp_r29->unk1] == -1) {
temp_r27->unk88[temp_r29->unk1] = HuAudFXPlay(768);
}
object->rot.y = temp_r29->unk06%360;
temp_r29->unk06 += 25;
if(temp_r29->unk04 < 180) {
temp_f27 = 0;
temp_f28 = 1;
} else {
temp_f27 = 1;
temp_f28 = 0.5f;
}
object->scale.x = (temp_f28*sind((float)(temp_r29->unk04%180)))+temp_f27;
object->scale.y = object->scale.x;
object->scale.z = object->scale.x;
if(temp_r29->unk04 <= 360) {
if(temp_r29->unk04 < 180) {
temp_r29->unk04 += 6;
} else {
temp_r29->unk04 += 18;
}
if(temp_r29->unk04 > 360) {
temp_r29->unk04 = 360;
}
}
}
break;
case 1:
temp_r29->unk04 += 4;
if(temp_r29->unk04 > 360) {
temp_r29->unk04 -= 360;
}
OSs16tof32(&temp_r29->unk04, &temp_f29);
object->trans.y += sind(temp_f29)*0.2f;
break;
case 2:
temp_r29->unk04++;
if(temp_r29->unk04 >= 8) {
if(temp_r27->unk88[temp_r29->unk1] != -1) {
HuAudFXStop(temp_r27->unk88[temp_r29->unk1]);
temp_r27->unk88[temp_r29->unk1] = -1;
}
HuAudFXPlay(771);
HuAudFXPlay(780);
temp_r29->unk3 = 3;
temp_r29->unk04 = 0;
fn_1_23FC(temp_r27, temp_r27->unk36[temp_r29->unk1]);
fn_1_2100(temp_r27, temp_r29->unk1);
Hu3DParManPosSet(temp_r27->unk48[temp_r29->unk1], object->trans.x, object->trans.y, object->trans.z);
BoardModelVisibilitySet(temp_r27->unk30[temp_r29->unk1], 0);
} else {
OSs16tof32(&temp_r29->unk04, &temp_f29);
if(temp_r29->unk04 < 4) {
object->trans.y += (0.5f*temp_f29)+10.0f;
object->scale.x += (0.1f*sind(4.0f*temp_f29));
object->scale.y = object->scale.x;
object->scale.z = object->scale.x;
} else {
BoardModelAlphaSet(temp_r27->unk30[temp_r29->unk1], 255-(temp_r29->unk04*32));
}
object->trans.y += -0.49f*temp_f29*temp_f29;
}
break;
case 3:
if(++temp_r29->unk04 >= 150) {
temp_r29->unk7 = 1;
}
break;
}
if(!temp_r29->unk6 || temp_r29->unk3 != 3) {
if(temp_r29->unk02++ > temp_r29->unk01) {
temp_r29->unk02 = 0;
temp_r25 = BoardModelMotionTimeGet(temp_r27->unk30[temp_r29->unk1]);
do {
temp_r26 = BoardRandMod(temp_r27->unk1A);
} while(temp_r26 == temp_r25);
BoardModelMotionTimeSet(temp_r27->unk30[temp_r29->unk1], temp_r26+0.5f);
}
}
BoardModelPosSet(temp_r27->unk30[temp_r29->unk1], object->trans.x, object->trans.y, object->trans.z);
BoardModelRotSet(temp_r27->unk30[temp_r29->unk1], object->rot.x, object->rot.y, object->rot.z);
BoardModelScaleSet(temp_r27->unk30[temp_r29->unk1], object->scale.x, object->scale.y, object->scale.z);
}
void fn_1_1F94(m02Dice* arg0, s32 arg1) {
if (arg0->unk30[arg1] != -1) {
BoardModelKill(arg0->unk30[arg1]);
arg0->unk30[arg1] = -1;
@ -223,6 +300,314 @@ void fn_1_1F94(unkW02Dice* arg0, s32 arg1) {
if (arg0->unk48[arg1] != -1) {
Hu3DParManKill(arg0->unk48[arg1]);
arg0->unk48[arg1] = -1;
}
}
void fn_1_2030(m02Dice *arg0)
{
fn_1_1F94(arg0, 0);
fn_1_1F94(arg0, 1);
fn_1_1F94(arg0, 2);
}
HsfanimStruct00 lbl_1_data_2D8 = {
150,
{ 0x00, 0x00 }, // padding?
50,
0,
65.0f,
{ 0.0f, -0.195f, 0.0f },
100.0f,
0.99f,
40.0f,
0.999f,
0x0004,
{
0xFF, 0xFF, 0x20, 0xFF,
0xFF, 0xFF, 0x00, 0xFF,
0xFF, 0xFF, 0x80, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
},
{
0xFF, 0xFF, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0x00,
0xFF, 0xFF, 0xFF, 0x00
}
};
void fn_1_2100(m02Dice *arg0, s32 arg1)
{
s16 temp_r29;
AnimData *temp_r28;
void *temp_r27;
temp_r27 = HuDataSelHeapReadNum(0x120001, MEMORY_DEFAULT_NUM, HEAP_DATA);
temp_r28 = HuSprAnimRead(temp_r27);
arg0->unk48[arg1] = Hu3DParManCreate(temp_r28, 100, &lbl_1_data_2D8);
Hu3DParManAttrSet(arg0->unk48[arg1], 0x108);
Hu3DParManRotSet(arg0->unk48[arg1], 0, 0, 0);
Hu3DParManVecSet(arg0->unk48[arg1], 0, 0.4f, 0.2f);
temp_r29 = Hu3DParManModelIDGet(arg0->unk48[arg1]);
Hu3DModelLayerSet(temp_r29, 2);
Hu3DParticleBlendModeSet(temp_r29, 0);
}
void fn_1_2220(m02Dice *arg0)
{
s32 temp_r30;
WorkDice *temp_r29;
temp_r30 = arg0->unk96;
temp_r29 = OM_GET_WORK_PTR(arg0->unk3C[temp_r30], WorkDice);
temp_r29->unk3 = 2;
temp_r29->unk04 = 0;
BoardModelMotionSpeedSet(arg0->unk30[temp_r30], 0);
arg0->unk36[temp_r30] = arg0->unk1C[temp_r30];
}
typedef struct {
u8 field0_bit0 : 1;
u8 field0_bit1 : 1;
u8 field0_bit2 : 1;
u8 field0_bit3 : 2;
s8 unk01;
s16 unk02;
s16 unk04[2];
float unk08;
} WorkDiceNum;
void fn_1_22BC(m02Dice *arg0)
{
s32 temp_r31;
WorkDiceNum *temp_r30;
for(temp_r31=0; temp_r31<arg0->unk00; temp_r31++) {
if(arg0->unk50[temp_r31]) {
temp_r30 = OM_GET_WORK_PTR(arg0->unk50[temp_r31], WorkDiceNum);
temp_r30->field0_bit1 = 1;
temp_r30->field0_bit2 = 1;
temp_r30->unk02 = 0;
}
}
}
s32 fn_1_233C(m02Dice* arg0)
{
s32 temp_r31;
WorkDiceNum *temp_r30;
for(temp_r31=0; temp_r31<arg0->unk00; temp_r31++) {
if(!arg0->unk50[temp_r31]) {
continue;
}
temp_r30 = OM_GET_WORK_PTR(arg0->unk50[temp_r31], WorkDiceNum);
if(temp_r30->field0_bit2) {
return 0;
}
}
return 1;
}
void fn_1_23B4(m02Dice *arg0, s32 arg1)
{
WorkDiceNum *work;
if(!arg0->unk50[arg1]) {
return;
}
work = OM_GET_WORK_PTR(arg0->unk50[arg1], WorkDiceNum);
work->field0_bit0 = 1;
}
void fn_1_25D0(omObjData *object);
void fn_1_23FC(m02Dice *arg0, s32 arg1)
{
Vec spC;
s16 sp8[2];
WorkDiceNum *temp_r31;
s16 temp_r29;
omObjData *temp_r28;
s32 temp_r26;
s16 temp_r25;
temp_r26 = arg0->unk96;
if(arg1 > 99) {
arg1 = 99;
}
sp8[0] = arg1%10;
sp8[1] = arg1/10;
spC = arg0->unk0C;
spC.y += 300.0f;
temp_r28 = omAddObjEx(boardObjMan, 258, 0, 0, -1, fn_1_25D0);
temp_r28->unk10 = (u32)arg0;
temp_r31 = OM_GET_WORK_PTR(temp_r28, WorkDiceNum);
temp_r31->field0_bit0 = 0;
temp_r31->field0_bit1 = 0;
temp_r31->field0_bit2 = 0;
temp_r31->field0_bit3 = temp_r26;
temp_r31->unk08 = 0.3f;
temp_r31->unk01 = arg1;
temp_r31->unk02 = 360;
for(temp_r29=0; temp_r29<2; temp_r29++) {
temp_r25 = BoardModelCreate(arg0->unk08[sp8[temp_r29]], NULL, 0);
BoardModelPosSetV(temp_r25, &spC);
temp_r31->unk04[temp_r29] = temp_r25;
}
if(sp8[1] == 0) {
BoardModelVisibilitySet(temp_r31->unk04[1], 0);
}
arg0->unk50[temp_r26] = temp_r28;
}
void fn_1_2694(WorkDiceNum *arg0);
void fn_1_2830(m02Dice *arg0, WorkDiceNum *arg1, s32 arg2);
void fn_1_2BE4(m02Dice *arg0, WorkDiceNum *arg1, s32 arg2);
void fn_1_25D0(omObjData *object)
{
WorkDiceNum *temp_r31;
m02Dice *temp_r30;
temp_r30 = (m02Dice *)object->unk10;
temp_r31 = OM_GET_WORK_PTR(object, WorkDiceNum);
if(temp_r31->field0_bit0 || BoardIsKill()) {
fn_1_2694(temp_r31);
temp_r30->unk50[temp_r31->field0_bit3] = NULL;
omDelObjEx(HuPrcCurrentGet(), object);
return;
}
if(BoardPauseActiveCheck()) {
return;
}
fn_1_2830(temp_r30, temp_r31, temp_r31->field0_bit1);
fn_1_2BE4(temp_r30, temp_r31, temp_r31->field0_bit1);
}
void fn_1_2694(WorkDiceNum *arg0)
{
s32 i;
for(i=0; i<2; i++) {
if(arg0->unk04[i] == -1) {
continue;
}
OSReport("%d:GenDiceNumExitOM Kill %d\n", i, arg0->unk04[i]);
BoardModelKill(arg0->unk04[i]);
arg0->unk04[i] = -1;
(void)i;
}
}
void fn_1_272C(m02Dice *arg0)
{
s32 i;
WorkDiceNum *work;
s32 j;
for(i=0; i<3; i++) {
if(!arg0->unk50[i]) {
continue;
}
work = OM_GET_WORK_PTR(arg0->unk50[i], WorkDiceNum);
for(j=0; j<2; j++) {
if(work->unk04[j] == -1) {
continue;
}
OSReport("%d:GenDiceNumOMKillAll %d\n", j, work->unk04[j]);
BoardModelKill(work->unk04[j]);
work->unk04[j] = -1;
(void)j;
}
fn_1_23B4(arg0, i);
}
}
void fn_1_2830(m02Dice *arg0, WorkDiceNum *arg1, s32 arg2)
{
float temp_f31;
s16 temp_r31;
Vec *temp_r29;
s16 temp_r27;
s32 sp8 = 0;
Vec sp30;
Vec sp24;
Vec sp18 = { 288, 155, 1400 };
Vec sp54[2];
Vec sp3C[2] = {
{ 144, 155, 1400 },
{ 432, 155, 1400 }
};
Vec sp6C[3] = {
{ 144, 155, 1400 },
{ 432, 155, 1400 },
{ 288, 155, 1400 }
};
Vec spC = { 288, 176, 1400 };
temp_r27 = arg1->unk01/10;
if(arg2) {
temp_r29 = &spC;
temp_f31 = -20.0f*arg1->field0_bit3;
} else {
switch(arg0->unk00) {
case 1:
temp_r29 = &arg0->unk7C;
break;
case 2:
case 3:
temp_r29 = &arg0->unk64[arg1->field0_bit3];
break;
}
temp_f31 = 0;
}
for(temp_r31=0; temp_r31<2; temp_r31++) {
if(temp_r27 == 0) {
sp54[temp_r31].x = temp_r29->x;
} else {
if(temp_r31) {
sp54[temp_r31].x = temp_r29->x-30;
} else {
sp54[temp_r31].x = temp_r29->x+30;
}
}
sp54[temp_r31].y = temp_r29->y;
sp54[temp_r31].z = temp_r29->z+temp_f31;
}
for(temp_r31=0; temp_r31<2; temp_r31++) {
BoardModelPosGet(arg1->unk04[temp_r31], &sp30);
Hu3D2Dto3D(&sp54[temp_r31], 1, &sp54[temp_r31]);
VECSubtract(&sp54[temp_r31], &sp30, &sp24);
if(VECMag(&sp24) < 0.01f) {
arg1->field0_bit2 = 0;
if(arg2 && arg1->field0_bit3) {
BoardModelVisibilitySet(arg1->unk04[temp_r31], 0);
}
} else {
arg1->field0_bit2 = 1;
}
VECScale(&sp24, &sp24, arg1->unk08);
VECAdd(&sp30, &sp24, &sp30);
BoardModelPosSetV(arg1->unk04[temp_r31], &sp30);
}
}
void fn_1_2BE4(m02Dice *arg0, WorkDiceNum *arg1, s32 arg2)
{
s32 temp_r29;
float temp_f30;
if(arg2) {
arg1->unk02 += 18;
if(arg1->unk02 >= 360) {
arg1->unk02 = 360;
}
} else {
arg1->unk02 -= 18;
if(arg1->unk02 <= 0) {
arg1->unk02 = 0;
}
}
OSs16tof32(&arg1->unk02, &temp_f30);
for(temp_r29=0; temp_r29<2; temp_r29++) {
if(arg1->unk04[temp_r29] == -1) {
continue;
}
BoardModelRotSet(arg1->unk04[temp_r29], 0, temp_f30, 0);
}
}

View file

@ -1,9 +1,308 @@
#include "REL/w02Dll.h"
#include "game/audio.h"
#include "game/pad.h"
#include "game/objsub.h"
#include "game/board/basic_space.h"
Process* lbl_1_bss_50;
s32 lbl_1_bss_54;
Process* lbl_1_bss_50;
void fn_1_2D04();
void fn_1_2D04(void)
{
float temp_f31;
float temp_f30;
float temp_f29;
m02Dice spEC;
m02Dice sp4C;
s32 sp24[10] = {
0x0076001C,
0x0076001D,
0x0076001E,
0x0076001F,
0x00760020,
0x00760021,
0x00760022,
0x00760023,
0x00760024,
0x00760025
};
Vec sp18;
Vec spC;
BoardSpace *sp8;
s32 temp_r31;
s16 temp_r30;
s32 temp_r29;
s16 temp_r28;
s32 temp_r27;
s32 temp_r26;
s32 temp_r25;
u16 temp_r24;
temp_r31 = GWSystem.player_curr;
OSReport("gamble start %d\n", temp_r31);
sp8 = BoardSpaceGet(0, GWPlayer[temp_r31].space_curr);
BoardRollDispSet(0);
temp_r28 = BoardModelCreate(0x76000F, NULL, 0);
BoardModelVisibilitySet(temp_r28, 0);
switch(lbl_1_bss_54) {
case 0:
temp_r30 = lbl_1_bss_30[0];
break;
case 1:
temp_r30 = lbl_1_bss_30[1];
break;
case 2:
temp_r30 = lbl_1_bss_30[2];
break;
}
BoardPlayerIdleSet(temp_r31);
BoardPlayerMotBlendSet(temp_r31, -90, 30);
while(!BoardPlayerMotBlendCheck(temp_r31)) {
HuPrcVSleep();
}
BoardCameraViewSet(3);
BoardCameraMotionWait();
BoardModelMotionStart(lbl_1_data_286, 1, 0x40000001);
BoardModelHookSet(temp_r30, "kuri", lbl_1_data_286);
BoardModelVisibilitySet(lbl_1_data_286, 1);
BoardModelMotionTimeSet(temp_r30, 0);
BoardModelAttrReset(temp_r30, 0x40000002);
HuAudFXPlay(813);
while(BoardModelMotionTimeGet(temp_r30) < 30.0f) {
HuPrcVSleep();
}
BoardModelAttrSet(temp_r30, 0x40000002);
BoardModelHookReset(temp_r30);
BoardModelPosGet(temp_r30, &sp18);
BoardModelPosSetV(lbl_1_data_286, &sp18);
fn_1_121C(0x13000A);
spEC.unk00 = 1;
spEC.unk04 = 0x76001B;
spEC.unk08 = sp24;
spEC.unk0C = sp18;
spEC.unk18 = 1;
spEC.unk1A = 10;
spEC.unk22 = 0;
spEC.unk24 = 1;
temp_r25 = frandmod(100);
if(temp_r25 <= 59) {
spEC.unk1C[0] = frandmod(4)+4;
} else if(temp_r25 <= 89) {
if(temp_r25 & 0x1) {
spEC.unk1C[0] = 2;
} else {
spEC.unk1C[0] = 8;
}
spEC.unk1C[0] += frand() & 0x1;
} else {
if(temp_r25 & 0x1) {
spEC.unk1C[0] = 1;
} else {
spEC.unk1C[0] = 10;
}
}
fn_1_1254(&spEC);
while(!fn_1_17F4(&spEC)) {
HuPrcVSleep();
}
temp_r29 = frandmod(45)+45;
HuPrcSleep(temp_r29);
BoardModelPosGet(lbl_1_data_286, &spC);
BoardModelMotionStart(lbl_1_data_286, 4, 0);
temp_f29 = 15;
temp_f31 = 0;
while(1) {
temp_f30 = temp_f29-(0.08166667f*(0.25f*(temp_f31*temp_f31)));
temp_f31++;
spC.y += temp_f30;
if(spC.y >= (250.0f+sp18.y)-130.0f) {
spC.y = (250.0f+sp18.y)-130.0f;
temp_f29 = -10;
temp_f31 = 0;
spEC.unk9C = 1;
}
if(spC.y <= sp18.y) {
spC.y = sp18.y;
spEC.unk9C = 0;
break;
}
BoardModelPosSetV(lbl_1_data_286, &spC);
HuPrcVSleep();
}
BoardModelPosSetV(lbl_1_data_286, &sp18);
BoardModelMotionStart(lbl_1_data_286, 1, 0x40000001);
while(spEC.unk28 == 0) {
HuPrcVSleep();
}
temp_r27 = spEC.unk94;
if(temp_r27 == 10) {
HuAudPlayerVoicePlay(temp_r31, 302);
fn_1_121C(0x130010);
} else {
fn_1_121C(0x13000C);
}
BoardPlayerMotBlendSet(temp_r31, 0, 15);
while(!BoardPlayerMotBlendCheck(temp_r31)) {
HuPrcVSleep();
}
BoardCameraTargetModelSet(-1);
if(temp_r27 != 10) {
sp4C = spEC;
BoardPlayerPosGet(temp_r31, &sp4C.unk0C);
sp4C.unk24 = 1;
sp4C.unk1C[0] = frandmod(10)+1;
if(sp4C.unk1C[0] == temp_r27) {
if(sp4C.unk1C[0] == 9) {
sp4C.unk1C[0]--;
} else {
sp4C.unk1C[0]++;
}
}
fn_1_1254(&sp4C);
while(!fn_1_17F4(&sp4C)) {
HuPrcVSleep();
}
temp_r24 = 0;
while(!(temp_r24 & PAD_BUTTON_A)) {
HuPrcVSleep();
if(GWPlayer[temp_r31].com) {
temp_r29 = frandmod(45)+20;
HuPrcSleep(temp_r29);
temp_r24 = PAD_BUTTON_A;
} else {
temp_r24 = HuPadBtnDown[GWPlayer[temp_r31].port];
}
}
BoardPlayerDiceJumpStart(temp_r31);
while(!BoardPlayerDiceJumpCheck(temp_r31)) {
HuPrcVSleep();
}
sp4C.unk9C = 1;
while(GWPlayer[temp_r31].jump) {
HuPrcVSleep();
}
sp4C.unk9C = 0;
while(sp4C.unk28 == 0) {
HuPrcVSleep();
}
if(sp4C.unk94 > temp_r27) {
fn_1_121C(0x13000D);
} else {
HuAudPlayerVoicePlay(temp_r31, 302);
fn_1_121C(0x13000F);
}
} else {
sp4C.unk94 = 0;
}
fn_1_1518(&spEC);
if(temp_r27 != 10) {
fn_1_1518(&sp4C);
}
BoardPlayerPosGet(temp_r31, &spC);
if(sp4C.unk94 > temp_r27) {
spC.y += 250.0f;
HuAudFXPlay(839);
temp_r29 = BoardCoinChgCreate(&spC, 10);
while(!BoardCoinChgExist(temp_r29)) {
HuPrcVSleep();
}
for(temp_r29=0; temp_r29<10; temp_r29++) {
BoardPlayerCoinsAdd(temp_r31, 1);
HuAudFXPlay(7);
HuPrcSleep(6);
}
fn_1_121C(0x13000E);
} else {
temp_r26 = GWPlayer[temp_r31].space_curr;
BoardCameraTargetSpaceSet(temp_r26);
BoardPlayerMotionShiftSet(temp_r31, 6, 0, 5, 0x40000001);
HuPrcSleep(60);
HuPrcSleep(30);
BoardModelPosSetV(temp_r28, &spC);
BoardModelMotionTimeSet(temp_r28, 0);
BoardModelVisibilitySet(temp_r28, 1);
HuAudFXPlay(1058);
while(BoardModelMotionTimeGet(temp_r28) < BoardModelMotionMaxTimeGet(temp_r28)) {
HuPrcVSleep();
}
omVibrate(temp_r31, 12, 4, 2);
temp_f30 = -4;
for(temp_r29=0; temp_r29<30; temp_r29++) {
spC.y += temp_f30;
temp_f30 *= 1.08f;
BoardPlayerPosSetV(temp_r31, &spC);
HuPrcVSleep();
}
temp_r26 = BoardSpaceFlagSearch(0, 0x80000000);
BoardCameraMoveSet(0);
BoardCameraTargetSpaceSet(temp_r26);
HuPrcVSleep();
BoardCameraMoveSet(1);
BoardSpacePosGet(0, temp_r26, &sp18);
spC = sp18;
spC.y -= 180.0f;
BoardPlayerPosSetV(temp_r31, &spC);
GWPlayer[temp_r31].space_curr = temp_r26;
HuPrcSleep(15);
BoardModelPosSetV(temp_r28, &sp18);
BoardModelMotionTimeSet(temp_r28, 0);
HuAudFXPlay(1058);
while(BoardModelMotionTimeGet(temp_r28) < BoardModelMotionMaxTimeGet(temp_r28)) {
HuPrcVSleep();
}
HuPrcSleep(15);
temp_f29 = 22;
temp_f31 = 1;
while(1) {
temp_f30 = temp_f29-((90.0f/1200.0f)*(0.25f*(temp_f31*temp_f31)));
temp_f31++;
spC.y += temp_f30;
if(spC.y >= sp18.y) {
BoardModelAttrSet(temp_r28, 0x40000004);
}
if(temp_f30 < 0 && spC.y <= sp18.y) {
omVibrate(temp_r31, 12, 4, 2);
temp_f29 = -temp_f30*0.31f;
temp_f31 = 1;
HuAudFXPlay(1068);
if(fabs(temp_f29) <= 5.0) {
break;
}
spC.y = sp18.y;
}
BoardPlayerPosSetV(temp_r31, &spC);
HuPrcVSleep();
}
BoardPlayerPosSetV(temp_r31, &sp18);
HuPrcSleep(90);
BoardPlayerIdleSet(temp_r31);
HuPrcSleep(9);
BoardCameraTargetPlayerSet(temp_r31);
}
BoardModelHookSet(temp_r30, "kuri", lbl_1_data_286);
BoardModelAttrReset(temp_r30, 0x40000002);
if(sp4C.unk94 > temp_r27) {
HuPrcSleep(10);
HuAudFXPlay(815);
}
while(BoardModelMotionTimeGet(temp_r30) < BoardModelMotionMaxTimeGet(temp_r30)) {
HuPrcVSleep();
}
BoardModelHookReset(temp_r30);
BoardCameraViewSet(1);
BoardCameraMotionWait();
BoardRollDispSet(1);
BoardModelVisibilitySet(lbl_1_data_286, 0);
BoardModelKill(temp_r28);
HuPrcKill(NULL);
while(1) {
HuPrcVSleep();
}
}
void fn_1_3938(void) {