Match bowser code
This commit is contained in:
parent
1a019c7c11
commit
7963e868fe
3 changed files with 413 additions and 3 deletions
|
|
@ -1751,8 +1751,8 @@ SpawnBowserFire = .text:0x8009A5D4; // type:function size:0xE4 scope:local
|
|||
CheckBowserFire = .text:0x8009A6B8; // type:function size:0xCC scope:local
|
||||
KillBowserFire = .text:0x8009A784; // type:function size:0x40 scope:local
|
||||
ExecMiniBowserEvent = .text:0x8009A7C4; // type:function size:0x188 scope:local
|
||||
MiniBowserTakeAll = .text:0x8009A94C; // type:function size:0x2C4 scope:local
|
||||
MiniBowserTake = .text:0x8009AC10; // type:function size:0x2B8 scope:local
|
||||
MiniBowserTake = .text:0x8009A94C; // type:function size:0x2C4 scope:local
|
||||
MiniBowserTakeAll = .text:0x8009AC10; // type:function size:0x2B8 scope:local
|
||||
MiniBowserBalloonStop = .text:0x8009AEC8; // type:function size:0x24 scope:local
|
||||
GetMiniBowserBalloonState = .text:0x8009AEEC; // type:function size:0xC scope:local
|
||||
SetMiniBowserBalloonState = .text:0x8009AEF8; // type:function size:0x10 scope:local
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ config.libs = [
|
|||
Object(Matching, "game/board/ui.c"),
|
||||
Object(Matching, "game/board/block.c"),
|
||||
Object(Matching, "game/board/item.c"),
|
||||
Object(NonMatching, "game/board/bowser.c"),
|
||||
Object(Matching, "game/board/bowser.c"),
|
||||
Object(Matching, "game/board/battle.c"),
|
||||
Object(Matching, "game/board/fortune.c"),
|
||||
Object(Matching, "game/board/boo.c"),
|
||||
|
|
|
|||
|
|
@ -1399,4 +1399,414 @@ static void KillBowserFire(void)
|
|||
fireParMan = -1;
|
||||
fireAnim = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct mini_bowser_balloon_work {
|
||||
u8 kill : 1;
|
||||
u8 state;
|
||||
u16 timer;
|
||||
s16 angle;
|
||||
float offset;
|
||||
s16 *models;
|
||||
} MiniBowserBalloonWork;
|
||||
|
||||
static void MiniBowserTake(void);
|
||||
static void MiniBowserTakeAll(void);
|
||||
static void MiniBowserBalloonStop(void);
|
||||
|
||||
static s32 GetMiniBowserBalloonState(void);
|
||||
static void SetMiniBowserBalloonState(s32 state);
|
||||
static void CreateMiniBowserBalloon(void);
|
||||
|
||||
static void ExecMiniBowserBalloon(omObjData *object);
|
||||
static void MiniBowserBalloonHover(MiniBowserBalloonWork *work, omObjData *object);
|
||||
static void MiniBowserBalloonFall(MiniBowserBalloonWork *work, omObjData *object);
|
||||
static void MiniBowserBalloonRaise(MiniBowserBalloonWork *work, omObjData *object);
|
||||
|
||||
|
||||
static void SetMiniBowserMotion(s32 mot, u8 end, s32 pause);
|
||||
static void SetMiniBowserMotionPause(s32 flag);
|
||||
static void WaitMiniBowserMotion(void);
|
||||
|
||||
static s32 ExecMiniBowserEvent(void)
|
||||
{
|
||||
s32 doneF = 0;
|
||||
CreateMiniBowserBalloon();
|
||||
SetMiniBowserBalloonState(0);
|
||||
while(GetMiniBowserBalloonState() != 2) {
|
||||
HuPrcVSleep();
|
||||
}
|
||||
BoardFilterFadeOut(30);
|
||||
BoardAudSeqFadeOut(1, 1000);
|
||||
HuPrcSleep(30);
|
||||
BoardAudSeqFadeOutFast(1);
|
||||
BoardMusStart(1, 11, 127, 0);
|
||||
HuAudFXPlay(62);
|
||||
BoardWinCreate(2, 0x30000, 6);
|
||||
BoardWinWait();
|
||||
if(BoardRandMod(100) < 70) {
|
||||
MiniBowserTake();
|
||||
} else {
|
||||
MiniBowserTakeAll();
|
||||
}
|
||||
if(BoardRandMod(100) < 5) {
|
||||
doneF = 1;
|
||||
}
|
||||
if(doneF) {
|
||||
HuPrcSleep(60);
|
||||
BoardWinCreate(2, 0x30006, 6);
|
||||
BoardWinWait();
|
||||
BoardWinKill();
|
||||
HuAudFXPlay(62);
|
||||
SetMiniBowserMotion(6, 10, 1);
|
||||
HuPrcSleep(60);
|
||||
} else {
|
||||
HuAudFXPlay(62);
|
||||
BoardWinCreate(2, 0x30002, 6);
|
||||
BoardWinWait();
|
||||
BoardWinKill();
|
||||
BoardAudSeqFadeOut(1, 1000);
|
||||
SetMiniBowserMotion(4, 10, 1);
|
||||
HuPrcSleep(30);
|
||||
}
|
||||
SetMiniBowserBalloonState(1);
|
||||
while(GetMiniBowserBalloonState() != 2) {
|
||||
HuPrcVSleep();
|
||||
}
|
||||
MiniBowserBalloonStop();
|
||||
return doneF;
|
||||
}
|
||||
|
||||
static void MiniBowserTake(void)
|
||||
{
|
||||
u8 coinSteal[][3] = {
|
||||
20, 20, 30,
|
||||
20, 20, 30,
|
||||
10, 15, 20,
|
||||
10, 15, 20
|
||||
};
|
||||
s32 coin_inc;
|
||||
s32 game_part;
|
||||
u8 steal;
|
||||
s32 i;
|
||||
u32 mess;
|
||||
s32 delay;
|
||||
s32 turn;
|
||||
s32 turn_max;
|
||||
turn = GWSystem.turn-1;
|
||||
turn_max = GWSystem.max_turn;
|
||||
game_part = turn/(turn_max/3);
|
||||
if(game_part >= 3) {
|
||||
game_part = 2;
|
||||
}
|
||||
steal = (u8)coinSteal[GWPlayer[eventPlayer].rank][game_part];
|
||||
sprintf(coinStealStrAll, "%d", steal);
|
||||
SetMiniBowserMotion(2, 10, 0);
|
||||
if(steal >= 20) {
|
||||
delay = 3;
|
||||
} else {
|
||||
delay = 6;
|
||||
}
|
||||
if(BoardPlayerCoinsGet(eventPlayer) != 0) {
|
||||
mess = 0x30001;
|
||||
coin_inc = -1;
|
||||
} else {
|
||||
mess = 0x30003;
|
||||
steal = 10;
|
||||
coin_inc = 1;
|
||||
}
|
||||
HuAudFXPlay(62);
|
||||
BoardWinCreate(2, mess, 6);
|
||||
BoardWinInsertMesSet(MAKE_MESSID_PTR(coinStealStrAll), 0);
|
||||
BoardWinWait();
|
||||
if(coin_inc > 0) {
|
||||
SetMiniBowserMotion(5, 10, 0);
|
||||
} else {
|
||||
SetMiniBowserMotion(3, 10, 1);
|
||||
}
|
||||
if(coin_inc < 0) {
|
||||
omVibrate(eventPlayer, 12, 6, 6);
|
||||
}
|
||||
if(coin_inc < 0) {
|
||||
BoardPlayerMotionShiftSet(eventPlayer, 13, 0.0f, 4.0f, 0);
|
||||
} else {
|
||||
BoardPlayerMotionShiftSet(eventPlayer, 12, 0.0f, 4.0f, 0);
|
||||
}
|
||||
for(i=0; i<steal; i++) {
|
||||
BoardPlayerCoinsAdd(eventPlayer, coin_inc);
|
||||
if(coin_inc < 0) {
|
||||
HuAudFXPlay(14);
|
||||
} else {
|
||||
HuAudFXPlay(7);
|
||||
}
|
||||
HuPrcSleep(6);
|
||||
if(BoardPlayerCoinsGet(eventPlayer) <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
HuAudFXPlay(15);
|
||||
HuPrcSleep(20);
|
||||
BoardPlayerIdleSet(eventPlayer);
|
||||
SetMiniBowserMotionPause(0);
|
||||
WaitMiniBowserMotion();
|
||||
SetMiniBowserMotion(1, 10, 1);
|
||||
}
|
||||
|
||||
static void MiniBowserTakeAll(void)
|
||||
{
|
||||
u8 coinSteal[] = {
|
||||
10, 20, 30,
|
||||
};
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 coin_total;
|
||||
s32 coin_inc;
|
||||
s32 game_part;
|
||||
u8 steal;
|
||||
u32 mess;
|
||||
s32 delay;
|
||||
s32 turn;
|
||||
s32 turn_max;
|
||||
turn = GWSystem.turn-1;
|
||||
turn_max = GWSystem.max_turn;
|
||||
game_part = turn/(turn_max/3);
|
||||
if(game_part >= 3) {
|
||||
game_part = 2;
|
||||
}
|
||||
steal = (u8)coinSteal[game_part];
|
||||
sprintf(coinStealStr, "%d", steal);
|
||||
SetMiniBowserMotion(2, 10, 0);
|
||||
for(coin_total=j=0; j<4; j++) {
|
||||
coin_total += BoardPlayerCoinsGet(j);
|
||||
}
|
||||
if(coin_total != 0) {
|
||||
mess = 0x30004;
|
||||
coin_inc = -1;
|
||||
} else {
|
||||
mess = 0x30005;
|
||||
steal = 10;
|
||||
coin_inc = 1;
|
||||
}
|
||||
HuAudFXPlay(62);
|
||||
BoardWinCreate(2, mess, 6);
|
||||
BoardWinInsertMesSet(MAKE_MESSID_PTR(coinStealStr), 0);
|
||||
BoardWinWait();
|
||||
if(coin_inc > 0) {
|
||||
SetMiniBowserMotion(5, 10, 0);
|
||||
} else {
|
||||
SetMiniBowserMotion(3, 10, 1);
|
||||
}
|
||||
if(coin_inc < 0) {
|
||||
for(i=0; i<4; i++) {
|
||||
omVibrate(i, 12, 6, 6);
|
||||
}
|
||||
}
|
||||
for(i=0; i<4; i++) {
|
||||
if(coin_inc < 0) {
|
||||
BoardPlayerMotionShiftSet(i, 13, 0.0f, 4.0f, 0);
|
||||
} else {
|
||||
BoardPlayerMotionShiftSet(i, 12, 0.0f, 4.0f, 0);
|
||||
}
|
||||
}
|
||||
if(steal >= 20) {
|
||||
delay = 3;
|
||||
} else {
|
||||
delay = 6;
|
||||
}
|
||||
for(i=0; i<steal; i++) {
|
||||
for(j=0; j<4; j++) {
|
||||
BoardPlayerCoinsAdd(j, coin_inc);
|
||||
}
|
||||
for(coin_total=j=0; j<4; j++) {
|
||||
coin_total += BoardPlayerCoinsGet(j);
|
||||
}
|
||||
if(coin_total == 0) {
|
||||
break;
|
||||
}
|
||||
if(coin_inc < 0) {
|
||||
HuAudFXPlay(14);
|
||||
} else {
|
||||
HuAudFXPlay(7);
|
||||
}
|
||||
HuPrcSleep(6);
|
||||
}
|
||||
HuAudFXPlay(15);
|
||||
HuPrcSleep(20);
|
||||
for(i=0; i<4; i++) {
|
||||
BoardPlayerIdleSet(i);
|
||||
}
|
||||
|
||||
SetMiniBowserMotionPause(0);
|
||||
WaitMiniBowserMotion();
|
||||
SetMiniBowserMotion(1, 10, 1);
|
||||
}
|
||||
|
||||
static const s32 miniBowserMotTbl[] = {
|
||||
DATA_MAKE_NUM(DATADIR_BKOOPA, 15),
|
||||
DATA_MAKE_NUM(DATADIR_BKOOPA, 16),
|
||||
DATA_MAKE_NUM(DATADIR_BKOOPA, 17),
|
||||
DATA_MAKE_NUM(DATADIR_BKOOPA, 18),
|
||||
DATA_MAKE_NUM(DATADIR_BKOOPA, 19),
|
||||
DATA_MAKE_NUM(DATADIR_BKOOPA, 20),
|
||||
DATA_NUM_LISTEND
|
||||
};
|
||||
|
||||
static void MiniBowserBalloonStop(void)
|
||||
{
|
||||
if(miniBowserBalloonObj) {
|
||||
OM_GET_WORK_PTR(miniBowserBalloonObj, MiniBowserBalloonWork)->kill = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static s32 GetMiniBowserBalloonState(void)
|
||||
{
|
||||
return OM_GET_WORK_PTR(miniBowserBalloonObj, MiniBowserBalloonWork)->state;
|
||||
}
|
||||
|
||||
static void SetMiniBowserBalloonState(s32 state)
|
||||
{
|
||||
OM_GET_WORK_PTR(miniBowserBalloonObj, MiniBowserBalloonWork)->state = state;
|
||||
}
|
||||
|
||||
static void CreateMiniBowserBalloon(void)
|
||||
{
|
||||
MiniBowserBalloonWork *work;
|
||||
s16 *models;
|
||||
Vec pos;
|
||||
miniBowserBalloonObj = omAddObjEx(boardObjMan, 257, 0, 0, -1, ExecMiniBowserBalloon);
|
||||
work = OM_GET_WORK_PTR(miniBowserBalloonObj, MiniBowserBalloonWork);
|
||||
work->kill = 0;
|
||||
work->state = 0;
|
||||
work->timer = 0;
|
||||
work->offset = 0;
|
||||
work->angle = 0;
|
||||
work->models = HuMemDirectMallocNum(HEAP_SYSTEM, 9*sizeof(s16), MEMORY_DEFAULT_NUM);
|
||||
models = work->models;
|
||||
models[0] = BoardModelCreate(DATA_MAKE_NUM(DATADIR_BKOOPA, 14), (s32 *)miniBowserMotTbl, 0);
|
||||
models[1] = BoardModelCreate(DATA_MAKE_NUM(DATADIR_BKOOPA, 0), NULL, 0);
|
||||
BoardPlayerPosGet(eventPlayer, &pos);
|
||||
miniBowserBalloonObj->trans.x = pos.x;
|
||||
miniBowserBalloonObj->trans.y = pos.y+800.0f;
|
||||
miniBowserBalloonObj->trans.z = pos.z;
|
||||
BoardModelHookSet(models[1], "minik01", models[0]);
|
||||
BoardModelPosSet(models[1], miniBowserBalloonObj->trans.x,
|
||||
miniBowserBalloonObj->trans.y,
|
||||
miniBowserBalloonObj->trans.z);
|
||||
SetMiniBowserMotion(1, 0, 1);
|
||||
}
|
||||
|
||||
static void ExecMiniBowserBalloon(omObjData *object)
|
||||
{
|
||||
MiniBowserBalloonWork *work;
|
||||
s16 *models;
|
||||
work = OM_GET_WORK_PTR(miniBowserBalloonObj, MiniBowserBalloonWork);
|
||||
models = work->models;
|
||||
if(work->kill || BoardIsKill()) {
|
||||
BoardModelKill(models[0]);
|
||||
BoardModelKill(models[1]);
|
||||
HuMemDirectFree(work->models);
|
||||
miniBowserBalloonObj = NULL;
|
||||
omDelObjEx(HuPrcCurrentGet(), object);
|
||||
return;
|
||||
}
|
||||
if(work->timer) {
|
||||
work->timer--;
|
||||
} else {
|
||||
switch(work->state) {
|
||||
case 0:
|
||||
MiniBowserBalloonFall(work, object);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
MiniBowserBalloonRaise(work, object);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
MiniBowserBalloonHover(work, object);
|
||||
break;
|
||||
}
|
||||
}
|
||||
BoardModelPosSet(models[1], object->trans.x, object->trans.y+work->offset, object->trans.z);
|
||||
}
|
||||
|
||||
static void MiniBowserBalloonHover(MiniBowserBalloonWork *work, omObjData *object)
|
||||
{
|
||||
float angle;
|
||||
work->angle++;
|
||||
if(work->angle >= 360) {
|
||||
work->angle = 0;
|
||||
}
|
||||
OSs16tof32(&work->angle, &angle);
|
||||
work->offset = 10.0*sin(M_PI*angle/180.0);
|
||||
}
|
||||
|
||||
static void MiniBowserBalloonFall(MiniBowserBalloonWork *work, omObjData *object)
|
||||
{
|
||||
Vec pos;
|
||||
BoardPlayerPosGet(eventPlayer, &pos);
|
||||
pos.y += 250.0f;
|
||||
if(object->trans.y < pos.y) {
|
||||
object->trans.y = pos.y;
|
||||
work->state = 2;
|
||||
} else {
|
||||
object->trans.y += -10.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void MiniBowserBalloonRaise(MiniBowserBalloonWork *work, omObjData *object)
|
||||
{
|
||||
Vec pos;
|
||||
BoardPlayerPosGet(eventPlayer, &pos);
|
||||
pos.y += 800.0f;
|
||||
if(object->trans.y > pos.y) {
|
||||
work->state = 2;
|
||||
} else {
|
||||
object->trans.y += 10.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void SetMiniBowserMotion(s32 mot, u8 end, s32 pause)
|
||||
{
|
||||
s16 *models;
|
||||
u32 attr;
|
||||
float shift_end;
|
||||
MiniBowserBalloonWork *work;
|
||||
work = OM_GET_WORK_PTR(miniBowserBalloonObj, MiniBowserBalloonWork);
|
||||
models = work->models;
|
||||
if(pause) {
|
||||
attr = 0x40000001;
|
||||
} else {
|
||||
attr = 0;
|
||||
}
|
||||
if(end) {
|
||||
OSu8tof32(&end, &shift_end);
|
||||
BoardModelMotionShiftSet(models[0], mot, 0, shift_end, attr);
|
||||
} else {
|
||||
BoardModelMotionStart(models[0], mot, attr);
|
||||
}
|
||||
}
|
||||
|
||||
static void SetMiniBowserMotionPause(s32 flag)
|
||||
{
|
||||
s16 *models;
|
||||
MiniBowserBalloonWork *work;
|
||||
work = OM_GET_WORK_PTR(miniBowserBalloonObj, MiniBowserBalloonWork);
|
||||
models = work->models;
|
||||
if(flag) {
|
||||
BoardModelAttrSet(models[0], 0x40000001);
|
||||
} else {
|
||||
BoardModelAttrReset(models[0], 0x40000001);
|
||||
}
|
||||
}
|
||||
|
||||
static void WaitMiniBowserMotion(void)
|
||||
{
|
||||
s16 *models;
|
||||
MiniBowserBalloonWork *work;
|
||||
work = OM_GET_WORK_PTR(miniBowserBalloonObj, MiniBowserBalloonWork);
|
||||
models = work->models;
|
||||
BoardModelAttrReset(models[0], 0x40000001);
|
||||
while(!BoardModelMotionEndCheck(models[0])) {
|
||||
HuPrcVSleep();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue