2#pragma literal_reload 0x3ECCCCCD, 0x3FA66666
8#include "btactstatus.hpp"
13#include "dataalloc.hpp"
15#include "dngmessageman.hpp"
16#include "dngstatusdata.hpp"
17#include "dun/gameloop.hpp"
19#include "framevu1.hpp"
21#include "menu_draw.hpp"
22#include "menu_dungeon.hpp"
23#include "menu_save.hpp"
27#include "userstatus.hpp"
36#include "collision.hpp"
37#include "dispctrl.hpp"
41#include "editloop3.hpp"
42#include "mainitemmodel.hpp"
45#include "monstorunit.hpp"
46#include "motionmodel.hpp"
53static int defWeapon[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};
56char *charaNameTbl[6] = {
57 "dun/mainchara/c01d.chr",
"dun/mainchara/c04b.chr",
"dun/mainchara/c06b.chr",
58 "dun/mainchara/c05a.chr",
"dun/mainchara/c10b.chr",
"dun/mainchara/c18a.chr",
62int BtGetTreasurebox_Sled;
63int BtGetAtraBoll_Sled;
64int TreasureboxBig_itemNo;
65int TreasureboxBig_itemType;
66float TreasureboxBig_itemScale;
67int BtGetTreasureboxSmall_itemNo;
68int BtGetTreasureboxSmall_itemVolume;
71int BtMiniChrSelecter_Sled;
78int createAttachVolume(
int item_no,
int dungeon);
80void selectChrUnit(
int chara_no,
int reload) {
81 char weapon0_name[64];
82 char weapon1_name[64];
83 char weapon2_name[64];
88 printf(
"%d -> %d\n", UserStatus->
cur_chara, chara_no);
90 if (chara_no == UserStatus->
cur_chara && reload == 0) {
95 LoadFile(charaNameTbl[chara_no], read_buffer, &size);
96 wait_now_loading_vsync();
97 size = (u_int) (((size >> 6) + 1) << 6) >> 2;
98 u_int *weapon0 = &read_buffer[size];
99 int default_weapon = defWeapon[chara_no];
100 BtGetWeaponNamePath3(weapon0_name, path, default_weapon);
101 BtGetWeaponNamePath3(weapon1_name, path, defWeapon[chara_no] + 1);
103 sprintf(path,
"commenu/weapon/%s", weapon0_name);
104 LoadFile(path, weapon0, &size);
105 u_int *weapon1 = &weapon0[(u_int) (((size >> 6) + 1) << 6) >> 2];
106 sprintf(path,
"commenu/weapon/%s", weapon1_name);
107 LoadFile(path, weapon1, NULL);
108 u_int *weapon2 = &weapon1[(u_int) (((size >> 6) + 1) << 6) >> 2];
109 sprintf(path,
"commenu/weapon/%s", weapon2_name);
110 LoadFile(path, weapon2, NULL);
111 wait_now_loading_vsync();
112 LoadChara2(chara_no, 0, read_buffer, weapon0, weapon1, weapon2);
113 SetWeaponAttachStatus(NowWeaponHave);
115 sprintf(effect_path,
"dun/mainchara/wep_eff/%s.chr", (
char *) effect);
116 printf(
"[%d] %s\n", chara_no, effect_path);
117 LoadFile(effect_path, read_buffer, &size);
118 wait_now_loading_vsync();
119 printf(
"fsize = %d\n", size);
120 MainChara_Effect(effect, read_buffer, 0);
124 unsigned int *buffer = read_buffer;
125 LoadFileMenuData(
"itemlst.img", buffer);
126 wait_now_loading_vsync();
127 SetTempTexture(0x28, (
char *) read_buffer);
128 BtItemListCashFlag = 1;
134 user->
hp[cur_chara] = 1;
145void LoadActiveItemIcon() {
146 unsigned int *buffer = read_buffer;
147 LoadFileMenuData(
"itemlst.img", buffer);
148 wait_now_loading_vsync();
149 SetTempTexture(0x28, (
char *) read_buffer);
150 BtItemListCashFlag = 1;
160void BtGetTreasureboxBig_Init() {
168 if (((
CDngStatusData *) UserStatus)->CheckWeaponRot(item_no) >= 10) {
169 SndSePlay(SE_CHEST_OPEN_BIG, -1, 0);
170 SetSystemMes(((
CDngStatusData *) UserStatus)->CheckWeaponUser(item_no) + 0x49, -1, MES_POS_CENTRE, 0, NULL, NULL);
186 BtGetTreasurebox_Sled = 10;
191 if (item_no == ITEM_WEAPON_STEVE && PlayerAllItemCheck(ITEM_WEAPON_STEVE) != 0) {
192 item_no = ITEM_WEAPON_BONE_SLINGSHOT;
195 TreasureboxBig_itemType = TREASUREBOX_POSE_DEFAULT;
197 if (((
CDngStatusData *) UserStatus)->CheckWeaponUser(item_no) == CHARA_XIAO) {
198 TreasureboxBig_itemType = TREASUREBOX_POSE_SLINGSHOT;
201 if (((
CDngStatusData *) UserStatus)->CheckWeaponUser(item_no) == CHARA_OSMOND) {
202 TreasureboxBig_itemType = TREASUREBOX_POSE_GUN;
205 if (((
CDngStatusData *) UserStatus)->CheckWeaponUser(item_no) == CHARA_RUBY) {
206 TreasureboxBig_itemType = TREASUREBOX_POSE_RING;
209 char *chara_files[6] = {
"dun/mainchara/c01d_ex00.chr",
"dun/mainchara/c04b_ex00.chr",
210 "dun/mainchara/c06b_ex00.chr",
"dun/mainchara/c05a_ex00.chr",
211 "dun/mainchara/c10b_ex00.chr",
"dun/mainchara/c18a_ex00.chr"};
213 char texture_path[64];
216 TreasureboxBig_itemNo = item_no;
218 BtGetItemNamePath(model_path, texture_path, item_no);
219 BtCashBuffer.
base = (u_char *) read_buffer;
220 BtCashBuffer.
limit = 0x445C0;
221 BtCashBuffer.
used = 0;
223 mds = BtCashBuffer.
base + BtCashBuffer.
used * 16;
224 itemOpenItemMds = (int) mds;
225 LoadFileBG(model_path, (u_long128 *) mds, &size);
226 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
227 img = BtCashBuffer.
base + BtCashBuffer.
used * 16;
228 itemOpenItemImg = (int) img;
229 LoadFileBG(texture_path, (u_long128 *) img, &size);
230 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
231 chr = BtCashBuffer.
base + BtCashBuffer.
used * 16;
232 itemOpenItemChr = (u_int *) chr;
233 LoadFileBG(chara_files[UserStatus->
cur_chara], (u_long128 *) chr, &size);
234 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
235 SndSPSeLoadBG(2, (u_int *) (BtCashBuffer.
base + BtCashBuffer.
used * 16), &size);
236 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
237 itemOpenBig.
frame->SetRotation(0.0f, 0.0f, 0.0f);
245 BtGetTreasurebox_Sled = 0;
256int BtGetTreasureboxBig_Loop() {
257 sceVu0FVECTOR position;
258 sceVu0FVECTOR item_position;
261 switch (BtGetTreasurebox_Sled) {
263 if (SndSPSeSyncBG() == 0 && ReadBGSync() == 0) {
264 SetTempTexture(0x1C, (
char *) itemOpenItemImg);
265 itemBoxModel = LoadMDSFile((u_int *) itemOpenItemMds, &BtCashBuffer, 0, NULL, NULL);
266 CharaMain.
LoadPackData((u_int *) itemOpenItemChr,
"base2.cfg", &BtCashBuffer, &BtCashBuffer);
268 BtGetTreasurebox_Sled++;
281 sceVu0CopyVector(position, NowDngMap->
boxes[index].
pos);
284 itemOpenBig.
frame->SetPosition(position);
285 itemOpenBigFx.
frame->SetPosition(position);
286 itemOpenBigFx.
frame->SetRotation(0.0f, 0.0f, 0.0f);
287 sceVu0CopyVector(item_position, position);
288 item_position[0] -= 5.0f;
289 item_position[1] += 13.0f;
291 switch (TreasureboxBig_itemType) {
292 case TREASUREBOX_POSE_DEFAULT:
293 itemBoxModel->SetRotation(HALF_PI, 0.0f, HALF_PI);
294 itemBoxModel->SetPosition(item_position);
295 TreasureboxBig_itemScale = 1.0f;
297 case TREASUREBOX_POSE_SLINGSHOT:
298 itemBoxModel->SetRotation(-HALF_PI, -HALF_PI, 0.0f);
299 item_position[0] += 3.5f;
300 itemBoxModel->SetPosition(item_position);
301 TreasureboxBig_itemScale = 1.0f;
303 case TREASUREBOX_POSE_GUN:
304 itemBoxModel->SetRotation(-HALF_PI, PI_SHORT, 0.0f);
305 item_position[0] += 2.5f;
306 itemBoxModel->SetPosition(item_position);
307 TreasureboxBig_itemScale = 1.0f;
309 case TREASUREBOX_POSE_RING:
310 itemBoxModel->SetRotation(0.0f, HALF_PI_SHORT, 0.0f);
311 item_position[0] += 3.5f;
312 itemBoxModel->SetPosition(item_position);
313 TreasureboxBig_itemScale = 2.0f;
317 itemBoxModel->SetScale(0.01f, 0.01f, 0.01f);
318 itemWeponScale = 0.1f;
322 itemOpenBig.
motion.unk_78 = 10.0f;
325 SubCamera = MainCamera__4;
326 NowCamera__3 = &SubCamera;
329 BtGetTreasurebox_Sled++;
334 setCameraPassData((
CFrameVu1 *) itemOpenBigFx.
frame, camera,
"cam",
"int");
338 if (!(pose_time < 79.0f) && pose_time <= 80.0f) {
345 if (!(sound_time <= 14.0f) && sound_time < 15.0f) {
346 SndSePlay(SE_CHEST_OPEN_BIG, -1, 0);
352 if (!(grow_time <= 50.0f) && grow_time <= 55.0f) {
353 float scale = TreasureboxBig_itemScale / 5.0f * (grow_time - 50.0f);
354 itemWeponScale = scale;
355 itemBoxModel->SetScale(scale, scale, scale);
361 BtGetTreasurebox_Sled++;
362 ItemGetMes(TreasureboxBig_itemNo, -1, 0x28, 1);
369 setCameraPassData((
CFrameVu1 *) itemOpenBigFx.
frame, camera,
"cam",
"int");
371 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
373 TexManager.DeleteTextureBlock(0x1C);
374 TexManager.CleanUpTextureList();
375 ((
CDngStatusData *) UserStatus)->GetItem(TreasureboxBig_itemNo, 0);
377 sceVu0CopyVector(position, CharaMain.
pos);
378 position[2] += 10.0f;
392 NowCamera__3 = &MainCamera__4;
399 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
426void BtGetTreasureboxSmall_Init(
int dungeon) {
433 int refusal = ((
CDngStatusData *) UserStatus)->CheckItemGet(item_no);
436 SndSePlay(SE_CHEST_OPEN_SMALL, -1, 0);
439 SetSystemMes(0x48, -1, MES_POS_CENTRE, 0, NULL, NULL);
443 SetSystemMes(0x51, -1, MES_POS_CENTRE, 0, NULL, NULL);
461 BtGetTreasurebox_Sled = 10;
466 char *chara_files[6] = {
"dun/mainchara/c01d_ex00.chr",
"dun/mainchara/c04b_ex00.chr",
467 "dun/mainchara/c06b_ex00.chr",
"dun/mainchara/c05a_ex00.chr",
468 "dun/mainchara/c10b_ex00.chr",
"dun/mainchara/c18a_ex00.chr"};
470 char texture_path[64];
475 if (ITEM_NAME_TBL_NEW[item_no - ITEM_ATTACH_START] == NULL) {
476 item_no = ITEM_ATTACH_PERIDOT;
479 int volume = createAttachVolume(item_no, dungeon);
480 printf(
"get attach vol = %d\n", volume);
481 BtGetTreasureboxSmall_itemNo = item_no;
482 BtGetTreasureboxSmall_itemVolume = volume;
483 strcpy(model_path,
"dun/item/main_data/");
484 strcat(model_path, ITEM_NAME_TBL_NEW[item_no - ITEM_ATTACH_START]);
485 strcpy(texture_path, model_path);
486 strcat(model_path,
".mds");
487 strcat(texture_path,
".img");
488 printf(
"[%d]%s\n", item_no, model_path);
489 printf(
"[%d]%s\n", item_no, texture_path);
490 BtCashBuffer.
base = (u_char *) read_buffer;
491 BtCashBuffer.
limit = 0x445C0;
492 BtCashBuffer.
used = 0;
494 mds = BtCashBuffer.
base + BtCashBuffer.
used * 16;
495 itemOpenItemMds = (int) mds;
496 LoadFileBG(model_path, (u_long128 *) mds, &size);
497 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
498 img = BtCashBuffer.
base + BtCashBuffer.
used * 16;
499 itemOpenItemImg = (int) img;
500 LoadFileBG(texture_path, (u_long128 *) img, &size);
501 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
502 chr = BtCashBuffer.
base + BtCashBuffer.
used * 16;
503 itemOpenItemChr = (u_int *) chr;
504 LoadFileBG(chara_files[UserStatus->
cur_chara], (u_long128 *) chr, &size);
505 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
506 SndSPSeLoadBG(2, (u_int *) (BtCashBuffer.
base + BtCashBuffer.
used * 16), &size);
507 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
508 itemOpenSmall.
frame->SetRotation(0.0f, 0.0f, 0.0f);
516 BtGetTreasurebox_Sled = 0;
527int BtGetTreasureboxSmall_Loop() {
530 switch (BtGetTreasurebox_Sled) {
532 if (ReadBGSync() == 0) {
534 SetTempTexture(0x1C, (
char *) itemOpenItemImg);
535 itemBoxModel = LoadMDSFile((u_int *) itemOpenItemMds, &BtCashBuffer, 0, NULL, NULL);
536 CharaMain.
LoadPackData((u_int *) itemOpenItemChr,
"base2.cfg", &BtCashBuffer, &BtCashBuffer);
538 BtGetTreasurebox_Sled++;
544 sceVu0FVECTOR position;
553 sceVu0CopyVector(position, NowDngMap->
boxes[index].
pos);
556 itemOpenSmall.
frame->SetPosition(position);
557 itemOpenSmallFx.
frame->SetPosition(position);
558 itemOpenSmallFx.
frame->SetRotation(0.0f, 0.0f, 0.0f);
559 position[1] += 13.0f;
560 itemBoxModel->SetPosition(position);
561 position[1] -= 13.0f;
562 itemBoxModel->SetScale(0.01f, 0.01f, 0.01f);
563 itemNormalScale = 0.1f;
569 itemOpenSmallFlag = 1;
570 SubCamera = MainCamera__4;
571 NowCamera__3 = &SubCamera;
574 BtGetTreasurebox_Sled++;
578 setCameraPassData((
CFrameVu1 *) itemOpenSmallFx.
frame, NowCamera__3,
"cam",
"int");
582 if (!(pose_time < 79.0f) && pose_time <= 80.0f) {
589 if (!(sound_time <= 19.0f) && sound_time < 20.4f) {
590 SndSePlay(SE_CHEST_OPEN_SMALL, -1, 0);
596 if (!(grow_time <= 50.0f) && grow_time <= 55.0f) {
597 float scale = 0.2f * (grow_time - 50.0f);
598 itemNormalScale = scale;
599 itemBoxModel->SetScale(scale, scale, scale);
604 itemOpenSmallFlag = 2;
606 if (BtGetTreasureboxSmall_itemVolume != 0) {
607 ItemGetMes(BtGetTreasureboxSmall_itemNo, BtGetTreasureboxSmall_itemVolume, 0x28, 1);
609 ItemGetMes(BtGetTreasureboxSmall_itemNo, -1, 0x28, 1);
612 BtGetTreasurebox_Sled++;
618 setCameraPassData((
CFrameVu1 *) itemOpenSmallFx.
frame, NowCamera__3,
"cam",
"int");
620 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
622 TexManager.DeleteTextureBlock(0x1C);
623 TexManager.CleanUpTextureList();
625 if ((
unsigned int) (BtGetTreasureboxSmall_itemNo - ITEM_MAP) < 2U) {
626 if (BtGetTreasureboxSmall_itemNo == ITEM_MAP) {
630 if (BtGetTreasureboxSmall_itemNo == ITEM_MAGICAL_CRYSTAL) {
631 BtEquipMasuisyou = 1;
634 ((
CDngStatusData *) UserStatus)->GetItem(BtGetTreasureboxSmall_itemNo, BtGetTreasureboxSmall_itemVolume);
637 sceVu0FVECTOR position;
639 sceVu0CopyVector(position, CharaMain.
pos);
640 position[2] += 10.0f;
653 itemOpenSmallFlag = 0;
654 NowCamera__3 = &MainCamera__4;
660 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
687void BtAtraGetShort_Init() {
690 atraShortGetType = 1;
691 BtCashBuffer.
base = (u_char *) read_buffer;
692 BtCashBuffer.
limit = 0x445C0;
693 BtCashBuffer.
used = 0;
695 LoadFileBG(BtAtraShortCharaFile, (u_long128 *) (itemOpenItemChr = (u_int *) (BtCashBuffer.
base + BtCashBuffer.
used * 16)), &size);
696 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
697 LoadFileBG(BtAtraShortEffectFile, (u_long128 *) (shortAtraEffectPtr = (u_int *) (BtCashBuffer.
base + BtCashBuffer.
used * 16)), &size);
698 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
699 SndSPSeLoadBG(1, (u_int *) (BtCashBuffer.
base + BtCashBuffer.
used * 16), &size);
700 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
706 BtAtraGetNo = iventActive;
708 BtGetAtraBoll_Sled = 0;
712char BtAtraShortEffectFile[] __attribute__((section(
".rodata"))) =
"dun/effect/saget.chr";
721int BtAtraGetShort_Loop(
int map_no,
int floor) {
722 sceVu0FVECTOR position;
725 switch (BtGetAtraBoll_Sled) {
727 if (SndSPSeSyncBG() == 0 && ReadBGSync() == 0) {
728 CharaMain.
LoadPackData((u_int *) itemOpenItemChr,
"base2.cfg", &BtCashBuffer, &BtCashBuffer);
730 shortAtraEffect.
LoadPackData2((u_int *) shortAtraEffectPtr,
"info.cfg", &BtCashBuffer, 0x1C, &BtCashBuffer, 0);
738 sceVu0CopyVector(atraGetPos, CharaMain.
pos);
740 driveNoInterpolate = 1;
745 atraGetStatusRate__2 = 0.0f;
748 BtAtraGetID = atra_id;
751 getAtraToSaveData(atra_id, NowDngMap->
atra[index].
atra_no, SaveData, map_no, floor);
752 sceVu0CopyVector(position, NowDngMap->
atra[index].
pos);
756 driveNoInterpolate = 1;
757 SubCamera = MainCamera__4;
758 NowCamera__3 = &SubCamera;
761 BtGetAtraBoll_Sled++;
770 if (!(pose_time < 129.0f) && pose_time <= 130.0f) {
775 if (atraGetStatusRate__2 < 256.0f) {
776 atraGetStatusRate__2 += 2.0f;
781 if (!(sound_time < 53.0f) && sound_time < 54.0f) {
786 AtraGetMes(map_no, BtAtraGetID, 0x28);
789 atraGetMsgBordRate = 0.0f;
791 BtGetAtraBoll_Sled++;
797 if (atraGetMsgBordRate < 128.0f) {
798 atraGetMsgBordRate += 4.0f;
800 BtGetAtraBoll_Sled++;
805 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
808 BtGetAtraBoll_Sled++;
813 if (DispFade__3.
GetRate() == 128.0f) {
816 BtGetAtraBoll_Sled++;
826 NowCamera__3 = &MainCamera__4;
852void BtMiniChrSelect_Init(
int type) {
855 BtMiniChrSelecter_Sled = 0;
856 BtMiniChrSel_Type = type;
866int BtMiniChrSelect_Loop() {
867 static int frameWait;
870 switch (BtMiniChrSelecter_Sled) {
872 BtMiniChrSelecter_Sled++;
880 if (frameWait >= 2) {
881 BtMiniChrSelecter_Sled++;
888 int blocks[2] = {0x128, 0xD8};
889 StartQuickChange((u_long128 *) read_buffer, 0x17, blocks, BtMiniChrSel_Type);
890 BtGameModeFlag = BT_GAME_MODE_CHARA_CHANGE;
891 BtMiniChrSelecter_Sled++;
908int BtMiniItemSelect_Sled;
922void BtMiniItemSelect() {
925 BtMiniItemSelect_Sled = 0;
936int BtMiniItemSelect_Loop() {
939 switch (BtMiniItemSelect_Sled) {
941 BtMiniItemSelect_Sled++;
946 BtMiniItemSelect_Sled++;
957 BtGameModeFlag = BT_GAME_MODE_ITEM_SELECT;
958 BtMiniItemSelect_Sled++;
984void BtGetGateKey_Init(
int item_no) {
986 char texture_path[64];
991 GateKey_itemNo = item_no;
992 BtGetItemNamePath(model_path, texture_path, item_no);
993 BtCashBuffer.
base = (u_char *) read_buffer;
994 BtCashBuffer.
limit = 0x445C0;
995 BtCashBuffer.
used = 0;
997 model = BtCashBuffer.
base + BtCashBuffer.
used * 16;
998 itemOpenItemMds = (int) model;
999 LoadFileBG(model_path, (u_long128 *) model, &size);
1000 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
1001 texture = BtCashBuffer.
base + BtCashBuffer.
used * 16;
1002 itemOpenItemImg = (int) texture;
1003 LoadFileBG(texture_path, (u_long128 *) texture, &size);
1004 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
1024int BtGetGateKey_Loop() {
1027 sceVu0FVECTOR ahead;
1030 switch (GateKey_Sled) {
1032 if (ReadBGSync() == 0) {
1033 SetTempTexture(0x1C, (
char *) itemOpenItemImg);
1034 itemBoxModel = LoadMDSFile((u_int *) itemOpenItemMds, &BtCashBuffer, 0, NULL, NULL);
1035 itemBoxModel->SetReference(CharaMain.
frame->SearchFrame(
"item"));
1036 itemBoxModel->SetPosition((0, 0.0f), (0, (0, 0.0f)), (0, (0, 0.0f)));
1037 itemBoxModel->SetRotation(0.0f, 0.0f, 0.0f);
1038 itemBoxModel->SetScale((0, (0, 1.0f)), 1.0f, (0, 1.0f));
1046 SetMIniMapStatus(0);
1054 sceVu0CopyVector(ref, CharaMain.
pos);
1057 sceVu0CopyVector(eye, CharaMain.
pos);
1058 getCharacterVector(ahead, 0.0f);
1059 sceVu0ScaleVectorXYZ(ahead, ahead, 40.0f);
1061 eye[1] += 20.0f + ahead[1];
1064 NowCamera__3 = &SubCamera;
1065 NowCamera__3->
Step(-1);
1067 SndSePlay(SE_GATE_KEY_GET, -1, 0);
1075 if (!(time < end - 0.5f) && time <= end) {
1076 ItemGetMes(GateKey_itemNo, -1, 0x28, 1);
1084 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
1085 TexManager.DeleteTextureBlock(0x1C);
1086 TexManager.CleanUpTextureList();
1089 SetMIniMapStatus(1);
1097 NowCamera__3 = &MainCamera__4;
1107void BtGetAttach_Init(
int dungeon,
int item_no) {
1110 if (item_no >= ITEM_ATTACH_START && item_no < ITEM_ATTACH_SLAYER_END) {
1111 volume = createAttachVolume(item_no, dungeon);
1114 BtGetTreasureboxSmall_itemNo = item_no;
1115 BtGetTreasureboxSmall_itemVolume = volume;
1118 ItemGetMes(BtGetTreasureboxSmall_itemNo, BtGetTreasureboxSmall_itemVolume, 0x78, 0);
1128int BtGetAttach_Loop() {
1131 switch (GateKey_Sled) {
1133 SetMIniMapStatus(0);
1137 ItemGetMes(BtGetTreasureboxSmall_itemNo, BtGetTreasureboxSmall_itemVolume, 0x28, 1);
1142 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
1145 SetMIniMapStatus(1);
1167void BtEscape_Init() {
1171 BtCashBuffer.
base = (u_char *) read_buffer;
1172 BtCashBuffer.
limit = 0x445C0;
1173 BtCashBuffer.
used = 0;
1175 chr = BtCashBuffer.
base + BtCashBuffer.
used * 16;
1176 escape_chr = (int) chr;
1177 LoadFileBG(
"dun/effect/escape.chr", (u_long128 *) chr, &size);
1178 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
1179 SndSPSeLoadBG(8, (u_int *) (BtCashBuffer.
base + BtCashBuffer.
used * 16), &size);
1180 BtCashBuffer.Alloc((((size >> 6) + 1) << 6) >> 4);
1190 SetMIniMapStatus(0);
1206int BtEscape_Loop() {
1207 sceVu0FVECTOR position;
1208 sceVu0FVECTOR rotation;
1211 switch (escape_sled) {
1213 if (SndSPSeSyncBG() == 0 && ReadBGSync() == 0) {
1214 EscapeEffect.
LoadPackData2((u_int *) escape_chr, BtEffectInfoFile, &BtCashBuffer, 0x1C, &BtCashBuffer, 0);
1218 sceVu0CopyVector(position, CharaMain.
pos);
1223 EdFadeOut(0x78, (0, 0.0f), (0, 0.0f), 0.0f);
1231 if (EdFadeOutCheck() != 0) {
1249void BtSetActiveItemModel(u_int *buffer) {
1255 char model_path[64];
1256 char texture_path[64];
1261 for (i = 0; i < 3; i++) {
1264 if (item_no == -1) {
1268 BtGetItemNamePath(model_path, texture_path, item_no);
1269 LoadFile(model_path, buffer, &model_size);
1270 wait_now_loading_vsync();
1271 model_size = (u_int) (((model_size >> 6) + 1) << 6) >> 2;
1272 LoadFile(texture_path, &buffer[model_size], &texture_size);
1273 wait_now_loading_vsync();
1275 if (activeItem.
model[i + 1] != -1) {
1277 activeItem.
model[i + 1] = -1;
1280 size = texture_size;
1281 texture = &buffer[model_size];
1283 if (activeItem.
model[i + 1] != -1) {
1288 activeItem.
model[i + 5] = 0;
1289 activeItem.
item[i + 1] = item_no;
1300void ParabolicInitialVector(
float *velocity,
float *from,
float *to,
float gravity,
float time) {
1301 velocity[0] = (to[0] - from[0]) / time;
1302 velocity[1] = (2.0f * (to[1] - from[1]) - time * (gravity * time)) / (2.0f * time);
1303 velocity[2] = (to[2] - from[2]) / time;
1305 float negative_one = -1.0f;
1306 velocity[1] = velocity[1] * negative_one;
1316void setShotVector(
float *velocity,
float speed,
float angle_y,
float angle_x) {
1317 sceVu0FMATRIX rotation;
1318 sceVu0FMATRIX identity;
1322 velocity[2] = speed;
1324 sceVu0UnitMatrix(identity);
1325 sceVu0RotMatrixX(rotation, identity, angle_x);
1326 sceVu0RotMatrixY(rotation, rotation, angle_y);
1327 sceVu0ApplyMatrix(velocity, rotation, velocity);
1330char no_item_name[] __attribute__((section(
".rodata"))) =
"";
1332char *ITEM_NAME_TBL_NEW[] = {
1510void getCharacterVector(
float *vector,
float pitch) {
1511 sceVu0FVECTOR forward = {0.0f, 0.0f, 1.0f, 1.0f};
1512 sceVu0FVECTOR rotation;
1513 sceVu0FMATRIX matrix;
1517 CharaMain.
frame->GetRotation(rotation);
1518 sceVu0UnitMatrix(yaw);
1519 sceVu0RotMatrixY(yaw, yaw, rotation[1]);
1520 sceVu0UnitMatrix(tilt);
1521 sceVu0RotMatrixX(tilt, tilt, pitch);
1522 sceVu0MulMatrix(matrix, yaw, tilt);
1523 sceVu0ApplyMatrix(vector, matrix, forward);
1533int ItemThrowStep(
float *position,
float *velocity) {
1534 sceVu0FVECTOR next_position;
1535 sceVu0FVECTOR direction;
1536 sceVu0FVECTOR hit_point;
1537 sceVu0FVECTOR normal;
1539 next_position[0] = position[0] + velocity[0];
1540 next_position[1] = position[1] + velocity[1];
1541 next_position[2] = position[2] + velocity[2];
1542 next_position[3] = 1.0f;
1543 velocity[1] -= 0.12f;
1544 sceVu0Normalize(direction, velocity);
1546 for (
int unit_no = 0; unit_no < 16; unit_no++) {
1547 for (
int i = 0; i < 16; i++) {
1556 int hit_poly = CheckHit(polys, setCollisionData(NowDngMap, polys, position, 20.0f, 1.5f), position, next_position, hit_point, 1, 4);
1558 if (hit_poly >= 0) {
1559 sceVu0CopyVector(normal, polys[hit_poly].normal);
1560 sceVu0Normalize(normal, normal);
1561 ReflectionPlane(normal, hit_point, position, velocity);
1562 sceVu0CopyVector(position, hit_point);
1563 position[0] += 1.3f * normal[0];
1564 position[1] += 1.3f * normal[1];
1565 position[2] += 1.3f * normal[2];
1566 velocity[0] *= 0.4f;
1567 velocity[1] *= 0.4f;
1568 velocity[2] *= 0.4f;
1572 sceVu0CopyVector(position, next_position);
virtual void Step(int steps)
void SetRef(CFrame *parent, float x, float y, float z)
void SetPos(CFrame *parent, float x, float y, float z)
void SetSpeed(float speed)
void SetMotion(int no, int mode, float speed=-1.0f)
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)
void SetMotionCamera(CCamera *camera)
tagMOTION_TYPE motion_type
virtual void SetRotation(float x, float y, float z)
virtual void SetPosition(float x, float y, float z)
void FadeInit(float start_rate)
void FadeOutStart(float fade_speed)
void FadeInStart(float fade_speed)
void DeleteModel(int model_no)
int SetCashModel(int item_no, unsigned int *model_data, unsigned int *texture_data, int texture_size)
MONSTOR_EFFECT_STATE effect[16]
virtual void GetRotation(float *out_rotation)
WEAPON_HAVE chara_weapons[6][11]
s8 equipped_weapon_slot[6]
ATRA_SAVE atra_registry[6][100]
void InitSet(CFrame *frame, char *root_name, char *tip_name)
CDataAlloc2< 1 > * WorkBuffer__2
sceVu0FVECTOR position[16]
MOTION_INFO * motion_info