DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
editmenu.cpp
1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3
4#include "editmenu.hpp"
5
6#include <cstdio>
7#include <cstdlib>
8#include <cstring>
9
10#include "battlemenu.hpp"
11#include "clsmes.hpp"
12#include "dataalloc.hpp"
13#include "dataread.hpp"
14#include "dun/gameloop.hpp"
15#include "edit.hpp"
16#include "editpartsinfo.hpp"
17#include "frame.hpp"
18#include "gamepad.hpp"
19#include "memcard.hpp"
20#include "menu_draw.hpp"
21#include "menu_manual.hpp"
22#include "menu_misc.hpp"
23#include "menu_save.hpp"
24#include "savedata.hpp"
25#include "snd.hpp"
26#include "texture.hpp"
27
28float MenuIconPos[6][2];
30float AnalyzeFill[3];
31
32s8 EditMenuIconID[6] = {13, 10, 11, 5, 4, 6};
33
34CTexture *Analyze;
35CTexture *AnaBar;
36int EdMenuTextureReadEndFlag;
37int EdMenuTextureBlock;
38u_long128 *EdMenuWorkBuf;
39int EdMenuExTextureBlock;
40int EdMenuExTextureBlock1;
41int EdMenuExTextureBlock2;
42int EditSwitch;
43s16 EdMenuRGB;
44int EdEffectCt;
45s16 EdMenuHelpWinAlpha;
46s16 AnalyzeSelect;
47int EdMenuMesNo2;
48int EdMenuMesMake2;
49s16 ButtonAdd;
50s16 AnalyzeBackBlockCnt;
51s16 EdMenuEffectFlag;
52float EdMenuEffectCt;
53float WindowPos[2];
54float EditMenuWinW;
55float EditMenuWinH;
56s16 MakeWin2Flag;
57
58#include "editloop.hpp"
59#include "mainselect.hpp"
60#include "menuitemstep.hpp"
61
69static int EditMenuStart();
70
78static void EditMenuSelectDraw();
79
87static int EditMenuSelect();
88
96static void EditMenuToExitDraw();
97
105static int EditMenuToExit();
106
114static void AtoraSelectDraw();
115
123static int AtoraSelect();
124
132static void AtoraMoveDraw();
133
141static int AtoraMove();
142
150static void ToAnalyzeEditDraw();
151
159static void ToAnalyzeEdit();
160
168static void AnalyzeEditDraw();
169
177static int AnalyzeEdit();
178
186static void FromAnalyzeEditDraw();
187
195static void FromAnalyzeEdit();
196
204static void EditSaveDraw();
205
213static void EditSaveKey();
214
222static void OptionDraw();
223
231static void EdOptionSelect();
232
240static int EdMenuManualKey();
241
249static void EdMenuManualDraw();
250
251int GetNumHowManyItemsHave(int item) {
252 COM_ITEM_INFO *info = GetCommonItemInfo(item);
253
254 if (info == NULL) {
255 return 0;
256 }
257
258 CDngStatusData *dungeon_status = SaveData->GetDngStatus();
259
260 if (dungeon_status == NULL) {
261 return 0;
262 }
263
264 int count = 0;
265
266 switch (info->kind) {
267 case ITEMKIND_WEAPON: {
268 WEAPON_DATA *weapon = GetWeaponData(item);
269
270 if (weapon != NULL) {
271 int i;
272 s8 owner = weapon->owner;
273 WEAPON_HAVE *weapons = dungeon_status->chara_weapons[owner];
274
275 for (i = 0; i < 10; i++) {
276 if (item == weapons[i].item_no) {
277 count++;
278 }
279 }
280 }
281
282 break;
283 }
284 }
285
286 return count;
287}
288
296static int GetEditMenuMax() {
297 int icon_max = 6;
298
299 if (GetGameFlagForManualMenu() == 0) {
300 icon_max--;
301 }
302
303 return icon_max;
304}
305
309static void DrawMenuIcon(int slot) {
310 MENU_ICON_INFO *info = GetMenuIconInfo(EditMenuIconID[slot]);
311
312 DrawMainMenuIcon((int) (MenuIconPos[slot][0] - 6.0f), (int) (MenuIconPos[slot][1] - 4.0f), info->id, 1, 0x80, 0x80);
313}
314
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();
327
328 if (icon_max == 5) {
329 for (int i = 0; i < icon_max; i++) {
330 x[i] = five[i];
331 }
332 }
333
334 if (icon_max == 6) {
335 for (int i = 0; i < icon_max; i++) {
336 x[i] = six[i];
337 }
338 }
339
340 position[0] = x[slot];
341 position[1] = slot * 40 + 0x4A;
342}
343
347static void DrawMoveMenuIcon() {
348 int y_offset;
349 int brightness;
350 int icon_max;
351 int i;
352 int icon;
353 int x_offset;
354
355 icon_max = GetEditMenuMax();
356
357 for (i = 0; i < icon_max; i++) {
358 if (EditSwitch == EDIT_MENU_SELECT) {
359 brightness = 0x80;
360 }
361
362 if (EditSwitch >= EDIT_MENU_ATORA_IN && EditSwitch < EDIT_MENU_ATORA_OUT) {
363 brightness = 0x80 - EdEffectCt * 8;
364 }
365
366 if (EditSwitch >= EDIT_MENU_ATORA_OUT && EditSwitch < EDIT_MENU_OUT_END) {
367 brightness = EdEffectCt * 8;
368 }
369
370 if (brightness < 0) {
371 brightness = 0;
372 }
373
374 if (brightness > 0x80) {
375 brightness = 0x80;
376 }
377
378 icon = EditMenuIconID[i];
379 GetMenuIconInfo(icon);
380
381 int selected;
382
383 y_offset = 0;
384 x_offset = 0;
385 selected = 0;
386
387 if (i == EdCur.selection) {
388 x_offset = 6;
389 y_offset = 2;
390 brightness = 0x80;
391 selected = 1;
392 }
393
394 DrawMainMenuIcon((int) (MenuIconPos[i][0] - x_offset), (int) (MenuIconPos[i][1] - y_offset), icon, selected, 0x80, brightness);
395 }
396}
397
405static int CalMoveFromMenuIcon() {
406 int done = 0;
407 int arrived_count = 0;
408#ifdef PAL
409 s16 target[13] = {0x50, 0x34, 0x50, 0x34, 0x50, 0x20, 0x5E, 0x1E, 0x50, 0x34, 0x50, 0x34, -262};
410#else
411 s16 target[13] = {0x50, 0x34, 0x50, 0x34, 0x50, 0x20, 0x5E, 0x1E, 0x50, 0x34, 0x50, 0x34, -250};
412#endif
413 int icon_max = GetEditMenuMax();
414
415 int x;
416 int y;
417
418 for (int i = 0; i < icon_max; i++) {
419 int arrived_axes = 0;
420
421 if (i != EditSwitch - EDIT_MENU_ATORA_IN) {
422 x = target[12];
423 y = (int) MenuIconPos[i][1];
424 } else {
425 x = target[i * 2];
426 y = target[i * 2 + 1];
427 }
428
429 float delta_x = x - MenuIconPos[i][0];
430 MenuIconPos[i][0] += delta_x / 4.0f;
431
432 if (abs((int) delta_x) < 4.0f) {
433 MenuIconPos[i][0] = x;
434 arrived_axes++;
435 }
436
437 float delta_y = y - MenuIconPos[i][1];
438 MenuIconPos[i][1] += delta_y / 4.0f;
439
440 if (abs((int) delta_y) < 4.0f) {
441 MenuIconPos[i][1] = y;
442 arrived_axes++;
443 }
444
445 if (arrived_axes >= 2) {
446 arrived_count++;
447 }
448 }
449
450 if (arrived_count >= icon_max) {
451 done = 1;
452 }
453
454 return done;
455}
456
460static int CalMoveToMenuIcon() {
461 int done = 0;
462 int arrived_count = 0;
463 int icon_max = GetEditMenuMax();
464
465 for (int i = 0; i < icon_max; i++) {
466 int arrived_axes = 0;
467 int target[2];
468
469 GetEditMenuIconPos(i, target);
470
471 float delta_x = (float) target[0] - MenuIconPos[i][0];
472 MenuIconPos[i][0] += delta_x / 4.0f;
473
474 if (abs((int) delta_x) < 2.0f) {
475 MenuIconPos[i][0] = target[0];
476 arrived_axes++;
477 }
478
479 float delta_y = (float) target[1] - MenuIconPos[i][1];
480 MenuIconPos[i][1] += delta_y / 4.0f;
481
482 if (abs((int) delta_y) < 2.0f) {
483 MenuIconPos[i][1] = target[1];
484 arrived_axes++;
485 }
486
487 if (arrived_axes >= 2) {
488 arrived_count++;
489 }
490 }
491
492 if (arrived_count >= icon_max) {
493 done = 1;
494 }
495
496 return done;
497}
498
499void EditMenuInit(int *texture_blocks, int start_at_atora) {
500 StartReadBG();
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);
510 GamePad.MenuModeOn(0x78);
511 GamePad.SetAutoRepeat(PAD_DPAD, 0x1E, 9);
512 CommonMenuMes2.mes_made = -1;
513 CommonMenuMes3.mes_made = -1;
514 MakeWin2Flag = 1;
515 EdMenuMesMake2 = 1;
516 EdMenuMesNo2 = 0x15;
517 EdMenuHelpWinAlpha = 0;
518 EdEffectCt = 0;
519 CursorVibeCnt = 0;
520 EdMenuEffectFlag = ED_MENU_ICON_STILL;
521 EdMenuEffectCt = 0;
522 ItemVolumeStep.CheckItemVolume();
523
524 if (start_at_atora != 0) {
525 EdMenuTextureReadEndFlag = 1;
526 EdMenuRGB = 0x40;
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;
535 CommonMenuMes2.edge_alpha = 0x80;
536 CommonMenuMes3.edge_alpha = 0x80;
537 return;
538 }
539
540 CommonMenuMes2.edge_alpha = 0;
541 CommonMenuMes3.edge_alpha = 0;
542 EdCur.selection = 0;
543 EditSwitch = EDIT_MENU_START;
544 EdMenuRGB = 0x80;
545 WindowPos[1] = 325.0f;
546 GetMainMenuRightHelpWinLangOffset(WindowPos[0], WindowPos[1], EditMenuWinW, EditMenuWinH);
547 EdCur.x = 48.0f;
548 EdCur.y = 76.0f;
549 s16 start_x[6] = {-0xC0, -0xB0, -0xA0, -0x90, -0x80, -0x80};
550
551 for (int i = 0; i < GetEditMenuMax(); i++) {
552 MenuIconPos[i][0] = start_x[i];
553 MenuIconPos[i][1] = i * 40 + 0x4A;
554 }
555}
556
564static void EditMenuExit() {
565 int blocks[5] = {0, 0, 0, 0, -1};
566
567 blocks[0] = EdMenuTextureBlock;
568 blocks[1] = EdMenuExTextureBlock;
569 blocks[2] = EdMenuExTextureBlock1;
570 blocks[3] = EdMenuExTextureBlock2;
571 MenuTextureDelete(blocks);
572 TexManager.CleanUpTextureList();
573 GamePad.AutoRepeatOff();
574 GamePad.MenuModeOff();
575}
576
585static int GetDrawHelpWindow(int draw) {
586 if ((EditSwitch == EDIT_MENU_ATORA_IN || EditSwitch == EDIT_MENU_ATORA || EditSwitch == EDIT_MENU_ATORA_OUT) && GetMenuAtraEventFlag()) {
587 draw = false;
588 }
589
590 return draw;
591}
592
593int EditMenuLoop() {
594 int result;
595
596 ReadBG();
597 result = 0;
598
599 switch (EditSwitch) {
600 case EDIT_MENU_SELECT:
601 result = EditMenuSelect();
602 break;
603 case EDIT_MENU_ANALYZE_IN:
604 ToAnalyzeEdit();
605 break;
606 case EDIT_MENU_ATORA_MOVE:
607 result = AtoraMove();
608 break;
609 case EDIT_MENU_ANALYZE:
610 result = AnalyzeEdit();
611 break;
612 case EDIT_MENU_ATORA:
613 case EDIT_MENU_ATORA_IN:
614 case EDIT_MENU_ATORA_OUT:
615 result = AtoraSelect();
616 break;
617 case EDIT_MENU_ANALYZE_OUT:
618 FromAnalyzeEdit();
619 break;
620 case EDIT_MENU_SAVE:
621 case EDIT_MENU_SAVE_IN:
622 case EDIT_MENU_SAVE_OUT:
623 EditSaveKey();
624 break;
625 case EDIT_MENU_OPTION:
626 case EDIT_MENU_OPTION_IN:
627 case EDIT_MENU_OPTION_OUT:
628 EdOptionSelect();
629 break;
630 case EDIT_MENU_MANUAL:
631 case EDIT_MENU_MANUAL_IN:
632 case EDIT_MENU_MANUAL_OUT:
633 EdMenuManualKey();
634 break;
635 case EDIT_MENU_EXIT:
636 result = EditMenuToExit();
637 break;
638 }
639
640 EditMenuDraw();
641 return result;
642}
643
644void EditMenuDraw() {
645 int text_x;
646 int text_y;
647
648 MenuTextureReload(EdMenuTextureBlock);
649 setbilinear(0);
650 FrameImageDraw(EdMenuRGB, 0x80);
651
652 switch (EditSwitch) {
653 case EDIT_MENU_START:
654 EditMenuStart();
655 break;
656 case EDIT_MENU_SELECT:
657 EditMenuSelectDraw();
658 break;
659 case EDIT_MENU_ANALYZE_IN:
660 ToAnalyzeEditDraw();
661 break;
662 case EDIT_MENU_ATORA_MOVE:
663 AtoraMoveDraw();
664 break;
665 case EDIT_MENU_ANALYZE:
666 AnalyzeEditDraw();
667 break;
668 case EDIT_MENU_ANALYZE_OUT:
669 FromAnalyzeEditDraw();
670 break;
671 case EDIT_MENU_ATORA:
672 case EDIT_MENU_ATORA_IN:
673 case EDIT_MENU_ATORA_OUT:
674 AtoraSelectDraw();
675 break;
676 case EDIT_MENU_SAVE:
677 case EDIT_MENU_SAVE_IN:
678 case EDIT_MENU_SAVE_OUT:
679 EditSaveDraw();
680 break;
681 case EDIT_MENU_OPTION:
682 case EDIT_MENU_OPTION_IN:
683 case EDIT_MENU_OPTION_OUT:
684 OptionDraw();
685 break;
686 case EDIT_MENU_MANUAL:
687 case EDIT_MENU_MANUAL_IN:
688 case EDIT_MENU_MANUAL_OUT:
689 EdMenuManualDraw();
690 break;
691 case EDIT_MENU_EXIT:
692 EditMenuToExitDraw();
693 break;
694 }
695
696 CursorVibeCnt++;
697
698 if (CursorVibeCnt >= 1080000000) {
699 CursorVibeCnt = 0;
700 }
701
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);
707
708 if (EdMenuTextureReadEndFlag != 0) {
709 switch (EditSwitch) {
710 case EDIT_MENU_EXIT:
711 EdMenuHelpWinAlpha -= 8;
712
713 if (EdMenuHelpWinAlpha < 0) {
714 EdMenuHelpWinAlpha = 0;
715 }
716
717 CommonMenuMes2.edge_alpha = EdMenuHelpWinAlpha;
718 break;
719 default:
720 EdMenuHelpWinAlpha += 8;
721
722 if (EdMenuHelpWinAlpha > 0x80) {
723 EdMenuHelpWinAlpha = 0x80;
724 }
725
726 CommonMenuMes2.edge_alpha += 8;
727
728 if (CommonMenuMes2.edge_alpha > 0x80) {
729 CommonMenuMes2.edge_alpha = 0x80;
730 }
731
732 break;
733 }
734
735 if (GetDrawHelpWindow(MakeWin2Flag) != 0) {
736 MenuHelpWinDraw((int) WindowPos[0], (int) WindowPos[1], EditMenuWinW, EditMenuWinH, EdMenuHelpWinAlpha);
737
738 if (EdMenuMesMake2 != 0) {
739 EdMenuMesMake2 = CommonMenuMes2.MakeMesWin(EdMenuMesNo2);
740 }
741
742 CommonMenuMes2.Step();
743 CommonMenuMes2.DrawMesWin();
744 }
745 }
746
747 setbilinear(1);
748}
749
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};
755 int brightness;
756 int x_offset;
757 int y_offset;
758 int i;
759 int icon;
760
761 if (icon_max == 5) {
762 for (int i = 0; i < icon_max; i++) {
763 x[i] = five[i];
764 }
765 }
766
767 if (icon_max == 6) {
768 for (int i = 0; i < icon_max; i++) {
769 x[i] = six[i];
770 }
771 }
772
773 for (int i = 0; i < icon_max; i++) {
774 MenuIconPos[i][0] += ((float) x[i] - MenuIconPos[i][0]) / 4.0f;
775 }
776
777 if (EdMenuRGB > 0x40) {
778 EdMenuRGB -= 4;
779 }
780
781 brightness = EdEffectCt * 7;
782
783 if (brightness > 0x80) {
784 brightness = 0x80;
785 }
786
787 for (i = 0; i < GetEditMenuMax(); i++) {
788 y_offset = 0;
789 x_offset = 0;
790 icon = EditMenuIconID[i];
791 GetMenuIconInfo(icon);
792 int selected = 0;
793
794 if (i == EdCur.selection) {
795 x_offset = 8;
796 y_offset = 2;
797 brightness = 0x80;
798 selected = 1;
799 }
800
801 DrawMainMenuIcon((int) (MenuIconPos[i][0] - x_offset), (int) (MenuIconPos[i][1] - y_offset), icon, selected, 0x80, brightness);
802 }
803
804 if (ReadBGSync() == 0 && EdMenuTextureReadEndFlag == 0) {
805 LOADTEXTURE_INFO2 textures[3] = {{"#frame_menuemenu#640#" SCREEN_HEIGHT_STR "#4"}};
806 textures[1].block_no = textures[0].block_no = EdMenuTextureBlock;
807 BG_READ_INFO *file = GetReadBGFile(0);
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;
825 }
826
827 EdEffectCt++;
828
829 if (EdEffectCt >= 17 && EdMenuTextureReadEndFlag != 0) {
830 EditSwitch = EDIT_MENU_SELECT;
831 EdCur.selection = 0;
832 EdEffectCt = 0;
833 }
834
835 return 0;
836}
837
841static void EditMenuSelectDraw() {
842 DrawMoveMenuIcon();
843
844 int icon_max = GetEditMenuMax();
845 s8 selection = EdCur.selection;
846 float slot = selection;
847 float x = 48.0f + 16.0f * slot;
848
849 if (icon_max == 6) {
850 if (selection == icon_max - 2) {
851 x -= 16.0f;
852 }
853
854 if (selection == icon_max - 1) {
855 x -= 48.0f;
856 }
857 }
858
859 if (icon_max == 5 && selection == icon_max - 1) {
860 x -= 32.0f;
861 }
862
863 float y = 76.0f + 40.0f * selection;
864
865 EdCur.x += (x - EdCur.x) / 4.0f;
866 EdCur.y += (y - EdCur.y) / 3.0f;
867
868 MENU_ICON_INFO *info = GetMenuIconInfo(EditMenuIconID[EdCur.selection]);
869 int width = info->label_width + 0x4A;
870 DrawMenuWaku(x + 18.0f, y - 15.0f, width, 0x28, 0, StayTex, 0x80);
871 DrawMenuObjectVibe((int) EdCur.x, (int) EdCur.y, 1, 0x40);
872
873 CommonMenuMes2.stay_frame = false;
874
875 if (CommonMenuMes2.mes_made != info->help_mes_no) {
876 CommonMenuMes2.MakeMesWin(info->help_mes_no);
877 }
878}
879
880static int EditMenuSelect() {
881 int icon_max = GetEditMenuMax();
882 int previous = EdCur.selection;
883
884 if (GamePad.Down(PAD_UP | PAD_LEFT) != 0) {
885 EdCur.selection--;
886
887 if (EdCur.selection < 0) {
888 EdCur.selection = icon_max - 1;
889 }
890 }
891
892 if (GamePad.Down(PAD_RIGHT | PAD_DOWN) != 0) {
893 EdCur.selection++;
894
895 if (icon_max - 1 <= EdCur.selection - 1) {
896 EdCur.selection = 0;
897 }
898 }
899
900 if (previous != EdCur.selection) {
901 ComMenuSePlay(MENU_SOUND_CURSOR);
902 }
903
904 if (GamePad.Down(PAD_CIRCLE) != 0) {
905 ComMenuSePlay(MENU_SOUND_REFUSE);
906 EditSwitch = EDIT_MENU_EXIT;
907 EdEffectCt = 0;
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};
910 EditSwitch = next[EdCur.selection];
911 ComMenuSePlay(MENU_SOUND_CONFIRM);
912 EdEffectCt = 0;
913 CommonMenuMes2.mes_made = -1;
914 u_long128 *work = EdMenuWorkBuf;
915
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);
922
923 if (area < 0 || area > 4) {
924 area = 0;
925 }
926
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;
931 EdMenuEffectCt = 0;
932 EdMenuMesMake2 = 1;
933 break;
934 }
935 case EDIT_MENU_ATORA_MOVE_IN:
936 EditSwitch = EDIT_MENU_ATORA_MOVE;
937 break;
938 case EDIT_MENU_ANALYZE_IN:
939 CommonMenuAtoraInfo = &EditPartsInfo;
940
941 if (CommonMenuAtoraInfo == NULL) {
942 CommonMenuAtoraInfo->Load(0, SaveData, 1);
943 }
944
945 EdEffectCt = 1;
946
947 for (int i = 0; i < 3; i++) {
948 AnalyzeFill[i] = 0.0f;
949 }
950
951 ButtonAdd = 0;
952 AnalyzeBackBlockCnt = 0;
953 AnalyzeSelect = 0;
954 MakeWin2Flag = 0;
955 break;
956 case EDIT_MENU_SAVE_IN:
957 MakeWin2Flag = 0;
958 EdMenuEffectFlag = ED_MENU_ICON_MOVE_FROM;
959 EdMenuMesMake2 = 1;
960 InitMenuSave(SAVE_MENU_MODE_SAVE, EdMenuExTextureBlock, work);
961 break;
962 case EDIT_MENU_OPTION_IN:
963 EdMenuMesMake2 = 1;
964 EdMenuEffectFlag = ED_MENU_ICON_MOVE_FROM;
965 InitMenuOption(OPTION_OPEN_GAME_MENU, EdMenuExTextureBlock, work);
966 break;
967 case EDIT_MENU_MANUAL_IN: {
968 MakeWin2Flag = 0;
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);
975 break;
976 }
977 }
978 }
979
980 return 0;
981}
982
983static void EditMenuToExitDraw() {
984 DrawMoveMenuIcon();
985}
986
990static int EditMenuToExit() {
991 EdMenuRGB += 3;
992
993 if (EdMenuRGB > 0x80) {
994 EdMenuRGB = 0x80;
995 }
996
997 CommonMenuMes2.edge_alpha -= 9;
998
999 if (CommonMenuMes2.edge_alpha < 0) {
1000 CommonMenuMes2.edge_alpha = 0;
1001 }
1002
1003 CommonMenuMes3.edge_alpha -= 9;
1004
1005 if (CommonMenuMes3.edge_alpha < 0) {
1006 CommonMenuMes3.edge_alpha = 0;
1007 }
1008
1009 for (int i = 0; i < GetEditMenuMax(); i++) {
1010 MenuIconPos[i][0] += (-220.0f - MenuIconPos[i][0]) / 4.0f;
1011 }
1012
1013 EdEffectCt++;
1014
1015 if (EdEffectCt > 0x15) {
1016 EdEffectCt = 0;
1017 EditMenuStatus.mode = EDIT_MENU_MODE_CLOSED;
1018 EditMenuStatus.parts = -1;
1019 EditMenuExit();
1020 return 1;
1021 }
1022
1023 return 0;
1024}
1025
1029static void AtoraSelectDraw() {
1030 if (EdMenuTextureReadEndFlag == 0 && ReadBGSync() == 0) {
1031 EdMenuTextureReadEndFlag = 1;
1032 }
1033
1034 DrawMenuAtoraSelect();
1035
1036 switch (EdMenuEffectFlag) {
1037 case ED_MENU_ICON_MOVE_FROM:
1038 case ED_MENU_ICON_MOVE_TO:
1039 DrawMoveMenuIcon();
1040 break;
1041 default:
1042 if (GetMenuAtraEventFlag() == 0) {
1043 DrawMoveMenuIcon();
1044 }
1045
1046 break;
1047 }
1048}
1049
1053static int AtoraSelect() {
1054 int result = 0;
1055
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;
1062 }
1063
1064 break;
1065 case ED_MENU_ICON_MOVE_TO:
1066 if (CalMoveToMenuIcon()) {
1067 EditSwitch = EDIT_MENU_SELECT;
1068 EdCur.selection = 0;
1069 EdCur.x = EdCur.selection * 16 + 0x30;
1070 EdCur.y = EdCur.selection * 40 + 0x4C;
1071 }
1072
1073 break;
1074 default:
1075 switch (MenuAtoraSelectKey()) {
1076 case ATORA_SELECT_PLACE_EXIT:
1077 case ATORA_SELECT_PLACE:
1078 result = 1;
1079 break;
1080 case ATORA_SELECT_CLOSE:
1081 EditSwitch = EDIT_MENU_ATORA_OUT;
1082 EdMenuEffectFlag = ED_MENU_ICON_MOVE_TO;
1083 EdMenuEffectCt = 0.0f;
1084 break;
1085 case ATORA_SELECT_NONE:
1086 break;
1087 }
1088
1089 break;
1090 }
1091
1092 if (EdMenuEffectFlag != ED_MENU_ICON_STILL) {
1093 EdMenuEffectCt += 1.0f;
1094 EdEffectCt++;
1095 } else {
1096 EdMenuEffectCt = 0.0f;
1097 EdEffectCt = 0;
1098 }
1099
1100 return result;
1101}
1102
1103static void AtoraMoveDraw() {}
1104
1108static int AtoraMove() {
1109 EditMenuExit();
1110 EditMenuStatus.mode = EDIT_MENU_MODE_MOVE;
1111 return 1;
1112}
1113
1117static void AnalyzeBackDraw(int alpha, int brightness) {
1118 AnalyzeBackBlockCnt++;
1119
1120 if (AnalyzeBackBlockCnt >= 0x10E) {
1121 AnalyzeBackBlockCnt = 0;
1122 }
1123
1124 int x = AnalyzeBackBlockCnt / 5 - 0x36;
1125 int y = 0x3C;
1126
1127 for (int column = 0; column < 0xD; column++, x += 0x36, y = 0x3C) {
1128 for (int row = 0; row < 5; row++, y += 0x36) {
1129 int bottom = 0x36;
1130 int top = 0;
1131
1132 if (y < 0x50) {
1133 top = 0x50 - y;
1134 }
1135
1136#ifdef PAL
1137 if (y + 0x36 > 0x130) {
1138#else
1139 if (y + 0x36 > 0x11C) {
1140#endif
1141#ifdef PAL
1142 bottom = 0x130 - y;
1143#else
1144 bottom = 0x11C - y;
1145#endif
1146 }
1147
1148 DrawMenu2DSprite(AnaBar, CRect_i_(x, y + top, 0x36, bottom - top), CRect_i_(0x36, top, 0x36, bottom - top), brightness, brightness, brightness, alpha);
1149 }
1150 }
1151}
1152
1156static float AnalyzeRequestPer() {
1157 CEditPartsInfo *info = CommonMenuAtoraInfo;
1158 float total = (float) info->parts_max;
1159
1160 if (total < 1.0f) {
1161 return 100.0f;
1162 }
1163
1164 float done = 0.0f;
1165
1166 for (int i = 0; i < 24; i++) {
1167 if (info->request[i] != 0) {
1168 done += 1.0f;
1169 }
1170 }
1171
1172 float percent = 100.0f * done / total;
1173
1174 if (percent >= 100.0f) {
1175 percent = 100.0f;
1176 }
1177
1178 return percent;
1179}
1180
1188static int AnalyzeBarDraw() {
1189 float parts_total;
1190 float parts_complete;
1191 float elements_total;
1192 int elements_done;
1193 int parts_done;
1194 int bars_started;
1195 int x;
1196 int i;
1197 int top;
1198 int digit_x;
1199 int digits;
1200 int number;
1201 float goal;
1202 float edge;
1203 float fill;
1204 float percent[3];
1205 float target[3];
1206
1207 elements_total = parts_complete = parts_total = 0.0f;
1208 elements_done = 0;
1209 parts_done = 0;
1210
1211 for (i = 0; i < 24; i++) {
1212 EDITPARTS_INFO *info = CommonMenuAtoraInfo->GetPartsInfo(i);
1213
1214 if (info != NULL && info->stock > 0) {
1215 parts_total += 1.0f;
1216
1217 if (info->obtained != 0) {
1218 parts_done++;
1219
1220 if (CommonMenuAtoraInfo->CheckComplete(i) != 0) {
1221 parts_complete += 1.0f;
1222 }
1223 }
1224
1225 for (int j = 0; j < 6; j++) {
1226 if (info->elements[j].id < 0) {
1227 break;
1228 }
1229
1230 elements_total += 1.0f;
1231
1232 if (info->elements[j].enabled != 0) {
1233 elements_done++;
1234 }
1235 }
1236 }
1237 }
1238
1239 s16 *elements = (s16 *) SaveData->GetElemData(NowEditMap);
1240
1241 for (i = 0; i < 128; i++) {
1242 if (elements[i] > -1) {
1243 elements_done++;
1244 }
1245 }
1246
1247 int total = (int) (parts_total + elements_total);
1248
1249 if (total <= 0) {
1250 percent[0] = 0.0f;
1251 } else {
1252 percent[0] = 100.0f * (float) (parts_done + elements_done) / (float) total;
1253 }
1254
1255 if ((int) parts_total <= 0) {
1256 percent[1] = 0.0f;
1257 } else {
1258 percent[1] = 100.0f * parts_complete / parts_total;
1259 }
1260
1261 percent[2] = AnalyzeRequestPer();
1262
1263 for (i = 0; i < 3; i++) {
1264 target[i] = 144.0f * percent[i] / 100.0f;
1265
1266 if (!(target[i] <= 144.0f)) {
1267 target[i] = 144.0f;
1268 }
1269 }
1270
1271 bars_started = 0;
1272 x = -0x3D;
1273
1274 for (i = 0; i < 3; i++) {
1275 x += 0xB5;
1276
1277 if (i != bars_started) {
1278 break;
1279 }
1280
1281 AnalyzeFill[i] += 2.0f + 2.0f * ButtonAdd;
1282 goal = target[i];
1283
1284 if (goal < AnalyzeFill[i]) {
1285 AnalyzeFill[i] = goal;
1286 }
1287
1288 fill = AnalyzeFill[i];
1289 edge = 0.08f * fill;
1290
1291 if (8.0f < edge) {
1292 edge = 8.0f;
1293 }
1294
1295#ifdef PAL
1296 top = (int) (306.0f - fill);
1297#else
1298 top = (int) (286.0f - fill);
1299#endif
1300 CRect_i_ bar_destination;
1301 CRect_i_ bar_source;
1302 bar_source.x = 0;
1303 bar_source.y = i * 16 + 8;
1304 bar_source.width = 0x36;
1305 bar_source.height = 7;
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];
1314
1315 if (!(AnalyzeFill[i] <= 0.0f)) {
1316#ifdef PAL
1317 DrawMenu2DSprite(AnaBar, CRect_i_(x + 0x36, (int) (top + edge), 10, (int) ((float) (0x130 - top) - edge)), CRect_i_(0x56, 0x36, 10, 9), 0x80);
1318#else
1319 DrawMenu2DSprite(AnaBar, CRect_i_(x + 0x36, (int) (top + edge), 10, (int) ((float) (0x11C - top) - edge)), CRect_i_(0x56, 0x36, 10, 9), 0x80);
1320#endif
1321 }
1322
1323 number = (int) (100.0f * AnalyzeFill[i] / 144.0f);
1324
1325 if (percent[i] < (float) number) {
1326 number = (int) percent[i];
1327 }
1328
1329 digit_x = x + 0x1B;
1330
1331 for (digits = GetNumberKeta(number); digits != 0; digits--, digit_x -= 13) {
1332 int digit = number % 10;
1333 int u = digit * 13;
1334 int v = 0x6F;
1335
1336 if (digit > 8) {
1337 u = 0;
1338 v = 0x5E;
1339 }
1340
1341 DrawMenu2DSprite(AnaBar, CRect_i_(digit_x, top - 0x1E, 0x10, 0x18), CRect_i_(u, v, 13, 0x11), 0x8C);
1342 number /= 10;
1343 }
1344
1345 DrawMenu2DSprite(AnaBar, CRect_i_(x + 0x28, top - 0x1E, 0xF, 0x13), CRect_i_(13, 0x5E, 13, 0x11), 0x80);
1346
1347 if (0.4f * goal <= AnalyzeFill[i]) {
1348 bars_started++;
1349 }
1350 }
1351
1352 if (AnalyzeFill[2] == target[2]) {
1353 return 1;
1354 }
1355
1356 return 0;
1357}
1358
1359static void ToAnalyzeEditDraw() {
1360 MenuTextureReload(EdMenuTextureBlock);
1361
1362 for (int i = 0; i < 3; i++) {
1363#ifdef PAL
1364 DrawMenu2DSprite(Analyze, CRect_i_(i * 0xB5 + 0x56, 0x14a, 0x7E, 0x50), CRect_i_(0x80, i * 0x50, 0x7E, 0x50), 0x80);
1365#else
1366 DrawMenu2DSprite(Analyze, CRect_i_(i * 0xB5 + 0x56, 0x136, 0x7E, 0x50), CRect_i_(0x80, i * 0x50, 0x7E, 0x50), 0x80);
1367#endif
1368 }
1369
1370 float left = (float) (0x280 - EdEffectCt * 16);
1371 int width = (int) (80.0f + left);
1372
1373 if (left < 0.0f) {
1374 left = 0.0f;
1375 }
1376
1377 width = (int) ((float) width - left);
1378
1379 if (width < 0) {
1380 width = 0;
1381 }
1382
1383 FadeTexX((int) left, width, 0x280, 0, "frame_image", 0);
1384 DrawMoveMenuIcon();
1385 int alpha = EdEffectCt * 4;
1386
1387 if (alpha > 0x80) {
1388 alpha = 0x80;
1389 }
1390
1391 int brightness = EdEffectCt + 16;
1392
1393 if (brightness > 0x40) {
1394 brightness = 0x40;
1395 }
1396
1397 AnalyzeBackDraw(alpha, brightness);
1398 int done = 0;
1399 float bar = (float) (EdEffectCt * 20);
1400
1401 if (640.0f < bar) {
1402 bar = 640.0f;
1403 }
1404
1405 if (560.0f < bar) {
1406 done = AnalyzeBarDraw();
1407 }
1408
1409 if (640.0f < bar) {
1410 bar = 640.0f;
1411 }
1412
1413#ifdef PAL
1414 DrawMenu2DSprite(AnaBar, CRect_i_(0, 0x130, (int) bar, 0x18), CRect_i_(0, 0x36, 0x20, 0x18), 0x80);
1415
1416#else
1417 DrawMenu2DSprite(AnaBar, CRect_i_(0, 0x11C, (int) bar, 0x18), CRect_i_(0, 0x36, 0x20, 0x18), 0x80);
1418
1419#endif
1420 for (int x = 0x75; (float) x < bar; x += 0xB5) {
1421 int segment_width = (int) (bar - (float) x);
1422
1423 if (segment_width > 0x3C) {
1424 segment_width = 0x3C;
1425 }
1426
1427#ifdef PAL
1428 DrawMenu2DSprite(AnaBar, CRect_i_(x, 0x130, segment_width, 0xF), CRect_i_(0x20, 0x36, 0x36, 0xF), 0x80);
1429#else
1430 DrawMenu2DSprite(AnaBar, CRect_i_(x, 0x11C, segment_width, 0xF), CRect_i_(0x20, 0x36, 0x36, 0xF), 0x80);
1431#endif
1432 }
1433
1434 CalMoveFromMenuIcon();
1435 EdEffectCt++;
1436
1437 if (done == 1) {
1438 EdEffectCt = 0;
1439 AnalyzeSelect = 0;
1440 EditSwitch = EDIT_MENU_ANALYZE;
1441 }
1442}
1443
1444static void ToAnalyzeEdit() {
1445 if (GamePad.AllOn()) {
1446 ButtonAdd = 2;
1447 EdEffectCt += 4;
1448 }
1449}
1450
1454static void AnalyzeEditDraw() {
1455 DrawMenuIcon(2);
1456 AnalyzeBackDraw(0x80, 0x40);
1457
1458 for (int i = 0; i < 3; i++) {
1459#ifdef PAL
1460 DrawMenu2DSprite(Analyze, CRect_i_(i * 0xB5 + 0x56, 0x14a, 0x7E, 0x50), CRect_i_(0x80, i * 0x50, 0x7E, 0x50), 0x80);
1461#else
1462 DrawMenu2DSprite(Analyze, CRect_i_(i * 0xB5 + 0x56, 0x136, 0x7E, 0x50), CRect_i_(0x80, i * 0x50, 0x7E, 0x50), 0x80);
1463#endif
1464 }
1465
1466 AnalyzeBarDraw();
1467#ifdef PAL
1468 DrawMenu2DSprite(AnaBar, CRect_i_(0, 0x130, 0x280, 0x18), CRect_i_(0, 0x36, 0x20, 0x18), 0x80);
1469#else
1470 DrawMenu2DSprite(AnaBar, CRect_i_(0, 0x11C, 0x280, 0x18), CRect_i_(0, 0x36, 0x20, 0x18), 0x80);
1471#endif
1472
1473 int x = 0x75;
1474 int i = 0;
1475
1476 while (x < 0x280) {
1477 int width = 0x280 - x;
1478
1479 if (width > 0x3C) {
1480 width = 0x3C;
1481 }
1482
1483 if (AnalyzeFill[i] > 0.0f) {
1484#ifdef PAL
1485 DrawMenu2DSprite(AnaBar, CRect_i_(x, 0x130, width, 0xF), CRect_i_(0x20, 0x36, 0x36, 0xF), 0x80);
1486#else
1487 DrawMenu2DSprite(AnaBar, CRect_i_(x, 0x11C, width, 0xF), CRect_i_(0x20, 0x36, 0x36, 0xF), 0x80);
1488#endif
1489 }
1490
1491 i++;
1492 x += 0xB5;
1493 }
1494}
1495
1496static int AnalyzeEdit() {
1497 if (GamePad.Down(PAD_CIRCLE | PAD_CROSS)) {
1498 ComMenuSePlay(MENU_SOUND_REFUSE);
1499 EditSwitch = EDIT_MENU_ANALYZE_OUT;
1500 AnalyzeSelect = 2;
1501 }
1502
1503 return 0;
1504}
1505
1506static void FromAnalyzeEditDraw() {
1507 int alpha;
1508
1509 DrawMoveMenuIcon();
1510 alpha = 0x80 - EdEffectCt * 10;
1511
1512 if (alpha < 0) {
1513 alpha = 0;
1514 }
1515
1516 AnalyzeBackDraw(alpha, 0x40);
1517}
1518
1522static void FromAnalyzeEdit() {
1523 CalMoveToMenuIcon();
1524 EdEffectCt++;
1525
1526 if (EdEffectCt >= 0x10) {
1527 EdEffectCt = 0;
1528 MakeWin2Flag = 1;
1529 EdCur.selection = 2;
1530 EdCur.x = EdCur.selection * 16 + 0x30;
1531 EdCur.y = EdCur.selection * 40 + 0x4C;
1532 EditSwitch = EDIT_MENU_SELECT;
1533 }
1534}
1535
1539static void EditSaveDraw() {
1540 DrawMenuSave("frame_image");
1541 setbilinear(0);
1542
1543 switch (EdMenuEffectFlag) {
1544 case ED_MENU_ICON_MOVE_FROM:
1545 case ED_MENU_ICON_MOVE_TO:
1546 DrawMoveMenuIcon();
1547 break;
1548 default:
1549 DrawMenuIcon(3);
1550 break;
1551 }
1552}
1553
1554static void EditSaveKey() {
1555 int arrived;
1556
1557 switch (EdMenuEffectFlag) {
1558 case ED_MENU_ICON_MOVE_FROM:
1559 arrived = CalMoveFromMenuIcon();
1560
1561 if (arrived) {
1562 EdMenuEffectFlag = ED_MENU_ICON_STILL;
1563 EdMenuEffectCt = 0.0f;
1564 }
1565
1566 break;
1567 case ED_MENU_ICON_MOVE_TO:
1568 arrived = CalMoveToMenuIcon();
1569 break;
1570 }
1571
1572 if (EdMenuEffectFlag != ED_MENU_ICON_STILL) {
1573 EdMenuEffectCt += 1.0f;
1574 } else {
1575 EdMenuEffectCt = 0.0f;
1576 }
1577
1578 MenuSaveKey();
1579
1580 if (SaveMenuEffectFadeOut()) {
1581 EdMenuEffectFlag = ED_MENU_ICON_MOVE_TO;
1582
1583 if (arrived) {
1584 EdEffectCt = 0;
1585 EditSwitch = EDIT_MENU_SELECT;
1586 MakeWin2Flag = 1;
1587 }
1588 }
1589}
1590
1594static void OptionDraw() {
1595 DrawMenuOption();
1596 setbilinear(0);
1597
1598 switch (EdMenuEffectFlag) {
1599 case ED_MENU_ICON_MOVE_FROM:
1600 case ED_MENU_ICON_MOVE_TO:
1601 DrawMoveMenuIcon();
1602 break;
1603 default:
1604 DrawMenuIcon(4);
1605 break;
1606 }
1607}
1608
1609static void EdOptionSelect() {
1610 int arrived = false;
1611 int key;
1612
1613 switch (EdMenuEffectFlag) {
1614 case ED_MENU_ICON_MOVE_FROM:
1615 arrived = CalMoveFromMenuIcon();
1616
1617 if (arrived) {
1618 EdMenuEffectFlag = ED_MENU_ICON_STILL;
1619 EdMenuEffectCt = 0.0f;
1620 }
1621
1622 break;
1623 case ED_MENU_ICON_MOVE_TO:
1624 arrived = CalMoveToMenuIcon();
1625 break;
1626 }
1627
1628 if (EdMenuEffectFlag != ED_MENU_ICON_STILL) {
1629 EdMenuEffectCt += 1.0f;
1630 } else {
1631 EdMenuEffectCt = 0.0f;
1632 }
1633
1634 key = MenuOptionKey();
1635
1636 if (OptionMenuFadeOutStart()) {
1637 EdMenuEffectFlag = ED_MENU_ICON_MOVE_TO;
1638
1639 if (arrived && key) {
1640 EdEffectCt = 0;
1641 EditSwitch = EDIT_MENU_SELECT;
1642 MakeWin2Flag = 1;
1643 }
1644 }
1645}
1646
1647static int EdMenuManualKey() {
1648 int arrived = false;
1649 int key;
1650
1651 switch (EdMenuEffectFlag) {
1652 case ED_MENU_ICON_MOVE_FROM:
1653 arrived = CalMoveFromMenuIcon();
1654
1655 if (arrived) {
1656 EdMenuEffectFlag = ED_MENU_ICON_STILL;
1657 EdMenuEffectCt = 0.0f;
1658 }
1659
1660 break;
1661 case ED_MENU_ICON_MOVE_TO:
1662 arrived = CalMoveToMenuIcon();
1663 break;
1664 }
1665
1666 if (EdMenuEffectFlag != ED_MENU_ICON_STILL) {
1667 EdMenuEffectCt += 1.0f;
1668 } else {
1669 EdMenuEffectCt = 0.0f;
1670 }
1671
1672 key = MenuManualKey();
1673
1674 if (GetNowManualMenuMode() == MANUAL_MODE_CLOSING) {
1675 EdMenuEffectFlag = ED_MENU_ICON_MOVE_TO;
1676
1677 if (arrived && key) {
1678 EdEffectCt = 0;
1679 EditSwitch = EDIT_MENU_SELECT;
1680 MakeWin2Flag = 1;
1681 }
1682 }
1683
1684 return 0;
1685}
1686
1690static void EdMenuManualDraw() {
1691 MenuManualDraw();
1692 setbilinear(0);
1693
1694 switch (EdMenuEffectFlag) {
1695 case ED_MENU_ICON_MOVE_FROM:
1696 case ED_MENU_ICON_MOVE_TO:
1697 DrawMoveMenuIcon();
1698 break;
1699 default:
1700 DrawMenuIcon(5);
1701 break;
1702 }
1703}
int CheckComplete(int index)
EDITPARTS_INFO * GetPartsInfo(int index)
void Load(int georama_no, CSaveData *save_data, int load_requests)
int AllOn()
Definition gamepad.cpp:465
int Down(int mask)
Definition gamepad.cpp:583
void MenuModeOff()
Definition gamepad.cpp:617
void MenuModeOn(int threshold)
Definition gamepad.cpp:613
void SetAutoRepeat(int mask, int initial_delay, int repeat_delay)
Definition gamepad.cpp:485
void AutoRepeatOff()
Definition gamepad.cpp:609
void CheckItemVolume()
s32 x
Definition rect.hpp:18
s32 width
Definition rect.hpp:20
s32 height
Definition rect.hpp:21
s32 y
Definition rect.hpp:19
CDngStatusData * GetDngStatus()
Definition savedata.cpp:250
s16 * GetElemData(int georama_no)
Definition savedata.cpp:242
WEAPON_HAVE chara_weapons[6][11]
s32 text_y
Definition clsmes.hpp:152
s32 text_x
Definition clsmes.hpp:151
void DrawMesWin()
Definition clsmes.cpp:2619
void Step()
Definition clsmes.cpp:575
s32 mes_made
Definition clsmes.hpp:207
s32 tex_block
Definition clsmes.hpp:227
s32 stay_frame
Definition clsmes.hpp:189
s32 edge_alpha
Definition clsmes.hpp:213
int MakeMesWin(int mes_no)
Definition clsmes.cpp:1669
u_long128 * buffer
Definition dataread.hpp:29
EDITPARTS_ELEMENT elements[6]