1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
12#include "battle_globals.hpp"
15#include "eastking.hpp"
16#include "editatra.hpp"
17#include "editground.hpp"
18#include "editloop.hpp"
19#include "editmenu.hpp"
23#include "mainselect.hpp"
24#include "memorycardaccess.hpp"
25#include "menu_draw.hpp"
26#include "menu_inventory.hpp"
27#include "menu_save.hpp"
34#include "userstatus.hpp"
59 s32 prev_screen_pos[2];
116short *GetAtraMsgReadBuf;
122int AtoraTextureEnterFlag;
125int AtoraTextureBaseBlock;
128int AtoraTextureReadBlock;
131u_long128 *AtoraOffsetBuf;
142static void DrawAtoraSelect(
int fade);
152static int AtoraBoardKey();
162static int AtoraTipKey();
171static void AtoraMenuTipCancel();
180static void AtoraBoardFadeEffect();
190static int SaveMenuKeyFadeIn();
200static int SaveMenuKeyFadeOut();
210static int SaveMenuKeyModeSelect();
220static int SaveMenuKeyMcSelect();
230static int SaveMenuKeyCheckMcType();
240static int SaveMenuKeyCheckMc();
250static int SaveMenuKeyLoadConfig();
260static int SaveMenuKeyFileSelect();
263 if (!card->
present || card->
type != sceMcTypePS2) {
270void DrawObjectVibe(
int x,
int y,
CTexture *texture,
CRect_i_ src_rect,
unsigned char alpha,
int flag) {
271 float dest_x = (float) x + 7.0f * cosf(0.08055365830659866f * (
float) CursorVibeCnt);
272 float dest_y = (float) y + 5.0f * sinf(0.1163552850484848f * (
float) CursorVibeCnt);
274 DrawMenu2DSprite(texture, dest_rect, src_rect, alpha, alpha, alpha, flag);
277void DrawObjectVibe(
int x,
int y,
CTexture *texture,
RECT src_rect,
unsigned char alpha,
int flag) {
279 DrawObjectVibe(x, y, texture, src, alpha, flag);
285void DrawMenuObjectVibe(
int x,
int y,
int shadow,
int icon_u) {
286 CTexture *texture = TexManager.GetTexture(AtoraVibeTextureName, -1);
287 CRect_i_ src(icon_u, 0x28, 0x20, 0x20);
290 DrawObjectVibe(x + 5, y + 3, texture, src, 0, 100);
293 DrawObjectVibe(x, y, texture, src, 0x80, 0x80);
296void DrawMenuHelpWindow(
CTexture *texture,
int style,
int x,
int y,
float width,
float height,
int alpha) {
305 }
else if (style == 1) {
311 middle_width = 24.0f * width;
312 middle_height = 24.0f * height;
314 bottom_y = middle_y + middle_height;
316 if (texture == NULL) {
320 DrawMenu2DSprite(texture,
CRect_i_(x, y, 24, 24),
CRect_i_(corner_u, 0, 24, 24), alpha);
321 DrawMenu2DSprite(texture,
CRect_i_(x, middle_y, 24, middle_height),
CRect_i_(24, 24, 24, 24), alpha);
322 DrawMenu2DSprite(texture,
CRect_i_(x, bottom_y, 24, 24),
CRect_i_(24, 48, 24, 24), alpha);
324 DrawMenu2DSprite(texture,
CRect_i_(x, y, middle_width, 24),
CRect_i_(48, 0, 24, 24), alpha);
325 DrawMenu2DSprite(texture,
CRect_i_(x, middle_y, middle_width, middle_height),
CRect_i_(48, 24, 24, 24), alpha);
326 DrawMenu2DSprite(texture,
CRect_i_(x, bottom_y, middle_width, 24),
CRect_i_(48, 48, 24, 24), alpha);
328 DrawMenu2DSprite(texture,
CRect_i_(x, y, 24, 24),
CRect_i_(72, 0, 24, 24), alpha);
329 DrawMenu2DSprite(texture,
CRect_i_(x, middle_y, 24, middle_height),
CRect_i_(72, 24, 24, 24), alpha);
330 DrawMenu2DSprite(texture,
CRect_i_(x, bottom_y, 24, 24),
CRect_i_(72, 48, 24, 24), alpha);
333void MenuHelpWinDraw(
int x,
int y,
float width,
float height,
int alpha,
int u,
int v,
CTexture *texture) {
339 middle_width = width * 16.0f;
340 middle_height = height * 22.0f;
342 bottom_y = middle_y + middle_height;
344 if (texture == NULL) {
348 DrawMenu2DSprite(texture,
CRect_i_(x, y, 24, 22),
CRect_i_(u, v, 24, 22), (alpha * 100) >> 7);
349 DrawMenu2DSprite(texture,
CRect_i_(x, middle_y, 24, middle_height),
CRect_i_(u, v + 22, 24, 20), (alpha * 100) >> 7);
350 DrawMenu2DSprite(texture,
CRect_i_(x, bottom_y, 24, 22),
CRect_i_(u, v + 42, 24, 22), (alpha * 100) >> 7);
352 DrawMenu2DSprite(texture,
CRect_i_(x, y, middle_width, 22),
CRect_i_(u + 22, v, 16, 22), (alpha * 100) >> 7);
353 DrawMenu2DSprite(texture,
CRect_i_(x, middle_y, middle_width, middle_height),
CRect_i_(u + 22, v + 22, 16, 20), (alpha * 100) >> 7);
354 DrawMenu2DSprite(texture,
CRect_i_(x, bottom_y, middle_width, 22),
CRect_i_(u + 22, v + 42, 16, 22), (alpha * 100) >> 7);
356 DrawMenu2DSprite(texture,
CRect_i_(x, y, 24, 22),
CRect_i_(u + 38, v, 24, 22), (alpha * 100) >> 7);
357 DrawMenu2DSprite(texture,
CRect_i_(x, middle_y, 24, middle_height),
CRect_i_(u + 38, v + 22, 24, 20), (alpha * 100) >> 7);
358 DrawMenu2DSprite(texture,
CRect_i_(x, bottom_y, 24, 22),
CRect_i_(u + 38, v + 42, 24, 22), (alpha * 100) >> 7);
361void MenuHelpWinDraw2(
int x,
int y,
float width,
float height,
int alpha,
int u,
int v,
CTexture *texture) {
367 middle_width = width;
368 middle_height = height;
370 bottom_y = middle_y + middle_height;
372 if (texture == NULL) {
376 DrawMenu2DSprite(texture,
CRect_i_(x, y, 24, 22),
CRect_i_(u, v, 24, 22), (alpha * 100) >> 7);
377 DrawMenu2DSprite(texture,
CRect_i_(x, middle_y, 24, middle_height),
CRect_i_(u, v + 22, 24, 20), (alpha * 100) >> 7);
378 DrawMenu2DSprite(texture,
CRect_i_(x, bottom_y, 24, 22),
CRect_i_(u, v + 42, 24, 22), (alpha * 100) >> 7);
380 DrawMenu2DSprite(texture,
CRect_i_(x, y, middle_width, 22),
CRect_i_(u + 22, v, 16, 22), (alpha * 100) >> 7);
381 DrawMenu2DSprite(texture,
CRect_i_(x, middle_y, middle_width, middle_height),
CRect_i_(u + 22, v + 22, 16, 20), (alpha * 100) >> 7);
382 DrawMenu2DSprite(texture,
CRect_i_(x, bottom_y, middle_width, 22),
CRect_i_(u + 22, v + 42, 16, 22), (alpha * 100) >> 7);
384 DrawMenu2DSprite(texture,
CRect_i_(x, y, 24, 22),
CRect_i_(u + 38, v, 24, 22), (alpha * 100) >> 7);
385 DrawMenu2DSprite(texture,
CRect_i_(x, middle_y, 24, middle_height),
CRect_i_(u + 38, v + 22, 24, 20), (alpha * 100) >> 7);
386 DrawMenu2DSprite(texture,
CRect_i_(x, bottom_y, 24, 22),
CRect_i_(u + 38, v + 42, 24, 22), (alpha * 100) >> 7);
392void MenuHelpWinDraw(
int x,
int y,
float width,
float height,
int alpha) {
393 StayTex = TexManager.GetTexture(AtoraVibeTextureName, -1);
394 MenuHelpWinDraw(x, y, width, height, alpha, 0, 0, StayTex);
397void DrawMenuWaku(
float x,
float y,
int width,
int height,
int type,
CTexture *texture,
int alpha) {
405 if (texture != NULL) {
406 static int MenuWakuCnt = 0;
408 offset = 0.2f * MenuWakuCnt;
411 right = (x + width) - offset;
412 bottom = (y + height) - offset;
424 if (MenuWakuCnt < 0 || MenuWakuCnt >= 30) {
430int DrawMenuNumber(
int number,
int x,
int y,
CTexture *texture,
RECT rect,
int overlap,
int flag) {
431 return DrawMenuNumber(number, x, y, rect, texture, overlap, 0, SCREEN_HEIGHT, flag);
434int DrawMenuNumber(
int number,
int x,
int y,
RECT rect,
CTexture *texture,
int overlap,
unsigned char r,
unsigned char g,
unsigned char b,
int flag) {
445 if (texture == NULL) {
449 for (digits = GetNumberKeta(number); 0 < digits; digits--) {
453 x -= width - overlap;
454 src_x = rect.
x + width * digit;
457 MenuTextureClip(clip_y, src_y, height, 0, SCREEN_HEIGHT);
459 CRect_i_ src(src_x, src_y, width, height);
460 dest_height = height - 1;
465 dest.
height = dest_height;
466 DrawMenu2DSprite(texture, dest, src, r, g, b, flag);
473int DrawMenuNumber(
int number,
int x,
int y,
RECT rect,
CTexture *texture,
int overlap,
int top,
int bottom,
int flag) {
484 if (texture == NULL) {
488 for (digits = GetNumberKeta(number); 0 < digits; digits--) {
492 x -= width - overlap;
493 src_x = rect.
x + width * digit;
496 MenuTextureClip(clip_y, src_y, height, top, bottom);
498 CRect_i_ src(src_x, src_y, width, height);
499 dest_height = height - 1;
504 dest.
height = dest_height;
505 DrawMenu2DSprite(texture, dest, src, flag);
512int GetMsgLengthMenu(
ClsMes *mes,
int mes_no) {
520 if ((
unsigned int) (c + 0x100) <= 1U || code == NULL) {
538static CTexture *RetCTexAtora(
int tip_no,
int &x,
int &y) {
542 tex_no = GetEditAtraChipData(MenuAtoraSel.
map_no, tip_no)->
tex_no;
543 x = ((tex_no + 7) % 7) * 36;
544 y = (tex_no / 7) * 36;
548 }
else if (tip_no >= 40) {
555void DrawAtoraParts(
int x,
int y,
int tip_no,
int top,
int bottom,
int alpha) {
561 if (x < 340 || x > 600) {
565 if (y < 80 || y > 300) {
569 if (y < top - 35 || bottom <= y) {
577 texture = RetCTexAtora(tip_no, src_x, src_y);
579 if (texture == NULL) {
584 MenuTextureClip(y, src_y, height, top, bottom);
585 CRect_i_ src(src_x, src_y, 36, height);
586 CRect_i_ shadow(x + 2, y + 1, 36, height);
587 DrawMenu2DSprite(texture, shadow, src, 0, 0, 0, (alpha * 80) >> 7);
589 DrawMenu2DSprite(texture, dest, src, alpha);
607 while (parts != -1) {
610 if (index == count) {
627static int AtoraAllTipGet(
int parts_no) {
641 for (i = 0; i < 6; i++) {
644 if (element == NULL) {
648 if (0 <= element->
id && element->
enabled == 0) {
664static int AlreadyPeopleTalk(
int map_no,
int chip_no) {
669 if (npc == NULL || chip_no - 40 < 0) {
700 if (atra->
kind == 0) {
714 for (i = 0; i < 6; i++) {
717 if (element->
id >= 40) {
718 if (element->
npc_no >= 0) {
719 if (AlreadyPeopleTalk(MenuAtoraSel.
map_no, element->
id) == 0) {
733 if (complete && filled && talked && !done) {
748static int AtraBoardMaxNum(
int ground) {
752 if (ground < 0 || ground >= 6) {
756 parts = GetEditAtraPartsData(ground, 0);
762 for (count = 0; count < 40 && parts->
max > 0; count++) {
783 return ATORA_LINK_NONE;
792 if (link < 0 || info->elements[slot].enabled != 0) {
793 return ATORA_LINK_NONE;
796 if (link < 3 && slot >= 3) {
797 code = ATORA_LINK_ABOVE;
799 code = ATORA_LINK_BESIDE;
839static void AtoraTipRelationDraw(
int x,
int y,
EDITPARTS_INFO *info,
int slot,
int link,
int alpha) {
847 static int tipcurCnt = 0;
856 case ATORA_LINK_BESIDE:
861 case ATORA_LINK_ABOVE:
868 if (tipcurCnt % 460 > 200) {
874 if (link < 49 && link >= 20) {
878 if (link < 50 && link > 0) {
879 DrawMenu2DSprite(Sozai,
CRect_i_(x + dx, y + dy, 12, height),
CRect_i_(u, v, 12, height), alpha);
883 DrawMenu2DSprite(Sozai,
CRect_i_(x, y, 36, 35),
CRect_i_(220, 346, 36, 37), alpha);
888 if (tipcurCnt < 0 || tipcurCnt > 999999) {
910static void AtoraBoardEnableMovePos(
int parts_no,
int *enable) {
915 info = SearchAtoraInfo(parts_no);
918 for (
int j = 0; j < 6; j++) {
925 for (i = 0; i < 6; i++) {
958static int AtoraBoardGoToPos(
int *enable,
int pos,
int min) {
960 if (enable[pos] != 0) {
970int GetAtraMsgNo(
int map_no,
int element) {
973 if (element < 0 || element >= 100) {
977 mes_no = atra->
msg_no + (map_no * 200 + 1000);
985 mes_no += count + 0x1C;
1012static int AtoraMsgNoGet(
int map_no,
int board_pos,
int slot) {
1023 info = SearchAtoraInfo(board_pos);
1029 parts = GetEditAtraPartsData(map_no, info->
parts_no);
1031 if (parts == NULL) {
1042 msg_no = parts->
msg_no + map_no * 200;
1050 msg_no += flag + 28;
1060 attach = &elements[slot] - 1;
1061 chip = GetEditAtraChipData(map_no, attach->
id);
1063 msg_no = chip->
msg_no + (map_no * 200 + 40);
1065 if (attach->
id >= 40) {
1075 if ((link >= 0 && info->
elements[link].
enabled == 0) || AtraTipCanDisplay(shown) == 0) {
1093static int AtoraTipOnlyMsgNoGet(
int map_no,
int number) {
1097 chip = GetEditAtraChipData(map_no, number);
1103 msg_no = chip->
msg_no + 40;
1119static void AtoraTipGetTexPos(
int tip_no,
int &x,
int &y) {
1122 tex_no = GetEditAtraChipData(MenuAtoraSel.
map_no, tip_no)->
tex_no;
1127 }
else if (0 <= tex_no && tex_no < 40) {
1128 x = (tex_no % 7) * 36;
1129 y = (tex_no / 7) * 36;
1140static void AtoraTipObjectOrPerson(
int x,
int y,
int tip_no,
int dark,
int alpha) {
1143 CTexture *texture = RetCTexAtora(tip_no, u, v);
1145 int red, green, blue;
1146 blue = green = red = 0x80;
1154 DrawMenu2DSprite(texture,
CRect_i_(x, y, source.width, source.height - 1), source, red, green, blue, alpha);
1165static CTexture *AtoraTipHoleTexInfoGet(
int gold,
unsigned char *color) {
1187static void AtoraPlateDrawHaichiBar(
EDITPARTS_INFO *info,
int x,
int y,
int flag) {
1190 CRect_i_ src(244, 323 - empty, 12, empty);
1193 dest.
y = y + 107 - empty;
1196 DrawMenu2DSprite(Sozai, dest, src, flag);
1197 DrawAtraBuildNum(info, x, y, flag);
1200void DrawAtraBuildNum(
EDITPARTS_INFO *info,
int x,
int y,
int alpha) {
1201 RECT digit = {0, 212, 12, 12};
1212 if (info->
stock / 10 > 0) {
1218 num_x = DrawMenuNumber(info->
stock, num_x, y + 5, StayTex, digit, 1, alpha);
1219 DrawMenu2DSprite(StayTex,
CRect_i_(num_x - 10, y + 5, 12, 12),
CRect_i_(120, digit.
y, 12, 12), alpha);
1220 DrawMenuNumber(info->
stock - info->
placed, num_x - 7, y + 5, StayTex, digit, 1, alpha);
1223void DrawAtora(
int x,
int y,
int parts_index,
int alpha) {
1226 unsigned char colour[4];
1228 if (y < -100 || y > 0x1CC) {
1239 int complete = CommonMenuAtoraInfo->
CheckComplete(parts_index);
1240 int all_tips = AtoraAllTipGet(parts_index);
1241 int event = AtoraCompOrEvent(info);
1249 DrawMenu2DSprite(Sozai,
CRect_i_(x, y, 0x100, 0x78),
CRect_i_(0, v, 0x100, 0x79), alpha);
1251 if (0 < info->
stock && MenuAtoraSel.
map_no != 5) {
1252 AtoraPlateDrawHaichiBar(info, x, y, alpha);
1255 int picture_x = x + 0x20;
1256 int picture_y = y + 8;
1257 int draw_picture = 1;
1258 int tex_no = parts->
tex_no;
1259 u = (tex_no / 6) * 0x54 + 0x104;
1260 v = (tex_no + 6) % 6 * 0x54;
1262 if (MenuAtoraSel.
map_no == 5) {
1263 if (complete == 0) {
1266 picture_x = x + 0x14;
1267 picture_y = y + 0xC;
1271 if (draw_picture != 0) {
1272 DrawMenu2DSprite(Sozai,
CRect_i_(picture_x, picture_y, 0x54, 0x54),
CRect_i_(u, v, 0x54, 0x54), alpha);
1281 DrawMenu2DSprite(Sozai,
CRect_i_(x + 0x88, y - 1, 0x78, 0x5D),
CRect_i_(0, 0xF0, 0x78, 0x5C), alpha);
1282 DrawMenu2DSprite(Sozai,
CRect_i_(x + 0x88, y + 7, 0x64, 0x1C),
CRect_i_(0, 0x164, 0x64, 0x1C), alpha);
1283 }
else if (event == 0) {
1284 for (
int i = 0; i < 6; i++) {
1288 if (chip->
id >= 0) {
1289 int status = AtoraTipStatusSearch(info, i);
1291 if (AtraTipCanDisplay(chip) == 0) {
1292 status = ATORA_LINK_HIDDEN;
1295 int tip_x = x + slot_x;
1296 int tip_y = y + slot_y;
1297 AtoraTipRelationDraw(tip_x, tip_y, info, i, status, alpha);
1299 if ((chip->
required_element < 0 || status < 3) && status != ATORA_LINK_HIDDEN) {
1300 AtoraTipGetTexPos(chip->
id, u, v);
1301 CTexture *hole = AtoraTipHoleTexInfoGet(all_tips, colour);
1302 DrawMenu2DSprite(hole,
CRect_i_(tip_x, tip_y, 0x24, 0x24),
CRect_i_(u, v, 0x24, 0x25), colour[0], colour[1], colour[2], alpha);
1306 AtoraTipObjectOrPerson(tip_x, tip_y, info->
elements[i].
id, all_tips, alpha);
1308 if (complete == 0 && chip->
npc_no >= 0 && AlreadyPeopleTalk(MenuAtoraSel.
map_no, chip->
id) == 0 && AtoraHeyCnt % (chip->
id + 0x4B) < 0x46) {
1309 DrawMenu2DSprite(CompleteTex,
CRect_i_(tip_x - 9, tip_y - 7, 0x20, 0x15),
CRect_i_(0xE2, 0, 0x20, 0x16), alpha);
1322 int base_x = x + 0x70;
1326 for (
int i = 0; i < 6; i++) {
1336 float wave = cosf(PI * CompMsgCt / (160.0f + (count >> 1)));
1337 base_x = (int) ((
float) (base_x - 6) + 6.0f * wave);
1338 base_y = (int) ((
float) base_y + 2.0f * wave);
1339 float width = 128.0f + 6.0f * wave;
1341 float height = 88.0f + 3.0f * wave;
1343 base_x = (int) ((
float) base_x + 8.0f * cosf(PI * CompMsgCt / (180.0f + count)));
1344 base_y = (int) ((
float) base_y + 4.0f * sinf(PI * CompMsgCt / (140.0f + count)));
1345 DrawMenu2DSprite(CompleteTex,
CRect_i_(base_x, base_y, (
int) width, (
int) height),
CRect_i_(0, 0x28, 0x80, 0x58), alpha);
1350 if (CompMsgCt >= 320000 || CompMsgCt < 0) {
1362static void DrawAtoraNothing(
int x,
int y,
int alpha) {
1363 DrawMenu2DSprite(Sozai,
CRect_i_(x, y, 18, 18),
CRect_i_(184, 346, 18, 18), alpha);
1364 DrawMenu2DSprite(Sozai,
CRect_i_(x + 18, y, 220, 18),
CRect_i_(200, 346, 4, 18), alpha);
1365 DrawMenu2DSprite(Sozai,
CRect_i_(x + 238, y, 18, 18),
CRect_i_(202, 346, 18, 18), alpha);
1366 DrawMenu2DSprite(Sozai,
CRect_i_(x, y + 18, 18, 84),
CRect_i_(184, 360, 18, 4), alpha);
1367 DrawMenu2DSprite(Sozai,
CRect_i_(x + 238, y + 18, 18, 84),
CRect_i_(202, 360, 18, 4), alpha);
1368 DrawMenu2DSprite(Sozai,
CRect_i_(x, y + 102, 18, 18),
CRect_i_(184, 364, 18, 18), alpha);
1369 DrawMenu2DSprite(Sozai,
CRect_i_(x + 18, y + 102, 220, 18),
CRect_i_(200, 364, 4, 18), alpha);
1370 DrawMenu2DSprite(Sozai,
CRect_i_(x + 238, y + 102, 18, 18),
CRect_i_(202, 364, 18, 18), alpha);
1372 int lang = GetMenuLangFlag();
1374 s8 message_x[7] = {64, 64, 64, 64, 54, 64, 64};
1375 DrawMenu2DSprite(Sozai,
CRect_i_(x + message_x[lang], y + 44, 132, 30),
CRect_i_(124, 418, 132, 30), alpha);
1377 DrawMenu2DSprite(Sozai,
CRect_i_(x + 64, y + 44, 132, 30),
CRect_i_(124, 418, 132, 30), alpha);
1388static void DrawMsgAtraWarning(
ClsMes *mes,
int x,
int y) {
1413static void AtoraTipInfoInit() {
1414 NowTipHavePt->
mode = ATORA_SIDE_BOARD;
1416 NowTipHavePt->
slot = -1;
1417 NowTipHavePt->
tip_no = -1;
1420int GetMenuAtraEventFlag() {
1431static void SetMenuAtraEventFlag(
int flag) {
1442static void MenuAtoraAfterFadeIn() {
1445 CommonMenuMes2.
SetBuff(GetAtraMsgReadBuf);
1447 msg_no = AtoraMsgNoGet(MenuAtoraSel.
map_no, MenuAtoraSel.
board_pos, 0);
1448 CommonMenuMes2.
MakeMesWin(msg_no >= 0 ? msg_no + 1000 : 0);
1451void InitMenuAtora1(
int open_mode,
int edit_map,
int *texture_blocks, u_long128 *buffer) {
1453 InitPersonalBoardMode((
CUserStatus *) SaveData->
GetDngStatus(), &MenuAtoraSel.
board, PERSONAL_BOARD_ATLA, edit_map + BOARD_PAGE_ATLA_VILLAGE);
1455 AtoraTextureBaseBlock = texture_blocks[0];
1456 AtoraTextureReadBlock = texture_blocks[1];
1457 AtoraOffsetBuf = buffer;
1458 AtoraOffsetBuf = MenuCalcBufAlignment(buffer);
1459 AtoraTextureEnterFlag = 0;
1461 CommonMenuMes3.
Preset(MES_PRESET_NAME);
1462 CommonMenuMes3.
style = MES_EDGE_NONE;
1464 CommonMenuMes3.
auto_pos = MES_POS_NONE;
1466 AtoraNameMes.
Preset(MES_PRESET_NAME);
1467 AtoraNameMes.
tex_buff = MesWinTexBuff_12;
1468 memset(AtoraNameMes.
tex_buff, 0, 0x100);
1469 AtoraNameMes.
rows = 4;
1470 s8 widths[7] = {0x10, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C};
1471 AtoraNameMes.
char_width = widths[GetMenuLangFlag()];
1474 for (
int i = 0; i < 10; i++) {
1475 AtoraNameMes.
mes_no[i] = 999;
1476 AtoraNameMes.
values[i] = -1;
1484 MenuAtoraSel.
step = ATORA_STEP_FADE_IN;
1486 SetMenuAtraEventFlag(0);
1490 MenuAtoraSel.
mode = cursor->
mode[3];
1492 if (MenuAtoraSel.
mode < 0 || MenuAtoraSel.
mode > 1) {
1493 MenuAtoraSel.
mode = ATORA_SIDE_BOARD;
1496 int pos = cursor->
pos[3];
1498 switch (MenuAtoraSel.
mode) {
1499 case ATORA_SIDE_BOARD:
1502 case ATORA_SIDE_CHIP_LIST:
1513 MenuAtoraSel.
mode = ATORA_SIDE_BOARD;
1518 if (GetMenuAtraEventFlag() != 0) {
1523void InitMenuAtoraSelect(
int map_no) {
1534 MenuAtoraSel.
map_no = map_no;
1535 map = MenuAtoraSel.
map_no;
1537 if (AtoraTextureEnterFlag == 0) {
1538 GetPathReadDifferntLang(path);
1539 strcat(path,
"a%d.pak");
1540 sprintf(path, path, map + 1);
1547 LoadFileBG(path, AtoraOffsetBuf, NULL);
1550 if ((MenuAtoraSel.
open_mode == ATORA_OPEN_PLACE || MenuAtoraSel.
open_mode == ATORA_OPEN_WARN) && MenuAtoraSel.
map_no == MapNo) {
1551 CommonMenuAtoraInfo = &EditPartsInfo;
1553 CommonMenuAtoraInfo = &BtEditPartsInfo;
1554 CommonMenuAtoraInfo->
Load(MenuAtoraSel.
map_no, SaveData, 1);
1561 count = AtraBoardMaxNum(MenuAtoraSel.
map_no);
1563 if (MenuAtoraSel.
board_pos > count - 1) {
1567 info = SearchAtoraInfo(MenuAtoraSel.
board_pos);
1569 if (MenuAtoraSel.
mode == ATORA_SIDE_BOARD) {
1586 MenuAtoraSel.
cursor_x = place * 58 + 334;
1597 MenuAtoraSel.
cursor_y = place * 50 + 118;
1602 y = MenuAtoraSel.
scroll_y + 80 + 130.0f * pos;
1604 for (i = 0; i < 3; i++) {
1605 info = SearchAtoraInfo(pos);
1613 AtoraNameMes.
mes_no[i] = 999;
1627static inline void SetCursorMode(
CMenuCursor *cursor,
int menu,
int mode) {
1628 cursor->
mode[menu] = mode;
1635static void ExitAtoraSelect() {
1642 SetCursorMode(cursor, 3, MenuAtoraSel.
mode);
1644 switch (MenuAtoraSel.
mode) {
1645 case ATORA_SIDE_BOARD:
1648 case ATORA_SIDE_CHIP_LIST:
1653 cursor->
pos[3] = pos;
1657 CommonMenuMes3.
auto_pos = MES_POS_NONE;
1658 CommonMenuMes3.
Preset(MES_PRESET_SYSTEM);
1669static void AtoraTexInfoGet() {
1670 CompleteTex = TexManager.GetTexture(
"complete", -1);
1671 Sozai = TexManager.GetTexture(
"sozai", AtoraTextureReadBlock);
1672 HoleGray = TexManager.GetTexture(
"holegray", AtoraTextureReadBlock);
1673 HoleGold = TexManager.GetTexture(
"holegold", AtoraTextureReadBlock);
1674 ObTip = TexManager.GetTexture(
"obtip", AtoraTextureReadBlock);
1675 ObPerson = TexManager.GetTexture(
"obperson", AtoraTextureReadBlock);
1676 VillageBar = TexManager.GetTexture(
"viltag", AtoraTextureBaseBlock);
1677 VillageName = TexManager.GetTexture(
"vilname", AtoraTextureBaseBlock);
1680void DrawMenuAtoraSelect() {
1687 switch (MenuAtoraSel.
step) {
1688 case ATORA_STEP_FADE_IN:
1691 case ATORA_STEP_FADE_OUT:
1704 if (MenuAtoraSel.
step != ATORA_STEP_EVENT_PLAY) {
1705 DrawAtoraSelect(alpha);
1707 if (MenuAtoraSel.
step == ATORA_STEP_RUN) {
1711 if (MenuAtoraSel.
step != ATORA_STEP_RUN && AtoraTextureEnterFlag != 0) {
1717 CTexture frame = *TexManager.GetTexture(
"frame_image", -1);
1726 switch (MenuAtoraSel.
step) {
1727 case ATORA_STEP_FADE_IN:
1730 case ATORA_STEP_EVENT_FADE_OUT:
1733 case ATORA_STEP_EVENT_FADE_IN:
1736 case ATORA_STEP_FADE_OUT:
1757 CRect_i_ rect(320, 0, 320, SCREEN_HEIGHT);
1758 DrawMenu2DSprite(&frame, rect, rect, 0x40, 0x40, 0x40, tint);
1761 if (MenuAtoraSel.
step == ATORA_STEP_EVENT_FADE_OUT || MenuAtoraSel.
step == ATORA_STEP_EVENT_FADE_IN) {
1762 AllFadeForMenu(fade);
1765 if (MenuAtoraSel.
step == ATORA_STEP_WARNING) {
1766 CommonMenuMes3.
auto_pos = MES_POS_CENTRE;
1768 DrawMsgAtraWarning(&CommonMenuMes3, 184, 150);
1774 if (MenuAtoraSel.
step == ATORA_STEP_EVENT_PLAY) {
1775 EastKingEventDraw();
1786static void DrawAtoraSelect(
int fade) {
1812 switch (MenuAtoraSel.
step) {
1813 case ATORA_STEP_FADE_IN:
1814 case ATORA_STEP_FADE_OUT:
1817 case ATORA_STEP_CHANGE_MAP:
1828 info = SearchAtoraInfo(MenuAtoraSel.
board_pos);
1833 event = AtoraCompOrEvent(info);
1834 all_tips = AtoraAllTipGet(info->
parts_no);
1837 MenuTextureReload(AtoraTextureReadBlock);
1838 target = 146.0f - 130.0f * MenuAtoraSel.
board_pos;
1839 step = (target - MenuAtoraSel.
scroll_y) / 2.0f;
1840 odd = (int) step % 2;
1846 if (!((
float) abs((
int) ((
float) MenuAtoraSel.
scroll_y - target)) <= 4.0f)) {
1852 if (MenuAtoraSel.
mode != ATORA_SIDE_BOARD || open_mode != ATORA_OPEN_PLACE) {
1856 if (NowEditMap != MenuAtoraSel.
map_no) {
1868 remaining = AtraBoardMaxNum(MenuAtoraSel.
map_no);
1872 if (AtoraTextureEnterFlag != 0) {
1875 while (0 <= parts) {
1876 DrawAtora(0x38, (
int) y, parts, alpha);
1882 while (remaining > 0) {
1883 DrawAtoraNothing(0x38, (
int) y, alpha);
1888 if (AtoraHeyCnt > 10000000) {
1892 if (settled != 0 || (MenuAtoraSel.
map_no == 5 && all_tips != 0)) {
1893 float phase = CursorVibeCnt % 89;
1895 float sign_y = 208.0f + 8.0f * sinf(PI * phase / 45.0f);
1898 if (MenuAtoraSel.
map_no == 5 && all_tips != 0) {
1902 DrawMenu2DSprite(CompleteTex,
CRect_i_(0x83, (
int) (1.0f + sign_y), source.width, source.height), source, 6, 6, 6, (alpha * 0x50) >> 7);
1903 DrawMenu2DSprite(CompleteTex,
CRect_i_(0x80, (
int) sign_y, source.width, source.height), source, alpha);
1906 if (MenuAtoraSel.
step == ATORA_STEP_COMPLETE_FLASH) {
1912 MGSetGsALPHA(&blend);
1913 int flash = (int) (128.0f - 3.0f * MenuAtoraSel.
step_count);
1917 MenuAtoraSel.
step = ATORA_STEP_RUN;
1920 DrawMenu2DSprite(Sozai,
CRect_i_(0x34, 0x8B, 0x10C, 0x82),
CRect_i_(0x8C, 0x1C0, 0x74, 0x40), flash);
1924 AtoraBoardFadeEffect();
1927 count = PersonalRetMax(MenuAtoraSel.
board.
page);
1929 board_y = (int) ((MenuAtoraSel.
board.
y += (board_y - MenuAtoraSel.
board.
y) / 4.0f), MenuAtoraSel.
board.
y);
1930 MenuTextureReload(PerBoardTex->
block);
1931 DrawPerBoardDraw(0, count, 0x168, board_y, 0x81, 0x121, PerBoardTex, 0x80);
1933 if (AtoraTextureEnterFlag != 0) {
1934 MenuTextureReload(AtoraTextureReadBlock);
1935 CommonIconDraw(MenuAtoraSel.
board.
page, count, 0x168, board_y + 1, 0x81, 0x121, alpha);
1938 MenuTextureReload(PerBoardTex->
block);
1939 PersonalBoardTagDraw(MenuAtoraSel.
board.
page, 0x154, 0x78, PerBoardTex, 0, 0x80);
1941 if (PerBoardTex != NULL) {
1942 MenuTextureReload(PerBoardTex->
block);
1943 PersonalBoardDrawWaku(0x154, 0x78, PerBoardTex, 0x80);
1944 PersonalBoardScrlBarDraw(count, 0x154, 0x78, MenuAtoraSel.
board.
scroll, MenuAtoraSel.
board.
top_row, PerBoardTex, 0x80);
1945 PersonalBoardMaxDraw(count, 0x154, 0x78, PerBoardTex, 0x80);
1950 if (0 < GetAtoraMaxVillage() - 3) {
1951 int arrow_y = (int) (66.0f + 4.0f * sinf(PI * (
float) (CursorVibeCnt % 79 - 40) / 40.0f));
1952 DrawMenu2DSprite(PerBoardTex,
CRect_i_(0x146, arrow_y, 0x1A, 0x18),
CRect_i_(0x62, 0x14, 0x1A, 0x18), 0x80);
1953 DrawMenu2DSprite(PerBoardTex,
CRect_i_(0x20C, arrow_y, 0x1A, 0x18),
CRect_i_(0x7C, 0x14, 0x1A, 0x18), 0x80);
1956 if (PerBoardTex != NULL) {
1957 MenuTextureReload(PerBoardTex->
block);
1960 switch (MenuAtoraSel.
mode) {
1961 case ATORA_SIDE_BOARD:
1968 waku_x = (int) (cursor_x + 2.0f);
1969 waku_y = (int) (cursor_y - 15.0f);
1973 cursor_x = (MenuAtoraSel.
board.
cursor + 2) % 3 * 0x2C + 0x92;
1981 waku_x = (int) (3.0f + cursor_x);
1982 waku_y = (int) (cursor_y - 5.0f);
1986 case ATORA_SIDE_CHIP_LIST: {
1987 cursor_x = MenuAtoraSel.
board.
cursor % 5 * 0x28 + 0x14E;
1998 cursor_y = row * 0x28 + 0x8A;
1999 waku_x = (int) cursor_x;
2000 waku_y = (int) cursor_y;
2008 if (NowTipHavePt->
tip_no > -1) {
2013 switch (MenuAtoraSel.
mode) {
2014 case ATORA_SIDE_BOARD:
2026 case ATORA_SIDE_CHIP_LIST:
2040 if (MenuAtoraSel.
step == ATORA_STEP_RUN) {
2041 MenuTextureReload(AtoraTextureReadBlock);
2042 int tip_no = NowTipHavePt->
tip_no;
2045 CTexture *texture = RetCTexAtora(tip_no, u, v);
2047 if (texture != NULL) {
2048 float sway_x = 7.0f * cosf(0.0805536583f * CursorVibeCnt);
2049 float sway_y = 5.0f * sinf(0.116355285f * CursorVibeCnt);
2050 int tip_x = (int) (2.0f + (MenuAtoraSel.
cursor_x + sway_x));
2051 int tip_y = (int) (MenuAtoraSel.
cursor_y + sway_y - 14.0f);
2053 DrawMenu2DSprite(texture,
CRect_i_(tip_x + 5, tip_y + 3, 0x24, 0x24), source, 10, 10, 10, 0x50);
2054 float hand_x = MenuAtoraSel.
cursor_x + sway_x;
2055 int hand_ix = (int) hand_x;
2056 float hand_y = MenuAtoraSel.
cursor_y + sway_y;
2057 int hand_iy = (int) hand_y;
2058 DrawMenu2DSprite(StayTex,
CRect_i_((
int) hand_x + 6, (
int) hand_y + 3, 0x20, 0x20),
CRect_i_(0x80, 0x28, 0x20, 0x20), 10, 10, 10, 0x50);
2059 DrawMenu2DSprite(texture,
CRect_i_(tip_x, tip_y, 0x24, 0x24), source, 0x80);
2065 switch (MenuAtoraSel.
mode) {
2066 case ATORA_SIDE_BOARD:
2071 if (open_mode == ATORA_OPEN_PLACE && 0 < MenuAtoraSel.
board.
cursor && event != 0) {
2078 if (MenuAtoraSel.
step == ATORA_STEP_EVENT_START || (MenuAtoraSel.
mode == ATORA_SIDE_BOARD && MenuAtoraSel.
board.
cursor == 0 && MenuAtoraSel.
map_no == 5)) {
2082 if (draw_waku != 0) {
2083 DrawMenuWaku(waku_x + 0x15, waku_y - 0xE, waku_size, waku_size, 0, StayTex, 0x80);
2095static int AtoraTextureEnter() {
2097 {
"#frame_image3#640#" SCREEN_HEIGHT_STR
"#4", 0, 0},
2103 tex[1].block_no = tex[0].block_no = AtoraTextureReadBlock;
2104 bg = GetReadBGFile(0);
2105 char name[16] =
"a%d.img";
2106 sprintf(name, name, MenuAtoraSel.
map_no + 1);
2107 tex[1].
name = (
char *) GetPackFile((u_int *) bg->
buffer, name, NULL);
2108 TexManager.DeleteTextureBlock(AtoraTextureReadBlock);
2109 TexManager.LoadTextureBlockEX(-1, tex);
2110 CompleteTex = TexManager.GetTexture(
"complete", -1);
2111 Sozai = TexManager.GetTexture(
"sozai", AtoraTextureReadBlock);
2112 HoleGray = TexManager.GetTexture(
"holegray", AtoraTextureReadBlock);
2113 HoleGold = TexManager.GetTexture(
"holegold", AtoraTextureReadBlock);
2114 ObTip = TexManager.GetTexture(
"obtip", AtoraTextureReadBlock);
2115 ObPerson = TexManager.GetTexture(
"obperson", AtoraTextureReadBlock);
2122int tip_sort_type = 1;
2125int tip_table[3] = {3, 1, 2};
2134static int GetTipKind(
int tip_no) {
2135 if (tip_no < 0 || tip_no >= 100) {
2139 if (0 <= tip_no && tip_no < 40) {
2160static int CompTip(
int tip_a,
int tip_b) {
2164 rank_a = tip_table[GetTipKind(tip_a)];
2165 rank_b = tip_table[GetTipKind(tip_b)];
2175 if (rank_a > rank_b) {
2179 if (rank_a < rank_b) {
2183 if (tip_a > tip_b) {
2187 return (tip_a < tip_b) ? -1 : 0;
2198static int SeitonAtoraTipBoardSub() {
2206 kind = tip_sort_type;
2208 for (rank = 0; rank < 3; rank++) {
2209 tip_table[kind] = rank;
2221 for (i = 0; i < 119; i++) {
2222 for (j = i + 1; j < 120; j++) {
2223 if (CompTip(list[i], list[j]) > 0) {
2224 MenuDataSwap(&list[i], &list[j]);
2241static void SeitonAtoraTipBoard() {
2244 for (i = 0; i < 3; i++) {
2245 if (SeitonAtoraTipBoardSub()) {
2251 if (tip_sort_type >= 3) {
2257int MenuAtoraSelectKey() {
2269 result = ATORA_SELECT_NONE;
2271 if (ReadBGSync() == 0 && AtoraTextureEnterFlag == 0) {
2272 AtoraTextureEnterFlag = AtoraTextureEnter();
2275 switch (MenuAtoraSel.
step) {
2276 case ATORA_STEP_FADE_IN:
2277 if (MenuAtoraSel.
step_count > 15 && AtoraTextureEnterFlag) {
2278 MenuAtoraSel.
step = ATORA_STEP_RUN;
2279 MenuAtoraAfterFadeIn();
2283 case ATORA_STEP_FADE_OUT:
2286 MenuAtoraSel.
step = ATORA_STEP_RUN;
2290 case ATORA_STEP_EVENT_START:
2291 if (MenuAtoraSel.
map_no != 5) {
2293 case ATORA_OPEN_PLACE:
2295 MenuAtoraSel.
step = ATORA_STEP_RUN;
2296 EditMenuStatus.
mode = EDIT_MENU_MODE_EVENT;
2301 return ATORA_SELECT_PLACE_EXIT;
2304 SetMenuAtraEventFlag(1);
2305 MenuAtoraSel.
step = ATORA_STEP_EVENT_FADE_OUT;
2306 GetPrevEastKingSndVol();
2307 SndBgmFadeOut(45, 0);
2311 case ATORA_STEP_EVENT_FADE_OUT:
2321 CommonMenuAtoraInfo->
Save(MenuAtoraSel.
map_no, SaveData);
2322 MenuAtoraSel.
step = ATORA_STEP_EVENT_PLAY;
2324 block[0] = AtoraTextureReadBlock;
2328 InitEastKingEvent(event_no, block, AtoraOffsetBuf);
2332 case ATORA_STEP_EVENT_PLAY:
2333 if (EastKingEventKey() == 1) {
2334 MenuAtoraSel.
step = ATORA_STEP_EVENT_FADE_IN;
2335 AtoraTextureEnterFlag = 0;
2336 InitMenuAtoraSelect(MenuAtoraSel.
map_no);
2337 SetMenuAtraEventFlag(0);
2342 case ATORA_STEP_EVENT_FADE_IN:
2346 MenuAtoraSel.
step = ATORA_STEP_RUN;
2350 case ATORA_STEP_COMPLETE_FLASH:
2352 MenuAtoraSel.
step = ATORA_STEP_RUN;
2356 case ATORA_STEP_WARNING:
2357 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS)) {
2358 MenuAtoraSel.
step = ATORA_STEP_RUN;
2362 case ATORA_STEP_CHANGE_MAP:
2363 if (MenuAtoraSel.
step_count > 24 && AtoraTextureEnterFlag) {
2364 MenuAtoraSel.
step = ATORA_STEP_RUN;
2366 case ATORA_STEP_RUN:
2367 switch (MenuAtoraSel.
mode) {
2368 case ATORA_SIDE_BOARD:
2369 result = AtoraBoardKey();
2371 case ATORA_SIDE_CHIP_LIST:
2372 result = AtoraTipKey();
2376 max_village = GetAtoraMaxVillage();
2379 if (GamePad.
Down(PAD_R2 | PAD_R1)) {
2380 if (NowTipHavePt->
tip_no < 0) {
2383 if (MenuAtoraSel.
board.
page > max_village) {
2384 MenuAtoraSel.
board.
page = BOARD_PAGE_ATLA_VILLAGE;
2387 ComMenuSePlay(MENU_SOUND_REFUSE);
2391 if (GamePad.
Down(PAD_L2 | PAD_L1)) {
2392 if (NowTipHavePt->
tip_no < 0) {
2395 if (MenuAtoraSel.
board.
page < BOARD_PAGE_ATLA_VILLAGE) {
2399 ComMenuSePlay(MENU_SOUND_REFUSE);
2403 if (prev_village != MenuAtoraSel.
board.
page) {
2404 result = ATORA_SELECT_CHANGE_PAGE;
2408 case ATORA_SELECT_PLACE:
2409 info = SearchAtoraInfo(MenuAtoraSel.
board_pos);
2410 EditMenuStatus.
mode = EDIT_MENU_MODE_PLACE;
2414 ComMenuSePlay(MENU_SOUND_CONFIRM);
2416 case ATORA_SELECT_CHANGE_PAGE:
2417 if (NowTipHavePt->
tip_no >= 0) {
2418 ComMenuSePlay(MENU_SOUND_REFUSE);
2422 CommonMenuAtoraInfo->
Save(MenuAtoraSel.
map_no, SaveData);
2423 MenuAtoraSel.
map_no = MenuAtoraSel.
board.
page - BOARD_PAGE_ATLA_VILLAGE;
2424 AtoraTextureEnterFlag = 0;
2425 max_pos = AtraBoardMaxNum(MenuAtoraSel.
map_no);
2427 if (max_pos <= MenuAtoraSel.
board_pos) {
2432 InitMenuAtoraSelect(MenuAtoraSel.
map_no);
2433 MenuAtoraSel.
step = ATORA_STEP_CHANGE_MAP;
2436 ComMenuSePlay(MENU_SOUND_CONFIRM);
2438 case ATORA_SELECT_CLOSE:
2439 MenuAtoraSel.
step = ATORA_STEP_FADE_OUT;
2441 CommonMenuAtoraInfo->
Save(MenuAtoraSel.
map_no, SaveData);
2451 switch (MenuAtoraSel.
mode) {
2452 case ATORA_SIDE_BOARD:
2454 msg_no = tip_no + 1000;
2460 if (tip_no == -788) {
2465 case ATORA_SIDE_CHIP_LIST:
2467 msg_base = MenuAtoraSel.
map_no * 200 + 1000;
2470 msg_no = msg_base + AtoraTipOnlyMsgNoGet(MenuAtoraSel.
map_no, held);
2471 }
else if (NowTipHavePt->
tip_no > -1) {
2472 msg_no = msg_base + AtoraTipOnlyMsgNoGet(MenuAtoraSel.
map_no, NowTipHavePt->
tip_no);
2482 if (AtoraTextureEnterFlag == 0 || MenuAtoraSel.
step == ATORA_STEP_FADE_IN) {
2486 if (CommonMenuMes2.
mes_made != msg_no) {
2493static int AtoraBoardKey() {
2496 int max = AtraBoardMaxNum(MenuAtoraSel.
map_no);
2500 int result = ATORA_SELECT_NONE;
2504 if (GamePad.
Down(PAD_UP) != 0) {
2515 }
else if (0 < MenuAtoraSel.
board_pos) {
2517 AtoraBoardEnableMovePos(MenuAtoraSel.
board_pos, movable);
2520 to = AtoraBoardGoToPos(movable, to, 3);
2522 if (movable[to] != 0) {
2527 to = AtoraBoardGoToPos(movable, to, 0);
2529 if (movable[to] != 0) {
2536 }
else if (GamePad.
Down(PAD_DOWN) != 0) {
2547 AtoraBoardEnableMovePos(MenuAtoraSel.
board_pos, movable);
2549 to = AtoraBoardGoToPos(movable, to, 0);
2551 if (movable[to] != 0) {
2558 AtoraBoardEnableMovePos(MenuAtoraSel.
board_pos, movable);
2561 to = AtoraBoardGoToPos(movable, to, 3);
2563 if (movable[to] != 0) {
2565 }
else if (MenuAtoraSel.
board_pos < max - 1) {
2568 AtoraBoardEnableMovePos(MenuAtoraSel.
board_pos, movable);
2570 to = AtoraBoardGoToPos(movable, to, 0);
2572 if (movable[to] != 0) {
2579 }
else if (GamePad.
Down(PAD_LEFT) != 0) {
2586 }
else if (GamePad.
Down(PAD_RIGHT) != 0) {
2589 AtoraBoardEnableMovePos(MenuAtoraSel.
board_pos, movable);
2593 event = AtoraCompOrEvent(info);
2598 if (info == NULL || event != 0) {
2600 }
else if (movable[MenuAtoraSel.
board.
cursor] != 0) {
2611 MenuAtoraSel.
mode = ATORA_SIDE_CHIP_LIST;
2615 if (MenuAtoraSel.
mode == ATORA_SIDE_CHIP_LIST) {
2620 if (MenuAtoraSel.
mode == ATORA_SIDE_BOARD) {
2625 event = AtoraCompOrEvent(info);
2634 if (GamePad.
Down(PAD_CROSS) != 0) {
2644 AtoraCompOrEvent(info);
2645 int all_tips = AtoraAllTipGet(info->
parts_no);
2647 if (MenuAtoraSel.
open_mode == ATORA_OPEN_WARN) {
2648 MenuAtoraSel.
step = ATORA_STEP_WARNING;
2651 int held = NowTipHavePt->
tip_no;
2655 }
else if (full == 0 && held < 0 && open_mode == ATORA_OPEN_PLACE && NowEditMap == MenuAtoraSel.
map_no) {
2657 ComMenuSePlay(MENU_SOUND_CONFIRM);
2658 return ATORA_SELECT_PLACE;
2659 }
else if (all_tips != 0 && MenuAtoraSel.
map_no == 5) {
2660 MenuAtoraSel.
step = ATORA_STEP_EVENT_START;
2666 }
else if (all_tips != 0) {
2667 ComMenuSePlay(MENU_SOUND_REFUSE);
2668 return ATORA_SELECT_NONE;
2670 AtoraBoardEnableMovePos(MenuAtoraSel.
board_pos, movable);
2673 if (NowTipHavePt->
tip_no < 0) {
2679 for (
int i = slot; i < 6; i++) {
2688 NowTipHavePt->
slot = slot;
2689 NowTipHavePt->
mode = ATORA_SIDE_BOARD;
2701 if (NowTipHavePt->
tip_no != element->
id) {
2715 if (AtraTipCanDisplay(chip) == 0) {
2723 return ATORA_SELECT_NONE;
2726 if (AtoraAllTipGet(info->
parts_no) != 0) {
2727 ComMenuSePlay(SE_SPARKLE);
2728 MenuAtoraSel.
step = ATORA_STEP_COMPLETE_FLASH;
2742 }
else if (GamePad.
Down(PAD_CIRCLE) != 0) {
2745 if (NowTipHavePt->
tip_no < 0) {
2747 result = ATORA_SELECT_CLOSE;
2749 AtoraMenuTipCancel();
2759 if (GamePad.
Down2(PAD_CROSS)) {
2760 if (parts != NULL) {
2761 for (
int i = 0; i < 6; i++) {
2773 if (GamePad.
Down2(PAD_CIRCLE)) {
2774 if (parts != NULL) {
2775 for (
int i = 0; i < 6; i++) {
2779 for (
int j = 0; j < 100; j++) {
2792 if (GamePad.
Down2(PAD_R1) && parts != NULL) {
2793 printf(
"info----------,,,\tID \t\t%d\n", parts->
parts_no);
2794 printf(
"\t\tcomplete_event\t\t%d\n", parts->
kind);
2796 for (
int i = 0; i < 6; i++) {
2802 for (
int j = 0; j < 120; j++) {
2815 if (GamePad.
Down2(PAD_L1)) {
2816 if (parts != NULL) {
2817 for (
int i = 0; i < 6; i++) {
2838 if (GamePad.
Down2(PAD_TRIANGLE)) {
2842 for (
int i = 0; i < 6; i++) {
2850 int npc_no = element->
npc_no;
2862 if (AtoraCompOrEvent(info) != 0 && open_mode == ATORA_OPEN_PLACE && NowEditMap == MenuAtoraSel.
map_no) {
2863 MenuAtoraSel.
step = ATORA_STEP_EVENT_START;
2866 ComMenuSePlay(MENU_SOUND_CONFIRM);
2870 if (GamePad.
Down2(PAD_CROSS) && GamePad.
Down2(PAD_CIRCLE)) {
2871 for (
int k = 0; k < max; k++) {
2877 for (
int i = 0; i < 6; i++) {
2885 int npc_no = element->
npc_no;
2899 ComMenuSePlay(MENU_SOUND_CONFIRM);
2902 if (GamePad.
Down2(PAD_CROSS) && GamePad.
Down2(PAD_DOWN)) {
2903 for (
int k = 0; k < max; k++) {
2907 for (
int i = 0; i < 6; i++) {
2911 int npc_no = element->
npc_no;
2936static int AtoraTipKey() {
2937 int result = ATORA_SELECT_NONE;
2939 int mode = MenuAtoraSel.
mode;
2942 switch (PersonalBoardKey()) {
2948 event = AtoraCompOrEvent(info);
2952 AtoraBoardEnableMovePos(MenuAtoraSel.
board_pos, enable);
2953 MenuAtoraSel.
mode = ATORA_SIDE_BOARD;
2955 if (info == NULL || event != 0) {
2958 int slot = AtoraBoardGoToPos(enable, MenuAtoraSel.
board.
cursor < MenuAtoraSel.
board.
top_row * 5 + 10 ? 2 : 5, 0);
2967 ComMenuSePlay(MENU_SOUND_CURSOR);
2972 if (MenuAtoraSel.
mode == ATORA_SIDE_CHIP_LIST) {
2974 ComMenuSePlay(MENU_SOUND_CURSOR);
2977 if (GamePad.
Down(PAD_CROSS)) {
2980 if (NowTipHavePt->
tip_no == *tip) {
2981 ComMenuSePlay(MENU_SOUND_REFUSE);
2983 ComMenuSePlay(MENU_SOUND_CONFIRM);
2985 *tip = NowTipHavePt->
tip_no;
2986 NowTipHavePt->
tip_no = tip_no;
2988 NowTipHavePt->
mode = ATORA_SIDE_CHIP_LIST;
2992 return ATORA_SELECT_NONE;
2993 }
else if (GamePad.
Down(PAD_CIRCLE)) {
2994 ComMenuSePlay(MENU_SOUND_REFUSE);
2996 if (NowTipHavePt->
tip_no < 0) {
2997 result = ATORA_SELECT_CLOSE;
2999 AtoraMenuTipCancel();
3001 }
else if (GamePad.
Down(PAD_SQUARE)) {
3002 ComMenuSePlay(MENU_SOUND_CONFIRM);
3003 SeitonAtoraTipBoard();
3010static void AtoraMenuTipCancel() {
3015 switch (NowTipHavePt->
mode) {
3016 case ATORA_SIDE_CHIP_LIST:
3019 NowTipHavePt->
tip_no = tip_no;
3021 case ATORA_SIDE_BOARD:
3022 info = SearchAtoraInfo(NowTipHavePt->
parts_no);
3030 NowTipHavePt->
tip_no = -1;
3035static void AtoraBoardFadeEffect() {
3036 CTexture frame = *TexManager.GetTexture(
"frame_image", -1);
3038 if (&frame == NULL) {
3049 bottom.
r = bottom.
g = bottom.
b = 0x40;
3050 top.
r = top.
g = top.
b = 0x40;
3053 set2DSprite(Vif1Packet, &frame,
CRect_i_(0, 0, 320, 1),
CRect_i_(0, 0, 320, 1), &top, &top, &bottom, &bottom, 1);
3054 set2DSprite(Vif1Packet, &frame,
CRect_i_(0, 1, 320, 60),
CRect_i_(0, 0, 320, 61), &top, &top, &bottom, &bottom, 1);
3057 set2DSprite(Vif1Packet, &frame,
CRect_i_(0, 61, 320, 59),
CRect_i_(0, 60, 320, 60), &top, &top, &bottom, &bottom, 1);
3060 set2DSprite(Vif1Packet, &frame,
CRect_i_(0, 277, 320, 89),
CRect_i_(0, 276, 320, 90), &top, &top, &bottom, &bottom, 1);
3063 set2DSprite(Vif1Packet, &frame,
CRect_i_(0, 366, 320, 1),
CRect_i_(0, 366, 320, 1), &top, &top, &bottom, &bottom, 1);
3065 set2DSprite(Vif1Packet, &frame,
CRect_i_(0, 367, 320, 113),
CRect_i_(0, 366, 320, 114), &top, &top, &bottom, &bottom, 1);
3067 set2DSprite(Vif1Packet, &frame,
CRect_i_(0, 367, 320, 81),
CRect_i_(0, 366, 320, 82), &top, &top, &bottom, &bottom, 1);
3072void AtoraNameDraw(
int unused) {
3082 MenuTextureReload(AtoraNameMes.
tex_block);
3085 for (
int j = 0; j < 3; j++) {
3086 prev_mes_no[j] = AtoraNameMes.
mes_no[j];
3089 y = MenuAtoraSel.
scroll_y + 92 + 130.0f * pos;
3091 for (i = 0; i < 3; i++) {
3092 if (y < 96 || y > 341) {
3095 info = SearchAtoraInfo(pos);
3104 AtoraNameMes.
mes_no[i] = mes_no;
3105 x = GetMsgLengthMenu(&AtoraNameMes, mes_no);
3107 if (GetMenuLangFlag() == LANG_JAPANESE && mes_no == 1000) {
3108 x = GetMsgLengthCharaName(0) + 3;
3111 x = 186.0f - 58.0f * (x / 10.0f);
3113 if (GetMenuLangFlag() > LANG_JAPANESE) {
3114 if (mes_no == 2001) {
3118 if (mes_no == 2002) {
3123 if (i >= 0 && i < 10) {
3132 for (
int k = 0; k < 3; k++) {
3133 if (AtoraNameMes.
mes_no[k] != prev_mes_no[k]) {
3142 switch (MenuAtoraSel.
step) {
3143 case ATORA_STEP_EVENT_FADE_OUT:
3151 case ATORA_STEP_EVENT_FADE_IN:
3159 case ATORA_STEP_EVENT_PLAY:
3165 AtoraNameMes.
Step();
3168 if (GetMenuAtraEventFlag() == 0) {
3169 AtoraBoardFadeEffect();
3182static void OptionMenuDraw(
int x,
int y,
int arrow_x,
int arrow_y,
int alpha) {
3183 int label[13] = {10, 8, 4, 5, 2, 3, 14, 9, 11, 12, 13, 6, 7};
3184 int kind[13] = {0, 0, 1, 2, 0, 1, 4, 3, 0, 0, 0, 0, 0};
3196 for (i = 0; i < 13; i++) {
3202 src.
y = label[i] * 24;
3205 src.
y = (label[i] - 7) * 24;
3210 DrawMenu2DSprite(MenuOption, dst, src, alpha);
3211 int row_kind = kind[i];
3213 int cell_uv[5][2] = {
3214 {OptionMenu.
flag[i] << 6, row_kind * 48 + 176},
3215 {OptionMenu.
flag[i] << 6, row_kind * 48 + 176},
3216 {OptionMenu.
flag[i] << 6, row_kind * 48 + 176},
3220 u = cell_uv[row_kind][0];
3221 v = cell_uv[row_kind][1];
3227 DrawMenu2DSprite(MenuOption,
CRect_i_(row_x + 238, row_y + 1, 64, 23),
CRect_i_(u, v + 1, 64, 24), alpha);
3235 v = (row_kind * 2 + 1) * 24 + 176;
3236 DrawMenu2DSprite(MenuOption,
CRect_i_(row_x + 310, row_y + 1, 64, 23),
CRect_i_(u, v + 1, 64, 24), alpha);
3239 cell_x = row_x + 238;
3240 setting = OptionMenu.
flag[i];
3242 for (
int j = 0; j < 3; j++) {
3249 DrawMenu2DSprite(MenuOption,
CRect_i_(cell_x, row_y + 1, 32, 23),
CRect_i_(u, v + 1, 32, 24), alpha);
3261 DrawMenu2DSprite(MenuOption,
CRect_i_(cell_x, row_y + 1, 64, 23),
CRect_i_(off_u, 199, 64, 24), alpha);
3264 DrawMenu2DSprite(MenuOption,
CRect_i_(row_x + 238, row_y + 1, 64, 23),
CRect_i_(u, v, 64, 24), alpha);
3276 DrawMenu2DSprite(MenuOption,
CRect_i_(arrow_x, arrow_y, 60, 29),
CRect_i_(452, 224, 60, 29), alpha);
3279static void OptionMenuDraw(
int x,
int y,
int arrow_x,
int arrow_y,
int alpha) {
3280 int label[12] = {10, 8, 4, 5, 2, 3, 9, 11, 12, 13, 6, 7};
3281 int kind[12] = {0, 0, 1, 2, 0, 1, 3, 0, 0, 0, 0, 0};
3294 for (i = 0; i < 12; i++) {
3300 src.
y = label[i] * 24;
3303 src.
y = (label[i] - 7) * 24;
3308 DrawMenu2DSprite(MenuOption, dst, src, alpha);
3314 u = OptionMenu.
flag[i] << 6;
3315 v = kind[i] * 48 + 176;
3316 DrawMenu2DSprite(MenuOption,
CRect_i_(row_x + 238, row_y + 1, 64, 23),
CRect_i_(u, v + 1, 64, 24), alpha);
3324 v = (kind[i] * 2 + 1) * 24 + 176;
3325 DrawMenu2DSprite(MenuOption,
CRect_i_(row_x + 310, row_y + 1, 64, 23),
CRect_i_(u, v + 1, 64, 24), alpha);
3329 cell_x = row_x + 238;
3330 setting = OptionMenu.
flag[i];
3332 for (j = 0; j < 3; j++) {
3339 DrawMenu2DSprite(MenuOption,
CRect_i_(cell_x, row_y + 1, 32, 23),
CRect_i_(u, v + 1, 32, 24), alpha);
3351 DrawMenu2DSprite(MenuOption,
CRect_i_(cell_x, row_y + 1, 64, 23),
CRect_i_(off_u, 199, 64, 24), alpha);
3363 DrawMenu2DSprite(MenuOption,
CRect_i_(arrow_x, arrow_y, 60, 29),
CRect_i_(452, 226, 60, 29), alpha);
3374static void DrawOptionLRCur(
int side,
int alpha) {
3376 s16 cursor_x[2] = {32, 520};
3378 int cursor_x[2] = {32, 520};
3382 v = side * 32 + 256;
3383 DrawMenu2DSprite(MenuOption,
CRect_i_(cursor_x[side], 180, 96, 32),
CRect_i_(416, v, 96, 32), alpha);
3394static void DrawOptionScreenWaku() {
3398 DrawMenu2DSprite(MenuOption,
CRect_i_(288, 208, 64, 64),
CRect_i_(448, 0, 64, 64), 0x80);
3400 s16 corner[4][2] = {
3408 {center_x - 16, center_y - 96},
3409 {center_x + 64, center_y - 16},
3410 {center_x - 16, center_y + 64},
3411 {center_x - 96, center_y - 16}
3414 u8 piece_uv[4][2] = {
3421 for (
int i = 0; i < 4; i++) {
3422 DrawMenu2DSprite(MenuOption,
CRect_i_(corner[i][0], corner[i][1], 32, 32),
CRect_i_(piece_uv[i][0] + 448, piece_uv[i][1] + 64, 32, 32), 0x80);
3423 DrawMenu2DSprite(MenuOption,
CRect_i_(arrow[i][0], arrow[i][1], 32, 32),
CRect_i_(piece_uv[i][0] + 448, piece_uv[i][1] + 128, 32, 32), 0x80);
3428int InitMenuOption(
int mode,
int block_no, u_long128 *buffer) {
3433 switch ((
int) buffer) {
3435 buffer = (u_long128 *) read_buffer;
3438 data = MenuCalcBufAlignment(buffer);
3441 if (LoadFileBGMenuData(
"option.pac", data) <= 0) {
3445 OptionMenu.
mode = mode;
3448 switch (OptionMenu.
mode) {
3449 case OPTION_OPEN_TITLE:
3455 OptionMenu.
step = OPTION_STEP_FADE_IN;
3464 OptionMenu.
page_x = 136.0f;
3468 OptionMenu.
flag[1] = OpConfigPt[7];
3469 OptionMenu.
flag[2] = OpConfigPt[4];
3470 OptionMenu.
flag[3] = OpConfigPt[5];
3471 OptionMenu.
flag[4] = OpConfigPt[2];
3472 OptionMenu.
flag[5] = OpConfigPt[3];
3475 OptionMenu.
flag[8] = OpConfigPt[10];
3476 OptionMenu.
flag[9] = OpConfigPt[9];
3477 OptionMenu.
flag[10] = OpConfigPt[11];
3478 OptionMenu.
flag[11] = OpConfigPt[8];
3479 OptionMenu.
flag[12] = OpConfigPt[6];
3480 OptionMenu.prev_screen_pos[0] = OpConfigPt[12];
3481 OptionMenu.prev_screen_pos[1] = OpConfigPt[13];
3484 for (i = 0; i < 14; i++) {
3490 OptionMenu.
flag[7] = OpConfigPt[10];
3491 OptionMenu.
flag[8] = OpConfigPt[9];
3492 OptionMenu.
flag[9] = OpConfigPt[11];
3493 OptionMenu.
flag[10] = OpConfigPt[8];
3494 OptionMenu.
flag[11] = OpConfigPt[6];
3496 for (i = 0; i < 12; i++) {
3508static inline void SetCursorResetPos(
CMenuCursor *cursor,
int reset) {
3516static void ExitMenuOption() {
3520 if (OptionMenu.
mode == OPTION_OPEN_TITLE) {
3529 SetCursorResetPos(cursor, OptionMenu.
flag[0]);
3535 OpConfigPt[7] = OptionMenu.
flag[1];
3536 OpConfigPt[4] = OptionMenu.
flag[2];
3537 OpConfigPt[5] = OptionMenu.
flag[3];
3539 OpConfigPt[2] = OptionMenu.
flag[4];
3540 OpConfigPt[3] = OptionMenu.
flag[5];
3543 OpConfigPt[10] = OptionMenu.
flag[8];
3544 OpConfigPt[9] = OptionMenu.
flag[9];
3545 OpConfigPt[11] = OptionMenu.
flag[10];
3546 OpConfigPt[8] = OptionMenu.
flag[11];
3547 OpConfigPt[6] = OptionMenu.
flag[12];
3550 OpConfigPt[10] = OptionMenu.
flag[7];
3551 OpConfigPt[9] = OptionMenu.
flag[8];
3552 OpConfigPt[11] = OptionMenu.
flag[9];
3553 OpConfigPt[8] = OptionMenu.
flag[10];
3554 OpConfigPt[6] = OptionMenu.
flag[11];
3565static void InitOptionFlag() {
3569 for (i = 0; i < 13; i++) {
3570 OptionMenu.
flag[i] = 0;
3573 OptionMenu.
flag[7] = 1;
3577 for (i = 0; i < 12; i++) {
3578 OptionMenu.
flag[i] = 0;
3581 OptionMenu.
flag[6] = 1;
3592static void PrevOptionSetFunc() {
3595 for (i = 0; i < 12; i++) {
3600 OpConfigPt[12] = OptionMenu.prev_screen_pos[0];
3601 OpConfigPt[13] = OptionMenu.prev_screen_pos[1];
3606int MenuOptionKey() {
3609 switch (OptionMenu.
step) {
3610 case OPTION_STEP_FADE_IN:
3614 if (ReadBGSync() == 0) {
3616 {
"#frame_image_option#640#" SCREEN_HEIGHT_STR
"#4", 0, 0},
3623 textures[1].
name = (
char *) GetPackFile((u_int *) file->
buffer,
"option.img", NULL);
3624 TexManager.DeleteTextureBlock(OptionMenu.
block_no);
3625 TexManager.CleanUpTextureList();
3626 TexManager.LoadTextureBlockEX(-1, textures);
3627 MenuOption = TexManager.GetTexture(
"option2", -1);
3629 if (OptionMenu.
mode == OPTION_OPEN_TITLE) {
3630 InitMenuMesSet(MENU_MES_SET_ALLMENU, (
short *) GetPackFile((u_int *) file->
buffer,
"allmenu.mes", NULL));
3639 OptionMenu.
step = OPTION_STEP_RUN;
3644 case OPTION_STEP_FADE_OUT:
3653 int old_cursor = OptionMenu.
cursor;
3654 int old_buttons = OptionMenu.
buttons;
3656 if (OptionMenu.
buttons != OPTION_AREA_SCREEN_POS && GamePad.
Down(PAD_L2 | PAD_R2 | PAD_L1 | PAD_R1) != 0) {
3657 if (OptionMenu.
cursor / 10 - 1 < 7) {
3663 if (OptionMenu.
cursor / 10 - 1 >= 13) {
3669 case OPTION_AREA_SCREEN_POS:
3671 if (GamePad.
Down(PAD_UP) != 0) {
3672 OpConfigPt[13] -= 2;
3675 if (GamePad.
Down(PAD_DOWN) != 0) {
3676 OpConfigPt[13] += 2;
3679 if (GamePad.
Down(PAD_LEFT) != 0) {
3680 OpConfigPt[12] -= 4;
3683 if (GamePad.
Down(PAD_RIGHT) != 0) {
3684 OpConfigPt[12] += 4;
3687 if (OpConfigPt[13] < -32) {
3688 OpConfigPt[13] = -32;
3691 if (OpConfigPt[13] > 32) {
3692 OpConfigPt[13] = 32;
3695 if (OpConfigPt[12] < -32) {
3696 OpConfigPt[12] = -32;
3699 if (OpConfigPt[12] > 32) {
3700 OpConfigPt[12] = 32;
3703 if (GamePad.
Down(PAD_SQUARE) != 0) {
3708 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
3709 OptionMenu.
buttons = OPTION_AREA_ROWS;
3713 case OPTION_AREA_ROWS:
3714 if (GamePad.
Down(PAD_DOWN) != 0) {
3715 if (OptionMenu.
cursor / 10 - 1 == 7 && OptionMenu.
cursor % 10 > 1) {
3719 switch (OptionMenu.
cursor / 10 - 1) {
3722 OptionMenu.
buttons = OPTION_AREA_EXIT_BUTTON;
3730 if (GamePad.
Down(PAD_UP) != 0) {
3731 switch (OptionMenu.
cursor / 10 - 1) {
3734 OptionMenu.
buttons = OPTION_AREA_EXIT_BUTTON;
3742 if (GamePad.
Down(PAD_RIGHT) != 0) {
3743 if (OptionMenu.
cursor / 10 - 1 == 6) {
3748 switch (OptionMenu.
cursor / 10 - 1) {
3750 if (OptionMenu.
cursor % 10 == 4) {
3756 if (OptionMenu.
cursor % 10 == 2) {
3760 if (OptionMenu.
cursor / 10 - 1 >= 13) {
3761 OptionMenu.
cursor -= 140;
3764 if (OptionMenu.
cursor / 10 - 1 > 13) {
3774 if (GamePad.
Down(PAD_LEFT) != 0) {
3775 if (OptionMenu.
cursor % 10 != 0) {
3778 int row = OptionMenu.
cursor / 10 - 1;
3782 OptionMenu.
cursor = 0x53;
3788 if (OptionMenu.
cursor / 10 - 1 >= 13) {
3801 if (OptionMenu.
cursor / 10 - 1 != 7) {
3802 if (OptionMenu.
cursor % 10 >= 2) {
3806 if (OptionMenu.
cursor / 10 - 1 == 6) {
3811 if (GamePad.
Down(PAD_CROSS) != 0) {
3812 ComMenuSePlay(MENU_SOUND_CONFIRM);
3814 if (OptionMenu.
cursor / 10 - 1 == 6) {
3815 OptionMenu.
buttons = OPTION_AREA_SCREEN_POS;
3819 }
else if (GamePad.
Down(PAD_CIRCLE) != 0) {
3820 OptionMenu.
step = OPTION_STEP_FADE_OUT;
3822 ComMenuSePlay(MENU_SOUND_REFUSE);
3826 case OPTION_AREA_EXIT_BUTTON:
3827 if (GamePad.
Down(PAD_DOWN) != 0) {
3828 OptionMenu.
buttons = OPTION_AREA_ROWS;
3830 if (OptionMenu.
cursor / 10 - 1 < 7) {
3837 if (GamePad.
Down(PAD_UP) != 0) {
3838 OptionMenu.
buttons = OPTION_AREA_ROWS;
3840 if (OptionMenu.
cursor / 10 - 1 < 7) {
3847 if (GamePad.
Down(PAD_CROSS) != 0) {
3848 OptionMenu.
step = OPTION_STEP_FADE_OUT;
3850 ComMenuSePlay(MENU_SOUND_REFUSE);
3851 }
else if (GamePad.
Down(PAD_SQUARE) != 0) {
3853 }
else if (GamePad.
Down(PAD_TRIANGLE) != 0) {
3854 PrevOptionSetFunc();
3855 }
else if (GamePad.
Down(PAD_CIRCLE) != 0) {
3856 OptionMenu.
step = OPTION_STEP_FADE_OUT;
3858 ComMenuSePlay(MENU_SOUND_REFUSE);
3864 if (old_cursor != OptionMenu.
cursor || old_buttons != OptionMenu.
buttons) {
3865 ComMenuSePlay(MENU_SOUND_CURSOR);
3869 int mes_nos[3] = {OptionMenu.
cursor / 10 + 0x15D, 0x171, 0x16C};
3870 int mes_no = mes_nos[OptionMenu.
buttons];
3872 if (OptionMenu.
buttons == OPTION_AREA_ROWS) {
3873 int row = OptionMenu.
cursor / 10 - 1;
3884 if (CommonMenuMes2.
mes_made != mes_no) {
3895int MenuOptionKey() {
3898 switch (OptionMenu.
step) {
3899 case OPTION_STEP_FADE_IN:
3903 if (ReadBGSync() == 0) {
3905 {
"#frame_image_option#640#448#4", 0, 0},
3912 textures[1].
name = (
char *) GetPackFile((u_int *) file->
buffer,
"option.img", NULL);
3913 TexManager.DeleteTextureBlock(OptionMenu.
block_no);
3914 TexManager.CleanUpTextureList();
3915 TexManager.LoadTextureBlockEX(-1, textures);
3916 MenuOption = TexManager.GetTexture(
"option2", -1);
3918 if (OptionMenu.
mode == OPTION_OPEN_TITLE) {
3919 InitMenuMesSet(MENU_MES_SET_ALLMENU, (
short *) GetPackFile((u_int *) file->
buffer,
"allmenu.mes", NULL));
3928 OptionMenu.
step = OPTION_STEP_RUN;
3933 case OPTION_STEP_FADE_OUT:
3942 int old_cursor = OptionMenu.
cursor;
3943 int old_buttons = OptionMenu.
buttons;
3945 if (GamePad.
Down(PAD_L2 | PAD_R2 | PAD_L1 | PAD_R1) != 0) {
3946 if (OptionMenu.
cursor / 10 - 1 < 6) {
3954 case OPTION_AREA_ROWS:
3955 if (GamePad.
Down(PAD_DOWN) != 0) {
3956 switch (OptionMenu.
cursor / 10 - 1) {
3959 OptionMenu.
buttons = OPTION_AREA_EXIT_BUTTON;
3967 if (GamePad.
Down(PAD_UP) != 0) {
3968 switch (OptionMenu.
cursor / 10 - 1) {
3971 OptionMenu.
buttons = OPTION_AREA_EXIT_BUTTON;
3979 if (GamePad.
Down(PAD_RIGHT) != 0) {
3982 switch (OptionMenu.
cursor / 10 - 1) {
3984 if (OptionMenu.
cursor % 10 == 4) {
3990 if (OptionMenu.
cursor % 10 == 2) {
3994 if (OptionMenu.
cursor / 10 - 1 >= 12) {
3995 OptionMenu.
cursor -= 120;
4003 if (GamePad.
Down(PAD_LEFT) != 0) {
4004 if (OptionMenu.
cursor % 10 != 0) {
4007 int row = OptionMenu.
cursor / 10 - 1;
4011 OptionMenu.
cursor = 0x49;
4026 if (OptionMenu.
cursor / 10 - 1 != 6 && OptionMenu.
cursor % 10 >= 2) {
4030 if (GamePad.
Down(PAD_CROSS) != 0) {
4031 ComMenuSePlay(MENU_SOUND_CONFIRM);
4036 case OPTION_AREA_EXIT_BUTTON:
4037 if (GamePad.
Down(PAD_DOWN) != 0) {
4038 OptionMenu.
buttons = OPTION_AREA_ROWS;
4040 if (OptionMenu.
cursor / 10 - 1 < 6) {
4047 if (GamePad.
Down(PAD_UP) != 0) {
4048 OptionMenu.
buttons = OPTION_AREA_ROWS;
4050 if (OptionMenu.
cursor / 10 - 1 < 6) {
4057 if (GamePad.
Down(PAD_CROSS) != 0) {
4058 OptionMenu.
step = OPTION_STEP_FADE_OUT;
4060 ComMenuSePlay(MENU_SOUND_REFUSE);
4061 }
else if (GamePad.
Down(PAD_SQUARE) != 0) {
4063 }
else if (GamePad.
Down(PAD_TRIANGLE) != 0) {
4064 PrevOptionSetFunc();
4070 if (old_cursor != OptionMenu.
cursor || old_buttons != OptionMenu.
buttons) {
4071 ComMenuSePlay(MENU_SOUND_CURSOR);
4074 if (GamePad.
Down(PAD_CIRCLE) != 0) {
4075 OptionMenu.
step = OPTION_STEP_FADE_OUT;
4077 ComMenuSePlay(MENU_SOUND_REFUSE);
4080 int mes_no = OptionMenu.
cursor / 10 + 0x15D;
4082 if (OptionMenu.
buttons == OPTION_AREA_EXIT_BUTTON) {
4086 if (CommonMenuMes2.
mes_made != mes_no) {
4099void DrawMenuOption() {
4106 MenuTextureReload(OptionMenu.
block_no);
4109 switch (OptionMenu.
step) {
4110 case OPTION_STEP_FADE_IN:
4113 case OPTION_STEP_FADE_OUT:
4116 case OPTION_STEP_RUN:
4121 if (alpha >= 0x80) {
4129 int row = OptionMenu.
cursor / 10 - 1;
4130 int column = OptionMenu.
cursor % 10;
4139 OptionMenu.
page_x += ((float) page_x - OptionMenu.
page_x) / 4.0f;
4140 int x = (int) OptionMenu.
page_x;
4142 if (OptionMenu.
buttons != OPTION_AREA_SCREEN_POS) {
4143 OptionMenuDraw(x, 0x56, 0x1AE, 0x128, alpha);
4150 DrawOptionLRCur(right, alpha);
4157 case OPTION_AREA_EXIT_BUTTON:
4162 target_x = column * 0x47 + 0x15C;
4166 target_x = column * 0x24 + 0x15C;
4173 target_y = row * 0x1E + 0x56;
4175 target_y = (row - 7) * 0x1E + 0x56;
4186 case OPTION_AREA_EXIT_BUTTON:
4192 if (row == 7 && column != 3) {
4199 switch (OptionMenu.
step) {
4200 case OPTION_STEP_FADE_IN:
4201 case OPTION_STEP_FADE_OUT:
4204 static int OpMenuWakuCnt = 0;
4205 static int OptionCurCnt = 0;
4206 int left = (int) ((
float) (target_x + 0x14) + 0.2f * OpMenuWakuCnt);
4207 int top = (int) ((
float) (target_y - 9) + 0.2f * OpMenuWakuCnt);
4208 int right_x = (int) ((
float) (target_x + 0x14 + width) - 0.2f * OpMenuWakuCnt);
4209 int bottom = (int) ((
float) (target_y + 0x11) - 0.2f * OpMenuWakuCnt);
4210 RECT corner = {0xB2, 0xF8, 0x10, 0x10};
4212 if (OptionMenu.
buttons != OPTION_AREA_SCREEN_POS) {
4219 if (OpMenuWakuCnt < 0 || OpMenuWakuCnt >= 30) {
4223 float hand_x = OptionMenu.
cursor_x + 7.0f * cosf(0.0805536583f * OptionCurCnt);
4224 float hand_y = OptionMenu.
cursor_y + 5.0f * sinf(0.116355285f * OptionCurCnt);
4225 CRect_i_ hand(0xD2, 0xF8, 0x20, 0x20);
4226 DrawMenu2DSprite(MenuOption,
CRect_i_((
int) (5.0f + hand_x), (
int) (3.0f + hand_y), 0x20, 0x20), hand, 0, 0, 0, (alpha * 100) >> 7);
4227 DrawMenu2DSprite(MenuOption,
CRect_i_((
int) hand_x, (
int) hand_y, 0x20, 0x20), hand, alpha);
4232 if (OptionCurCnt > 0x107AC0 || OptionCurCnt < 0) {
4240 if (OptionMenu.
buttons == OPTION_AREA_SCREEN_POS) {
4241 AllFadeForMenu(0x20);
4242 DrawOptionScreenWaku();
4245 if (OptionMenu.
step != OPTION_STEP_RUN) {
4251 switch (OptionMenu.
mode) {
4252 case OPTION_OPEN_TITLE: {
4259 DrawMenu2DSprite(MenuOption,
CRect_i_(0x50, 0x28, 0xAA, 0x28),
CRect_i_(0xB3, 0x118, 0xAA, 0x28), alpha);
4260 GetMainMenuRightHelpWinLangOffset(win_x, win_y, win_w, win_h);
4261 MenuHelpWinDraw((
int) win_x, (
int) win_y, win_w, win_h, alpha);
4262 GetMainMenuRightHelpMsgLangOffset(text_x, text_y);
4264 MenuTextureReload(CommonMenuMes2.
tex_block);
4265 DrawMenuClsMes(&CommonMenuMes2, (
int) (win_x + text_x), (
int) (win_y + text_y));
4273void DrawMenuOption() {
4280 MenuTextureReload(OptionMenu.
block_no);
4283 switch (OptionMenu.
step) {
4284 case OPTION_STEP_FADE_IN:
4287 case OPTION_STEP_FADE_OUT:
4290 case OPTION_STEP_RUN:
4295 if (alpha >= 0x80) {
4303 int row = OptionMenu.
cursor / 10 - 1;
4304 int column = OptionMenu.
cursor % 10;
4313 OptionMenu.
page_x += ((float) page_x - OptionMenu.
page_x) / 4.0f;
4314 int x = (int) OptionMenu.
page_x;
4315 OptionMenuDraw(x, 0x5A, 0x1AE, 0x122, alpha);
4322 DrawOptionLRCur(right, alpha);
4327 case OPTION_AREA_EXIT_BUTTON:
4332 target_x = column * 0x47 + 0x15C;
4336 target_x = column * 0x24 + 0x15C;
4343 target_y = row * 0x1E + 0x5A;
4345 target_y = (row - 6) * 0x1E + 0x5A;
4356 case OPTION_AREA_EXIT_BUTTON:
4362 if (row == 6 && column != 3) {
4369 switch (OptionMenu.
step) {
4370 case OPTION_STEP_FADE_IN:
4371 case OPTION_STEP_FADE_OUT:
4374 static int OpMenuWakuCnt = 0;
4375 static int OptionCurCnt = 0;
4376 int left = (int) ((
float) (target_x + 0x14) + 0.2f * OpMenuWakuCnt);
4377 int top = (int) ((
float) (target_y - 9) + 0.2f * OpMenuWakuCnt);
4378 int right_x = (int) ((
float) (target_x + 0x14 + width) - 0.2f * OpMenuWakuCnt);
4379 int bottom = (int) ((
float) (target_y + 0x11) - 0.2f * OpMenuWakuCnt);
4380 RECT corner = {0xB2, 0xF8, 0x10, 0x10};
4387 if (OpMenuWakuCnt < 0 || OpMenuWakuCnt >= 30) {
4391 float hand_x = OptionMenu.
cursor_x + 7.0f * cosf(0.0805536583f * OptionCurCnt);
4392 float hand_y = OptionMenu.
cursor_y + 5.0f * sinf(0.116355285f * OptionCurCnt);
4393 CRect_i_ hand(0xD2, 0xF8, 0x20, 0x20);
4394 DrawMenu2DSprite(MenuOption,
CRect_i_((
int) (5.0f + hand_x), (
int) (3.0f + hand_y), 0x20, 0x20), hand, 0, 0, 0, (alpha * 100) >> 7);
4395 DrawMenu2DSprite(MenuOption,
CRect_i_((
int) hand_x, (
int) hand_y, 0x20, 0x20), hand, alpha);
4398 if (OptionCurCnt > 0x107AC0 || OptionCurCnt < 0) {
4406 if (OptionMenu.
step != OPTION_STEP_RUN) {
4412 switch (OptionMenu.
mode) {
4413 case OPTION_OPEN_TITLE: {
4420 DrawMenu2DSprite(MenuOption,
CRect_i_(0x50, 0x28, 0xAA, 0x28),
CRect_i_(0xB3, 0x118, 0xAA, 0x28), alpha);
4421 GetMainMenuRightHelpWinLangOffset(win_x, win_y, win_w, win_h);
4422 MenuHelpWinDraw((
int) win_x, (
int) win_y, win_w, win_h, alpha);
4423 GetMainMenuRightHelpMsgLangOffset(text_x, text_y);
4425 MenuTextureReload(CommonMenuMes2.
tex_block);
4426 DrawMenuClsMes(&CommonMenuMes2, (
int) (win_x + text_x), (
int) (win_y + text_y));
4435int OptionMenuFadeOutStart() {
4438 if (OptionMenu.
step == OPTION_STEP_FADE_OUT) {
4445int InitMenuSave(
int mode,
int block_no, u_long128 *buffer) {
4451 if (buffer == NULL) {
4452 data = (u_long128 *) read_buffer;
4455 data = MenuCalcBufAlignment(data);
4456 SaveMenu.
mode = mode;
4458 SaveMenu.
result = MENU_SAVE_RUNNING;
4464 LoadFileBGMenuData(
"savetex.pak", data);
4470 switch (SaveMenu.
mode) {
4471 case SAVE_MENU_MODE_LOAD:
4474 SaveMenu.
key_no = SAVE_KEY_MC_SELECT;
4477 case SAVE_MENU_MODE_SAVE:
4478 SaveMenu.
key_no = SAVE_KEY_MC_SELECT;
4482 case SAVE_MENU_MODE_ENDING:
4483 case SAVE_MENU_MODE_ENDING_NO_CLEAR:
4484 clear = SaveMenu.
mode == SAVE_MENU_MODE_ENDING;
4487 GameClearFlag = SaveMenu.
mode == SAVE_MENU_MODE_ENDING;
4488 SaveMenu.
mode = SAVE_MENU_MODE_ENDING;
4491 SaveMenu.
key_no = SAVE_KEY_AFTER_ENDING;
4499 CommonMenuMes2.
auto_pos = MES_POS_CENTRE;
4513static void ExitSaveSelect() {
4519 CommonMenuMes2.
auto_pos = MES_POS_NONE;
4521 switch (SaveMenu.
mode) {
4522 case SAVE_MENU_MODE_LOAD:
4531 if (config != NULL) {
4541 case SAVE_MENU_MODE_SAVE:
4543 case SAVE_MENU_MODE_ENDING:
4553int SaveMenuKeySaveCheck();
4554int SaveMenuKeySaveDecide();
4555int SaveMenuKeySave();
4556int SaveMenuKeyEndSave();
4557int SaveMenuKeyLoadDecide();
4558int SaveMenuKeyLoad();
4559int SaveMenuKeyArart();
4560int SaveMenuKeyNewDir();
4561int SaveMenuKeyNewDirSelect();
4562int SaveMenuKeyFormat();
4563int SaveMenuKeyUnFormat();
4564int SaveMenuKeyDifVersion();
4565int SaveMenuKeyDelete();
4566int SaveMenuKeyCopy();
4567int SaveMenuKeyAfterEnding();
4568int SaveMenuKeySaveEnding();
4569int SaveMenuKeySaveDecideEnding();
4570int SaveMenuKeyEndSaveEnding();
4573int (*SaveMenuFunc[26])() = {
4576 SaveMenuKeyModeSelect,
4577 SaveMenuKeyMcSelect,
4578 SaveMenuKeyCheckMcType,
4580 SaveMenuKeyLoadConfig,
4581 SaveMenuKeyFileSelect,
4582 SaveMenuKeySaveCheck,
4583 SaveMenuKeySaveDecide,
4586 SaveMenuKeyLoadDecide,
4590 SaveMenuKeyNewDirSelect,
4592 SaveMenuKeyUnFormat,
4593 SaveMenuKeyDifVersion,
4596 SaveMenuKeyAfterEnding,
4597 SaveMenuKeySaveEnding,
4598 SaveMenuKeySaveDecideEnding,
4599 SaveMenuKeyEndSaveEnding,
4616 result = McAccess.
Step();
4619 if (prev_func_no == now_func_no) {
4620 last_error = &McAccess.
error;
4622 switch (now_func_no) {
4623 case MC_OPERATION_FORMAT:
4625 SaveMenu.
key_no = SAVE_KEY_ALERT;
4626 SaveMenu.
alert_no = SAVE_ALERT_FORMAT_FAILED;
4631 case MC_OPERATION_MAKE_DIR:
4632 case MC_OPERATION_SAVE:
4634 SaveMenu.
key_no = SAVE_KEY_ALERT;
4635 SaveMenu.
alert_no = SAVE_ALERT_SAVE_FAILED;
4640 case MC_OPERATION_LOAD:
4642 SaveMenu.
key_no = SAVE_KEY_ALERT;
4643 SaveMenu.
alert_no = SAVE_ALERT_LOAD_FAILED;
4648 case MC_OPERATION_GET_DIR:
4649 last_error->
code = MC_ERROR_NONE;
4650 case MC_OPERATION_GET_ALL_SAVE_FILE_INFO:
4652 SaveMenu.
key_no = SAVE_KEY_ALERT;
4653 SaveMenu.
alert_no = SAVE_ALERT_CARD_ERROR;
4658 switch (last_error->
code) {
4661 case MC_ERROR_VERSION:
4663 SaveMenu.
key_no = SAVE_KEY_DIF_VERSION;
4666 case MC_ERROR_UNK_2:
4667 case MC_ERROR_SHORT_READ:
4670 SaveMenu.
key_no = SAVE_KEY_ALERT;
4671 SaveMenu.
alert_no = SAVE_ALERT_CARD_FULL;
4678 switch (prev_func_no) {
4679 case MC_OPERATION_GET_ALL_SAVE_FILE_INFO:
4681 case MC_OPERATION_LOAD:
4682 switch (SaveMenu.
mode) {
4683 case SAVE_MENU_MODE_LOAD:
4684 SaveMenu.
key_no = SAVE_KEY_FADE_OUT;
4688 case SAVE_MENU_MODE_SAVE:
4691 case SAVE_MENU_MODE_ENDING:
4696 case MC_OPERATION_DELETE:
4697 error = &McAccess.
error;
4699 switch (error->
code) {
4700 case MC_ERROR_VERSION:
4701 McAccess.
SetFuncNo(MC_OPERATION_GET_ALL_SAVE_FILE_INFO);
4708 if (McAccess.
step > 49) {
4712 error->
code = MC_ERROR_NONE;
4716 McAccess.
SetFuncNo(MC_OPERATION_GET_ALL_SAVE_FILE_INFO);
4721 case MC_OPERATION_SAVE:
4722 ComMenuSePlay(SE_SAVE_START);
4723 McAccess.
SetFuncNo(MC_OPERATION_GET_ALL_SAVE_FILE_INFO);
4729 case MC_OPERATION_IDLE:
4730 SaveMenuFunc[SaveMenu.
key_no]();
4735 if (GamePad.
Down2(PAD_R1)) {
4736 McAccess.
SetFuncNo(MC_OPERATION_UNFORMAT);
4737 ComMenuSePlay(MENU_SOUND_CONFIRM);
4740 if (GamePad.
Down2(PAD_TRIANGLE)) {
4741 McAccess.
SetFuncNo(MC_OPERATION_FORMAT);
4742 ComMenuSePlay(MENU_SOUND_CONFIRM);
4745 if (GamePad.
Down2(PAD_CROSS)) {
4746 McAccess.
SetFuncNo(MC_OPERATION_WRITE_TEST);
4747 ComMenuSePlay(MENU_SOUND_CONFIRM);
4751 if (GamePad.
Down2(PAD_L3)) {
4752 McAccess.
SetFuncNo(MC_OPERATION_CONVERT);
4753 ComMenuSePlay(MENU_SOUND_CONFIRM);
4762 msg_no = GetSaveMenuMsgNo();
4764 if (CommonMenuMes2.
mes_made != msg_no) {
4765 mes_value = SaveMenu.
file_no + 1;
4767 switch (msg_no - 250) {
4774 mes_value = McAccess.
port + 1;
4778 CommonMenuMes2.
value = mes_value;
4780 if (msg_no == 299) {
4784 printf(
"msgno = %d\n", msg_no);
4791void DrawMenuSave(
char *frame_name) {
4798 switch (SaveMenu.
mode) {
4799 case SAVE_MENU_MODE_LOAD:
4800 case SAVE_MENU_MODE_SAVE:
4802 case SAVE_MENU_MODE_ENDING:
4803 AllFillBoxForMenu(0, 0, 0, 0x80);
4809 switch (SaveMenu.
key_no) {
4810 case SAVE_KEY_FADE_IN:
4818 case SAVE_KEY_FADE_OUT:
4828 MenuTextureReload(SaveMenu.
block_no);
4829 float y = 150.0f - 150.0f * SaveMenu.
file_no;
4832 float board_x = 140.0f;
4835 switch (SaveMenu.
key_no) {
4836 case SAVE_KEY_SAVE_DECIDE:
4837 case SAVE_KEY_LOAD_DECIDE:
4839 case SAVE_KEY_ALERT:
4840 case SAVE_KEY_FORMAT:
4841 case SAVE_KEY_DIF_VERSION:
4848 switch (SaveMenu.
key_no) {
4849 case SAVE_KEY_FILE_SELECT:
4850 case SAVE_KEY_SAVE_CHECK:
4851 case SAVE_KEY_SAVE_DECIDE:
4852 case SAVE_KEY_LOAD_DECIDE:
4858 if (SaveMenu.
key_no == SAVE_KEY_FADE_OUT && SaveMenu.
mode == SAVE_MENU_MODE_LOAD && SaveMenu.
loaded != 0) {
4862 if (show != 0 && (
unsigned int) (McAccess.
GetFuncNo() - MC_OPERATION_GET_ALL_SAVE_FILE_INFO) > 1U) {
4865 if (cards != NULL) {
4866 for (
int i = 0; i < 12; i++) {
4870 if (file->
state == 0) {
4871 DrawNewFileTemplete((
int) board_x, (
int) y, alpha);
4873 DrawSaveBoard(file, SaveMenuMojiTextbl, (
int) board_x, (
int) y, bright, alpha);
4880 printf(
"mcinfo is NULL\n");
4884 float text_pos[2] = {-20.0f, -20.0f};
4885 CommonMenuMes2.
auto_pos = MES_POS_NONE;
4888 case MC_OPERATION_IDLE:
4889 switch (SaveMenu.
key_no) {
4890 case SAVE_KEY_MODE_SELECT:
4891 text_pos[0] = 240.0f;
4892 text_pos[1] = 154.0f;
4893 CommonMenuMes2.
auto_pos = MES_POS_CENTRE;
4895 case SAVE_KEY_NEW_DIR:
4896 case SAVE_KEY_NEW_DIR_SELECT:
4897 case SAVE_KEY_MC_SELECT:
4898 case SAVE_KEY_FORMAT:
4899 text_pos[0] = 184.0f;
4900 text_pos[1] = 152.0f;
4901 CommonMenuMes2.
auto_pos = MES_POS_CENTRE;
4903 case SAVE_KEY_SAVE_DECIDE:
4904 case SAVE_KEY_LOAD_DECIDE:
4905 text_pos[0] = 246.0f;
4906 text_pos[1] = 156.0f;
4907 CommonMenuMes2.
auto_pos = MES_POS_CENTRE;
4909 case SAVE_KEY_DIF_VERSION:
4910 text_pos[0] = 196.0f;
4911 text_pos[1] = 140.0f;
4912 CommonMenuMes2.
auto_pos = MES_POS_CENTRE;
4914 case SAVE_KEY_ALERT:
4915 text_pos[0] = 230.0f;
4916 text_pos[1] = 140.0f;
4917 CommonMenuMes2.
auto_pos = MES_POS_CENTRE;
4918 case SAVE_KEY_AFTER_ENDING:
4919 text_pos[0] = 196.0f;
4920 text_pos[1] = 140.0f;
4921 CommonMenuMes2.
auto_pos = MES_POS_CENTRE;
4922 case SAVE_KEY_END_SAVE_ENDING:
4923 case SAVE_KEY_END_SAVE:
4924 text_pos[0] = 196.0f;
4925 text_pos[1] = 140.0f;
4926 CommonMenuMes2.
auto_pos = MES_POS_CENTRE;
4931 case MC_OPERATION_DELETE:
4932 text_pos[0] = 216.0f;
4933 text_pos[1] = 180.0f;
4934 CommonMenuMes2.
auto_pos = MES_POS_CENTRE;
4937 text_pos[0] = 184.0f;
4938 text_pos[1] = 152.0f;
4939 CommonMenuMes2.
auto_pos = MES_POS_CENTRE;
4943 MenuTextureReload(CommonMenuMes2.
tex_block);
4954 DrawMenuClsMes(&CommonMenuMes2, (
int) text_pos[0], (
int) text_pos[1]);
4959 switch (SaveMenu.
key_no) {
4960 case SAVE_KEY_MODE_SELECT:
4961 case SAVE_KEY_MC_SELECT:
4964 case SAVE_KEY_FILE_SELECT:
4965 if (McAccess.
GetFuncNo() != MC_OPERATION_GET_ALL_SAVE_FILE_INFO && McAccess.
GetFuncNo() != MC_OPERATION_SAVE) {
4973 if (0 < hand_x && 0 < hand_y) {
4975 RECT hand = {0x160, 0xD6, 0x20, 0x20};
4976 float draw_x = (float) hand_x + 7.0f * cosf(0.0805536583f * ct);
4977 float draw_y = (float) hand_y + 5.0f * sinf(0.116355285f * ct);
4978 CRect_i_ source(0x160, 0xD6, 0x20, 0x20);
4979 DrawMenu2DSprite(SaveBoard,
CRect_i_((
int) (5.0f + draw_x), (
int) (3.0f + draw_y), hand.
width, hand.
height), source, 0, 0, 0, alpha);
4980 DrawMenu2DSprite(SaveBoard,
CRect_i_((
int) draw_x, (
int) draw_y, hand.
width, hand.
height), source, alpha);
4983 if (!((
float) ct < 105299.0f)) {
4988 switch (SaveMenu.
key_no) {
4989 case SAVE_KEY_FADE_OUT:
4990 case SAVE_KEY_MC_SELECT:
4991 case SAVE_KEY_FADE_IN:
4999 switch (SaveMenu.
mode) {
5000 case SAVE_MENU_MODE_LOAD:
5001 DrawMenu2DSprite(SaveBoard,
CRect_i_(0x46, 0x32, 0x3A, 0x27),
CRect_i_(0x110, 0xD8, 0x3A, 0x28), alpha);
5003 DrawMenu2DSprite(SaveBoard,
CRect_i_(0x86, 0x37, 0x50, 0x1E),
CRect_i_(0x110, 0x100, 0x50, 0x1E), alpha);
5005 DrawMenu2DSprite(SaveBoard,
CRect_i_(0x86, 0x37, 0x4A, 0x1E),
CRect_i_(0x110, 0x100, 0x4A, 0x1E), alpha);
5008 case SAVE_MENU_MODE_ENDING:
5009 DrawMainMenuIcon(0x46, 0x32, 5, 1, 0x80, alpha);
5014static int SaveMenuKeyFadeIn() {
5016 SaveMenu.
key_no = SAVE_KEY_FILE_SELECT;
5023static int SaveMenuKeyFadeOut() {
5028 SaveMenu.
result = MENU_SAVE_LOADED;
5030 SaveMenu.
result = MENU_SAVE_CLOSED;
5037static int SaveMenuKeyModeSelect() {
5038 if (GamePad.
Down(PAD_UP | PAD_DOWN)) {
5046 if (GamePad.
Down(PAD_CROSS)) {
5053 SaveMenu.
key_no = SAVE_KEY_MC_SELECT;
5055 ComMenuSePlay(MENU_SOUND_CONFIRM);
5059 if (GamePad.
Down(PAD_CIRCLE)) {
5060 SaveMenu.
key_no = SAVE_KEY_FADE_OUT;
5063 ComMenuSePlay(MENU_SOUND_REFUSE);
5070static int SaveMenuKeyMcSelect() {
5075 if (GamePad.
Down(PAD_UP | PAD_DOWN)) {
5083 if (prev_slot != SaveMenu.
file_no) {
5084 ComMenuSePlay(MENU_SOUND_CURSOR);
5087 if (GamePad.
Down(PAD_CIRCLE)) {
5088 switch (SaveMenu.
mode) {
5089 case SAVE_MENU_MODE_LOAD:
5090 SaveMenu.
key_no = SAVE_KEY_FADE_OUT;
5093 case SAVE_MENU_MODE_SAVE:
5094 SaveMenu.
key_no = SAVE_KEY_FADE_OUT;
5097 case SAVE_MENU_MODE_ENDING:
5098 SaveMenu.
key_no = SAVE_KEY_FADE_OUT;
5104 ComMenuSePlay(MENU_SOUND_REFUSE);
5109 SaveMenu.
key_no = SAVE_KEY_CHECK_MC_TYPE;
5111 McAccess.
SetFuncNo(MC_OPERATION_SEARCH_TYPE);
5112 ComMenuSePlay(MENU_SOUND_CONFIRM);
5116 if (GamePad.
Down2(PAD_CROSS) && GamePad.
Down2(PAD_CIRCLE)) {
5117 SaveMenu.
key_no = SAVE_KEY_UNFORMAT;
5118 McAccess.
SetFuncNo(MC_OPERATION_UNFORMAT);
5120 ComMenuSePlay(MENU_SOUND_CONFIRM);
5126static int SaveMenuKeyCheckMcType() {
5129 card = &McAccess.
card[McAccess.
port];
5132 switch (card->
type) {
5134 McAccess.
SetFuncNo(MC_OPERATION_GET_DIR);
5135 SaveMenu.
key_no = SAVE_KEY_CHECK_MC;
5138 SaveMenu.
key_no = SAVE_KEY_ALERT;
5139 SaveMenu.
alert_no = SAVE_ALERT_NO_CARD;
5143 SaveMenu.
key_no = SAVE_KEY_ALERT;
5144 SaveMenu.
alert_no = SAVE_ALERT_NO_CARD;
5150static int SaveMenuKeyCheckMc() {
5153 printf(
"check end !!\n");
5154 card = &McAccess.
card[McAccess.
port];
5155 SaveMenu.
alert_no = SAVE_ALERT_NONE;
5159 SaveMenu.
alert_no = SAVE_ALERT_CARD_MISSING;
5160 SaveMenu.
key_no = SAVE_KEY_MC_SELECT;
5165 if (card->
type != sceMcTypePS2) {
5166 printf(
"type is not PS2\n");
5167 SaveMenu.
alert_no = SAVE_ALERT_CARD_MISSING;
5168 SaveMenu.
key_no = SAVE_KEY_MC_SELECT;
5174 SaveMenu.
alert_no = SAVE_ALERT_NO_SAVE_DATA;
5175 SaveMenu.
key_no = SAVE_KEY_ALERT;
5180 SaveMenu.
alert_no = SAVE_ALERT_NO_SPACE_DIR;
5181 SaveMenu.
key_no = SAVE_KEY_ALERT;
5185 if (SaveMenu.
mode == SAVE_MENU_MODE_ENDING) {
5186 SaveMenu.
key_no = SAVE_KEY_SAVE_ENDING;
5187 }
else if (SaveMenu.
access_kind == SAVE_ACCESS_LOAD) {
5188 SaveMenu.
key_no = SAVE_KEY_LOAD_CONFIG;
5189 McAccess.
SetFuncNo(MC_OPERATION_LOAD_CONFIG);
5191 McAccess.
SetFuncNo(MC_OPERATION_GET_ALL_SAVE_FILE_INFO);
5192 SaveMenu.
key_no = SAVE_KEY_FILE_SELECT;
5199static int SaveMenuKeyLoadConfig() {
5200 McAccess.
SetFuncNo(MC_OPERATION_GET_ALL_SAVE_FILE_INFO);
5201 SaveMenu.
key_no = SAVE_KEY_FILE_SELECT;
5211static int SaveMenuKeyFileSelect() {
5217 if (GamePad.
Down(PAD_DOWN)) {
5225 if (GamePad.
Down(PAD_UP) && 0 < SaveMenu.
file_no) {
5229 if (prev_file != SaveMenu.
file_no) {
5230 ComMenuSePlay(MENU_SOUND_CURSOR);
5233 if (GamePad.
Down(PAD_CIRCLE)) {
5234 SaveMenu.
key_no = SAVE_KEY_MC_SELECT;
5237 ComMenuSePlay(MENU_SOUND_REFUSE);
5241 if (GamePad.
Down(PAD_CROSS)) {
5243 case SAVE_ACCESS_SAVE:
5244 SaveMenu.
key_no = SAVE_KEY_SAVE_CHECK;
5245 McAccess.
SetFuncNo(MC_OPERATION_SEARCH_TYPE);
5247 case SAVE_ACCESS_LOAD:
5251 SaveMenu.
key_no = SAVE_KEY_LOAD_DECIDE;
5253 ComMenuSePlay(MENU_SOUND_REFUSE);
5259 ComMenuSePlay(MENU_SOUND_CONFIRM);
void Save(int georama_no, CSaveData *save_data)
int GetNextParts(int index)
int GetNextPartsNum(int index)
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)
void SetFuncNo(int func_no)
SAVEDATA_INFO file_info[MC_SAVE_FILE_MAX]
MC_CARD_INFO card[MC_CARD_MAX]
SV_GRD_NPC * GetGrdNPCData(int map_no, int npc_no)
CMenuCursor * GetMenuCursor()
CDngStatusData * GetDngStatus()
s16 * GetElemData(int georama_no)
int GetGameIntFlag(int flag_no)
void SetStereoMode(int mode)
void SetBuff(short *buff)
short * GetTextLineDataTop_system(int line)
MES_LINE_POS line_pos[10]
int MakeMesWin(int mes_no)
EDITPARTS_ELEMENT elements[6]
EDIT_CHIP_ATTACH_DATA elements[6]