diff --git a/config/GMPE01_00/rels/instDll/symbols.txt b/config/GMPE01_00/rels/instDll/symbols.txt index db3511cb..146e93b7 100644 --- a/config/GMPE01_00/rels/instDll/symbols.txt +++ b/config/GMPE01_00/rels/instDll/symbols.txt @@ -118,7 +118,7 @@ lbl_1_rodata_210 = .rodata:0x00000210; // type:object size:0x8 data:double lbl_1_data_0 = .data:0x00000000; // type:object size:0x2 data:2byte lbl_1_data_2 = .data:0x00000002; // type:object size:0x24 data:string lbl_1_data_26 = .data:0x00000026; // type:object size:0x20 -lbl_1_data_46 = .data:0x00000046; // type:object size:0xA +lbl_1_data_46 = .data:0x00000046; // type:object size:0x8 lbl_1_data_50 = .data:0x00000050; // type:object size:0x20 lbl_1_data_70 = .data:0x00000070; // type:object size:0x20 lbl_1_data_90 = .data:0x00000090; // type:object size:0x8 data:string @@ -147,4 +147,5 @@ lbl_1_bss_20 = .bss:0x00000020; // type:object size:0x8 data:float lbl_1_bss_28 = .bss:0x00000028; // type:object size:0x18 data:float lbl_1_bss_40 = .bss:0x00000040; // type:object size:0x18 data:float lbl_1_bss_58 = .bss:0x00000058; // type:object size:0x4 data:4byte -lbl_1_bss_5C = .bss:0x0000005C; // type:object size:0x8 data:4byte +lbl_1_bss_5C = .bss:0x0000005C; // type:object size:0x4 data:4byte +lbl_1_bss_60 = .bss:0x00000060; // type:object size:0x4 data:4byte diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index c174a8a5..cf031b1b 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -4927,7 +4927,7 @@ lbl_8012E70A = .data:0x8012E70A; // type:object size:0xB data:string lbl_8012E715 = .data:0x8012E715; // type:object size:0x273 lbl_8012E988 = .data:0x8012E988; // type:object size:0x12 data:string lbl_8012E99A = .data:0x8012E99A; // type:object size:0xD6 -sndGrpTable = .data:0x8012EA70; // type:object size:0x5B0 +HuSndGrpTbl = .data:0x8012EA70; // type:object size:0x5B0 lbl_8012F020 = .data:0x8012F020; // type:object size:0x94 lbl_8012F0B4 = .data:0x8012F0B4; // type:object size:0x11 data:string lbl_8012F0C5 = .data:0x8012F0C5; // type:object size:0x3A diff --git a/include/game/audio.h b/include/game/audio.h index 59f34f27..7392530a 100644 --- a/include/game/audio.h +++ b/include/game/audio.h @@ -3,6 +3,15 @@ #include "dolphin.h" +typedef struct hu_snd_grp_data { + /* 0x00 */ s16 ovl; + /* 0x02 */ s16 grpset; + /* 0x04 */ s32 auxANo; + /* 0x08 */ s32 auxBNo; + /* 0x0C */ s8 auxAVol; + /* 0x0D */ s8 auxBVol; +} HuSndGrpData; + void HuAudInit(void); s32 HuAudStreamPlay(void); void HuAudStreamVolSet(s16 vol); @@ -64,4 +73,6 @@ extern float Snd3DDistOffset; extern s32 musicOffF; extern u8 fadeStat; +extern HuSndGrpData HuSndGrpTbl[]; + #endif diff --git a/include/game/gamework_data.h b/include/game/gamework_data.h index 6393b6e3..902c7af8 100644 --- a/include/game/gamework_data.h +++ b/include/game/gamework_data.h @@ -45,7 +45,7 @@ typedef struct system_state { }; /* 0x32 */ s8 unk_32; /* 0x34 */ u16 mg_next; -/* 0x36 */ s16 mg_next_type; +/* 0x36 */ s16 mg_type; /* 0x38 */ u16 unk_38; /* 0x3A */ u8 flag[3][16]; /* 0x6A */ u8 unk_6A[0x72]; @@ -153,6 +153,16 @@ static inline s32 GWTeamGet(void) return GWSystem.team; } +static inline s32 GWMGTypeGet(void) +{ + return GWSystem.mg_type; +} + +static inline void GWMGTypeSet(s32 type) +{ + GWSystem.mg_type = type; +} + static inline s32 GWPartyGet(void) { return GWSystem.party; diff --git a/include/game/hsfanim.h b/include/game/hsfanim.h index 6868b818..63015b06 100644 --- a/include/game/hsfanim.h +++ b/include/game/hsfanim.h @@ -3,7 +3,7 @@ #include "game/hsfformat.h" #include "game/hsfman.h" -#include "game/sprite.h" +#include "game/animdata.h" typedef struct model_data ModelData; typedef struct particle_data ParticleData; diff --git a/include/game/hsfformat.h b/include/game/hsfformat.h index 7d1e4f79..56c35fcb 100644 --- a/include/game/hsfformat.h +++ b/include/game/hsfformat.h @@ -2,7 +2,7 @@ #define _GAME_HSFFORMAT_H #include "dolphin.h" -#include "game/sprite.h" +#include "game/animdata.h" #define HSF_OBJ_NULL1 0 #define HSF_OBJ_REPLICA 1 diff --git a/include/game/minigame_seq.h b/include/game/minigame_seq.h index 7a1a85b3..c8ae6be3 100644 --- a/include/game/minigame_seq.h +++ b/include/game/minigame_seq.h @@ -2,6 +2,39 @@ #define _GAME_MINIGAME_SEQ_H #include "game/object.h" +#include "stdarg.h" + +typedef struct seq_work SeqWork; + +typedef int (*SeqUpdateFunc)(SeqWork *work); +typedef int (*SeqInitFunc)(SeqWork *work, va_list params); + +typedef struct seq_work { + SeqUpdateFunc update; + char *data; + float x; + float y; + float scale_x; + float scale_y; + float unk_18; + float angle; + float win_scale; + float unk_24; + s16 time; + s16 time_max; + s16 timer_val; + s16 state; + s16 alt_word_len; + s16 word_len; + s16 param[2]; + s16 type; + s16 spr_grp[16]; + s16 sprite[16]; + u8 seq_no; + u8 stat; + u8 unk_7C; + u8 unk_7D; +} SeqWork; void MGSeqInit(void); void MGSeqMain(void); diff --git a/include/game/sprite.h b/include/game/sprite.h index 42dcba76..c08cf105 100644 --- a/include/game/sprite.h +++ b/include/game/sprite.h @@ -113,7 +113,6 @@ void HuSprGrpCenterSet(s16 group, float x, float y); void HuSprGrpZRotSet(s16 group, float z_rot); void HuSprGrpScaleSet(s16 group, float x, float y); void HuSprGrpTPLvlSet(s16 group, float tp_lvl); -s32 HuSprGrpDrawNoSet(s16 group, s32 draw_no); void HuSprDrawNoSet(s16 group, s16 member, s32 draw_no); void HuSprPriSet(s16 group, s16 member, s16 prio); void HuSprGrpScissorSet(s16 group, s16 x, s16 y, s16 w, s16 h); diff --git a/include/game/window.h b/include/game/window.h index aec4a429..86d5eb0e 100644 --- a/include/game/window.h +++ b/include/game/window.h @@ -1,7 +1,7 @@ #ifndef _GAME_WINDOW_H #define _GAME_WINDOW_H -#include "game/sprite.h" +#include "game/animdata.h" #include "dolphin.h" #define MAKE_MESSID(bank, mess) (((bank) << 16)+(mess)) diff --git a/src/REL/instDll/main.c b/src/REL/instDll/main.c new file mode 100644 index 00000000..e70cc7c7 --- /dev/null +++ b/src/REL/instDll/main.c @@ -0,0 +1,411 @@ +#include "game/object.h" +#include "game/objsub.h" +#include "game/pad.h" +#include "game/gamework_data.h" +#include "game/hsfman.h" +#include "game/hsfmotion.h" + +#include "game/wipe.h" +#include "game/flag.h" +#include "game/minigame_seq.h" +#include "game/data.h" +#include "game/audio.h" +#include "game/window.h" +#include "game/sprite.h" +#include "math.h" + +#include "rel_sqrt_consts.h" + +void HuSprGrpDrawNoSet(s16 group, s32 draw_no); +static s16 lbl_1_data_0 = 1; + +static omObjData *lbl_1_bss_60; +static omObjData *lbl_1_bss_5C; +static Process *lbl_1_bss_58; +static Vec lbl_1_bss_40[2]; +static Vec lbl_1_bss_28[2]; +static float lbl_1_bss_20[2]; +static s32 lbl_1_bss_1C; +static AnimData *lbl_1_bss_18; +static u16 lbl_1_bss_14; +static u16 lbl_1_bss_12; +static u16 lbl_1_bss_10; +static float lbl_1_bss_C; +static u8 lbl_1_bss_8; +static u16 lbl_1_bss_6; +static u16 lbl_1_bss_4; +static s32 lbl_1_bss_0; + +static void fn_1_994(void); +static void fn_1_17E4(void); +static void fn_1_220C(void); +static void fn_1_2804(void); +static void fn_1_2FA0(void); +static void fn_1_4174(omObjData *object); +static void fn_1_4528(omObjData *object); + +void ModuleProlog(void) +{ + s32 i; + omOvlHisData *his; + s32 light; + OSReport("******* INST ObjectSetup *********\n"); + lbl_1_bss_58 = omInitObjMan(50, 8192); + omGameSysInit(lbl_1_bss_58); + lbl_1_bss_8 = GWLanguageGet(); + lbl_1_bss_14 = GWSystem.mg_next; + lbl_1_bss_10 = 0; + lbl_1_bss_4 = 0; + _ClearFlag(0x1000C); + for(i=0; HuSndGrpTbl[i].ovl != OVL_INVALID; i++) { + if(HuSndGrpTbl[i].ovl == mgInfoTbl[lbl_1_bss_14].ovl) { + break; + } + } + if(HuSndGrpTbl[i].ovl != OVL_INVALID) { + HuAudSndGrpSetSet(HuSndGrpTbl[i].grpset); + } + if(mgInfoTbl[lbl_1_bss_14].ovl == OVL_M411) { + if(GWMGTypeGet() == -1) { + GWMGTypeSet(frandmod(3)); + } + } else { + GWMGTypeSet(-1); + } + HuDataDirClose(mgInfoTbl[lbl_1_bss_14].data_dir); + his = omOvlHisGet(0); + omOvlHisChg(0, OVL_RESULT, his->event, his->stat); + if(omovlevtno == 0 && mgInfoTbl[lbl_1_bss_14].ovl == OVL_M430) { + s32 team_cnt[2]; + s32 team_players[2][2]; + team_cnt[0] = team_cnt[1] = 0; + for(i=0; i<4; i++) { + team_players[GWPlayerCfg[i].group][team_cnt[GWPlayerCfg[i].group]++] = i; + } + if(frand() & 1) { + GWPlayerCfg[team_players[0][0]].group = 0; + GWPlayerCfg[team_players[0][1]].group = 1; + } else { + GWPlayerCfg[team_players[0][0]].group = 1; + GWPlayerCfg[team_players[0][1]].group = 0; + } + if(frand() & 1) { + GWPlayerCfg[team_players[1][0]].group = 2; + GWPlayerCfg[team_players[1][1]].group = 3; + } else { + GWPlayerCfg[team_players[1][0]].group = 3; + GWPlayerCfg[team_players[1][1]].group = 2; + } + } + if(mgInfoTbl[lbl_1_bss_14].type == 3 + || mgInfoTbl[lbl_1_bss_14].type == 5 + || mgInfoTbl[lbl_1_bss_14].type == 6 + || mgInfoTbl[lbl_1_bss_14].type == 8 + || !_CheckFlag(0xB)) { + HuDataDirClose(DATADIR_INST); + omSysPauseEnable(1); + omOvlCallEx(mgInfoTbl[lbl_1_bss_14].ovl, 1, 0, 0); + return; + } + lbl_1_bss_40[0].x = -67.0f; + lbl_1_bss_40[0].y = 40.0f; + lbl_1_bss_40[0].z = 0.0f; + lbl_1_bss_28[0].x = 260.0f; + lbl_1_bss_28[0].y = -103.0f; + lbl_1_bss_28[0].z = -18.0f; + lbl_1_bss_20[0] = 2885.0f; + lbl_1_bss_C = 20.0f; + lbl_1_bss_12 = GWSystem.board; + if(mgBoardHostEnableF) { + lbl_1_bss_12 = 1; + } + lbl_1_bss_40[1].x = lbl_1_bss_40[1].y = lbl_1_bss_40[1].z = 0.0f; + lbl_1_bss_28[1].x = lbl_1_bss_28[1].y = lbl_1_bss_28[1].z = 0.0f; + lbl_1_bss_20[1] = 1000.0f; + omSysPauseEnable(0); + Hu3DCameraCreate(3); + Hu3DCameraPerspectiveSet(1, 30.0f, 20.0f, 15000.0f, 1.2f); + Hu3DCameraViewportSet(1, 0, 0, 640, 480, 0, 1); + Hu3DCameraPerspectiveSet(2, 30.0f, 20.0f, 15000.0f, 1.2f); + Hu3DCameraViewportSet(2, 0, 0, 640, 480, 0, 1); + light = Hu3DGLightCreate(0, 100, 1000, 0, -0.5, -1, 255, 255, 255); + Hu3DGLightInfinitytSet(light); + HuPrcChildCreate(fn_1_994, 100, 12288, 0, lbl_1_bss_58); + HuPrcChildCreate(fn_1_17E4, 100, 12288, 0, lbl_1_bss_58); + HuPrcChildCreate(fn_1_220C, 100, 12288, 0, lbl_1_bss_58); + HuPrcChildCreate(fn_1_2804, 100, 12288, 0, lbl_1_bss_58); + HuPrcChildCreate(fn_1_2FA0, 100, 12288, 0, lbl_1_bss_58); + lbl_1_bss_5C = omAddObjEx(lbl_1_bss_58, 32730, 0, 0, -1, fn_1_4174); + omAddObjEx(lbl_1_bss_58, 0, 32, 32, -1, fn_1_4528); + HuAudSeqPlay(59); + Hu3DBGColorSet(0, 0, 0); + HuWinInit(1); +} + +static s8 lbl_1_data_26[][4] = { + { 3, 2, 1, 0 }, + { 1, 1, 1, 0 }, + { 1, 1, 0, 0 }, + { 0, 1, 2, 3 }, + { 3, 2, 1, 0 }, + { 0, -1, -1, -1 }, + { 0, -1, -1, -1 }, + { 3, 2, 1, 0 }, +}; + +static s8 lbl_1_data_46[] = { + 4, + 4, + 4, + 4, + 4, + 1, + 1, + 4 +}; + +static s32 lbl_1_data_50[] = { + DATA_MAKE_NUM(DATADIR_INST, 0), + DATA_MAKE_NUM(DATADIR_INST, 1), + DATA_MAKE_NUM(DATADIR_INST, 2), + DATA_MAKE_NUM(DATADIR_INST, 3), + DATA_MAKE_NUM(DATADIR_INST, 4), + DATA_MAKE_NUM(DATADIR_INST, 0), + DATA_MAKE_NUM(DATADIR_INST, 5), + DATA_MAKE_NUM(DATADIR_INST, 0), +}; + +static s32 lbl_1_data_70[] = { + DATA_MAKE_NUM(DATADIR_INST, 9), + DATA_MAKE_NUM(DATADIR_INST, 10), + DATA_MAKE_NUM(DATADIR_INST, 11), + DATA_MAKE_NUM(DATADIR_INST, 12), + DATA_MAKE_NUM(DATADIR_INST, 13), + DATA_MAKE_NUM(DATADIR_INST, 14), + DATA_MAKE_NUM(DATADIR_INST, 14), + DATA_MAKE_NUM(DATADIR_INST, 9), +}; + +static void fn_1_50B0(ModelData *model, Mtx mtx); +static void fn_1_5B64(ModelData *model, Mtx mtx); + +static void fn_1_994(void) +{ + + Vec pos; + Vec target; + Vec up; + + Vec spC; + Process *process; + + s16 i; + s16 model; + s16 num_coms; + s16 j; + s16 btns; + s32 status; + s32 done; + s16 group; + s32 pic; + omOvlHisData *his; + s16 sprite; + AnimData *anim; + float pos_z; + float time; + float fov_vel; + float rot_x; + + + process = HuPrcCurrentGet(); + status = -1; + group = HuSprGrpCreate(1); + anim = HuSprAnimRead(HuDataReadNum(lbl_1_data_70[mgInfoTbl[lbl_1_bss_14].type], MEMORY_DEFAULT_NUM)); + sprite = HuSprCreate(anim, 0, 0); + HuSprGrpMemberSet(group, 0, sprite); + HuSprGrpDrawNoSet(group, 127); + HuSprPosSet(group, 0, 288, 240); + if(GWMGTypeGet() == -1) { + pic = mgInfoTbl[lbl_1_bss_14].inst_pic[0]; + } else { + pic = mgInfoTbl[lbl_1_bss_14].inst_pic[GWMGTypeGet()]; + } + lbl_1_bss_18 = HuSprAnimRead(HuDataReadNumHeapShortForce(pic, MEMORY_DEFAULT_NUM, HEAP_DATA)); + Hu3DShadowCreate(20, 500, 8000); + Hu3DShadowTPLvlSet(0); + Hu3DShadowSizeSet(192); + target.x = target.y = target.z = 0; + pos.x = pos.z = 100.0f; + pos.y = 7000.0f; + up.x = up.y = 0.0f; + up.z = 1.0f; + Hu3DShadowPosSet(&pos, &up, &target); + model = Hu3DModelCreateFile(lbl_1_data_50[mgInfoTbl[lbl_1_bss_14].type]); + lbl_1_bss_1C = model; + Hu3DModelPosSet(model, 0, 2000, 0); + Hu3DModelAttrSet(model, 0x40000002); + Hu3DModelCameraSet(model, 1); + Hu3DModelShadowSet(model); + i = Hu3DHookFuncCreate(fn_1_5B64); + Hu3DModelPosSet(i, 0, -200, 0); + Hu3DModelCameraSet(i, 1); + WipeCreate(WIPE_MODE_IN, WIPE_TYPE_NORMAL, 10); + while(WipeStatGet()) { + HuPrcVSleep(); + } + pos_z = -500.0f; + for(i=0; i<=50; i++) { + Hu3DModelPosSet(model, 0.0f, 2500.0*cos(M_PI*(i*1.8f)/180.0)-200.0, pos_z); + Hu3DModelRotSet(model, 0, 0, 45.0f*(1.0f-(i/50.0f))); + pos_z += 50.0/7.0; + Hu3DShadowTPLvlSet(0.5*(i/50.0f)); + HuPrcVSleep(); + } + HuAudFXPlay(1211); + Hu3DModelAttrReset(model, 0x40000002); + for(i=1; i<=20; i++) { + Hu3DModelPosSet(model, 0.0f, (200.0*(sin(M_PI*(i*2.25f)/180.0)*(1.0/sin(M_PI/4))))-200.0, pos_z); + rot_x = (20-i)*cos(M_PI*(i*13.5f)/180.0); + Hu3DModelRotSet(model, rot_x, 0.0f, 0.0f); + pos_z += 50.0/7.0; + HuPrcVSleep(); + } + Hu3DModelPosSet(model, 0.0f, 0.0f, 0.0f); + Hu3DModelAttrSet(model, 0x40000002); + HuPrcSleep(10); + HuAudFXPlay(1212); + Hu3DModelAttrReset(model, 0x40000002); + i = Hu3DHookFuncCreate(fn_1_50B0); + + Hu3DModelCameraSet(i, 1); + Hu3DModelPosSet(i, 0, 415, 0); + lbl_1_data_0 = 0; + while(Hu3DMotionTimeGet(model) < 80.0f) { + if(Hu3DMotionTimeGet(model) > 30.0f) { + lbl_1_data_0 = 2; + } + HuPrcVSleep(); + } + Hu3DModelAttrSet(model, 0x40000002); + HuDataDirClose(DATADIR_INST); + status = HuDataDirReadAsync(mgInfoTbl[lbl_1_bss_14].data_dir); + while(lbl_1_data_0 != 1) { + HuPrcVSleep(); + } + done = 0; + for(i=num_coms=0; i<4; i++) { + if(GWPlayerCfg[i].iscom) { + num_coms++; + } + } + i=0; + while(1) { + if(!done) { + for(btns=j=0; j<4; j++) { + if(!GWPlayerCfg[j].iscom) { + btns |= HuPadBtnDown[GWPlayerCfg[j].pad_idx]; + } + } + if((btns == PAD_BUTTON_START) || omSysExitReq || (num_coms == 4 && i > 60)) { + HuAudFXPlay(2); + done = 1; + } + if(btns == PAD_TRIGGER_Z) { + HuAudFXPlay(1); + done = 1; + his = omOvlHisGet(0); + omOvlHisChg(0, OVL_INST, 1, his->stat); + _SetFlag(0x1000C); + } + if(mgInstExitEnableF && (btns & PAD_BUTTON_B)) { + HuAudFXPlay(3); + if(status != -1) { + while(!HuDataGetAsyncStat(status)) { + HuPrcVSleep(); + } + } + WipeCreate(WIPE_MODE_OUT, WIPE_TYPE_NORMAL, 30); + HuAudSeqAllFadeOut(500); + while(WipeStatGet()) { + HuPrcVSleep(); + } + HuDataDirClose(mgInfoTbl[lbl_1_bss_14].data_dir); + if(mgInfoTbl[lbl_1_bss_14].ovl == OVL_M430) { + for(num_coms=0; num_coms<4; num_coms++) { + GWPlayerCfg[num_coms].group = GWPlayerCfg[num_coms].group/2; + } + } + omOvlReturnEx(1, 1); + HuPrcEnd(); + while(1) { + HuPrcVSleep(); + } + } + } + if(!lbl_1_bss_4 || !done) { + HuPrcVSleep(); + i++; + continue; + } else { + break; + } + } + if(status != -1) { + while(!HuDataGetAsyncStat(status)) { + HuPrcVSleep(); + } + } + spC = lbl_1_bss_40[0]; + pos = lbl_1_bss_28[0]; + pos_z = lbl_1_bss_20[0]; + WipeColorSet(255, 255, 255); + lbl_1_data_0 = 3; + HuPrcSleep(20); + lbl_1_data_0 = 4; + HuPrcSleep(10); + + Hu3DModelAttrReset(model, 0x40000002); + HuPrcSleep(10); + fov_vel = 0; + for(i=0; i<=60; i++) { + time = i/60.0f; + lbl_1_bss_40[0].x = spC.x+((-65.0f-spC.x)*time); + lbl_1_bss_40[0].y = spC.y+((8.0f-spC.y)*time); + lbl_1_bss_40[0].z = spC.z+(-spC.z)*time; + lbl_1_bss_28[0].x = pos.x+((17.0f-pos.x)*time); + lbl_1_bss_28[0].y = pos.y+((5.0f-pos.y)*time); + lbl_1_bss_28[0].z = pos.z+((-188.0f-pos.z)*time); + lbl_1_bss_20[0] = pos_z+((1173.0f-pos_z)*time); + if(i == 30) { + HuAudFXPlay(1210); + WipeCreate(WIPE_MODE_OUT, WIPE_TYPE_NORMAL, 30); + HuAudSeqAllFadeOut(1000); + } + if(i == 40) { + Hu3DModelAttrSet(model, 0x40000002); + } + if(i > 20) { + lbl_1_bss_C += fov_vel; + fov_vel += 0.04; + } + HuPrcVSleep(); + } + while(WipeStatGet()) { + lbl_1_bss_C += fov_vel; + fov_vel += 0.04; + HuPrcVSleep(); + } + lbl_1_data_0 = 6; + HuPrcVSleep(); + omSysPauseEnable(1); + if(omSysExitReq) { + HuDataDirClose(mgInfoTbl[lbl_1_bss_14].data_dir); + omOvlReturnEx(1, 1); + } else { + omOvlCallEx(mgInfoTbl[lbl_1_bss_14].ovl, 1, 0, 0); + } + HuPrcEnd(); + while(1) { + HuPrcVSleep(); + } +} \ No newline at end of file diff --git a/src/REL/modeltestDll/main.c b/src/REL/modeltestDll/main.c index 7c1bbae8..444cea7a 100644 --- a/src/REL/modeltestDll/main.c +++ b/src/REL/modeltestDll/main.c @@ -9,6 +9,7 @@ #include "game/printfunc.h" #include "game/window.h" #include "game/gamework_data.h" +#include "game/sprite.h" #include "REL/modeltestDll.h" diff --git a/src/game/ClusterExec.c b/src/game/ClusterExec.c index 57fb5ef0..21032229 100644 --- a/src/game/ClusterExec.c +++ b/src/game/ClusterExec.c @@ -1,6 +1,7 @@ #include "game/ClusterExec.h" #include "game/EnvelopeExec.h" #include "game/hsfmotion.h" +#include "game/sprite.h" float GetClusterCurve(HsfTrack *arg0, float arg1) { float *var_r30; diff --git a/src/game/audio.c b/src/game/audio.c index 2a1e1dd5..804da97f 100644 --- a/src/game/audio.c +++ b/src/game/audio.c @@ -5,15 +5,6 @@ #include "game/wipe.h" #include "game/gamework_data.h" -typedef struct { - /* 0x00 */ s16 unk00; - /* 0x02 */ s16 unk02; - /* 0x04 */ s32 unk04; - /* 0x08 */ s32 unk08; - /* 0x0C */ s8 unk0C; - /* 0x0D */ s8 unk0D; -} sndGrpTableData; - static s32 HuSePlay(s32 arg0, UnkMsmStruct_01 *arg1); extern s16 omSysExitReq; @@ -346,111 +337,111 @@ s32 HuAudSStreamStatGet(s32 arg0) { return msmStreamGetStatus(arg0); } -sndGrpTableData sndGrpTable[] = { - { OVL_BOOT , 0xFFFF, 0, 1, 0xFF, 0xFF }, - { OVL_INST , 0xFFFF, 0, 1, 0xFF, 0xFF }, - { OVL_M401 , 0x0012, 0, 2, 0x40, 0x40 }, - { OVL_M402 , 0x0013, 0, 3, 0x30, 0x20 }, - { OVL_M403 , 0x0014, 0, 1, 0xFF, 0xFF }, - { OVL_M404 , 0x0015, 0, 1, 0xFF, 0xFF }, - { OVL_M405 , 0x0016, 0, 1, 0x40, 0x20 }, - { OVL_M406 , 0x0017, 0, 1, 0xFF, 0xFF }, - { OVL_M407 , 0x0018, 0, 1, 0xFF, 0xFF }, - { OVL_M408 , 0x0019, 0, 1, 0xFF, 0xFF }, - { OVL_M409 , 0x001A, 0, 4, 0xFF, 0xFF }, - { OVL_M410 , 0x001B, 0, 1, 0xFF, 0xFF }, - { OVL_M411 , 0x001C, 0, 1, 0xFF, 0xFF }, - { OVL_M412 , 0x001D, 0, 1, 0xFF, 0xFF }, - { OVL_M413 , 0x001E, 0, 1, 0xFF, 0xFF }, - { OVL_M414 , 0x001F, 0, 1, 0xFF, 0xFF }, - { OVL_M415 , 0x0020, 0, 1, 0xFF, 0xFF }, - { OVL_M416 , 0x0021, 0, 1, 0xFF, 0xFF }, - { OVL_M417 , 0x0022, 0, 1, 0xFF, 0xFF }, - { OVL_M418 , 0x0023, 0, 1, 0x40, 0x40 }, - { OVL_M419 , 0x0024, 0, 6, 0xFF, 0xFF }, - { OVL_M420 , 0x0025, 0, 1, 0xFF, 0xFF }, - { OVL_M421 , 0x0026, 0, 1, 0xFF, 0xFF }, - { OVL_M422 , 0x0027, 0, 1, 0xFF, 0xFF }, - { OVL_M423 , 0x0028, 0, 1, 0xFF, 0xFF }, - { OVL_M424 , 0x0029, 0, 1, 0xFF, 0xFF }, - { OVL_M425 , 0x002A, 0, 1, 0xFF, 0xFF }, - { OVL_M426 , 0x002B, 0, 1, 0xFF, 0xFF }, - { OVL_M427 , 0x002C, 0, 1, 0x40, 0x48 }, - { OVL_M428 , 0x002D, 0, 1, 0xFF, 0xFF }, - { OVL_M429 , 0x002E, 0, 1, 0xFF, 0xFF }, - { OVL_M430 , 0x002F, 0, 1, 0xFF, 0xFF }, - { OVL_M431 , 0x0030, 0, 1, 0xFF, 0xFF }, - { OVL_M432 , 0x0031, 0, 1, 0x30, 0x20 }, - { OVL_M433 , 0x0032, 0, 1, 0xFF, 0xFF }, - { OVL_M434 , 0x0033, 0, 1, 0xFF, 0xFF }, - { OVL_M435 , 0x0034, 0, 9, 0x20, 0x40 }, - { OVL_M436 , 0x0035, 0, 10, 0x20, 0x40 }, - { OVL_M437 , 0x0036, 0, 1, 0x20, 0x40 }, - { OVL_M438 , 0x0037, 0, 11, 0xFF, 0xFF }, - { OVL_M439 , 0x0038, 0, 12, 0x30, 0x20 }, - { OVL_M440 , 0x0039, 0, 1, 0xFF, 0xFF }, - { OVL_M441 , 0x003A, 0, 1, 0xFF, 0xFF }, - { OVL_M442 , 0x003B, 0, 1, 0xFF, 0xFF }, - { OVL_M443 , 0x003C, 0, 1, 0xFF, 0xFF }, - { OVL_M444 , 0x003D, 0, 1, 0xFF, 0xFF }, - { OVL_M445 , 0x003E, 0, 1, 0xFF, 0xFF }, - { OVL_M446 , 0x003F, 0, 1, 0xFF, 0xFF }, - { OVL_M447 , 0x0040, 0, 1, 0xFF, 0xFF }, - { OVL_M448 , 0x0041, 0, 1, 0xFF, 0xFF }, - { OVL_M449 , 0x0042, 0, 1, 0xFF, 0xFF }, - { OVL_M450 , 0x0043, 0, 13, 0x40, 0x40 }, - { OVL_M451 , 0x0044, 0, 1, 0xFF, 0xFF }, - { OVL_M453 , 0x0045, 0, 1, 0xFF, 0xFF }, - { OVL_M455 , 0x0046, 0, 1, 0xFF, 0xFF }, - { OVL_M456 , 0x0047, 0, 1, 0xFF, 0xFF }, - { OVL_M457 , 0x0048, 0, 14, 0x40, 0x20 }, - { OVL_M458 , 0x0049, 0, 15, 0x40, 0x20 }, - { OVL_M459 , 0x004A, 0, 1, 0xFF, 0xFF }, - { OVL_M460 , 0x004B, 0, 1, 0xFF, 0xFF }, - { OVL_M461 , 0x004C, 0, 1, 0xFF, 0xFF }, - { OVL_M462 , 0x004D, 0, 1, 0xFF, 0xFF }, - { OVL_M463 , 0x004E, 0, 1, 0xFF, 0xFF }, - { OVL_MENT , 0xFFFF, 0, 1, 0xFF, 0xFF }, - { OVL_MGMODE , 0x0001, 0, 1, 0xFF, 0xFF }, - { OVL_MODESEL , 0x0000, 0, 1, 0xFF, 0xFF }, - { OVL_MODELTEST, 0x0012, 0, 1, 0xFF, 0xFF }, - { OVL_MSETUP , 0x0000, 0, 1, 0xFF, 0xFF }, - { OVL_MSTORY , 0x0005, 0, 1, 0xFF, 0xFF }, - { OVL_MSTORY2 , 0x0005, 0, 1, 0xFF, 0xFF }, - { OVL_MSTORY3 , 0x0008, 0, 1, 0xFF, 0xFF }, - { OVL_NIS , 0x0009, 0, 1, 0xFF, 0xFF }, - { OVL_OPTION , 0xFFFF, 0, 1, 0xFF, 0xFF }, - { OVL_PRESENT , 0xFFFF, 0, 1, 0xFF, 0xFF }, - { OVL_RESULT , 0xFFFF, 0, 1, 0xFF, 0xFF }, - { OVL_SAF , 0x0000, 0, 2, 0x7F, 0x7F }, - { OVL_SELMENU , 0x0000, 0, 1, 0xFF, 0xFF }, - { OVL_W01 , 0x0009, 0, 1, 0xFF, 0xFF }, - { OVL_W02 , 0x000A, 0, 1, 0xFF, 0xFF }, - { OVL_W03 , 0x000B, 0, 1, 0xFF, 0xFF }, - { OVL_W04 , 0x000C, 0, 1, 0xFF, 0xFF }, - { OVL_W05 , 0x000D, 0, 1, 0xFF, 0xFF }, - { OVL_W06 , 0x000E, 0, 1, 0xFF, 0xFF }, - { OVL_W10 , 0x000F, 0, 1, 0xFF, 0xFF }, - { OVL_W20 , 0x0010, 0, 1, 0xFF, 0xFF }, - { OVL_W21 , 0x0011, 0, 1, 0xFF, 0xFF }, - { OVL_MPEX , 0x0004, 0, 1, 0xFF, 0xFF }, - { OVL_ZTAR , 0xFFFF, 0, 1, 0xFF, 0xFF }, - { OVL_E3SETUP , 0x0000, 0, 1, 0xFF, 0xFF }, - { OVL_STAFF , 0xFFFF, 0, 1, 0xFF, 0xFF }, - { OVL_INVALID , 0xFFFF, 0, 1, 0x00, 0x00 } +HuSndGrpData HuSndGrpTbl[] = { + { OVL_BOOT, -1, 0, 1, -1, -1 }, + { OVL_INST, -1, 0, 1, -1, -1 }, + { OVL_M401, 18, 0, 2, 64, 64 }, + { OVL_M402, 19, 0, 3, 48, 32 }, + { OVL_M403, 20, 0, 1, -1, -1 }, + { OVL_M404, 21, 0, 1, -1, -1 }, + { OVL_M405, 22, 0, 1, 64, 32 }, + { OVL_M406, 23, 0, 1, -1, -1 }, + { OVL_M407, 24, 0, 1, -1, -1 }, + { OVL_M408, 25, 0, 1, -1, -1 }, + { OVL_M409, 26, 0, 4, -1, -1 }, + { OVL_M410, 27, 0, 1, -1, -1 }, + { OVL_M411, 28, 0, 1, -1, -1 }, + { OVL_M412, 29, 0, 1, -1, -1 }, + { OVL_M413, 30, 0, 1, -1, -1 }, + { OVL_M414, 31, 0, 1, -1, -1 }, + { OVL_M415, 32, 0, 1, -1, -1 }, + { OVL_M416, 33, 0, 1, -1, -1 }, + { OVL_M417, 34, 0, 1, -1, -1 }, + { OVL_M418, 35, 0, 1, 64, 64 }, + { OVL_M419, 36, 0, 6, -1, -1 }, + { OVL_M420, 37, 0, 1, -1, -1 }, + { OVL_M421, 38, 0, 1, -1, -1 }, + { OVL_M422, 39, 0, 1, -1, -1 }, + { OVL_M423, 40, 0, 1, -1, -1 }, + { OVL_M424, 41, 0, 1, -1, -1 }, + { OVL_M425, 42, 0, 1, -1, -1 }, + { OVL_M426, 43, 0, 1, -1, -1 }, + { OVL_M427, 44, 0, 1, 64, 72 }, + { OVL_M428, 45, 0, 1, -1, -1 }, + { OVL_M429, 46, 0, 1, -1, -1 }, + { OVL_M430, 47, 0, 1, -1, -1 }, + { OVL_M431, 48, 0, 1, -1, -1 }, + { OVL_M432, 49, 0, 1, 48, 32 }, + { OVL_M433, 50, 0, 1, -1, -1 }, + { OVL_M434, 51, 0, 1, -1, -1 }, + { OVL_M435, 52, 0, 9, 32, 64 }, + { OVL_M436, 53, 0, 10, 32, 64 }, + { OVL_M437, 54, 0, 1, 32, 64 }, + { OVL_M438, 55, 0, 11, -1, -1 }, + { OVL_M439, 56, 0, 12, 48, 32 }, + { OVL_M440, 57, 0, 1, -1, -1 }, + { OVL_M441, 58, 0, 1, -1, -1 }, + { OVL_M442, 59, 0, 1, -1, -1 }, + { OVL_M443, 60, 0, 1, -1, -1 }, + { OVL_M444, 61, 0, 1, -1, -1 }, + { OVL_M445, 62, 0, 1, -1, -1 }, + { OVL_M446, 63, 0, 1, -1, -1 }, + { OVL_M447, 64, 0, 1, -1, -1 }, + { OVL_M448, 65, 0, 1, -1, -1 }, + { OVL_M449, 66, 0, 1, -1, -1 }, + { OVL_M450, 67, 0, 13, 64, 64 }, + { OVL_M451, 68, 0, 1, -1, -1 }, + { OVL_M453, 69, 0, 1, -1, -1 }, + { OVL_M455, 70, 0, 1, -1, -1 }, + { OVL_M456, 71, 0, 1, -1, -1 }, + { OVL_M457, 72, 0, 14, 64, 32 }, + { OVL_M458, 73, 0, 15, 64, 32 }, + { OVL_M459, 74, 0, 1, -1, -1 }, + { OVL_M460, 75, 0, 1, -1, -1 }, + { OVL_M461, 76, 0, 1, -1, -1 }, + { OVL_M462, 77, 0, 1, -1, -1 }, + { OVL_M463, 78, 0, 1, -1, -1 }, + { OVL_MENT, -1, 0, 1, -1, -1 }, + { OVL_MGMODE, 1, 0, 1, -1, -1 }, + { OVL_MODESEL, 0, 0, 1, -1, -1 }, + { OVL_MODELTEST, 18, 0, 1, -1, -1 }, + { OVL_MSETUP, 0, 0, 1, -1, -1 }, + { OVL_MSTORY, 5, 0, 1, -1, -1 }, + { OVL_MSTORY2, 5, 0, 1, -1, -1 }, + { OVL_MSTORY3, 8, 0, 1, -1, -1 }, + { OVL_NIS, 9, 0, 1, -1, -1 }, + { OVL_OPTION, -1, 0, 1, -1, -1 }, + { OVL_PRESENT, -1, 0, 1, -1, -1 }, + { OVL_RESULT, -1, 0, 1, -1, -1 }, + { OVL_SAF, 0, 0, 2, 127, 127 }, + { OVL_SELMENU, 0, 0, 1, -1, -1 }, + { OVL_W01, 9, 0, 1, -1, -1 }, + { OVL_W02, 10, 0, 1, -1, -1 }, + { OVL_W03, 11, 0, 1, -1, -1 }, + { OVL_W04, 12, 0, 1, -1, -1 }, + { OVL_W05, 13, 0, 1, -1, -1 }, + { OVL_W06, 14, 0, 1, -1, -1 }, + { OVL_W10, 15, 0, 1, -1, -1 }, + { OVL_W20, 16, 0, 1, -1, -1 }, + { OVL_W21, 17, 0, 1, -1, -1 }, + { OVL_MPEX, 4, 0, 1, -1, -1 }, + { OVL_ZTAR, -1, 0, 1, -1, -1 }, + { OVL_E3SETUP, 0, 0, 1, -1, -1 }, + { OVL_STAFF, -1, 0, 1, -1, -1 }, + { OVL_INVALID, -1, 0, 1, 0, 0 } }; void HuAudDllSndGrpSet(u16 ovl) { - sndGrpTableData *var_r31; + HuSndGrpData *var_r31; s16 var_r29; - var_r31 = sndGrpTable; + var_r31 = HuSndGrpTbl; while (1) { - if (var_r31->unk00 == ovl) { - var_r29 = var_r31->unk02; + if (var_r31->ovl == ovl) { + var_r29 = var_r31->grpset; break; } - if (var_r31->unk00 == OVL_INVALID) { + if (var_r31->ovl == OVL_INVALID) { var_r29 = 0x12; break; } @@ -459,14 +450,14 @@ void HuAudDllSndGrpSet(u16 ovl) { if (var_r29 != -1) { OSReport("SOUND ##########################\n"); HuAudSndGrpSetSet(var_r29); - if (var_r31->unk04 != auxANoBak || var_r31->unk08 != auxBNoBak) { - msmSysSetAux(var_r31->unk04, var_r31->unk08); - OSReport("Change AUX %d,%d\n", var_r31->unk04, var_r31->unk08); - auxANoBak = var_r31->unk04; - auxBNoBak = var_r31->unk08; + if (var_r31->auxANo != auxANoBak || var_r31->auxBNo != auxBNoBak) { + msmSysSetAux(var_r31->auxANo, var_r31->auxBNo); + OSReport("Change AUX %d,%d\n", var_r31->auxANo, var_r31->auxBNo); + auxANoBak = var_r31->auxANo; + auxBNoBak = var_r31->auxBNo; HuPrcVSleep(); } - HuAudAUXVolSet(var_r31->unk0C, var_r31->unk0D); + HuAudAUXVolSet(var_r31->auxAVol, var_r31->auxBVol); OSReport("##########################\n"); } } @@ -549,7 +540,7 @@ void HuAudAUXVolSet(s8 arg0, s8 arg1) { } void HuAudVoiceInit(s16 ovl) { - sndGrpTableData *var_r29; + HuSndGrpData *var_r29; OSTick temp_r23; s16 temp_r26; s16 temp_r25; @@ -559,12 +550,12 @@ void HuAudVoiceInit(s16 ovl) { s16 i; if (ovl != OVL_INVALID) { - var_r29 = sndGrpTable; + var_r29 = HuSndGrpTbl; while (1) { - if (var_r29->unk00 == ovl && var_r29->unk02 == -1) { + if (var_r29->ovl == ovl && var_r29->grpset == -1) { return; } - if (var_r29->unk00 == OVL_INVALID) { + if (var_r29->ovl == OVL_INVALID) { break; } var_r29++; diff --git a/src/game/board/lottery.c b/src/game/board/lottery.c index b10a9f25..d8ae7e4b 100755 --- a/src/game/board/lottery.c +++ b/src/game/board/lottery.c @@ -23,6 +23,8 @@ #include "math.h" +void HuSprGrpDrawNoSet(s16 group, s32 draw_no); + #define ABS(x) (((x) < 0) ? -(x) : (x)) typedef struct { diff --git a/src/game/board/main.c b/src/game/board/main.c index 1cf38513..2d1249ff 100644 --- a/src/game/board/main.c +++ b/src/game/board/main.c @@ -291,7 +291,7 @@ void BoardSaveInit(s32 board) GWSystem.bowser_event = 0; GWSystem.unk_32 = 1; GWSystem.mg_next = 0; - GWSystem.mg_next_type = 0; + GWMGTypeSet(0); GWSystem.unk_38 = 0; GWSystem.block_pos = 0; memset(GWSystem.board_data, 0, 32); diff --git a/src/game/board/mg_setup.c b/src/game/board/mg_setup.c index ce09c15a..7a1a8ad8 100644 --- a/src/game/board/mg_setup.c +++ b/src/game/board/mg_setup.c @@ -282,7 +282,7 @@ static void ExecMGSetup(void) { BoardDataAsyncWait(var_r22); var_r24 = mgNext + 0x191; BoardMGSetupPlayPush(mgType, var_r24); - GWSystem.mg_next_type = -1; + GWMGTypeSet(-1); GWMGAvailSet(var_r24); GWSystem.mg_next = var_r24 - 0x191; _SetFlag(0x10002U); diff --git a/src/game/chrman.c b/src/game/chrman.c index bbfb4f37..17b2b183 100755 --- a/src/game/chrman.c +++ b/src/game/chrman.c @@ -9,6 +9,7 @@ #include "game/hsfmotion.h" #include "game/object.h" #include "game/process.h" +#include "game/sprite.h" #include "math.h" diff --git a/src/game/hsfanim.c b/src/game/hsfanim.c index ef3b7121..0c45106f 100755 --- a/src/game/hsfanim.c +++ b/src/game/hsfanim.c @@ -3,6 +3,7 @@ #include "game/init.h" #include "game/memory.h" #include "game/process.h" +#include "game/sprite.h" #include "math.h" #include "string.h" diff --git a/src/game/minigame_seq.c b/src/game/minigame_seq.c index 244969ca..62bfe709 100644 --- a/src/game/minigame_seq.c +++ b/src/game/minigame_seq.c @@ -21,34 +21,6 @@ extern s16 HuSysVWaitGet(s16 param); -typedef struct seq_work SeqWork; - -typedef int (*SeqUpdateFunc)(SeqWork *work); -typedef int (*SeqInitFunc)(SeqWork *work, va_list params); - -typedef struct seq_work { - SeqUpdateFunc update; - char *data; - float x; - float y; - float scale_x; - float scale_y; - float unk_18; - float work_float[2]; - float unk_24; - s16 time; - s16 time_max; - s16 work_s16[4]; - s16 param[2]; - s16 type; - s16 spr_grp[16]; - s16 sprite[16]; - u8 seq_no; - u8 stat; - u8 unk_7C; - u8 unk_7D; -} SeqWork; - typedef struct seq_info { SeqInitFunc init; SeqUpdateFunc update; @@ -258,8 +230,8 @@ static s16 CreateSeq(s16 seq_no, va_list params) work->unk_18 = 0.0f; work->unk_7D = 255; work->time_max = info->time_max; - work->work_s16[0] = work->work_s16[1] = work->work_s16[2] = work->work_s16[3] = 0; - work->work_float[0] = work->work_float[1] = 0.0f; + work->timer_val = work->state = work->alt_word_len = work->word_len = 0; + work->angle = work->win_scale = 0.0f; work->param[0] = work->param[1] = 0; for(temp=0; temp<16; temp++) { work->sprite[temp] = work->spr_grp[temp] = -1; @@ -392,16 +364,16 @@ static int SeqInitTimer(SeqWork *work, va_list params) if(duration <= 0 && duration > 99) { duration = 99; } - work->work_s16[0] = duration; + work->timer_val = duration; if(x >= 0) { work->x = x; } if(y >= 0) { work->y = y; } - work->work_s16[2] = 0; - work->work_s16[1] = 2; - work->work_float[0] = 0; + work->alt_word_len = 0; + work->state = 2; + work->angle = 0; work->spr_grp[0] = spr_grp = HuSprGrpCreate(4); HuSprGrpScaleSet(spr_grp, work->scale_x, work->scale_y); spr_anim = HuSprAnimRead(SeqReadFile(DATA_MAKE_NUM(DATADIR_GAMEMES, 2))); @@ -426,7 +398,7 @@ static int SeqInitTimer(SeqWork *work, va_list params) HuSprGrpMemberSet(spr_grp, 3, sprite); HuSprPosSet(spr_grp, 3, 0, 0); if(seqPauseF) { - work->work_s16[1] = 1; + work->state = 1; for(i=0; i<2; i++) { HuSprAttrSet(spr_grp, i, HUSPR_ATTR_DISPOFF); (void)i; //Hack for Matching @@ -442,24 +414,24 @@ static int SeqUpdateTimer(SeqWork *work) u8 digits[2]; s16 i; s16 spr_grp = work->spr_grp[0]; - if(work->param[0] != 0 && work->work_s16[1] != -1) { + if(work->param[0] != 0 && work->state != -1) { switch(work->param[0]) { case 2: switch(work->param[1]) { case -1: work->stat |= 0x4; - work->work_s16[1] = -1; - work->work_float[0] = 0.0f; + work->state = -1; + work->angle = 0.0f; break; case 0: - work->work_s16[1] = 2; - work->work_float[0] = 0.0f; + work->state = 2; + work->angle = 0.0f; break; case 1: - work->work_s16[1] = 3; - work->work_float[0] = 0.0f; + work->state = 3; + work->angle = 0.0f; break; default: @@ -471,18 +443,18 @@ static int SeqUpdateTimer(SeqWork *work) case 1: if(work->param[1] < 0 && !(work->stat & 0x4)) { work->stat |= 0x4; - work->work_s16[1] = -1; - work->work_float[0] = 0.0f; + work->state = -1; + work->angle = 0.0f; } else { if(work->param[1] > 99) { - work->work_s16[0] = 99; + work->timer_val = 99; } else { - if(work->work_s16[0] != work->param[1]) { - work->work_s16[0] = work->param[1]; + if(work->timer_val != work->param[1]) { + work->timer_val = work->param[1]; if(work->param[1] <= 5) { HuAudFXPlay(6); - work->work_s16[1] = 3; - work->work_float[0] = 0.0f; + work->state = 3; + work->angle = 0.0f; HuSprColorSet(spr_grp, 0, 255, 112, 160); HuSprColorSet(spr_grp, 1, 255, 112, 160); } else { @@ -499,7 +471,7 @@ static int SeqUpdateTimer(SeqWork *work) for(i=0; i<2; i++) { HuSprAttrReset(spr_grp, i, HUSPR_ATTR_DISPOFF); } - work->work_s16[1] = 3; + work->state = 3; work->param[0] = 0; break; @@ -508,33 +480,33 @@ static int SeqUpdateTimer(SeqWork *work) break; } } - if(work->work_s16[1] == 1) { + if(work->state == 1) { return 1; } - if(work->work_s16[0] > 99) { + if(work->timer_val > 99) { digits[0] = digits[1] = 9; } else { s32 value; - value = work->work_s16[0]/10; + value = work->timer_val/10; digits[1] = value; - digits[0] = work->work_s16[0]-(value*10); + digits[0] = work->timer_val-(value*10); } HuSprGrpPosSet(spr_grp, work->x, work->y); HuSprGrpScaleSet(spr_grp, work->scale_x, work->scale_y); for(i=0; i<2; i++) { HuSprBankSet(spr_grp, i, digits[i]); } - if(work->work_s16[1] != 0) { - switch(work->work_s16[1]) { + if(work->state != 0) { + switch(work->state) { case 2: { float scale_x, scale_y; - scale = fabs(((sin((work->work_float[0]*M_PI)/180)*5.0f)+1.0f)-(sin((130*M_PI)/180)*5.0f)); + scale = fabs(((sin((work->angle*M_PI)/180)*5.0f)+1.0f)-(sin((130*M_PI)/180)*5.0f)); scale_x = work->scale_x*scale; scale_y = work->scale_y*scale; - work->work_float[0] += seqSpeed*5.0f; - if(work->work_float[0] > 130.0f) { - work->work_s16[1] = 0; + work->angle += seqSpeed*5.0f; + if(work->angle > 130.0f) { + work->state = 0; break; } HuSprGrpScaleSet(spr_grp, scale_x, scale_y); @@ -543,11 +515,11 @@ static int SeqUpdateTimer(SeqWork *work) case 3: { - scale = sin((work->work_float[0]*M_PI)/180)+1.0; - tp_lvl = 1.0-(sin((work->work_float[0]*M_PI)/180)*0.5); - work->work_float[0] += seqSpeed*18.0f; - if(work->work_float[0] > 180.0f) { - work->work_s16[1] = 0; + scale = sin((work->angle*M_PI)/180)+1.0; + tp_lvl = 1.0-(sin((work->angle*M_PI)/180)*0.5); + work->angle += seqSpeed*18.0f; + if(work->angle > 180.0f) { + work->state = 0; scale = 1.0f; tp_lvl = 1.0f; } @@ -563,14 +535,14 @@ static int SeqUpdateTimer(SeqWork *work) for(i=0; i<2; i++) { HuSprScaleSet(spr_grp, i, 1.0f, 1.0f); } - work->work_float[0] += 1.0f; - if(work->work_float[0] < 60.0f) { + work->angle += 1.0f; + if(work->angle < 60.0f) { break; } - tp_lvl = 1.0-((work->work_float[0]-60.0f)/20.0f); + tp_lvl = 1.0-((work->angle-60.0f)/20.0f); if(tp_lvl <= 0.0f) { tp_lvl = 0.0f; - work->work_s16[1] = 0; + work->state = 0; work->stat |= 0x8; } @@ -616,8 +588,8 @@ static int SeqInitType2(SeqWork *work, va_list params) if(y >= 0) { work->y = y; } - work->work_s16[1] = 0; - work->work_float[0] = 0.0f; + work->state = 0; + work->angle = 0.0f; x = 0; len = 0; str=work->data; @@ -636,7 +608,7 @@ static int SeqInitType2(SeqWork *work, va_list params) len++; } } - work->work_s16[3] = len; + work->word_len = len; for(i=0; i<6; i++) { if(x & (1 << i)) { anim_tbl[i] = HuSprAnimRead(SeqReadFile(seqType2SprTbl[i])); @@ -669,7 +641,7 @@ static int SeqInitType2(SeqWork *work, va_list params) } else if(c == ' ') { i = -1; } - work->work_s16[2] = x; + work->alt_word_len = x; if(i == -1) { x += 32; } else if(i >= 0) { @@ -682,8 +654,8 @@ static int SeqInitType2(SeqWork *work, va_list params) } } if(seqPauseF) { - work->work_s16[1] = 1; - for(i=0; iwork_s16[3]; i++) { + work->state = 1; + for(i=0; iword_len; i++) { HuSprAttrSet(spr_grp, i, HUSPR_ATTR_DISPOFF); } } @@ -695,16 +667,16 @@ static int SeqUpdateType2(SeqWork *work) float tp_lvl; s16 spr_grp; spr_grp = work->spr_grp[0]; - HuSprGrpPosSet(spr_grp, work->x-((0.5f*work->scale_x)*work->work_s16[2]), work->y); + HuSprGrpPosSet(spr_grp, work->x-((0.5f*work->scale_x)*work->alt_word_len), work->y); HuSprGrpScaleSet(spr_grp, work->scale_x, work->scale_y); - if(work->param[0] != 0 && work->work_s16[1] != -1) { + if(work->param[0] != 0 && work->state != -1) { switch(work->param[0]) { case 2: if(work->param[1] != -1) { (void)work; //HACK: to introduce extra branch } else { - work->work_s16[1] = -1; - work->work_float[0] = 0.0f; + work->state = -1; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -717,11 +689,11 @@ static int SeqUpdateType2(SeqWork *work) case 3: { s32 i; - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprAttrReset(spr_grp, i, HUSPR_ATTR_DISPOFF); (void)i; } - work->work_s16[1] = 0; + work->state = 0; work->param[0] = 0; } break; @@ -731,28 +703,28 @@ static int SeqUpdateType2(SeqWork *work) break; } } - if(work->work_s16[1] == 1) { + if(work->state == 1) { return 1; } work->time += seqSpeed; - if(work->time >= work->time_max && work->work_s16[1] != -1) { + if(work->time >= work->time_max && work->state != -1) { work->stat |= 0x4; - work->work_s16[1] = -1; - work->work_float[0] = 0.0f; + work->state = -1; + work->angle = 0.0f; } - if(work->work_s16[1] != 0) { - if(work->work_s16[1] != -1) { + if(work->state != 0) { + if(work->state != -1) { (void)work; //HACK: to introduce extra branch } else { s16 i; - work->work_float[0] += seqSpeed*0.1f; - tp_lvl = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + tp_lvl = 1.0f-work->angle; if(tp_lvl <= 0.0f) { tp_lvl = 0.0f; - work->work_s16[1] = 0; + work->state = 0; work->stat |= 0x8; } - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprTPLvlSet(spr_grp, i, tp_lvl); (void)i; } @@ -878,7 +850,7 @@ static s32 SeqMakeWord(SeqWork *work, char *str, s16 flags) HuSprGrpMemberSet(spr_grp, i, sprite); HuSprPosSet(spr_grp, i, char_pos[i]-x, 0.0f); } - work->work_s16[3] = len; + work->word_len = len; HuMemDirectFree(char_anim); HuMemDirectFree(char_pos); return grp_idx; @@ -953,19 +925,19 @@ static int SeqInitMGBasic(SeqWork *work, va_list params) s16 i; s16 word_grp; - work->work_s16[1] = va_arg(params, int); - if(work->work_s16[1] == 2) { + work->state = va_arg(params, int); + if(work->state == 2) { return SeqInitDraw(work, params); } work->type = 0; - work->work_float[0] = 0; + work->angle = 0; { s32 word_katakana; s32 word_flag; s32 word_ofs; word_katakana = 0; - if(work->work_s16[1] == 2 && seqLanguage == 0) { + if(work->state == 2 && seqLanguage == 0) { word_katakana = 1; } if(word_katakana) { @@ -978,11 +950,11 @@ static int SeqInitMGBasic(SeqWork *work, va_list params) } else { word_ofs = 3; } - word_grp = SeqMakeWord(work, wordMgTbl[work->work_s16[1]+word_ofs], word_flag); + word_grp = SeqMakeWord(work, wordMgTbl[work->state+word_ofs], word_flag); } HuSprGrpPosSet(work->spr_grp[word_grp], 0.0f, 0.0f); - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprTPLvlSet(work->spr_grp[word_grp], i, 1.0f); HuSprPosSet(work->spr_grp[word_grp], i, -100.0f, 240.0f); } @@ -1006,7 +978,7 @@ static int SeqUpdateMGBasic(SeqWork *work) (void)work; //HACK: to introduce extra branch } else { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -1032,7 +1004,7 @@ static int SeqUpdateMGBasic(SeqWork *work) work->time += seqSpeed; if(work->time >= work->time_max && work->type != -1) { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } if(work->type) { switch(work->type) { @@ -1041,27 +1013,27 @@ static int SeqUpdateMGBasic(SeqWork *work) float pos_x; float time; s16 i; - if(work->work_s16[1] == 0) { + if(work->state == 0) { if(work->time <= 40) { - for(i=0; iwork_s16[3]; i++) { - time = work->time-((20/work->work_s16[3])*(work->work_s16[3]-i-1)); + for(i=0; iword_len; i++) { + time = work->time-((20/work->word_len)*(work->word_len-i-1)); if(time < 0 || time > 20.0f) { continue; } - pos_x = (work->x-(0.5f*(work->work_s16[3]*56)))+28.0f+(i*56); + pos_x = (work->x-(0.5f*(work->word_len*56)))+28.0f+(i*56); if(time == 20.0f) { HuSprPosSet(work->spr_grp[0], i, pos_x, work->y); HuSprZRotSet(work->spr_grp[0], i, 0.0f); } else { - HuSprPosSet(work->spr_grp[0], i, pos_x-(((1.0-sin(((time*4.5f)*M_PI)/180.0))*(work->work_s16[3]*56*2))), work->y); + HuSprPosSet(work->spr_grp[0], i, pos_x-(((1.0-sin(((time*4.5f)*M_PI)/180.0))*(work->word_len*56*2))), work->y); HuSprZRotSet(work->spr_grp[0], i, (time/20.0f)*390.0f); } } } else { time = work->time-40; scale = work->scale_x+(0.5*sin(((time*9.0f)*M_PI)/180.0)); - for(i=0; iwork_s16[3]; i++) { - pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->work_s16[3]*56)))))+(scale*(i*56)); + for(i=0; iword_len; i++) { + pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->word_len*56)))))+(scale*(i*56)); HuSprPosSet(work->spr_grp[0], i, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], i, scale, work->scale_y+sin(((time*9.0f)*M_PI)/180.0)); } @@ -1079,7 +1051,7 @@ static int SeqUpdateMGBasic(SeqWork *work) } } else { if(work->time == 1) { - if(work->work_s16[1] == 1) { + if(work->state == 1) { HuAudFXPlay(37); } else { HuAudFXPlay(40); @@ -1090,29 +1062,29 @@ static int SeqUpdateMGBasic(SeqWork *work) if(work->time <= 20) { time = work->time; scale = work->scale_x+(0.5*sin(((time*9.0f)*M_PI)/180.0)); - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprAttrReset(work->spr_grp[0], i, HUSPR_ATTR_DISPOFF); - pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->work_s16[3]*56)))))+(scale*(i*56)); + pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->word_len*56)))))+(scale*(i*56)); HuSprPosSet(work->spr_grp[0], i, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], i, work->scale_x+sin(((time*9.0f)*M_PI)/180.0), work->scale_y+sin(((time*9.0f)*M_PI)/180.0)); } if(time == 20.0f) { - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprAttrReset(work->spr_grp[0], i, HUSPR_ATTR_DISPOFF); } } } else { if(work->time > 80) { - for(i=0; iwork_s16[3]; i++) { - time = (work->time-80)-((20/work->work_s16[3])*(work->work_s16[3]-i-1)); + for(i=0; iword_len; i++) { + time = (work->time-80)-((20/work->word_len)*(work->word_len-i-1)); if(time < 0.0f || time > 20.0f) { continue; } - pos_x = (28.0f+(work->x-(0.5f*(work->work_s16[3]*56))))+(i*56); + pos_x = (28.0f+(work->x-(0.5f*(work->word_len*56))))+(i*56); if(time == 20.0f) { HuSprAttrSet(work->spr_grp[0], i, HUSPR_ATTR_DISPOFF); } else { - HuSprPosSet(work->spr_grp[0], i, pos_x+((1.0-cos(((time*4.5f)*M_PI)/180.0f))*(work->work_s16[3]*56*2)), work->y); + HuSprPosSet(work->spr_grp[0], i, pos_x+((1.0-cos(((time*4.5f)*M_PI)/180.0f))*(work->word_len*56*2)), work->y); HuSprZRotSet(work->spr_grp[0], i, (time/20.0f)*390.0f); } } @@ -1131,17 +1103,17 @@ static int SeqUpdateMGBasic(SeqWork *work) case -1: { - work->work_float[0] += seqSpeed*0.1f; - scale = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + scale = 1.0f-work->angle; if(scale <= 0.0f) { scale = 0.0f; work->type = 0; work->stat |= 0x8; - if(work->work_s16[1] == 0) { + if(work->state == 0) { MGSeqPauseEnableCtrl(1); } } - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { HuSprTPLvlSet(work->spr_grp[0], idx, scale); } } @@ -1165,12 +1137,12 @@ static int SeqInitMGCommon(SeqWork *work, va_list params) s16 j; s16 word_grp; - work->work_s16[1] = va_arg(params, int); - if(work->work_s16[1] == 2) { + work->state = va_arg(params, int); + if(work->state == 2) { return SeqInitDraw(work, params); } work->type = 0; - work->work_float[0] = 0; + work->angle = 0; tp_lvl = 1.0f; for(i=0; i<4; i++) { if(i == 0) @@ -1179,7 +1151,7 @@ static int SeqInitMGCommon(SeqWork *work, va_list params) s32 word_flag; s32 word_ofs; word_katakana = 0; - if(work->work_s16[1] == 2 && seqLanguage == 0) { + if(work->state == 2 && seqLanguage == 0) { word_katakana = 1; } if(word_katakana) { @@ -1192,7 +1164,7 @@ static int SeqInitMGCommon(SeqWork *work, va_list params) } else { word_ofs = 3; } - word_grp = SeqMakeWord(work, wordMgTbl[work->work_s16[1]+word_ofs], word_flag); + word_grp = SeqMakeWord(work, wordMgTbl[work->state+word_ofs], word_flag); } else { s16 grp_idx; s32 new_grp; @@ -1211,7 +1183,7 @@ static int SeqInitMGCommon(SeqWork *work, va_list params) word_grp = new_grp; } HuSprGrpPosSet(work->spr_grp[word_grp], 0.0f, 0.0f); - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprTPLvlSet(work->spr_grp[word_grp], j, tp_lvl); HuSprPosSet(work->spr_grp[word_grp], j, -100.0f, 240.0f); HuSprPriSet(work->spr_grp[word_grp], j, i+5); @@ -1243,7 +1215,7 @@ static int SeqUpdateMGBattle(SeqWork *work) (void)work; //HACK: to introduce extra branch } else { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -1270,7 +1242,7 @@ static int SeqUpdateMGBattle(SeqWork *work) if(work->time >= work->time_max && work->type != -1) { work->stat |= 0x4; work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } if(work->type) { switch(work->type) { @@ -1279,12 +1251,12 @@ static int SeqUpdateMGBattle(SeqWork *work) s16 i, j; float time; float pos_x; - if(work->work_s16[1] == 0) { + if(work->state == 0) { if(work->time < 45) { if(work->time > 10 && work->time <= 40) { time = work->time-10; scale = 10.0f*(1.0f-(time/30.0f)); - pos_x = (work->x-(0.5f*(work->work_s16[3]*56)))+28.0f; + pos_x = (work->x-(0.5f*(work->word_len*56)))+28.0f; HuSprPosSet(work->spr_grp[0], 0, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], 0, work->scale_x+scale, work->scale_y+scale); scale = time/30.0f; @@ -1295,8 +1267,8 @@ static int SeqUpdateMGBattle(SeqWork *work) if(time < 0 || time > 40) { continue; } - for(j=1; jwork_s16[3]; j++) { - pos_x = (28.0f+(work->x-(0.5f*(work->work_s16[3]*56))))+(j*56); + for(j=1; jword_len; j++) { + pos_x = (28.0f+(work->x-(0.5f*(work->word_len*56))))+(j*56); if(time == 40.0f) { HuSprPosSet(work->spr_grp[i], j, pos_x, work->y); HuSprZRotSet(work->spr_grp[i], j, 0.0f); @@ -1352,8 +1324,8 @@ static int SeqUpdateMGBattle(SeqWork *work) if(work->time > 60) { time = work->time-60; scale = 0.5*sin((M_PI*(time*9.0f))/180.0); - for(j=0; jwork_s16[3]; j++) { - pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->work_s16[3]*56)*(scale+work->scale_x))))+((j*56)*(scale+work->scale_x)); + for(j=0; jword_len; j++) { + pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->word_len*56)*(scale+work->scale_x))))+((j*56)*(scale+work->scale_x)); HuSprPosSet(work->spr_grp[0], j, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], j, work->scale_x+scale, work->scale_y+scale); } @@ -1372,7 +1344,7 @@ static int SeqUpdateMGBattle(SeqWork *work) } } else { if(work->time == 1) { - if(work->work_s16[1] == 1) { + if(work->state == 1) { HuAudFXPlay(37); } else { HuAudFXPlay(40); @@ -1382,32 +1354,32 @@ static int SeqUpdateMGBattle(SeqWork *work) } if(work->time <= 20) { for(i=1; i<4; i++) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrSet(work->spr_grp[i], j, HUSPR_ATTR_DISPOFF); } } time = work->time; scale = work->scale_x+(0.5*sin((M_PI*(time*9.0f))/180.0)); - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrReset(work->spr_grp[0], j, HUSPR_ATTR_DISPOFF); - pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->work_s16[3]*56)))))+(scale*(j*56)); + pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->word_len*56)))))+(scale*(j*56)); HuSprPosSet(work->spr_grp[0], j, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], j, work->scale_x+(sin((M_PI*(time*9.0f))/180.0)), work->scale_y+(sin((M_PI*(time*9.0f))/180.0))); } if(time == 20.0f) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrReset(work->spr_grp[0], j, HUSPR_ATTR_DISPOFF); } } } else { if(work->time > 80 && work->time <= 95) { time = work->time-80; - for(j=0; jwork_s16[3]; j++) { - pos_x = (28.0f+(work->x-(0.5f*(work->work_s16[3]*56))))+(j*56); + for(j=0; jword_len; j++) { + pos_x = (28.0f+(work->x-(0.5f*(work->word_len*56))))+(j*56); HuSprPosSet(work->spr_grp[0], j, pos_x+((288.0f-pos_x)*(1.0-cos((M_PI*(time*6.0))/180.0))), work->y); } if(time == 15.0f) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrReset(work->spr_grp[1], j, HUSPR_ATTR_DISPOFF); HuSprPosSet(work->spr_grp[1], j, 288.0f, work->y); HuSprTPLvlSet(work->spr_grp[1], j, 1.0f); @@ -1415,7 +1387,7 @@ static int SeqUpdateMGBattle(SeqWork *work) } } else { if(work->time > 105) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { time = work->time-105; time -= j*3; if(time < 0) { @@ -1447,17 +1419,17 @@ static int SeqUpdateMGBattle(SeqWork *work) case -1: { - work->work_float[0] += seqSpeed*0.1f; - scale = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + scale = 1.0f-work->angle; if(scale <= 0.0f) { scale = 0.0f; work->type = 0; work->stat |= 0x8; - if(work->work_s16[1] == 0) { + if(work->state == 0) { MGSeqPauseEnableCtrl(1); } } - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { HuSprTPLvlSet(work->spr_grp[0], idx, scale); } } @@ -1485,7 +1457,7 @@ static int SeqUpdateMG1vs3(SeqWork *work) (void)work; //HACK: to introduce extra branch } else { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -1512,7 +1484,7 @@ static int SeqUpdateMG1vs3(SeqWork *work) if(work->time >= work->time_max && work->type != -1) { work->stat |= 0x4; work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } if(work->type) { switch(work->type) { @@ -1523,14 +1495,14 @@ static int SeqUpdateMG1vs3(SeqWork *work) float pos_x, pos_y; s16 i; s16 j; - if(work->work_s16[1] == 0) { + if(work->state == 0) { if(work->time <= 10) { scale = work->time/10.0f; time = work->time; - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { scale_x = 0.3*work->scale_x; scale_y = 0.3*work->scale_y; - pos_x = ((28.0f*scale_x)+(work->x-(0.5f*(scale_x*(work->work_s16[3]*56)))))+(scale_x*(idx*56)); + pos_x = ((28.0f*scale_x)+(work->x-(0.5f*(scale_x*(work->word_len*56)))))+(scale_x*(idx*56)); pos_y = work->y-(150.0*sin((M_PI*(((16.0f/3.0f)*time)+20.0f))/180.0)); HuSprPosSet(work->spr_grp[0], idx, pos_x, pos_y); HuSprScaleSet(work->spr_grp[0], idx, scale_x, scale_y*cos(M_PI*(12.0f*time)/180.0)); @@ -1539,7 +1511,7 @@ static int SeqUpdateMG1vs3(SeqWork *work) } else { if(work->time <= 60) { for(i=0; i<4; i++) { - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { time = (work->time-10)-(idx*3)-i; if(time < 0.0f) { time = 0.0f; @@ -1551,7 +1523,7 @@ static int SeqUpdateMG1vs3(SeqWork *work) scale = 0.3+(0.7*(1.0-cos((M_PI*(time*3.0f))/180.0))); scale_x = work->scale_x*scale; scale_y = work->scale_y*scale; - pos_x = ((28.0f*scale_x)+(work->x-(0.5f*(scale_x*(work->work_s16[3]*56)))))+(scale_x*(idx*56)); + pos_x = ((28.0f*scale_x)+(work->x-(0.5f*(scale_x*(work->word_len*56)))))+(scale_x*(idx*56)); pos_y = work->y-(150.0*sin((M_PI*(((16.0f/3.0f)*time)+20.0f))/180.0)); HuSprPosSet(work->spr_grp[i], idx, pos_x, pos_y); HuSprScaleSet(work->spr_grp[i], idx, scale_x, scale_y*cos(M_PI*(12.0f*time)/180.0)); @@ -1559,7 +1531,7 @@ static int SeqUpdateMG1vs3(SeqWork *work) } if(work->time == 60) { for(i=1; i<4; i++) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrSet(work->spr_grp[i], j, HUSPR_ATTR_DISPOFF); } } @@ -1568,8 +1540,8 @@ static int SeqUpdateMG1vs3(SeqWork *work) if(work->time > 70) { time = work->time-70; scale = 0.5*sin((M_PI*(time*9.0f))/180.0); - for(j=0; jwork_s16[3]; j++) { - pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->work_s16[3]*56)*(scale+work->scale_x))))+((j*56)*(scale+work->scale_x)); + for(j=0; jword_len; j++) { + pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->word_len*56)*(scale+work->scale_x))))+((j*56)*(scale+work->scale_x)); HuSprPosSet(work->spr_grp[0], j, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], j, work->scale_x+scale, work->scale_y+scale); } @@ -1589,7 +1561,7 @@ static int SeqUpdateMG1vs3(SeqWork *work) } } else { if(work->time == 1) { - if(work->work_s16[1] == 1) { + if(work->state == 1) { HuAudFXPlay(37); } else { HuAudFXPlay(40); @@ -1599,21 +1571,21 @@ static int SeqUpdateMG1vs3(SeqWork *work) } if(work->time <= 20) { for(i=1; i<4; i++) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrSet(work->spr_grp[i], j, HUSPR_ATTR_DISPOFF); } } time = work->time; scale = work->scale_x+(0.5*sin((M_PI*(time*9.0f))/180.0)); - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrReset(work->spr_grp[0], j, HUSPR_ATTR_DISPOFF); - pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->work_s16[3]*56)))))+(scale*(j*56)); + pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->word_len*56)))))+(scale*(j*56)); HuSprPosSet(work->spr_grp[0], j, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], j, work->scale_x+(sin((M_PI*(time*9.0f))/180.0)), work->scale_y+(sin((M_PI*(time*9.0f))/180.0))); } if(time == 20.0f) { for(i=1; i<4; i++) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrReset(work->spr_grp[i], j, HUSPR_ATTR_DISPOFF); } } @@ -1621,18 +1593,18 @@ static int SeqUpdateMG1vs3(SeqWork *work) } else { if(work->time > 80 || work->time < 140) { for(i=0; i<4; i++) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { time = (work->time-80)-i-j; if(time < 0 || time > 40) { continue; } if(time <= 20) { - float pos_base = (28.0f+(work->x-(0.5f*(work->work_s16[3]*56))))+(j*56); - pos_x = (28.0f+(work->x-(0.5f*(work->work_s16[3]*56))))+((work->work_s16[3]-j-1)*56); + float pos_base = (28.0f+(work->x-(0.5f*(work->word_len*56))))+(j*56); + pos_x = (28.0f+(work->x-(0.5f*(work->word_len*56))))+((work->word_len-j-1)*56); HuSprPosSet(work->spr_grp[i], j, pos_base+((time/20.0f)*(pos_x-pos_base)), work->y+((440.0f-work->y)*(time/20.0f))); } else { time -= 20.0f; - pos_x = (28.0f+(work->x-(0.5f*(work->work_s16[3]*56))))+((work->work_s16[3]-j-1)*56); + pos_x = (28.0f+(work->x-(0.5f*(work->word_len*56))))+((work->word_len-j-1)*56); pos_y = 440.0f; HuSprPosSet(work->spr_grp[i], j, pos_x, pos_y+((-40.0f-pos_y)*(time/20.0f))); } @@ -1653,17 +1625,17 @@ static int SeqUpdateMG1vs3(SeqWork *work) case -1: { - work->work_float[0] += seqSpeed*0.1f; - scale = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + scale = 1.0f-work->angle; if(scale <= 0.0f) { scale = 0.0f; work->type = 0; work->stat |= 0x8; - if(work->work_s16[1] == 0) { + if(work->state == 0) { MGSeqPauseEnableCtrl(1); } } - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { HuSprTPLvlSet(work->spr_grp[0], idx, scale); } } @@ -1691,7 +1663,7 @@ static int SeqUpdateMGStory(SeqWork *work) (void)work; //HACK: to introduce extra branch } else { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -1718,7 +1690,7 @@ static int SeqUpdateMGStory(SeqWork *work) if(work->time >= work->time_max && work->type != -1) { work->stat |= 0x4; work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } if(work->type) { switch(work->type) { @@ -1728,9 +1700,9 @@ static int SeqUpdateMGStory(SeqWork *work) float time; s16 i; s16 j; - if(work->work_s16[1] == 0) { + if(work->state == 0) { if(work->time <= 30) { - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { time = (work->time-(idx*2)); if(time < 0.0f || time > 15.0f) { continue; @@ -1745,23 +1717,23 @@ static int SeqUpdateMGStory(SeqWork *work) HuSprZRotSet(work->spr_grp[1], idx, (1.0-(time/15.0f))*-180.0); } if(work->time == 30) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrSet(work->spr_grp[1], j, HUSPR_ATTR_DISPOFF); } } } else { if(work->time > 35 && work->time <= 45) { time = work->time-35; - for(idx=0; idxwork_s16[3]; idx++) { - pos_x = (work->x-(0.5f*(work->work_s16[3]*56)))+28.0f+(idx*56); + for(idx=0; idxword_len; idx++) { + pos_x = (work->x-(0.5f*(work->word_len*56)))+28.0f+(idx*56); HuSprPosSet(work->spr_grp[0], idx, 288.0f+((pos_x-288.0f)*(time/10.0f)), work->y); } } else { if(work->time > 55) { time = work->time-55; scale = 0.5*sin(M_PI*(9.0f*time)/180.0); - for(j=0; jwork_s16[3]; j++) { - pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->work_s16[3]*56)*(scale+work->scale_x))))+((j*56)*(scale+work->scale_x)); + for(j=0; jword_len; j++) { + pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->word_len*56)*(scale+work->scale_x))))+((j*56)*(scale+work->scale_x)); HuSprPosSet(work->spr_grp[0], j, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], j, work->scale_x+scale, work->scale_y+scale); } @@ -1781,7 +1753,7 @@ static int SeqUpdateMGStory(SeqWork *work) } } else { if(work->time == 1) { - if(work->work_s16[1] == 1) { + if(work->state == 1) { HuAudFXPlay(37); } else { HuAudFXPlay(40); @@ -1791,42 +1763,42 @@ static int SeqUpdateMGStory(SeqWork *work) } if(work->time <= 20) { for(i=1; i<4; i++) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrSet(work->spr_grp[i], j, HUSPR_ATTR_DISPOFF); } } time = work->time; scale = work->scale_x+(0.5*sin((M_PI*(time*9.0f))/180.0)); - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrReset(work->spr_grp[0], j, HUSPR_ATTR_DISPOFF); - pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->work_s16[3]*56)))))+(scale*(j*56)); + pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->word_len*56)))))+(scale*(j*56)); HuSprPosSet(work->spr_grp[0], j, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], j, work->scale_x+(sin((M_PI*(time*9.0f))/180.0)), work->scale_y+(sin((M_PI*(time*9.0f))/180.0))); } if(time == 20.0f){ for(i=1; i<4; i++) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrReset(work->spr_grp[i], j, HUSPR_ATTR_DISPOFF); } } } } else if(work->time > 80 && work->time < 160) { for(i=0; i<4; i++) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { s16 initF; float dx, dy; time = (work->time-80)-i; if(time < 0 || time > 60) { continue; } - pos_x = (28.0f+(work->x-(0.5f*(work->work_s16[3]*56))))+(j*56); - dx = 28.0f+(work->x-(0.5f*(work->work_s16[3]*56))); + pos_x = (28.0f+(work->x-(0.5f*(work->word_len*56))))+(j*56); + dx = 28.0f+(work->x-(0.5f*(work->word_len*56))); pos_y = work->y; for(idx=initF=0; idxx-(0.5f*(work->work_s16[3]*56))); + pos_x = 28.0f+(work->x-(0.5f*(work->word_len*56))); initF = 1; dy = 25.0f; dx = 10.0f; @@ -1860,17 +1832,17 @@ static int SeqUpdateMGStory(SeqWork *work) case -1: { - work->work_float[0] += seqSpeed*0.1f; - scale = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + scale = 1.0f-work->angle; if(scale <= 0.0f) { scale = 0.0f; work->type = 0; work->stat |= 0x8; - if(work->work_s16[1] == 0) { + if(work->state == 0) { MGSeqPauseEnableCtrl(1); } } - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { HuSprTPLvlSet(work->spr_grp[0], idx, scale); } } @@ -1898,7 +1870,7 @@ static int SeqUpdateMG2vs2(SeqWork *work) (void)work; //HACK: to introduce extra branch } else { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -1925,7 +1897,7 @@ static int SeqUpdateMG2vs2(SeqWork *work) if(work->time >= work->time_max && work->type != -1) { work->stat |= 0x4; work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } if(work->type) { switch(work->type) { @@ -1945,11 +1917,11 @@ static int SeqUpdateMG2vs2(SeqWork *work) float time; s16 i; s16 j; - if(work->work_s16[1] == 0) { + if(work->state == 0) { if(work->time <= 30) { time = work->time; - for(idx=0; idxwork_s16[3]; idx++) { - pos_x = (28.0f+(work->x-(0.5f*(work->scale_x*(work->work_s16[3]*56)))))+(idx*56); + for(idx=0; idxword_len; idx++) { + pos_x = (28.0f+(work->x-(0.5f*(work->scale_x*(work->word_len*56)))))+(idx*56); HuSprPosSet(work->spr_grp[0], idx, pos_x+((1.0f-(time/30.0f))*letterOfs[(idx*2)]), work->y+((1.0f-(time/30.0f))*letterOfs[(idx*2)+1])); HuSprTPLvlSet(work->spr_grp[0], idx, time/30.0f); } @@ -1957,8 +1929,8 @@ static int SeqUpdateMG2vs2(SeqWork *work) if(work->time > 40 && work->time <= 60) { time = work->time-40; scale = 0.5*sin(((time*9.0f)*M_PI)/180.0); - for(j=0; jwork_s16[3]; j++) { - pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->work_s16[3]*56)*(scale+work->scale_x))))+((j*56)*(scale+work->scale_x)); + for(j=0; jword_len; j++) { + pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->word_len*56)*(scale+work->scale_x))))+((j*56)*(scale+work->scale_x)); HuSprPosSet(work->spr_grp[0], j, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], j, work->scale_x+scale, work->scale_y+scale); } @@ -1977,7 +1949,7 @@ static int SeqUpdateMG2vs2(SeqWork *work) } } else { if(work->time == 1) { - if(work->work_s16[1] == 1) { + if(work->state == 1) { HuAudFXPlay(37); } else { HuAudFXPlay(40); @@ -1987,21 +1959,21 @@ static int SeqUpdateMG2vs2(SeqWork *work) } if(work->time <= 20) { for(i=1; i<4; i++) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrSet(work->spr_grp[i], j, HUSPR_ATTR_DISPOFF); } } time = work->time; scale = work->scale_x+(0.5*sin((M_PI*(time*9.0f))/180.0)); - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrReset(work->spr_grp[0], j, HUSPR_ATTR_DISPOFF); - pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->work_s16[3]*56)))))+(scale*(j*56)); + pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->word_len*56)))))+(scale*(j*56)); HuSprPosSet(work->spr_grp[0], j, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], j, work->scale_x+(sin((M_PI*(time*9.0f))/180.0)), work->scale_y+(sin((M_PI*(time*9.0f))/180.0))); } if(time == 20.0f) { for(i=1; i<4; i++) { - for(j=0; jwork_s16[3]; j++) { + for(j=0; jword_len; j++) { HuSprAttrReset(work->spr_grp[i], j, HUSPR_ATTR_DISPOFF); } } @@ -2009,8 +1981,8 @@ static int SeqUpdateMG2vs2(SeqWork *work) } else { if(work->time > 80 && work->time < 140) { time = work->time-80; - for(idx=0; idxwork_s16[3]; idx++) { - float radius = (idx*56)-(((work->work_s16[3]-1)*56)/2); + for(idx=0; idxword_len; idx++) { + float radius = (idx*56)-(((work->word_len-1)*56)/2); float angle = (1.0f+(1.0f-(ABS(radius)/320.0f)))*720.0f; float new_scale; radius *= 1.0-(time/60.0f); @@ -2035,17 +2007,17 @@ static int SeqUpdateMG2vs2(SeqWork *work) case -1: { - work->work_float[0] += seqSpeed*0.1f; - scale = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + scale = 1.0f-work->angle; if(scale <= 0.0f) { scale = 0.0f; work->type = 0; work->stat |= 0x8; - if(work->work_s16[1] == 0) { + if(work->state == 0) { MGSeqPauseEnableCtrl(1); } } - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { HuSprTPLvlSet(work->spr_grp[0], idx, scale); } } @@ -2069,12 +2041,12 @@ static int SeqInitFlip(SeqWork *work, va_list params) s16 i; s16 word_grp; s16 word_ofs; - work->work_s16[1] = va_arg(params, int); - if(work->work_s16[1] == 2) { + work->state = va_arg(params, int); + if(work->state == 2) { return SeqInitDraw(work, params); } work->type = 0; - work->work_float[0] = 0; + work->angle = 0; { s32 word_ofs_temp; s32 word_katakana; @@ -2087,7 +2059,7 @@ static int SeqInitFlip(SeqWork *work, va_list params) } word_ofs = word_ofs_temp; word_katakana = 0; - if(work->work_s16[1] == 2 && word_ofs == 0) { + if(work->state == 2 && word_ofs == 0) { word_katakana = 1; } if(word_katakana) { @@ -2096,16 +2068,16 @@ static int SeqInitFlip(SeqWork *work, va_list params) word_flag = 0; } - word_grp = SeqMakeWord(work, wordMgTbl[work->work_s16[1]+word_ofs], word_flag); + word_grp = SeqMakeWord(work, wordMgTbl[work->state+word_ofs], word_flag); } HuSprGrpPosSet(work->spr_grp[word_grp], 0.0f, 0.0f); - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprTPLvlSet(work->spr_grp[word_grp], i, 0.0f); - HuSprPosSet(work->spr_grp[word_grp], i, (28.0f+(work->x-(0.5f*(work->work_s16[3]*56))))+(i*56), work->y); + HuSprPosSet(work->spr_grp[word_grp], i, (28.0f+(work->x-(0.5f*(work->word_len*56))))+(i*56), work->y); HuSprAttrSet(work->spr_grp[word_grp], i, HUSPR_ATTR_LINEAR); HuSprAttrReset(work->spr_grp[word_grp], i, HUSPR_ATTR_DISPOFF); } - work->work_s16[2] = work->work_s16[3]; + work->alt_word_len = work->word_len; { s32 word_ofs_temp; s32 word_katakana; @@ -2118,7 +2090,7 @@ static int SeqInitFlip(SeqWork *work, va_list params) } word_ofs = word_ofs_temp; word_katakana = 0; - if(work->work_s16[1] == 2 && word_ofs == 0) { + if(work->state == 2 && word_ofs == 0) { word_katakana = 1; } if(word_katakana) { @@ -2127,12 +2099,12 @@ static int SeqInitFlip(SeqWork *work, va_list params) word_flag = 0; } - word_grp = SeqMakeWord(work, wordMgTbl[work->work_s16[1]+word_ofs], word_flag); + word_grp = SeqMakeWord(work, wordMgTbl[work->state+word_ofs], word_flag); } HuSprGrpPosSet(work->spr_grp[word_grp], 0.0f, 0.0f); - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprTPLvlSet(work->spr_grp[word_grp], i, 0.0f); - HuSprPosSet(work->spr_grp[word_grp], i, (28.0f+(work->x-(0.5f*(work->work_s16[3]*56))))+(i*56), work->y); + HuSprPosSet(work->spr_grp[word_grp], i, (28.0f+(work->x-(0.5f*(work->word_len*56))))+(i*56), work->y); HuSprAttrSet(work->spr_grp[word_grp], i, HUSPR_ATTR_LINEAR); HuSprAttrReset(work->spr_grp[word_grp], i, HUSPR_ATTR_DISPOFF); } @@ -2156,7 +2128,7 @@ static int SeqUpdateFlip(SeqWork *work) (void)work; //HACK: to introduce extra branch } else { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -2183,7 +2155,7 @@ static int SeqUpdateFlip(SeqWork *work) if(work->time >= work->time_max && work->type != -1) { work->stat |= 0x4; work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } if(work->type) { switch(work->type) { @@ -2192,21 +2164,21 @@ static int SeqUpdateFlip(SeqWork *work) float time; float pos_x; s16 i; - if(work->work_s16[1] == 0) { + if(work->state == 0) { if(work->time <= 10) { - for(idx=0; idxwork_s16[2]; idx++) { + for(idx=0; idxalt_word_len; idx++) { HuSprTPLvlSet(work->spr_grp[0], idx, work->time/10.0f); } } else { if(work->time <= 30) { time = work->time-10; if(time <= 10) { - for(idx=0; idxwork_s16[2]; idx++) { + for(idx=0; idxalt_word_len; idx++) { HuSprScaleSet(work->spr_grp[0], idx, cos(M_PI*((time/10.0f)*90.0f)/180.0), 1.0f); } } else { time -= 10.0f; - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { HuSprTPLvlSet(work->spr_grp[1], idx, 1.0f); HuSprScaleSet(work->spr_grp[1], idx, sin(M_PI*((time/10.0f)*90.0f)/180.0), 1.0f); } @@ -2215,8 +2187,8 @@ static int SeqUpdateFlip(SeqWork *work) if(work->time > 35 && work->time <= 55) { time = work->time-35; scale = 0.5*sin(((time*9.0f)*M_PI)/180.0); - for(i=0; iwork_s16[3]; i++) { - pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->work_s16[3]*56)*(scale+work->scale_x))))+((i*56)*(scale+work->scale_x)); + for(i=0; iword_len; i++) { + pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->word_len*56)*(scale+work->scale_x))))+((i*56)*(scale+work->scale_x)); HuSprPosSet(work->spr_grp[1], i, pos_x, work->y); HuSprScaleSet(work->spr_grp[1], i, work->scale_x+scale, work->scale_y+scale); } @@ -2236,7 +2208,7 @@ static int SeqUpdateFlip(SeqWork *work) } } else { if(work->time == 1) { - if(work->work_s16[1] == 1) { + if(work->state == 1) { HuAudFXPlay(37); } else { HuAudFXPlay(40); @@ -2247,23 +2219,23 @@ static int SeqUpdateFlip(SeqWork *work) if(work->time <= 20) { time = work->time; scale = 0.5*sin(M_PI*(9.0f*time)/180.0); - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprTPLvlSet(work->spr_grp[1], i, 1.0f); - pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->work_s16[3]*56)*(scale+work->scale_x))))+((i*56)*(scale+work->scale_x)); + pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->word_len*56)*(scale+work->scale_x))))+((i*56)*(scale+work->scale_x)); HuSprPosSet(work->spr_grp[1], i, pos_x, work->y); HuSprScaleSet(work->spr_grp[1], i, work->scale_x+scale, work->scale_y+scale); } } else { if(work->time > 80 && work->time <= 160) { time = work->time-80; - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { scale = time-(idx*2); if(scale < 0 || scale > 15.0f) { continue; } HuSprScaleSet(work->spr_grp[1], idx, cos(M_PI*((scale/15.0f)*90.0f)/180.0), 1.0f); } - for(idx=0; idxwork_s16[2]; idx++) { + for(idx=0; idxalt_word_len; idx++) { scale = (time-15.0f)-(idx*2); if(scale < 0 || scale > 30.0f) { continue; @@ -2286,17 +2258,17 @@ static int SeqUpdateFlip(SeqWork *work) case -1: { - work->work_float[0] += seqSpeed*0.1f; - scale = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + scale = 1.0f-work->angle; if(scale <= 0.0f) { scale = 0.0f; work->type = 0; work->stat |= 0x8; - if(work->work_s16[1] == 0) { + if(work->state == 0) { MGSeqPauseEnableCtrl(1); } } - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { HuSprTPLvlSet(work->spr_grp[1], idx, scale); } } @@ -2324,7 +2296,7 @@ static int SeqUpdateMGBowser(SeqWork *work) (void)work; //HACK: to introduce extra branch } else { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -2351,7 +2323,7 @@ static int SeqUpdateMGBowser(SeqWork *work) if(work->time >= work->time_max && work->type != -1) { work->stat |= 0x4; work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } if(work->type) { switch(work->type) { @@ -2370,10 +2342,10 @@ static int SeqUpdateMGBowser(SeqWork *work) float scale_arr[16]; - if(work->work_s16[1] == 0) { + if(work->state == 0) { if(work->time <= 60) { - center_x = (0.5*(work->work_s16[3]*56))+20.0; - for(idx=0; idxwork_s16[3]; idx++) { + center_x = (0.5*(work->word_len*56))+20.0; + for(idx=0; idxword_len; idx++) { time = work->time-idx; if(time < 0) { scale_arr[idx] = 0.0f; @@ -2383,7 +2355,7 @@ static int SeqUpdateMGBowser(SeqWork *work) time = 50.0f; } time_angle = 540.0*(1.0f-(time/50.0f)); - pos_x = (28.0f+(0.5f*-(work->work_s16[3]*56)))+(idx*56); + pos_x = (28.0f+(0.5f*-(work->word_len*56)))+(idx*56); angle = 180.0*(atan2(pos_x, center_x)/M_PI); pos_x = work->x+(center_x*sin(M_PI*(angle+time_angle)/180.0)); pos_y = work->y-(240.0*(1.0-(time/50.0f))); @@ -2394,8 +2366,8 @@ static int SeqUpdateMGBowser(SeqWork *work) spr_idx[idx] = idx; } } - for(i=1; iwork_s16[3]; i++) { - for(idx=0; idxwork_s16[3]-i; idx++) { + for(i=1; iword_len; i++) { + for(idx=0; idxword_len-i; idx++) { if(scale_arr[idx] > scale_arr[idx+1]) { j= spr_idx[idx]; spr_idx[idx] = spr_idx[idx+1]; @@ -2406,15 +2378,15 @@ static int SeqUpdateMGBowser(SeqWork *work) } } } - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { HuSprPriSet(work->spr_grp[0], spr_idx[idx], idx+5); } } else { if(work->time > 60 && work->time <= 80) { time = work->time-60; scale = 0.5*sin(((time*9.0f)*M_PI)/180.0); - for(i=0; iwork_s16[3]; i++) { - pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->work_s16[3]*56)*(scale+work->scale_x))))+((i*56)*(scale+work->scale_x)); + for(i=0; iword_len; i++) { + pos_x = (28.0f*(scale+work->scale_x))+(work->x-(0.5f*((work->word_len*56)*(scale+work->scale_x))))+((i*56)*(scale+work->scale_x)); HuSprPosSet(work->spr_grp[0], i, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], i, work->scale_x+scale, work->scale_y+scale); } @@ -2434,7 +2406,7 @@ static int SeqUpdateMGBowser(SeqWork *work) } } else { if(work->time == 1) { - if(work->work_s16[1] == 1) { + if(work->state == 1) { HuAudFXPlay(37); } else { HuAudFXPlay(40); @@ -2444,21 +2416,21 @@ static int SeqUpdateMGBowser(SeqWork *work) } if(work->time <= 20) { for(j=1; j<4; j++) { - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprAttrSet(work->spr_grp[j], i, HUSPR_ATTR_DISPOFF); } } time = work->time; scale = work->scale_x+(0.5*sin(((time*9.0f)*M_PI)/180.0)); - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprAttrReset(work->spr_grp[0], i, HUSPR_ATTR_DISPOFF); - pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->work_s16[3]*56)))))+(scale*(i*56)); + pos_x = ((28.0f*scale)+(work->x-(0.5f*(scale*(work->word_len*56)))))+(scale*(i*56)); HuSprPosSet(work->spr_grp[0], i, pos_x, work->y); HuSprScaleSet(work->spr_grp[0], i, work->scale_x+(sin((M_PI*(time*9.0f))/180.0)), work->scale_y+(sin((M_PI*(time*9.0f))/180.0))); } if(time == 20.0f) { for(j=1; j<4; j++) { - for(i=0; iwork_s16[3]; i++) { + for(i=0; iword_len; i++) { HuSprAttrReset(work->spr_grp[j], i, HUSPR_ATTR_DISPOFF); } } @@ -2479,8 +2451,8 @@ static int SeqUpdateMGBowser(SeqWork *work) if(time < 0.0f || time > 15.0f) { continue; } - for(idx=0; idxwork_s16[3]; idx++) { - pos_x = (28.0f+(work->x-(0.5f*(work->work_s16[3]*56))))+(idx*56); + for(idx=0; idxword_len; idx++) { + pos_x = (28.0f+(work->x-(0.5f*(work->word_len*56))))+(idx*56); pos_x += (time/15.0f)*(letterOfs[(idx*2)]-pos_x); pos_y = work->y+((time/15.0f)*(letterOfs[(idx*2)+1]-work->y)); HuSprPosSet(work->spr_grp[i], idx, pos_x, pos_y); @@ -2501,17 +2473,17 @@ static int SeqUpdateMGBowser(SeqWork *work) case -1: { - work->work_float[0] += seqSpeed*0.1f; - scale = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + scale = 1.0f-work->angle; if(scale <= 0.0f) { scale = 0.0f; work->type = 0; work->stat |= 0x8; - if(work->work_s16[1] == 0) { + if(work->state == 0) { MGSeqPauseEnableCtrl(1); } } - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { HuSprTPLvlSet(work->spr_grp[0], idx, scale); } } @@ -2531,10 +2503,10 @@ static int SeqUpdateMGBowser(SeqWork *work) static int SeqInitDraw(SeqWork *work, va_list params) { s16 word_grp; - work->work_s16[1] = 2; + work->state = 2; work->seq_no = 13; work->type = 0; - work->work_float[0] = 0.0f; + work->angle = 0.0f; { s32 word_flag; s32 word_ofs; @@ -2569,7 +2541,7 @@ static int SeqUpdateDraw(SeqWork *work) (void)work; //HACK: to introduce extra branch } else { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -2593,7 +2565,7 @@ static int SeqUpdateDraw(SeqWork *work) if(work->time >= work->time_max && work->type != -1) { work->stat |= 0x4; work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } if(work->type) { switch(work->type) { @@ -2627,11 +2599,11 @@ static int SeqUpdateDraw(SeqWork *work) case -1: { float tp_lvl; - work->work_float[0] += seqSpeed*0.1f; - tp_lvl = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + tp_lvl = 1.0f-work->angle; if(tp_lvl <= 0.0f) { tp_lvl = 0.0f; - work->work_s16[1] = 0; + work->state = 0; work->stat |= 0x8; } HuSprGrpTPLvlSet(group, tp_lvl); @@ -2751,13 +2723,13 @@ static int SeqInitWin(SeqWork *work, va_list params) } } word_grp = SeqMakeWord(work, winWordTbl[word_idx], GET_WIN_KANAF()); - winnerNameW[0] = work->work_s16[3]*50; - for(i=0; iwork_s16[3]; i++) { - HuSprPosSet(work->spr_grp[word_grp], i, 25.0f+((i*50)-(0.5f*(work->work_s16[3]*50))), 0.0f); + winnerNameW[0] = work->word_len*50; + for(i=0; iword_len; i++) { + HuSprPosSet(work->spr_grp[word_grp], i, 25.0f+((i*50)-(0.5f*(work->word_len*50))), 0.0f); HuSprAttrSet(work->spr_grp[word_grp], i, HUSPR_ATTR_LINEAR); } num_winners = 0; - work->work_float[1] = 1.0f; + work->win_scale = 1.0f; for(j=0; j<4; j++) { s32 winner = va_arg(params, int); if(winner < 0) { @@ -2767,7 +2739,7 @@ static int SeqInitWin(SeqWork *work, va_list params) if(seqLanguage != 0) { char *name = winCharNameTbl[(winner*2)+GET_LANG_IDX()]; word_w = 0.0f; - for(i=word_w; iwork_s16[3]; i++, name++) { + for(i=word_w; iword_len; i++, name++) { if(*name == ' ') { word_w += 30.0f; } else { @@ -2776,7 +2748,7 @@ static int SeqInitWin(SeqWork *work, va_list params) } name = winCharNameTbl[(winner*2)+GET_LANG_IDX()]; word_x = 0.0f; - for(i=word_x; iwork_s16[3]; i++, name++) { + for(i=word_x; iword_len; i++, name++) { HuSprPosSet(work->spr_grp[word_grp], i, 25.0+(word_x-(0.5*word_w)), 0.0f); HuSprAttrSet(work->spr_grp[word_grp], i, HUSPR_ATTR_LINEAR); if(*name == ' ') { @@ -2785,23 +2757,23 @@ static int SeqInitWin(SeqWork *work, va_list params) word_x += 50.0f; } } - if(work->work_float[1] == 0.6f || winner == 7 || winner == 13 || winner == 10) { - work->work_float[1] = 0.6f; + if(work->win_scale == 0.6f || winner == 7 || winner == 13 || winner == 10) { + work->win_scale = 0.6f; } else { - work->work_float[1] = 0.75f; + work->win_scale = 0.75f; } winnerNameW[num_winners+1] = word_w; } else { if(winner == 7 || winner == 13) { - for(i=0;iwork_s16[3]; i++) { - HuSprPosSet(work->spr_grp[word_grp], i, 26.0f+((i*52)-(0.5f*(work->work_s16[3]*52))), 0.0f); + for(i=0;iword_len; i++) { + HuSprPosSet(work->spr_grp[word_grp], i, 26.0f+((i*52)-(0.5f*(work->word_len*52))), 0.0f); HuSprAttrSet(work->spr_grp[word_grp], i, HUSPR_ATTR_LINEAR); } - work->work_float[1] = 0.8f; - winnerNameW[num_winners+1] = work->work_s16[3]*52; + work->win_scale = 0.8f; + winnerNameW[num_winners+1] = work->word_len*52; } else { - work->work_float[1] = 1.0f; - winnerNameW[num_winners+1] = work->work_s16[3]*56; + work->win_scale = 1.0f; + winnerNameW[num_winners+1] = work->word_len*56; } } @@ -2810,13 +2782,13 @@ static int SeqInitWin(SeqWork *work, va_list params) if(num_winners == 0) { return 0; } - work->work_s16[1] = 0; - work->work_s16[3] = num_winners+1; - work->work_float[0] = 0.0f; + work->state = 0; + work->word_len = num_winners+1; + work->angle = 0.0f; work->type = 0; for(j=0; jwork_float[1])); + word_x = 32.0f+((float)winnerNameW[0]+(winnerNameW[1]*work->win_scale)); if(j == 0) { word_x = (((576.0f-word_x)/2.0f)+(word_x-(winnerNameW[0]/2)))-288.0f; } else { @@ -2827,7 +2799,7 @@ static int SeqInitWin(SeqWork *work, va_list params) if(winnerNameW[j]+32 < 288.0f) { word_x = 176.0f; } else { - word_x = 32.0f+((winnerNameW[j]*work->work_float[1])/2.0f); + word_x = 32.0f+((winnerNameW[j]*work->win_scale)/2.0f); } if(winPosOfs[num_winners-1][j][0] < 0) { word_x = -(288.0f-word_x); @@ -2865,7 +2837,7 @@ static int SeqUpdateWin(SeqWork *work) (void)work; //HACK: to introduce extra branch } else { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -2889,7 +2861,7 @@ static int SeqUpdateWin(SeqWork *work) if(work->time >= work->time_max && work->type != -1) { work->stat |= 0x4; work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } if(work->type) { switch(work->type) { @@ -2906,14 +2878,14 @@ static int SeqUpdateWin(SeqWork *work) HuSprGrpZRotSet(work->spr_grp[0], zrot); scale = 1.0+(5.0*cos(M_PI*(90.0f*(time/20.0f))/180.0)); tp_lvl = time/20.0f; - for(idx=1; idxwork_s16[3]; idx++) { + for(idx=1; idxword_len; idx++) { HuSprGrpTPLvlSet(work->spr_grp[idx], tp_lvl); - HuSprGrpScaleSet(work->spr_grp[idx], scale*work->work_float[1], scale); + HuSprGrpScaleSet(work->spr_grp[idx], scale*work->win_scale, scale); } } if(work->time > 20 && work->time <= 22) { HuSprGrpZRotSet(work->spr_grp[0], 0.0f); - for(idx=1; idxwork_s16[3]; idx++) { + for(idx=1; idxword_len; idx++) { float pos_x; float ofs[2]; if(work->time == 21) { @@ -2922,26 +2894,26 @@ static int SeqUpdateWin(SeqWork *work) } else { ofs[0] = ofs[1] = 0.0f; } - if(work->work_s16[3] == 2) { + if(work->word_len == 2) { pos_x = winnerNameW[1]+winnerNameW[0]+32; pos_x = (((576.0f-pos_x)/2.0f)+(winnerNameW[1]/2))-288.0f; } else { - if(abs(winPosOfs[work->work_s16[3]-2][idx][0]) == 144.0f) { + if(abs(winPosOfs[work->word_len-2][idx][0]) == 144.0f) { if(winnerNameW[idx]+32 < 288.0f) { pos_x = 176.0f; } else { - pos_x = 32.0f+((winnerNameW[idx]*work->work_float[1])/2.0f); + pos_x = 32.0f+((winnerNameW[idx]*work->win_scale)/2.0f); } - if(winPosOfs[work->work_s16[3]-2][idx][0] < 0) { + if(winPosOfs[work->word_len-2][idx][0] < 0) { pos_x = -(288.0f-pos_x); } else { pos_x = (576.0f-pos_x)-288.0f; } } else { - pos_x = winPosOfs[work->work_s16[3]-2][idx][0]; + pos_x = winPosOfs[work->word_len-2][idx][0]; } } - HuSprGrpPosSet(work->spr_grp[idx], (288.0f+pos_x)+ofs[0], ofs[1]+(240.0f+winPosOfs[work->work_s16[3]-2][idx][1])); + HuSprGrpPosSet(work->spr_grp[idx], (288.0f+pos_x)+ofs[0], ofs[1]+(240.0f+winPosOfs[work->word_len-2][idx][1])); } } if(work->time == 125) { @@ -2952,14 +2924,14 @@ static int SeqUpdateWin(SeqWork *work) case -1: { - work->work_float[0] += seqSpeed*0.1f; - tp_lvl = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + tp_lvl = 1.0f-work->angle; if(tp_lvl <= 0.0f) { tp_lvl = 0.0f; - work->work_s16[1] = 0; + work->state = 0; work->stat |= 0x8; } - for(idx=0; idxwork_s16[3]; idx++) { + for(idx=0; idxword_len; idx++) { HuSprGrpTPLvlSet(work->spr_grp[idx], tp_lvl); } } @@ -2987,7 +2959,7 @@ static int SeqInitRecord(SeqWork *work, va_list params) s32 digit; seqRecordVal = va_arg(params, int); work->type = 0; - work->work_float[0] = 0.0f; + work->angle = 0.0f; work->spr_grp[0] = spr_grp = HuSprGrpCreate(10); spr_data = HuSprAnimRead(SeqReadFile(DATA_MAKE_NUM(DATADIR_GAMEMES, 9))); sprite = HuSprCreate(spr_data, 0, 0); @@ -3095,7 +3067,7 @@ static int SeqUpdateRecord(SeqWork *work) { s16 group; if(_CheckFlag(0x1000C)) { - work->work_s16[1] = 0; + work->state = 0; work->stat |= 0xC; } else { group = work->spr_grp[0]; @@ -3106,7 +3078,7 @@ static int SeqUpdateRecord(SeqWork *work) (void)work; //HACK: to introduce extra branch } else { work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } work->param[0] = 0; break; @@ -3130,7 +3102,7 @@ static int SeqUpdateRecord(SeqWork *work) if(work->time >= work->time_max && work->type != -1) { work->stat |= 0x4; work->type = -1; - work->work_float[0] = 0.0f; + work->angle = 0.0f; } if(work->type) { switch(work->type) { @@ -3151,11 +3123,11 @@ static int SeqUpdateRecord(SeqWork *work) case -1: { float tp_lvl; - work->work_float[0] += seqSpeed*0.1f; - tp_lvl = 1.0f-work->work_float[0]; + work->angle += seqSpeed*0.1f; + tp_lvl = 1.0f-work->angle; if(tp_lvl <= 0.0f) { tp_lvl = 0.0f; - work->work_s16[1] = 0; + work->state = 0; work->stat |= 0x8; } HuSprGrpTPLvlSet(group, tp_lvl); @@ -3209,7 +3181,7 @@ static void PauseProc(void) work.sprite[i] = work.spr_grp[i] = -1; } SeqMakeWord(&work, pauseStr[GET_LANG_IDX()], 0); - for(i=0; i