1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3#pragma name_counter 885
5#pragma argument_flag_free 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609
6#pragma argument_flag_free 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619
7#pragma argument_flag_free 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629
8#pragma argument_flag_free 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639
9#pragma argument_flag_free 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649
10#pragma argument_flag_free 3650, 3651, 3652, 3653, 3654, 3655, 3656, 3657, 3658, 3659
11#pragma argument_flag_free 3660, 3661, 3662, 3663, 3664, 3665, 3666, 3667, 3668, 3669
12#pragma argument_flag_free 3670, 3671, 3672, 3673, 3674, 3675, 3676, 3677, 3678, 3679
13#pragma argument_flag_free 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689
14#pragma argument_flag_free 3690, 3691, 3692, 3693, 3694, 3695, 3696, 3697, 3698, 3699
15#pragma argument_flag_free 3700, 3701, 3702, 3703, 3704, 3705, 3706, 3707, 3708, 3709
16#pragma argument_flag_free 3710, 3711, 3712, 3713, 3714, 3715, 3716, 3717, 3718, 3719
17#pragma argument_flag_free 3720, 3721, 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729
18#pragma argument_flag_free 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739
19#pragma argument_flag_free 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749
20#pragma argument_flag_free 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759
21#pragma argument_flag_free 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769
22#pragma argument_flag_free 3770, 3771, 3772, 3773, 3774, 3775, 3776, 3777, 3778, 3779
23#pragma argument_flag_free 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789
24#pragma argument_flag_free 3790, 3791, 3792, 3793, 3794, 3795, 3796, 3797, 3798, 3799
25#pragma argument_flag_free 3800, 3801, 3802, 3803, 3804, 3805, 3806, 3807, 3808, 3809
26#pragma argument_flag_free 3810, 3811, 3812, 3813, 3814, 3815, 3816, 3817, 3818, 3819
27#pragma argument_flag_free 3820, 3821, 3822, 3823, 3824, 3825, 3826, 3827, 3828, 3829
28#pragma argument_flag_free 3830, 3831, 3832, 3833, 3834, 3835, 3836, 3837, 3838, 3839
29#pragma argument_flag_free 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3848, 3849
30#pragma argument_flag_free 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3857, 3858, 3859
31#pragma argument_flag_free 3860, 3861, 3862, 3863, 3864, 3865, 3866, 3867, 3868, 3869
32#pragma argument_flag_free 3870, 3871, 3872, 3873, 3874, 3875, 3876, 3877, 3878, 3879
33#pragma argument_flag_free 3880
34#pragma argument_flag_ones 154, 451, 493, 573, 574, 575, 591, 592, 593, 594
35#pragma argument_flag_ones 1155, 1173, 1174, 1175, 1176, 1239, 1249, 1250, 1285, 1289
36#pragma argument_flag_ones 1314, 1318, 1326, 1330, 1339, 1364, 1366, 1411, 1456, 1459
37#pragma argument_flag_ones 1460, 1464, 1471, 1473, 1489, 1491, 1505, 1755, 1756, 1810
38#pragma argument_flag_ones 1811, 1815, 1816, 1817, 1877, 1880, 1906, 1937, 1988, 2045
39#pragma argument_flag_ones 2197, 2243, 2244, 2362, 2411, 2426, 2433, 2444, 2450, 2473
40#pragma argument_flag_ones 2474, 2475, 2476, 2477, 2521, 2578, 2581, 2582, 2614, 2624
41#pragma argument_flag_ones 2700, 2897, 3024, 3309, 3337, 3513, 3515, 3587, 3589, 3684
42#pragma argument_flag_ones 3685, 3687, 3688, 3891, 3911, 3922, 3943, 3946, 3947, 3999
43#pragma argument_flag_ones 4058, 4069, 4077, 4097, 4100, 4135, 4142, 4157, 4160, 4185
44#pragma argument_flag_ones 4213, 4220, 4234, 4253, 4265, 4269, 4270, 4340, 4346, 4355
45#pragma argument_flag_ones 4367, 4393, 4415, 4422, 4429, 4701, 4702, 4703, 4746, 4749
46#pragma argument_flag_ones 4810, 4811, 4813
47#pragma argument_flag 0
50#include "dun/gameloop.hpp"
59#include "battlemenu.hpp"
60#include "btactstatus.hpp"
67#include "clothread.hpp"
69#include "collision.hpp"
70#include "collisiondata.hpp"
71#include "dataalloc.hpp"
74#include "dispctrl.hpp"
75#include "dngmessageman.hpp"
76#include "dngstatusdata.hpp"
77#include "dranmapfield.hpp"
78#include "dungeoneventman.hpp"
81#include "editloop3.hpp"
83#include "frameattr.hpp"
84#include "gamemode.hpp"
87#include "healeffect.hpp"
88#include "hit_machingun_effect.hpp"
90#include "hitvalue.hpp"
91#include "itembombeffect.hpp"
94#include "mainitemmodel.hpp"
95#include "mainselect.hpp"
98#include "menu_draw.hpp"
99#include "menu_dungeon.hpp"
100#include "menu_misc.hpp"
101#include "menu_save.hpp"
102#include "menuitemstep.hpp"
104#include "monstorunit.hpp"
105#include "motionmodel.hpp"
107#include "npcharacter.hpp"
108#include "objanime.hpp"
109#include "randomitem.hpp"
111#include "runeffect.hpp"
114#include "shot_effect.hpp"
115#include "shot_effect_pack.hpp"
116#include "shot_firebar.hpp"
117#include "shot_freefuncs.hpp"
119#include "stealitem.hpp"
120#include "texture.hpp"
121#include "textureanime.hpp"
122#include "userstatus.hpp"
181s32 defWeapon__6[6] = {ITEM_WEAPON_DAGGER_BROKEN, ITEM_WEAPON_WOODENSLINGSHOT_BROKEN, ITEM_WEAPON_MALLET_BROKEN, ITEM_WEAPON_GOLD_RING_BROKEN, ITEM_WEAPON_FIGHTING_STICK_BROKEN, ITEM_WEAPON_MACHINE_GUN_BROKEN};
186static inline float CharaRangeRate(
CUserStatus *status) {
187 float range_rate[6] = {1.2f, 1.4f, 1.1f, 1.5f, 1.0f, 1.8f};
195static inline float CharaHeight(
CUserStatus *status) {
196 float chara_height[6] = {16.0f, 14.0f, 16.0f, 16.0f, 18.0f, 15.0f};
221void SetSystemMes(
int mes_no,
int frames,
int x,
int y,
int *result,
int *unk);
228void NotGetAtraMes(
int chara,
int frames);
235void DeadMes(
int chara,
int frames);
242void AllDeadMes(
int frames);
249int DebugInfomationIF();
256void SndSeSeqAllStop();
261int BtMiniChrSelect_Loop();
273void BtGetTreasureboxBig_Init();
278int BtGetTreasureboxBig_Loop();
285void BtGetTreasureboxSmall_Init(
int dungeon);
290int BtGetTreasureboxSmall_Loop();
297void BtAtraGetShort_Init();
302int BtAtraGetShort_Loop(
int dungeon,
int floor);
307int BtGetGateKey_Loop();
339void UngagaKey_Play();
346void ClearSystemMes();
353void BtSetActiveItemModel(
unsigned int *pack);
360void ClearGateKeyStack();
365void SndAmbientSetVol(
int volume);
372void BtBattleMusic_Init();
379void BtAtraListMake(
int dungeon);
386void DebugInfomationInit();
395static void LoadData();
425sceVu0FMATRIX main_light;
426sceVu0FMATRIX main_lightcolor;
427sceVu0FVECTOR main_ambientlight;
428sceVu0FMATRIX sub_light;
429sceVu0FMATRIX sub_lightcolor;
430sceVu0FVECTOR sub_ambientlight;
502sceVu0FVECTOR atraGetPos;
505sceVu0FVECTOR atraGetRot;
529sceVu0FVECTOR iventPos;
558float MonstorPicupInner[36];
588sceVu0FVECTOR veloOld;
626sceVu0FVECTOR ref_off;
629sceVu0FVECTOR ruby_effect_pos;
630sceVu0FVECTOR ruby_effect_vec;
633float unitAmbientAnime_rgb[3];
644 {0.0f, 0.0f, 0.0f, 0.0f}, {20.0f, 0.0f, 0.0f, 0.0f},
646 {0, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
654 {0.0f, 0.0f, 0.0f, 0.0f}, {1.5f, 0.0f, 0.0f, 0.0f},
656 {0, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
664 {0.0f, 0.0f, 0.0f, 0.0f}, {15.0f, 0.0f, 0.0f, 0.0f},
666 {0, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
674 {2.5f, 2.5f, 0.0f, 0.0f}, {5.0f, 5.0f, 0.0f, 0.0f},
676 {0, 1, 2, -1}, -1, {0, 0}, 0.0f, 0,
684 {2.5f, 2.5f, 0.0f, 0.0f}, {5.0f, 5.0f, 0.0f, 0.0f},
686 {0, 1, 2, -1}, -1, {0, 0}, 0.0f, 0,
694 {2.5f, 2.5f, 0.0f, 0.0f}, {5.0f, 5.0f, 0.0f, 0.0f},
696 {0, 1, 2, -1}, -1, {0, 0}, 0.0f, 0,
704 {2.5f, 2.5f, 0.0f, 0.0f}, {5.0f, 5.0f, 0.0f, 0.0f},
706 {0, 1, 2, -1}, -1, {0, 0}, 0.0f, 0,
714 {2.5f, 2.5f, 0.0f, 0.0f}, {5.0f, 5.0f, 0.0f, 0.0f},
716 {0, 1, 2, -1}, -1, {0, 0}, 0.0f, 0,
724 {0.2f, 0.9f, 0.2f, 0.2f}, {8.0f, 8.0f, 6.0f, 6.0f},
726 {0, 1, 2, 2}, -1, {0, 0}, 0.0f, 0,
734 {0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
736 {1, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
744 {3.5f, 3.5f, 0.2f, 0.2f}, {0.0f, 4.5f, 0.0f, 0.0f},
746 {0, 1, 2, -1}, -1, {0, 0}, 0.0f, 0,
754 {3.5f, 3.5f, 0.2f, 0.2f}, {0.0f, 4.5f, 0.0f, 0.0f},
756 {0, 1, 2, -1}, -1, {0, 0}, 0.0f, 0,
764 {0.0f, 0.5f, 0.2f, 0.2f}, {0.0f, 1.5f, 0.0f, 0.0f},
766 {1, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
774 {0.0f, 0.5f, 0.2f, 0.2f}, {0.0f, 1.5f, 0.0f, 0.0f},
776 {1, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
784 {0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f},
786 {1, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
796 &MyEntryEffect_RUBY_F1,
797 &MyEntryEffect_RUBY_C1,
798 &MyEntryEffect_RUBY_T1,
799 &MyEntryEffect_RUBY_W1,
800 &MyEntryEffect_RUBY_H1,
801 &MyEntryEffect_UNGAGA,
802 &MyEntryEffect_OZUMOND_M,
803 &MyEntryEffect_OZUMOND_H,
804 &MyEntryEffect_OZUMOND_H2,
805 &MyEntryEffect_OZUMOND_V2,
806 &MyEntryEffect_OZUMOND_G,
807 &MyEntryEffect_OZUMOND_S,
814 {0.0f, 0.0f, 0.0f, 0.0f}, {10.0f, 0.0f, 0.0f, 0.0f},
816 {0, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
824 {0.0f, 0.0f, 0.0f, 0.0f}, {10.0f, 0.0f, 0.0f, 0.0f},
826 {1, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
834 {0.0f, 0.0f, 0.0f, 0.0f}, {10.0f, 0.0f, 0.0f, 0.0f},
836 {3, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
844 {0.0f, 0.0f, 0.0f, 0.0f}, {10.0f, 0.0f, 0.0f, 0.0f},
846 {2, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
854 {0.0f, 0.0f, 0.0f, 0.0f}, {10.0f, 0.0f, 0.0f, 0.0f},
856 {4, -1, -1, -1}, -1, {0, 0}, 0.0f, 0,
862sceVu0FMATRIX ZeroMatrix = {
863 {0.0f, 0.0f, 0.0f, 0.0f},
864 {0.0f, 0.0f, 0.0f, 0.0f},
865 {0.0f, 0.0f, 0.0f, 0.0f},
866 {0.0f, 0.0f, 0.0f, 0.0f}
870float main_fogRate[4] = {1000.0f, 3500.0f, 0.0f, 255.0f};
871float sub_fogRate[4] = {1000.0f, 3500.0f, 0.0f, 255.0f};
874sceVu0FVECTOR def_ambientlight = {64.0f, 64.0f, 64.0f, 128.0f};
877sceVu0FMATRIX def_lightcolor = {
878 {120.0f, 120.0f, 120.0f, 128.0f},
879 {0.0f, 0.0f, 0.0f, 0.0f },
880 {0.0f, 0.0f, 0.0f, 0.0f },
881 {0.0f, 0.0f, 0.0f, 0.0f }
886MOTION_INFO itemOpenSmallFx_info = {10, 80, 0.5f, 0};
891sceVu0FVECTOR velo__2 = {0.0f, 0.0f, 0.0f, 0.0f};
894sceVu0FVECTOR velo2 = {0.0f, 0.0f, 0.0f, 0.0f};
897sceVu0FVECTOR blowVelo = {0.0f, 0.0f, 0.0f, 0.0f};
901 {
"#frame_image#640#" SCREEN_HEIGHT_STR
"#4", 1, 0},
902 {
"dun/etc/cursor.img", 1, 0},
903 {
"gatekey00.img", 1, 0},
904 {
"#water#640#" HALF_BUFFER_HEIGHT_STR
"#4", 13, 0},
905 {
"dun/etc/atrtx.img", 22, 0},
906 {
"wepready.img", 2, 0},
907 {
"#shadow_buf#640#" HALF_BUFFER_HEIGHT_STR
"#3", 15, 0},
908 {
"dun/effect/basefx00.img", 18, 0},
909 {
"basefx01.img", 18, 0},
910 {
"dun/d01/effect/fx_foot.img", 18, 0},
911 {
"dun/effect/bombfx00.img", 19, 0},
913 {
"#dbgwork#640#" SCREEN_HEIGHT_STR
"#3", 12, 0},
914 {
"check/ankfont.img", 12, 0},
916 {
"#mes_frame_buff#640#448#4", 26, 0},
917 {
"#fontbase#512#256#1", 26, 0},
918 {
"#fukidashibase#640#224#4", 26, 0},
919 {
"meswin/syst04.img", 26, 0},
920 {
"meswin/gaiji.img", 26, 0},
921 {
"meswin/fuki256.img", 26, 0},
923 {
"element.img", 18, 0},
924 {
"igetfx.img", 22, 0},
930 {
"#dbgwork#640#" SCREEN_HEIGHT_STR
"#3", 12, 0},
931 {
"check/ankfont.img", 12, 0},
938s32 camera_dist_mode__3 = 1;
941u8 main_fogColor[3] = {0x60, 0xA0, 0xEF};
942u8 sub_fogColor[3] = {0x60, 0xA0, 0xEF};
951float camera_up_near_dist = 60.0f;
952float camera_near_dist__2 = 10.0f;
953float camera_far_dist__2 = 80.0f;
956spRGBA ELife1 = {0xFF, 0x00, 0x00, 0x80};
957spRGBA ELife2 = {0xFF, 0xB4, 0x00, 0x80};
960spRGBA ELifeB1 = {0x80, 0x9B, 0xFF, 0x80};
961spRGBA ELifeB2 = {0x80, 0x9B, 0xFF, 0x80};
964spRGBA ELifeN1 = {0x00, 0x00, 0x20, 0x80};
1051s32 CharaMainHandViewFlag;
1075s32 Water_Splash_actFlag;
1093s32 atraShortGetType;
1094float atraGetStatusRate__2;
1099float atraGetMsgBordRate;
1100u_int *shortAtraEffectPtr;
1101float itemNormalScale;
1102s32 itemOpenSmallFlag;
1105u_int *itemOpenItemChr;
1109float itemWeponScale;
1131s32 driveNoInterpolate;
1140s32 lockOnTargetDraw;
1146s32 lockOnTargetFlag;
1149s32 targetCursorShiftNo;
1152s32 targetCursorShiftRot;
1164s32 BtEquipMasuisyou;
1190s32 BtItemListCashFlag;
1205unsigned int *ozumond_default_effect;
1225s32 DeadKeyStartWait;
1229unsigned int *old_read_buffer;
1250void LoadBaseTexture() {
1256 sprintf(texdata__2[2].name,
"gatekey0%d.img", selectMapNo + 1);
1258 char path[64] =
"dun/pack/dun/pack/teximg2.pac";
1260 if (LanguageCode > LANG_JAPANESE) {
1261 sprintf(path,
"dun/pack/teximg2_%d.pac", LanguageCode);
1264 LoadFile(path, (
void *) read_buffer, NULL);
1265 wait_now_loading_vsync();
1269 while ((name = texdata__2[i].name) != NULL) {
1272 if (name[0] ==
'#') {
1273 info[i].
name = name;
1275 u_int *found = GetPackFile(read_buffer, name, &size);
1277 if (found != NULL) {
1278 info[i].
name = (
char *) found;
1280 printf(
"Error::Pack->FileNotFound [%d]%s!!\n", i, name);
1289 info[i].
name = NULL;
1290 TexManager.LoadTextureBlock(-1, info);
1295 {
"#mes_frame_buff#640#480#4", 0x1A, 0},
1296 {
"#fukidashibase#640#224#4", 0x1A, 0},
1297 {
"#fontbase#512#256#1", 0x1A, 0},
1298 {
"meswin/gaiji.img", 0x1A, 0},
1299 {
"meswin/fuki256.img", 0x1A, 0},
1300 {
"meswin/syst04.img", 0x1A, 0},
1302 char mes_path[64] =
"meswin/mes_tex.pak";
1304 if (LanguageCode > LANG_JAPANESE) {
1305 sprintf(mes_path,
"meswin/mes_tex_%d.pak", LanguageCode);
1308 LoadFile(mes_path, read_buffer, NULL);
1309 wait_now_loading_vsync();
1310 mes_info[3].
name = (
char *) GetPackFile(read_buffer,
"gaiji.img", NULL);
1311 mes_info[4].
name = (
char *) GetPackFile(read_buffer,
"fuki256.img", NULL);
1312 mes_info[5].
name = (
char *) GetPackFile(read_buffer,
"syst04.img", NULL);
1313 TexManager.LoadTextureBlock(-1, mes_info);
1316void LoadBaseTexture() {
1322 sprintf(texdata__2[2].name,
"gatekey0%d.img", selectMapNo + 1);
1324 unsigned int *pack = read_buffer;
1326 LoadFile(
"dun/pack/teximg2.pac", pack, NULL);
1327 wait_now_loading_vsync();
1331 while ((name = texdata__2[i].name) != NULL) {
1334 if (name[0] ==
'#') {
1335 info[i].
name = name;
1337 u_int *found = GetPackFile(read_buffer, name, &size);
1339 if (found != NULL) {
1340 info[i].
name = (
char *) found;
1342 printf(
"Error::Pack->FileNotFound [%d]%s!!\n", i, name);
1351 info[i].
name = NULL;
1352 TexManager.LoadTextureBlock(-1, info);
1356int LoadTempTexture(
char **files,
int block,
char *buffer) {
1365 while (files[i] != NULL) {
1366 LoadFile(files[i], buffer, &size);
1367 wait_now_loading_vsync();
1370 info[i].
name = buffer;
1371 buffer += ((size >> 6) + 1) << 6;
1375 TexManager.DeleteTextureBlock(block);
1376 TexManager.LoadTextureBlockEX(block, info);
1380void SetTempTexture(
int block,
char *name) {
1384 info[0].
name = name;
1385 TexManager.DeleteTextureBlock(block);
1386 TexManager.LoadTextureBlockEX(block, info);
1389void MemoryMapDump() {
1390 printf(
"MainVisualData \t%d/%d\n", MainModelBuffer.
used, 0x9470);
1391 printf(
"MotionData \t%d/%d\n", MotionData.
used, 10000);
1392 printf(
"CharaModelBuffer\t%d/%d\n", CharaModelBuffer.
used, 0x33450);
1393 printf(
"MasekiModelBuffer\t%d/%d\n", MasekiModelBuffer.
used, 0xFDE8);
1394 printf(
"MapVisualData \t%d/%d\n", MapModelBuffer.
used, 0xA7F80);
1395 s32 monster_size = MonstorModelBuffer.
limit;
1397 printf(
"MonstorModelBuffer\t%d/%d\n", MonstorModelBuffer.
used, monster_size);
1398 printf(
"SystemScriptBuffer\t%d/%d\n", BtSystemScriptFileBuffer.
used, 0x88B8);
1399 printf(
"StartLogoBuffer\t %d/%d\n", BtStartLogoBuffer.
used, 5000);
1400 printf(
"BtMesBuffer\t %d/%d\n", BtMesBuffer.
used, 0x2904);
1401 printf(
"BtSteebMesBuffer\t%d/%d\n", BtSteebMesBuffer.
used, 0xDAC);
1402 TexManager.print_buff_info();
1414 selectMapNo = main_select_menu_no;
1422 for (i = 0; i < 6; i++) {
1431 int map = selectMapNo;
1436 sceVu0CopyMatrix(main_light, ZeroMatrix);
1437 sceVu0CopyMatrix(main_lightcolor, def_lightcolor);
1438 sceVu0CopyVector(main_ambientlight, def_ambientlight);
1439 sceVu0CopyMatrix(sub_light, ZeroMatrix);
1440 sceVu0CopyMatrix(sub_lightcolor, def_lightcolor);
1441 sceVu0CopyVector(sub_ambientlight, def_ambientlight);
1443 InitializeDataBuffer();
1444 SetDataBuffer(&MainModelBuffer, 0x9470);
1445 SetDataBuffer(&MotionData, 10000);
1446 SetDataBuffer(&CharaModelBuffer, 0x33450);
1447 SetDataBuffer(&MasekiModelBuffer, 0xFDE8);
1448 SetDataBuffer(&TextureData, 0xB3B0);
1449 SetDataBuffer(&BtSystemScriptFileBuffer, 0x88B8);
1450 SetDataBuffer(&BtMesBuffer, 0x2904);
1451 SetDataBuffer(&BtSteebMesBuffer, 0xDAC);
1452 SetDataBuffer(&BtStartLogoBuffer, 5000);
1453 SetDataBuffer(&BtScriptWorkBuffer, 100000);
1455 for (
int i = 0; i < 6; i++) {
1456 SetDataBuffer(&BtItemCashArea[i], 2501);
1459 for (
int i = 0; i < 16; i++) {
1460 SetDataBuffer(&MonstorScriptBuffer[i], 1875);
1463 SetDataBuffer(&MapModelBuffer, 0xA7F80);
1464 SetPacketReadBuffer(0x9344, 0x445C0);
1465 old_read_buffer = read_buffer;
1469 MainCamera__4.
SetFollow(0.0f, 0.0f, 0.0f);
1470 MainCamera__4.
Step(10);
1479 NowCamera__3 = &MainCamera__4;
1481 NowDngMap = &MainDungeonMap;
1485 for (
int i = 0; i < 64; i++) {
1488 slot->
name[0] =
'\0';
1495 for (
int i = 0; i < 96; i++) {
1498 state->
event = NULL;
1505 NowEventMan = &DngEventMan;
1508 for (
int i = 0; i < 12; i++) {
1513 DranMapField.
state[i] = 3;
1518 NowDranMapField = DranMapField.
field;
1519 NowColData = &CColData;
1521 for (
int i = 0; i < 12; i++) {
1522 ShotData.
used[i] = 0;
1525 NowShotData = &ShotData;
1526 HealEffect.
active =
false;
1529 for (
int i = 0; i < 5; i++) {
1533 NowShotEffect = &ShotEffect;
1535 for (
int i = 0; i < 5; i++) {
1539 for (
int i = 0; i < 16; i++) {
1540 OzumondShot.
damage[i] = 1;
1541 OzumondShot.
age[i] = 0;
1544 for (
int i = 0; i < 64; i++) {
1545 OzumondFire.
damage[i] = 1;
1546 OzumondFire.
state[i] = -1;
1553 for (
int i = 0; i < 16; i++) {
1557 for (
int i = 0; i < 16; i++) {
1558 OzumondShotEffect.
timer[i] = -1;
1561 NewChangeFxFlag = 0;
1563 for (
int i = 0; i < 32; i++) {
1564 HitValue[i].
active =
false;
1565 HitValue[i].
frame = NULL;
1568 NowHitValue = HitValue;
1573 for (
int i = 0; i < 16; i++) {
1574 MainMonstorUnit.
script[i] = &MonstorScriptBuffer[i];
1579 BtSetEventExtendTable();
1580 NowMonstorUnit = &MainMonstorUnit;
1581 NowWeaponHave = &WeaponHave;
1582 SetWeaponAttachStatus(NowWeaponHave);
1587 ClearGateKeyStack();
1588 TexManager.Initialize(0x3FE0);
1591 LoadFileMenuData(
"itempack.img", (
unsigned int *) read_buffer);
1592 wait_now_loading_vsync();
1593 TexManager.EnterIMGFile((
unsigned char *) read_buffer, -1, 0, 0);
1594 LoadFileMenuData(
"stayframe.img", (
unsigned int *) read_buffer);
1595 wait_now_loading_vsync();
1596 TexManager.EnterFixTextureZ((
unsigned char *) read_buffer);
1600 for (
int i = 0; i < 4; i++) {
1601 activeItem.
item[i] = -1;
1602 activeItem.
model[i] = -1;
1605 activeItem.
model[8] = -1;
1607 activeItem.
models = &mainItemModel;
1608 BtSetActiveItemModel(read_buffer);
1625 BtActStatus.unk_066 = 1;
1653 camera_dist_mode__3 = 2;
1659 switch (LanguageCode) {
1664 case LANG_ENGLISH_US:
1671 DngMes1.
Preset(MES_PRESET_SYSTEM);
1682 DngMes1.
style = MES_EDGE_NONE;
1683 DngMes1.
tex_buff = MesWinTexBuff_01;
1685 DngMes2.
Preset(MES_PRESET_SYSTEM);
1696 DngMes2.
tex_buff = MesWinTexBuff_02;
1714 DngMesStb.
blink = 0;
1719 for (
int i = 0; i < 10; i++) {
1720 DngMesStb.
mes_no[i] = -1;
1723 for (
int i = 0; i < 8; i++) {
1727 DngMesStb.
value = 0;
1737 for (
int i = 0; i < 10; i++) {
1742 DngMesStb.
Preset(MES_PRESET_NAME);
1755 DngMesStb.
tex_buff = MesWinTexBuff_11;
1760 BtEventMes0.
rows = 4;
1764 BtEventMes0.
style = MES_EDGE_NONE;
1769 BtEventMes0.
tex_buff = MesWinTexBuff_01;
1772 BtEventMes1.
rows = 5;
1778 BtEventMes1.
style = MES_EDGE_NONE;
1783 BtEventMes1.
tex_buff = MesWinTexBuff_02;
1785 mes = (
short *) (BtMesBuffer.
base + BtMesBuffer.
used * 16);
1786 sprintf(name,
"dun/message/ww_mes/dunmsd00_%d.mes", LanguageCode);
1787 LoadFile(name, mes, &size);
1788 wait_now_loading_vsync();
1791 MonsterNameInit(&DngMes2, mes, MesWinTexBuff_02);
1793 BtMesBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
1794 BtMesBuffer.Align64();
1796 mes = (
short *) (BtMesBuffer.
base + BtMesBuffer.
used * 16);
1797 sprintf(name,
"dun/message/ww_mes/font18_%d.mes", LanguageCode);
1798 LoadFile(name, mes, &size);
1799 wait_now_loading_vsync();
1801 BtMesBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
1802 BtMesBuffer.Align64();
1804 mes = (
short *) (BtMesBuffer.
base + BtMesBuffer.
used * 16);
1805 LoadFile(
"meswin/system14e.bin", mes, &size);
1806 wait_now_loading_vsync();
1807 BtMesBuffer.Alloc((size >> 4) + 1);
1814 DngMessMan.
timer = 0;
1823 for (
int i = 0; i < 32; i++) {
1824 CWeaponFx.
used[i] = 0;
1834 CWeaponFx.
timer = 0;
1836 for (
int i = 0; i < 4; i++) {
1840 SndSetReadBuffer(read_buffer);
1843 SndBgmLoad(selectMapNo + 100);
1847 SndSoundLoad(selectMapNo + 100);
1849 if (selectMapNo == DUNGEON_DEMON_SHAFT) {
1850 SndSePlay(SE_AMBIENT_DUNGEON_HISS, 0, 0);
1853 if (selectMapNo == DUNGEON_DIVINE_BEAST_CAVE) {
1854 SndSePlay(SE_AMBIENT_DUNGEON_HISS, 0, 0);
1855 SndSePlay(SE_AMBIENT_CAVE_DRIPS, 0, 0);
1858 if (selectMapNo == DUNGEON_SHIPWRECK) {
1859 SndSePlay(SE_AMBIENT_SHIPWRECK, 0, 0);
1862 if (selectMapNo >= DUNGEON_SUN_MOON_TEMPLE) {
1863 SndSePlay(SE_AMBIENT_DEEP_DUNGEON, 0, 0);
1867 SndAmbientSetVol(0);
1868 BtBattleMusic_Init();
1871 LoadStartLogo(selectMapNo);
1872 initBlendCnt(8, 1.0f);
1874 atraGetStatusRate__2 = 0.0f;
1880 itemOpenSmallFlag = 0;
1881 itemOpenBigFlag = 0;
1884 driveNoInterpolate = 0;
1885 int dungeon = selectMapNo;
1888 BtAtraListMake(dungeon);
1895 BtStatusAlarmInit();
1897 for (
int i = 0; i < 3; i++) {
1901 NowBombEffect = CBomb__2;
1902 ShockWave.
active =
false;
1903 NowShockWave = &ShockWave;
1922 CharaMainHandViewFlag = 0;
1923 MonstorViewFlag = 1;
1924 RsetUnitAmbientAnime();
1927 lockOnTargetFlag = 0;
1928 lockOnTargetNo = -1;
1929 EnemyLifeGage.
on = 0;
1930 EnemyLifeGage.
draw =
true;
1934 TEX_WepGage = TexManager.GetTexture(
"wepready", -1);
1935 TEX_Stayframe = TexManager.GetTexture(
"stayframe", -1);
1936 TEX_Shadow = TexManager.GetTexture(
"shadow_buf", -1);
1937 sprintf(gate_name,
"gatekey0%d", selectMapNo + 1);
1938 GoldTex = TexManager.GetTexture(gate_name, -1);
1940 if (GoldTex == NULL) {
1941 printf(
"******** ERR\n");
1944 BtMapJumpCashClear();
1961 DebugInfomationInit();
1962 EdDSetFont(&DbgMsg);
1964 BtItemListCashFlag = 0;
1967 BtSystemScriptEventInfoInit();
1968 BtSystemScriptInit();
1969 BtSystemScriptLoad(selectMapNo);
1971 BtGameModeFlag = BT_GAME_MODE_PLAY;
1974 gameTask = GAME_TASK_SCRIPT_START;
1981 switch (BtGameModeFlag) {
1982 case BT_GAME_MODE_PLAY:
1985 case BT_GAME_MODE_BATTLE_MENU:
1986 if (BattleMenuCursor() == 0) {
1987 BtGameModeFlag = BT_GAME_MODE_PLAY;
1993 switch (BtGameModeFlag) {
1994 case BT_GAME_MODE_PLAY:
1997 case BT_GAME_MODE_BATTLE_MENU:
2000 case BT_GAME_MODE_ITEM_SELECT:
2001 if (EventItemSelectLoop(&miniItemSelNo) != 0) {
2002 BtGameModeFlag = BT_GAME_MODE_PLAY;
2006 case BT_GAME_MODE_ENTRANCE_MENU: {
2007 int floor = DunEnterMenuLoop();
2016 BtGameModeFlag = BT_GAME_MODE_PLAY;
2021 case BT_GAME_MODE_ESCAPE_MSG: {
2022 int answer = DngEscapeMsgLoop();
2030 BtGameModeFlag = BT_GAME_MODE_PLAY;
2035 case BT_GAME_MODE_CHARA_CHANGE: {
2036 int chara = CharaChangeLoop();
2038 BtMiniChrSelectNo = chara;
2041 BtGameModeFlag = BT_GAME_MODE_PLAY;
2048 if (existFlag != 0) {
2049 while (ReadBGSync() == 1) {
2061 EdGetFadeColor(fade);
2068 for (i = 0; i < 6; i++) {
2087 if (DebugMode != 0 && GamePad.
On(PAD_SELECT) != 0 && GamePad.
Down(PAD_START) != 0) {
2088 while (ReadBGSync() == 1) {
2100 if (tryalExit != 0) {
2101 while (ReadBGSync() == 1) {
2116void Draw_MainUnitShadow() {
2124 MGGetPLight(light, colour);
2125 sceVu0CopyMatrix(saved, light);
2126 light[0][0] *= 0.2f;
2127 light[2][0] *= 0.2f;
2128 MGSetPLight(light, colour);
2130 TexManager.ReloadTexture(Vif1Packet, 15);
2131 MGBeginDrawShadow(*(
sceGsTex0 *) &TexManager.GetTexture(
"shadow_buf", -1)->
tex0);
2137 if (CMonUnitHyde == 0 && BtEventMode == 0) {
2141 if (BtEventMode != 0) {
2142 for (i = 0; i < 6; i++) {
2149 MGEndDrawShadow(0x40);
2150 sceVu0CopyMatrix(light, saved);
2151 MGSetPLight(light, colour);
2154void Draw_MainUnit() {
2157 float saved_light[4][4];
2158 float saved_colour[4][4];
2160 sceVu0FVECTOR stood;
2161 sceVu0FVECTOR towards;
2162 sceVu0FVECTOR world;
2163 sceVu0FMATRIX place;
2164 sceVu0FVECTOR ambient;
2165 sceVu0FVECTOR saved_ambient;
2171 MGGetPLight(light, colour);
2172 sceVu0CopyMatrix(saved_light, light);
2173 sceVu0CopyMatrix(saved_colour, colour);
2176 if (atraGetStatus != 0) {
2177 CFrame *lamp = shortAtraEffect.
frame->SearchFrame(
"light01");
2179 sceVu0CopyMatrix(place, lamp->
local);
2180 up[0] = place[3][0];
2181 up[1] = place[3][1];
2182 up[2] = place[3][2];
2183 lamp->GetWorldPosition(world, up);
2184 sceVu0CopyVector(stood, CharaFrame->
position);
2186 towards[0] = world[0] - stood[0];
2187 towards[1] = world[1] - stood[1] - 12.0f;
2188 towards[2] = world[2] - stood[2];
2190 float dist = sqrt(towards[0] * towards[0] + towards[1] * towards[1] + towards[2] * towards[2]);
2192 if (dist <= 10.0f) {
2196 float power = 5.0f * (100.0f / (dist * dist));
2198 sceVu0Normalize(towards, towards);
2199 towards[0] *= power;
2200 towards[1] *= power;
2201 towards[2] *= power;
2204 light[0][3] = towards[0];
2205 light[1][3] = towards[1];
2206 light[2][3] = towards[2];
2209 colour[3][0] = 0.8359375f * atraGetStatusRate__2;
2210 colour[3][1] = 0.9765625f * atraGetStatusRate__2;
2211 colour[3][2] = 0.66015625f * atraGetStatusRate__2;
2212 colour[3][3] = 0.5f * atraGetStatusRate__2;
2215 MGSetPLight(light, colour);
2216 MGGetAmbient(saved_ambient);
2217 MGGetAmbient(ambient);
2221 if (BtBySpeedFlag != 0) {
2222 static float rate = 0.0f;
2227 rate += 0.09817477f;
2232 ambient[2] = 96.0f + 96.0f * sinf(rate);
2235 if (BtStatusErrColorSet() != 0) {
2236 ambient[0] = StatusColor[0];
2237 ambient[1] = StatusColor[1];
2238 ambient[2] = StatusColor[2];
2241 float damage = setUnitDamageColor(0);
2243 if (damage != 128.0f) {
2244 ambient[0] = damage;
2245 ambient[1] = damage;
2246 ambient[2] = damage;
2247 ambient[3] = 128.0f;
2250 unitAmbientAnime(ambient);
2253 MGSetAmbient(ambient);
2254 TexManager.ReloadTexture(Vif1Packet, 0x11);
2259 TexManager.ReloadTexture(Vif1Packet, 0x1D);
2263 MGSetAmbient(saved_ambient);
2264 sceVu0CopyMatrix(light, saved_light);
2265 sceVu0CopyMatrix(colour, saved_colour);
2266 MGSetPLight(light, colour);
2270 sceVu0FMATRIX camera;
2279 NowCamera__3->
GetPos(eye);
2281 sceVu0UnitMatrix(unit);
2282 sceVu0MulMatrix(view, unit, camera);
2283 MGSetViewMatrix(view, eye);
2284 SndSetCamera(NowCamera__3);
2285 sceVif1PkCall(Vif1Packet, (u_long128 *) Vu_prog0f, 0);
2287 if (BtAllDrawFlag == 0) {
2288 if (BtItemListCashFlag != 0) {
2289 TexManager.ReloadTexture(Vif1Packet, 0x28);
2290 DngActiveItemTextureCopy();
2291 DngActiveWeaponTextureCopy();
2292 BtItemListCashFlag = 0;
2299 if (lightingMode == 0) {
2300 MGSetPLight(main_light, main_lightcolor);
2301 MGSetAmbient(main_ambientlight);
2302 MGSetBGColor(main_bgColor[0], main_bgColor[1], main_bgColor[2], 128.0f);
2303 MGSetFogParm(main_fogRate[0], main_fogRate[1], main_fogColor[0], main_fogColor[1], main_fogColor[2], main_fogRate[2], main_fogRate[3]);
2305 MGSetPLight(sub_light, sub_lightcolor);
2306 MGSetAmbient(sub_ambientlight);
2307 MGSetBGColor(sub_bgColor[0], sub_bgColor[1], sub_bgColor[2], 128.0f);
2308 MGSetFogParm(sub_fogRate[0], sub_fogRate[1], sub_fogColor[0], sub_fogColor[1], sub_fogColor[2], sub_fogRate[2], sub_fogRate[3]);
2311 if (BtItemListCashFlag != 0) {
2312 TexManager.ReloadTexture(Vif1Packet, 0x28);
2313 DngActiveItemTextureCopy();
2314 DngActiveWeaponTextureCopy();
2315 BtItemListCashFlag = 0;
2318 TexManager.ReloadTexture(Vif1Packet, 3);
2324 NowDngMap->
DrawMap(NowCamera__3, CharaFrame);
2331 NowDranMapField->CDranMapField::Draw();
2333 if (itemOpenSmallFlag == 0 && itemOpenBigFlag == 0) {
2334 sceVu0FVECTOR box_pos;
2336 sceVu0CopyVector(box_pos, CharaFrame->
position);
2339 if (itemOpenSmallFlag != 0) {
2340 itemOpenSmall.
Draw();
2343 if (itemOpenBigFlag != 0) {
2348 if (BtEventMode != 0) {
2349 sceVu0FVECTOR focus = {200.0f, 500.0f, 0.0f, 0.0f};
2351 DepthOfField(focus, 3, 0x40, 0);
2354 if (atraGetStatus == 0) {
2355 sceVu0FVECTOR atra_pos;
2357 TexManager.ReloadTexture(Vif1Packet, 0x16);
2358 sceVu0CopyVector(atra_pos, CharaFrame->
position);
2362 Draw_MainUnitShadow();
2368 if (CMonUnitHyde == 0 && BtEventMode == 0) {
2372 if (CharaMainHandViewFlag != 0) {
2373 TexManager.ReloadTexture(Vif1Packet, 0x11);
2375 if (UserStatus->
cur_chara == CHARA_XIAO) {
2380 TexManager.ReloadTexture(Vif1Packet, 0x1D);
2385 if (BtEventMode != 0) {
2386 for (i = 0; i < 6; i++) {
2387 if (EdEventInfo.
npc_draw[i] != 0) {
2388 TexManager.ReloadTexture(Vif1Packet, i + 0x20);
2392 if (i == BtEventInfo.
bee_npc) {
2393 DrawBee(NPCUnit[BtEventInfo.
bee_npc].frame, 0xF);
2400 mainItemModel.
Draw();
2401 TexManager.ReloadTexture(Vif1Packet, 6);
2404 if (Water_Splash_actFlag != 0) {
2405 Water_Splash.
Draw();
2410 sceVu0FVECTOR water_pos;
2412 TexManager.ReloadTexture(Vif1Packet, 0xD);
2413 MGGetFBuffTex(&frame_tex);
2417 area.
height = SCREEN_HALF_HEIGHT;
2418 water_tex = *(
sceGsTex0 *) &TexManager.GetTexture(
"water", -1)->
tex0;
2419 MGMoveImage(&frame_tex, area, &water_tex, 0, 0, 0);
2420 sceVu0CopyVector(water_pos, CharaFrame->
position);
2421 NowDngMap->
DrawWater(water_pos, driveStepHold);
2424 if (CEffectHyde == 0 && BtEventMode == 0) {
2425 TexManager.ReloadTexture(Vif1Packet, 0x13);
2426 NowShockWave->
Draw(NowCamera__3);
2428 for (i = 0; i < 3; i++) {
2429 CBomb__2[i].
Draw(NowCamera__3);
2432 for (i = 0; i < 5; i++) {
2433 MasekiEffect[i].
Draw();
2438 for (i = 0; i < 5; i++) {
2442 NowMainEffect->
Draw();
2445 sceVu0FVECTOR raster_pos;
2447 sceVu0CopyVector(raster_pos, CharaFrame->
position);
2448 TexManager.ReloadTexture(Vif1Packet, 0xE);
2452 NowDngMap->
DrawFire(CharaFrame, NowCamera__3);
2457 if (atraGetStatus != 0 && atraShortGetType != 0) {
2458 TexManager.ReloadTexture(Vif1Packet, 0x1C);
2459 shortAtraEffect.
Draw();
2462 if (gateItemFlag != 0) {
2463 TexManager.ReloadTexture(Vif1Packet, 0x1C);
2464 MGDraw(itemBoxModel);
2467 if (itemOpenSmallFlag != 0) {
2468 sceVu0FVECTOR ambient;
2472 MGGetAmbient(ambient);
2473 TexManager.ReloadTexture(Vif1Packet, 0x16);
2474 itemOpenSmallFx.
Draw();
2475 TexManager.ReloadTexture(Vif1Packet, 0x1C);
2476 sceVu0CopyVector(lift, itemBoxModel->
position);
2477 sceVu0CopyVector(held, lift);
2479 static float itemposr = -PI;
2481 itemposr += 0.10471976f;
2483 if (itemposr >= PI) {
2487 lift[1] += 0.5f * sinf(itemposr);
2488 itemBoxModel->SetPosition(lift);
2489 MGDraw(itemBoxModel);
2490 MGSetAmbient(ambient);
2491 itemBoxModel->SetPosition(held);
2494 if (itemOpenBigFlag != 0) {
2498 TexManager.ReloadTexture(Vif1Packet, 0x16);
2499 MGDraw(itemOpenBigFx.
frame);
2500 sceVu0CopyVector(lift, itemBoxModel->
position);
2501 sceVu0CopyVector(held, lift);
2503 static float itemposr = -PI;
2505 itemposr += 0.10471976f;
2507 if (itemposr >= PI) {
2511 lift[1] += 0.03f * sinf(itemposr);
2512 itemBoxModel->SetPosition(lift);
2513 TexManager.ReloadTexture(Vif1Packet, 0x1C);
2514 MGDraw(itemBoxModel);
2517 if (NewChangeFxFlag != 0) {
2521 TexManager.ReloadTexture(Vif1Packet, 0xB);
2522 sceVu0CopyVector(pos, CharaMain.
pos);
2529 if (EscapeFlag != 0) {
2530 TexManager.ReloadTexture(Vif1Packet, 0x1C);
2531 EscapeEffect.
Draw();
2535 TexManager.ReloadTexture(Vif1Packet, 1);
2537 if (CMonUnitHyde == 0 && BtEventMode == 0) {
2544 sceVu0CopyVector(mark, CharaMain.
pos);
2547 static float bic_posr = -PI_SHORT;
2549 bic_posr += 0.104719736f;
2551 if (bic_posr >= PI_SHORT) {
2552 bic_posr -= TWO_PI_SHORT;
2555 mark[1] += 0.5f * sinf(bic_posr);
2557 mark[1] += CharaHeight(UserStatus) - 15.0f;
2558 bicCursorFrame->SetPosition(mark);
2559 MGDraw(bicCursorFrame);
2563 if (BtAllClear == 0 && DebugStatus[10] == 0) {
2570 if (autoDemo == 0 && CMonUnitHyde == 0) {
2571 setTargetCursor(lockOnTargetFlag);
2573 if (lockOnTargetDraw != 0) {
2574 MGDraw(cursorFrame);
2575 lockOnTargetDraw = 0;
2582 sceVu0CopyVector(iventPos, CharaMain.
pos);
2583 iventPos[1] += 22.0f;
2585 static float bic_posr = -PI_SHORT;
2587 bic_posr += 0.104719736f;
2589 if (bic_posr >= PI_SHORT) {
2590 bic_posr -= TWO_PI_SHORT;
2593 iventPos[1] += 0.5f * sinf(bic_posr);
2595 iventPos[1] += CharaHeight(UserStatus) - 15.0f;
2596 bicCursorFrame->SetPosition(iventPos);
2599 if (BombInfo.
aiming != 0) {
2600 bombCursorFrame->SetPosition(BombInfo.
pos);
2601 MGDraw(bombCursorFrame);
2604 if (CEffectHyde == 0 && BtEventMode == 0) {
2610 if (autoDemo == 0) {
2614 TexManager.ReloadTexture(Vif1Packet, 0x12);
2621 MGSetGsALPHA(&blend);
2624 depth.bits.zmsk = 1;
2625 MGSetGsZBUF(&depth);
2627 for (i = 0; i < 4; i++) {
2628 CWeaponElFx[i].
Draw();
2631 WeaponCrashEffect.
Draw();
2633 for (i = 0; i < 16; i++) {
2635 HitPointMark[i].
Draw();
2636 MyHitPointMark[i].
Draw();
2641 if (CEffectHyde == 0 && BtEventMode == 0) {
2642 NowShotData->
draw();
2643 OzumondShotEffect.
Draw();
2656 TEX_Floor1 = TexManager.GetTexture(floor_name, -1);
2663 TexManager.ReloadTexture(Vif1Packet, 8);
2664 StartMessageDraw(TEX_Floor1, selectMapNo, UserStatus->
cur_floor, BtUraDongeon, rogoAlphaA[2]);
2668 TEX_Floor1 = TexManager.GetTexture(floor_name, -1);
2676 TexManager.ReloadTexture(Vif1Packet, 8);
2678 if (LanguageCode == LANG_JAPANESE) {
2679 switch (selectMapNo) {
2680 case DUNGEON_DIVINE_BEAST_CAVE:
2681 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(floor_no + 0xE2, 0xAA, 0x72, 0x32),
CRect_i_(0, 0, 0x72, 0x32), rogoAlphaA[2]);
2682 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0x17D, 0xAA, 0x4C, 0x32),
CRect_i_(0x72, 0, 0x4C, 0x32), rogoAlphaA[2]);
2684 case DUNGEON_WISE_OWL_FOREST:
2685 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0xBE, 0xAA, 0xBE, 0x32),
CRect_i_(0, 0, 0xBE, 0x32), rogoAlphaA[2]);
2688 case DUNGEON_SHIPWRECK:
2689 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(floor_no + 0xF5, 0xAA, 0x4C, 0x32),
CRect_i_(0, 0, 0x4C, 0x32), rogoAlphaA[2]);
2690 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0x159, 0xAA, 0x4C, 0x32),
CRect_i_(0x4C, 0, 0x4C, 0x32), rogoAlphaA[2]);
2693 case DUNGEON_SUN_MOON_TEMPLE:
2694 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0xE8, 0xAA, 0x98, 0x32),
CRect_i_(0, 0, 0x98, 0x32), rogoAlphaA[2]);
2697 case DUNGEON_MOON_SEA:
2698 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(floor_no + 0xD7, 0xAA, 0x4C, 0x32),
CRect_i_(0, 0, 0x4C, 0x32), rogoAlphaA[2]);
2699 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0x13B, 0xAA, 0xBE, 0x32),
CRect_i_(0x4C, 0, 0xBE, 0x32), rogoAlphaA[2]);
2702 case DUNGEON_GALLERY_OF_TIME:
2703 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0x135, 0xAA, 0x98, 0x32),
CRect_i_(0, 0, 0x98, 0x32), rogoAlphaA[2]);
2708 if (BtUraDongeon != 0) {
2709 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0x120, 0xE6, 0x40, 0x38),
CRect_i_(0x13A, 0x78, 0x40, 0x38), rogoAlphaA[2]);
2711 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0xD4, 0xE6, 0xD8, 0x30),
CRect_i_(0, 0x78, 0xD8, 0x30), rogoAlphaA[2]);
2715 if (LanguageCode > LANG_JAPANESE) {
2716 switch (selectMapNo) {
2717 case DUNGEON_DIVINE_BEAST_CAVE:
2718 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(floor_no + 0x122, 0xAA, 0x2D, 0x32),
CRect_i_(0, 0, 0x2D, 0x32), rogoAlphaA[2]);
2721 case DUNGEON_WISE_OWL_FOREST:
2722 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0xA0, 0xAA, 0xDA, 0x32),
CRect_i_(0, 0, 0xDA, 0x32), rogoAlphaA[2]);
2730 case DUNGEON_SHIPWRECK:
2731 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0xC8, 0xAA, 0x91, 0x32),
CRect_i_(0, 0, 0x91, 0x32), rogoAlphaA[2]);
2738 case DUNGEON_SUN_MOON_TEMPLE:
2739 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(floor_no + 0xDC, 0xAA, 0x8E, 0x32),
CRect_i_(0, 0, 0x8E, 0x32), rogoAlphaA[2]);
2742 case DUNGEON_MOON_SEA:
2743 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(floor_no + 0xC3, 0xAA, 0x4B, 0x32),
CRect_i_(0, 0, 0x4B, 0x32), rogoAlphaA[2]);
2744 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0x13B, 0xAA, 0xC0, 0x32),
CRect_i_(0x60, 0, 0xC0, 0x32), rogoAlphaA[2]);
2747 case DUNGEON_GALLERY_OF_TIME:
2748 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0x108, 0xAA, 0xE1, 0x32),
CRect_i_(0, 0, 0xE1, 0x32), rogoAlphaA[2]);
2751 case DUNGEON_DEMON_SHAFT:
2752 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(floor_no + 0xDC, 0xAA, 0x8E, 0x32),
CRect_i_(0, 0, 0x8E, 0x32), rogoAlphaA[2]);
2757 if (BtUraDongeon != 0) {
2758 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0x110, 0xE6, 0x60, 0x38),
CRect_i_(0x110, 0x78, 0x60, 0x38), rogoAlphaA[2]);
2760 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(0xD4, 0xE6, 0xF0, 0x30),
CRect_i_(0, 0x78, 0xF0, 0x30), rogoAlphaA[2]);
2766 if (selectMapNo == DUNGEON_GALLERY_OF_TIME) {
2767 floor_no = BtGetFloorLevel(floor_no - 1);
2770 if (floor_no < 10) {
2771 digit_x = floor_no % 10 * 0x26;
2772 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(shift + 0x15A, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), rogoAlphaA[2]);
2775 if (floor_no >= 10 && floor_no < 100) {
2776 digit_x = floor_no / 10 * 0x26;
2777 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(shift + 0x136, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), rogoAlphaA[2]);
2778 digit_x = floor_no % 10 * 0x26;
2779 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(shift + 0x15A, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), rogoAlphaA[2]);
2782 if (floor_no >= 100) {
2783 int digit = floor_no / 100;
2785 digit_x = digit * 0x26;
2786 floor_no -= digit * 100;
2787 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(shift + 0x112, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), rogoAlphaA[2]);
2788 digit_x = floor_no / 10 * 0x26;
2789 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(shift + 0x136, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), rogoAlphaA[2]);
2790 digit_x = floor_no % 10 * 0x26;
2791 set2DSprite(Vif1Packet, TEX_Floor1,
CRect_i_(shift + 0x15A, 0xAA, 0x26, 0x32),
CRect_i_(digit_x, 0x32, 0x26, 0x32), rogoAlphaA[2]);
2797 TexManager.ReloadTexture(Vif1Packet, 2);
2799 int gauge_alpha = rogoY3 + 0x60;
2803 set2DSprite(Vif1Packet, TEX_WepGage,
CRect_i_(0x28, SCREEN_HEIGHT - 0x34, 0x80, 0x1C),
CRect_i_(0, 0, 0x80, 0x1C), gauge_alpha);
2805 set2DSprite(Vif1Packet, TEX_WepGage,
CRect_i_(0x28, SCREEN_HEIGHT - 0x34, 0x80, 0x1C),
CRect_i_(0, 0x1C, 0x80, 0x1C), gauge_alpha);
2811 if ((
int) wear < 100) {
2812 int left = (int) wear;
2814 set2DSprite(Vif1Packet, TEX_WepGage,
CRect_i_(0x28, SCREEN_HEIGHT - 0x34, 0x80, 0x1C),
CRect_i_(0, 0x54, 0x80, 0x1C), gauge_alpha);
2815 set2DSprite(Vif1Packet, TEX_WepGage,
CRect_i_(0x42, SCREEN_HEIGHT - 0x34, left, 0x1C),
CRect_i_(0x1A, 0x38, left, 0x1C), gauge_alpha);
2818 if (infoMap != 0 && NowDngMap->
map_type == 1) {
2819 sceVu0FVECTOR map_pos;
2820 sceVu0FVECTOR map_rot;
2822 TexManager.ReloadTexture(Vif1Packet, 0x1F);
2823 sceVu0CopyVector(map_pos, CharaFrame->
position);
2824 CharaFrame->GetRotation(map_rot);
2830 topStatusInfo(rogoY3, itemNowSel, UserStatus->
cur_floor);
2831 BtStatusErrDraw(rogoY3);
2833 for (i = 0; i < 32; i++) {
2837 if (exitMenuFlag != 0) {
2838 TexManager.ReloadTexture(Vif1Packet, 7);
2839 set2DSprite(Vif1Packet, TexManager.GetTexture(
"pause", -1),
CRect_i_(0x100, 0xCC, 0x80, 0x28), 0, 0);
2845 if (MonstorNameOff == 0) {
2849 SetMonsterNameDrawFlag(0);
2855 MGFillBox(
CRect_i_(0, 0, 0x2800, 0xE00), (
int) fade[0], (
int) fade[1], (
int) fade[2], (
int) fade[3]);
2858 if (BtEventMode != 0) {
2859 EdEventSpriteDraw();
2861 TexManager.ReloadTexture(Vif1Packet, 0x1A);
2866 for (i = 0; i < 1; i++) {
2868 TexManager.ReloadTexture(Vif1Packet, i + 0x28);
2874 TexManager.ReloadTexture(Vif1Packet, 0x1A);
2888 int mes_no = DngMessMan.
message;
2897 if (mes_no != oldMsgNo) {
2902 if (Mes1MakeFlg != 0) {
2909 DngMes1.
auto_pos = MES_POS_BOTTOM_RIGHT;
2913 int mes_no = DngMessMan.
message;
2919 if (mes_no != oldMsgNo) {
2924 if (Mes1MakeFlg != 0) {
2929 DngMesStb.
auto_pos = MES_POS_BOTTOM;
2936 if (BtEventMode != 0) {
2937 if (DebugStatus[4] != 0) {
2938 TexManager.ReloadTexture(Vif1Packet, 0xC);
2942 TexManager.ReloadTexture(Vif1Packet, 0xC);
2943 DebugInfomationDraw();
2946 DispFade__3.
FadeIn(Vif1Packet);
2947 DispFade__3.
FadeOut(Vif1Packet);
2950 if (frameCaputer != 0) {
2951 sceGsSyncPath(0, 0);
2952 TexManager.ReloadTexture(Vif1Packet, 0x17);
2953 MGMoveFrameBuffImage((
sceGsTex0 *) &TexManager.GetTexture(
"frame_image", -1)->
tex0, 0, 0, 0);
2957float oldCameraHeight;
2958float oldCameraAngle;
2966static inline void DeleteItemModel(
int slot) {
2967 if (activeItem.
model[slot] != -1) {
2969 activeItem.
model[slot] = -1;
2982 static sceVu0FVECTOR reference = {0.0f, 7.5f, 0.0f, 0.0f};
2996 if (BtEventMode != 0 && EdEventInfo.
projection > 0.0f) {
2997 MGSetRenderInfo(EdEventInfo.
projection, 1.0f, (
float) 0xFFFF);
2999 MGSetRenderInfo(800.0f, 1.0f, (
float) 0xFFFF);
3002 sceVu0CopyVector(pos, CharaFrame->
position);
3004 GameEnv.
camera = NowCamera__3;
3005 GameEnv.
frame = CharaFrame;
3012 sceVu0FVECTOR forward = {0.0f, 0.0f, 1.0f, 1.0f};
3013 sceVu0FVECTOR rotation;
3015 sceVu0FMATRIX rot_matrix;
3017 CharaMain.
frame->GetRotation(rotation);
3018 sceVu0UnitMatrix(rot_matrix);
3019 sceVu0RotMatrixY(rot_matrix, rot_matrix, rotation[1]);
3020 sceVu0ApplyMatrix(dir, rot_matrix, forward);
3030 if (GamePad.
Down2(PAD_CROSS) != 0) {
3034 if (GamePad.
Down2(PAD_SQUARE) != 0) {
3036 MesAbsDrawOff = BtAllClear;
3039 GamePad.
Down(PAD_SELECT);
3042 case GAME_TASK_PLAY:
3043 if (CheckTrialEnd() != 0) {
3045 }
else if (GamePad.
Down(PAD_START) != 0) {
3046 printf(
"pause!!\n");
3051 PlayTimeCountFlag(0);
3052 SndSePlay(MENU_SOUND_CONFIRM, -1, 0);
3053 gameTask = GAME_TASK_PAUSE;
3055 move_x = lx * cos(angle) + ly * sinf(angle);
3056 BtActStatus.
move_x = move_x;
3057 move_z = ly * cos(angle) - lx * sinf(angle);
3058 BtActStatus.
move_z = move_z;
3060 if (StatusErrCheck(AILMENT_GOO) != 0) {
3067 if (StatusErrCheck(AILMENT_FREEZE) != 0) {
3075 velo__2[0] = move_x;
3076 velo__2[2] = move_z;
3077 velo2[0] = rx * cos(angle) + ry * sinf(angle);
3078 velo2[2] = ry * cos(angle) - rx * sinf(angle);
3079 stickVector = DistVector(velo__2);
3081 stickVector2 = DistVector(velo__2);
3084 if (lockOnTargetFlag != 0) {
3085 velo__2[0] = move_x;
3086 velo__2[2] = move_z;
3097 if (BtBySpeedFlag != 0) {
3103 velo__2[0] = move_x * run_speed;
3104 velo__2[2] = move_z * run_speed;
3109 if (DebugMode != 0 && GamePad.
Down(PAD_R3) != 0 && BtEventMode == 0) {
3111 gameTask = GAME_TASK_DEBUG_OPEN;
3112 SndSePlay(MENU_SOUND_CONFIRM, -1, 0);
3117 if (stickVector <= 0.01f) {
3127 gameTask = GAME_TASK_MENU_OPEN;
3128 EnemyLifeGage.
draw =
false;
3130 SetMIniMapStatus(0);
3133 SndSePlay(MENU_SOUND_CONFIRM, -1, 0);
3134 }
else if (GamePad.
Down(PAD_TRIANGLE) != 0) {
3137 if (move_x == 0.0f && move_z == 0.0f && BtActStatus.
action_on == 0) {
3151 gameTask = GAME_TASK_MENU_OPEN;
3152 EnemyLifeGage.
draw =
false;
3154 SetMIniMapStatus(0);
3157 SndSePlay(MENU_SOUND_CONFIRM, -1, 0);
3163 if ((move_x != 0.0f || move_z != 0.0f) && (BtActStatus.
action_on == 0 || UserStatus->
cur_chara == CHARA_OSMOND)) {
3164 CharaFrame->SetRotation(0.0f, unitRotation(CharaFrame, atan2f(move_x, move_z)), 0.0f);
3174 if (stickVector >= 0.8f && UserStatus->
cur_chara == CHARA_TOAN) {
3188 DngMessMan.
timer = 0;
3193 EnemyLifeGage.
draw =
false;
3194 BtMiniChrSelect_Init(0);
3196 gameTask = GAME_TASK_CHARA_SELECT_LOOP;
3201 sceVu0FVECTOR mask_pos;
3208 sceVu0CopyVector(mask_pos, CharaFrame->
position);
3211 NowDngMap->
checkMask(mask_pos[0], mask_pos[2]);
3218 if (GamePad.
Down(PAD_LEFT) != 0) {
3219 SndSePlay(MENU_SOUND_CURSOR, -1, 0);
3221 if (itemNowSel < 2) {
3227 activeItem.
now = itemNowSel;
3230 if (GamePad.
Down(PAD_RIGHT) != 0) {
3231 SndSePlay(MENU_SOUND_CURSOR, -1, 0);
3233 if (itemNowSel >= 3) {
3239 activeItem.
now = itemNowSel;
3243 if (GamePad.
Down(PadInput_NO) != 0) {
3244 if (lockOnTargetNo == -1) {
3247 CharaFrame->GetLWMatrix(look);
3248 NowCamera__3->
SetAngle(atan2f(look[2][0], look[2][2]) - PI_D);
3249 }
else if (lockOnTargetFlag == 0) {
3250 if (lockOnTargetNo != -1) {
3251 lockOnTargetFlag = 1;
3252 SndSePlay(SE_LOCK_ON, -1, 0);
3255 lockOnTargetFlag = 0;
3256 SndSePlay(MENU_SOUND_REFUSE, -1, 0);
3260 if (GamePad.
Down(PAD_L1) != 0 && BtActStatus.
movement_locked == 0 && lockOnTargetFlag != 0) {
3261 if (targetCursorShiftNo >= targetCursorShiftRot - 1) {
3262 targetCursorShiftNo = 0;
3263 targetCursorShiftRot = SetNearLockOnTarget(0, 0);
3264 SndSePlay(SE_LOCK_ON, -1, 0);
3266 targetCursorShiftNo++;
3267 targetCursorShiftRot = SetNearLockOnTarget(targetCursorShiftNo, 0);
3268 SndSePlay(SE_LOCK_ON, -1, 0);
3272 if (SetBattleStyle(selectMapNo, 0) <= 60.0f && move_x == 0.0f && move_z == 0.0f) {
3276 if (lockOnTargetFlag != 0) {
3278 sceVu0FVECTOR target;
3282 atan2f(pos[0] - target[0], pos[2] - target[2]);
3283 face = atan2f(target[0] - pos[0], target[2] - pos[2]);
3286 CharaFrame->SetRotation(0.0f, face, 0.0f);
3288 CharaFrame->SetRotation(0.0f, unitRotation(CharaFrame, face), 0.0f);
3298 turn = atan2f(move_x, move_z);
3301 if (turn < -PI_SHORT) {
3302 turn += TWO_PI_SHORT;
3305 if (turn > PI_SHORT) {
3306 turn -= TWO_PI_SHORT;
3314 if (turn > -1.2f && turn < 1.2f) {
3318 if (turn < -2.6f || turn > 2.6f) {
3322 if (turn > 1.2f && turn < 2.6f) {
3326 if (turn < -1.2f && turn > -2.6f) {
3343 if (UserStatus->
cur_chara == CHARA_XIAO && BtActStatus.
action_no == 0xC && (move_x != 0.0f || move_z != 0.0f)) {
3344 CharaFrame->SetRotation(0.0f, unitRotation(CharaFrame, atan2f(move_x, move_z)), 0.0f);
3350 driveNoInterpolate = 1;
3356 if (lockOnTargetFlag == 0) {
3368 driveNoInterpolate = 1;
3376 if (GamePad.
On(PAD_R1) == 0) {
3379 driveNoInterpolate = 1;
3407 EdFadeOut(0x78, r, g, b);
3409 gameTask = GAME_TASK_FLOOR_FADE_RESET;
3413 gameTask = GAME_TASK_SCRIPT_START;
3419 printf(
"dead script !!\n");
3420 gameTask = GAME_TASK_SCRIPT_START;
3426 SetSystemMes(Run_TrapCircle(trap) + 0x12C, 0x96, MES_POS_BOTTOM, 0, NULL, NULL);
3437 SetSystemMes(0x48, 0x78, MES_POS_BOTTOM, 0, NULL, NULL);
3441 SetSystemMes(0x51, 0x78, MES_POS_BOTTOM, 0, NULL, NULL);
3450 case ITEM_DRAN_S_CREST:
3451 case ITEM_SHINY_STONE:
3452 case ITEM_RED_BERRY:
3454 case ITEM_KING_S_SLATE:
3455 case ITEM_GUN_POWDER:
3456 case ITEM_CLOCK_HANDS:
3457 case ITEM_POINTY_CHESTNUT:
3458 case ITEM_BLACK_KNIGHT_CREST:
3460 BtGetGateKey_Init(event);
3461 gameTask = GAME_TASK_GATE_KEY_LOOP;
3464 BtGetAttach_Init(selectMapNo, event);
3466 SndSePlay(SE_ITEM_GET, -1, 0);
3480 BtGetAttach_Init(selectMapNo, stolen);
3482 SndSePlay(SE_ITEM_GET, -1, 0);
3489 sceVu0FVECTOR slot_pos;
3490 sceVu0FVECTOR slot_dir;
3496 if (done == chara) {
3508 sceVu0CopyVector(slot_pos, state->
pos);
3509 sceVu0CopyVector(slot_dir, state->
dir);
3510 sceVu0CopyVector(BtEventInfo.
position, slot_pos);
3511 sceVu0CopyVector(BtEventInfo.
direction, slot_dir);
3520 gameTask = GAME_TASK_SCRIPT_START;
3527 EdFadeOut(0x78, 0.0f, 0.0f, 0.0f);
3529 gameTask = GAME_TASK_SCRIPT_RESTART;
3530 }
else if (state->
hold != 0 && GamePad.
Down(PAD_SQUARE) != 0) {
3531 gameTask = GAME_TASK_SCRIPT_START;
3533 }
else if (GamePad.
Down(PadInput_OK) != 0) {
3534 gameTask = GAME_TASK_SCRIPT_START;
3546 BtActStatus.unk_028 = 0;
3557 SetSystemMes(0x47, 0x5A, MES_POS_BOTTOM, 0, NULL, NULL);
3561 BtActStatus.unk_028 = 0;
3569 SetSystemMes(0x50, 0x5A, MES_POS_BOTTOM, 0, NULL, NULL);
3576 iventInfo = NowDngMap->
events[iventActive].
kind;
3589 switch (NowDngMap->
events[iventActive].
kind) {
3596 gameTask = GAME_TASK_BOX_BIG_INIT;
3602 sceVu0FVECTOR box_pos;
3603 sceVu0FVECTOR box_dir = {0.0f, 0.0f,
3606 sceVu0CopyVector(box_pos, NowDngMap->
events[iventActive].
pos);
3607 sceVu0CopyVector(BtEventInfo.
position, box_pos);
3608 sceVu0CopyVector(BtEventInfo.
direction, box_dir);
3614 gameTask = GAME_TASK_SCRIPT_START;
3622 gameTask = GAME_TASK_SCRIPT_START;
3628 gameTask = GAME_TASK_BOX_SMALL_INIT;
3630 SndSePlay(MENU_SOUND_CONFIRM, -1, 0);
3638 if (NowDngMap->
atra[entry_no].
used != 0) {
3641 if (UserStatus->
cur_chara == CHARA_TOAN) {
3642 gameTask = GAME_TASK_ATRA_GET_INIT;
3644 SndSePlay(MENU_SOUND_CONFIRM, -1, 0);
3646 NotGetAtraMes(chara, 0x5A);
3658 if (item_no >= 0 && item_no < 0x11) {
3679 BattleActionOn_Jinn();
3685 BattleActionOn_Ruby();
3692 BattleActionOn_Ozumond();
3696 BattleActionOn_Ozumond_H();
3700 BattleActionOn_Ozumond_F();
3716 BattleActionPlay_Jinn(&CharaMain, 0);
3722 BattleActionPlay_Ruby(&CharaMain, 0);
3729 BattleActionPlay_Ozumond(0);
3733 BattleActionPlay_Ozumond_H(0);
3737 BattleActionPlay_Ozumond_F(0);
3745 if (GamePad.
On(PAD_SQUARE) != 0 && BtActStatus.
movement_locked == 0 && lockOnTargetFlag == 0) {
3746 if (DebugStatus[5] == 0) {
3750 if (BtActStatus.
action_on == 0 && gameTask != GAME_TASK_UNK_F0 && BtActStatus.
can_act != 0) {
3753 if (activeItem.
CheckStatusType() == ACTIVE_ITEM_FEATHER && slots[itemNowSel + 3] > 0) {
3759 int slot = itemNowSel - 1;
3765 DelActiveItem(itemNowSel);
3767 DngMessMan.
insert_mes_1 = GetCommonItemDataSystemMsg(-1);
3768 DngMessMan.
timer = 0xB4;
3779 used = checkItemUsed(itemNowSel - 1);
3781 if (activeItem.
CheckStatusType() == ACTIVE_ITEM_DRINK && used != 0 && slots[itemNowSel + 3] > 0) {
3788 if (activeItem.
model[8] == -1) {
3793 if (activeItem.
CheckStatusType() == ACTIVE_ITEM_EAT && used != 0 && slots[itemNowSel + 3] > 0) {
3794 setUnitAmbientAnime(64.0f, 1.0f, 0.0f, 122.0f, 208.0f);
3795 SndSePlay(SE_EFFECT_CHIME, -1, 0);
3797 s32 taken = activeItem.
item[activeItem.
now];
3799 usedActiveItem(UserStatus, taken);
3803 if (inner[itemNowSel + 3] == 1) {
3804 inner[itemNowSel] = -1;
3805 inner[itemNowSel + 3] = 0;
3806 DeleteItemModel(itemNowSel);
3808 inner[itemNowSel + 3]--;
3811 SndSePlay(SE_CHARA_RECOVER, -1, 0);
3814 if (activeItem.
CheckStatusType() == ACTIVE_ITEM_ACTION && BtActStatus.
can_act != 0 && used != 0 && BtActStatus.
action_on != 2 && slots[itemNowSel + 3] > 0) {
3815 printf(
"throw !!\n");
3817 if (lockOnTargetFlag == 0) {
3823 sceVu0CopyVector(hand, CharaMain.
pos);
3824 getCharacterVector(BombInfo.
pos, 0.0f);
3825 BombInfo.
pos[0] += hand[0] + 30.0f * BombInfo.
pos[0];
3826 BombInfo.
pos[1] = hand[1];
3827 BombInfo.
pos[2] += hand[2] + 30.0f * BombInfo.
pos[2];
3832 if (activeItem.
model[8] == -1) {
3842 if (activeItem.
model[8] == -1) {
3851 sceVu0FVECTOR slot_pos;
3852 sceVu0FVECTOR slot_dir;
3861 sceVu0CopyVector(slot_pos, state->
pos);
3862 sceVu0CopyVector(slot_dir, state->
dir);
3863 sceVu0CopyVector(BtEventInfo.
position, slot_pos);
3864 sceVu0CopyVector(BtEventInfo.
direction, slot_dir);
3868 gameTask = GAME_TASK_SCRIPT_START;
3876 BattleActionThlow();
3877 BattleActionDrink();
3899 if (stickVector >= 0.1f) {
3904 .
speed = 0.2f + stickVector / 2.0f;
3913 if (stickVector >= 0.1f) {
3918 .
speed = 0.2f + stickVector / 2.0f;
3925 if (UserStatus->
cur_chara == CHARA_OSMOND) {
3929 if (ok == 0 || BtActStatus.
can_act == 0) {
3935 BtCheckDamageProc();
3959 DeadKeyWait = 0x168;
3960 DeadKeyStartWait = 0x3C;
3965 gameTask = GAME_TASK_DEAD;
3968 velo__2[0] = blowVelo[0];
3969 velo__2[2] = blowVelo[2];
3971 for (
int i = 0; i < 3; i++) {
3972 float speed = blowVelo[i];
3974 float step = 0.018f;
3977 blowVelo[i] = speed + step;
3979 if (blowVelo[i] >= -0.01f) {
3983 blowVelo[i] = speed - 0.018f;
3985 if (blowVelo[i] <= 0.01f) {
4003 velo__2[0] += push[0];
4004 velo__2[2] += push[2];
4014 if (DebugStatus[5] != 0) {
4016 sceVu0FVECTOR moved;
4018 sceVu0FVECTOR parts_pos;
4026 bound.
max[0] = 20.0f + pos[0];
4027 bound.
max[1] = 20.0f + pos[1];
4028 bound.
max[2] = 20.0f + pos[2];
4029 bound.
min[0] = pos[0] - 20.0f;
4030 bound.
min[1] = pos[1] - 40.0f;
4031 bound.
min[2] = pos[2] - 20.0f;
4042 for (; NowDngMap->
parts[i].
frame[0] != NULL; i++) {
4047 if (collision != NULL) {
4056 turn += turn_part->collision_turn;
4066 float rot = PI * (-90.0f * turn) / 180.0f;
4068 collision->SetRotation(0.0f, rot, 0.0f);
4069 collision->SetPosition(parts_pos);
4070 colPolyNum += collision->PickUpNearPoly(&polys[colPolyNum], bound);
4074 for (entry_no = 0; entry_no < 24; entry_no++) {
4075 if (NowDngMap->
boxes[entry_no].
used != 0) {
4078 collision->SetPosition(NowDngMap->
boxes[entry_no].
pos);
4079 colPolyNum += collision->PickUpNearPoly(&polys[colPolyNum], bound);
4084 colPolyNum = NowDranMapField->
AddCollision(polys, colPolyNum, bound);
4085 NowMonstorUnit->
MoveCheck(pos, velo__2, lockOnTargetFlag);
4088 if (UserStatus->
cur_chara == CHARA_OSMOND) {
4092 MoveCheck(pos, velo__2, moved, &info, polys, colPolyNum, mode);
4094 if (colPolyNum >= 0x190) {
4095 printf(
"er -> %d\n", colPolyNum);
4098 sceVu0SubVector(ref_off, moved, pos);
4099 veloOld[1] = velo__2[1];
4102 if (velo__2[1] < -10.0f) {
4103 velo__2[1] = -10.0f;
4106 sceVu0CopyVector(pos, moved);
4119 sceVu0FVECTOR moved;
4130 bound.
max[0] = 20.0f + pos[0];
4131 bound.
max[1] = 20.0f + pos[1];
4132 bound.
max[2] = 20.0f + pos[2];
4133 bound.
min[0] = pos[0] - 20.0f;
4134 bound.
min[1] = pos[1] - 40.0f;
4135 bound.
min[2] = pos[2] - 20.0f;
4138 for (z = 0; z < 20; z++) {
4139 for (x = 0; x < 20; x++) {
4141 int parts_no = cmap->
cells[x + z * 20]
4146 collision = parts_no == -1 ? NULL : NowDngMap->
parts[parts_no].
collision;
4148 ->
cells[x + z * 20];
4150 if (selectMapNo == DUNGEON_GALLERY_OF_TIME && parts_no >= 0x28 && parts_no < 0x2C) {
4154 if (collision != NULL && cell->
camera_dist <= 240.0f) {
4169 float rot = PI * (-90.0f * turn) / 180.0f;
4171 collision->SetRotation(0.0f, rot, 0.0f);
4172 collision->SetPosition(160.0f * x, 0.0f, 160.0f * z);
4173 colPolyNum += collision
4174 ->PickUpNearPoly(&polys[colPolyNum], bound);
4179 for (
int i = 0; i < 24; i++) {
4183 collision->SetPosition(NowDngMap->
boxes[i].
pos);
4184 colPolyNum += collision->PickUpNearPoly(&polys[colPolyNum], bound);
4189 NowMonstorUnit->
MoveCheck(pos, velo__2, lockOnTargetFlag);
4192 if (UserStatus->
cur_chara == CHARA_OSMOND) {
4196 MoveCheck(pos, velo__2, moved, &info, polys, colPolyNum, mode);
4198 if (colPolyNum >= 0x190) {
4199 printf(
"er -> %d\n", colPolyNum);
4202 sceVu0SubVector(ref_off, moved, pos);
4203 veloOld[1] = velo__2[1];
4206 if (velo__2[1] < -10.0f) {
4207 velo__2[1] = -10.0f;
4210 sceVu0CopyVector(pos, moved);
4224 pos[0] += velo__2[0];
4225 pos[1] += velo__2[1];
4226 pos[2] += velo__2[2];
4229 if (UserStatus->
cur_chara != CHARA_OSMOND) {
4252 SndSeSeqPlayStop(0x1CC, 5, id_cnt);
4256 if (id_cnt >= 0xA) {
4262 if (pos[1] <= -30.0f && selectMapNo == DUNGEON_DIVINE_BEAST_CAVE) {
4264 setUnitAmbientAnime(120.0f, 1.0f, 255.0f, 0.0f, 0.0f);
4268 EdFadeOut(0x78, 0.0f, 0.0f, 0.0f);
4269 gameTask = GAME_TASK_SCRIPT_RESTART;
4274 sceVu0FVECTOR run_pos;
4276 sceVu0CopyVector(run_pos, CharaFrame->
position);
4277 CRunFx__2.
Set(run_pos);
4285 if (time >= 75.0f && time <= 76.0f) {
4289 if (time >= 77.0f && time <= 78.0f) {
4293 if (time >= 85.0f && time <= 86.0f) {
4297 if (time >= 87.0f && time <= 88.0f) {
4302 if (DistVector(velo__2) >= 0.4f) {
4303 if (time >= 38.0f && time <= 39.0f) {
4307 if (time >= 45.0f && time <= 46.0f) {
4316 sceVu0FVECTOR step_pos;
4318 sceVu0CopyVector(step_pos, CharaFrame->
position);
4320 if (UserStatus->
cur_chara != CHARA_OSMOND) {
4321 CRunFx__2.
Set(step_pos);
4327 float turn = GamePad.
GetRXf();
4331 if (NowCamera__3->
GetHeight() >= 30.0f) {
4335 NowCamera__3->
AddAngle(0.04f * -turn);
4337 if (lockOnTargetFlag == 0) {
4338 if (GamePad.
On(PAD_R1) != 0) {
4339 NowCamera__3->
AddAngle(-0.034906585f);
4342 if (GamePad.
On(PAD_L1) != 0) {
4343 NowCamera__3->
AddAngle(0.034906585f);
4347 if (GamePad.
On(PAD_L2) != 0) {
4350 CharaFrame->GetLWMatrix(look);
4351 NowCamera__3->
SetAngle(atan2f(look[2][0], look[2][2]) - PI_D);
4355 oldCameraAngle = NowCamera__3->
GetAngle();
4356 oldCameraHeight = NowCamera__3->
GetHeight();
4362 if (UserStatus->
cur_chara == CHARA_XIAO) {
4363 EquipReAttach(NowWeapon, 1);
4366 BtActStatus.unk_028 = 0;
4373 if (ruby_effect_id != -1 && UserStatus->
cur_chara == CHARA_RUBY) {
4374 NowMainEffect->
OffEffect(ruby_effect_id);
4375 ruby_effect_id = -1;
4378 gameTask = GAME_TASK_EYE_CAMERA;
4380 sceVu0FVECTOR follow;
4382 if (pos[1] < -100.0f) {
4386 CharaFrame->SetPosition(pos[0], pos[1], pos[2]);
4387 sceVu0CopyVector(follow, pos);
4388 follow[0] += 7.0f * ref_off[0];
4389 follow[1] += BtActStatus.
camera_shake_offset + (6.0f + (2.0f * ref_off[1] + reference[1]));
4390 follow[2] += 7.0f * ref_off[2];
4391 NowCamera__3->
SetFollow(follow[0], follow[1], follow[2]);
4393 if (lockOnTargetFlag != 0) {
4395 ->
chara[lockOnTargetNo][0];
4396 sceVu0FVECTOR to_target;
4397 sceVu0FVECTOR target;
4401 dist = DistVector(target, pos);
4402 to_target[0] = target[0] - pos[0];
4403 to_target[1] = target[1] - pos[1];
4404 to_target[2] = target[2] - pos[2];
4405 to_target[3] = 1.0f;
4407 if (dist >= 20.0f) {
4411 sceVu0Normalize(to_target, to_target);
4412 sceVu0ScaleVectorXYZ(to_target, to_target, dist);
4413 to_target[1] = 0.0f;
4414 NowCamera__3->
SetFollow(pos[0] + to_target[0], BtActStatus.
camera_shake_offset + (to_target[1] + (6.0f + pos[1] + reference[1])), pos[2] + to_target[2]);
4433 case GAME_TASK_SCRIPT_RESTART:
4434 gameTask = GAME_TASK_SCRIPT_START;
4436 case GAME_TASK_FLOOR_FADE_RESET:
4437 if (EdFadeOutCheck() != 0) {
4441 for (i = 0; i < 5; i++) {
4451 gameTask = GAME_TASK_SCRIPT_START;
4455 case GAME_TASK_SCRIPT_START:
4463 DngMessMan.
timer = 0;
4473 BtSystemScriptInit();
4476 printf(
"********** system mem !!!\n");
4477 BtCashBuffer.
base = BtScriptWorkBuffer.
base;
4478 BtCashBuffer.
limit = 0x186A0;
4479 BtCashBuffer.
used = 0;
4486 printf(
"********** ext mem !!!\n");
4487 TexManager.DeleteTextureBlock(0x2A);
4488 TexManager.DeleteTextureBlock(0x26);
4489 TexManager.CleanUpBuffer();
4490 TexManager.CleanUpTextureList();
4491 effects = NowShotEffect->
effect;
4493 for (i = 0; i < 5; i++) {
4498 MonstorModelBuffer.
used = 0;
4499 u8 *cash = MonstorModelBuffer.
base;
4500 u32 cash_size = MonstorModelBuffer.
limit;
4502 BtCashBuffer.
base = cash;
4503 BtCashBuffer.
limit = cash_size + 0x88B8;
4504 BtCashBuffer.
used = 0;
4505 read_buffer = old_read_buffer + 0x88B80 / 4;
4509 BtSystemScriptAfter();
4510 gameTask = GAME_TASK_PLAY;
4516 case GAME_TASK_SCRIPT_RUN:
4517 if (EdEventMode(NowCamera__3, 0) > 0) {
4518 BtSystemScriptAfter();
4519 read_buffer = old_read_buffer;
4526 DngMessMan.
timer = 0;
4531 gameTask = GAME_TASK_PLAY;
4532 printf(
"exit script\n");
4539 SetBattleStyle(selectMapNo, 1);
4541 switch (BtEventInfo.
request) {
4542 case BT_REQUEST_ITEM_WINDOW:
4543 BtEventInfo.
request = BT_REQUEST_NONE;
4545 gameTask = GAME_TASK_SCRIPT_ITEM_SELECT;
4547 case BT_REQUEST_URA_DUNGEON:
4548 BtEventInfo.
request = BT_REQUEST_NONE;
4549 gameTask = GAME_TASK_URA_SWAP;
4551 case BT_REQUEST_ENTRANCE_WINDOW:
4552 BtEventInfo.
request = BT_REQUEST_NONE;
4553 InitDunEnterMenu(0x17, selectMapNo, -1);
4554 BtGameModeFlag = BT_GAME_MODE_ENTRANCE_MENU;
4556 case BT_REQUEST_ESCAPE_WINDOW:
4557 BtEventInfo.
request = BT_REQUEST_NONE;
4558 DngEscapeMsgInit(&DngMes2, &DngMes1, 0);
4559 BtGameModeFlag = BT_GAME_MODE_ESCAPE_MSG;
4561 case BT_REQUEST_GO_DUNGEON:
4562 BtEventInfo.
request = BT_REQUEST_NONE;
4563 BtSystemScriptAfter();
4564 read_buffer = old_read_buffer;
4565 ClearGateKeyStack();
4573 DngMessMan.
timer = 0;
4581 SndSPSePlay(0x1B, -1);
4587 UserStatus->
hp[chara] = 1;
4595 gameTask = GAME_TASK_PLAY;
4596 printf(
"go dungeon\n");
4598 case BT_REQUEST_RUN_SCRIPT:
4599 BtEventInfo.
request = BT_REQUEST_NONE;
4600 BtSystemScriptAfter();
4602 gameTask = GAME_TASK_SCRIPT_START;
4607 case GAME_TASK_SCRIPT_ITEM_SELECT:
4608 if (BtMiniItemSelect_Loop() != 0) {
4609 gameTask = GAME_TASK_SCRIPT_RUN;
4616 case GAME_TASK_URA_SWAP: {
4617 int ura = BtUraDongeon;
4623 for (
int i = 0; i < 16; i++) {
4624 unit->
script[i] = &MonstorScriptBuffer[i];
4629 BtSetEventExtendTable();
4631 if (BtUraDongeon == 0) {
4633 NowDngMap = &UraDungeonMap;
4634 NowEventMan = &UraEventMan;
4636 RandomItem = &SubRandomItem;
4639 int ura = BtUraDongeon;
4645 for (
int i = 0; i < 16; i++) {
4646 unit_now->
script[i] = &MonstorScriptBuffer[i];
4651 BtSetEventExtendTable();
4658 NowDngMap = &MainDungeonMap;
4659 NowEventMan = &DngEventMan;
4660 NowMonstorUnit = &MainMonstorUnit;
4662 RandomItem = &MainRandomItem;
4665 int ura = BtUraDongeon;
4670 for (
int i = 0; i < 16; i++) {
4671 MainMonstorUnit.
script[i] = &MonstorScriptBuffer[i];
4676 BtSetEventExtendTable();
4683 gameTask = GAME_TASK_SCRIPT_RUN;
4686 case GAME_TASK_DEBUG_OPEN:
4691 GamePad.
SetAutoRepeat(PAD_L2 | PAD_R2 | PAD_L1 | PAD_R1 | PAD_DPAD, 0x14, 3);
4694 case GAME_TASK_DEBUG_MENU:
4695 switch (DebugInfomationIF()) {
4696 case DEBUG_INFO_UNK_28:
4703 case DEBUG_INFO_UNK_3C:
4708 gameTask = GAME_TASK_DEBUG_RELOAD_MONSTER;
4710 case DEBUG_INFO_RELOAD_ENEMY:
4715 gameTask = GAME_TASK_DEBUG_RELOAD_MONSTER_SET;
4717 case DEBUG_INFO_SET_CHR_KEY:
4722 gameTask = GAME_TASK_PLAY;
4724 case DEBUG_INFO_CLOSE:
4729 lightingMode = DebugStatus[16];
4730 gameTask = GAME_TASK_PLAY;
4732 case DEBUG_INFO_FLOOR_ATRA_GET:
4735 for (
int i = 0; i < 8; i++) {
4738 if (atra_no != -1) {
4741 getAtraToSaveData(atra, atra_no, SaveData, selectMapNo, UserStatus->
cur_floor);
4748 gameTask = GAME_TASK_PLAY;
4750 case DEBUG_INFO_EVENT_TEST:
4757 case DEBUG_INFO_SET_STATUS:
4760 switch (DebugStatus[17]) {
4766 BtSetStatusErr(AILMENT_FREEZE);
4769 BtSetStatusErr(AILMENT_STAMINA);
4772 BtSetStatusErr(AILMENT_POISON);
4775 BtSetStatusErr(AILMENT_CURSE);
4778 BtSetStatusErr(AILMENT_GOO);
4785 gameTask = GAME_TASK_PLAY;
4790 case GAME_TASK_DEBUG_RUN_EVENT:
4791 BtEventInfo.
script_no = DebugStatus[11];
4794 BtSystemScriptLoad(selectMapNo);
4795 gameTask = GAME_TASK_SCRIPT_START;
4797 case GAME_TASK_DEBUG_RELOAD_MONSTER: {
4798 int ura = BtUraDongeon;
4804 for (
int i = 0; i < 16; i++) {
4805 unit->
script[i] = &MonstorScriptBuffer[i];
4810 BtSetEventExtendTable();
4813 NowMonstorUnit->
ArrangementPos(NowDngMap, DebugStatus[13], -1, 0);
4814 gameTask = GAME_TASK_PLAY;
4817 case GAME_TASK_DEBUG_RELOAD_MONSTER_SET: {
4818 int ura = BtUraDongeon;
4824 for (
int i = 0; i < 16; i++) {
4825 unit->
script[i] = &MonstorScriptBuffer[i];
4830 BtSetEventExtendTable();
4833 NowMonstorUnit->
ArrangementPos(NowDngMap, DebugStatus[15], DebugStatus[14], 0);
4834 gameTask = GAME_TASK_PLAY;
4837 case GAME_TASK_PAUSE:
4838 if (GamePad.
Down(PAD_START) != 0) {
4843 SndSePlay(MENU_SOUND_CONFIRM, -1, 0);
4844 PlayTimeCountFlag(1);
4846 if (viewMode__2 != 0) {
4847 gameTask = GAME_TASK_EYE_CAMERA;
4849 gameTask = GAME_TASK_PLAY;
4854 case GAME_TASK_MAPJUMP_FADE_START:
4860 case GAME_TASK_MAPJUMP_FADE_WAIT:
4863 if (DispFade__3.
GetRate() >= 128.0f) {
4869 case GAME_TASK_ESCAPE_INIT:
4873 case GAME_TASK_ESCAPE_LOOP:
4874 if (BtEscape_Loop() != 0) {
4876 gameTask = GAME_TASK_EXIT_FADE_WAIT;
4880 case GAME_TASK_EXIT_FADE_START:
4886 case GAME_TASK_EXIT_FADE_WAIT:
4889 if (DispFade__3.
GetRate() >= 128.0f) {
4892 switch (selectMapNo) {
4893 case DUNGEON_DIVINE_BEAST_CAVE:
4896 case DUNGEON_WISE_OWL_FOREST:
4899 case DUNGEON_SHIPWRECK:
4902 case DUNGEON_SUN_MOON_TEMPLE:
4905 case DUNGEON_MOON_SEA:
4908 case DUNGEON_GALLERY_OF_TIME:
4911 case DUNGEON_DEMON_SHAFT:
4916 MapJump(map_no, -1);
4921 case GAME_TASK_SYSMES_WAIT:
4922 if (GamePad.
Down(PadInput_OK | PadInput_NO) != 0) {
4929 gameTask = GAME_TASK_PLAY;
4934 case GAME_TASK_GATE_KEY_LOOP:
4935 if (BtGetGateKey_Loop() != 0) {
4936 gameTask = GAME_TASK_PLAY;
4941 case GAME_TASK_ATTACH_LOOP:
4942 if (BtGetAttach_Loop() != 0) {
4943 gameTask = GAME_TASK_PLAY;
4947 case GAME_TASK_EYE_CAMERA:
4950 if (GamePad.
Down(PAD_START) != 0) {
4955 PlayTimeCountFlag(0);
4956 SndSePlay(MENU_SOUND_CONFIRM, -1, 0);
4957 gameTask = GAME_TASK_PAUSE;
4963 if (StatusErrCheck(AILMENT_FREEZE) != 0) {
4973 next_task = GAME_TASK_PLAY;
4976 if (NowDngMap->
map_type != 1 && selectMapNo == DUNGEON_DIVINE_BEAST_CAVE) {
4977 sceVu0FVECTOR moved;
4979 sceVu0FVECTOR parts_pos;
4985 sceVu0CopyVector(pos, CharaMain.
pos);
4990 bound.
max[0] = 20.0f + pos[0];
4991 bound.
max[1] = 20.0f + pos[1];
4992 bound.
max[2] = 20.0f + pos[2];
4993 bound.
min[0] = pos[0] - 20.0f;
4994 bound.
min[1] = pos[1] - 40.0f;
4995 bound.
min[2] = pos[2] - 20.0f;
4998 unsigned int address;
5002 for (; (address = (
unsigned int) NowDngMap, offset = i * (
int)
sizeof(
CDungeonParts), ((
CDungeonMap *) (offset + address))->parts[0].frame[0] != NULL); i++) {
5006 collision = i == -1 ? NULL : (address = (
unsigned int) NowDngMap, ((
CDungeonMap *) (offset + address))->parts[0].collision);
5008 if (collision != NULL) {
5026 float rot = PI * (-90.0f * turn) / 180.0f;
5028 collision->SetRotation(0.0f, rot, 0.0f);
5029 collision->SetPosition(parts_pos);
5030 colPolyNum += collision->PickUpNearPoly(&polys[colPolyNum], bound);
5034 colPolyNum = NowDranMapField->
AddCollision(polys, colPolyNum, bound);
5037 if (UserStatus->
cur_chara == CHARA_OSMOND) {
5041 MoveCheck(pos, velo__2, moved, &info, polys, colPolyNum, mode);
5043 if (colPolyNum >= 0x190) {
5044 printf(
"er -> %d\n", colPolyNum);
5047 sceVu0SubVector(ref_off, moved, pos);
5048 veloOld[1] = velo__2[1];
5051 if (velo__2[1] < -10.0f) {
5052 velo__2[1] = -10.0f;
5055 sceVu0CopyVector(pos, moved);
5070 if (pos[1] <= -30.0f) {
5076 SetSystemMes(0x47, 0x5A, MES_POS_BOTTOM, 0, NULL, NULL);
5082 SetSystemMes(0x50, 0x5A, MES_POS_BOTTOM, 0, NULL, NULL);
5089 if ((UserStatus->
cur_chara == CHARA_XIAO || who == CHARA_RUBY || who == CHARA_OSMOND) && hand_ok != 0 && BtActStatus.
movement_locked == 0) {
5090 float head = viewAngleH__2;
5092 if (head - PI <= -PI) {
5093 head = viewAngleH__2;
5097 CharaMainHandViewFlag = 1;
5101 if (GamePad.
Down(PadInput_OK) != 0) {
5102 BattleActionOn_Jinn();
5107 if (GamePad.
Down(PadInput_OK) != 0) {
5108 BattleActionOn_Ruby();
5113 if (GamePad.
Down(PadInput_OK) != 0) {
5115 BattleActionOn_Ozumond();
5119 BattleActionOn_Ozumond_H();
5123 BattleActionOn_Ozumond_F();
5133 BattleActionPlay_Jinn(&CharaHand, 1);
5136 BattleActionPlay_Ruby(&CharaHand, 1);
5140 BattleActionPlay_Ozumond(1);
5144 BattleActionPlay_Ozumond_H(1);
5148 BattleActionPlay_Ozumond_F(1);
5156 SetBattleStyle(selectMapNo, 0);
5158 if (GamePad.
Down(PAD_TRIANGLE) != 0) {
5174 gameTask = GAME_TASK_MENU_OPEN;
5176 SetMIniMapStatus(0);
5179 SndSePlay(MENU_SOUND_CONFIRM, -1, 0);
5190 sceVu0FVECTOR slot_pos;
5191 sceVu0FVECTOR slot_dir;
5200 sceVu0CopyVector(slot_pos, state->
pos);
5201 sceVu0CopyVector(slot_dir, state->
dir);
5202 sceVu0CopyVector(BtEventInfo.
position, slot_pos);
5203 sceVu0CopyVector(BtEventInfo.
direction, slot_dir);
5210 next_task = GAME_TASK_SCRIPT_START;
5220 EdFadeOut(0x78, 0.0f, 0.0f, 0.0f);
5222 next_task = GAME_TASK_FLOOR_FADE_RESET;
5233 next_task = GAME_TASK_SCRIPT_START;
5245 printf(
"dead script !!\n");
5246 next_task = GAME_TASK_SCRIPT_START;
5255 BtGetAttach_Init(selectMapNo, stolen);
5257 SndSePlay(SE_ITEM_GET, -1, 0);
5263 DeadKeyWait = 0x168;
5264 DeadKeyStartWait = 0x3C;
5266 next_task = GAME_TASK_DEAD;
5270 entry_no = BtCheckDamageProc();
5272 if (entry_no != 0) {
5276 if (GamePad.
Down(PAD_R2) != 0 || GamePad.
Down(PAD_L1) != 0 || GamePad.
Down(PadInput_NO) != 0 || leaving != 0) {
5277 sceVu0FVECTOR chara_rot;
5279 CharaMainHandViewFlag = 0;
5281 NowCamera__3->
SetHeight(oldCameraHeight);
5283 NowCamera__3->
Step(1);
5286 chara_rot[1] = viewAngleH__2;
5290 cameraAuto = cameraAutoOld;
5292 if (UserStatus->
cur_chara == CHARA_XIAO) {
5293 EquipReAttach(NowWeapon, 0);
5296 if (ruby_effect_id != -1 && UserStatus->
cur_chara == CHARA_RUBY) {
5297 NowMainEffect->
OffEffect(ruby_effect_id);
5298 ruby_effect_id = -1;
5301 if (entry_no == 0) {
5302 BtActStatus.unk_028 = 0;
5307 gameTask = next_task;
5313 case GAME_TASK_MENU_OPEN:
5324 DngMessMan.
timer = 0;
5332 case GAME_TASK_MENU_WAIT_FRAME:
5333 if (battleMenuWait < 3) {
5341 case GAME_TASK_MENU_SKIP:
5344 case GAME_TASK_MENU_INIT: {
5348 s32 menu[6] = {0x17, 0x18, 0x19, 0x28, 0x29};
5350 s32 menu[5] = {0x17, 0x18, 0x19, 0x28, 0x29};
5353 BattleMenuInit(menu, BATTLE_MENU_MODE_DUNGEON);
5354 BtGameModeFlag = BT_GAME_MODE_BATTLE_MENU;
5355 oldUnitNow = nowUnitNow;
5366 DngMessMan.
timer = 0;
5371 EnemyLifeGage.
draw =
true;
5376 case GAME_TASK_MENU_CLOSE:
5377 if (MenuMapJumpMode != 0) {
5378 gameTask = GAME_TASK_ESCAPE_INIT;
5391 if (oldUnitNow != nowUnitNow) {
5392 gameTask = GAME_TASK_CHARA_CHANGED;
5395 if (viewMode__2 != 0) {
5396 sceVu0FVECTOR chara_rot;
5398 CharaMainHandViewFlag = 0;
5400 NowCamera__3->
SetHeight(oldCameraHeight);
5402 NowCamera__3->
Step(1);
5405 chara_rot[1] = viewAngleH__2;
5409 cameraAuto = cameraAutoOld;
5411 if (UserStatus->
cur_chara == CHARA_XIAO) {
5412 EquipReAttach(NowWeapon, 0);
5417 SetWeaponAttachStatus(NowWeaponHave);
5421 if (viewMode__2 != 0) {
5422 gameTask = GAME_TASK_EYE_CAMERA;
5424 gameTask = GAME_TASK_PLAY;
5430 case GAME_TASK_CHARA_CHANGED:
5433 gameTask = GAME_TASK_PLAY;
5438 NewChangeFxFlag = 1;
5440 printf(
"se stop !!\n");
5444 setUnitAmbientAnime(160.0f, 1.0f, 255.0f, 0.0f, 0.0f);
5445 SndSePlay(SE_SPARKLE, -1, 0);
5447 setUnitAmbientAnime(90.0f, 1.0f, 250.0f, 250.0f, 250.0f);
5448 SndSePlay(SE_SPARKLE, -1, 0);
5454 case GAME_TASK_UNK_123:
5456 case GAME_TASK_CHARA_SELECT_LOOP:
5457 if (BtMiniChrSelect_Loop() != 0) {
5458 if (BtMiniChrSelectNo == 2) {
5461 gameTask = GAME_TASK_EXIT_FADE_START;
5464 if (oldUnitNow == nowUnitNow) {
5472 EnemyLifeGage.
draw =
true;
5473 gameTask = GAME_TASK_PLAY;
5482 EnemyLifeGage.
draw =
true;
5483 gameTask = GAME_TASK_CHARA_CHANGED;
5494 case GAME_TASK_BOX_BIG_INIT:
5495 BtGetTreasureboxBig_Init();
5498 case GAME_TASK_BOX_BIG_LOOP:
5499 if (BtGetTreasureboxBig_Loop() != 0) {
5500 gameTask = GAME_TASK_PLAY;
5504 case GAME_TASK_BOX_SMALL_INIT:
5505 BtGetTreasureboxSmall_Init(selectMapNo);
5508 case GAME_TASK_BOX_SMALL_LOOP:
5509 if (BtGetTreasureboxSmall_Loop() != 0) {
5510 gameTask = GAME_TASK_PLAY;
5514 case GAME_TASK_ATRA_GET_INIT:
5515 BtAtraGetShort_Init();
5519 case GAME_TASK_ATRA_GET_LOOP:
5520 if (BtAtraGetShort_Loop(selectMapNo, UserStatus->
cur_floor) == 1) {
5521 gameTask = GAME_TASK_PLAY;
5525 case GAME_TASK_ATRA_REFUSE_INIT: {
5533 NotGetAtraMes(UserStatus->
cur_chara, -1);
5537 case GAME_TASK_ATRA_REFUSE_WAIT:
5538 if (GamePad.
Down(PadInput_OK | PadInput_NO) != 0) {
5544 gameTask = GAME_TASK_PLAY;
5548 case GAME_TASK_DEAD: {
5557 if (ruby_effect_id != -1 && UserStatus->
cur_chara == CHARA_RUBY) {
5558 NowMainEffect->
OffEffect(ruby_effect_id);
5559 ruby_effect_id = -1;
5562 slot = ((
CDngStatusData *) UserStatus)->CheckActItemSlot(ITEM_REVIVAL_POWDER);
5567 setUnitAmbientAnime(64.0f, 1.0f, 0.0f, 122.0f, 208.0f);
5569 UserStatus->
hp[chara] = UserStatus->
max_hp[chara] >> 1;
5572 SetSystemMes(0x3E, -1, MES_POS_BOTTOM, 0, NULL, NULL);
5579 if (activeItem.
model[8] != -1) {
5581 activeItem.
model[8] = -1;
5589 printf(
"itemno = %d\n", slot);
5590 gameTask = GAME_TASK_REVIVE_WAIT;
5591 DelActiveItem(slot + 1);
5600 SndSePlay(SE_CHARA_KNOCKED_OUT, -1, 0);
5613 if (activeItem.
model[8] != -1) {
5615 activeItem.
model[8] = -1;
5630 case GAME_TASK_DEAD_GAMEOVER:
5633 if (DeadKeyStartWait > 0) {
5636 if (DeadKeyStartWait == 0) {
5645 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0 || DeadKeyWait <= 0) {
5651 if (DebugMode != 0) {
5658 gameTask = GAME_TASK_PLAY;
5662 gameTask = GAME_TASK_EXIT_FADE_START;
5666 gameTask = GAME_TASK_EXIT_FADE_START;
5673 case GAME_TASK_DEAD_CHANGE_CHARA:
5676 if (DeadKeyStartWait > 0) {
5679 if (DeadKeyStartWait == 0) {
5684 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0 || DeadKeyWait <= 0) {
5686 BtMiniChrSelect_Init(1);
5691 gameTask = GAME_TASK_CHARA_SELECT_LOOP;
5696 case GAME_TASK_REVIVE_WAIT: {
5699 s16 max_hp = UserStatus->
max_hp[chara];
5701 if (!(UserStatus->
hp[chara] < (max_hp >> 1))) {
5711 case GAME_TASK_REVIVE_DONE:
5712 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
5718 gameTask = GAME_TASK_PLAY;
5720 setUnitAmbientAnime(160.0f, 1.0f, 255.0f, 0.0f, 0.0f);
5727 if (rogoSwitch2 != 0) {
5728 switch (startCnt2) {
5730 if (rogoAlphaA[2] < 0x80) {
5733 rogoAlphaW[2] = 0x78;
5737 if (rogoY3 < 0x20) {
5743 if (rogoAlphaW[2] > 0) {
5749 if (rogoY3 < 0x20) {
5755 if (rogoAlphaA[2] > 0) {
5757 }
else if (rogoY3 >= 0x20) {
5761 if (rogoY3 < 0x20) {
5785 sceVu0FVECTOR rotation;
5790 if (BtAllDrawFlag == 0) {
5794 if (BtEventMode == 0) {
5795 NowMonstorUnit->
Step(driveStepHold | CMonUnitHold);
5799 sceVu0CopyVector(pos, CharaFrame->
position);
5800 CharaFrame->GetRotation(rotation);
5802 CharaMain.
SetRotation(rotation[0], rotation[1], rotation[2]);
5806 if (driveNoInterpolate != 0) {
5808 driveNoInterpolate = 0;
5818 if (chara == CHARA_XIAO) {
5832 if (chara == CHARA_XIAO) {
5844 if (UserStatus->
cur_chara == CHARA_OSMOND) {
5845 CFrame *tail = CharaMain.
frame->SearchFrame(
"tukene1");
5849 static float y = 0.0f;
5853 if (!(y < PI_SHORT)) {
5854 y = y - TWO_PI_SHORT;
5857 tail->SetRotType(2);
5858 tail->SetRotation(0.0f, AngleLimit(y), 0.0f);
5860 if (tail_shadow != NULL) {
5861 tail_shadow->SetRotType(2);
5862 tail_shadow->SetRotation(0.0f, AngleLimit(y), 0.0f);
5867 if (lockOnTargetFlag != 0 && UserStatus->
cur_chara == CHARA_XIAO && CharaMainHandViewFlag == 0) {
5878 if (chara == CHARA_XIAO) {
5887 if ((CharaMainHandViewFlag != 0 && UserStatus->
cur_chara == CHARA_XIAO) || UserStatus->
cur_chara == CHARA_RUBY) {
5888 sceVu0CopyVector(hand, CharaFrame->
position);
5890 float height = CharaHeight(UserStatus);
5892 hand[1] += height - 3.0f;
5897 if (driveNoInterpolate != 0) {
5899 driveNoInterpolate = 0;
5907 if (chara == CHARA_XIAO) {
5921 if (chara == CHARA_XIAO) {
5932 if (chara == CHARA_XIAO) {
5939 if (BtEventMode != 0) {
5940 for (
int i = 0; i < 6; i++) {
5941 if (EdEventInfo.
npc_stop[i] == 0) {
5948 if (driveStepHold == 1) {
5957 if (BtEventMode == 0) {
5965 status = UserStatus;
5966 owner = check_owner = status->
cur_chara;
5972 static int warning_cnt;
5987 if (warning_cnt <= 0) {
5989 SndSePlay(SE_WARNING, -1, 0);
6001 NowCamera__3->
Step(1);
6004 if (Water_Splash_actFlag != 0) {
6005 Water_Splash.
Step();
6010 Water_Splash_actFlag = 0;
6018 if (EscapeFlag != 0) {
6019 EscapeEffect.
Step();
6024 NowDranMapField->CDranMapField::Step();
6027 if (DngMessMan.
timer > 0) {
6030 if (DngMessMan.
timer == 0) {
6045 for (i = 0; i < 96; i++) {
6046 if (collision->
active[i] == 0) {
6058 if (collision->
hit[i].
life <= 0) {
6059 collision->
active[i] = 0;
6071 if (StatusErrCheck(AILMENT_FREEZE) != 0 || StatusErrCheck(AILMENT_STAMINA) != 0) {
6099 float gain = (float) NowWeaponHave->
speed / 30.0f;
6101 if (StatusErrCheck(AILMENT_GOO) != 0) {
6105 if (StatusErrCheck(AILMENT_STAMINA) != 0) {
6126 if (*who_ref == CHARA_UNGAGA) {
6137 s8 who_copy = *who_ref;
6139 if (*who_ref == CHARA_OSMOND) {
6151 if (who == CHARA_XIAO) {
6155 if (who_copy == CHARA_RUBY) {
6171 BtActStatus.
hud_shake_y = (int) (16.0f * (
float) rand() / 2147483648.0f) - 8;
6187 float water_max = status->
water_max[*healed_ref];
6188 float water_now = status->
water_now[*healed_ref];
6189 static int heal_counter = 0;
6193 if (!(heal_counter < 240)) {
6194 if ((NowWeaponHave->
flags & 0x800) && status->
hp[*healed_ref] > 0) {
6195 status->
AddNowLife((s8) *healed_ref, 1, 255.0f);
6201 UserStatus->
Step(0);
6205 BtStatusAlarmAnime();
6207 for (
int i = 0; i < FrameObjAnimCnt; i++) {
6208 ObjAnimePlay(&FrameObjAnim[i]);
6213 map->
fire.FireStep();
6217 for (
int i = 0; i < 4; i++) {
6218 CWeaponElFx[i].
Step();
6221 for (
int i = 0; i < 32; i++) {
6225 mainItemModel.
Step();
6226 WeaponCrashEffect.
Step();
6228 for (
int i = 0; i < 16; i++) {
6230 HitPointMark[i].
Step();
6231 MyHitPointMark[i].
Step();
6234 if (NewChangeFxFlag != 0) {
6240 NewChangeFxFlag = 0;
6244 if (atraShortGetType != 0 && atraGetStatus != 0) {
6245 shortAtraEffect.
Step();
6248 if (itemOpenSmallFlag == 1) {
6249 itemOpenSmall.
Step();
6250 itemOpenSmallFx.
Step();
6253 if (itemOpenBigFlag == 1) {
6255 itemOpenBigFx.
Step();
6258 if (CEffectHold != 0 || BtEventMode != 0) {
6265 BtActStatus.
camera_shake_offset = 2.0f * (shake * (float) rand()) / 2147483648.0f - shake;
6278 int total = collector->
money + picked_up;
6280 if (!(total < 0xFFFF)) {
6281 collector->
money = 0xFFFF;
6283 collector->
money = total;
6289 for (
int i = 0; i < 3; i++) {
6293 for (
int i = 0; i < 5; i++) {
6294 MasekiEffect[i].
Step();
6297 NowShockWave->
Step();
6301 for (i = 0; i < 5; i++) {
6307 OzumondShotEffect.
Step();
6308 NowMainEffect->
Step();
6309 NowShotData->
step();
6313void BtCleatRandomMap() {
6322 NowDngMap = &MainDungeonMap;
6323 NowEventMan = &DngEventMan;
6328 for (i = 0; i < 96; i++) {
6340 for (i = 0; i < 48; i++) {
6345 for (i = 0; i < 24; i++) {
6353 for (i = 0; i < 8; i++) {
6359 for (i = 0; i < 4; i++) {
6365 for (item_slot = 0; item_slot < 32; item_slot++) {
6366 MainRandomItem.
id[item_slot] = -1;
6373 for (item_slot = 0; item_slot < 32; item_slot++) {
6374 SubRandomItem.
id[item_slot] = -1;
6380 RandomItem = &MainRandomItem;
6390 s32 event_no = NowDngMap->
map_type;
6392 NowEventMan->
SetupEvent(NowDngMap, event_no);
6394 NowDngMap = &UraDungeonMap;
6395 NowEventMan = &UraEventMan;
6396 UraDungeonMap = MainDungeonMap;
6397 UraEventMan = DngEventMan;
6399 for (k = 0; k < 96; k++) {
6409 for (j = 0; j < 48; j++) {
6414 for (j = 0; j < 24; j++) {
6422 for (j = 0; j < 8; j++) {
6428 for (j = 0; j < 4; j++) {
6434 s32 ura_map_no = UraDungeonMap.
map_type;
6438 s32 ura_draw_no = UraDungeonMap.
map_type;
6442 s32 ura_event_no = UraDungeonMap.
map_type;
6444 UraEventMan.
SetupEvent(&UraDungeonMap, ura_event_no);
6446 NowDngMap = &MainDungeonMap;
6447 NowEventMan = &DngEventMan;
6451 BtEquipMasuisyou = 0;
6454void BtCleatFreeMap() {
6456 s32 map_no = MainDungeonMap.
map_type;
6460 s32 draw_no = MainDungeonMap.
map_type;
6464 s32 event_no = MainDungeonMap.
map_type;
6466 DngEventMan.
SetupEvent(&MainDungeonMap, event_no);
6470 for (i = 0; i < 32; i++) {
6471 MainRandomItem.
id[i] = -1;
6477 RandomItem = &MainRandomItem;
6481 NowDngMap = &MainDungeonMap;
6482 NowEventMan = &DngEventMan;
6484 BtEquipMasuisyou = 0;
6487void BtArrengeMonstor() {
6492void BtLoadMonstor(
int ura) {
6499 MonstorModelBuffer.
used = 0;
6501 s32 ura_dungeon = BtUraDongeon;
6507 for (slot = 0; slot < 16; slot++) {
6508 unit->
script[slot] = &MonstorScriptBuffer[slot];
6513 BtSetEventExtendTable();
6515 for (i = 0; i < 320; i++) {
6519 TexManager.DeleteTextureBlock(0x2A);
6520 TexManager.DeleteTextureBlock(0x26);
6521 TexManager.CleanUpBuffer();
6522 TexManager.CleanUpTextureList();
6524 LoadFile(
"dun/etc/atrcol.mds", read_buffer, NULL);
6525 wait_now_loading_vsync();
6526 NowMonstorUnit->
collision = LoadCollisionFile(read_buffer, &MonstorModelBuffer);
6530 for (i = 0; i < 5; i++) {
6537 layout = BtEnemyLayoutList[selectMapNo];
6539 layout = BtUraEnemyLayoutList[selectMapNo];
6544 for (monster = 0; monster < 9; monster++) {
6555void EquipReAttach(
CCharacter *equipment,
int held_out) {
6558 if (held_out != 0) {
6559 hand = CharaHand.
frame->SearchFrame(
"pati1");
6561 hand = CharaMain.
frame->SearchFrame(
"weapon");
6566 equipment->
frame->SetReference(hand);
6569void EquipWeaponFrame(
CCharacter *weapon,
int chara,
int held_out) {
6575 if (held_out != 0 && chara == CHARA_XIAO) {
6576 hand = CharaHand.
frame->SearchFrame(
"pati1");
6578 hand = CharaMain.
frame->SearchFrame(
"weapon");
6582 printf(
"no weapon frame !!\n");
6590 NowWeapon->
frame->SetReference(hand);
6593 for (i = 0; i < 32; i++) {
6594 CWeaponFx.
used[i] = 0;
6604 CWeaponFx.
timer = 0;
6609void LoadWeapon2(
unsigned int *crash_data,
unsigned int *default_data,
unsigned int *main_data,
int chara,
int reload) {
6610 int weapon_kind[6] = {1, 4, 6, 5, 10, 7};
6611 int weapon_first[6] = {ITEM_WEAPON_DAGGER_BROKEN, ITEM_WEAPON_WOODENSLINGSHOT_BROKEN, ITEM_WEAPON_MALLET_BROKEN, ITEM_WEAPON_GOLD_RING_BROKEN, ITEM_WEAPON_FIGHTING_STICK_BROKEN, ITEM_WEAPON_MACHINE_GUN_BROKEN};
6612 char weapon_name[64];
6613 char weapon_model_path[64];
6615 int *kind = &weapon_kind[chara];
6619 TexManager.DeleteTextureBlock(0x1D);
6620 TexManager.DeleteTextureBlock(0x10);
6621 TexManager.CleanUpBuffer();
6622 TexManager.CleanUpTextureList();
6623 WeaponModelBuffer.
used = 0;
6624 WEffectModelBuffer.
used = 0;
6627 BtGetWeaponNamePath2(weapon_name, weapon_model_path, chara, 0);
6629 CrashWeapon.
LoadPackData3(crash_data, weapon_model_path, &WeaponModelBuffer, 0x1D, &WeaponModelBuffer, 1, 0);
6631 BtGetWeaponNamePath2(weapon_name, weapon_model_path, chara, 1);
6633 DefaultWeapon.
LoadPackData3(default_data, weapon_model_path, &WeaponModelBuffer, 0x1D, &WeaponModelBuffer, 1, 0);
6641 model_no -= weapon_first[chara];
6642 BtGetWeaponNamePath2(weapon_name, weapon_model_path, chara, model_no);
6644 MainWeapon.
LoadPackData3(main_data, weapon_model_path, &WeaponModelBuffer, 0x1D, &WeaponModelBuffer, 1, 0);
6645 EquipWeaponFrame(&MainWeapon, chara, CharaMainHandViewFlag);
6650 int used = WeaponModelBuffer.
used;
6652 weapon_end = WeaponModelBuffer.
base + used * 16;
6653 free_start = weapon_end;
6654 s64 free_size = 0x33450 - CharaModelBuffer.
used - used;
6656 WEffectModelBuffer.
base = free_start;
6657 WEffectModelBuffer.
limit = free_size;
6658 WEffectModelBuffer.
used = 0;
6665 MenuWeaponSpSet(NowWeapon, have);
6670void SwordDmgCheck1(
float amount,
int kind) {
6676 float warn = (float) (weapon->
durability * 0.2);
6678 broke = BattleSubWeaponDmg(amount, kind);
6681 if (weapon->
item_no == ITEM_WEAPON_LAMB_S_SWORD && weapon->
durability_f <= warn && was >= warn) {
6682 SetWeaponAttachStatus(NowWeaponHave);
6684 DngMessMan.
timer = 0xF0;
6686 SndSePlay(SE_POWER_UP, -1, 0);
6687 MenuWeaponSpSet(NowWeapon, weapon);
6694 float spread[4] = {0.0f, 1.0f, 0.0f, 1.0f};
6695 float offset[4] = {0.0f, 0.0f, 0.0f, 1.0f};
6696 sceVu0FVECTOR world;
6699 sceVu0CopyVector(pos, CharaMain.
pos);
6701 CFrame *hand = CharaMain.
frame->SearchFrame(
"weapon");
6704 hand->GetWorldPosition(world, offset);
6705 WeaponCrashEffect.
Set(world, spread, 4, 1.5f, 0.01f, 0.01f, 0.3f, 0x20, pos[1]);
6709 EquipWeaponFrame(&CrashWeapon, UserStatus->
cur_chara, CharaMainHandViewFlag);
6712 if (owner == 5 || (s8) owner == 3) {
6713 NowMainEffect = &CharaMainEffectCrash;
6720 EquipWeaponFrame(&DefaultWeapon, UserStatus->
cur_chara, CharaMainHandViewFlag);
6723 if (owner == 5 || (s8) owner == 3) {
6724 NowMainEffect = &CharaMainEffectCrash;
6734 {0xFF, 0x3C, 0x00}, {0x64, 0xC8, 0xFF}, {0xFF, 0xFF, 0x64}, {0x8A, 0xFF, 0xBC}, {0xE3, 0x96, 0xAD},
6738void SetWeaponColor() {
6739 u8 red, green, blue;
6749 }
else if (element >= 0 && element < 6) {
6750 blue = wep_rgb[element][2] >> 2;
6751 green = wep_rgb[element][1] >> 2;
6752 red = wep_rgb[element][0] >> 2;
6766 return MyEffectEntry_Tbl[0];
6768 return MyEffectEntry_Tbl[1];
6770 return MyEffectEntry_Tbl[2];
6773 if (form < 0 || form > 4) {
6777 return MyEffectEntry_Tbl[3 + form];
6779 return MyEffectEntry_Tbl[8];
6780 case CHARA_OSMOND: {
6787 if (weapon == ITEM_WEAPON_JACKAL) {
6792 if (weapon == ITEM_WEAPON_BLESSING_GUN) {
6797 if (weapon == ITEM_WEAPON_SKUNK) {
6802 if (weapon == ITEM_WEAPON_G_CRUSHER) {
6807 if (weapon == ITEM_WEAPON_HEXA_BLASTER) {
6812 if (weapon == ITEM_WEAPON_STAR_BREAKER) {
6817 if (weapon == ITEM_WEAPON_SUPERNOVA) {
6822 if (weapon == ITEM_WEAPON_SNAIL) {
6827 return MyEffectEntry_Tbl[9 + entry];
6834void MainChara_Effect(
BT_SHOT_EFFECT *effect,
unsigned int *data,
int reload) {
6838 if (effect == NULL) {
6844 TexManager.DeleteTextureBlock(0x10);
6845 TexManager.CleanUpBuffer();
6846 TexManager.CleanUpTextureList();
6847 WEffectModelBuffer.
used = 0;
6850 if (CharaMainEffect.
Entry2(effect, data, 0x10, &WEffectModelBuffer, 6) == 0) {
6851 printf(
"effect entry err!!\n");
6853 printf(
"set eff sucsess !\n");
6856 if (UserStatus->
cur_chara == CHARA_OSMOND) {
6857 unsigned int *crash = ozumond_default_effect;
6859 CharaMainEffectCrash.
Entry2(MyEffectEntry_Tbl[9], crash, 0x10, &WEffectModelBuffer, 6);
6862 if (UserStatus->
cur_chara == CHARA_RUBY) {
6863 unsigned int *crash = ozumond_default_effect;
6865 CharaMainEffectCrash.
Entry2(MyEffectEntry_Tbl[3], crash, 0x10, &WEffectModelBuffer, 6);
6868 NowMainEffect = &CharaMainEffect;
6871void LoadChara2(
int chara,
int keep_place,
unsigned int *chara_data,
unsigned int *crash_data,
unsigned int *default_data,
unsigned int *main_data) {
6874 sceVu0FVECTOR rotation;
6882 if (keep_place == 0) {
6883 sceVu0CopyVector(pos, CharaFrame->
position);
6884 CharaFrame->GetRotation(rotation);
6887 TexManager.DeleteTextureBlock(0x11);
6888 TexManager.DeleteTextureBlock(0x1D);
6889 TexManager.DeleteTextureBlock(0x10);
6890 TexManager.CleanUpBuffer();
6891 TexManager.CleanUpTextureList();
6892 CharaModelBuffer.
used = 0;
6896 for (i = 0; i < 64; i++) {
6901 CharaMain.
LoadPackData2(chara_data,
"base.cfg", &CharaModelBuffer, 0x11, &CharaModelBuffer, 0);
6905 if (chara == CHARA_XIAO) {
6909 hand_attr.unk_09 = 0;
6910 CharaHand.
LoadPackData(chara_data,
"hand_up.cfg", &CharaModelBuffer, &CharaModelBuffer, NULL);
6911 CharaHand.
frame->SetAttr(hand_attr, 1, 0);
6914 if (chara == CHARA_RUBY) {
6918 hand_attr.unk_09 = 0;
6919 CharaHand.
LoadPackData(chara_data,
"hand_up.cfg", &CharaModelBuffer, &CharaModelBuffer, NULL);
6920 CharaHand.
frame->SetAttr(hand_attr, 1, 0);
6923 CharaMain.
frame->SetAttr(frame_attr, 1, 4);
6925 if (keep_place == 0) {
6926 CharaMain.
frame->SetPosition(pos);
6927 CharaMain.
frame->SetRotation(rotation[0], rotation[1], rotation[2]);
6929 CharaMain.
SetRotation(rotation[0], rotation[1], rotation[2]);
6934 if (chara == CHARA_OSMOND) {
6941 u_int *hand_texture = GetPackFile(chara_data,
"c05w_h.img", &size);
6942 u8 *at = CharaModelBuffer.
base + CharaModelBuffer.
used * 16;
6944 memcpy(at, hand_texture, size);
6945 size = (((size >> 6) + 1) << 6) >> 4;
6946 CharaModelBuffer.Alloc(size);
6947 info[0].
name = (
char *) at;
6948 TexManager.DeleteTextureBlock(0x46);
6949 TexManager.LoadTextureBlockEX(0x46, info);
6951 u_int *effect = GetPackFile(chara_data,
"mgan01.chr", &size);
6953 ozumond_default_effect = (
unsigned int *) (CharaModelBuffer.
base + CharaModelBuffer.
used * 16);
6954 memcpy(ozumond_default_effect, effect, size);
6955 size = (((size >> 6) + 1) << 6) >> 4;
6956 CharaModelBuffer.Alloc(size);
6959 if (chara == CHARA_RUBY) {
6961 u_int *effect = GetPackFile(chara_data,
"c05_f03.chr", &size);
6963 ozumond_default_effect = (
unsigned int *) (CharaModelBuffer.
base + CharaModelBuffer.
used * 16);
6964 memcpy(ozumond_default_effect, effect, size);
6965 size = (((size >> 6) + 1) << 6) >> 4;
6966 CharaModelBuffer.Alloc(size);
6970 s32 used = CharaModelBuffer.
used;
6971 u8 *free_start = CharaModelBuffer.
base + used * 16;
6972 s64 free_size = 0x33450 - used;
6974 WeaponModelBuffer.
base = free_start;
6975 WeaponModelBuffer.
limit = free_size;
6976 WeaponModelBuffer.
used = 0;
6977 LoadWeapon2(crash_data, default_data, main_data, chara, 0);
6981static void LoadData() {
6983 char weapon_model_path[64];
6984 char weapon_name[64];
6985 char weapon_effect_name[64];
6986 char steal_model_name[64];
6990 int equipped_weapon_size;
7002 strcpy(weapon_model_path,
"commenu/weapon/");
7003 strcat(weapon_model_path, weapon_name);
7006 LoadFile(
"dun/mainchara/c01d.chr", read_buffer, &character_size);
7007 unsigned int aligned_size = ((character_size >> 6) + 1) << 6;
7008 unsigned int *weapon_data_0 = read_buffer + (aligned_size >> 2);
7010 LoadFile(
"commenu/weapon/c01w00.chr", weapon_data_0, &weapon_0_size);
7011 aligned_size = ((weapon_0_size >> 6) + 1) << 6;
7012 unsigned int *weapon_data_1 = weapon_data_0 + (aligned_size >> 2);
7014 LoadFile(
"commenu/weapon/c01w01.chr", weapon_data_1, &weapon_1_size);
7015 aligned_size = ((weapon_1_size >> 6) + 1) << 6;
7016 unsigned int *equipped_weapon_data = weapon_data_1 + (aligned_size >> 2);
7018 LoadFile(weapon_model_path, equipped_weapon_data, &equipped_weapon_size);
7019 wait_now_loading_vsync();
7020 LoadChara2(UserStatus->
cur_chara, 1, read_buffer, weapon_data_0, weapon_data_1, equipped_weapon_data);
7021 float chara_z = 150.0f;
7023 CharaFrame->SetPosition(200.0f, 0.0f, chara_z);
7026 LoadFile(
"dun/mainchara/wep_eff/c01_fuusya.chr", read_buffer, NULL);
7027 wait_now_loading_vsync();
7028 MainChara_Effect(main_effect, read_buffer, 0);
7030 if (SndVoiceLoad(0) != 0) {
7031 printf(
"voice err \n");
7033 printf(
"snd load\n");
7037 unsigned int *main_pack = read_buffer;
7039 LoadFile(
"dun/pack/maindat.pac", main_pack, NULL);
7040 wait_now_loading_vsync();
7041 cursorFrame = LoadMDSFilePack(read_buffer,
"dun/etc/cursor.mds", &MainModelBuffer);
7042 bombCursorFrame = LoadMDSFilePack(read_buffer,
"dun/etc/bomblock.mds", &MainModelBuffer);
7043 bicCursorFrame = LoadMDSFilePack(read_buffer,
"dun/etc/bic.mds", &MainModelBuffer);
7044 bicCursorFrame->SetScale(0.7f, 0.7f, 0.7f);
7046 NowDngMap->
atra_model = LoadMDSFilePack(read_buffer,
"dun/etc/atr.mds", &MainModelBuffer);
7047 NowDngMap->
collision_model = LoadCollisionFilePack(read_buffer,
"dun/etc/atrcol.mds", &MainModelBuffer);
7048 NowDngMap->
atra_model->SetAttr(frame_attr, 1, 0);
7050 NewChangeFx.
LoadPackData2((
unsigned int *) GetPackFile(read_buffer,
"ceffe_s.chr", NULL),
"info.cfg", &MainModelBuffer, 11, &MainModelBuffer, 0);
7051 itemOpenSmallFx.
LoadPack(read_buffer,
"igetfx", &MainModelBuffer, &MotionData, &itemOpenSmallFx_info, 0);
7052 itemOpenBigFx.
LoadPack(read_buffer,
"igetfxb", &MainModelBuffer, &MotionData, &itemOpenBigFx_info, 0);
7054 Water_Splash.
LoadPackData2((
unsigned int *) GetPackFile(read_buffer,
"water_sp.chr", NULL),
"info.cfg", &MainModelBuffer, 6, &MainModelBuffer, 0);
7056 unsigned int *effect_data = (
unsigned int *) GetPackFile(read_buffer,
"trap01.chr", NULL);
7058 Trap_Circle.
LoadPackData2(effect_data,
"info.cfg", &MainModelBuffer, 71, &MainModelBuffer, 0);
7059 Trap_Circle.
frame->SetAttr(frame_attr, 1, 0x40);
7061 sprintf(steal_model_name,
"kara0%d.mds", selectMapNo + 1);
7062 unsigned int *steal_model_data = (
unsigned int *) GetPackFile(read_buffer, steal_model_name, NULL);
7063 StealModel = (
CFrameVu1 *) LoadMDSFile(steal_model_data, &MainModelBuffer, 0, NULL, NULL);
7065 MasekiModelBuffer.
used = 0;
7066 LoadFile(
"dun/effect/maseki_ex.chr", read_buffer, NULL);
7067 wait_now_loading_vsync();
7068 MasekiEffect[0].
Entry2(&MyEntryEffect_Maseki00, read_buffer, 6, &MasekiModelBuffer, 3);
7070 memcpy(&MasekiEffect[1], &MasekiEffect[0],
sizeof(
CSHOT_EFFECT));
7071 MasekiEffect[1].
ReEntry(&MyEntryEffect_Maseki01, &MasekiModelBuffer);
7072 memcpy(&MasekiEffect[2], &MasekiEffect[0],
sizeof(
CSHOT_EFFECT));
7073 MasekiEffect[2].
ReEntry(&MyEntryEffect_Maseki02, &MasekiModelBuffer);
7074 memcpy(&MasekiEffect[3], &MasekiEffect[0],
sizeof(
CSHOT_EFFECT));
7075 MasekiEffect[3].
ReEntry(&MyEntryEffect_Maseki03, &MasekiModelBuffer);
7076 memcpy(&MasekiEffect[4], &MasekiEffect[0],
sizeof(
CSHOT_EFFECT));
7077 MasekiEffect[4].
ReEntry(&MyEntryEffect_Maseki04, &MasekiModelBuffer);
7080int BtCheckDamageProc() {
7087 static int dmgSnd = 0;
7094 if (DebugStatus[20] == 2) {
7102 sceVu0CopyVector(pos, CharaMain.
pos);
7104 int hit_no = NowColData->
CheckHitUser(pos, 1, CharaHeight(UserStatus));
7119 if (activeItem.
model[8] != -1) {
7121 activeItem.
model[8] = -1;
7130 if (ruby_effect_id != -1 && UserStatus->
cur_chara == CHARA_RUBY) {
7131 NowMainEffect->
OffEffect(ruby_effect_id);
7132 ruby_effect_id = -1;
7135 int damage = NowColData->
Get(hit_no)->
damage;
7141 if (StatusErrCheck(AILMENT_STAMINA) != 0) {
7151 int owner = NowColData->
hit[hit_no].
owner;
7156 monster = (owner - 200) / 5;
7159 if (monster >= 0 && monster < 16) {
7163 NowMonstorUnit->
chara[monster][0].GetPosition(from);
7166 roll = (int) (100.0f * (
float) rand() / 2147483648.0f);
7170 if ((hit->
flags & 0x40000) && roll < 20 && monster != -1) {
7171 u16 *wallet = &UserStatus->
money;
7172 u16 had = UserStatus->
money;
7175 int drained = had / 5;
7178 SndSePlay(SE_ITEM_GET, -1, 0);
7181 DngMessMan.
timer = 0xB4;
7186 if ((hit->
flags & 0x1000) && roll < 0x41) {
7187 BtSetStatusErr(AILMENT_STAMINA);
7190 if (hit->
flags & 0x100000) {
7191 BtSetStatusErr(AILMENT_FREEZE);
7194 if ((hit->
flags & 0x100) && roll < 0x41) {
7195 int slot = ((
CDngStatusData *) UserStatus)->CheckActItemSlot(ITEM_ANTI_FREEZE_AMULET);
7198 BtSetStatusErr(AILMENT_FREEZE);
7202 unsigned int address = slot *
sizeof(s32);
7204 address += (
unsigned int) who;
7207 if (--(*vol) <= 0) {
7208 DelActiveItem(slot + 1);
7210 DngMessMan.
insert_mes_1 = GetCommonItemDataSystemMsg(ITEM_ANTI_FREEZE_AMULET);
7211 DngMessMan.
timer = 0xB4;
7217 if ((hit->
flags & 0x200) && roll < 0x41 && (UserStatus->
ailments[UserStatus->
cur_chara] & AILMENT_POISON) == 0) {
7218 int slot = ((
CDngStatusData *) UserStatus)->CheckActItemSlot(ITEM_ANTIDOTE_AMULET);
7221 BtSetStatusErr(AILMENT_POISON);
7223 DngMessMan.
timer = 0xB4;
7227 unsigned int address = slot *
sizeof(s32);
7229 address += (
unsigned int) who;
7232 if (--(*vol) <= 0) {
7233 DelActiveItem(slot + 1);
7235 DngMessMan.
insert_mes_1 = GetCommonItemDataSystemMsg(ITEM_ANTIDOTE_AMULET);
7236 DngMessMan.
timer = 0xB4;
7242 if ((hit->
flags & 0x400) && roll < 0x41 && (UserStatus->
ailments[UserStatus->
cur_chara] & AILMENT_CURSE) == 0) {
7243 int slot = ((
CDngStatusData *) UserStatus)->CheckActItemSlot(ITEM_ANTICURSEAMULET);
7246 BtSetStatusErr(AILMENT_CURSE);
7248 DngMessMan.
timer = 0xB4;
7252 unsigned int address = slot *
sizeof(s32);
7254 address += (
unsigned int) who;
7257 if (--(*vol) <= 0) {
7258 DelActiveItem(slot + 1);
7260 DngMessMan.
insert_mes_1 = GetCommonItemDataSystemMsg(ITEM_ANTICURSEAMULET);
7261 DngMessMan.
timer = 0xB4;
7267 if ((hit->
flags & 0x800) && roll < 0x41 && (UserStatus->
ailments[UserStatus->
cur_chara] & AILMENT_GOO) == 0) {
7268 int slot = ((
CDngStatusData *) UserStatus)->CheckActItemSlot(ITEM_ANTIGOO_AMULET);
7271 BtSetStatusErr(AILMENT_GOO);
7273 DngMessMan.
timer = 0xB4;
7277 unsigned int address = slot *
sizeof(s32);
7279 address += (
unsigned int) who;
7282 if (--(*vol) <= 0) {
7283 DelActiveItem(slot + 1);
7285 DngMessMan.
insert_mes_1 = GetCommonItemDataSystemMsg(ITEM_ANTIGOO_AMULET);
7286 DngMessMan.
timer = 0xB4;
7293 if (hit->
flags & 0x80000) {
7297 if (NowColData->
hit[hit_no].
kind == 3) {
7298 sceVu0CopyVector(blow, NowColData->
hit[hit_no].
pos);
7302 sceVu0CopyVector(blowVelo, NowColData->
hit[hit_no].
velocity);
7303 velo__2[0] = blowVelo[0] / 10.0f;
7304 velo__2[2] = blowVelo[2] / 10.0f;
7307 NowColData->
active[hit_no] = 0;
7311 SndSePlay(SE_HIT_BLOCKED, -1, 0);
7315 SndSePlay(SE_CHARA_HURT, -1, 0);
7316 SndSePlay(SE_PLAYER_HIT, -1, 0);
7318 setUnitAmbientAnime(160.0f, 1.0f, 255.0f, 0.0f, 0.0f);
7321 float number_pos[4] = {0.0f, 0.0f, 0.0f, 1.0f};
7323 number_pos[1] = CharaHeight(UserStatus);
7324 HitValueEntry(NowHitValue, number_pos, damage, HIT_VALUE_PLAYER, CharaMain.
frame);
7326 sceVu0CopyVector(blowVelo, NowColData->
hit[hit_no].
velocity);
7327 unitBlowActionRot(blowVelo);
7330 NowColData->
active[hit_no] = 0;
7333 if (damage < UserStatus->hp[UserStatus->
cur_chara]) {
7343 driveNoInterpolate = 1;
7344 lockOnTargetFlag = 0;
7350 int kind = hits[hit_no].
kind;
7352 if (kind == 2 || hits[hit_no].kind == 4) {
7356 sceVu0CopyVector(at, hits[hit_no].pos);
7360 sceVu0CopyVector(away, CharaMain.
pos);
7362 if (monster != -1) {
7372 sceVu0CopyVector(MyHitPointMark[0].pos, at);
7373 MyHitPointMark[0].
on = 1;
7374 MyHitPointMark[0].
blink = 0;
7375 MyHitPointMark[0].
timer = 0x10;
7376 velo__2[0] = away[0] / 2.0f;
7377 velo__2[2] = away[2] / 2.0f;
7380 NowColData->
active[hit_no] = 0;
7384 SndSePlay(SE_HIT_BLOCKED, -1, 0);
7388 SndSePlay(SE_CHARA_HURT_HEAVY, -1, 0);
7389 SndSePlay(SE_PLAYER_HIT, -1, 0);
7391 setUnitAmbientAnime(80.0f, 1.0f, 255.0f, 0.0f, 0.0f);
7395 NowColData->
active[hit_no] = 0;
7398 float heavy_number_pos[4] = {0.0f, 0.0f, 0.0f, 1.0f};
7400 heavy_number_pos[1] = CharaHeight(UserStatus);
7401 HitValueEntry(NowHitValue, heavy_number_pos, damage, HIT_VALUE_PLAYER, CharaMain.
frame);
7406 sceVu0CopyVector(spot->
pos, at);
7417 if (!(stickVector < 0.8f)) {
7426 driveNoInterpolate = 1;
7429 if (NowColData->
hit[hit_no].
kind == 4) {
7431 setUnitAmbientAnime(10.0f, 1.0f, 255.0f, 0.0f, 0.0f);
7433 setUnitAmbientAnime(80.0f, 1.0f, 255.0f, 0.0f, 0.0f);
7440 if (DebugStatus[20] > 0) {
7449void BattleActionThlow() {
7450 sceVu0FVECTOR stood;
7453 float facing = NowCamera__3->
GetAngle();
7460 if (BombInfo.
aiming != 0) {
7461 if (GamePad.
On(PAD_SQUARE) != 0) {
7462 float stick_x = GamePad.
GetLXf();
7463 float stick_y = GamePad.
GetLYf();
7465 sceVu0CopyVector(stood, CharaMain.
pos);
7466 aim[0] = BombInfo.
pos[0] + stick_x * cos(facing) + stick_y * sinf(facing);
7467 aim[2] = BombInfo.
pos[2] + stick_y * cos(facing) - stick_x * sinf(facing);
7468 aim[1] = BombInfo.
pos[1];
7471 float away = DistVector(aim, stood);
7473 if (!(away < 30.0f) && away <= 120.0f) {
7474 sceVu0CopyVector(BombInfo.
pos, aim);
7477 float heading = atan2f(aim[0] - stood[0], aim[2] - stood[2]);
7478 float turned = unitRotation((
CFrameVu1 *) CharaFrame, heading);
7481 CharaFrame->SetRotation(zero, turned, zero);
7491 float throw_frame[6] = {548.0f, 452.0f, 267.0f, 347.0f, 188.0f, 321.0f};
7493 float start = throw_frame[UserStatus->
cur_chara];
7496 SndSePlay(SE_THROW, -1, 0);
7500 if (slots[itemNowSel + 3] == 1) {
7501 slots[itemNowSel] = -1;
7502 slots[itemNowSel + 3] = 0;
7504 slots[itemNowSel + 3]--;
7507 if (lockOnTargetFlag == 0) {
7508 sceVu0FVECTOR vector;
7511 if (activeItem.
model[8] != -1) {
7515 activeItem.
model[8] = -1;
7517 float offset[4] = {0.0f, 0.0f, 0.0f, 1.0f};
7519 CharaMain.
frame->SearchFrame(
"item")->GetWorldPosition(from, offset);
7520 DistVector(from, BombInfo.
pos);
7521 ParabolicInitialVector(vector, from, BombInfo.
pos, 0.12f, 20.0f);
7522 sceVu0ScaleVectorXYZ(vector, vector, 0.8f);
7524 if (activeItem.
model[8] == -1) {
7530 sceVu0FVECTOR lock_vector;
7531 sceVu0FVECTOR lock_from;
7533 if (activeItem.
model[8] != -1) {
7537 activeItem.
model[8] = -1;
7539 float lock_offset[4] = {0.0f, 0.0f, 0.0f, 1.0f};
7540 CFrame *hand = CharaMain.
frame->SearchFrame(
"item");
7543 hand->GetWorldPosition(lock_from, lock_offset);
7547 lock_vector[1] = 5.0f + (BtActStatus.
target_position[1] - lock_from[1]);
7549 sceVu0Normalize(lock_vector, lock_vector);
7550 lock_vector[0] *= 4.5f;
7551 lock_vector[1] *= 4.5f;
7552 lock_vector[2] *= 4.5f;
7554 if (activeItem.
model[8] == -1) {
7571 if (now >= end - 2.0f && now <= end) {
7574 BtActStatus.unk_028 = 0;
7575 driveNoInterpolate = 1;
7577 if (lockOnTargetFlag != 0) {
7587void BattleActionDrink() {
7595 float drink_frame[6] = {628.0f, 474.0f, 285.0f, 474.0f, 474.0f, 474.0f};
7598 frame = drink_frame[UserStatus->
cur_chara];
7601 if (now >= frame && now < frame + 0.3f) {
7602 SndSePlay(SE_DRINK, -1, 0);
7605 if (now >= frame + 10.0f && now < frame + 10.3f) {
7606 setUnitAmbientAnime(64.0f, 1.0f, 0.0f, 122.0f, 208.0f);
7607 SndSePlay(SE_EFFECT_CHIME, -1, 0);
7613 s32 running = activeItem.
item[activeItem.
now];
7615 usedActiveItem(UserStatus, running);
7620 if (slots[itemNowSel + 3] == 1) {
7621 slots[itemNowSel] = -1;
7622 slots[itemNowSel + 3] = 0;
7624 slots[itemNowSel + 3]--;
7627 if (activeItem.
model[8] != -1) {
7631 activeItem.
model[8] = -1;
7632 SndSePlay(SE_CHARA_RECOVER, -1, 0);
7636 driveNoInterpolate = 1;
7642 DngMessMan.
timer = 0;
7655void BattleActionOn_Jinn() {
7662 driveNoInterpolate = 1;
7663 SndSePlay(SE_CHARA_ACTION, -1, 0);
7667void BattleActionPlay_Jinn(
CCharacter *chara,
int aimed) {
7669 int damage = NowWeaponHave->
attack;
7673 if (StatusErrCheck(AILMENT_STAMINA) != 0) {
7678 if (GamePad.
On(PadInput_OK) == 0) {
7688 if (now >= end - 2.0f && now <= end) {
7701 if (now > 251.0f && now < 252.0f) {
7702 SndSePlay(SE_CHARA_ACTION_2, -1, 0);
7703 SndSePlay(SE_CHARA_SHOUT_2, -1, 0);
7705 sceVu0FVECTOR world;
7706 sceVu0FVECTOR vector;
7707 float offset[4] = {0.0f, 0.0f, 0.0f, 1.0f};
7708 CFrame *hand = NowWeapon->
frame->SearchFrame(
"eff30");
7711 hand->GetWorldPosition(world, offset);
7713 if (lockOnTargetFlag == 0) {
7716 setShotVector(vector, 5.0f, y, 0.0f);
7721 sceVu0Normalize(vector, vector);
7727 CSHOT *shots = NowShotData;
7729 for (i = 0; i < 12; i++) {
7730 if (shots->
used[i] == 0) {
7731 sceVu0CopyVector(shots->
pos[i], world);
7732 sceVu0CopyVector(shots->
vector[i], vector);
7733 shots->
life[i] = 0x78;
7734 shots->
damage[i] = damage;
7735 shots->
size[i] = 1.0f;
7746 SwordDmgCheck1(1.0f, 0);
7750 if (now > 21.0f && now < 21.8f) {
7752 if (now > 21.0f && now < 21.5f) {
7754 SndSePlay(SE_CHARA_ACTION_2, -1, 0);
7755 SndSePlay(SE_CHARA_SHOUT_2, -1, 0);
7757 sceVu0FVECTOR world;
7758 sceVu0FVECTOR vector;
7759 float offset[4] = {0.0f, 0.0f, 0.0f, 1.0f};
7760 CFrame *hand = NowWeapon->
frame->SearchFrame(
"eff30");
7763 hand->GetWorldPosition(world, offset);
7764 setShotVector(vector, 3.5f, viewAngleH__2, viewAngleV__2);
7766 CSHOT *shots = NowShotData;
7768 for (i = 0; i < 12; i++) {
7769 if (shots->
used[i] == 0) {
7770 sceVu0CopyVector(shots->
pos[i], world);
7771 sceVu0CopyVector(shots->
vector[i], vector);
7772 shots->
life[i] = 0x78;
7773 shots->
damage[i] = damage;
7774 shots->
size[i] = 1.0f;
7785 SwordDmgCheck1(1.0f, 0);
7791 if (now >= end - 2.0f && now <= end) {
7792 BtActStatus.unk_028 = 0;
7796 if (lockOnTargetFlag != 0) {
7801 if (gameTask == GAME_TASK_EYE_CAMERA) {
7808 if (GamePad.
On(PadInput_OK) == 0) {
7813 driveNoInterpolate = 1;
7816 driveNoInterpolate = 1;
7822void BattleActionOn_Ruby() {
7829 driveNoInterpolate = 1;
7833void BattleActionShotRuby(
CCharacter *chara,
int aimed,
float scale,
int repeat) {
7836 int damage = (weapon->
attack >> 1) + (weapon->
magic >> 1);
7838 damage = (int) ((
float) damage * scale);
7841 if (StatusErrCheck(AILMENT_STAMINA) != 0) {
7847 if (NowMainEffect->
Set(ruby_effect_pos, ruby_effect_vec, 3, element, 0, NULL, 1) != -1) {
7850 NowMainEffect->
SetDmg(damage);
7861 getFramePos((
CFrameVu1 *) chara->
frame,
"weapon", ruby_effect_pos);
7863 if (lockOnTargetFlag == 0) {
7864 getCharacterVector(ruby_effect_vec, 0.0f);
7865 ruby_effect_vec[0] += ruby_effect_pos[0];
7866 ruby_effect_vec[1] += ruby_effect_pos[1];
7867 ruby_effect_vec[2] += ruby_effect_pos[2];
7868 shot_no = NowMainEffect->
Set(ruby_effect_pos, ruby_effect_vec, 3, element, 0, NULL, 1);
7871 shot_no = NowMainEffect->
Set(ruby_effect_pos, ruby_effect_vec, 3, element, 0, NULL, 1);
7874 if (shot_no == -1) {
7880 NowMainEffect->
SetDmg(damage);
7884 float offset[4] = {0.0f, 0.0f, 0.0f, 1.0f};
7886 chara->
frame->SearchFrame(
"weapon")->GetWorldPosition(ruby_effect_pos, offset);
7887 setShotVector(ruby_effect_vec, 3.5f, viewAngleH__2, viewAngleV__2);
7888 ruby_effect_vec[0] += ruby_effect_pos[0];
7889 ruby_effect_vec[1] += ruby_effect_pos[1];
7890 ruby_effect_vec[2] += ruby_effect_pos[2];
7892 if (NowMainEffect->
Set(ruby_effect_pos, ruby_effect_vec, 3, element, 0, NULL, 1) != -1) {
7895 NowMainEffect->
SetDmg(damage);
7899void BattleActionPlay_Ruby(
CCharacter *chara,
int aimed) {
7904 if (GamePad.
On(PadInput_OK) == 0) {
7909 ruby_effect_id = -1;
7913 if (now >= 125.5f && now <= 126.5f && BtActStatus.
action_step == 0) {
7915 if (now >= 126.0f && now < 126.3f && BtActStatus.
action_step == 0) {
7923 ruby_effect_id = NowMainEffect->
Set(pos, aim, 3, element, 0, chara->
frame->SearchFrame(
"item"), 0);
7928 if (now >= 128.0f && now < 128.4f) {
7930 if (now >= 128.0f && now < 128.3f) {
7932 BattleActionShotRuby(chara, aimed, 1.0f, 0);
7934 SwordDmgCheck1(0.8f, 0);
7935 SndSePlay(SE_CHARA_ACTION, -1, 0);
7936 SndSePlay(SE_CHARA_SHOUT, -1, 0);
7940 if (now >= 126.0f && now <= 126.5f && BtActStatus.
action_step == 0) {
7942 if (now >= 126.0f && now < 126.3f && BtActStatus.
action_step == 0) {
7950 ruby_effect_id = NowMainEffect->
Set(pos, aim, 3, element, 0, chara->
frame->SearchFrame(
"item"), 0);
7955 if (now >= 128.0f && now < 128.4f) {
7957 if (now >= 128.0f && now < 128.3f) {
7959 BattleActionShotRuby(chara, aimed, 1.0f, 0);
7961 SwordDmgCheck1(0.8f, 0);
7962 SndSePlay(SE_CHARA_ACTION, -1, 0);
7963 SndSePlay(SE_CHARA_SHOUT, -1, 0);
7969 if (now >= end - 1.0f && now <= end) {
7970 BtActStatus.unk_028 = 0;
7974 if (lockOnTargetFlag != 0 && aimed == 0) {
7981 if (GamePad.
On(PadInput_OK) == 0) {
7986 SndSeSeqPlayStop(0x193, 5, 0);
7995 setUnitAmbientAnime(15.0f, 1.0f, 0.0f, 122.0f, 208.0f);
8010 if (now >= 216.0f && now < 217.5f && ruby_effect_id != -1) {
8011 NowMainEffect->
OffEffect(ruby_effect_id);
8012 ruby_effect_id = -1;
8017 if (now >= 216.0f && now < 216.5f) {
8019 if (now >= 216.0f && now < 216.4f) {
8021 BattleActionShotRuby(chara, aimed, 2.2f, 0);
8022 BattleActionShotRuby(chara, aimed, 2.2f, 1);
8024 SwordDmgCheck1(1.8f, 0);
8025 SndSePlay(SE_CHARA_ACTION, -1, 0);
8026 SndSePlay(SE_CHARA_SHOUT_3, -1, 0);
8030 if (now >= 216.0f && now < 216.5f) {
8032 if (now >= 216.0f && now < 216.3f) {
8034 BattleActionShotRuby(chara, aimed, 2.2f, 0);
8035 BattleActionShotRuby(chara, aimed, 2.2f, 1);
8037 SwordDmgCheck1(1.8f, 0);
8038 SndSePlay(SE_CHARA_ACTION, -1, 0);
8039 SndSePlay(SE_CHARA_SHOUT_3, -1, 0);
8043 if (now >= 216.5f && now < 217.5f && ruby_effect_id != -1) {
8044 NowMainEffect->
OffEffect(ruby_effect_id);
8045 ruby_effect_id = -1;
8048 if (now >= 216.5f && now < 216.9f) {
8049 BattleActionShotRuby(chara, aimed, 1.5f, 0);
8051 SwordDmgCheck1(1.2f, 0);
8052 SndSePlay(SE_CHARA_ACTION, -1, 0);
8053 SndSePlay(SE_CHARA_SHOUT_3, -1, 0);
8059 if (now >= end - 1.0f && now <= end) {
8060 BtActStatus.unk_028 = 0;
8064 if (lockOnTargetFlag != 0 && aimed == 0) {
8071void BattleActionOn_Ozumond() {
8078 driveNoInterpolate = 1;
8079 SndSePlay(SE_CHARA_SHOUT, -1, 0);
8080 ozumond_snd_cnt = 30;
8084void BattleActionOn_Ozumond_H() {
8092 driveNoInterpolate = 1;
8093 SndSePlay(SE_CHARA_SHOUT, -1, 0);
8094 ozumond_snd_cnt = 30;
8098void BattleActionOn_Ozumond_F() {
8104 driveNoInterpolate = 1;
8106 SndSePlay(SE_CHARA_SHOUT, -1, 0);
8107 ozumond_snd_cnt = 30;
8111void BattleActionPlay_Ozumond(
int aimed) {
8118 int damage = (weapon->
attack >> 1) + (weapon->
magic >> 1);
8121 if (StatusErrCheck(AILMENT_STAMINA) != 0) {
8125 drain = 1.5f - 0.01f * (float) NowWeaponHave->
speed;
8131 if (GamePad.
On(PadInput_OK) == 0) {
8135 SndSeSeqPlayStop(0x190, 5, 0);
8141 BtActStatus.unk_028 = 0;
8146 if (lockOnTargetFlag != 0) {
8155 getCharacterVector(aim, 0.0f);
8157 setShotVector(aim, 3.5f, viewAngleH__2, viewAngleV__2);
8158 sceVu0CopyVector(pos, CharaMain.
pos);
8162 sceVu0CopyVector(shot, aim);
8167 if (lockOnTargetFlag != 0) {
8173 static int s_cnt = 0;
8181 NowMainEffect->
Set(pos, aim, -1, -1, 0, NowWeapon->
frame->SearchFrame(
"dcol0"), -1);
8185 static int msg_cnt = 0;
8189 if (msg_cnt >= 10) {
8191 sceVu0Normalize(shot, shot);
8192 sceVu0ScaleVectorXYZ(shot, shot, 10.0f);
8193 OzumondShot.
Set(pos, shot, damage, 0);
8195 SwordDmgCheck1(0.5f, 0);
8199 BtActStatus.unk_028 = 0;
8203 if (lockOnTargetFlag != 0) {
8211void BattleActionPlay_Ozumond_H(
int aimed) {
8212 static int wait_cnt;
8219 int damage = weapon->
attack;
8222 if (StatusErrCheck(AILMENT_STAMINA) != 0) {
8230 if (GamePad.
On(PadInput_OK) == 0) {
8239 if (wait_cnt >= 10) {
8241 SndSeSeqPlayStop(0x199, 5, 0);
8245 getCharacterVector(aim, 0.0f);
8247 setShotVector(aim, 3.5f, viewAngleH__2, viewAngleV__2);
8248 sceVu0CopyVector(pos, CharaMain.
pos);
8252 sceVu0CopyVector(shot, aim);
8259 if (lockOnTargetFlag != 0) {
8260 shot_no = NowMainEffect->
Set(pos, BtActStatus.
target_position, 5, element, 0, NULL, -1);
8262 shot_no = NowMainEffect->
Set(pos, aim, 5, element, 0, NULL, -1);
8265 if (shot_no != -1) {
8269 NowMainEffect->
SetDmg(damage);
8274 SwordDmgCheck1(2.0f, 0);
8278 BtActStatus.unk_028 = 0;
8282 if (lockOnTargetFlag != 0) {
8288void BattleActionPlay_Ozumond_F(
int aimed) {
8289 static int wait_cnt = 0;
8290 sceVu0FVECTOR start;
8291 sceVu0FVECTOR start_dir;
8295 GetWeaponElementAttr(NowWeaponHave->
best_elem);
8297 int damage = NowWeaponHave->
attack;
8300 if (StatusErrCheck(AILMENT_STAMINA) != 0) {
8308 if (dmg_check_wait >= 8) {
8310 SwordDmgCheck1(1.5f, 0);
8316 getCharacterVector(start_dir, 0.0f);
8318 setShotVector(start_dir, 1.0f, viewAngleH__2, viewAngleV__2);
8319 sceVu0CopyVector(start, CharaMain.
pos);
8323 OzumondFire.
Init(start, start_dir, 0, 0);
8326 if (GamePad.
On(PadInput_OK) == 0) {
8327 BtActStatus.unk_028 = 0;
8331 if (lockOnTargetFlag != 0) {
8344 SndSeSeqPlayStop(0x194, 5, 0);
8350 BtActStatus.unk_028 = 0;
8355 if (lockOnTargetFlag != 0) {
8362 getCharacterVector(aim, 0.0f);
8364 setShotVector(aim, 3.5f, viewAngleH__2, viewAngleV__2);
8365 sceVu0CopyVector(pos, CharaMain.
pos);
8369 OzumondFire.
Set(pos, aim, damage, NowWeaponHave->
best_elem);
8373 if (dmg_check_wait >= 30) {
8375 SwordDmgCheck1(2.2f, 0);
8379 if (GamePad.
On(PadInput_OK) == 0) {
8380 BtActStatus.unk_028 = 0;
8384 if (lockOnTargetFlag != 0) {
8394float camera_far_dist_limmit;
8400static void CameraAutoMove(
CCameraFollow *camera,
CCPoly *poly,
float *position,
float from,
float to) {
8405 camera->
GetRef(reference);
8406 offset[0] = position[0] - reference[0];
8407 offset[2] = position[2] - reference[2];
8412 float over = camera->
GetDistance() - camera_near_dist__2;
8415 step = -over / 20.0f;
8419 step = over / 30.0f;
8434 NowCamera__3->
SetAngle(atan2f(offset[0], offset[2]));
8437 NowCamera__3->
AddAngle(0.2f * -step);
8439 NowCamera__3->
AddAngle(0.2f * step);
8442 if (camera->
GetDistance() < 0.8f * camera_near_dist__2) {
8447void autoCamTrial() {
8448 static int cameraDilay = 0;
8451 sceVu0FVECTOR along;
8456 sceVu0FVECTOR reach;
8457 sceVu0FVECTOR forward;
8458 sceVu0FVECTOR towards;
8460 float hit_point[32][4];
8461 sceVu0FVECTOR facing;
8462 sceVu0FVECTOR facing_last;
8463 sceVu0FVECTOR stood;
8464 sceVu0FVECTOR chara;
8465 sceVu0FVECTOR near_chara;
8466 sceVu0FVECTOR locked;
8472 if (DebugStatus[5] == 0) {
8476 NowCamera__3->
GetPos(eye);
8477 NowCamera__3->
GetRef(look);
8479 along[0] = look[0] - eye[0];
8480 along[1] = look[1] - eye[1];
8481 along[2] = look[2] - eye[2];
8483 sceVu0Normalize(along, along);
8496 box.
max[0] = look[0] > eye[0] ? look[0] : eye[0];
8497 box.
max[1] = look[1] > eye[1] ? look[1] : eye[1];
8498 box.
max[2] = look[2] > eye[2] ? look[2] : eye[2];
8499 box.
min[0] = look[0] < eye[0] ? look[0] : eye[0];
8500 box.
min[1] = look[1] < eye[1] ? look[1] : eye[1];
8501 box.
min[2] = look[2] < eye[2] ? look[2] : eye[2];
8509 while (NowDngMap->
parts[i].
frame[0] != NULL) {
8516 if (frame != NULL) {
8522 int turn = (int) ((
CDungeonMap *) map)->parts[i].frame_turn[0];
8534 frame->SetRotation(0.0f, PI * (-90.0f * turn) / 180.0f, 0.0f);
8535 frame->SetPosition(eye);
8536 count += frame->PickUpNearPoly(&poly[count], box);
8546 for (j = 0; j < 20; j++) {
8547 for (i = 0; i < 20; i++) {
8551 if (parts_no == -1) {
8559 if (frame == NULL) {
8579 frame->SetRotation(0.0f, PI * (-90.0f * turn) / 180.0f, 0.0f);
8580 frame->SetPosition(160.0f * i, 0.0f, 160.0f * j);
8581 count += frame->PickUpNearPoly(&poly[count], box);
8594 NowCamera__3->
GetPos(pos);
8595 NowCamera__3->
GetRef(ref);
8596 sceVu0SubVector(forward, ref, pos);
8597 sceVu0SubVector(reach, pos, forward);
8598 sceVu0SubVector(reach, pos, ref);
8599 sceVu0Normalize(reach, reach);
8600 sceVu0ScaleVectorXYZ(reach, reach, 80.0f);
8605 int hits = CheckHits(poly, count, ref, reach, 32, hit_poly, hit_point, 1, 0);
8607 camera_far_dist_limmit = 80.0f;
8610 camera_far_dist_limmit = DistVector(ref, hit_point[0]);
8616 sceVu0InnerProduct(forward, poly[hit_poly[0]].normal);
8619 for (i = 0; i < hits; i++) {
8620 sceVu0SubVector(towards, hit_point[i], pos);
8622 if (sceVu0InnerProduct(forward, towards) < 0.0f) {
8630 sceVu0CopyVector(facing, poly[hit_poly[last]].normal);
8632 if (sceVu0InnerProduct(forward, facing) > 0.0f) {
8633 if (last + 1 < hits) {
8634 float away = DistVector(pos, hit_point[last + 1]);
8636 if (away - DistVector(pos, hit_point[last]) < 0.0f) {
8637 CameraAutoMove(NowCamera__3, &poly[hit_poly[last + 1]], hit_point[last + 1], 1000000.0f, 1000000.0f);
8639 CameraAutoMove(NowCamera__3, &poly[hit_poly[last]], hit_point[last], 1000000.0f, 1000000.0f);
8641 }
else if (camera_far_dist_limmit >= camera_near_dist__2 && camera_far_dist_limmit < camera_far_dist__2) {
8642 NowCamera__3->
SetPos(hit_point[0]);
8644 CameraAutoMove(NowCamera__3, &poly[hit_poly[last]], hit_point[last], 1000000.0f, 1000000.0f);
8648 sceVu0CopyVector(facing_last, poly[hit_poly[0]].normal);
8650 if (sceVu0InnerProduct(forward, facing_last) < 0.0f) {
8651 CameraAutoMove(NowCamera__3, &poly[hit_poly[0]], hit_point[0], 1000000.0f, 1000000.0f);
8657 sceVu0CopyVector(reach, pos);
8660 if (CheckHitVertical(poly, count, reach, -100.0f, at, 0) >= 0) {
8661 if (pos[1] - at[1] < 25.0f) {
8662 pos[1] = 25.0f + at[1];
8663 NowCamera__3->
SetHeight(pos[1] - ref[1] - 0.01f);
8667 sceVu0CopyVector(chara, CharaMain.
pos);
8668 NowCamera__3->
GetPos(stood);
8670 if (DistVector(chara, stood) < camera_up_near_dist) {
8673 if (NowCamera__3->
GetHeight() <= 1.6f) {
8677 if (NowCamera__3->
GetHeight() <= 1.6f) {
8681 if (!(NowCamera__3->
GetHeight() <= 5.0f)) {
8683 float over = NowCamera__3->
GetHeight() - 5.0f;
8684 float step = over * rate;
8690 if (!(step <= 0.5f)) {
8698 if (!(NowCamera__3->
GetDistance() <= camera_far_dist__2)) {
8702 if (NowCamera__3->
GetDistance() < camera_near_dist__2) {
8706 if (NowCamera__3->
GetDistance() < camera_far_dist_limmit) {
8711 float turn = inputH1;
8713 inputH1 = inputH1 * (DistVector(ref_off) / 1.3f / 2.0f);
8715 if (!(inputH1 <= 0.1f)) {
8720 if (!(turn <= 1.0f)) {
8724 NowCamera__3->
AddAngle(2.5f * (-DEG_TO_RAD * turn));
8727 if (inputH1 < -0.1f) {
8728 if (!(turn <= -0.4f)) {
8736 NowCamera__3->
AddAngle(2.5f * (-DEG_TO_RAD * turn));
8741 if (lockOnTargetFlag != 0) {
8742 sceVu0CopyVector(near_chara, CharaMain.
pos);
8743 NowMonstorUnit->
chara[lockOnTargetNo][0].GetPosition(locked);
8745 float away = DistVector(near_chara, locked);
8747 if (!(away <= 30.0f)) {
8748 CharaMain.
frame->GetLWMatrix(world);
8750 float want = (float) (atan2f(world[2][0], world[2][2]) - PI_D);
8752 if (!(want <= PI_SHORT)) {
8753 want -= TWO_PI_SHORT;
8756 if (want < -PI_SHORT) {
8757 want += TWO_PI_SHORT;
8760 float angle = NowCamera__3->
GetAngle();
8761 float range = 70.0f * ((60.0f - away) / 30.0f);
8765 if (!(range < 90.0f)) {
8773 if (!(away <= 80.0f)) {
8777 if (AngleCmp(want, angle, DEG_TO_RAD_SHORT * range) != 0) {
8781 if (AngleCmp(want, angle, HALF_PI_SHORT) != 0) {
8789void DelActiveItem(
int slot) {
8795 if (slots[slot + 3] == 1) {
8797 slots[slot + 3] = 0;
8799 if (activeItem.
model[slot] != -1) {
8801 activeItem.
model[slot] = -1;
8808#define CHARA_WEAPONS_OFFSET 0x450c
8809STATIC_ASSERT((
int) &((
CUserStatus *) 0)->chara_weapons == CHARA_WEAPONS_OFFSET);
8811#pragma opt_propagation off
8829 status = UserStatus;
8830 wallet = &status->
money;
8831 had = status->
money;
8832 int had_copy = *wallet;
8835 slot = slots[chara];
8836 int slot_bytes = slot * (int)
sizeof(
WEAPON_HAVE);
8837 int row_bytes = chara * (int)
sizeof(status->
chara_weapons[0]);
8838 weapon = (
WEAPON_HAVE *) ((
char *) status + row_bytes + slot_bytes + CHARA_WEAPONS_OFFSET);
8845 if (item_no == defWeapon__6[chara] || item_no == defWeapon__6[chara] + 1) {
8851 BtSetStatusErr(AILMENT_STAMINA);
8856 int added = had_copy + 10;
8858 if (had + added >= 0xFFFF) {
8859 status->
money = 0xFFFF;
8861 status->
money += added;
8868 element = RGATE_ABS_FULL;
8872 element = RGATE_WHP_UP;
8876 element = RGATE_WHP_CURE;
8884 had_copy = (int) (had_copy - 0.2f * had_copy);
8886 if (had_copy <= 0) {
8895 element = RGATE_STAT_DOWN;
8899 element = RGATE_WHP_DOWN;
8903 element = RGATE_WHP_QUARTER;
8908 if (element != -1) {
8909 WeaponDataChangeByRGate(weapon, element);
8910 SetWeaponAttachStatus(NowWeaponHave);
8913 SndSePlay(se, -1, 0);
8917#pragma opt_propagation reset
8919void LockOffTargte() {
8920 lockOnTargetDraw = 0;
8921 lockOnTargetNo = -1;
8922 lockOnTargetFlag = 0;
8923 targetCursorShiftNo = -1;
8924 targetCursorShiftRot = 0.0f;
8925 EnemyLifeGage.
on = 0;
8928void DrawTargetLife() {
8935 if (EnemyLifeGage.
on == 0) {
8939 if (EnemyLifeGage.
draw == 0) {
8947 x = EnemyLifeGage.
x - 32;
8948 EnemyLifeGage.
y = (EnemyLifeGage.
y >> 1) << 1;
8949 width = (s32) (64.0f / EnemyLifeGage.
life_max * EnemyLifeGage.
life);
8951 if (x >= 577 || x < 0) {
8955 if (EnemyLifeGage.
y >= 481 || EnemyLifeGage.
y < 0) {
8959 s32 top = EnemyLifeGage.
y - 1;
8965 set2DSpriteC4(Vif1Packet, border, &ELifeB1, &ELifeB2, &ELifeB1, &ELifeB2);
8967 s32 ground_top = EnemyLifeGage.
y;
8970 ground.
y = ground_top;
8973 set2DSpriteC4(Vif1Packet, ground, &ELifeN1, &ELifeN1, &ELifeN1, &ELifeN1);
8975 s32 life_top = EnemyLifeGage.
y;
8981 set2DSpriteC4(Vif1Packet, life, &ELife1, &ELife2, &ELife1, &ELife2);
8985float targetCursorCnt;
8987void DrawtargetCursor(
float *world,
float width,
float height,
float alpha) {
8989 int bottom_right[4];
8992 texture = TexManager.GetTexture(
"d01e04", -1);
8996 if (MGRotTransPers3DSprite(top_left, bottom_right, world, width, height, 0) != 0) {
8999 top_left[0] -= 0x6C08;
9000 top_left[1] -= (GS_Y_OFFSET + 8);
9001 bottom_right[0] -= 0x6C08;
9002 bottom_right[1] -= (GS_Y_OFFSET + 8);
9005 bottom_right[0] >>= 4;
9006 bottom_right[1] >>= 3;
9008 static int rate = (int) (16.0f * alpha);
9010 set2DSprite(Vif1Packet, texture,
CRect_i_(top_left[0], top_left[1], 0x10, 0x10),
CRect_i_(0, 0x20, 0x10, 0x10), rate);
9011 set2DSprite(Vif1Packet, texture,
CRect_i_(bottom_right[0], top_left[1], 0x10, 0x10),
CRect_i_(0, 0, 0x10, 0x10), rate);
9012 set2DSprite(Vif1Packet, texture,
CRect_i_(top_left[0], bottom_right[1], 0x10, 0x10),
CRect_i_(0, 0x30, 0x10, 0x10), rate);
9013 set2DSprite(Vif1Packet, texture,
CRect_i_(bottom_right[0], bottom_right[1], 0x10, 0x10),
CRect_i_(0, 0x10, 0x10, 0x10), rate);
9020int SetNearLockOnTarget(
int from,
int nearest_only) {
9023 sceVu0FVECTOR towards;
9024 sceVu0FVECTOR pos[16];
9036 rate = CharaRangeRate(status);
9038 CharaFrame->GetRotation(at);
9044 sceVu0FVECTOR forward = {0.0f, 0.0f, 1.0f, 1.0f};
9050 sceVu0UnitMatrix(unit);
9051 sceVu0RotMatrixY(turn, unit, at[1]);
9052 sceVu0ApplyMatrix(forward, turn, forward);
9053 sceVu0Normalize(forward, forward);
9056 sceVu0CopyVector(at, CharaFrame->
position);
9058 for (i = 0; i < 16; i++) {
9062 for (i = 0; i < 16; i++) {
9065 MonstorPicupInner[i] = 0.0f;
9077 if (i >= 0 && i < 17) {
9089 monsters->
chara[i][0].GetPosition(pos[i]);
9091 away = DistVector(at, pos[i]);
9093 if (!(away < NowMonstorUnit->monster[i].lock_range * rate)) {
9097 towards[0] = pos[i][0] - at[0];
9098 towards[2] = pos[i][2] - at[2];
9101 sceVu0Normalize(towards, towards);
9103 MonstorPicupInner[i] = sceVu0InnerProduct(forward, towards);
9105 if (MonstorPicupInner[i] < 0.25f) {
9123 for (slot = 0; slot < 16; slot++) {
9128 for (; place < count; place++) {
9131 while (found[nearest] == -1) {
9135 float best = dist[nearest];
9137 for (other = 0; other < count; other++) {
9138 if (other == place) {
9142 if (found[other] == -1) {
9146 if (dist[other] < best) {
9152 order[place] = found[nearest];
9153 found[nearest] = -1;
9158 if (nearest_only == 0) {
9162 if (from >= count) {
9166 if (lockOnTargetNo == order[from]) {
9170 if (from >= count) {
9174 target = order[from];
9185 if (lockOnTargetNo == target && nearest_only == 0) {
9190 NowMonstorUnit->
chara[target][0].GetPosition(at);
9191 at[1] += NowMonstorUnit->
chara[target][0].body_height;
9192 cursorFrame->SetPosition(at);
9193 lockOnTargetDraw = 1;
9194 targetCursorCnt = 8.0f;
9197 if (MGRotTransPers(screen, at, 0) != 0) {
9198 SetMonsterNameDrawFlag(1);
9199 MonsterNamePosSet((screen[0] - 0x6C00) >> 4, (screen[1] - GS_Y_OFFSET) >> 4);
9200 EnemyLifeGage.
x = (screen[0] - 0x6C00) >> 4;
9201 EnemyLifeGage.
y = ((screen[1] - GS_Y_OFFSET) >> 4) + 42;
9203 SetMonsterNameDrawFlag(0);
9204 EnemyLifeGage.
on = 0;
9207 if (lockOnTargetNo != target) {
9213 lockOnTargetNo = target;
9217void setTargetCursor(
int on) {
9219 sceVu0FVECTOR target;
9220 sceVu0FVECTOR stood;
9221 sceVu0FVECTOR flat_stood;
9222 sceVu0FVECTOR flat_target;
9228 float rate = CharaRangeRate(status);
9233 if (NowMonstorUnit->
monster[lockOnTargetNo].
state != 2 || NowMonstorUnit->
monster[lockOnTargetNo].
hp <= 0) {
9241 sceVu0CopyVector(stood, CharaFrame->
position);
9242 NowMonstorUnit->
chara[lockOnTargetNo][0].GetPosition(target);
9244 float away = DistVector(stood, target);
9246 if (!(away < NowMonstorUnit->monster[lockOnTargetNo].lock_range * rate)) {
9252 if (NowMonstorUnit->
monster[lockOnTargetNo].
kind != MONSTER_KIND_NO_LOCK_ON) {
9253 sceVu0CopyVector(flat_stood, stood);
9254 sceVu0CopyVector(flat_target, target);
9255 flat_target[1] = 0.0f;
9256 flat_stood[1] = 0.0f;
9258 if (DistVector(flat_stood, flat_target) <= 8.0f + NowMonstorUnit->
monster[lockOnTargetNo].
body_radius && !(stood[1] <= 10.0f + target[1])) {
9262 float drop = stood[1] - target[1];
9264 drop = drop < 0.0f ? -drop : drop;
9266 if (!(drop < 80.0f)) {
9283 if (NowMonstorUnit->
monster[lockOnTargetNo].
name_no > 0 && NowMonstorUnit->
monster[lockOnTargetNo].
kind != MONSTER_KIND_NO_LOCK_ON) {
9285 EnemyLifeGage.
life = NowMonstorUnit->
monster[lockOnTargetNo].
hp;
9286 EnemyLifeGage.
on = 1;
9287 EnemyLifeGage.
x = 0x280;
9288 EnemyLifeGage.
y = 0;
9294 if (MGRotTransPers(screen, target, 0) != 0) {
9295 MonsterNameMake(NowMonstorUnit->
monster[lockOnTargetNo].
name_no);
9296 MonsterNamePosSet((screen[0] - 0x6C00) >> 4, (screen[1] - GS_Y_OFFSET) >> 4);
9297 EnemyLifeGage.
x = (screen[0] - 0x6C00) >> 4;
9298 EnemyLifeGage.
y = ((screen[1] - GS_Y_OFFSET) >> 4) + 42;
9299 SetMonsterNameDrawFlag(1);
9301 SetMonsterNameDrawFlag(0);
9302 EnemyLifeGage.
on = 0;
9305 DrawtargetCursor(BtActStatus.
target_position, width, height, targetCursorCnt);
9309 s16 weapon = NowWeaponHave->
item_no;
9311 if ((weapon == ITEM_WEAPON_STEVE || weapon == ITEM_WEAPON_SUPER_STEVE) && lockOnTargetFlag != 0 && NowMonstorUnit->
monster[lockOnTargetNo].
name_no > 0 && (
int) (100.0f * (
float) rand() / 2147483648.0f) < 3) {
9316 if (targetCursorCnt > 0.0f) {
9317 targetCursorCnt -= 0.5f;
9319 targetCursorCnt = 0.0f;
9322 if (targetCursorCnt < 8.0f) {
9323 targetCursorCnt += 0.25f;
9325 SndSePlay(MENU_SOUND_REFUSE, -1, 0);
9326 targetCursorShiftNo = 0;
9327 targetCursorShiftRot = 0;
9328 lockOnTargetFlag = 0;
9329 lockOnTargetNo = -1;
9330 EnemyLifeGage.
on = 0;
9338 targetCursorShiftRot = SetNearLockOnTarget(0, 1);
9341void unitBlowActionRot(
float *velocity) {
9342 sceVu0FVECTOR rotation;
9344 CharaFrame->GetRotation(rotation);
9345 rotation[1] = atan2f(velocity[0], velocity[2]);
9348 if (rotation[1] <= -PI) {
9349 rotation[1] += TWO_PI;
9352 CharaFrame->SetRotation(rotation[0], rotation[1], rotation[2]);
9355float setUnitDamageColor(
int hit) {
9356 static float dmgColor = 128.0f;
9357 static float dmgVec = 0.0f;
9366 dmgVec += EIGHTH_PI;
9367 dmgColor = 128.0f + 80.0f * sinf(dmgVec);
9370 if (dmgVec >= 9.424778f) {
9380float unitAmbientAnime_Speed;
9383float unitAmbientAnime_Count;
9386s32 unitAmbientAnime_Timer;
9389s32 unitAmbientAnime_flag;
9391void RsetUnitAmbientAnime() {
9392 unitAmbientAnime_flag = 0;
9395void setUnitAmbientAnime(
float speed,
float time,
float red,
float green,
float blue) {
9396 unitAmbientAnime_rgb[0] = red;
9397 unitAmbientAnime_rgb[1] = green;
9398 unitAmbientAnime_rgb[2] = blue;
9399 unitAmbientAnime_Count = 0;
9400 unitAmbientAnime_Speed = speed;
9401 unitAmbientAnime_Timer = (s32) time;
9402 unitAmbientAnime_flag = 1;
9405int unitAmbientAnime(
float *colour) {
9406 if (unitAmbientAnime_flag == 0) {
9410 colour[0] = 64.0f + unitAmbientAnime_rgb[0] * sinf(unitAmbientAnime_Count);
9411 colour[1] = 64.0f + unitAmbientAnime_rgb[1] * sinf(unitAmbientAnime_Count);
9412 colour[2] = 64.0f + unitAmbientAnime_rgb[2] * sinf(unitAmbientAnime_Count);
9415 unitAmbientAnime_Count += PI / unitAmbientAnime_Speed;
9417 if (unitAmbientAnime_Count > PI) {
9418 unitAmbientAnime_Timer--;
9420 if (unitAmbientAnime_Timer <= 0) {
9421 unitAmbientAnime_flag = 0;
9423 unitAmbientAnime_Count -= PI;
9424 unitAmbientAnime_Timer--;
9431int LoadStartLogo(
int map) {
9432 char *dungeon_name[7] = {
9441 char *floor_texture[7] = {
9455 files[0] = NameExchg(dungeon_name[map], 0);
9457 BtStartLogoBuffer.
used = 0;
9458 size = LoadTempTexture(files, 8, (
char *) BtStartLogoBuffer.
base);
9459 blocks = (((size >> 6) + 1) << 6) >> 4;
9460 BtStartLogoBuffer.Alloc(blocks);
9462 char *name = floor_texture[map];
9464 TEX_Floor1 = TexManager.GetTexture(name, -1);
9465 strcpy(floor_name, name);
9471char *MapInfoNameArea[7] = {
9472 "Cave of the Sacred Beast",
"Forest of the Own",
"Sunken Ship",
"Shrine of Sun and Moon",
"MoonOcean",
9473 "DarkHeven Castle",
"Deamon Shaft",
9477void FloorTitleOn() {
9484void SetMIniMapStatus(
int on) {
9487 infoMapOld = infoMap;
9491 infoMap = infoMapOld;
9496void ResetStatusInfo() {
9508 BtActStatus.unk_066 = 1;
9528void ResetMovePower() {
9535 MGSetBGColor(32.0f, 96.0f, 12.0f, 128.0f);
9536 TexManager.Initialize(0x3FE0);
9537 TexManager.EnterTextureFile(texdata2);
9538 TexManager.LoadTextureBlock(-1, read_buffer);
9543 CDbgMsg.
width = 256;
9553 static int nowCursor = 0;
9555 CDbgMsg.
length = sprintf(&CDbgMsg.
text[CDbgMsg.
length],
"- MapInfomationFile Loader -\n");
9557 for (i = 0; i < 7; i++) {
9558 strcpy(name, MapInfoNameArea[i]);
9560 if (nowCursor == i) {
9561 CDbgMsg.
length += sprintf(&CDbgMsg.
text[CDbgMsg.
length],
">>[%2d] %s\n", i + 1, name);
9563 CDbgMsg.
length += sprintf(&CDbgMsg.
text[CDbgMsg.
length],
" [%2d] %s\n", i + 1, name);
9567 if (GamePad.
Down(PAD_UP) != 0 && nowCursor != 0) {
9571 if (GamePad.
Down(PAD_DOWN) != 0 && nowCursor != 6) {
9575 if (GamePad.
Down(PAD_START) != 0 || GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
9576 selectMapNo = nowCursor;
9577 main_select_menu_no = nowCursor;
9578 MapJump(selectMapNo + 200, -1);
9579 MGSetBGColor(0.0f, 0.0f, 0.0f, 128.0f);
9583 sceVif1PkCall(Vif1Packet, (u_long128 *) Vu_prog0f, 0);
9584 sceVif1PkTerminate(Vif1Packet);
9585 TexManager.ReloadTexture(Vif1Packet, 12);
9590void InitEyeCamera() {
9594 viewAngleV__2 = 0.0f;
9595 sceVu0CopyVector(pos, CharaMain.
pos);
9601 sceVu0FMATRIX rotation;
9606 stick_x = GamePad.
GetLXf();
9607 stick_y = -GamePad.
GetLYf();
9611 if (stick_x > 0.0f) {
9614 viewAngleH__2 -= stick_x * rate;
9616 if (viewAngleH__2 < -PI) {
9617 viewAngleH__2 += TWO_PI;
9621 if (stick_x < -0.0f) {
9624 viewAngleH__2 -= stick_x * rate;
9626 if (viewAngleH__2 > PI) {
9627 viewAngleH__2 -= TWO_PI;
9631 if (stick_y > 0.0f) {
9632 if (viewAngleV__2 < 0.65f) {
9635 viewAngleV__2 += stick_y * rate;
9639 if (stick_y < -0.0f) {
9640 if (viewAngleV__2 > -1.0f) {
9643 viewAngleV__2 += stick_y * rate;
9652 sceVu0UnitMatrix(unit);
9653 sceVu0RotMatrixX(rotation, unit, viewAngleV__2);
9654 sceVu0RotMatrixY(rotation, rotation, viewAngleH__2);
9655 sceVu0ApplyMatrix(ref, rotation, ref);
9656 sceVu0CopyVector(pos, CharaMain.
pos);
9659 float height = CharaHeight(status);
9661 pos[1] += height - 1.5f;
9666 NowCamera__3->
SetPos(pos);
9667 NowCamera__3->
SetRef(ref);
void SetHeight(float height)
void AddDistance(float delta)
void SetFollow(float x, float y, float z)
void AddAngle(float delta)
void SetDistance(float distance)
virtual void Step(int steps)
void SetAngle(float angle)
void AddHeight(float delta)
void GetCameraMatrix(float(*matrix)[4])
void SetRef(CFrame *parent, float x, float y, float z)
void SetPos(CFrame *parent, float x, float y, float z)
void SetSpeed(float speed)
virtual void GetPosition(float *out_position)
virtual void LoadPackData2(unsigned int *pack, char *name, CDataAlloc2< 1 > *alloc, int texture_block_no, CDataAlloc2< 1 > *image_alloc, int visual_type)
virtual void LoadPackData(unsigned int *pack, char *name, CDataAlloc2< 1 > *model_alloc, CDataAlloc2< 1 > *texture_alloc)
virtual void LoadPackData3(unsigned int *pack, char *name, CDataAlloc2< 1 > *alloc, int texture_block_no, CDataAlloc2< 1 > *image_alloc, int keep_textures, int visual_type)
void InitializeTexAnime(CTexAnimeData *data, int count)
void SetFootSoundID(int id)
virtual void ShadowStep()
tagMOTION_TYPE motion_type
virtual void SetRotation(float x, float y, float z)
void FootSoundEnable(int on)
void TextureAnime(int step)
virtual void DrawShadow()
virtual void Initialize()
virtual void SetPosition(float x, float y, float z)
virtual void ClothStep(int step)
int CheckHitUser(float *position, int mask, float height)
COLLISION_HIT * Get(int index)
void FadeInit(float start_rate)
void FadeOutStart(float fade_speed)
float FadeOut(sceVif1Packet *packet)
float FadeIn(sceVif1Packet *packet)
void FadeInStart(float fade_speed)
void SetSteevMes(int first)
void SetStatus_Dry(float water_max, float water_before, float water_now)
int AddCollision(CCPoly *poly, int count, CBoxVu0 box)
CDungeonEventData * SearchDataSlotPos2(float *position)
CDungeonEventData event[96]
void SetupEvent(CDungeonMap *map, int mode)
CDungeonEventData * SearchDataSlotPos(float *position)
ROOM_LINK_RESULT room_link[4]
void DrawFire(CFrameVu1 *frame, CCameraFollow *camera)
void DrawFireFreeStyle(CFrameVu1 *frame, CCameraFollow *camera)
MAP_TRAP_CIRCLE * DistTrapCircle()
void DrawItemBox(float *pos)
void DrawRaster(CFrameVu1 *frame)
void DrawWater(float *pos, int mute)
void DrawBGModel(CCamera *camera)
int CreateCollision(CCPoly *poly, CBoxVu0 box, int num)
CFrame * box_collision_model
void DrawDummyModel(CCamera *camera)
int GetActiveIvent(CFrameVu1 *frame)
void DrawMap(CCameraFollow *camera, CFrameVu1 *player)
void DrawMiniMap(float *pos, float angle)
void buildEventData(int floor_no, int enabled, int place_atla)
void checkMask(float x, float z)
void DrawMapCalc(int mode)
void buildRandomMap(int room_max, int first_build)
void DrawAtraBoll(float *pos)
CFrame * camera_collision
s16 camera_collision_turn
void SetVibration(int motor, int intensity, int duration)
void SetAutoRepeat(int mask, int initial_delay, int repeat_delay)
void Set(float *position, float *direction, int kind, float spread, float shrink, float gravity, float speed, int count, float floor_y)
void Draw(CCamera *camera)
void DeleteModel(int model_no)
int SetHandModel(int source_no)
int SetThrowModel(int source_no, float *position, float *heading)
void DrawMapSymbol(float *offset)
int SetupBaseModel(int slot, int model_no, int texture_block, CDataAlloc2< 1 > *alloc)
CDataAlloc2< 1 > * script[16]
void ArrangementPos(CDungeonMap *map, int count, int model_no, int unused)
void CleanViewMonstor(int back_floor)
void MoveCheck(float *position, float *movement, int flat)
void LoadPack(unsigned int *pack, char *base_name, CDataAlloc2< 1 > *model_arena, CDataAlloc2< 1 > *motion_arena, MOTION_INFO *motion_info, int initialize_frames)
virtual void DrawShadow()
virtual void ShadowStep()
virtual void GetRotation(float *out_rotation)
void Set(float *position)
void SetVsMonster(char *effectiveness)
void SetWepStatus(int status)
int ReEntry(BT_SHOT_EFFECT *description, CDataAlloc2< 1 > *allocator)
void SetRandomRate(float rate)
int Entry2(BT_SHOT_EFFECT *description, unsigned int *pack, int tex_block, CDataAlloc2< 1 > *allocator, int slots)
void SetAttribute(int attribute)
int Set(float *position, float *target, int owner, int sub_id, int source, CFrame *parent, int initial_phase)
int Init(float *origin, float *direction, int collision_damage, int element)
int Set(float *origin, float *direction, int collision_damage, int element)
int Set(float *origin, float *direction, int damage, int element)
CDngStatusData * GetDngStatus()
void AddNowTime(float add)
void Draw(CCamera *camera)
void Initialize(CFrameVu1 *model)
void Initialize(CTexAnimeData *records, int count)
void TexAnime(int texture_block)
void AddNowLife(int chara_no, s16 amount, float ratio)
WEAPON_HAVE chara_weapons[6][11]
s8 equipped_weapon_slot[6]
s32 res_limit_zone_current
ATRA_SAVE atra_registry[6][100]
void InitSet(CFrame *frame, char *root_name, char *tip_name)
s32 used[WEAPON_EFFECT_STEP_MAX]
void SetBuff(short *buff)
MES_LINE_POS line_pos[10]
int MakeMesWin(int mes_no)
void SetBuff_system(short *buff)
CDataAlloc2< 1 > * WorkBuffer__2
@ TRAP_CIRCLE_WHP_QUARTER
@ TRAP_CIRCLE_ALL_MONSTER_STAMINA
@ ED_EVENT_RETURN_MAP_JUMP
sceVu0FVECTOR target_position
sceVu0FVECTOR input_direction
sceVu0FVECTOR move_vector
float camera_shake_offset
BT_ENEMY_LAYOUT monster[9]
s32 clear_script_ext_memory
RS_STACKDATA * escape_result
RS_STACKDATA * entrance_result
sceVu0FVECTOR screen_filter_color
CTexAnimeData * main_texture_animation
CFrameVu1 * item_frame[1]
sceVu0FVECTOR lockon_position
_FRAMECONSTRAINT look_constraint
sceVu0FVECTOR look_position
sceVu0FVECTOR ground_point
MOTION_INFO * motion_info