1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
10#include "battlemenu.hpp"
12#include "dataalloc.hpp"
14#include "dun/gameloop.hpp"
20#include "menu_draw.hpp"
21#include "menu_manual.hpp"
22#include "menu_misc.hpp"
23#include "menu_save.hpp"
28float MenuIconPos[6][2];
32s8 EditMenuIconID[6] = {13, 10, 11, 5, 4, 6};
36int EdMenuTextureReadEndFlag;
37int EdMenuTextureBlock;
38u_long128 *EdMenuWorkBuf;
39int EdMenuExTextureBlock;
40int EdMenuExTextureBlock1;
41int EdMenuExTextureBlock2;
45s16 EdMenuHelpWinAlpha;
50s16 AnalyzeBackBlockCnt;
58#include "editloop.hpp"
59#include "mainselect.hpp"
60#include "menuitemstep.hpp"
69static int EditMenuStart();
78static void EditMenuSelectDraw();
87static int EditMenuSelect();
96static void EditMenuToExitDraw();
105static int EditMenuToExit();
114static void AtoraSelectDraw();
123static int AtoraSelect();
132static void AtoraMoveDraw();
141static int AtoraMove();
150static void ToAnalyzeEditDraw();
159static void ToAnalyzeEdit();
168static void AnalyzeEditDraw();
177static int AnalyzeEdit();
186static void FromAnalyzeEditDraw();
195static void FromAnalyzeEdit();
204static void EditSaveDraw();
213static void EditSaveKey();
222static void OptionDraw();
231static void EdOptionSelect();
240static int EdMenuManualKey();
249static void EdMenuManualDraw();
251int GetNumHowManyItemsHave(
int item) {
260 if (dungeon_status == NULL) {
266 switch (info->
kind) {
267 case ITEMKIND_WEAPON: {
270 if (weapon != NULL) {
272 s8 owner = weapon->
owner;
275 for (i = 0; i < 10; i++) {
276 if (item == weapons[i].item_no) {
296static int GetEditMenuMax() {
299 if (GetGameFlagForManualMenu() == 0) {
309static void DrawMenuIcon(
int slot) {
312 DrawMainMenuIcon((
int) (MenuIconPos[slot][0] - 6.0f), (
int) (MenuIconPos[slot][1] - 4.0f), info->
id, 1, 0x80, 0x80);
322static void GetEditMenuIconPos(
int slot,
int *position) {
323 u8 six[6] = {0x50, 0x60, 0x70, 0x80, 0x80, 0x70};
324 u8 five[5] = {0x50, 0x60, 0x70, 0x80, 0x70};
325 u8 x[6] = {0x50, 0x60, 0x70, 0x80, 0x80, 0x70};
326 int icon_max = GetEditMenuMax();
329 for (
int i = 0; i < icon_max; i++) {
335 for (
int i = 0; i < icon_max; i++) {
340 position[0] = x[slot];
341 position[1] = slot * 40 + 0x4A;
347static void DrawMoveMenuIcon() {
355 icon_max = GetEditMenuMax();
357 for (i = 0; i < icon_max; i++) {
358 if (EditSwitch == EDIT_MENU_SELECT) {
362 if (EditSwitch >= EDIT_MENU_ATORA_IN && EditSwitch < EDIT_MENU_ATORA_OUT) {
363 brightness = 0x80 - EdEffectCt * 8;
366 if (EditSwitch >= EDIT_MENU_ATORA_OUT && EditSwitch < EDIT_MENU_OUT_END) {
367 brightness = EdEffectCt * 8;
370 if (brightness < 0) {
374 if (brightness > 0x80) {
378 icon = EditMenuIconID[i];
379 GetMenuIconInfo(icon);
394 DrawMainMenuIcon((
int) (MenuIconPos[i][0] - x_offset), (
int) (MenuIconPos[i][1] - y_offset), icon, selected, 0x80, brightness);
405static int CalMoveFromMenuIcon() {
407 int arrived_count = 0;
409 s16 target[13] = {0x50, 0x34, 0x50, 0x34, 0x50, 0x20, 0x5E, 0x1E, 0x50, 0x34, 0x50, 0x34, -262};
411 s16 target[13] = {0x50, 0x34, 0x50, 0x34, 0x50, 0x20, 0x5E, 0x1E, 0x50, 0x34, 0x50, 0x34, -250};
413 int icon_max = GetEditMenuMax();
418 for (
int i = 0; i < icon_max; i++) {
419 int arrived_axes = 0;
421 if (i != EditSwitch - EDIT_MENU_ATORA_IN) {
423 y = (int) MenuIconPos[i][1];
426 y = target[i * 2 + 1];
429 float delta_x = x - MenuIconPos[i][0];
430 MenuIconPos[i][0] += delta_x / 4.0f;
432 if (abs((
int) delta_x) < 4.0f) {
433 MenuIconPos[i][0] = x;
437 float delta_y = y - MenuIconPos[i][1];
438 MenuIconPos[i][1] += delta_y / 4.0f;
440 if (abs((
int) delta_y) < 4.0f) {
441 MenuIconPos[i][1] = y;
445 if (arrived_axes >= 2) {
450 if (arrived_count >= icon_max) {
460static int CalMoveToMenuIcon() {
462 int arrived_count = 0;
463 int icon_max = GetEditMenuMax();
465 for (
int i = 0; i < icon_max; i++) {
466 int arrived_axes = 0;
469 GetEditMenuIconPos(i, target);
471 float delta_x = (float) target[0] - MenuIconPos[i][0];
472 MenuIconPos[i][0] += delta_x / 4.0f;
474 if (abs((
int) delta_x) < 2.0f) {
475 MenuIconPos[i][0] = target[0];
479 float delta_y = (float) target[1] - MenuIconPos[i][1];
480 MenuIconPos[i][1] += delta_y / 4.0f;
482 if (abs((
int) delta_y) < 2.0f) {
483 MenuIconPos[i][1] = target[1];
487 if (arrived_axes >= 2) {
492 if (arrived_count >= icon_max) {
499void EditMenuInit(
int *texture_blocks,
int start_at_atora) {
501 u_long128 *buffer = (u_long128 *) (EdMenuBuffer.
base + EdMenuBuffer.
used * 16);
502 EdMenuWorkBuf = buffer + (LoadFileBGMenuData(
"emenu.pak", buffer) >> 4) + 1;
503 EdMenuWorkBuf = MenuCalcBufAlignment(EdMenuWorkBuf);
504 EdMenuTextureReadEndFlag = 0;
505 EdMenuTextureBlock = texture_blocks[0];
506 EdMenuExTextureBlock = texture_blocks[1];
507 EdMenuExTextureBlock1 = texture_blocks[2];
508 EdMenuExTextureBlock2 = texture_blocks[3];
509 StayTex = TexManager.GetTexture(
"stayframe", -1);
517 EdMenuHelpWinAlpha = 0;
520 EdMenuEffectFlag = ED_MENU_ICON_STILL;
524 if (start_at_atora != 0) {
525 EdMenuTextureReadEndFlag = 1;
527 MenuIconPos[0][0] = 80.0f;
528 MenuIconPos[0][1] = 52.0f;
529 int blocks[2] = {0, 0};
530 blocks[0] = EdMenuTextureBlock;
531 blocks[1] = EdMenuExTextureBlock;
532 InitMenuAtora1(ATORA_OPEN_PLACE, NowEditMap, blocks, EdMenuWorkBuf);
533 InitMenuAtoraSelect(NowEditMap);
534 EditSwitch = EDIT_MENU_ATORA;
543 EditSwitch = EDIT_MENU_START;
545 WindowPos[1] = 325.0f;
546 GetMainMenuRightHelpWinLangOffset(WindowPos[0], WindowPos[1], EditMenuWinW, EditMenuWinH);
549 s16 start_x[6] = {-0xC0, -0xB0, -0xA0, -0x90, -0x80, -0x80};
551 for (
int i = 0; i < GetEditMenuMax(); i++) {
552 MenuIconPos[i][0] = start_x[i];
553 MenuIconPos[i][1] = i * 40 + 0x4A;
564static void EditMenuExit() {
565 int blocks[5] = {0, 0, 0, 0, -1};
567 blocks[0] = EdMenuTextureBlock;
568 blocks[1] = EdMenuExTextureBlock;
569 blocks[2] = EdMenuExTextureBlock1;
570 blocks[3] = EdMenuExTextureBlock2;
571 MenuTextureDelete(blocks);
572 TexManager.CleanUpTextureList();
585static int GetDrawHelpWindow(
int draw) {
586 if ((EditSwitch == EDIT_MENU_ATORA_IN || EditSwitch == EDIT_MENU_ATORA || EditSwitch == EDIT_MENU_ATORA_OUT) && GetMenuAtraEventFlag()) {
599 switch (EditSwitch) {
600 case EDIT_MENU_SELECT:
601 result = EditMenuSelect();
603 case EDIT_MENU_ANALYZE_IN:
606 case EDIT_MENU_ATORA_MOVE:
607 result = AtoraMove();
609 case EDIT_MENU_ANALYZE:
610 result = AnalyzeEdit();
612 case EDIT_MENU_ATORA:
613 case EDIT_MENU_ATORA_IN:
614 case EDIT_MENU_ATORA_OUT:
615 result = AtoraSelect();
617 case EDIT_MENU_ANALYZE_OUT:
621 case EDIT_MENU_SAVE_IN:
622 case EDIT_MENU_SAVE_OUT:
625 case EDIT_MENU_OPTION:
626 case EDIT_MENU_OPTION_IN:
627 case EDIT_MENU_OPTION_OUT:
630 case EDIT_MENU_MANUAL:
631 case EDIT_MENU_MANUAL_IN:
632 case EDIT_MENU_MANUAL_OUT:
636 result = EditMenuToExit();
648 MenuTextureReload(EdMenuTextureBlock);
650 FrameImageDraw(EdMenuRGB, 0x80);
652 switch (EditSwitch) {
653 case EDIT_MENU_START:
656 case EDIT_MENU_SELECT:
657 EditMenuSelectDraw();
659 case EDIT_MENU_ANALYZE_IN:
662 case EDIT_MENU_ATORA_MOVE:
665 case EDIT_MENU_ANALYZE:
668 case EDIT_MENU_ANALYZE_OUT:
669 FromAnalyzeEditDraw();
671 case EDIT_MENU_ATORA:
672 case EDIT_MENU_ATORA_IN:
673 case EDIT_MENU_ATORA_OUT:
677 case EDIT_MENU_SAVE_IN:
678 case EDIT_MENU_SAVE_OUT:
681 case EDIT_MENU_OPTION:
682 case EDIT_MENU_OPTION_IN:
683 case EDIT_MENU_OPTION_OUT:
686 case EDIT_MENU_MANUAL:
687 case EDIT_MENU_MANUAL_IN:
688 case EDIT_MENU_MANUAL_OUT:
692 EditMenuToExitDraw();
698 if (CursorVibeCnt >= 1080000000) {
702 MenuTextureReload(CommonMenuMes2.
tex_block);
703 GetMainMenuRightHelpMsgLangOffset(text_x, text_y);
704 GetMainMenuRightHelpWinLangOffset(WindowPos[0], WindowPos[1], EditMenuWinW, EditMenuWinH);
705 CommonMenuMes2.
text_x = (int) (WindowPos[0] + text_x);
706 CommonMenuMes2.
text_y = (int) (WindowPos[1] + text_y);
708 if (EdMenuTextureReadEndFlag != 0) {
709 switch (EditSwitch) {
711 EdMenuHelpWinAlpha -= 8;
713 if (EdMenuHelpWinAlpha < 0) {
714 EdMenuHelpWinAlpha = 0;
717 CommonMenuMes2.
edge_alpha = EdMenuHelpWinAlpha;
720 EdMenuHelpWinAlpha += 8;
722 if (EdMenuHelpWinAlpha > 0x80) {
723 EdMenuHelpWinAlpha = 0x80;
735 if (GetDrawHelpWindow(MakeWin2Flag) != 0) {
736 MenuHelpWinDraw((
int) WindowPos[0], (
int) WindowPos[1], EditMenuWinW, EditMenuWinH, EdMenuHelpWinAlpha);
738 if (EdMenuMesMake2 != 0) {
739 EdMenuMesMake2 = CommonMenuMes2.
MakeMesWin(EdMenuMesNo2);
742 CommonMenuMes2.
Step();
750static int EditMenuStart() {
751 u8 six[6] = {0x50, 0x60, 0x70, 0x80, 0x80, 0x70};
752 u8 five[5] = {0x50, 0x60, 0x70, 0x80, 0x70};
753 int icon_max = GetEditMenuMax();
754 u8 x[6] = {0x50, 0x60, 0x70, 0x80, 0x80, 0x70};
762 for (
int i = 0; i < icon_max; i++) {
768 for (
int i = 0; i < icon_max; i++) {
773 for (
int i = 0; i < icon_max; i++) {
774 MenuIconPos[i][0] += ((float) x[i] - MenuIconPos[i][0]) / 4.0f;
777 if (EdMenuRGB > 0x40) {
781 brightness = EdEffectCt * 7;
783 if (brightness > 0x80) {
787 for (i = 0; i < GetEditMenuMax(); i++) {
790 icon = EditMenuIconID[i];
791 GetMenuIconInfo(icon);
801 DrawMainMenuIcon((
int) (MenuIconPos[i][0] - x_offset), (
int) (MenuIconPos[i][1] - y_offset), icon, selected, 0x80, brightness);
804 if (ReadBGSync() == 0 && EdMenuTextureReadEndFlag == 0) {
805 LOADTEXTURE_INFO2 textures[3] = {{
"#frame_menuemenu#640#" SCREEN_HEIGHT_STR
"#4"}};
808 textures[1].
name = (
char *) GetPackFile((u_int *) file->
buffer,
"editmenu.img", NULL);
809 int blocks[5] = {0, 0, 0, 0, -1};
810 blocks[0] = EdMenuTextureBlock;
811 blocks[1] = EdMenuExTextureBlock;
812 blocks[2] = EdMenuExTextureBlock1;
813 blocks[3] = EdMenuExTextureBlock2;
814 MenuTextureDelete(blocks);
815 TexManager.CleanUpTextureList();
816 TexManager.LoadTextureBlockEX(-1, textures);
817 Analyze = TexManager.GetTexture(
"analyzeB", EdMenuTextureBlock);
818 AnaBar = TexManager.GetTexture(
"anabar", EdMenuTextureBlock);
819 PerBoardTex = TexManager.GetTexture(
"perbrd", EdMenuTextureBlock);
820 VillageName = TexManager.GetTexture(
"vilname", -1);
821 VillageBar = TexManager.GetTexture(
"viltag", -1);
822 GetAtraMsgReadBuf = (s16 *) GetPackFile((u_int *) file->
buffer,
"atrames.bin", NULL);
823 InitMenuMesSet(MENU_MES_SET_ALLMENU, (s16 *) GetPackFile((u_int *) file->
buffer,
"allmenu.mes", NULL));
824 EdMenuTextureReadEndFlag = 1;
829 if (EdEffectCt >= 17 && EdMenuTextureReadEndFlag != 0) {
830 EditSwitch = EDIT_MENU_SELECT;
841static void EditMenuSelectDraw() {
844 int icon_max = GetEditMenuMax();
846 float slot = selection;
847 float x = 48.0f + 16.0f * slot;
850 if (selection == icon_max - 2) {
854 if (selection == icon_max - 1) {
859 if (icon_max == 5 && selection == icon_max - 1) {
863 float y = 76.0f + 40.0f * selection;
865 EdCur.
x += (x - EdCur.
x) / 4.0f;
866 EdCur.
y += (y - EdCur.
y) / 3.0f;
870 DrawMenuWaku(x + 18.0f, y - 15.0f, width, 0x28, 0, StayTex, 0x80);
871 DrawMenuObjectVibe((
int) EdCur.
x, (
int) EdCur.
y, 1, 0x40);
880static int EditMenuSelect() {
881 int icon_max = GetEditMenuMax();
884 if (GamePad.
Down(PAD_UP | PAD_LEFT) != 0) {
892 if (GamePad.
Down(PAD_RIGHT | PAD_DOWN) != 0) {
895 if (icon_max - 1 <= EdCur.
selection - 1) {
901 ComMenuSePlay(MENU_SOUND_CURSOR);
904 if (GamePad.
Down(PAD_CIRCLE) != 0) {
905 ComMenuSePlay(MENU_SOUND_REFUSE);
906 EditSwitch = EDIT_MENU_EXIT;
908 }
else if (GamePad.
Down(PAD_CROSS) != 0) {
909 int next[6] = {EDIT_MENU_ATORA_IN, EDIT_MENU_ATORA_MOVE_IN, EDIT_MENU_ANALYZE_IN, EDIT_MENU_SAVE_IN, EDIT_MENU_OPTION_IN, EDIT_MENU_MANUAL_IN};
911 ComMenuSePlay(MENU_SOUND_CONFIRM);
914 u_long128 *work = EdMenuWorkBuf;
916 switch (EditSwitch) {
917 case EDIT_MENU_ATORA_IN: {
918 int blocks[2] = {0, 0};
919 blocks[0] = EdMenuTextureBlock;
920 blocks[1] = EdMenuExTextureBlock;
921 int area = GetNowMapTransAtraMap(MapNo);
923 if (area < 0 || area > 4) {
927 printf(
"now atra load area = %d\n", area);
928 InitMenuAtora1(ATORA_OPEN_PLACE, NowEditMap, blocks, work);
929 InitMenuAtoraSelect(NowEditMap);
930 EdMenuEffectFlag = ED_MENU_ICON_MOVE_FROM;
935 case EDIT_MENU_ATORA_MOVE_IN:
936 EditSwitch = EDIT_MENU_ATORA_MOVE;
938 case EDIT_MENU_ANALYZE_IN:
939 CommonMenuAtoraInfo = &EditPartsInfo;
941 if (CommonMenuAtoraInfo == NULL) {
942 CommonMenuAtoraInfo->
Load(0, SaveData, 1);
947 for (
int i = 0; i < 3; i++) {
948 AnalyzeFill[i] = 0.0f;
952 AnalyzeBackBlockCnt = 0;
956 case EDIT_MENU_SAVE_IN:
958 EdMenuEffectFlag = ED_MENU_ICON_MOVE_FROM;
960 InitMenuSave(SAVE_MENU_MODE_SAVE, EdMenuExTextureBlock, work);
962 case EDIT_MENU_OPTION_IN:
964 EdMenuEffectFlag = ED_MENU_ICON_MOVE_FROM;
965 InitMenuOption(OPTION_OPEN_GAME_MENU, EdMenuExTextureBlock, work);
967 case EDIT_MENU_MANUAL_IN: {
969 EdMenuEffectFlag = ED_MENU_ICON_MOVE_FROM;
970 int blocks[3] = {0, 0, 0};
971 blocks[0] = EdMenuExTextureBlock1;
972 blocks[1] = EdMenuExTextureBlock;
973 blocks[2] = EdMenuExTextureBlock2;
974 InitMenuManual(blocks, work);
983static void EditMenuToExitDraw() {
990static int EditMenuToExit() {
993 if (EdMenuRGB > 0x80) {
1009 for (
int i = 0; i < GetEditMenuMax(); i++) {
1010 MenuIconPos[i][0] += (-220.0f - MenuIconPos[i][0]) / 4.0f;
1015 if (EdEffectCt > 0x15) {
1017 EditMenuStatus.
mode = EDIT_MENU_MODE_CLOSED;
1018 EditMenuStatus.
parts = -1;
1029static void AtoraSelectDraw() {
1030 if (EdMenuTextureReadEndFlag == 0 && ReadBGSync() == 0) {
1031 EdMenuTextureReadEndFlag = 1;
1034 DrawMenuAtoraSelect();
1036 switch (EdMenuEffectFlag) {
1037 case ED_MENU_ICON_MOVE_FROM:
1038 case ED_MENU_ICON_MOVE_TO:
1042 if (GetMenuAtraEventFlag() == 0) {
1053static int AtoraSelect() {
1056 switch (EdMenuEffectFlag) {
1057 case ED_MENU_ICON_MOVE_FROM:
1058 if (CalMoveFromMenuIcon()) {
1059 EditSwitch = EDIT_MENU_ATORA;
1060 EdMenuEffectFlag = ED_MENU_ICON_STILL;
1061 EdMenuEffectCt = 0.0f;
1065 case ED_MENU_ICON_MOVE_TO:
1066 if (CalMoveToMenuIcon()) {
1067 EditSwitch = EDIT_MENU_SELECT;
1075 switch (MenuAtoraSelectKey()) {
1076 case ATORA_SELECT_PLACE_EXIT:
1077 case ATORA_SELECT_PLACE:
1080 case ATORA_SELECT_CLOSE:
1081 EditSwitch = EDIT_MENU_ATORA_OUT;
1082 EdMenuEffectFlag = ED_MENU_ICON_MOVE_TO;
1083 EdMenuEffectCt = 0.0f;
1085 case ATORA_SELECT_NONE:
1092 if (EdMenuEffectFlag != ED_MENU_ICON_STILL) {
1093 EdMenuEffectCt += 1.0f;
1096 EdMenuEffectCt = 0.0f;
1103static void AtoraMoveDraw() {}
1108static int AtoraMove() {
1110 EditMenuStatus.
mode = EDIT_MENU_MODE_MOVE;
1117static void AnalyzeBackDraw(
int alpha,
int brightness) {
1118 AnalyzeBackBlockCnt++;
1120 if (AnalyzeBackBlockCnt >= 0x10E) {
1121 AnalyzeBackBlockCnt = 0;
1124 int x = AnalyzeBackBlockCnt / 5 - 0x36;
1127 for (
int column = 0; column < 0xD; column++, x += 0x36, y = 0x3C) {
1128 for (
int row = 0; row < 5; row++, y += 0x36) {
1137 if (y + 0x36 > 0x130) {
1139 if (y + 0x36 > 0x11C) {
1148 DrawMenu2DSprite(AnaBar,
CRect_i_(x, y + top, 0x36, bottom - top),
CRect_i_(0x36, top, 0x36, bottom - top), brightness, brightness, brightness, alpha);
1156static float AnalyzeRequestPer() {
1166 for (
int i = 0; i < 24; i++) {
1167 if (info->request[i] != 0) {
1172 float percent = 100.0f * done / total;
1174 if (percent >= 100.0f) {
1188static int AnalyzeBarDraw() {
1190 float parts_complete;
1191 float elements_total;
1207 elements_total = parts_complete = parts_total = 0.0f;
1211 for (i = 0; i < 24; i++) {
1214 if (info != NULL && info->
stock > 0) {
1215 parts_total += 1.0f;
1221 parts_complete += 1.0f;
1225 for (
int j = 0; j < 6; j++) {
1230 elements_total += 1.0f;
1239 s16 *elements = (s16 *) SaveData->
GetElemData(NowEditMap);
1241 for (i = 0; i < 128; i++) {
1242 if (elements[i] > -1) {
1247 int total = (int) (parts_total + elements_total);
1252 percent[0] = 100.0f * (float) (parts_done + elements_done) / (float) total;
1255 if ((
int) parts_total <= 0) {
1258 percent[1] = 100.0f * parts_complete / parts_total;
1261 percent[2] = AnalyzeRequestPer();
1263 for (i = 0; i < 3; i++) {
1264 target[i] = 144.0f * percent[i] / 100.0f;
1266 if (!(target[i] <= 144.0f)) {
1274 for (i = 0; i < 3; i++) {
1277 if (i != bars_started) {
1281 AnalyzeFill[i] += 2.0f + 2.0f * ButtonAdd;
1284 if (goal < AnalyzeFill[i]) {
1285 AnalyzeFill[i] = goal;
1288 fill = AnalyzeFill[i];
1289 edge = 0.08f * fill;
1296 top = (int) (306.0f - fill);
1298 top = (int) (286.0f - fill);
1303 bar_source.
y = i * 16 + 8;
1304 bar_source.
width = 0x36;
1306 int height = (int) fill;
1307 bar_destination.
x = x;
1308 bar_destination.
y = top;
1309 bar_destination.
width = 0x36;
1310 bar_destination.
height = height;
1311 DrawMenu2DSprite(AnaBar, bar_destination, bar_source, 0x80);
1312 DrawMenu2DSprite(AnaBar,
CRect_i_(x, top, 0x36, (
int) edge),
CRect_i_(0, i * 16, 0x36, 8), 0x80);
1313 edge = 0.1f * AnalyzeFill[i];
1315 if (!(AnalyzeFill[i] <= 0.0f)) {
1317 DrawMenu2DSprite(AnaBar,
CRect_i_(x + 0x36, (
int) (top + edge), 10, (
int) ((
float) (0x130 - top) - edge)),
CRect_i_(0x56, 0x36, 10, 9), 0x80);
1319 DrawMenu2DSprite(AnaBar,
CRect_i_(x + 0x36, (
int) (top + edge), 10, (
int) ((
float) (0x11C - top) - edge)),
CRect_i_(0x56, 0x36, 10, 9), 0x80);
1323 number = (int) (100.0f * AnalyzeFill[i] / 144.0f);
1325 if (percent[i] < (
float) number) {
1326 number = (int) percent[i];
1331 for (digits = GetNumberKeta(number); digits != 0; digits--, digit_x -= 13) {
1332 int digit = number % 10;
1341 DrawMenu2DSprite(AnaBar,
CRect_i_(digit_x, top - 0x1E, 0x10, 0x18),
CRect_i_(u, v, 13, 0x11), 0x8C);
1345 DrawMenu2DSprite(AnaBar,
CRect_i_(x + 0x28, top - 0x1E, 0xF, 0x13),
CRect_i_(13, 0x5E, 13, 0x11), 0x80);
1347 if (0.4f * goal <= AnalyzeFill[i]) {
1352 if (AnalyzeFill[2] == target[2]) {
1359static void ToAnalyzeEditDraw() {
1360 MenuTextureReload(EdMenuTextureBlock);
1362 for (
int i = 0; i < 3; i++) {
1364 DrawMenu2DSprite(Analyze,
CRect_i_(i * 0xB5 + 0x56, 0x14a, 0x7E, 0x50),
CRect_i_(0x80, i * 0x50, 0x7E, 0x50), 0x80);
1366 DrawMenu2DSprite(Analyze,
CRect_i_(i * 0xB5 + 0x56, 0x136, 0x7E, 0x50),
CRect_i_(0x80, i * 0x50, 0x7E, 0x50), 0x80);
1370 float left = (float) (0x280 - EdEffectCt * 16);
1371 int width = (int) (80.0f + left);
1377 width = (int) ((
float) width - left);
1383 FadeTexX((
int) left, width, 0x280, 0,
"frame_image", 0);
1385 int alpha = EdEffectCt * 4;
1391 int brightness = EdEffectCt + 16;
1393 if (brightness > 0x40) {
1397 AnalyzeBackDraw(alpha, brightness);
1399 float bar = (float) (EdEffectCt * 20);
1406 done = AnalyzeBarDraw();
1414 DrawMenu2DSprite(AnaBar,
CRect_i_(0, 0x130, (
int) bar, 0x18),
CRect_i_(0, 0x36, 0x20, 0x18), 0x80);
1417 DrawMenu2DSprite(AnaBar,
CRect_i_(0, 0x11C, (
int) bar, 0x18),
CRect_i_(0, 0x36, 0x20, 0x18), 0x80);
1420 for (
int x = 0x75; (float) x < bar; x += 0xB5) {
1421 int segment_width = (int) (bar - (
float) x);
1423 if (segment_width > 0x3C) {
1424 segment_width = 0x3C;
1428 DrawMenu2DSprite(AnaBar,
CRect_i_(x, 0x130, segment_width, 0xF),
CRect_i_(0x20, 0x36, 0x36, 0xF), 0x80);
1430 DrawMenu2DSprite(AnaBar,
CRect_i_(x, 0x11C, segment_width, 0xF),
CRect_i_(0x20, 0x36, 0x36, 0xF), 0x80);
1434 CalMoveFromMenuIcon();
1440 EditSwitch = EDIT_MENU_ANALYZE;
1444static void ToAnalyzeEdit() {
1445 if (GamePad.
AllOn()) {
1454static void AnalyzeEditDraw() {
1456 AnalyzeBackDraw(0x80, 0x40);
1458 for (
int i = 0; i < 3; i++) {
1460 DrawMenu2DSprite(Analyze,
CRect_i_(i * 0xB5 + 0x56, 0x14a, 0x7E, 0x50),
CRect_i_(0x80, i * 0x50, 0x7E, 0x50), 0x80);
1462 DrawMenu2DSprite(Analyze,
CRect_i_(i * 0xB5 + 0x56, 0x136, 0x7E, 0x50),
CRect_i_(0x80, i * 0x50, 0x7E, 0x50), 0x80);
1468 DrawMenu2DSprite(AnaBar,
CRect_i_(0, 0x130, 0x280, 0x18),
CRect_i_(0, 0x36, 0x20, 0x18), 0x80);
1470 DrawMenu2DSprite(AnaBar,
CRect_i_(0, 0x11C, 0x280, 0x18),
CRect_i_(0, 0x36, 0x20, 0x18), 0x80);
1477 int width = 0x280 - x;
1483 if (AnalyzeFill[i] > 0.0f) {
1485 DrawMenu2DSprite(AnaBar,
CRect_i_(x, 0x130, width, 0xF),
CRect_i_(0x20, 0x36, 0x36, 0xF), 0x80);
1487 DrawMenu2DSprite(AnaBar,
CRect_i_(x, 0x11C, width, 0xF),
CRect_i_(0x20, 0x36, 0x36, 0xF), 0x80);
1496static int AnalyzeEdit() {
1497 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS)) {
1498 ComMenuSePlay(MENU_SOUND_REFUSE);
1499 EditSwitch = EDIT_MENU_ANALYZE_OUT;
1506static void FromAnalyzeEditDraw() {
1510 alpha = 0x80 - EdEffectCt * 10;
1516 AnalyzeBackDraw(alpha, 0x40);
1522static void FromAnalyzeEdit() {
1523 CalMoveToMenuIcon();
1526 if (EdEffectCt >= 0x10) {
1532 EditSwitch = EDIT_MENU_SELECT;
1539static void EditSaveDraw() {
1540 DrawMenuSave(
"frame_image");
1543 switch (EdMenuEffectFlag) {
1544 case ED_MENU_ICON_MOVE_FROM:
1545 case ED_MENU_ICON_MOVE_TO:
1554static void EditSaveKey() {
1557 switch (EdMenuEffectFlag) {
1558 case ED_MENU_ICON_MOVE_FROM:
1559 arrived = CalMoveFromMenuIcon();
1562 EdMenuEffectFlag = ED_MENU_ICON_STILL;
1563 EdMenuEffectCt = 0.0f;
1567 case ED_MENU_ICON_MOVE_TO:
1568 arrived = CalMoveToMenuIcon();
1572 if (EdMenuEffectFlag != ED_MENU_ICON_STILL) {
1573 EdMenuEffectCt += 1.0f;
1575 EdMenuEffectCt = 0.0f;
1580 if (SaveMenuEffectFadeOut()) {
1581 EdMenuEffectFlag = ED_MENU_ICON_MOVE_TO;
1585 EditSwitch = EDIT_MENU_SELECT;
1594static void OptionDraw() {
1598 switch (EdMenuEffectFlag) {
1599 case ED_MENU_ICON_MOVE_FROM:
1600 case ED_MENU_ICON_MOVE_TO:
1609static void EdOptionSelect() {
1610 int arrived =
false;
1613 switch (EdMenuEffectFlag) {
1614 case ED_MENU_ICON_MOVE_FROM:
1615 arrived = CalMoveFromMenuIcon();
1618 EdMenuEffectFlag = ED_MENU_ICON_STILL;
1619 EdMenuEffectCt = 0.0f;
1623 case ED_MENU_ICON_MOVE_TO:
1624 arrived = CalMoveToMenuIcon();
1628 if (EdMenuEffectFlag != ED_MENU_ICON_STILL) {
1629 EdMenuEffectCt += 1.0f;
1631 EdMenuEffectCt = 0.0f;
1634 key = MenuOptionKey();
1636 if (OptionMenuFadeOutStart()) {
1637 EdMenuEffectFlag = ED_MENU_ICON_MOVE_TO;
1639 if (arrived && key) {
1641 EditSwitch = EDIT_MENU_SELECT;
1647static int EdMenuManualKey() {
1648 int arrived =
false;
1651 switch (EdMenuEffectFlag) {
1652 case ED_MENU_ICON_MOVE_FROM:
1653 arrived = CalMoveFromMenuIcon();
1656 EdMenuEffectFlag = ED_MENU_ICON_STILL;
1657 EdMenuEffectCt = 0.0f;
1661 case ED_MENU_ICON_MOVE_TO:
1662 arrived = CalMoveToMenuIcon();
1666 if (EdMenuEffectFlag != ED_MENU_ICON_STILL) {
1667 EdMenuEffectCt += 1.0f;
1669 EdMenuEffectCt = 0.0f;
1672 key = MenuManualKey();
1674 if (GetNowManualMenuMode() == MANUAL_MODE_CLOSING) {
1675 EdMenuEffectFlag = ED_MENU_ICON_MOVE_TO;
1677 if (arrived && key) {
1679 EditSwitch = EDIT_MENU_SELECT;
1690static void EdMenuManualDraw() {
1694 switch (EdMenuEffectFlag) {
1695 case ED_MENU_ICON_MOVE_FROM:
1696 case ED_MENU_ICON_MOVE_TO:
int CheckComplete(int index)
EDITPARTS_INFO * GetPartsInfo(int index)
void Load(int georama_no, CSaveData *save_data, int load_requests)
void MenuModeOn(int threshold)
void SetAutoRepeat(int mask, int initial_delay, int repeat_delay)
CDngStatusData * GetDngStatus()
s16 * GetElemData(int georama_no)
WEAPON_HAVE chara_weapons[6][11]
int MakeMesWin(int mes_no)
EDITPARTS_ELEMENT elements[6]