1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
6#pragma argument_flag_ones 58, 65, 66, 144, 209, 238, 377, 387, 414, 419
7#pragma argument_flag_ones 447, 448, 499, 575, 577, 713, 729, 744, 746, 748
8#pragma argument_flag_ones 750
9#pragma argument_flag_ones 752, 753, 763, 765, 766, 792, 803, 816, 818, 827
10#pragma argument_flag_ones 975, 981, 994, 1033, 1054, 1156, 1185, 1325
11#pragma argument_flag_ones 1461, 1463, 1486, 1488, 2014, 2172, 2256, 2267, 2351, 2358
12#pragma argument_flag_ones 2374, 2406, 2407, 2433, 2434, 2441
13#pragma argument_flag_ones 2442, 2471, 2655, 2656, 2725, 2726, 2802, 2803, 2925, 2926
14#pragma argument_flag_ones 2964, 2965, 3099, 3100, 3144, 3156
15#pragma argument_flag_ones 3157, 3164, 3165, 3247, 3587, 3595, 3662, 3663, 3671, 3672
16#pragma argument_flag_ones 3688, 3690, 3696, 3697, 3698, 3730
17#pragma argument_flag_ones 3738, 3739, 3757, 3758, 3784, 3887, 3937, 3939, 4082, 4134
18#pragma argument_flag_ones 4167
21#include "battlemenu.hpp"
31#include "dngstatusdata.hpp"
32#include "dun/gameloop.hpp"
33#include "eastking.hpp"
36#include "mainselect.hpp"
38#include "menu_draw.hpp"
39#include "menu_dungeon.hpp"
40#include "menu_inventory.hpp"
41#include "menu_manual.hpp"
42#include "menu_misc.hpp"
43#include "menu_save.hpp"
44#include "menuiconautoget.hpp"
46#include "monstorunit.hpp"
51#include "weapon_buildup.hpp"
52#include "weaponlevelup.hpp"
54static int GetVisitInfo(
int place,
int menu_mode);
58#include "battle_globals.hpp"
59#include "btactstatus.hpp"
60#include "dataalloc.hpp"
62#include "menuitemstep.hpp"
64#include "shot_effect.hpp"
65#include "userstatus.hpp"
68static void DrawStatusNumberNowAndMax(
int *values,
int x,
int y,
int color,
int alpha);
69static void BattleMenuAppear();
70static int BattleMenuExit();
71static void InitItemTrushStart();
72static int BattleMenuAtoraKey();
73static void BattleMenuOptionKey();
74static void BattleMenuSaveKey();
75static void BattleManualDraw();
76static void InitItemMode(
int mode,
int chara);
77static void InitMenuChara(u_long128 *buffer);
78static void InitWeaponSelect(
int mode,
int chara);
79static int WeaponSelectKey();
80static void WeaponMenuActWepKey();
81static void WeaponMenuAttachWepKey();
82static void WeaponMenuAttachKey();
83static int WorldMapMoveKey();
84static void DrawWorldMap(
int alpha);
98RECT NumberSprite[2] = {
103s16 BtlDrawTbl[2][8] = {
104 {0, 1, 2, 3, 7, 4, 6, 0},
105 {0, 1, 2, 3, 8, 5, 4, 6}
109 {0, 0, {0, 0}, 0.0f, 0.0f},
110 {1, 0, {0, 0}, 0.0f, 0.0f},
111 {2, 0, {0, 0}, 0.0f, 0.0f},
112 {3, 0, {0, 0}, 0.0f, 0.0f},
113 {4, 0, {0, 0}, 0.0f, 0.0f},
114 {5, 0, {0, 0}, 0.0f, 0.0f},
117s16 MenuDefaultWeaponNo[7] = {ITEM_WEAPON_DAGGER_BROKEN, ITEM_WEAPON_WOODENSLINGSHOT_BROKEN, ITEM_WEAPON_MALLET_BROKEN, ITEM_WEAPON_GOLD_RING_BROKEN, ITEM_WEAPON_FIGHTING_STICK_BROKEN, ITEM_WEAPON_MACHINE_GUN_BROKEN, 81};
119s16 MenuCharaWeaponMax[6] = {42, 15, 17, 16, 16, 14};
122 {{0.0f, 0.0f, 0.0f}, 1.0f, {-HALF_PI, 0.0f, 0.62831855f}, {0.0f, 0.028559932f, 0.0f}},
123 {{-0.3f, 0.5f, 0.0f}, 1.4f, {-HALF_PI, 0.0f, 0.62831855f}, {0.0f, 0.028559932f, 0.0f}},
124 {{0.0f, 0.0f, 0.0f}, 0.8f, {-HALF_PI, 0.0f, 0.62831855f}, {0.0f, 0.028559932f, 0.0f}},
125 {{-1.4f, 2.1f, 0.0f}, 4.2f, {-HALF_PI, -0.16453463f, 0.62831855f}, {0.0f, 0.028559932f, 0.0f}},
126 {{-0.8f, 0.7f, 0.0f}, 0.7f, {-HALF_PI, -0.8005375f, 0.62831855f}, {0.0f, 0.028559932f, 0.0f}},
127 {{-0.4f, 0.5f, 0.0f}, 1.0f, {-HALF_PI, 0.0f, 0.62831855f}, {0.0f, 0.028559932f, 0.0f}},
131 {{{0xF5, 0xAB, 0x48, 0x80}, {0x8C, 0x8E, 0x64, 0x80}, {0x57, 0x59, 0x20, 0x80}, {0x1F, 0x2E, 0x2A, 0x80}}},
132 {{{0x7D, 0xB2, 0xFF, 0x80}, {0x73, 0xA1, 0xC6, 0x80}, {0x2E, 0x5B, 0x78, 0x80}, {0x2D, 0x4C, 0x57, 0x80}}},
133 {{{0x69, 0x9E, 0xF7, 0x80}, {0x5F, 0x8D, 0xB2, 0x80}, {0x24, 0x51, 0x6E, 0x80}, {0x0F, 0x2E, 0x39, 0x80}}},
134 {{{0x1D, 0xF7, 0xA1, 0x80}, {0x61, 0xBA, 0x9D, 0x80}, {0x0A, 0x7B, 0x0A, 0x80}, {0x10, 0x44, 0x2F, 0x80}}},
135 {{{0xFE, 0xC4, 0x00, 0x80}, {0x99, 0xA9, 0x63, 0x80}, {0x55, 0x62, 0x00, 0x80}, {0x22, 0x3C, 0x16, 0x80}}},
136 {{{0x21, 0xBF, 0xFD, 0x80}, {0x40, 0xBA, 0xB4, 0x80}, {0x0B, 0x5F, 0x6E, 0x80}, {0x05, 0x44, 0x38, 0x80}}},
137 {{{0xDD, 0x96, 0xFD, 0x80}, {0x91, 0x95, 0xB1, 0x80}, {0x46, 0x4B, 0x6E, 0x80}, {0x1F, 0x32, 0x37, 0x80}}},
138 {{{0xED, 0x00, 0x00, 0x80}, {0x98, 0x6F, 0x64, 0x80}, {0x65, 0x00, 0x00, 0x80}, {0x37, 0x2C, 0x24, 0x80}}},
139 {{{0x1F, 0x2E, 0xF1, 0x80}, {0x54, 0x94, 0xC9, 0x80}, {0x0D, 0x1B, 0x7D, 0x80}, {0x1A, 0x42, 0x58, 0x80}}},
140 {{{0xEE, 0xBE, 0x00, 0x80}, {0xB3, 0xD7, 0x62, 0x80}, {0x65, 0x6E, 0x00, 0x80}, {0x42, 0x69, 0x23, 0x80}}},
141 {{{0x0F, 0x95, 0x00, 0x80}, {0x4D, 0xD7, 0x65, 0x80}, {0x06, 0x57, 0x00, 0x80}, {0x17, 0x69, 0x24, 0x80}}},
142 {{{0xEE, 0x15, 0xF1, 0x80}, {0xAB, 0x91, 0xB9, 0x80}, {0x65, 0x0C, 0x7D, 0x80}, {0x3E, 0x40, 0x50, 0x80}}},
143 {{{0x38, 0xC3, 0x0B, 0x80}, {0x59, 0xC4, 0x6D, 0x80}, {0x15, 0x66, 0x00, 0x80}, {0x1B, 0x55, 0x2A, 0x80}}},
144 {{{0x77, 0x56, 0xE5, 0x80}, {0x6F, 0x94, 0xA1, 0x80}, {0x2C, 0x2B, 0x6E, 0x80}, {0x22, 0x3D, 0x3E, 0x80}}},
145 {{{0x52, 0xC2, 0xED, 0x80}, {0x62, 0xC3, 0xA7, 0x80}, {0x1F, 0x66, 0x71, 0x80}, {0x1E, 0x55, 0x40, 0x80}}},
146 {{{0xB0, 0x7D, 0x0C, 0x80}, {0x82, 0x97, 0x6A, 0x80}, {0x41, 0x41, 0x02, 0x80}, {0x29, 0x3E, 0x24, 0x80}}},
147 {{{0x8C, 0xEE, 0x08, 0x80}, {0x76, 0xA8, 0x69, 0x80}, {0x34, 0x85, 0x00, 0x80}, {0x25, 0x47, 0x24, 0x80}}},
148 {{{0xCC, 0x80, 0x07, 0x80}, {0x8C, 0xA2, 0x63, 0x80}, {0x4C, 0x42, 0x00, 0x80}, {0x2D, 0x43, 0x21, 0x80}}},
149 {{{0x24, 0xD4, 0xF3, 0x80}, {0x52, 0x9C, 0xB3, 0x80}, {0x0D, 0x76, 0x73, 0x80}, {0x18, 0x40, 0x45, 0x80}}},
150 {{{0xC0, 0xBC, 0xBC, 0x80}, {0x87, 0xC3, 0xA1, 0x80}, {0x47, 0x62, 0x59, 0x80}, {0x2B, 0x55, 0x1A, 0x80}}},
151 {{{0xCC, 0xB1, 0x04, 0x80}, {0x8C, 0xC3, 0x54, 0x80}, {0x4C, 0x5C, 0x00, 0x80}, {0x2C, 0x55, 0x1A, 0x80}}},
152 {{{0xD4, 0x38, 0xCC, 0x80}, {0x8E, 0x86, 0xA2, 0x80}, {0x4F, 0x1A, 0x61, 0x80}, {0x2D, 0x36, 0x3E, 0x80}}},
153 {{{0x40, 0xC1, 0x82, 0x80}, {0x00, 0x81, 0xFF, 0x80}, {0x40, 0xC1, 0x82, 0x80}, {0x00, 0x81, 0xFF, 0x80}}},
154 {{{0xFF, 0x00, 0xC6, 0x80}, {0x3F, 0x00, 0x31, 0x80}, {0xFF, 0x00, 0xC6, 0x80}, {0x3F, 0x00, 0x31, 0x80}}},
155 {{{0xFF, 0x00, 0x00, 0x80}, {0x3F, 0x00, 0x00, 0x80}, {0xFF, 0x00, 0x00, 0x80}, {0x3F, 0x00, 0x00, 0x80}}},
156 {{{0xFF, 0x80, 0x00, 0x80}, {0xFF, 0x20, 0x00, 0x80}, {0xFF, 0x80, 0x00, 0x80}, {0xFF, 0x20, 0x00, 0x80}}},
160s16 BtlMenuNowLang = 1;
162s32 BtlMenuNowLang = 1;
164s32 BattleMenuFlag = BTLMENU_STATE_APPEAR;
165float chara_r_long = 118.0f;
166s16 TrushMoveMax[3] = {3, 1, 3};
167s32 BtlEffectFlag = BTLEFFECT_NONE;
175u_long128 *BtlMenuReadBuf;
176s32 BtlMenuReadEndFlag;
177s32 ItemMenuWeaponIconReadBlock;
178s32 ItemMenuAlreadyReadWepIconTexFlag;
179s32 MenuShadowReadBlock;
183s32 BtlMenuExReadBlock;
184s32 BtlMenuExReadFlag;
185s32 MenuExtendReadBlock;
186s32 MenuExTextureReadFlag;
187u_long128 *ItemMenuCharaReadBuf;
189s32 BtlMenuManualReadBlock;
219s32 MenuWarningMsgFlag;
220u_long128 *BtlMenuCharaChangeBuf;
222int GetDefaultWeaponNo(
int character_no) {
223 return MenuDefaultWeaponNo[character_no];
226int IsDefaultWeapon(
int weapon_no) {
230 for (chara = 0; chara <= 5; chara++) {
231 int default_weapon_no = GetDefaultWeaponNo(chara);
233 if (default_weapon_no == weapon_no || default_weapon_no + 1 == weapon_no) {
242void SetNowEquipWeaponDataForMsg(
int item_no,
int slot) {
247void GetNowEquipWeaponDataForMsg(
int &item_no,
int &slot) {
250 if (item_info != NULL) {
251 item_no = item_info->
msg;
260 return &MenuColorInfo2[index];
271 int chara = WepMenu.
chara;
285static int EscapeDungeonMode() {
286 int mode = ESCAPE_DNG_PAY;
289 mode = ESCAPE_DNG_POWDER;
293 mode = ESCAPE_DNG_FREE;
299void SetEscapeDngFlag(
int flag) {
303int GetEscapeDngFlag() {
307void SetInteriorOutFlag(
int flag) {
311int GetInteriorOutFlag() {
322static void DrawDngYesNoDialog(
int x,
int y,
int alpha) {
326 for (
int row = 0; row < 2; row++) {
327 DrawMenu2DSprite(BtStatus, dst, src, alpha);
341static int GetMenuModeMax() {
344 switch (BtlMenuMode) {
345 case BATTLE_MENU_MODE_DUNGEON:
348 case BATTLE_MENU_MODE_TOWN:
353 if (GetGameFlagForManualMenu() == 0) {
363static void GetMenuIconPos(
int icon,
int *position) {
365 int x = next * 16 + 80;
366 int y = icon * 40 + 54;
369 x -= ((icon - 4) << 5) + 16;
383static void BtlMenuMekeIconInfo(
int *icons,
int menu_mode) {
384 int icon_count = GetMenuModeMax();
386 for (
int i = 0; i < icon_count; i++) {
387 icons[i] = BtlDrawTbl[BtlMenuMode][i];
390 if (BtlMenuMode != BATTLE_MENU_MODE_DUNGEON) {
393 switch (NowGetGameFlagForBtlMenu(BtlMenuMode)) {
394 case MENU_MOVE_LOCKED:
395 case MENU_MOVE_FIRST_DUNGEON:
398 case MENU_MOVE_WORLD_MAP:
401 case MENU_MOVE_INTERIOR_OUT:
406 icons[4] = special_icon;
418static void DrawBtlMenuBar() {
428 if (BtlEffectFlag == BTLEFFECT_PAGE_CLOSE || BattleMenuFlag == BTLMENU_STATE_APPEAR) {
429 alpha = 10.0f * BtlEffectCt;
436 if (BtlEffectFlag == BTLEFFECT_PAGE_OPEN || BattleMenuFlag == BTLMENU_STATE_EXIT) {
437 alpha = 128.0f - 10.0f * BtlEffectCt;
446 NowGetGameFlagForBtlMenu(BtlMenuMode);
447 int icon_count = GetMenuModeMax();
449 BtlMenuMekeIconInfo(icons, BtlMenuMode);
451 for (i = 0; i < icon_count; i++) {
455 if (MenuWarningMsgFlag != 0) {
459 menu_flag = BattleMenuFlag;
461 if (BTLMENU_STATE_MAIN < menu_flag && menu_flag < BTLMENU_STATE_ITEM_OPEN) {
466 float icon_x = NorMenuIcon[i].
x;
468 float icon_y = NorMenuIcon[i].
y;
469 float lowered_y = 2.0f + icon_y;
470 y = 1.0f + lowered_y;
472 if (i == MenuSelect[1]) {
473 if ((menu_flag == BTLMENU_STATE_APPEAR || menu_flag == BTLMENU_STATE_EXIT) && menu_flag == BTLMENU_STATE_MOVE_OPEN) {
479 y = 1.0f + (icon_y - 2.0f);
484 DrawMainMenuIcon(x, y, icons[i], selected, brightness, icon_alpha);
493 case RES_LIMIT_ZONE_NONE:
496 case RES_LIMIT_ZONE_NO_WEAPON_CHANGE:
499 case RES_LIMIT_ZONE_THIRST:
502 case RES_LIMIT_ZONE_TOAN:
503 case RES_LIMIT_ZONE_XIAO:
504 case RES_LIMIT_ZONE_GORO:
505 case RES_LIMIT_ZONE_RUBY:
506 case RES_LIMIT_ZONE_UNGAGA:
507 case RES_LIMIT_ZONE_OSMOND:
515void DrawBattleMain() {
519 GetMenuIconPos(MenuSelect[1], pos);
520 int x = pos[0] - 0x2C;
522 SysCur[0] += ((float) x - SysCur[0]) / 4.0f;
523 SysCur[1] += ((float) y - SysCur[1]) / 4.0f;
525 BtlMenuMekeIconInfo(icons, BtlMenuMode);
529 if (MenuSelect[1] == 4) {
530 switch (NowGetGameFlagForBtlMenu(BtlMenuMode)) {
531 case MENU_MOVE_DUNGEON_ESCAPE: {
532 s16 escape[3] = {0x1B, 0x1C, 0x0F};
533 mes_no = escape[GetEscapeDngFlag()];
536 case MENU_MOVE_LOCKED:
539 case MENU_MOVE_FIRST_DUNGEON:
542 case MENU_MOVE_WORLD_MAP:
545 case MENU_MOVE_INTERIOR_OUT:
551 if (CommonMenuMes2.
mes_made != mes_no) {
555 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON) {
556 int limit = GetLimmitMsg();
558 if (CommonMenuMes1.
mes_made != limit) {
563 MenuTextureReload(CommonMenuMes1.
tex_block);
565 if (BtlMenuNowLang > LANG_JAPANESE) {
566 CommonMenuMes1.
text_x = 0x44;
568 CommonMenuMes1.
text_y = 0x176;
570 CommonMenuMes1.
text_y = 0x156;
573 CommonMenuMes1.
text_x = 0x50;
575 CommonMenuMes1.
text_y = 0x16A;
577 CommonMenuMes1.
text_y = 0x14A;
582 CommonMenuMes1.
Step();
588 float waku_y = NorMenuIcon[MenuSelect[1]].
y - 8.0f;
589 DrawMenuWaku(NorMenuIcon[MenuSelect[1]].x - 18.0f, waku_y, width, 0x22, 0, StayTex, 0x80);
590 DrawMenuObjectVibe((
int) SysCur[0], (
int) SysCur[1], 1, 0x40);
593void DrawOtherCharaStatus(
int x,
int y,
int chara,
int alpha) {
602 float hp = status->
hp[chara];
603 float max_hp = status->
max_hp[chara];
613 if (weapon == NULL) {
620 if (max_whp < 1.0f) {
624 int water = (int) status->
water_now[chara];
625 int max_water = (int) status->
water_max[chara];
626 float values[4] = {hp, max_hp, whp, max_whp};
627 MGFillBox(
CRect_i_((bar_x - 3) * 16, ((bar_y - 2) >> 1) * 16, 0x3A0, 0x30), 0x14, 0x14, 0x14, alpha);
628 int hp_len = (int) (52.0f * hp / max_hp);
629 MGFillBox(
CRect_i_(bar_x * 16, (bar_y >> 1) * 16, 0x340, 0x20), 0x4F, 0x4F, 0x4F, alpha);
630 CRect_i_ hp_rect(bar_x * 16, (bar_y >> 1) * 16, hp_len * 16, 0x20);
635 if (!(15.6f < hp_len)) {
641 MGFillBox(hp_rect, r, g, b, alpha);
642 MGFillBox(
CRect_i_((bar_x + 1) * 16, ((bar_y + 4) >> 1) * 16, 0x3A0, 0x30), 0x14, 0x14, 0x14, alpha);
643 float whp_len = 52.0f * whp / max_whp;
644 int whp_width = (int) whp_len;
645 MGFillBox(
CRect_i_((bar_x + 4) * 16, ((bar_y + 6) >> 1) * 16, 0x340, 0x20), 0x4F, 0x4F, 0x4F, alpha);
646 MGFillBox(
CRect_i_((bar_x + 4) * 16, ((bar_y + 6) >> 1) * 16, (
int) whp_len * 16, 0x20), 0xFF, 0xB1, 0x49, alpha);
647 MGFillBox(
CRect_i_((bar_x + 5) * 16, ((bar_y + 10) >> 1) * 16, 0x3A0, 0x40), 0x14, 0x14, 0x14, alpha);
648 int water_len = water * 0x34 / max_water;
649 MGFillBox(
CRect_i_((bar_x + 8) * 16, ((bar_y + 12) >> 1) * 16, 0x340, 0x20), 0x4F, 0x4F, 0x4F, alpha);
650 MGFillBox(
CRect_i_((bar_x + 8) * 16, ((bar_y + 12) >> 1) * 16, water_len * 16, 0x20), 0xC8, 0xEF, 0xF2, alpha);
653void DngComStatus(
int x,
int y,
int chara,
int alpha) {
654 CTexture *texture = TexManager.GetTexture(
"charastb", -1);
658 float unused_scale[2] = {0.0f, 0.0f};
659 float hp = BtlMenuStatusPt->
hp[chara];
660 float max_hp = BtlMenuStatusPt->
max_hp[chara];
670 if (weapon == NULL) {
677 if (max_whp < 1.0f) {
681 float values[2][2] = {
685 float full[2] = {200.0f, 99.0f};
686 int unused_colour[6] = {64, 212, 162, 255, 128, 0};
687 int colour_no[2] = {22, 25};
694 for (
int i = 0; i < 2; i++) {
695 int length = (int) (148.0f * values[i][1] / full[i]);
696 DrawMenu2DSprite(texture,
CRect_i_(left + 0x10, y + 5, 4, 0xF),
CRect_i_(0x10, 0xB0, 4, 0x10), alpha);
697 DrawMenu2DSprite(texture,
CRect_i_(left + 0x14, y + 5, length, 0xF),
CRect_i_(0x14, 0xB0, 4, 0x10), alpha);
698 DrawMenu2DSprite(texture,
CRect_i_(left + 0x13 + length, y + 5, 4, 0xF),
CRect_i_(0x18, 0xB0, 4, 0x10), alpha);
699 fill = (int) ((
float) length * values[i][0] / values[i][1]);
702 if (hp < 0.3f * max_hp) {
706 if (hp < 0.15f * max_hp) {
712 memcpy(&colours, GetGradationColorInfo2(colour_no[i]),
sizeof(colours));
718 int number_x = left + 0x4C + length;
720 while (x + 0x9A < number_x) {
725 numbers[0] = GetDispVolumeForFloat(values[i][0]);
726 numbers[1] = GetDispVolumeForFloat(values[i][1]);
727 DrawStatusNumberNowAndMax(numbers, number_x, y + 6, 1, alpha);
732 int drops = (int) BtlMenuStatusPt->
water_max[chara] / 10;
733 int drop_x = left + 0x12;
735 for (
int i = 0; i < drops - 1; i++) {
736 DrawMenu2DSprite(texture,
CRect_i_(drop_x, y + 5, 0x12, 0x13),
CRect_i_(0x22, 0x9C, 0x12, 0x14), alpha);
740 DrawMenu2DSprite(texture,
CRect_i_(drop_x, y + 5, 0x18, 0x14),
CRect_i_(0x34, 0x9C, 0x18, 0x14), alpha);
741 int water_alpha = (alpha * 0x50) >> 7;
742 int full_drops = (int) BtlMenuStatusPt->
water_now[chara] / 10;
744 for (
int i = 0; i < full_drops; i++) {
745 DrawMenu2DSprite(texture,
CRect_i_(left + 0x13 + i * 0x12, y, 0x10, 0x14),
CRect_i_(0, 0x88, 0x10, 0x14), water_alpha);
748 int rest = (int) BtlMenuStatusPt->
water_now[chara] % 10;
751 DrawMenu2DSprite(texture,
CRect_i_(left + 0x13 + full_drops * 0x12, y, 0x10, 0x14),
CRect_i_((3 - (
int) ((
float) rest / 2.5f)) * 16, 0x88, 0x10, 0x14), water_alpha);
755void DrawSelCharaStatus(
float x,
float y,
int chara,
int alpha,
int face_size,
int face_alpha,
int face_x,
int face_y) {
758 int px = (int) (x - 144.0f);
759 float top = 1.0f + y;
760 int py = (int) (top - 24.0f);
762 CTexture *texture = TexManager.GetTexture(
"charastb", -1);
764 CTexture *texture = TexManager.GetTexture(CharaStatusTextureName, -1);
767 DrawMenu2DSprite(texture,
CRect_i_(px, py - 1, 0x100, 0x88),
CRect_i_(0, 0, 0x100, 0x88), alpha);
768 RECT digits = {0x40, 0x88, 0xC, 0xE};
769 DrawMenuNumber((
int) BtlMenuStatusPt->
defense[chara], px + 0x5E, py + 0x72, texture, digits, 1, alpha);
771 px = (int) (x - 132.0f);
772 py = (int) (10.0f + y);
773 DngComStatus(px, py, chara, alpha);
774 px = (int) (x - 110.0f);
775 py = (int) (top - 18.0f);
777 CTexture *fonts[4] = {BtlAlpha, BtlKata, BtlHira, BtlEuro};
779 CTexture *fonts[3] = {BtlAlpha, BtlKata, BtlHira};
781 CharaSelectNameDraw2(px, py, (
short *) BtlMenuSaveDataPt->
GetCharaName(chara), fonts, alpha);
782 px = (int) (x - 118.0f - 12.0f);
783 py = (int) (70.0f + y);
788 if (weapon != NULL) {
793 WeaponAllValueSet(weapon, &total, 0);
794 DrawMenu2DSprite(icon,
CRect_i_(px + 2, py + 2, 0x20, 0x20),
CRect_i_(u, v, 0x20, 0x20), alpha);
795 DrawMenuNumber(total.
attack, px + 0x20, py + 0x14, texture, digits, 1, alpha);
799 px = (int) (x - 34.0f);
800 py = (int) (64.0f + y);
801 px = (int) (x - 40.0f);
802 CharaStatusMsgDraw(px, (
int) (68.0f + y), chara, 1, alpha);
808static void DrawBtlAtoraSelect() {
809 DrawMenuAtoraSelect();
815static void BtlDrawOption() {
827static void BtlDrawSave() {
828 DrawMenuSave(
"frame_image");
839static void BtlMenuTexBlockEnter() {
840 MenuCharaFace = TexManager.GetTexture(
"charaface", BtlMenuReadBlock);
841 BtStatus = TexManager.GetTexture(
"btstatus2", BtlMenuReadBlock);
842 WepIcon = TexManager.GetTexture(
"wepicon", -1);
843 ItemIcon = TexManager.GetTexture(
"itemicon", BtlMenuReadBlock);
844 PerBoardTex = TexManager.GetTexture(
"perbrd", BtlMenuReadBlock);
846 WepStatus = TexManager.GetTexture(
"wepstatus", BtlMenuExtBlock);
848 WepStatus = TexManager.GetTexture(
"wepstatus", BtlMenuReadBlock);
850 VillageName = TexManager.GetTexture(
"vilname", -1);
851 VillageBar = TexManager.GetTexture(
"viltag", -1);
855void BattleMenuTexEnter() {
857 {
"#frame_image#640#480#4", 0, 0},
858 {
"#dbgwork_menu#256#256#3", 0, 0},
860 {
"#frame_image_2#640#480#4", 0, 0},
865 textures[0].
block_no = BtlMenuReadBlock;
866 textures[1].
block_no = BtlMenuReadBlock;
867 textures[2].
block_no = BtlMenuReadBlock;
868 textures[3].
block_no = BtlMenuExtBlock;
869 textures[4].
block_no = BtlMenuExtBlock;
871 textures[2].
name = (
char *) GetPackFile((u_int *) file->
buffer,
"btlmenu.img", NULL);
872 textures[4].
name = (
char *) GetPackFile((u_int *) file->
buffer,
"btlmenu2.img", NULL);
873 int blocks[3] = {0, 0, -1};
874 blocks[0] = BtlMenuReadBlock;
875 blocks[1] = BtlMenuExtBlock;
876 MenuTextureDelete(blocks);
877 TexManager.CleanUpTextureList();
878 TexManager.LoadTextureBlockEX(-1, textures);
879 BtlMenuTexBlockEnter();
880 GetAtraMsgReadBuf = (
short *) GetPackFile((u_int *) file->
buffer,
"atrames.bin", NULL);
881 short *mes = (
short *) GetPackFile((u_int *) file->
buffer,
"allmenu.mes", NULL);
882 InitMenuMesSet(MENU_MES_SET_ALLMENU, mes);
884 BtlMenuReadEndFlag = 1;
888void BattleMenuTexEnter() {
890 {
"#frame_image#640#448#4", 0, 0},
891 {
"#dbgwork_menu#256#224#3", 0, 0},
896 textures[0].
block_no = BtlMenuReadBlock;
897 textures[1].
block_no = BtlMenuReadBlock;
898 textures[2].
block_no = BtlMenuReadBlock;
900 textures[2].
name = (
char *) GetPackFile((u_int *) file->
buffer,
"btlmenu.img", NULL);
901 int blocks[2] = {0, -1};
902 blocks[0] = BtlMenuReadBlock;
903 MenuTextureDelete(blocks);
904 TexManager.CleanUpTextureList();
905 TexManager.LoadTextureBlockEX(-1, textures);
906 BtlMenuTexBlockEnter();
907 GetAtraMsgReadBuf = (
short *) GetPackFile((u_int *) file->
buffer,
"atrames.bin", NULL);
908 short *mes = (
short *) GetPackFile((u_int *) file->
buffer,
"allmenu.mes", NULL);
909 InitMenuMesSet(MENU_MES_SET_ALLMENU, mes);
911 BtlMenuReadEndFlag = 1;
916void ExitBattleMenu(
int unused) {
918 s16 *item = MenuItemPackPt->
item;
920 for (
int i = 0; i < MenuItemPackPt->
num; i++, item++) {
921 if (*item >= ITEM_DUNGEON_START) {
930 for (
int i = 0; i < 3; i++, item++) {
931 if (*item >= ITEM_DUNGEON_START) {
941 int blocks[7] = {0, 0, 0, 0, 0, 0, -1};
943 int blocks[6] = {0, 0, 0, 0, 0, -1};
945 blocks[0] = BtlMenuReadBlock;
946 blocks[1] = MenuExtendReadBlock;
947 blocks[2] = BtlMenuExReadBlock;
948 blocks[3] = BtlMenuManualReadBlock;
949 blocks[4] = MenuShadowReadBlock;
951 blocks[5] = BtlMenuExtBlock;
953 MenuTextureDelete(blocks);
954 TexManager.CleanUpBuffer();
955 TexManager.CleanUpTextureList();
959 switch (BtlMenuMode) {
960 case BATTLE_MENU_MODE_DUNGEON: {
962 {
"#frame_image0#640#" SCREEN_HEIGHT_STR
"#4", 0, 0},
965 textures[0].
block_no = BtlMenuReadBlock;
966 TexManager.LoadTextureBlock(-1, textures);
971 SndSetBgmVol(BtlMenuBGMvol);
977void BattleMenuInit(
int *texture_blocks,
int mode) {
979 BtlMenuReadBlock = texture_blocks[0];
980 MenuExtendReadBlock = texture_blocks[1];
981 BtlMenuExReadBlock = texture_blocks[2];
982 BtlMenuManualReadBlock = texture_blocks[3];
983 ItemMenuWeaponIconReadBlock = texture_blocks[3];
984 MenuShadowReadBlock = texture_blocks[4];
986 BtlMenuExtBlock = texture_blocks[5];
988 BtlMenuNowLang = GetMenuLangFlag();
992 switch (BtlMenuMode) {
993 case BATTLE_MENU_MODE_DUNGEON: {
995 {
"#frame_image#640#" SCREEN_HEIGHT_STR
"#4", 0, 0},
998 texture[0].
block_no = BtlMenuReadBlock;
1000 int blocks[7] = {0, 0, 0, 0, 0, 0, -1};
1002 int blocks[6] = {0, 0, 0, 0, 0, -1};
1004 blocks[0] = BtlMenuReadBlock;
1005 blocks[1] = MenuExtendReadBlock;
1006 blocks[2] = BtlMenuExReadBlock;
1007 blocks[3] = BtlMenuManualReadBlock;
1008 blocks[4] = MenuShadowReadBlock;
1010 blocks[5] = BtlMenuExtBlock;
1012 MenuTextureDelete(blocks);
1013 TexManager.CleanUpBuffer();
1014 TexManager.CleanUpTextureList();
1015 TexManager.LoadTextureBlockEX(-1, texture);
1020 BtlMenuReadBuf = BtlMenuBufferSet(BtlMenuMode);
1021 BtlMenuReadBuf = MenuCalcBufAlignment(BtlMenuReadBuf);
1023 int size = LoadFileBGMenuData(
"dungeon/dunmenu5.pak", BtlMenuReadBuf);
1025 BtlMenuReadBuf += (size >> 4) + 1;
1026 BtlMenuReadBuf = MenuCalcBufAlignment(BtlMenuReadBuf);
1027 BtlMenuExReadFlag = 1;
1028 BtlMenuReadEndFlag = 0;
1029 MenuExTextureReadFlag = MENU_EX_TEX_UNREAD;
1032 printf(
"msg work area\n");
1033 BtlMenuReadBuf += 0x11;
1034 BtlMenuReadBuf = MenuCalcBufAlignment(BtlMenuReadBuf);
1035 StayTex = TexManager.GetTexture(
"stayframe", -1);
1040 BtlMenuSaveDataPt = SaveData;
1042 switch (BtlMenuMode) {
1043 case BATTLE_MENU_MODE_DUNGEON:
1044 MenuMapJumpMode = 0;
1046 SetEscapeDngFlag(EscapeDungeonMode());
1048 case BATTLE_MENU_MODE_TOWN:
1049 MenuMapJumpMode = -1;
1051 SetEscapeDngFlag(ESCAPE_DNG_PAY);
1055 SetInteriorOutFlag(0);
1057 MenuItemPackPt = &BtlMenuStatusPt->
item_pack;
1065 BtlMenuStatusPt->
GetItem(GetDefaultWeaponNo(BtlMenuStatusPt->
party_size - 1) + 1, 0);
1066 EquipDefaultWeapon(BtlMenuStatusPt->
party_size - 1);
1067 printf(
"Debug Party Member Get\n");
1073 BtlHelpWinAlpha = 0;
1074 GetMainMenuRightHelpWinLangOffset(HelpWinHead[0], HelpWinHead[1], BtlHelpWinW, BtlHelpWinH);
1076 MenuSelect[0] = BTLMENU_PAGE_ITEM;
1079 for (
int i = 0; i < 8; i++) {
1080 NorMenuIcon[i].
x = -150.0f;
1081 NorMenuIcon[i].
y = i * 0x28 + 0x30;
1084 if (CheckItemThrow(NULL, NULL) != 0) {
1085 BattleMenuFlag = BTLMENU_STATE_ITEM_TRUSH;
1086 BtlEffectFlag = BTLEFFECT_NONE;
1089 for (
int i = 1; i < 8; i++) {
1090 NorMenuIcon[i].
x = -230.0f;
1093 NorMenuIcon[0].
x = 70.0f;
1094 NorMenuIcon[0].
y = 28.0f;
1096 BattleMenuFlag = BTLMENU_STATE_APPEAR;
1097 BtlEffectFlag = BTLEFFECT_NONE;
1100 MenuChara.
state = MENU_CHARA_OPEN;
1103 MenuWarningMsgFlag = 0;
1104 BtlMenuBGMvol = SndGetBgmVol();
1114static int BtlMenuDrawSpecialFlag(
int flag) {
1115 if ((BattleMenuFlag == BTLMENU_STATE_ATLA_OPEN || BattleMenuFlag == BTLMENU_STATE_ATLA || BattleMenuFlag == BTLMENU_STATE_ATLA_CLOSE) && GetMenuAtraEventFlag() != 0) {
1119 if (MenuChara.
state == MENU_CHARA_CHANGE_LOAD || MenuChara.
state == MENU_CHARA_CHANGE_EXIT) {
1126void BattleMenuDraw() {
1131 MenuWorldTrans(&MenuCamera);
1132 sceVif1PkCall(GetVif1Packet(), (u_long128 *) Vu_prog0f, 0);
1133 sceVif1PkTerminate(GetVif1Packet());
1134 MenuTextureReload(BtlMenuReadBlock);
1135 CTexture frame = *TexManager.GetTexture(
"frame_image", -1);
1139 if (texture != NULL) {
1147 switch (BattleMenuFlag) {
1148 case BTLMENU_STATE_APPEAR:
1149 bright = (int) (128.0f - 4.0f * BtlEffectCt);
1151 if (bright < 0x40) {
1156 case BTLMENU_STATE_EXIT:
1157 bright += 4.0f * BtlEffectCt;
1159 if (bright > 0x80) {
1166 DrawMenu2DSprite(&frame, MenuDispRc, MenuDispRc, bright, bright, bright, 0x80);
1168 switch (BattleMenuFlag) {
1169 case BTLMENU_STATE_MAIN:
1172 case BTLMENU_STATE_CHARA:
1173 case BTLMENU_STATE_CHARA_OPEN:
1174 case BTLMENU_STATE_CHARA_CLOSE:
1175 case BTLMENU_STATE_UNK_1A:
1178 case BTLMENU_STATE_WEAPON:
1179 case BTLMENU_STATE_WEAPON_OPEN:
1180 case BTLMENU_STATE_WEAPON_CLOSE:
1183 case BTLMENU_STATE_ITEM:
1184 case BTLMENU_STATE_ITEM_OPEN:
1185 case BTLMENU_STATE_ITEM_CLOSE:
1188 case BTLMENU_STATE_ATLA:
1189 case BTLMENU_STATE_ATLA_OPEN:
1190 case BTLMENU_STATE_ATLA_CLOSE:
1191 DrawBtlAtoraSelect();
1193 case BTLMENU_STATE_MOVE:
1194 case BTLMENU_STATE_MOVE_OPEN:
1195 case BTLMENU_STATE_MOVE_CLOSE:
1198 case BTLMENU_STATE_OPTION:
1199 case BTLMENU_STATE_OPTION_OPEN:
1200 case BTLMENU_STATE_OPTION_CLOSE:
1203 case BTLMENU_STATE_SAVE:
1204 case BTLMENU_STATE_SAVE_OPEN:
1205 case BTLMENU_STATE_SAVE_CLOSE:
1208 case BTLMENU_STATE_MANUAL:
1209 case BTLMENU_STATE_MANUAL_OPEN:
1210 case BTLMENU_STATE_MANUAL_CLOSE:
1217 if (CursorVibeCnt >= 0x405F7E00) {
1221 int draw_help = BtlMenuDrawSpecialFlag(BtlWakuMake2);
1223 if (BtlMenuReadEndFlag != 0) {
1224 switch (BattleMenuFlag) {
1225 case BTLMENU_STATE_EXIT:
1226 BtlHelpWinAlpha -= 8;
1228 if (BtlHelpWinAlpha < 0) {
1229 BtlHelpWinAlpha = 0;
1234 BtlHelpWinAlpha += 9;
1236 if (BtlHelpWinAlpha > 0x80) {
1237 BtlHelpWinAlpha = 0x80;
1243 if (draw_help != 0) {
1244 MenuHelpWinDraw((
int) HelpWinHead[0], (
int) HelpWinHead[1], BtlHelpWinW, BtlHelpWinH, BtlHelpWinAlpha);
1248 MenuTextureReload(CommonMenuMes2.
tex_block);
1249 GetMainMenuRightHelpMsgLangOffset(text_x, text_y);
1250 CommonMenuMes2.
text_x = (int) (HelpWinHead[0] + text_x);
1251 CommonMenuMes2.
text_y = (int) (HelpWinHead[1] + text_y);
1253 if (BtlMenuReadEndFlag != 0 && draw_help != 0) {
1256 CommonMenuMes2.
Step();
1261 draw_help = BtlMenuDrawSpecialFlag(1);
1263 if (draw_help != 0) {
1267 if (WepMenu.
mode != WEP_MENU_BUILDUP_SELECT) {
1268 MenuWepLevelUp.
Step();
1269 MenuWepLevelUp.
Draw();
1272 if (GetInteriorOutFlag() != 0) {
1273 BtlEffectCt += 1.0f;
1274 int fade = (int) (3.0f * BtlEffectCt);
1280 AllFadeForMenu(fade);
1286int BattleMenuCursor() {
1295 switch (BattleMenuFlag) {
1296 case BTLMENU_STATE_APPEAR:
1299 case BTLMENU_STATE_EXIT:
1300 result = BattleMenuExit();
1302 case BTLMENU_STATE_MAIN:
1303 result = BattleMenuSelect();
1305 case BTLMENU_STATE_WEAPON:
1306 case BTLMENU_STATE_WEAPON_OPEN:
1307 case BTLMENU_STATE_WEAPON_CLOSE:
1310 case BTLMENU_STATE_ITEM_TRUSH:
1311 InitItemTrushStart();
1313 case BTLMENU_STATE_ITEM:
1314 case BTLMENU_STATE_ITEM_OPEN:
1315 case BTLMENU_STATE_ITEM_CLOSE:
1318 case BTLMENU_STATE_CHARA:
1319 case BTLMENU_STATE_CHARA_OPEN:
1320 case BTLMENU_STATE_CHARA_CLOSE:
1321 case BTLMENU_STATE_UNK_1A:
1322 result = BattleMenuCharaKey();
1324 case BTLMENU_STATE_ATLA:
1325 case BTLMENU_STATE_ATLA_OPEN:
1326 case BTLMENU_STATE_ATLA_CLOSE:
1327 BattleMenuAtoraKey();
1329 case BTLMENU_STATE_MOVE:
1330 case BTLMENU_STATE_MOVE_OPEN:
1331 case BTLMENU_STATE_MOVE_CLOSE:
1332 result = MenuMoveKey();
1334 case BTLMENU_STATE_OPTION:
1335 case BTLMENU_STATE_OPTION_OPEN:
1336 case BTLMENU_STATE_OPTION_CLOSE:
1337 BattleMenuOptionKey();
1339 case BTLMENU_STATE_SAVE:
1340 case BTLMENU_STATE_SAVE_OPEN:
1341 case BTLMENU_STATE_SAVE_CLOSE:
1342 BattleMenuSaveKey();
1344 case BTLMENU_STATE_MANUAL:
1345 case BTLMENU_STATE_MANUAL_OPEN:
1346 case BTLMENU_STATE_MANUAL_CLOSE:
1353 switch (BtlMenuMode) {
1354 case BATTLE_MENU_MODE_DUNGEON:
1355 SetEscapeDngFlag(EscapeDungeonMode());
1369static void BattleMenuAppear() {
1370 int arrived =
false;
1374 for (i = 0; i < GetMenuModeMax(); i++) {
1375 GetMenuIconPos(i, position);
1376 float x = NorMenuIcon[i].
x;
1377 float dx = position[0] - x;
1378 NorMenuIcon[i].
x = x + dx / 4.0f;
1379 NorMenuIcon[i].
y += (position[1] - NorMenuIcon[i].
y) / 4.2f;
1382 NorMenuIcon[i].
x = position[0];
1387 BtlEffectCt += 1.0f;
1389 if (!(BtlEffectCt < 19.0f)) {
1390 BtlEffectCt = 19.0f;
1393 int reading = ReadBGSync();
1395 if (arrived >= 6 && reading == 0) {
1396 BattleMenuTexEnter();
1397 BtlMenuReadEndFlag = 1;
1399 BtlEffectFlag = BTLEFFECT_NONE;
1400 BattleMenuFlag = BTLMENU_STATE_MAIN;
1401 MenuSelect[0] = BTLMENU_PAGE_ITEM;
1415static int BattleMenuExit() {
1418 for (i = 0; i < GetMenuModeMax(); i++) {
1419 NorMenuIcon[i].
x += (-198.0f - NorMenuIcon[i].
x) / 4.0f;
1422 BtlEffectCt += 1.0f;
1424 if (!(BtlEffectCt <= 20.0f) && ReadBGSync() == 0) {
1432int BattleMenuSelect() {
1433 if (MenuWarningMsgFlag != 0) {
1434 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
1435 MenuWarningMsgFlag = 0;
1441 int old = MenuSelect[1];
1442 int max = GetMenuModeMax();
1444 if (GamePad.
Down(PAD_UP | PAD_LEFT) != 0) {
1447 if (MenuSelect[1] < 0) {
1448 MenuSelect[1] = max - 1;
1452 if (GamePad.
Down(PAD_RIGHT | PAD_DOWN) != 0) {
1455 if (MenuSelect[1] > max - 1) {
1460 if (old != MenuSelect[1]) {
1461 ComMenuSePlay(MENU_SOUND_CURSOR);
1464 if (GamePad.
Down(PAD_CROSS) != 0) {
1466 {BTLMENU_PAGE_ITEM, BTLMENU_PAGE_WEAPON, BTLMENU_PAGE_CHARA, BTLMENU_PAGE_ATLA, BTLMENU_PAGE_MOVE, BTLMENU_PAGE_OPTION, BTLMENU_PAGE_MANUAL, BTLMENU_PAGE_NONE },
1467 {BTLMENU_PAGE_ITEM, BTLMENU_PAGE_WEAPON, BTLMENU_PAGE_CHARA, BTLMENU_PAGE_ATLA, BTLMENU_PAGE_MOVE, BTLMENU_PAGE_SAVE, BTLMENU_PAGE_OPTION, BTLMENU_PAGE_MANUAL}
1469 MenuSelect[0] = pages[BtlMenuMode][MenuSelect[1]];
1473 u_long128 *buffer = BtlMenuReadBuf;
1475 switch (MenuSelect[0]) {
1476 case BTLMENU_PAGE_CHARA:
1477 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON) {
1480 if (zone < 6 && zone >= 0) {
1481 ComMenuSePlay(MENU_SOUND_REFUSE);
1486 InitMenuChara(buffer);
1488 case BTLMENU_PAGE_WEAPON:
1489 InitWeaponSelect(WEP_OPEN_FROM_BAR, chara);
1491 case BTLMENU_PAGE_ITEM:
1492 InitItemMode(0, chara);
1494 case BTLMENU_PAGE_ATLA: {
1495 int blocks[2] = {0, 0};
1496 blocks[0] = BtlMenuReadBlock;
1497 blocks[1] = MenuExtendReadBlock;
1500 switch (BtlMenuMode) {
1501 case BATTLE_MENU_MODE_DUNGEON:
1513 case BATTLE_MENU_MODE_TOWN:
1514 map = GetNowMapTransAtraMap(MapNo);
1516 if (map < 0 || map > 5) {
1523 InitMenuAtora1(BtlMenuMode, map, blocks, buffer);
1524 InitMenuAtoraSelect(map);
1527 case BTLMENU_PAGE_MOVE: {
1528 int flag = NowGetGameFlagForBtlMenu(BtlMenuMode);
1531 case MENU_MOVE_LOCKED:
1532 ComMenuSePlay(MENU_SOUND_REFUSE);
1535 case MENU_MOVE_WORLD_MAP:
1536 case MENU_MOVE_FIRST_DUNGEON:
1537 case MENU_MOVE_INTERIOR_OUT:
1538 case MENU_MOVE_DUNGEON_ESCAPE:
1539 InitMenuMove(flag, MenuExtendReadBlock, buffer);
1546 case BTLMENU_PAGE_OPTION:
1547 InitMenuOption(OPTION_OPEN_GAME_MENU, MenuExtendReadBlock, buffer);
1549 case BTLMENU_PAGE_SAVE:
1551 InitMenuSave(SAVE_MENU_MODE_SAVE, MenuExtendReadBlock, buffer);
1553 case BTLMENU_PAGE_MANUAL: {
1555 int blocks[3] = {0, 0, 0};
1556 blocks[0] = MenuExtendReadBlock;
1557 blocks[1] = BtlMenuExReadBlock;
1558 blocks[2] = BtlMenuManualReadBlock;
1559 BattleManualInit(blocks, buffer);
1564 BattleMenuFlag = MenuSelect[0] + BTLMENU_STATE_OPEN_OFFSET;
1565 BtlEffectFlag = BTLEFFECT_PAGE_OPEN;
1567 ComMenuSePlay(MENU_SOUND_CONFIRM);
1568 }
else if (GamePad.
Down(PAD_CIRCLE) != 0) {
1569 ComMenuSePlay(MENU_SOUND_REFUSE);
1570 BattleMenuFlag = BTLMENU_STATE_EXIT;
1576int ToFromSelect(
int out) {
1577 if (out < 0 || out > 1) {
1593 float hide_x = -240.0f;
1595 if (BtlMenuNowLang > LANG_JAPANESE) {
1600 float hide_x = -224.0f;
1602 if (BtlMenuNowLang > LANG_JAPANESE) {
1608 int arrived =
false;
1610 for (
int i = 0; i < GetMenuModeMax(); i++) {
1614 GetMenuIconPos(i, pos);
1615 }
else if (i != MenuSelect[1]) {
1616 pos[0] = (int) hide_x;
1617 pos[1] = i * 0x28 + 0x48;
1619 pos[0] = home[i][0];
1620 pos[1] = home[i][1];
1623 float dx = (float) pos[0] - NorMenuIcon[i].x;
1624 float dy = (float) pos[1] - NorMenuIcon[i].y;
1625 NorMenuIcon[i].
x += dx / 4.0f;
1626 NorMenuIcon[i].
y += dy / 4.0f;
1628 if ((
float) abs((
int) dx) < 2.0f) {
1629 NorMenuIcon[i].
x = pos[0];
1633 if ((
float) abs((
int) dy) < 2.0f) {
1634 NorMenuIcon[i].
y = pos[1];
1657static void ForBackMenu() {
1661 BtlEffectFlag = BTLEFFECT_NONE;
1664 CommonMenuMes1.
auto_pos = MES_POS_NONE;
1667 for (
int i = 0; i < 10; i++) {
1668 CommonMenuMes1.
mes_no[i] = -1;
1669 CommonMenuMes1.
values[i] = -1;
1672 MenuSelect[0] = BattleMenuFlag - BTLMENU_STATE_CLOSE_OFFSET;
1673 GetMenuIconPos(MenuSelect[1], position);
1674 SysCur[0] = position[0] - 40;
1675 SysCur[1] = position[1] + 20;
1685static void InitMenuChara(u_long128 *buffer) {
1687 LoadFileBGMenuData(
"charatex.img", buffer);
1689 BtlMenuExReadFlag = 0;
1690 MenuChara.
state = MENU_CHARA_OPEN;
1691 MenuChara.
timer = 0.0f;
1692 chara_r_long = 118.0f;
1694 MenuCharaMove = 0.0f;
1699 MenuChara.
chara = chara;
1701 for (
int i = 0; i < MenuChara.
slot_count; i++) {
1702 SysChara[i].
place = i - chara;
1703 SysChara[i].
chara = i;
1707 if (SysChara[i].place < 0) {
1712 int message_no = chara + 30;
1722#pragma opt_propagation off
1724int BattleMenuCharaKey() {
1725 switch (MenuChara.
state) {
1726 case MENU_CHARA_CHANGE_LOAD:
1733 CharaChangeInitToGL2(1);
1734 MenuChara.
state = MENU_CHARA_CHANGE_EXIT;
1738 case MENU_CHARA_CHANGE_EXIT:
1749 case MENU_CHARA_OPEN: {
1750 if (BtlMenuExReadFlag == 0) {
1751 if (ReadBGSync() == 0) {
1753 {
"#frame_image_charamenu#640#" SCREEN_HEIGHT_STR
"#4", 0, 0},
1757 texture[0].
block_no = BtlMenuExReadBlock;
1758 texture[1].
block_no = BtlMenuExReadBlock;
1761 BtlMenuCharaChangeBuf = file->
buffer + (file->
size >> 4) + 1;
1762 BtlMenuCharaChangeBuf = MenuCalcBufAlignment(BtlMenuCharaChangeBuf);
1763 int blocks[2] = {0, -1};
1764 blocks[0] = BtlMenuExReadBlock;
1765 MenuTextureDelete(blocks);
1766 TexManager.CleanUpTextureList();
1767 TexManager.LoadTextureBlockEX(-1, texture);
1768 BtlMenuTexBlockEnter();
1769 MenuCharaFace = TexManager.GetTexture(
"charaface", BtlMenuExReadBlock);
1770 BtStatus = TexManager.GetTexture(
"btstatus2", BtlMenuExReadBlock);
1771 NonCharaFace = TexManager.GetTexture(
"nonchara", BtlMenuExReadBlock);
1772 BtlAlpha = TexManager.GetTexture(
"alphabet", BtlMenuExReadBlock);
1773 BtlHira = TexManager.GetTexture(
"hira", BtlMenuExReadBlock);
1774 BtlKata = TexManager.GetTexture(
"kata", BtlMenuExReadBlock);
1776 BtlEuro = TexManager.GetTexture(
"euro", BtlMenuExReadBlock);
1778 BtlMenuExReadFlag = 1;
1784 int done = ToFromSelect(0);
1786 if (BtlMenuExReadFlag != 0) {
1787 MenuChara.
timer += 1.0f;
1790 if (!(MenuChara.
timer < 20.0f)) {
1791 MenuChara.
timer = 20.0f;
1794 if (!(MenuChara.
timer < 20.0f) && done == 1 && BtlMenuExReadFlag != 0) {
1795 MenuCharaMove = 0.0f;
1796 MenuChara.
state = MENU_CHARA_SELECT;
1797 MenuChara.
timer = 0.0f;
1798 BattleMenuFlag = BTLMENU_STATE_CHARA;
1803 case MENU_CHARA_CLOSE: {
1804 int done = ToFromSelect(1);
1805 MenuChara.
timer += 1.0f;
1807 if (!(MenuChara.
timer <= 20.0f) && done == 1) {
1809 int blocks[2] = {0, -1};
1810 blocks[0] = BtlMenuExReadBlock;
1811 MenuTextureDelete(blocks);
1812 TexManager.CleanUpTextureList();
1813 BtlMenuTexBlockEnter();
1814 MenuCharaFace = TexManager.GetTexture(
"charaface", BtlMenuReadBlock);
1815 BtStatus = TexManager.GetTexture(
"btstatus2", BtlMenuReadBlock);
1816 BattleMenuFlag = BTLMENU_STATE_MAIN;
1821 case MENU_CHARA_TURN:
1822 MenuChara.
timer += 1.0f;
1824 if (!(MenuChara.
timer < 21.0f)) {
1825 if (!(MenuCharaMove <= 0.0f)) {
1826 for (
int i = 0; i < MenuChara.
slot_count; i++) {
1827 SysChara[i].
place++;
1829 if (MenuChara.
slot_count == SysChara[i].place) {
1830 SysChara[i].
place = 0;
1834 for (
int i = 0; i < MenuChara.
slot_count; i++) {
1835 SysChara[i].
place--;
1837 if (SysChara[i].place == -1) {
1843 for (
int i = 0; i < 6; i++) {
1844 if (SysChara[i].place == 0) {
1845 int chara = SysChara[i].
chara;
1846 int mes_no = chara + 0x1E;
1848 if (BtlMenuStatusPt->
party_size - 1 < chara) {
1852 if (CommonMenuMes2.
mes_made != mes_no) {
1858 MenuChara.
state = MENU_CHARA_SELECT;
1859 MenuChara.
timer = 0.0f;
1860 MenuCharaMove = 0.0f;
1864 case MENU_CHARA_MESSAGE:
1865 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
1866 MenuChara.
state = MENU_CHARA_SELECT;
1867 ComMenuSePlay(MENU_SOUND_CONFIRM);
1871 case MENU_CHARA_SELECT: {
1872 int old = MenuChara.
chara;
1874 if (GamePad.
On(PAD_UP | PAD_RIGHT) != 0) {
1875 MenuCharaMove = PosAngle / 20.0f;
1876 MenuChara.
state = MENU_CHARA_TURN;
1877 MenuChara.
timer = 0.0f;
1880 if (MenuChara.
chara < 0) {
1881 MenuChara.
chara = 5;
1884 ComMenuSePlay(MENU_SOUND_CURSOR);
1885 }
else if (GamePad.
On(PAD_DOWN | PAD_LEFT) != 0) {
1886 MenuCharaMove = -PosAngle / 20.0f;
1887 MenuChara.
state = MENU_CHARA_TURN;
1888 MenuChara.
timer = 0.0f;
1891 if (MenuChara.
chara > 5) {
1892 MenuChara.
chara = 0;
1895 ComMenuSePlay(MENU_SOUND_CURSOR);
1896 }
else if (GamePad.
Down(PAD_CIRCLE) != 0) {
1897 BattleMenuFlag = BTLMENU_STATE_CHARA_CLOSE;
1898 MenuChara.
state = MENU_CHARA_CLOSE;
1899 MenuChara.
timer = 0.0f;
1900 BtlEffectFlag = BTLEFFECT_PAGE_CLOSE;
1902 ComMenuSePlay(MENU_SOUND_REFUSE);
1903 }
else if (GamePad.
Down(PAD_CROSS) != 0) {
1904 switch (BtlMenuMode) {
1905 case BATTLE_MENU_MODE_DUNGEON: {
1912 if (cur == CHARA_OSMOND && BtActStatus.
ground_kind == 10) {
1914 ComMenuSePlay(MENU_SOUND_REFUSE);
1917 if (SysChara[i].place != 0) {
1921 int chara = SysChara[i].
chara;
1924 ComMenuSePlay(MENU_SOUND_REFUSE);
1928 s16 hp = status->
hp[chara];
1931 if (hp <= 0 || (condition & AILMENT_KNOCKED_OUT)) {
1932 ComMenuSePlay(MENU_SOUND_REFUSE);
1936 if (chara != (s8) cur) {
1938 ComMenuSePlay(MENU_SOUND_CONFIRM);
1939 MenuChara.
state = MENU_CHARA_CHANGE_LOAD;
1949 ComMenuSePlay(MENU_SOUND_REFUSE);
1954 if (old != MenuChara.
chara && MenuChara.
chara < BtlMenuStatusPt->
party_size && BtlMenuCharaChangeBuf != NULL && BtlMenuMode == BATTLE_MENU_MODE_DUNGEON) {
1956 CharaChangeInitToGL(BtlMenuCharaChangeBuf, MenuChara.
chara);
1962 if (GamePad.
On(PAD_R2 | PAD_R1) != 0) {
1963 for (
int i = 0; i < MenuChara.
slot_count; i++) {
1964 if (SysChara[i].place == 0) {
1965 int raised = BtlMenuStatusPt->
max_hp[i] + 1;
1967 if (raised < 0x80) {
1968 BtlMenuStatusPt->
max_hp[i] = raised;
1974 if (GamePad.
Down2(PAD_CROSS) != 0 && BtlMenuStatusPt->
party_size < 6) {
1976 BtlMenuStatusPt->
GetItem(GetDefaultWeaponNo(BtlMenuStatusPt->
party_size - 1) + 1, 0);
1979 EquipDefaultWeapon(BtlMenuStatusPt->
party_size - 1);
1980 NameDefaultSet(BtlMenuStatusPt->
party_size - 1);
1983 if (GamePad.
Down2(PAD_CIRCLE) != 0 && BtlMenuStatusPt->
party_size > 1) {
1996#pragma opt_propagation reset
1998void DrawCharaSelect() {
1999 if (BtlMenuExReadFlag == 0) {
2004 int ring_alpha = 0x80;
2009 switch (MenuChara.
state) {
2010 case MENU_CHARA_OPEN:
2011 bright = (int) (10.0f * MenuChara.
timer);
2012 ring_alpha = bright;
2014 case MENU_CHARA_CLOSE:
2015 bright = (int) (128.0f - 12.0f * MenuChara.
timer);
2016 ring_alpha = bright;
2018 case MENU_CHARA_CHANGE_LOAD:
2019 case MENU_CHARA_CHANGE_EXIT:
2025 if (ring_alpha > 0x80) {
2029 if (ring_alpha < 0) {
2037 MenuTextureReload(BtlMenuExReadBlock);
2043 MGSetGsALPHA(&blend);
2044 DrawMenu2DSprite(TexManager.GetTexture(
"dgring", -1),
CRect_i_(0x12A, 0x32, 0x118, 0x118),
CRect_i_(0, 0, 0x80, 0x80), (ring_alpha * 0x8C) >> 7);
2047 switch (MenuChara.
state) {
2048 case MENU_CHARA_OPEN:
2049 for (
int i = 0; i < MenuChara.
slot_count; i++) {
2050 float radius = chara_r_long / 20.0f * MenuChara.
timer;
2051 float angle = PI + (PosAngle * (SysChara[i].
place - 1.0f) + PosAngle / 20.0f * MenuChara.
timer);
2052 SysChara[i].
x = radius * cosf(angle);
2053 SysChara[i].
y = radius * sinf(angle);
2057 case MENU_CHARA_TURN:
2058 for (
int i = 0; i < MenuChara.
slot_count; i++) {
2059 float radius = chara_r_long;
2060 float angle = PI + (PosAngle * SysChara[i].
place + MenuCharaMove * MenuChara.
timer);
2061 SysChara[i].
x = radius * cos(angle);
2062 SysChara[i].
y = radius * sin(angle);
2066 case MENU_CHARA_CHANGE_EXIT:
2067 case MENU_CHARA_CHANGE_LOAD:
2070 for (
int i = 0; i < MenuChara.
slot_count; i++) {
2071 float radius = chara_r_long;
2072 float angle = PI + (PosAngle * SysChara[i].
place + MenuCharaMove * MenuChara.
change_counter);
2073 SysChara[i].
x = radius * cos(angle);
2074 SysChara[i].
y = radius * sin(angle);
2088 for (
int i = 0; i < MenuChara.
slot_count; i++) {
2089 face_x = 394.0f + SysChara[i].
x;
2091 face_y = 120.0f + SysChara[i].
y;
2093 face_alpha = bright;
2094 status_alpha = bright;
2097 if ((!((move = MenuCharaMove) <= 0.0f) && MenuChara.
slot_count - 1 == SysChara[i].place) || (move < 0.0f && SysChara[i].place == 1)) {
2098 float step = 0.6666667f * MenuChara.
timer;
2099 draw_x = face_x - step;
2101 panel_alpha = (int) (128.0f * MenuChara.
timer / 21.0f);
2102 status_alpha = 0x80 - panel_alpha;
2105 if (SysChara[i].place == 0) {
2106 time = MenuChara.
timer;
2107 float scale = 0.6666667f;
2108 draw_x = face_x + scale * (time - 20.0f - 1.0f);
2109 grow = scale * time;
2110 size = 106.0f - grow;
2111 status_alpha = (int) ((
float) bright * time / 21.0f);
2116 }
else if (MenuChara.
state == MENU_CHARA_TURN) {
2117 panel_alpha = (int) (128.0f - 10.0f * time);
2120 switch (MenuChara.
state) {
2121 case MENU_CHARA_CHANGE_EXIT:
2122 case MENU_CHARA_CHANGE_LOAD:
2123 case MENU_CHARA_OPEN:
2124 case MENU_CHARA_CLOSE:
2128 face_alpha = bright;
2129 panel_alpha = bright;
2134 if (i < BtlMenuStatusPt->party_size) {
2135 float box_x = 23.0f + face_x;
2136 float box_y = 86.0f + face_y;
2138 if (status_alpha > 0x80) {
2139 status_alpha = 0x80;
2142 if (status_alpha < 0) {
2146 DrawOtherCharaStatus((
int) box_x, (
int) box_y, i, status_alpha);
2147 box_x = 394.0f + SysChara[i].
x - 29.0f;
2148 box_y = 120.0f + SysChara[i].
y - 3.0f;
2150 if (panel_alpha > 0x80) {
2154 if (panel_alpha < 0) {
2159 if (box_x < -300.0f || (
float) 0x28A < box_x || face_y < -130.0f || 1280.0f < face_y) {
2161 if (box_x < -300.0f || (
float) 0x28A < box_x || face_y < -130.0f || 448.0f < face_y) {
2166 MenuTextureReload(BtlMenuExReadBlock);
2167 DrawSelCharaStatus(box_x, box_y, i, panel_alpha, (
int) size, face_alpha, (
int) draw_x, (
int) face_y);
2170 MenuTextureReload(BtlMenuExReadBlock);
2183 s16 hp = BtlMenuStatusPt->
hp[i];
2186 if (hp <= 0 || (condition & AILMENT_KNOCKED_OUT)) {
2191 face = NonCharaFace;
2193 if (SysChara[i].place == 0) {
2194 face = TexManager.GetTexture(
"nonchara2", -1);
2208 if (face_alpha > 0x80) {
2212 if (face_alpha < 0) {
2216 if (MenuChara.
state == MENU_CHARA_CHANGE_EXIT || MenuChara.
state == MENU_CHARA_CHANGE_LOAD) {
2219 if (face_alpha < 0) {
2224 if (0.0f < draw_x && draw_x < 640.0f && 0.0f < face_y && face_y < SCREEN_HEIGHT_F) {
2225 DrawMenu2DSprite(face,
CRect_i_((
int) draw_x, (
int) face_y, (
int) size, (
int) size),
CRect_i_(u, v, width, width), shade, shade, shade, face_alpha);
2229 CommonMenuMes1.
auto_pos = MES_POS_NONE;
2232 switch (MenuChara.
state) {
2233 case MENU_CHARA_MESSAGE:
2234 AllFadeForMenu(0x40);
2235 CommonMenuMes1.
auto_pos = MES_POS_CENTRE;
2237 CommonMenuMes1.
Step();
2240 case MENU_CHARA_OPEN:
2241 case MENU_CHARA_CLOSE:
2242 case MENU_CHARA_CHANGE_LOAD:
2243 case MENU_CHARA_CHANGE_EXIT:
2247 float waku_x = 394.0f + chara_r_long * cosf(angle) - 184.0f;
2248 face_y = 120.0f + chara_r_long * sinf(angle) - 26.0f;
2250 int cursor_x = 0x3C;
2253 for (i = 0; i < 6; i++) {
2254 if (SysChara[i].place == 0) {
2259 if (BtlMenuStatusPt->
party_size <= SysChara[i].chara) {
2261 waku_x = (float) (0x18A + chara_r_long * cos(angle) - 30.0);
2265 SysCur[0] += ((float) cursor_x - SysCur[0]) / 4.0f;
2266 int draw_x = (int) SysCur[0];
2267 DrawMenuWaku(waku_x, face_y, width, 0x82, 1, StayTex, 0x80);
2268 DrawMenuObjectVibe(draw_x, (
int) SysCur[1], 1, 0x40);
2281 max_exp = GetWeaponMaxExp(weapon);
2284 if (max_exp < exp) {
2296 int exp_len = exp * 99 / max_exp;
2297 DrawMenu2DSprite(WepStatus,
CRect_i_(rect.
x, y, durability, 8),
CRect_i_(0x100, 0x70, 8, 8), alpha);
2298 static int warningcnt = 0;
2302 abs((
int) (60.0f * sinf((
float) warningcnt / 18.0f)));
2305 if (warningcnt > 1000000) {
2310 MGFillBox(
CRect_i_(rect.
x * 16, ((y - 1) >> 1) * 16, (durability + 1) * 16, 0x50), 0x4F, 0x4F, 0x4F, alpha);
2312 memcpy(&colours, GetGradationColorInfo2(25),
sizeof(colours));
2319 RECT digits = {0xD4, 0x1F4, 0xC, 0xD};
2321 DrawMenuNumber(durability, x, y, WepStatus, digits, 1, alpha);
2322 DrawMenu2DSprite(WepStatus,
CRect_i_(x - 0x20, y, 0xC, 0xB),
CRect_i_(digits.
x + 0x78, digits.
y, 0xC, 0xC), alpha);
2323 DrawMenuNumber(now, x - 0x20, y, WepStatus, digits, 1, alpha);
2326 DrawMenu2DSprite(WepStatus,
CRect_i_(rect.
x, y, exp_len, 8),
CRect_i_(0x100, 0x78, 8, 8), alpha);
2327 int digits_count = GetNumberKeta(max_exp);
2330 x += digits_count * 0x18;
2331 DrawMenuNumber(max_exp, x, y, WepStatus, digits, 1, alpha);
2332 x -= digits_count * 0x10;
2333 DrawMenu2DSprite(WepStatus,
CRect_i_(x, y, 0xC, 0xB),
CRect_i_(digits.
x + 0x78, digits.
y, 0xC, 0xC), alpha);
2334 DrawMenuNumber(exp, x, y, WepStatus, digits, 1, alpha);
2337void DrawWepStatus(
int x,
int y,
WEAPON_HAVE *weapon,
int selected,
int alpha) {
2340 if (selected != 0) {
2344 DrawMenu2DSprite(WepStatus,
CRect_i_(x, y + 1, 0xAC, 0x33),
CRect_i_(0xD4, v, 0xAC, 0x34), alpha);
2345 RECT rect = {0, 0, 0x30, -7};
2348 DrawWepDamageDraw(rect, weapon, alpha);
2351void DrawWepVolumeDisplay(
int x,
int y,
WEAPON_HAVE *weapon,
int alpha) {
2359 WeaponAllValueSet(weapon, &total, 0);
2360 CRect_i_ source(0x110, 0xCC, 0x10, 0x10);
2361 CRect_i_ dest(x, y, source.width, source.height);
2362 RECT digits = {0xD4, 0x1F4, 0xC, 0xD};
2367 MenuTextureReload(BtlMenuReadBlock);
2369 DrawMenu2DSprite(MenuCharaFace,
CRect_i_(x, y - 0x10, 0x20, 0x10),
CRect_i_(0xE0, weapon->
best_elem * 16, 0x20, 0x10), alpha);
2371 MenuTextureReload(BtlMenuExtBlock);
2375 int values[4] = {0, 0, 0, 0};
2376 values[0] = total.
attack;
2378 values[2] = total.
speed;
2379 values[3] = total.
magic;
2380 float rate = GetNowWeaponRate(&total);
2382 limit[0] = (int) ((
float) limit[0] * rate);
2383 limit[3] = (int) ((
float) limit[3] * rate);
2385 for (
int i = 0; i < 4; i++, dest.y += source.height, source.y += source.height) {
2386 if (limit[i] < values[i]) {
2387 values[i] = limit[i];
2390 DrawMenu2DSprite(WepStatus, dest, source, alpha);
2391 DrawMenuNumber(values[i], dest.x + source.width + digits.
width * 3 - 2, dest.y + 2, WepStatus, digits, 1, alpha);
2402static void DrawWeaponNameBoard(
int x,
int y,
int width,
int alpha,
int brightness) {
2403 CRect_i_ left(x, y + 1, 0x28, 0x1F);
2404 CRect_i_ middle(x + 0x28, y + 1, 0x99, 0x1F);
2405 CRect_i_ right(x + 0xAC, y + 1, 0x20, 0x1F);
2407 DrawMenu2DSprite(WepStatus, left,
CRect_i_(0xE0, 0x1A8, 0x28, 0x20), brightness, brightness, brightness, alpha);
2408 DrawMenu2DSprite(WepStatus, middle,
CRect_i_(0x108, 0x1A8, 0x78, 0x20), brightness, brightness, brightness, alpha);
2409 DrawMenu2DSprite(WepStatus, right,
CRect_i_(0xD4, 0x1D4, 0x20, 0x20), brightness, brightness, brightness, alpha);
2412s32 GetWeaponNamePutX(s32 center_x, s32 width) {
2413 return center_x - (width >> 1);
2419static inline void SetLinePos(
ClsMes *window,
int line,
int x,
int y) {
2420 if (line >= 0 && line < 10) {
2437static void WeaponNameDraw(
int y,
int selected_only,
int alpha) {
2438 int previous_mes[4];
2439 int previous_level[4];
2441 MenuTextureReload(AtoraNameMes.
tex_block);
2444 for (
int i = 0; i < 4; i++) {
2445 previous_mes[i] = AtoraNameMes.
mes_no[i];
2446 previous_level[i] = AtoraNameMes.
values[i];
2449 int x = 22.0f + WeaponPos + slot * 0xD6;
2452 for (
int i = 0; i < 3; i++) {
2456 if (x < -140 || x > 630 || (selected_only == 1 && slot != WepMenu.
weapon_slot) || slot < 0 || slot > 9 || ((WepMenu.
state == WEP_STATE_STATUS_BREAK_EFFECT || WepMenu.
state == WEP_STATE_BUILDUP_EFFECT) && slot == WepMenu.
weapon_slot) || (WepMenu.
mode > WEP_MENU_LIST && slot != WepMenu.
weapon_slot) || (WepMenu.
state != WEP_STATE_REPAIR_EFFECT && WepMenu.
state >= WEP_STATE_STATUS_BREAK_EFFECT && WepMenu.
state < WEP_STATE_WARNING) || (WepMenu.
state == WEP_STATE_LEVELUP_EFFECT && slot != WepMenu.
weapon_slot)) {
2459 mes_no = GetWeaponMsgNo(&DngWepHavePt[slot]);
2461 if (mes_no < 0 || slot < 0) {
2467 level = DngWepHavePt[slot].
level;
2472 AtoraNameMes.
mes_no[i] = mes_no;
2473 AtoraNameMes.
values[i] = level;
2474 int name_x = GetWeaponNamePutX(x + 0x42, width);
2479 if (level / 10 > 0) {
2484 SetLinePos(&AtoraNameMes, i, name_x, y);
2489 for (
int i = 0; i < 4; i++) {
2492 AtoraNameMes.
mes_no[i] = 999;
2496 for (
int i = 0; i < 4; i++) {
2497 if (AtoraNameMes.
mes_no[i] != previous_mes[i] || AtoraNameMes.
values[i] != previous_level[i]) {
2505 AtoraNameMes.
Step();
2508 if (WepMenu.
mode == WEP_MENU_LIST && WepMenu.
state == WEP_STATE_IDLE) {
2509 CTexture *frame = TexManager.GetTexture(
"frame_image", -1);
2511 if (frame != NULL) {
2512 TexManager.ReloadTexture(GetVif1Packet(), frame->
block);
2518 CRect_i_ rect(0, 0x14A, 0x104, 0x76);
2519 set2DSprite(GetVif1Packet(), frame, rect, rect, 0x40, 0x40, 0x40, alpha);
2525RECT WeaponVolumeNumberRect = {212, 500, 12, 13};
2534static void WepStatusVolumeDraw(
RECT rect,
int width,
int *volume,
int color,
int alpha,
int build,
int gain) {
2536 int fill = (float) (volume[1] * width) / (float) volume[0];
2543 memcpy(&gradation, GetGradationColorInfo2(color),
sizeof(gradation));
2544 gradation.
colors[3].
a = alpha;
2545 gradation.
colors[2].
a = alpha;
2546 gradation.
colors[1].
a = alpha;
2547 gradation.
colors[0].
a = alpha;
2549 DrawMenuColorGradation(bar, &gradation.
colors[0], &gradation.
colors[1], &gradation.
colors[2], &gradation.
colors[3]);
2550 fill = (float) (volume[2] * width) / (float) volume[0];
2556 int number_alpha = 1.5f * alpha;
2558 if (build == 1 && gain > 0) {
2559 DrawMenuNumber(volume[1], rect.
x + rect.
width, y + rect.
height, WeaponVolumeNumberRect, WepStatus, 2, 0xDC, 0, 0, alpha);
2561 DrawMenuNumber(volume[1], rect.
x + rect.
width, y + rect.
height, WepStatus, WeaponVolumeNumberRect, 2, alpha);
2565void DrawWeaponStatusWaku(
int x,
int y,
int width,
int limit) {
2567 {{0x3B, 0x68, 0x56, 0x80}, {0x3B, 0x68, 0x56, 0x80}},
2568 {{0x00, 0x00, 0xE6, 0x80}, {0x00, 0x00, 0xE6, 0x80}}
2570 CRect_i_ rect(x - 1, y - 1, width + 2, 10);
2571 DrawMenuSideGradation(rect, &colours[limit][0], &colours[limit][1]);
2581static void DrawLimmitMax(
int x,
int y,
int alpha) {
2582 DrawMenu2DSprite(WepStatus,
CRect_i_(x, y, 0x1E, 0xA),
CRect_i_(0xF8, 0x158, 0x1E, 0xA), alpha);
2585void DrawBtlMenuLRCursor(
int x,
int y,
int width,
int alpha) {
2586 int count = CursorVibeCnt % 79;
2588 int draw_y = (int) ((
float) y + 4.0f * sinf((
float) (pi * ((
double) count - 40.0) / 40.0)));
2589 CRect_i_ source(0x62, 0x14, 0x1A, 0x18);
2590 DrawMenu2DSprite(PerBoardTex,
CRect_i_(x, draw_y, source.width, source.height), source, alpha);
2591 source.x += source.width;
2592 DrawMenu2DSprite(PerBoardTex,
CRect_i_(x + width, draw_y, source.width, source.height), source, alpha);
2595void DrawWeaponStatusTag(
int x,
int y,
WEAPON_HAVE *weapon,
int build,
int weapon_no,
int alpha) {
2599 built = GetWeaponData(weapon_no);
2602 RECT pos = {0, 0, 0x1E, -8};
2605 s16 gauge[2] = {0, 0};
2609 gauge[0] = (int) now;
2614 int shown = (int) now;
2616 if ((
float) shown < now) {
2617 shown = (int) (1.0f + now);
2620 int full = value * 0x7E / 99;
2621 int fill = shown * full / value;
2627 MGFillBox(
CRect_i_(pos.
x * 16, (bar_y >> 1) * 16, full * 16, 0x40), 0x4F, 0x4F, 0x4F, alpha);
2629 memcpy(&colours, GetGradationColorInfo2(25),
sizeof(colours));
2637 for (
int digits = GetNumberKeta(value) - 1; digits > 0; digits--) {
2638 int width = pos.
width;
2642 DrawMenuNumber(weapon->
durability, number_x, bar_y, WepStatus, WeaponVolumeNumberRect, 1, alpha);
2643 DrawMenu2DSprite(WepStatus,
CRect_i_(number_x - 0x20, bar_y, 0xC, 0xB),
CRect_i_(WeaponVolumeNumberRect.
x + 0x78, WeaponVolumeNumberRect.
y, 0xC, 0xC), alpha);
2644 DrawMenuNumber(shown, number_x - 0x20, bar_y, WepStatus, WeaponVolumeNumberRect, 1, alpha);
2648 int max_exp = GetWeaponMaxExp(weapon);
2649 int exp_len = (weapon->
experience << 7) / max_exp;
2651 if (exp_len > 0x7E) {
2655 DrawMenu2DSprite(WepStatus,
CRect_i_(pos.
x, bar_y, exp_len, 8),
CRect_i_(0x100, 0x78, 8, 8), alpha);
2658 for (
int digits = GetNumberKeta(max_exp); digits >= 2; digits--) {
2659 number_x += WeaponVolumeNumberRect.
width * 2;
2662 int left = DrawMenuNumber(max_exp, number_x, bar_y, WepStatus, WeaponVolumeNumberRect, 1, alpha);
2663 DrawMenu2DSprite(WepStatus,
CRect_i_(left - 0xB, bar_y, 0xC, 0xB),
CRect_i_(WeaponVolumeNumberRect.
x + 0x78, WeaponVolumeNumberRect.
y, 0xC, 0xC), alpha);
2664 DrawMenuNumber(weapon->
experience, left - 0xB, bar_y, WepStatus, WeaponVolumeNumberRect, 2, alpha);
2665 int values[4] = {0, 0, 0, 0};
2666 values[0] = weapon->
attack;
2668 values[2] = weapon->
speed;
2669 values[3] = weapon->
magic;
2670 int bonus[4] = {0, 0, 0, 0};
2671 int target[4] = {0, 0, 0, 0};
2673 if (build == 1 && built != NULL) {
2674 target[0] = built->
attack;
2676 target[2] = built->
speed;
2677 target[3] = built->
magic;
2684 for (
int i = 0; i < 4; i++) {
2685 bonus[i] = GetWeaponAttachStatusUp(weapon, i + 1);
2693 float rate = GetNowWeaponRate(weapon);
2699 if (!(rate <= 1.0f)) {
2700 limit[0] = (int) ((
float) limit[0] * rate);
2701 limit[3] = (int) ((
float) limit[3] * rate);
2704 RECT row = {0, 0, -4, -2};
2707 int volume[3] = {0, 0, 0};
2710 for (
int i = 0; i < 4; i++) {
2713 volume[1] = value + bonus[i];
2714 volume[1] = (int) ((
float) volume[1] * rate);
2716 if (volume[1] >= limit[i]) {
2717 volume[1] = limit[i];
2723 if (volume[2] >= limit[i]) {
2724 volume[2] = limit[i];
2727 int length = (int) ((
float) (volume[1] << 7) / (
float) volume[0]);
2729 if (length > 0x80) {
2733 int diff = target[i] - value;
2734 DrawWeaponStatusWaku(row.
x, row.
y, length, limited);
2735 WepStatusVolumeDraw(row, 0x80, volume, i + 3, alpha, build, diff);
2738 DrawLimmitMax(row.
x + 4, row.
y + 3, 0x80);
2745void DrawWeaponElemTag(
int x,
int y,
WEAPON_HAVE *weapon,
int build,
int weapon_no,
int alpha) {
2749 built = GetWeaponData(weapon_no);
2755 int src_y = best * 0x18 + 0x68;
2756 int tag_y = y + 0x24 + best * 0x18;
2757 DrawMenu2DSprite(WepStatus,
CRect_i_(x + 6, tag_y + 1, 0x2C, 0x18),
CRect_i_(0xD4, src_y, 0x2C, 0x18), alpha);
2760 RECT row = {0, 0, -4, -4};
2763 float rate = GetNowWeaponRate(weapon);
2764 int bonus[5] = {0, 0, 0, 0, 0};
2765 int target[5] = {0, 0, 0, 0, 0};
2768 for (
int i = 0; i < 5; i++) {
2769 bonus[i] = GetWeaponAttachStatusUp(weapon, i + 8);
2773 if (build == 1 && built != NULL) {
2774 for (
int i = 0; i < 5; i++) {
2775 target[i] = built->
elem[i];
2779 int volume[3] = {0, 0, 0};
2782 for (
int i = 0; i < 5; i++) {
2784 volume[1] = weapon->
elem[i] + bonus[i];
2785 volume[1] = (int) ((
float) volume[1] * rate);
2787 if (volume[1] >= 99) {
2792 volume[2] = weapon->
elem[i];
2794 if (volume[2] >= 99) {
2798 float length = (float) (volume[1] << 7) / (float) volume[0];
2799 int width = (int) length;
2800 DrawWeaponStatusWaku(row.
x, row.
y, (
int) length, limited);
2801 int diff = target[i] - weapon->
elem[i];
2802 WepStatusVolumeDraw(row, 0x80, volume, i + 7, alpha, build, diff);
2805 DrawLimmitMax(row.
x + 2, row.
y + 4, 0x80);
2812 int mark_y = y + 0x30 + best * 0x18;
2813 DrawMenu2DSprite(WepStatus,
CRect_i_(x + 0x8A, mark_y, 0x42, 0x15),
CRect_i_(0xD4, 0x190, 0x42, 0x16), (alpha * 0x6E) >> 7);
2817void DrawWeaponVsMonster(
int x,
int y,
WEAPON_HAVE *weapon,
int build,
int weapon_no,
int alpha) {
2821 built = GetWeaponData(weapon_no);
2825 RECT row = {0, 0, 0x10, -8};
2828 int volume[3] = {100, 0, 0};
2829 int bonus[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
2830 int target[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
2833 for (
int i = 0; i < 10; i++) {
2834 bonus[i] = GetWeaponAttachStatusUp(weapon, i + 14);
2839 for (
int i = 0; i < 10; i++) {
2844 float rate = GetNowWeaponRate(weapon);
2846 for (
int i = 0; i < 10; i++) {
2848 volume[1] = weapon->
vs_monster[i] + bonus[i];
2849 volume[1] = (int) ((
float) volume[1] * rate);
2851 if (volume[1] >= 99) {
2858 if (volume[2] >= 99) {
2862 float length = (float) (volume[1] << 6) / (float) volume[0];
2863 int width = (int) length;
2864 DrawWeaponStatusWaku(row.
x, row.
y, (
int) length, limited);
2865 int diff = target[i] - weapon->
vs_monster[i];
2866 WepStatusVolumeDraw(row, 0x40, volume, i + 12, alpha, build, diff);
2869 DrawLimmitMax(row.
x + 0x1E, row.
y + 4, 0x80);
2888static void DrawWeaponTagBoard(
int x,
int y,
WEAPON_HAVE *weapon,
int build,
int weapon_no,
int alpha) {
2895 for (; i < 3; i++) {
2896 int brightness = 128;
2908 if (WepMenu.
mode == WEP_MENU_ELEMENT && tag != WEP_TAG_ELEMENT) {
2912 int top = tag * 0xAA;
2913 DrawMenu2DSprite(WepStatus,
CRect_i_(x, y, 0xD4, 0xAA),
CRect_i_(0, top, 0xD4, 0xAA), brightness, brightness, brightness, alpha);
2917 if (weapon != NULL) {
2919 case WEP_TAG_STATUS:
2920 DrawWeaponStatusTag(x, y, weapon, build, weapon_no, alpha);
2922 case WEP_TAG_ELEMENT:
2923 DrawWeaponElemTag(x, y, weapon, build, weapon_no, alpha);
2925 case WEP_TAG_VS_MONSTER:
2926 DrawWeaponVsMonster(x, y, weapon, build, weapon_no, alpha);
2932void DrawAallWeapon(
int x,
int y,
float depth,
CCharacter *model,
WEAPON_HAVE *weapon,
int equipped,
int selected,
int alpha) {
2933 if (weapon == NULL) {
2937 MenuTextureReload(MenuExtendReadBlock);
2940 sceVu0FVECTOR position = {0.0f, -1.3f, 0.0f, 1.0f};
2941 position[0] = depth;
2943 if (model != NULL) {
2944 if (equipped != 0) {
2945 position[1] = -1.3f + sinf(WepFrameRate);
2946 WepFrameRate += 0.34906587f;
2949 if (limit <= WepFrameRate) {
2950 WepFrameRate = limit;
2953 if (PI != WepFrameRate) {
2959 position[0] += offset->
position[0];
2960 position[1] += offset->
position[1];
2962 float scale = offset->
scale;
2963 model->
SetScale(scale, scale, scale);
2965 if (selected != 0) {
2966 spin = (float) (PI_D * (CursorVibeCnt % 219 - 110) / 110);
2970 float rot_x = -HALF_PI;
2977 spin = rot_y + spin;
2983 float rot_z = 0.62831855f;
2996 MenuTextureReload(BtlMenuExtBlock);
2999 MenuTextureReload(BtlMenuReadBlock);
3002 switch (WepMenu.
mode) {
3004 case WEP_MENU_ACTION:
3005 case WEP_MENU_ELEMENT:
3006 case WEP_MENU_LEVELUP_CONFIRM:
3007 case WEP_MENU_STATUS_BREAK_CONFIRM:
3008 case WEP_MENU_BUILDUP_SELECT:
3009 case WEP_MENU_BUILDUP_CONFIRM:
3010 case WEP_MENU_BUILDUP_PREVIEW:
3012 DrawWepStatus(draw_x, y + 0x66, weapon, equipped, alpha);
3013 DrawWepVolumeDisplay(x, y + 0x14, weapon, alpha);
3015 case WEP_MENU_ATTACH_WEAPON:
3016 case WEP_MENU_ATTACH_SOCKETS:
3017 case WEP_MENU_ATTACH_BOARD:
3018 case WEP_MENU_ATTACH_TAGS:
3022 DrawWeaponNameBoard(x - 0x11, y - 0x32, equipped, alpha, 0x80);
3024 if (equipped != 0) {
3025 DrawMenu2DSprite(WepStatus,
CRect_i_(x + 10, y - 0x15, 0x40, 0x17),
CRect_i_(0xD4, 0x141, 0x40, 0x17), alpha);
3028 WeaponStarDraw(x + 4, y + 0x3C, weapon, alpha);
3030 if (selected != 0) {
3031 MenuMes.
draw_x = x + 0xBE;
3032 MenuMes.
draw_y = y + 0xE;
3036 WeaponOptionStatusDraw(weapon, x + 0x50, y - 0x12, alpha);
3039 if (selected != 0) {
3040 MenuMes.
draw_x = x + 0xA0;
3041 MenuMes.
draw_y = y + 0xE;
3043 WeaponOptionStatusDraw(weapon, x + 0x50, y - 0x12, alpha);
3046 float hole_scale[2] = {0.75f, 1.0f};
3047 float width = GetWeaponHoleNum(weapon->
item_no) * 0x12 + 10;
3048 width *= hole_scale[selected];
3049 draw_x = (int) ((
float) (x + 0x52) - width);
3051 if (WepMenu.
mode >= WEP_MENU_ATTACH_WEAPON) {
3052 DrawWepHole(draw_x, 0xB8, weapon, selected, alpha);
3053 MenuTextureReload(MenuShadowReadBlock);
3054 DrawWepAttach(draw_x + 0xE, 0xBE, weapon, selected, alpha);
3058void BtlWeaponDraw(
int x,
float depth,
int chara,
int alpha) {
3061 sceVu0FVECTOR ref = {0.0f, 0.0f, -45.0f, 1.0f};
3062 sceVu0FVECTOR pos = {0.0f, 0.0f, 60.0f, 1.0f};
3063 sceVu0FVECTOR ambient;
3064 sceVu0FVECTOR bright;
3065 sceVu0FMATRIX light_dir;
3066 sceVu0FMATRIX light_col;
3070 MGGetPLight(light_dir, light_col);
3071 MGGetAmbient(ambient);
3072 bright[0] = bright[1] = bright[2] = 80.0f;
3073 sceVu0FVECTOR direction = {0.3f, 1.0f, 0.3f, 0.0f};
3074 sceVu0FVECTOR normal;
3075 sceVu0Normalize(normal, direction);
3076 sceVu0FMATRIX dir = {
3077 {0.3f, 0.0f, 0.0f, 0.0f},
3078 {0.3f, 0.0f, 0.0f, 0.0f},
3079 {0.3f, 0.0f, 0.0f, 0.0f},
3080 {0.0f, 0.0f, 0.0f, 0.0f}
3082 sceVu0FMATRIX col = {
3083 {96.0f, 96.0f, 96.0f, 0.0f},
3084 {0.0f, 0.0f, 0.0f, 0.0f},
3085 {0.0f, 0.0f, 0.0f, 0.0f},
3086 {0.0f, 0.0f, 0.0f, 0.0f}
3088 dir[0][0] = normal[0];
3089 dir[1][0] = normal[1];
3090 dir[2][0] = normal[2];
3091 MGSetPLight(dir, col);
3093 for (
int i = 0; i < 10; i++, x += 0xD6, depth += 16.0f) {
3094 int draw_alpha = alpha;
3096 if (x < -0x60 || (WepMenu.
mode >= WEP_MENU_ATTACH_WEAPON && i != cursor)) {
3105 int is_equipped = 0;
3107 if (i == equipped_slot) {
3111 int is_selected = 0;
3117 if (is_selected != 0) {
3118 switch (WepMenu.
state) {
3119 case WEP_STATE_STATUS_BREAK_EFFECT:
3121 case WEP_EFFECT_STATE_BREAK_PLAY:
3122 draw_alpha = (int) (128.0f - 4.0f * MenuWepLevelUp.
effect_timer);
3124 if (draw_alpha < 0) {
3129 case WEP_EFFECT_STATE_BREAK_DONE:
3136 if (draw_alpha > 0x80) {
3146 MenuMes.
alpha = draw_alpha;
3148 if (WepMenu.
mode > WEP_MENU_LIST) {
3153 if (WepMenu.
state >= WEP_STATE_LEVELUP_EFFECT) {
3158 if (WepMenu.
state >= WEP_STATE_LEVELUP_EFFECT && WepMenu.
state < 15) {
3163 bright[3] = draw_alpha;
3164 MGSetAmbient(bright);
3166 if (MenuExTextureReadFlag != MENU_EX_TEX_READY) {
3170 if (weapon->
item_no >= ITEM_WEAPON_START) {
3173 switch (GetNowTestNo()) {
3175 if (is_equipped != 0) {
3176 MenuTextureReload(MenuShadowReadBlock);
3177 char *shadows[6] = {
"kagetoan",
"kagesyao",
"kagegoro",
"kageruby",
"kageunga",
"kageozu"};
3178 DrawMenu2DSprite(TexManager.GetTexture(shadows[WepMenu.
chara], -1),
CRect_i_(x + 0x24, 0x96, 0x64, 0x63),
CRect_i_(0, 0, 0x64, 0x64), draw_alpha * 9 / 40);
3179 MenuTextureReload(MenuExtendReadBlock);
3182 int frame_no = GetMenuWeaponModelFrameNo(i);
3184 if (frame_no >= 0) {
3185 frame = &DngWeaponFrm[frame_no];
3186 MenuWeaponSpSet(frame, weapon);
3192 if (frame != NULL) {
3193 DrawAallWeapon(x, 0xA0, depth, frame, weapon, is_equipped, is_selected, draw_alpha);
3197 MenuTextureReload(BtlMenuExtBlock);
3200 MenuTextureReload(BtlMenuReadBlock);
3203 if (is_selected == 0 || WepMenu.
state != WEP_STATE_STATUS_BREAK_EFFECT) {
3204 DrawMenuNothing(x - 4, 0x82, 0xB4, 0x96,
"wepstatus", 0, draw_alpha);
3208 MenuMes.
mode = MENU_CLSMES_OFF;
3210 switch (WepMenu.
mode) {
3211 case WEP_MENU_ATTACH_TAGS:
3212 case WEP_MENU_ATTACH_SOCKETS:
3213 case WEP_MENU_ATTACH_BOARD:
3214 case WEP_MENU_ATTACH_WEAPON:
3215 MenuTextureReload(BtlMenuReadBlock);
3216 DrawBtlMenuLRCursor(x - 0x1C, 0xE6, 0xD4, draw_alpha);
3218 MenuTextureReload(BtlMenuExtBlock);
3220 DrawWeaponTagBoard(x - 0xC, 0xF0, weapon, 0, 0, draw_alpha);
3222 WeaponOptionStatusDraw(weapon, x + 0x50, 0x8E, draw_alpha);
3225 MenuMes.
mode = MENU_CLSMES_OPTIONS;
3230 MGSetPLight(light_dir, light_col);
3231 MGSetAmbient(ambient);
3233 if (MenuExTextureReadFlag == MENU_EX_TEX_READY) {
3236 switch (WepMenu.
mode) {
3237 case WEP_MENU_ATTACH_TAGS:
3238 case WEP_MENU_ATTACH_WEAPON:
3239 case WEP_MENU_ATTACH_SOCKETS:
3240 case WEP_MENU_ATTACH_BOARD:
3245 WeaponNameDraw(0x72, tags, alpha);
3248 switch (WepMenu.
mode) {
3249 case WEP_MENU_ATTACH_TAGS:
3250 case WEP_MENU_ATTACH_SOCKETS:
3251 case WEP_MENU_ATTACH_BOARD:
3252 case WEP_MENU_ATTACH_WEAPON:
3257 if (WepMenu.
mode != WEP_MENU_LIST) {
3261 FadeTexX(0, 0xCC, 0x1AE, 0xD2,
"frame_image", dim);
3266 if (WepMenu.
state != WEP_STATE_STATUS_BREAK_EFFECT) {
3279static int NowWeaponStatusValue(
WEAPON_HAVE *weapon) {
3280 if (weapon == NULL) {
3286 if (weapon->
experience >= GetWeaponMaxExp(weapon) || GetNowItemNum(ITEM_POWERUP_POWDER, MenuItemPackPt) > 0) {
3290 if (WeaponStatusBreakEnable(weapon) != 0) {
3297 if (WeaponStatusBuildUp(weapon, build_up) > 0 && GetNowWeaponAttachNum(weapon) == 0 && build_up > 0) {
3301 if (IsNotBuildUpWeapon(weapon->
item_no) != 0) {
3306 if (status & 0x10) {
3317static int EnableWeaponElemNone(
int weapon_no) {
3318 if (WhoIsWeaponEquip(weapon_no) == CHARA_RUBY) {
3322 if ((
unsigned int) (weapon_no - ITEM_WEAPON_BLESSING_GUN) <= 1U || weapon_no == ITEM_WEAPON_HEXA_BLASTER || weapon_no == ITEM_WEAPON_SUPERNOVA) {
3341 if (weapon->
best_elem == 5 && EnableWeaponElemNone(weapon->
item_no) != 0) {
3342 SetWeaponElementStatus(weapon);
3345 printf(
"now active elem = %d\n", weapon->
best_elem);
3346 printf(
"now active vol = %d\n", weapon->
elem[weapon->
best_elem]);
3360 if (EnableWeaponElemNone(weapon->
item_no) != 0) {
3361 WepMenu.
state = WEP_STATE_WARNING;
3367 }
else if (attachment->
elem[elem] > 0) {
3370 WepMenu.
state = WEP_STATE_WARNING;
3375 if (weapon != NULL) {
3376 printf(
"now elem = %d\n", weapon->
best_elem);
3379 printf(
"now elem vol = %d\n", attachment->
elem[weapon->
best_elem]);
3386void DrawWeaponSelectDialog(
int x,
int y,
int alpha) {
3389 if (BtlMenuNowLang > LANG_JAPANESE) {
3393 int left = x + shift;
3394 int top = y + shift;
3397 int repair_items = GetNowItemNum(ITEM_REPAIR_POWDER, MenuItemPackPt);
3398 int options = NowWeaponStatusValue(weapon);
3401 switch (WepMenu.
state) {
3402 case WEP_STATE_EQUIP:
3407 DrawMenu2DSprite(WepStatus,
CRect_i_(left, top + 1, 0x60, 0x1F),
CRect_i_(0x120, title_v, 0x60, 0x20), alpha);
3408 CRect_i_ source(0x120, 0x88, 0x60, 0x20);
3409 DrawMenu2DSprite(WepStatus,
CRect_i_(left, top + 0x1B, 0x60, 0x1F), source, alpha);
3413 if (WepMenu.
mode == WEP_MENU_ELEMENT) {
3414 build_x = left + 0x28;
3417 DrawMenu2DSprite(WepStatus,
CRect_i_(build_x, top + 0x35, 0x60, 0x1F),
CRect_i_(0x120, 0x148, 0x60, 0x20), alpha);
3420 if (repair_items <= 0 || weapon->durability_f == (
float) weapon->
durability) {
3424 static int warmcnt = 0;
3425 int default_no = GetDefaultWeaponNo(WepMenu.
chara);
3428 bright = abs((
int) (50.0f * sinf((
float) warmcnt / 12.0f))) + 0x78;
3431 if (warmcnt > 1000000) {
3436 DrawMenu2DSprite(WepStatus,
CRect_i_(left, top + 0x4F, 0x60, 0x1F), source, bright, bright, bright, alpha);
3438 static int levelbrinkcnt = 0;
3439 int level_bright = 0x80;
3442 if (levelbrinkcnt > 1000000) {
3446 CRect_i_ dest(left, top + 0x69, 0x60, 0x1F);
3448 for (
int i = 1; i <= 3; i++) {
3449 if (options & (1 << i)) {
3450 DrawMenu2DSprite(WepStatus, dest, source, level_bright, level_bright, level_bright, alpha);
3459 WeaponStatusBuildUp(weapon, build);
3460 int attached = GetNowWeaponAttachNum(weapon);
3462 if (build > 0 && attached == 0) {
3463 level_bright += abs((
int) (40.0f * sinf((
float) levelbrinkcnt / 12.0f)));
3468 switch (WepMenu.
state) {
3469 case WEP_STATE_SCRAP_PROMPT:
3470 case WEP_STATE_SCRAP_CONFIRM:
3471 DrawMenu2DSprite(BtStatus,
CRect_i_(x + 0x64, y + 0x33, 0x60, 0x1F),
CRect_i_(0, 0x80, 0x60, 0x20), 0x80);
3483static void InitWeaponSelect(
int mode,
int chara) {
3484 InitPersonalBoardMode((
CUserStatus *) BtlMenuStatusPt, &WepMenu.
board, PERSONAL_BOARD_WEAPON_ATTACH, BOARD_PAGE_ATTACH);
3486 WepMenu.
mode = WEP_MENU_LIST;
3487 WepMenu.
chara = chara;
3490 case WEP_OPEN_FROM_BAR:
3491 WepMenu.
state = WEP_STATE_OPEN;
3494 case WEP_OPEN_IN_PLACE:
3495 WepMenu.
state = WEP_STATE_IDLE;
3497 case WEP_OPEN_VIEW_ONLY:
3502 StartReadWepMDS(BtlMenuReadBuf, chara);
3503 MenuExTextureReadFlag = MENU_EX_TEX_UNREAD;
3507 for (
int i = 0; i < 10; i++) {
3508 if (DngWepHavePt[i].item_no < ITEM_WEAPON_START) {
3522 WepMenu.
chara = chara;
3524 for (
int i = 0; i < 6; i++) {
3525 SysChara[i].
x = (SysChara[i].
chara - WepMenu.
chara) * 110 + 270;
3526 SysChara[i].
y = 14.0f;
3534 CommonMenuMes3.
Preset(MES_PRESET_SYSTEM);
3535 CommonMenuMes3.
char_width = GetMenuCommonFontW(BtlMenuNowLang, -1);
3536 CommonMenuMes3.
style = MES_EDGE_NONE;
3539 AtoraNameMes.
char_width = GetMenuCommonFontW(BtlMenuNowLang, -1);
3540 AtoraNameMes.
style = MES_EDGE_NONE;
3542 memset(AtoraNameMes.
tex_buff, 0, 0x100);
3544 for (
int i = 0; i < 10; i++) {
3545 AtoraNameMes.
mes_no[i] = -1;
3546 AtoraNameMes.
values[i] = 0;
3550 AtoraNameMes.
Preset(MES_PRESET_NAME);
3553 MenuMes.
message->unk_02C = 0x10;
3564static void ExitWeaponMenuSelect() {
3567 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON && chara == WepMenu.
chara) {
3568 DngWeaponEquipModelBuild(chara, MenuExtendReadBlock, BtlMenuReadBuf);
3571 TexManager.DeleteTextureBlock(MenuExtendReadBlock);
3572 TexManager.CleanUpTextureList();
3573 BtlMenuTexBlockEnter();
3574 BattleMenuFlag = BTLMENU_STATE_WEAPON_CLOSE;
3580 CommonMenuMes3.
fade = 0.0f;
3581 CommonMenuMes3.
fade_in =
true;
3583 CommonMenuMes3.
waiting =
false;
3584 CommonMenuMes3.
text_at = 0.0f;
3590 CommonMenuMes3.
wait = 0;
3591 CommonMenuMes3.
blink = 0;
3596 for (
int slot = 0; slot < 10; slot++) {
3597 CommonMenuMes3.
mes_no[slot] = -1;
3600 for (
int slot = 0; slot < 8; slot++) {
3601 CommonMenuMes3.
values[slot] = 0;
3604 CommonMenuMes3.
value = 0;
3614 for (
int line = 0; line < 10; line++) {
3619 CommonMenuMes3.
Preset(MES_PRESET_SYSTEM);
3620 CommonMenuMes3.
char_width = GetMenuCommonFontW(BtlMenuNowLang, -1);
3626 AtoraNameMes.
char_width = GetMenuCommonFontW(BtlMenuNowLang, -1);
3629 BattleMenuFlag = BTLMENU_STATE_MAIN;
3632void WeaponMenuSelect() {
3635 switch (WepMenu.
state) {
3636 case WEP_STATE_OPEN:
3639 case WEP_STATE_CLOSE:
3644 int done = ToFromSelect(direction);
3646 switch (MenuExTextureReadFlag) {
3647 case MENU_EX_TEX_UNREAD:
3649 if (ReadBGSync() == 0) {
3650 if (MenuExTextureReadFlag != MENU_EX_TEX_UNREAD) {
3654 MenuExTextureReadFlag = EnterWeaponModel(WepMenu.
chara, MenuExtendReadBlock, WepMenu.
weapon_slot);
3655 BtlMenuTexBlockEnter();
3664 WeaponModelBuildFunc(WepMenu.
chara, MenuExtendReadBlock);
3667 MenuExTextureReadFlag++;
3671 case MENU_EX_TEX_BUILDING:
3674 if (BtlMDSBuildCnt > 3) {
3675 MenuExTextureReadFlag = MENU_EX_TEX_READY;
3681 if (WepMenu.
state != WEP_STATE_IDLE) {
3687 switch (WepMenu.
state) {
3688 case WEP_STATE_OPEN:
3689 if (!((
float) WepMenu.
counter <= 18.0f) && done != 0 && MenuExTextureReadFlag != MENU_EX_TEX_UNREAD) {
3690 BattleMenuFlag = BTLMENU_STATE_WEAPON;
3691 WepMenu.
state = WEP_STATE_IDLE;
3696 case WEP_STATE_CLOSE:
3697 if (WepMenu.
counter > 20 && done != 0) {
3698 ExitWeaponMenuSelect();
3702 case WEP_STATE_LEVELUP_EFFECT:
3703 case WEP_STATE_STATUS_BREAK_EFFECT:
3704 case WEP_STATE_BUILDUP_EFFECT:
3705 case WEP_STATE_REPAIR_EFFECT:
3706 if (MenuWepLevelUp.
effect_active == 0 && GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0 && (MenuWepLevelUp.
effect_state == WEP_EFFECT_STATE_BREAK_DONE || MenuWepLevelUp.
effect_state == WEP_EFFECT_STATE_LEVELUP_DONE || MenuWepLevelUp.
effect_state == WEP_EFFECT_STATE_BUILDUP_DONE || MenuWepLevelUp.
effect_state == WEP_EFFECT_STATE_RECOVER_DONE)) {
3709 switch (WepMenu.
state) {
3710 case WEP_STATE_LEVELUP_EFFECT:
3715 for (
int i = 0; i < 6; i++) {
3716 memset(&weapon->
attach[i], 0,
sizeof(weapon->
attach[i]));
3720 case WEP_STATE_STATUS_BREAK_EFFECT: {
3723 if (WepMenu.
weapon_slot == equipped || DngWepHavePt[equipped].item_no < ITEM_WEAPON_START) {
3724 EquipDefaultWeapon(WepMenu.
chara);
3730 case WEP_STATE_BUILDUP_EFFECT:
3731 case WEP_STATE_REPAIR_EFFECT:
3735 if (WepMenu.
state != WEP_STATE_REPAIR_EFFECT) {
3740 WepMenu.
state = WEP_STATE_IDLE;
3744 case WEP_STATE_WARNING:
3745 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
3746 WepMenu.
state = WEP_STATE_IDLE;
3751 case WEP_STATE_SCRAP_REFUSED:
3752 if (GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
3753 WepMenu.
state = WEP_STATE_IDLE;
3757 case WEP_STATE_SCRAP_PROMPT:
3758 if (GamePad.
Down(PAD_CROSS) != 0) {
3761 if (0 <= IsDefaultWeapon(weapon->
item_no)) {
3762 ComMenuSePlay(MENU_SOUND_REFUSE);
3763 WepMenu.
state = WEP_STATE_SCRAP_REFUSED;
3764 }
else if (weapon->
item_no == ITEM_WEAPON_SERPENT_SWORD && GetMenuHebikiriFlag() == 0) {
3765 WepMenu.
state = WEP_STATE_SCRAP_REFUSED;
3766 ComMenuSePlay(MENU_SOUND_REFUSE);
3768 WepMenu.
state = WEP_STATE_SCRAP_CONFIRM;
3769 ComMenuSePlay(MENU_SOUND_CONFIRM);
3771 }
else if (GamePad.
Down(PAD_CIRCLE | PAD_LEFT) != 0) {
3772 WepMenu.
state = WEP_STATE_IDLE;
3773 ComMenuSePlay(MENU_SOUND_CURSOR);
3776 if (WepMenu.
state == WEP_STATE_IDLE) {
3781 case WEP_STATE_SCRAP_CONFIRM:
3782 if (GamePad.
Down(PAD_UP | PAD_DOWN) != 0) {
3783 if (WepMenu.
confirm[0] != 0) {
3789 ComMenuSePlay(MENU_SOUND_CURSOR);
3792 if (GamePad.
Down(PAD_CROSS) != 0) {
3793 if (WepMenu.
confirm[0] == 0) {
3796 if (0 <= IsDefaultWeapon(weapon->
item_no)) {
3797 ComMenuSePlay(MENU_SOUND_REFUSE);
3799 InitHaveWep(weapon);
3800 ComMenuSePlay(MENU_SOUND_CONFIRM);
3801 WepMenu.
state = WEP_STATE_IDLE;
3804 EquipDefaultWeapon(WepMenu.
chara);
3807 ComMenuSePlay(MENU_SOUND_CONFIRM);
3810 WepMenu.
state = WEP_STATE_IDLE;
3811 ComMenuSePlay(MENU_SOUND_REFUSE);
3813 }
else if (GamePad.
Down(PAD_CIRCLE | PAD_LEFT) != 0) {
3814 WepMenu.
state = WEP_STATE_IDLE;
3815 ComMenuSePlay(MENU_SOUND_CURSOR);
3818 if (WepMenu.
state == WEP_STATE_IDLE) {
3820 WepMenu.
mode = WEP_MENU_LIST;
3824 case WEP_STATE_EQUIP:
3825 if (!(WepFrameRate < PI)) {
3826 WepMenu.
state = WEP_STATE_IDLE;
3828 case WEP_STATE_CHARA_CHANGE:
3830 WepMenu.
state = WEP_STATE_IDLE;
3832 case WEP_STATE_IDLE: {
3840 page = WepMenu.
mode;
3841 chara = WepMenu.
chara;
3846 case WEP_MENU_ACTION:
3847 case WEP_MENU_ELEMENT:
3848 case WEP_MENU_LEVELUP_CONFIRM:
3849 case WEP_MENU_STATUS_BREAK_CONFIRM:
3850 case WEP_MENU_BUILDUP_SELECT:
3851 case WEP_MENU_BUILDUP_CONFIRM:
3852 case WEP_MENU_BUILDUP_PREVIEW:
3853 if (GetMenuCharaEffectReadFlag() != 0) {
3854 if (ReadBGSync() == 0) {
3855 SetMenuCharaEffectReadFlag(0);
3862 case WEP_MENU_ATTACH_WEAPON:
3863 case WEP_MENU_ATTACH_SOCKETS:
3864 case WEP_MENU_ATTACH_BOARD:
3865 case WEP_MENU_ATTACH_TAGS:
3866 WeaponMenuAttachModeKey();
3871 ComMenuSePlay(MENU_SOUND_CURSOR);
3881 int name_no = -0x1F3;
3887 if (weapon != NULL) {
3888 name_no = GetWeaponMsgNo2(weapon->
item_no);
3891 s16 page_mes[12] = {0, 0, 0, 0, 0, 0, 0, 0xAC, 0x73, 0, 0, 0};
3893 page_mes[2] = WepMenu.
element + 0x82;
3894 int name_msg = name_no + 500;
3895 page_mes[3] = name_msg;
3896 page_mes[4] = name_msg;
3897 page_mes[5] = name_msg;
3898 page_mes[6] = name_msg;
3900 mes_no = page_mes[WepMenu.
mode];
3902 if (WepMenu.
mode >= WEP_MENU_LEVELUP_CONFIRM && WepMenu.
mode < WEP_MENU_ATTACH_WEAPON) {
3903 s16 dialog[5] = {0x74, 0x76, 0x75, 0x77, 0x75};
3904 help_no = dialog[WepMenu.
mode - WEP_MENU_LEVELUP_CONFIRM];
3911 switch (WepMenu.
mode) {
3912 case WEP_MENU_ACTION:
3913 switch (WepMenu.
state) {
3914 case WEP_STATE_SCRAP_PROMPT:
3915 case WEP_STATE_SCRAP_CONFIRM:
3916 case WEP_STATE_SCRAP_REFUSED:
3922 case WEP_MENU_BUILDUP_SELECT:
3923 case WEP_MENU_BUILDUP_PREVIEW:
3924 EnableBuildUpModel(builds, weapon);
3928 while (builds[i].weapon_no != -1) {
3929 COM_ITEM_INFO *info = GetCommonItemInfo(builds[i].weapon_no);
3934 if (builds[i].enabled == 0) {
3946 if (WepMenu.
mode == WEP_MENU_BUILDUP_SELECT) {
3949 if ((enabled = builds[WepMenu.
board.
cursor].enabled) != 0) {
3960 case WEP_MENU_LIST: {
3961 int item_no = weapon->
item_no;
3963 if (item_no >= ITEM_WEAPON_START) {
3964 mes_no = GetWeaponMsgNo2(item_no) + 500;
3965 value = weapon->
level;
3970 case WEP_MENU_ATTACH_SOCKETS: {
3973 if (item_no >= ITEM_ATTACH_START) {
3974 mes_no = item_no + 500;
3977 if (item_no == ITEM_ATTACH_SYNTHESIS_SPHERE) {
3992 case WEP_MENU_ELEMENT:
3998 case WEP_MENU_ATTACH_TAGS:
4004 case WEP_MENU_ATTACH_BOARD:
4006 case PERSONAL_BOARD_AREA_CELLS: {
4007 int held = BtlHaveItemPt->
item_no;
4009 if (held >= ITEM_ATTACH_START) {
4010 mes_no = held + 500;
4013 if (BtlHaveItemPt->
item_no == ITEM_ATTACH_SYNTHESIS_SPHERE) {
4018 int item_no = attach->
item_no;
4020 if (item_no >= ITEM_ATTACH_START) {
4021 mes_no = item_no + 500;
4022 value = GetAttachVolumeForMsg(attach);
4024 if (attachments[WepMenu.
board.
cursor].item_no == ITEM_ATTACH_SYNTHESIS_SPHERE) {
4025 name_mes = GetWeaponMsgNo2(attachments[WepMenu.
board.
cursor].sphere_weapon_no);
4032 case PERSONAL_BOARD_AREA_TRASH:
4040 if (WepMenu.
state == WEP_STATE_WARNING) {
4041 s16 warnings[10] = {0xA1, 0xA2, 0xA3, 0x19B, 0x19C, 0x19D, 0xA8, 0xAA, 0xA9, 0xAB};
4045 if (WepMenu.
state == WEP_STATE_SCRAP_CONFIRM) {
4049 if (WepMenu.
state == WEP_STATE_SCRAP_REFUSED) {
4052 if (weapon->
item_no == ITEM_WEAPON_SERPENT_SWORD && GetMenuHebikiriFlag() == 0) {
4057 if (CommonMenuMes2.
mes_made != mes_no || CommonMenuMes2.
value != value || (CommonMenuMes2.
mes_made == 0x24E && (CommonMenuMes2.
mes_no[0] != name_mes + 100 || CommonMenuMes2.
value != value))) {
4062 CommonMenuMes2.
mes_no[0] = name_mes + 100;
4065 CommonMenuMes2.
value = value;
4072 if (WepMenu.
mode == WEP_MENU_BUILDUP_SELECT || WepMenu.
mode == WEP_MENU_BUILDUP_PREVIEW) {
4075 for (
int i = 0; i < 3; i++) {
4076 previous[i] = CommonMenuMes1.
mes_no[i];
4078 if (previous[i] != builds[i].weapon_no + 100 && previous[i] > 100) {
4082 if (builds[i].enabled == 1) {
4084 }
else if (builds[i].enabled == 0) {
4085 CommonMenuMes1.
mes_no[i] = 2;
4088 if (builds[i].weapon_no <= 0) {
4089 CommonMenuMes1.
mes_no[i] = -1;
4093 for (
int i = 0; i < 4; i++) {
4094 CommonMenuMes1.
mes_no[i] = -1;
4096 if (i >= 0 && i < 10) {
4103 if ((CommonMenuMes1.
mes_made != help_no && MenuWepLevelUp.
operation_kind == WEP_EFFECT_NONE) || ((WepMenu.
mode == WEP_MENU_BUILDUP_SELECT || WepMenu.
mode == WEP_MENU_BUILDUP_PREVIEW) && changed != 0) || (CommonMenuMes1.
mes_made != help_no && WepMenu.
state == WEP_STATE_WARNING) || (CommonMenuMes1.
mes_made != help_no && WepMenu.
state == WEP_STATE_SCRAP_CONFIRM) || (CommonMenuMes1.
mes_made != help_no && WepMenu.
state == WEP_STATE_SCRAP_REFUSED)) {
4104 switch (WepMenu.
state) {
4105 case WEP_STATE_WARNING:
4106 case WEP_STATE_SCRAP_CONFIRM:
4107 case WEP_STATE_SCRAP_REFUSED:
4120static int WeaponMenuKastumSelectUp(
int row,
int enabled_rows) {
4125 int selected_row = 3;
4128 if (enabled_rows & (1 << (row - 4))) {
4129 selected_row = row - 1;
4136 return selected_row;
4142static int WeaponMenuKastumSelectDown(
int row,
int enabled_rows) {
4143 int selected_row = 0;
4146 if (enabled_rows & (1 << (row - 3))) {
4154 return selected_row;
4164static int WeaponSelectKey() {
4167 int prev_chara = WepMenu.
chara;
4169 switch (WepMenu.
mode) {
4170 case WEP_MENU_LIST: {
4187 if (GamePad.
Down2(PAD_CROSS) && weapon->
level < 99) {
4191 if (GamePad.
Down2(PAD_R2 | PAD_R1)) {
4192 for (
int i = 1; i <= 13; i++) {
4193 weapon->
flags |= 1 << i;
4197 if (GamePad.
Down2(PAD_TRIANGLE)) {
4207 for (
int i = 0; i < 5; i++) {
4208 weapon->
elem[i] = 99;
4211 for (
int i = 0; i < 10; i++) {
4217 for (
int i = 1; i <= 13; i++) {
4218 weapon->
flags |= 1 << i;
4222 if (GamePad.
Down2(PAD_CIRCLE)) {
4224 weapon->
flags = 0x36EA;
4230 if (GamePad.
Down2(PAD_SQUARE)) {
4238 for (
int i = 0; i < 5; i++) {
4239 weapon->
elem[i] = 0;
4242 for (
int i = 0; i < 10; i++) {
4250 for (
int i = 0; i < 5; i++) {
4251 weapon->
elem[i] = 20;
4254 for (
int i = 0; i < 10; i++) {
4258 printf(
"now 20%\n");
4262 for (
int i = 0; i < 5; i++) {
4263 weapon->
elem[i] = 50;
4266 for (
int i = 0; i < 10; i++) {
4270 printf(
"now 50%\n");
4274 for (
int i = 0; i < 5; i++) {
4275 weapon->
elem[i] = 100;
4278 for (
int i = 0; i < 10; i++) {
4282 printf(
"now 100%\n");
4285 for (
int i = 0; i < now; i++) {
4286 ComMenuSePlay(MENU_SOUND_CONFIRM);
4292 if (GamePad.
Down(PAD_CIRCLE)) {
4293 ComMenuSePlay(MENU_SOUND_REFUSE);
4296 case WEP_OPEN_VIEW_ONLY:
4298 case WEP_OPEN_FROM_BAR:
4299 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON) {
4300 MenuTextureReload(MenuShadowReadBlock);
4301 DngActiveWeaponTextureCopy();
4304 BattleMenuFlag = BTLMENU_STATE_WEAPON_CLOSE;
4305 WepMenu.
state = WEP_STATE_CLOSE;
4311 }
else if (GamePad.
Down(PAD_CROSS)) {
4313 case WEP_OPEN_FROM_BAR:
4314 if (GetDefaultWeaponNo(WepMenu.
chara) > DngWepHavePt[WepMenu.
weapon_slot].item_no) {
4315 ComMenuSePlay(MENU_SOUND_REFUSE);
4317 WepMenu.
mode = WEP_MENU_ACTION;
4319 ComMenuSePlay(MENU_SOUND_CONFIRM);
4329 if (GamePad.
Down(PAD_R2 | PAD_R1)) {
4332 if (WepMenu.
chara >= chara_num) {
4337 if (GamePad.
Down(PAD_L2 | PAD_L1)) {
4340 if (WepMenu.
chara < 0) {
4341 WepMenu.
chara = chara_num - 1;
4348 case WEP_MENU_ACTION: {
4350 int status = NowWeaponStatusValue(weapon);
4352 if (GamePad.
Down(PAD_UP)) {
4360 if (GamePad.
Down(PAD_DOWN)) {
4368 if (GamePad.
Down(PAD_RIGHT) && WepMenu.
board.
cursor == WEP_ACTION_EQUIP) {
4369 WepMenu.
state = WEP_STATE_SCRAP_PROMPT;
4371 ComMenuSePlay(MENU_SOUND_CURSOR);
4372 }
else if (GamePad.
Down(PAD_CROSS)) {
4374 NowWeaponStatusValue(weapon);
4377 case WEP_ACTION_EQUIP: {
4382 ComMenuSePlay(MENU_SOUND_REFUSE);
4383 WepMenu.
state = WEP_STATE_WARNING;
4386 WepMenu.
state = WEP_STATE_WARNING;
4388 ComMenuSePlay(MENU_SOUND_REFUSE);
4390 WepMenu.
state = WEP_STATE_WARNING;
4392 ComMenuSePlay(MENU_SOUND_REFUSE);
4395 WepFrameRate = 0.0f;
4396 WepMenu.
state = WEP_STATE_EQUIP;
4397 int chara = ((
CUserStatus *) BtlMenuStatusPt)->cur_chara;
4399 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON && ((chara == CHARA_OSMOND && WepMenu.
chara == CHARA_OSMOND) || (chara == CHARA_RUBY && WepMenu.
chara == CHARA_RUBY))) {
4401 DngWepEffectReadStart();
4404 ComMenuSePlay(SE_WEAPON_EQUIP);
4409 case WEP_ACTION_ATTACH: {
4410 WepMenu.
mode = WEP_MENU_ATTACH_BOARD;
4414 int holes = GetWeaponHoleNum(weapon->
item_no);
4416 int max = PersonalRetMax(BOARD_PAGE_ATTACH);
4421 if (WepMenu.
mode < WEP_MENU_ATTACH_WEAPON || WepMenu.
mode > WEP_MENU_ATTACH_TAGS) {
4422 WepMenu.
mode = WEP_MENU_ATTACH_BOARD;
4427 switch (WepMenu.
mode) {
4428 case WEP_MENU_ATTACH_SOCKETS:
4434 case WEP_MENU_ATTACH_BOARD:
4450 case WEP_MENU_ATTACH_WEAPON:
4453 case WEP_MENU_ATTACH_TAGS:
4482 int pages = max / 5;
4485 ComMenuSePlay(MENU_SOUND_CONFIRM);
4488 case WEP_ACTION_ELEMENT:
4489 WepMenu.
mode = WEP_MENU_ELEMENT;
4490 WepMenu.
tag_page = WEP_TAG_ELEMENT;
4497 ComMenuSePlay(MENU_SOUND_CONFIRM);
4499 case WEP_ACTION_REPAIR:
4500 if (GetNowItemNum(ITEM_REPAIR_POWDER, MenuItemPackPt) <= 0) {
4501 ComMenuSePlay(MENU_SOUND_REFUSE);
4503 int chara = WepMenu.
chara;
4506 if (ItemUseFunc(status_data, ITEM_REPAIR_POWDER, chara, ITEM_USE_ON_BOARD_WEAPON, weapon) == 2) {
4507 DeleteItemAfterUseItem(ITEM_REPAIR_POWDER, MenuItemPackPt);
4508 ComMenuSePlay(SE_WEAPON_REPAIR);
4510 if (IsDefaultWeapon(weapon->
item_no) >= 0) {
4511 SetMenuWeaponModelReference(slot, 1, 1);
4514 MenuWepLevelUp.
WepRecover(weapon, &DngWeaponFrm[slot], WepMenuEffectReadBuf, BtlMenuExReadBlock);
4515 WepMenu.
state = WEP_STATE_REPAIR_EFFECT;
4517 ComMenuSePlay(MENU_SOUND_REFUSE);
4522 case WEP_ACTION_LEVELUP: {
4523 int item_no = weapon->
item_no;
4525 if (item_no == GetDefaultWeaponNo(WepMenu.
chara)) {
4526 WepMenu.
state = WEP_STATE_WARNING;
4528 ComMenuSePlay(MENU_SOUND_REFUSE);
4529 }
else if (item_no == ITEM_WEAPON_SERPENT_SWORD && GetMenuHebikiriFlag() == 0) {
4530 WepMenu.
state = WEP_STATE_WARNING;
4532 ComMenuSePlay(MENU_SOUND_REFUSE);
4533 }
else if (weapon->
level >= 99) {
4534 WepMenu.
state = WEP_STATE_WARNING;
4536 ComMenuSePlay(MENU_SOUND_REFUSE);
4538 WepMenu.
mode = WEP_MENU_LEVELUP_CONFIRM;
4540 ComMenuSePlay(MENU_SOUND_CONFIRM);
4545 case WEP_ACTION_STATUS_BREAK: {
4551 for (i = 0; i < 40; i++) {
4552 if (items[i].
id >= ITEM_ATTACH_START) {
4558 WepMenu.
state = WEP_STATE_WARNING;
4560 ComMenuSePlay(MENU_SOUND_REFUSE);
4562 WepMenu.
mode = WEP_MENU_STATUS_BREAK_CONFIRM;
4564 ComMenuSePlay(MENU_SOUND_CONFIRM);
4569 case WEP_ACTION_BUILDUP:
4570 WepMenu.
mode = WEP_MENU_BUILDUP_SELECT;
4572 ComMenuSePlay(MENU_SOUND_CONFIRM);
4575 }
else if (GamePad.
Down(PAD_CIRCLE)) {
4576 WepMenu.
mode = WEP_MENU_LIST;
4577 ComMenuSePlay(MENU_SOUND_REFUSE);
4582 case WEP_MENU_ELEMENT:
4583 WepMenu.
tag_page = WEP_TAG_ELEMENT;
4585 if (GamePad.
Down(PAD_L2 | PAD_R2 | PAD_L1 | PAD_R1)) {
4586 ComMenuSePlay(MENU_SOUND_REFUSE);
4589 if (GamePad.
Down(PAD_UP) && 0 < WepMenu.
element) {
4593 if (GamePad.
Down(PAD_DOWN) && WepMenu.
element < 4) {
4597 if (GamePad.
Down(PAD_CROSS)) {
4600 WeaponAllValueSet(weapon, &total, 0);
4602 if (WeaponMenuCheckEnableSetElem(weapon, &total, WepMenu.
element)) {
4603 ComMenuSePlay(MENU_SOUND_REFUSE);
4605 ComMenuSePlay(MENU_SOUND_CONFIRM);
4607 }
else if (GamePad.
Down(PAD_CIRCLE)) {
4608 WepMenu.
mode = WEP_MENU_ACTION;
4610 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON && ((
CUserStatus *) BtlMenuStatusPt)->cur_chara == CHARA_RUBY && WepMenu.
chara == CHARA_RUBY) {
4612 DngWepEffectReadStart();
4615 ComMenuSePlay(MENU_SOUND_REFUSE);
4619 case WEP_MENU_LEVELUP_CONFIRM:
4620 if (GamePad.
Down(PAD_UP | PAD_DOWN)) {
4631 if (DngWepHavePt[slot].experience < GetWeaponMaxExp(&DngWepHavePt[slot])) {
4632 DeleteItemAfterUseItem(ITEM_POWERUP_POWDER, MenuItemPackPt);
4635 MenuWepLevelUp.
SetLevelUpValue(&DngWepHavePt[slot], &DngWeaponFrm[slot], WepMenuEffectReadBuf, BtlMenuExReadBlock);
4636 WepMenu.
state = WEP_STATE_LEVELUP_EFFECT;
4637 WepMenu.
mode = WEP_MENU_LIST;
4639 ComMenuSePlay(MENU_SOUND_CONFIRM);
4640 }
else if ((WepMenu.
board.
cursor == 1 && GamePad.
Down(PAD_CROSS)) || GamePad.
Down(PAD_CIRCLE)) {
4641 WepMenu.
mode = WEP_MENU_ACTION;
4643 ComMenuSePlay(MENU_SOUND_REFUSE);
4647 case WEP_MENU_STATUS_BREAK_CONFIRM:
4648 if (GamePad.
Down(PAD_UP | PAD_DOWN)) {
4657 WepMenu.
mode = WEP_MENU_ACTION;
4659 ComMenuSePlay(MENU_SOUND_REFUSE);
4663 MenuWepLevelUp.
SetStatusBreak(&DngWepHavePt[slot], &DngWeaponFrm[slot], buffer, BtlMenuExReadBlock);
4664 WepMenu.
state = WEP_STATE_STATUS_BREAK_EFFECT;
4665 WepMenu.
mode = WEP_MENU_LIST;
4667 ComMenuSePlay(MENU_SOUND_CONFIRM);
4671 case WEP_MENU_BUILDUP_SELECT: {
4675 EnableBuildUpModel(info, weapon);
4676 int count = WeaponStatusBuildUp(weapon, build_up);
4678 if (GamePad.
Down(PAD_UP)) {
4682 if (GamePad.
Down(PAD_DOWN)) {
4694 if (GamePad.
Down(PAD_CIRCLE)) {
4696 WepMenu.
mode = WEP_MENU_ACTION;
4697 }
else if (GamePad.
Down(PAD_CROSS)) {
4700 for (
int i = 0; i < GetWeaponHoleNum(weapon->
item_no); i++) {
4709 if (enabled == 1 && attached == 0) {
4711 WepMenu.
mode = WEP_MENU_BUILDUP_CONFIRM;
4713 }
else if (enabled == 0) {
4714 WepMenu.
mode = WEP_MENU_BUILDUP_PREVIEW;
4717 WepMenu.
state = WEP_STATE_WARNING;
4724 case WEP_MENU_BUILDUP_CONFIRM:
4725 if (GamePad.
Down(PAD_UP | PAD_DOWN)) {
4734 WepMenu.
mode = WEP_MENU_ACTION;
4736 ComMenuSePlay(MENU_SOUND_REFUSE);
4739 WepMenu.
state = WEP_STATE_BUILDUP_EFFECT;
4740 WepMenu.
mode = WEP_MENU_LIST;
4742 ComMenuSePlay(MENU_SOUND_CONFIRM);
4746 case WEP_MENU_BUILDUP_PREVIEW:
4747 if (GamePad.
Down(PAD_L2 | PAD_L1)) {
4751 WepMenu.
tag_page = WEP_TAG_VS_MONSTER;
4754 ComMenuSePlay(MENU_SOUND_CURSOR);
4757 if (GamePad.
Down(PAD_R2 | PAD_R1)) {
4760 if (WepMenu.
tag_page > WEP_TAG_VS_MONSTER) {
4764 ComMenuSePlay(MENU_SOUND_CURSOR);
4767 if (GamePad.
Down(PAD_CIRCLE)) {
4768 WepMenu.
mode = WEP_MENU_BUILDUP_SELECT;
4769 ComMenuSePlay(MENU_SOUND_REFUSE);
4775 if (prev_chara != WepMenu.
chara) {
4776 int chara = ((
CUserStatus *) BtlMenuStatusPt)->cur_chara;
4778 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON && chara == prev_chara) {
4779 DngWeaponEquipModelBuild(chara, MenuExtendReadBlock, BtlMenuReadBuf);
4782 int selected_chara = WepMenu.
chara;
4786 if (StartReadWepMDS(BtlMenuReadBuf, WepMenu.
chara)) {
4787 MenuExTextureReadFlag = MENU_EX_TEX_UNREAD;
4788 WepMenu.
state = WEP_STATE_CHARA_CHANGE;
4791 if (abs(prev_chara - WepMenu.
chara) > 1) {
4792 for (
int i = 0; i < 6; i++) {
4793 SysChara[i].
x = (SysChara[i].
chara - WepMenu.
chara) * 110 + 270;
4797 int next_chara = WepMenu.
chara;
4808 WepMenu.
state = WEP_STATE_IDLE;
4812 ComMenuSePlay(MENU_SOUND_REFUSE);
4822static inline void SetCursorPos(
CMenuCursor *cursor,
int menu,
int pos) {
4823 cursor->
pos[menu] = pos;
4829static inline void SetCursorChara(
CMenuCursor *cursor,
int chara) {
4840static void WepAttachHaveCancel() {
4842 s16 held = BtlHaveItemPt->
item_no;
4844 if (held >= ITEM_ATTACH_START) {
4846 case WEP_MENU_ATTACH_BOARD: {
4848 slot = &items[BtlHaveItemPt->
from_slot];
4851 case WEP_MENU_ATTACH_SOCKETS:
4859 BtlHaveItemPt->
item_no = item_no;
4863 if (BtlHaveItemPt->
item_no < ITEM_ATTACH_START) {
4864 InitHaveData(BtlHaveItemPt);
4874 WepMenu.
mode = WEP_MENU_ACTION;
4877 GetNowSelectWeapon();
4879 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON && BtlMenuStatusPt->
cur_chara == CHARA_RUBY && WepMenu.
chara == CHARA_RUBY) {
4881 DngWepEffectReadStart();
4886void WeaponMenuAttachModeKey() {
4887 switch (WepMenu.
mode) {
4888 case WEP_MENU_ATTACH_TAGS:
4889 case WEP_MENU_ATTACH_SOCKETS:
4890 case WEP_MENU_ATTACH_BOARD:
4891 case WEP_MENU_ATTACH_WEAPON: {
4894 if (GamePad.
Down(PAD_R2 | PAD_R1) != 0) {
4897 if (WepMenu.
tag_page > WEP_TAG_VS_MONSTER) {
4902 if (GamePad.
Down(PAD_L2 | PAD_L1) != 0) {
4906 WepMenu.
tag_page = WEP_TAG_VS_MONSTER;
4911 int rows[3] = {5, 4, 9};
4917 ComMenuSePlay(MENU_SOUND_CURSOR);
4925 s16 mode = WepMenu.
mode;
4926 WeaponMenuSelectKeyLockFlag = 0;
4929 case WEP_MENU_ATTACH_WEAPON:
4930 WeaponMenuActWepKey();
4932 case WEP_MENU_ATTACH_TAGS:
4935 case WEP_MENU_ATTACH_SOCKETS:
4936 WeaponMenuAttachWepKey();
4938 case WEP_MENU_ATTACH_BOARD:
4939 WeaponMenuAttachKey();
4943 if ((row != WepMenu.
tag_row || mode != WepMenu.
mode) && GamePad.
Down(PAD_CIRCLE) == 0) {
4944 ComMenuSePlay(MENU_SOUND_CURSOR);
4955static void WeaponMenuActWepKey() {
4956 if (GamePad.
Down(PAD_RIGHT) != 0) {
4957 WepMenu.
mode = WEP_MENU_ATTACH_BOARD;
4959 }
else if (GamePad.
Down(PAD_DOWN) != 0) {
4960 WepMenu.
mode = WEP_MENU_ATTACH_TAGS;
4961 WepMenu.
tag_row = WEP_TAG_ROW_DURABILITY;
4962 }
else if (GamePad.
Down(PAD_CIRCLE) != 0) {
4963 ComMenuSePlay(MENU_SOUND_REFUSE);
4964 WepAttachHaveCancel();
4968void WeaponMenuTagKey() {
4970 s16 rows[3] = {5, 4, 10};
4980 GetWeaponHoleNum(GetNowSelectWeapon()->item_no);
4983 case WEP_TAG_STATUS:
4984 if (GamePad.
Down(PAD_UP) != 0) {
4990 WepMenu.
mode = WEP_MENU_ATTACH_SOCKETS;
4992 WepMenu.
mode = WEP_MENU_ATTACH_WEAPON;
4994 }
else if (GamePad.
Down(PAD_DOWN) != 0) {
5000 }
else if (GamePad.
Down(PAD_CROSS) != 0) {
5002 ComMenuSePlay(MENU_SOUND_REFUSE);
5011 WeaponAllValueSet(weapon, &total, 0);
5013 if (GamePad.
On2(PAD_RIGHT)) {
5015 case WEP_TAG_ROW_DURABILITY:
5021 case WEP_TAG_ROW_EXP:
5022 if (weapon->
experience < GetWeaponMaxExp(weapon)) {
5027 case WEP_TAG_ROW_ATTACK:
5033 case WEP_TAG_ROW_ENDURANCE:
5039 case WEP_TAG_ROW_SPEED:
5040 if (weapon->
speed < 99) {
5045 case WEP_TAG_ROW_MAGIC:
5054 if (GamePad.
On2(PAD_LEFT)) {
5056 case WEP_TAG_ROW_DURABILITY:
5062 case WEP_TAG_ROW_EXP:
5068 case WEP_TAG_ROW_ATTACK:
5069 if (0 < weapon->
attack) {
5074 case WEP_TAG_ROW_ENDURANCE:
5080 case WEP_TAG_ROW_SPEED:
5081 if (0 < weapon->
speed) {
5086 case WEP_TAG_ROW_MAGIC:
5087 if (0 < weapon->
magic) {
5095 if (GamePad.
On2(PAD_CROSS)) {
5097 case WEP_TAG_ROW_DURABILITY:
5106 if (GamePad.
On2(PAD_CIRCLE)) {
5108 case WEP_TAG_ROW_DURABILITY:
5117 if (GamePad.
Down2(PAD_TRIANGLE)) {
5119 case WEP_TAG_ROW_ATTACK:
5122 case WEP_TAG_ROW_ENDURANCE:
5125 case WEP_TAG_ROW_SPEED:
5128 case WEP_TAG_ROW_MAGIC:
5137 case WEP_TAG_ELEMENT:
5138 if (GamePad.
Down(PAD_UP) != 0) {
5144 WepMenu.
mode = WEP_MENU_ATTACH_SOCKETS;
5146 WepMenu.
mode = WEP_MENU_ATTACH_WEAPON;
5148 }
else if (GamePad.
Down(PAD_DOWN) != 0) {
5154 }
else if (GamePad.
Down(PAD_CROSS) != 0) {
5158 WeaponAllValueSet(weapon, &total, 0);
5160 if (WeaponMenuCheckEnableSetElem(weapon, &total, WepMenu.
tag_row) != 0) {
5161 ComMenuSePlay(MENU_SOUND_REFUSE);
5163 ComMenuSePlay(MENU_SOUND_CONFIRM);
5169 if (GamePad.
On2(PAD_RIGHT)) {
5177 if (GamePad.
On2(PAD_LEFT)) {
5188 case WEP_TAG_VS_MONSTER:
5189 if (GamePad.
Down(PAD_UP) != 0) {
5192 if (WepMenu.
tag_row % 5 != 0) {
5195 WepMenu.
mode = WEP_MENU_ATTACH_SOCKETS;
5197 WepMenu.
mode = WEP_MENU_ATTACH_WEAPON;
5199 }
else if (GamePad.
Down(PAD_DOWN) != 0) {
5202 if (WepMenu.
tag_row % 5 != 4) {
5205 }
else if (GamePad.
Down(PAD_LEFT) != 0) {
5211 }
else if (GamePad.
Down(PAD_CROSS) != 0) {
5213 ComMenuSePlay(MENU_SOUND_REFUSE);
5218 if (GamePad.
On2(PAD_RIGHT)) {
5226 if (GamePad.
On2(PAD_LEFT)) {
5243 if (GamePad.
Down(PAD_CIRCLE) != 0) {
5244 ComMenuSePlay(MENU_SOUND_REFUSE);
5245 WepAttachHaveCancel();
5249 if (GamePad.
Down(PAD_RIGHT) != 0) {
5251 case WEP_TAG_VS_MONSTER:
5257 WepMenu.
mode = WEP_MENU_ATTACH_BOARD;
5260 case WEP_TAG_STATUS:
5261 case WEP_TAG_ELEMENT:
5262 WepMenu.
mode = WEP_MENU_ATTACH_BOARD;
5276static void WeaponMenuAttachWepKey() {
5280 if (GamePad.
Down(PAD_LEFT)) {
5288 int holes = GetWeaponHoleNum(weapon->
item_no);
5295 WepMenu.
mode = WEP_MENU_ATTACH_WEAPON;
5302 WepMenu.
mode = WEP_MENU_ATTACH_WEAPON;
5310 if (GamePad.
Down(PAD_CROSS)) {
5312 ComMenuSePlay(MENU_SOUND_REFUSE);
5318 if (BtlHaveItemPt->
item_no < ITEM_ATTACH_START) {
5320 ComMenuSePlay(MENU_SOUND_REFUSE);
5324 ComMenuSePlay(SE_ATTACHMENT_REMOVE);
5325 s16 held = BtlHaveItemPt->
item_no;
5328 BtlHaveItemPt->
item_no = item_no;
5331 BtlHaveItemPt->
from_page = WEP_MENU_ATTACH_SOCKETS;
5333 WeaponAllValueSet(weapon, &total, 0);
5334 WeaponMenuCheckElemValue(weapon, &total);
5339 int socket = data->
hole[hole];
5341 if (BtlHaveItemPt->
item_no == ITEM_ATTACH_SYNTHESIS_SPHERE && socket != 2) {
5342 ComMenuSePlay(MENU_SOUND_REFUSE);
5346 ComMenuSePlay(SE_ATTACHMENT_SET);
5348 s16 held = BtlHaveItemPt->
item_no;
5351 BtlHaveItemPt->
item_no = item_no;
5355 WeaponAllValueSet(weapon, &total, 0);
5356 WeaponMenuCheckElemValue(weapon, &total);
5360 if (GamePad.
Down(PAD_CIRCLE)) {
5361 ComMenuSePlay(MENU_SOUND_REFUSE);
5362 WepAttachHaveCancel();
5366 if (GamePad.
Down(PAD_RIGHT)) {
5374 WepMenu.
mode = WEP_MENU_ATTACH_BOARD;
5377 }
else if (GamePad.
Down(PAD_SQUARE)) {
5378 ComMenuSePlay(MENU_SOUND_REFUSE);
5379 }
else if (GamePad.
Down(PAD_DOWN)) {
5380 WepMenu.
mode = WEP_MENU_ATTACH_TAGS;
5381 WepMenu.
tag_row = WEP_TAG_ROW_DURABILITY;
5385s32 WeaponMenuSelectKeyLockFlag;
5394static void WeaponMenuAttachKey() {
5395 if (PersonalBoardKey()) {
5397 WepMenu.
mode = WEP_MENU_ATTACH_SOCKETS;
5398 WepMenu.
board.
cursor = GetWeaponHoleNum(GetNowSelectWeapon()->item_no) - 1;
5400 WepMenu.
mode = WEP_MENU_ATTACH_WEAPON;
5402 }
else if (GamePad.
Down(PAD_CROSS)) {
5404 case PERSONAL_BOARD_AREA_TRASH:
5405 InitHaveData(BtlHaveItemPt);
5407 ComMenuSePlay(MENU_SOUND_REFUSE);
5409 case PERSONAL_BOARD_AREA_CELLS: {
5413 if (slot->
item_no >= ITEM_ATTACH_START || BtlHaveItemPt->
item_no >= ITEM_ATTACH_START) {
5414 ComMenuSePlay(MENU_SOUND_CONFIRM);
5415 s16 held = BtlHaveItemPt->
item_no;
5418 BtlHaveItemPt->
item_no = item_no;
5421 BtlHaveItemPt->
from_page = WEP_MENU_ATTACH_BOARD;
5423 if (BtlHaveItemPt->
item_no >= ITEM_ATTACH_START) {
5426 InitHaveData(BtlHaveItemPt);
5430 ComMenuSePlay(MENU_SOUND_REFUSE);
5436 }
else if (GamePad.
Down(PAD_CIRCLE)) {
5437 ComMenuSePlay(MENU_SOUND_REFUSE);
5438 WepAttachHaveCancel();
5439 }
else if (GamePad.
Down(PAD_SQUARE)) {
5441 ComMenuSePlay(MENU_SOUND_CONFIRM);
5446void RepairAndLevelUpDraw(
int x,
int y,
int alpha) {
5450 float widths[7] = {10.7f, 10.7f, 10.7f, 15.3f, 11.8f, 12.2f, 12.3f};
5451 MenuHelpWinDraw(x - 10, y, widths[BtlMenuNowLang], 2.2f, alpha);
5452 int row_y = y + 0xE;
5453 MenuTextureReload(BtlMenuReadBlock);
5454 u8 items[2] = {ITEM_REPAIR_POWDER, ITEM_POWERUP_POWDER};
5455 u8 shift[7] = {0, 0, 0, 58, 8, 22, 22};
5457 for (
int i = 0; i < 2; i++) {
5459 int item_no = items[i];
5460 count = GetNowItemNum(item_no, MenuItemPackPt);
5461 CTexture *icon = RetCTex((u8) item_no, u, v);
5462 DrawMenu2DSprite(icon,
CRect_i_(x + 0x10, row_y, 0x20, 0x20),
CRect_i_(u, v, 0x20, 0x20), alpha);
5463 DrawMenu2DSprite(BtStatus,
CRect_i_(x + 0x9A + shift[BtlMenuNowLang], row_y + 8, 0x10, 0x10),
CRect_i_(0x60, 0x58, 0x10, 0x10), alpha);
5464 int number_x = x + 0xC0 + shift[BtlMenuNowLang];
5466 if (count / 10 > 0) {
5467 number_x += NumberSprite[1].
width >> 1;
5470 DrawMenuNumber(count, number_x, row_y + 8, StayTex, NumberSprite[1], 2, alpha);
5474 MenuTextureReload(CommonMenuMes3.
tex_block);
5476 if (BtlMenuNowLang > LANG_JAPANESE) {
5477 s8 count_shift[6] = {20, 20, 0, 12, -6, -4};
5478 int name_x = x + 0x36;
5482 count_x = name_x + count_shift[BtlMenuNowLang - 1];
5484 CommonMenuMes3.
line_pos[1].
y = y + 0x1C;
5486 CommonMenuMes3.
line_pos[2].
y = y + 0x2E;
5488 CommonMenuMes3.
line_pos[3].
y = y + 0x3E;
5493 if (CommonMenuMes3.
mes_made != 0x1A7) {
5498 CommonMenuMes3.
Step();
5502void RepairAndLevelUpDraw(
int x,
int y,
int alpha) {
5506 MenuHelpWinDraw(x - 10, y, 10.7f, 2.2f, alpha);
5507 int row_y = y + 0xE;
5508 MenuTextureReload(BtlMenuReadBlock);
5509 int items[2] = {ITEM_REPAIR_POWDER, ITEM_POWERUP_POWDER};
5511 for (
int i = 0; i < 2; i++) {
5513 int item_no = items[i];
5514 count = GetNowItemNum(item_no, MenuItemPackPt);
5515 CTexture *icon = RetCTex(item_no, u, v);
5516 DrawMenu2DSprite(icon,
CRect_i_(x + 0x10, row_y, 0x20, 0x20),
CRect_i_(u, v, 0x20, 0x20), alpha);
5517 DrawMenu2DSprite(BtStatus,
CRect_i_(x + 0x9A, row_y + 8, 0x10, 0x10),
CRect_i_(0x60, 0x58, 0x10, 0x10), alpha);
5518 int number_x = x + 0xC0;
5520 if (count / 10 > 0) {
5521 number_x += NumberSprite[1].
width >> 1;
5524 DrawMenuNumber(count, number_x, row_y + 8, StayTex, NumberSprite[1], 2, alpha);
5528 MenuTextureReload(CommonMenuMes3.
tex_block);
5530 int name_x = x + 0x36;
5535 CommonMenuMes3.
line_pos[1].
y = y + 0x1C;
5537 CommonMenuMes3.
line_pos[2].
y = y + 0x2E;
5539 CommonMenuMes3.
line_pos[3].
y = y + 0x3E;
5542 if (CommonMenuMes3.
mes_made != 0x1A7) {
5547 CommonMenuMes3.
Step();
5552void DrawBuildUpWeaponSelect(
int x,
int y,
int cursor) {
5554 MenuTextureReload(BtlMenuReadBlock);
5556 float size[7][2] = {
5576 MenuHelpWinDraw(x - 0xE + offset[BtlMenuNowLang][0], y - 0xC + offset[BtlMenuNowLang][1], size[BtlMenuNowLang][0], size[BtlMenuNowLang][1], 0x80);
5584 int count = WeaponStatusBuildUp(GetNowSelectWeapon(), build);
5586 for (
int i = 0; i < count; i++) {
5593 DrawWeaponNameBoard(x + 0x10, y, selected, 0x80, 0x6E);
5596 if (i + 2 >= 0 && i + 2 < 10) {
5597 CommonMenuMes1.
line_pos[i + 2].
x = name_x;
5598 CommonMenuMes1.
line_pos[i + 2].
y = y + 5;
5604 MenuTextureReload(CommonMenuMes1.
tex_block);
5605 CommonMenuMes1.
Step();
5609void WeaponMenuDraw() {
5615 BtlMenuTexBlockEnter();
5618 switch (WepMenu.
state) {
5619 case WEP_STATE_OPEN:
5627 case WEP_STATE_CLOSE:
5628 alpha = 0x80 - WepMenu.
counter * 9;
5639 switch (WepMenu.
mode) {
5640 case WEP_MENU_ATTACH_WEAPON:
5641 case WEP_MENU_ATTACH_SOCKETS:
5642 case WEP_MENU_ATTACH_BOARD:
5643 case WEP_MENU_ATTACH_TAGS:
5646 case WEP_MENU_ACTION:
5647 case WEP_MENU_ELEMENT:
5648 case WEP_MENU_LEVELUP_CONFIRM:
5649 case WEP_MENU_STATUS_BREAK_CONFIRM:
5650 case WEP_MENU_BUILDUP_SELECT:
5651 case WEP_MENU_BUILDUP_CONFIRM:
5652 case WEP_MENU_BUILDUP_PREVIEW:
5653 for (i = 0; i < 6; i++) {
5654 int target = (SysChara[i].
chara - WepMenu.
chara) * 0x6E + 0x10E;
5655 SysChara[i].
x += ((float) target - SysChara[i].x) / 4.0f;
5657 if (attach_mode == 0 || i == WepMenu.
chara) {
5660 int face_chara = SysChara[i].
chara;
5661 int v = face_chara * 0x6A;
5663 if (face_chara > 2) {
5665 v = (face_chara - 3) * 0x6A;
5673 DrawMenu2DSprite(face,
CRect_i_(SysChara[i].x, 0xE, 0x64, 0x64),
CRect_i_(scratch, v, 0x6A, 0x6A), alpha, alpha, alpha, alpha);
5677 FadeTexX(0xDC, 0x32, 0x172, 0x32,
"frame_image", 0);
5679 if (attach_mode == 0) {
5683 if (WepMenu.
mode == WEP_MENU_LIST) {
5694 i = ct % 30 / 10 * 2;
5695 CRect_i_ arrow(0x60, 0x68, 10, 0x18);
5696 DrawMenu2DSprite(BtStatus,
CRect_i_(0x102 - i, 0x48, arrow.width, arrow.height), arrow, scratch);
5697 arrow.x += arrow.width;
5698 DrawMenu2DSprite(BtStatus,
CRect_i_(i + 0x174, 0x48, arrow.width, arrow.height), arrow, scratch);
5708 switch (WepMenu.
mode) {
5710 case WEP_MENU_ACTION:
5711 case WEP_MENU_ELEMENT:
5712 case WEP_MENU_LEVELUP_CONFIRM:
5713 case WEP_MENU_STATUS_BREAK_CONFIRM:
5714 case WEP_MENU_BUILDUP_SELECT:
5715 case WEP_MENU_BUILDUP_CONFIRM:
5716 case WEP_MENU_BUILDUP_PREVIEW:
5718 target_depth = 2.0f + 16.0f * -WepMenu.
weapon_slot;
5720 case WEP_MENU_ATTACH_WEAPON:
5721 case WEP_MENU_ATTACH_SOCKETS:
5722 case WEP_MENU_ATTACH_BOARD:
5723 case WEP_MENU_ATTACH_TAGS: {
5725 target_x = (int) (80.0f - (
float) (slot * 0xD6));
5726 target_depth = 2.0f + (-11.0f + 16.0f * -slot);
5731 WeaponPos += ((float) target_x - WeaponPos) / 4.0f;
5732 WepPolyPos += (target_depth - WepPolyPos) / 4.0f;
5735 switch (WepMenu.
state) {
5736 case WEP_STATE_UNK_3:
5737 scratch = alpha - 9;
5739 case WEP_STATE_CHARA_CHANGE:
5740 scratch = WepMenu.
counter * 5;
5742 case WEP_STATE_OPEN:
5743 case WEP_STATE_CLOSE:
5752 if (scratch > 0x80) {
5756 target_x = (int) WeaponPos;
5757 target_depth = WepPolyPos;
5758 BtlWeaponDraw(target_x, target_depth, WepMenu.
chara, scratch);
5760 if (attach_mode == 0) {
5762 u8 repair_x[7] = {78, 78, 78, 26, 64, 64, 66};
5763 RepairAndLevelUpDraw(repair_x[BtlMenuNowLang], 0x164, alpha);
5765 RepairAndLevelUpDraw(0x4E, 0x144, alpha);
5769 int dialog_pos = 0x70;
5771 MenuTextureReload(BtlMenuReadBlock);
5775 switch (WepMenu.
mode) {
5776 case WEP_MENU_LEVELUP_CONFIRM:
5777 case WEP_MENU_BUILDUP_CONFIRM:
5779 MenuTextureReload(BtlMenuReadBlock);
5781 DrawDngYesNoDialog(0x88, 0xDD, 0x80);
5782 MenuHelpWinDraw(0x46, 0x8C, 10.0f, 1.4f, 100);
5785 MenuTextureReload(CommonMenuMes1.
tex_block);
5786 DrawMenuClsMes(&CommonMenuMes1, 0x58, 0x92);
5788 case WEP_MENU_STATUS_BREAK_CONFIRM:
5790 MenuTextureReload(BtlMenuReadBlock);
5792 DrawDngYesNoDialog(0x88, 0xF3, 0x80);
5793 CommonMenuMes1.
auto_pos = MES_POS_NONE;
5796 DrawMenuClsMes(&CommonMenuMes1, 0x50, 0x98);
5798 case WEP_MENU_BUILDUP_PREVIEW:
5799 AllFadeForMenu(0x40);
5801 MenuTextureReload(BtlMenuReadBlock);
5803 DrawBtlMenuLRCursor(0x158, 0x6E, 0xD4, alpha);
5804 EnableBuildUpModel(builds, GetNowSelectWeapon());
5806 MenuTextureReload(BtlMenuExtBlock);
5808 DrawWeaponTagBoard(0x16C, 0x78, GetNowSelectWeapon(), 1, builds[WepMenu.
board.
cursor].weapon_no, 0x80);
5809 case WEP_MENU_BUILDUP_SELECT:
5811 MenuTextureReload(BtlMenuExtBlock);
5813 DrawBuildUpWeaponSelect(0x58, 0x9C, WepMenu.
board.
cursor);
5815 case WEP_MENU_ELEMENT:
5817 MenuTextureReload(BtlMenuExtBlock);
5819 DrawWeaponTagBoard(0x18A, 0x64, GetNowSelectWeapon(), 0, 0, 0x80);
5820 case WEP_MENU_ACTION:
5822 MenuTextureReload(BtlMenuExtBlock);
5826 if (GetNowSelectWeapon() != NULL) {
5827 DrawWeaponSelectDialog(dialog_pos, dialog_pos, scratch);
5833 DrawBtlMenuLRCursor(0xE6, 0x12, 0x96, alpha);
5837 case WEP_MENU_ATTACH_WEAPON:
5838 case WEP_MENU_ATTACH_SOCKETS:
5839 case WEP_MENU_ATTACH_BOARD:
5840 case WEP_MENU_ATTACH_TAGS:
5841 MenuTextureReload(BtlMenuReadBlock);
5842 DrawPersonalBoard(0x154, 0x78, WepMenu.
board.
page, alpha, 0);
5843 CommonTrushDraw(0x232, 0x10C, alpha);
5845 if (BtlHaveItemPt->
item_no >= ITEM_ATTACH_START) {
5846 MenuTextureReload(MenuShadowReadBlock);
5847 DrawMenuVibeItem((
int) SysCur[0], (
int) SysCur[1], 2, -0xC, 0x80);
5865 int holes = GetWeaponHoleNum(DngWepHavePt[slot].item_no);
5866 s16 cursor_pos[12][2] = {
5881 cursor_pos[1][1] = dialog_pos + row;
5882 cursor_pos[2][1] = WepMenu.
element * 0x18 + 0x86;
5883 s16 dialog_y = row + 0xDC;
5884 cursor_pos[3][1] = dialog_y;
5885 cursor_pos[4][1] = row + 0xF2;
5887 cursor_pos[5][1] = build_y;
5888 cursor_pos[6][1] = dialog_y;
5889 cursor_pos[7][1] = build_y;
5890 cursor_pos[9][0] = (0x90 - holes * 0x12) + (s16) WepMenu.
board.
cursor * 0x2A;
5891 int cursor_x = cursor_pos[WepMenu.
mode][0];
5892 int cursor_y = cursor_pos[WepMenu.
mode][1];
5894 if (WepMenu.
state == WEP_STATE_SCRAP_PROMPT) {
5896 cursor_y = dialog_pos + 0x2E;
5899 if (WepMenu.
state == WEP_STATE_SCRAP_CONFIRM) {
5901 cursor_y = WepMenu.
confirm[0] * 0x1A + 0xBE;
5905 {0xCD, 0x64, 0xCC, 0xC9},
5916 {0xD8, 0x76, 0xB8, 0x98}
5918 frames[1].
x = cursor_x + 0x19;
5919 frames[1].
y = cursor_y - 6;
5920 frames[2].
x = cursor_x + 0x1A;
5921 frames[2].
y = cursor_y - 6;
5922 frames[3].
x = cursor_x + 0x18;
5923 frames[3].
y = cursor_y - 6;
5924 frames[4].
x = cursor_x + 0x18;
5925 frames[4].
y = cursor_y - 6;
5926 frames[5].
x = cursor_x + 0x18;
5927 frames[5].
y = cursor_y - 8;
5928 frames[6].
x = cursor_x + 0x18;
5929 frames[6].
y = cursor_y - 6;
5930 frames[7].
x = cursor_x + 0x18;
5931 frames[7].
y = cursor_y - 8;
5932 frames[8].
x = cursor_x + 0x12;
5933 frames[8].
y = cursor_y - 0x18;
5934 frames[9].
x = cursor_x + 0xC;
5935 frames[9].
y = cursor_y - 8;
5936 frames[10].
x = cursor_x + 0xC;
5937 frames[10].
y = cursor_y - 8;
5938 frame = frames[WepMenu.
mode];
5941 if (selected != NULL && selected->
item_no < ITEM_WEAPON_START) {
5945 if (WepMenu.
state == WEP_STATE_SCRAP_PROMPT) {
5946 frame.
x = cursor_x + 0x19;
5947 frame.
y = cursor_y - 4;
5952 switch (WepMenu.
mode) {
5953 case WEP_MENU_ACTION:
5956 int options = NowWeaponStatusValue(&DngWepHavePt[WepMenu.
weapon_slot]);
5959 if (options & (1 << (i - 3))) {
5964 cursor_y = dialog_pos + 0x4E + scratch;
5965 frame.
y = cursor_y - 6;
5969 case WEP_MENU_BUILDUP_SELECT:
5970 case WEP_MENU_ATTACH_SOCKETS:
5972 case WEP_MENU_ATTACH_BOARD:
5974 case PERSONAL_BOARD_AREA_CELLS: {
5976 cursor_x = cell % 5 * 0x28 + 0x154;
5978 cursor_y = cell / 5 * 0x28 + 0x7E;
5981 case PERSONAL_BOARD_AREA_TRASH:
5987 frame.
x = cursor_x + 0xC;
5988 frame.
y = cursor_y - 8;
5992 case WEP_MENU_ATTACH_TAGS: {
5996 case WEP_TAG_STATUS:
5999 cursor_y = sel * 0x14 + 0x114;
6003 cursor_y = (sel - 2) * 0x10 + 0x148;
6008 case WEP_TAG_ELEMENT:
6010 cursor_y = sel * 0x18 + 0x112;
6013 case WEP_TAG_VS_MONSTER:
6014 cursor_x = sel / 5 * 0x68 + 0x28;
6015 cursor_y = sel % 5 * 0x18 + 0x112;
6020 frame.
x = cursor_x + 0x1C;
6021 frame.
y = cursor_y - 6;
6029 if (WepMenu.
mode <= WEP_MENU_LIST) {
6031 }
else if (BtlHaveItemPt->
item_no >= ITEM_ATTACH_START) {
6035 }
else if ((WepMenu.
mode == WEP_MENU_ATTACH_SOCKETS && DngWepHavePt[slot].attach[WepMenu.
board.
cursor].item_no >= ITEM_ATTACH_START) || (WepMenu.
mode == WEP_MENU_ATTACH_BOARD && consumables[WepMenu.
board.
cursor].
id >= ITEM_ATTACH_START)) {
6043 SysCur[0] += ((float) cursor_x - SysCur[0]) / 4.0f;
6044 SysCur[1] += ((float) cursor_y - SysCur[1]) / 4.0f;
6046 switch (WepMenu.
state) {
6047 case WEP_STATE_OPEN:
6048 case WEP_STATE_CLOSE:
6049 case WEP_STATE_CHARA_CHANGE:
6050 case WEP_STATE_LEVELUP_EFFECT:
6051 case WEP_STATE_STATUS_BREAK_EFFECT:
6052 case WEP_STATE_BUILDUP_EFFECT:
6053 case WEP_STATE_REPAIR_EFFECT:
6054 CommonMenuMes1.
auto_pos = MES_POS_NONE;
6056 case WEP_STATE_WARNING:
6057 case WEP_STATE_SCRAP_REFUSED:
6058 CommonMenuMes1.
auto_pos = MES_POS_CENTRE;
6059 MenuTextureReload(CommonMenuMes1.
tex_block);
6060 CommonMenuMes1.
Step();
6066 if (WepMenu.
mode == WEP_MENU_LIST) {
6070 if (WepMenu.
state == WEP_STATE_SCRAP_CONFIRM) {
6071 DrawDngYesNoDialog(0x190, 0xBE, 0x80);
6081 CommonMenuMes1.
auto_pos = MES_POS_NONE;
6082 CommonMenuMes1.
text_x = offset[BtlMenuNowLang][0] + 0x190;
6083 CommonMenuMes1.
text_y = offset[BtlMenuNowLang][1] + 0xBE;
6084 MenuTextureReload(CommonMenuMes1.
tex_block);
6085 CommonMenuMes1.
Step();
6089 DrawMenuWaku(frame.
x, frame.
y, frame.
width, frame.
height, shadow, StayTex, 0x80);
6092 if (scratch >= 0x80) {
6096 DrawMenuObjectVibe((
int) SysCur[0], (
int) SysCur[1], big, scratch);
6112static int ItemTrushKey(
int *thrown,
int *thrown_vol,
int slot) {
6115 int kind = WhatIsKindofItem(BtlHaveItemPt->
item_no);
6116 s16 held = BtlHaveItemPt->
item_no;
6120 case BOARD_PAGE_ITEM:
6121 if (!kind || kind == BOARD_PAGE_NONE) {
6128 case BOARD_PAGE_WEAPON:
6129 if (kind == BOARD_PAGE_WEAPON || kind == BOARD_PAGE_NONE) {
6132 int equip = WhoIsWeaponEquip(held);
6135 for (
int i = 0; i < 6; i++) {
6140 if (weapon != NULL && weapon->
item_no >= ITEM_WEAPON_START) {
6150 if (weapon != NULL) {
6157 for (
int chara = 0; chara < 6; chara++) {
6158 int default_no = GetDefaultWeaponNo(chara);
6175 if (equip >= 0 && owner != equip && owner >= 0) {
6182 BtlHaveItemPt->
item_no = item_no;
6191 case BOARD_PAGE_ATTACH:
6192 if (kind == BOARD_PAGE_ATTACH || kind == BOARD_PAGE_NONE) {
6197 BtlHaveItemPt->
item_no = item_no;
6208void DrawTrushItem() {
6212 for (
int i = 0; i < 7; i++) {
6217 if (CheckItemThrow(items, values) == 0 && ItemMenuMode.
overflow == 0) {
6222 int count[3] = {3, 1, 3};
6223 int first[3] = {0, 3, 4};
6224 int entry = first[page];
6226 MenuTextureReload(ItemMenuWeaponIconReadBlock);
6227 static int ncnt = 0;
6228 int bright = (int) (112.0f + 48.0f * sinf(PI * (
float) (ncnt - 0x3C) / 60.0f));
6230 for (
int i = 0; i < 3; i++) {
6231 if ((ItemMenuMode.
overflow_pages & (1 << (i + 1))) && page == i) {
6232 for (
int j = 0; j < ItemMenuMode.
overflow_count[i]; j++, entry++) {
6233 DrawMenu2DSprite(CharaStatus,
CRect_i_(0x138, y, 0x2A, 0x29),
CRect_i_(0xC2, 0xD6, 0x2A, 0x2A), bright, bright, bright, 0x80);
6234 DrawIconParts(items[entry], 0x13C, y + 6, 0, 0x280, 0x80, values[entry]);
6249 MenuTextureReload(AtoraNameMes.
tex_block);
6251 if (AtoraNameMes.
mes_made != 0xBB) {
6257 DrawMenuClsMes(&AtoraNameMes, 0x34, 0x152);
6267static void ExitItemSelect() {
6268 CommonMenuMes3.
rows = 3;
6272 AtoraNameMes.
auto_pos = MES_POS_NONE;
6276 SetCursorPos(cursor, 0, ItemMenuMode.
board.
cursor);
6277 cursor->
mode[0] = ItemMenuMode.
mode;
6278 SetCursorChara(cursor, ItemMenuMode.
board.
page);
6289static void StartBGReadItemMenuWepIcon(u_long128 *buffer,
int &size) {
6291 size = LoadFileBGMenuData(
"wepchara.img", buffer);
6292 ItemMenuAlreadyReadWepIconTexFlag = 0;
6295void ReadSyncItemMenuWepIcon() {
6298 {
"#frame_image#640#" SCREEN_HEIGHT_STR
"#4", 0, 0},
6303 textures[0].
block_no = ItemMenuWeaponIconReadBlock;
6305 textures[1].
block_no = ItemMenuWeaponIconReadBlock;
6306 CharaStatus = TexManager.GetTexture(
"status", -1);
6307 TexManager.DeleteTextureBlock(ItemMenuWeaponIconReadBlock);
6308 TexManager.CleanUpTextureList();
6309 TexManager.LoadTextureBlockEX(-1, textures);
6322static void InitItemMode(
int mode,
int chara) {
6327 InitPersonalBoardMode((
CUserStatus *) BtlMenuStatusPt, &ItemMenuMode.
board, PERSONAL_BOARD_ITEM, BOARD_PAGE_ITEM);
6328 ItemMenuMode.
mode = ITEM_MENU_BOARD;
6329 ItemMenuMode.
chara = chara;
6333 ItemMenuMode.
mode = cursor->
mode[0];
6335 if (ItemMenuMode.
mode < 0 || ItemMenuMode.
mode > ITEM_MENU_BOARD) {
6336 ItemMenuMode.
mode = ITEM_MENU_BOARD;
6339 max = PersonalRetMax(cursor->
chara_no);
6347 ItemMenuMode.
mode = ITEM_MENU_BOARD;
6350 max = PersonalRetMax(BOARD_PAGE_ITEM);
6353 memset(thrown, 0,
sizeof(thrown));
6355 for (
int i = 0; i < 3; i++) {
6362 if (CheckItemThrow(thrown, NULL)) {
6363 for (
int i = 0; i < 3; i++) {
6364 if (thrown[i] >= ITEM_DUNGEON_START) {
6369 if (thrown[3] >= ITEM_WEAPON_START) {
6373 for (
int i = 0; i < 3; i++) {
6374 if (thrown[i + 4] < ITEM_ATTACH_START) {
6381 for (
int i = 0; i < 3; i++) {
6387 for (
int i = 2; i >= 0; i--) {
6393 if (ItemMenuMode.
board.
page == BOARD_PAGE_WEAPON) {
6394 ItemMenuMode.
board.
cursor = WhoIsWeaponEquip(thrown[3]) * 10;
6411 int pages = max / 5;
6414 ItemMenuMode.
state = ITEM_MENU_STATE_LOADING;
6416 u_long128 *buffer = BtlMenuReadBuf;
6418 StartBGReadItemMenuWepIcon(buffer, size);
6419 buffer += (size >> 4) + 1;
6420 ItemMenuCharaReadBuf = MenuCalcBufAlignment(buffer);
6422 StartLoadCharaMDS(ItemMenuCharaReadBuf, chara, 1);
6423 MenuExTextureReadFlag = MENU_EX_TEX_UNREAD;
6424 memset(&IconAutoGet, -1,
sizeof(IconAutoGet));
6425 CommonMenuMes3.
Preset(MES_PRESET_NAME);
6427 CommonMenuMes3.
rows = 1;
6431 AtoraNameMes.
Preset(MES_PRESET_SYSTEM);
6433 AtoraNameMes.
rows = 3;
6435 for (
int i = 0; i < 10; i++) {
6436 AtoraNameMes.
mes_no[i] = 0;
6437 AtoraNameMes.
values[i] = 0;
6438 SetLinePos(&AtoraNameMes, i, -1, -1);
6441 AtoraNameMes.
char_width = GetMenuCommonFontW(BtlMenuNowLang, -1);
6442 int member = ItemMenuMode.
chara;
6448 if (weapon != NULL) {
6449 SetNowEquipWeaponDataForMsg(weapon->
item_no, weapon->
level);
6451 SetNowEquipWeaponDataForMsg(0, 0);
6462static void InitItemTrushStart() {
6463 if (ReadBGSync() == 0) {
6464 BattleMenuTexEnter();
6466 if (BtlMenuMode == BATTLE_MENU_MODE_TOWN) {
6470 InitItemMode(0, BtlMenuStatusPt->
cur_chara);
6471 BattleMenuFlag = MenuSelect[0] + BTLMENU_STATE_OPEN_OFFSET;
6472 BtlEffectFlag = BTLEFFECT_PAGE_OPEN;
6477void ExistItemMenu() {
6478 int blocks[3] = {0, 0, -1};
6480 blocks[0] = MenuExtendReadBlock;
6481 blocks[1] = ItemMenuWeaponIconReadBlock;
6482 MenuTextureDelete(blocks);
6483 TexManager.CleanUpTextureList();
6484 BtlMenuTexBlockEnter();
6486 for (
int i = 0; i < 6; i++) {
6489 if (0 > slot || slot >= 10) {
6490 EquipDefaultWeapon(i);
6504static void ChangeMenuChara() {
6506 int previous = ItemMenuMode.
chara;
6507 int party_size = BtlMenuStatusPt->
party_size;
6509 if (GamePad.
Down(PAD_L2 | PAD_L1) != 0) {
6510 ItemMenuMode.
chara--;
6512 if (ItemMenuMode.
chara < 0) {
6513 ItemMenuMode.
chara = party_size - 1;
6517 if (GamePad.
Down(PAD_R2 | PAD_R1) != 0) {
6518 ItemMenuMode.
chara++;
6520 if (party_size - 1 < ItemMenuMode.
chara) {
6521 ItemMenuMode.
chara = 0;
6525 if (previous != ItemMenuMode.
chara) {
6527 if (ReadBGSync() != 0) {
6531 MenuExTextureReadFlag = StartLoadCharaMDS(ItemMenuCharaReadBuf, ItemMenuMode.
chara, 0);
6532 int chara = ItemMenuMode.
chara;
6538 if (weapon != NULL) {
6539 SetNowEquipWeaponDataForMsg(weapon->
item_no, weapon->
level);
6541 SetNowEquipWeaponDataForMsg(0, 0);
6544 MenuExTextureReadFlag = MENU_EX_TEX_BUILDING;
6554static inline int DebugGetHp(
int chara) {
6555 return BtlMenuStatusPt->
hp[chara];
6561static inline int DebugGetMaxHp(
int chara) {
6562 return BtlMenuStatusPt->
max_hp[chara];
6568static inline void DebugSetHp(
int chara,
int hp) {
6569 BtlMenuStatusPt->
hp[chara] = hp;
6575static inline float DebugGetWater(
int chara) {
6576 return BtlMenuStatusPt->
water_now[chara];
6582static inline void DebugSetWater(
int chara,
float water) {
6583 BtlMenuStatusPt->
water_now[chara] = water;
6589static inline int DebugGetDefense(
int chara) {
6590 return BtlMenuStatusPt->
defense[chara];
6596static inline void DebugSetDefense(
int chara,
int defense) {
6597 BtlMenuStatusPt->
defense[chara] = defense;
6604int ItemMenuMainKey() {
6608 switch (MenuExTextureReadFlag) {
6609 case MENU_EX_TEX_UNREAD:
6610 if (ReadBGSync() == 0) {
6611 if (ItemMenuAlreadyReadWepIconTexFlag == 0) {
6612 ReadSyncItemMenuWepIcon();
6613 ItemMenuAlreadyReadWepIconTexFlag = 1;
6614 ItemMenuMode.
state = ITEM_MENU_STATE_OPEN;
6617 MenuCharaMDSBuild2(ItemMenuMode.
chara, MenuExtendReadBlock);
6618 MenuExTextureReadFlag = MENU_EX_TEX_BUILDING;
6623 case MENU_EX_TEX_BUILDING:
6625 MenuCharaFrame.
Step();
6627 if (ItemMenuMode.
chara == 0) {
6631 if (BtlMDSBuildCnt > 3) {
6632 MenuExTextureReadFlag = MENU_EX_TEX_READY;
6638 int old_mode = ItemMenuMode.
mode;
6640 int old_chara = ItemMenuMode.
chara;
6645 for (
int i = 0; i < 18; i++) {
6650 int result = CheckItemThrow(thrown, thrown_vol);
6651 int overflowing = 0;
6653 for (
int i = 0; i < 3; i++) {
6655 GetNowModeMaxNum(i, &maximum);
6662 if (IconAutoGet.
IsMoveIcon() == 0 && result == 0 && overflowing == 0 && BtlHaveItemPt->
item_no < ITEM_ATTACH_START) {
6664 ((
CUserStatus *) BtlMenuStatusPt)->overflow_flag =
false;
6665 DeleteMenuTrushMark();
6668 switch (ItemMenuMode.
state) {
6669 case ITEM_MENU_STATE_LOADING:
6672 case ITEM_MENU_STATE_OPEN:
6673 result = ToFromSelect(0);
6676 if (ItemMenuMode.
counter >= 0x11 && result != 0) {
6677 BtlEffectFlag = BTLEFFECT_NONE;
6678 ItemMenuMode.
state = ITEM_MENU_STATE_IDLE;
6680 BattleMenuFlag = BTLMENU_STATE_ITEM;
6684 case ITEM_MENU_STATE_CLOSE:
6685 result = ToFromSelect(1);
6687 if (BtlMenuExReadFlag == 0) {
6688 BtlMenuExReadFlag = DngActItemModelBuild(0);
6693 if (ItemMenuMode.
counter > 0x11 && result != 0 && BtlMenuExReadFlag != 0) {
6695 BattleMenuFlag = BTLMENU_STATE_MAIN;
6699 case ITEM_MENU_STATE_EFFECT: {
6703 if (state == WEP_EFFECT_STATE_CURE_STATUS_PLAY || state == WEP_EFFECT_STATE_CURE_FRUIT_OF_EDEN_PLAY || state == WEP_EFFECT_STATE_CURE_GOURD_PLAY || state == WEP_EFFECT_STATE_CURE_POCKET_PLAY || state == 0x1Fu || state == WEP_EFFECT_STATE_CURE_REVIVAL_POWDER_PLAY || (state == WEP_EFFECT_STATE_CURE_AILMENT_PLAY && MenuWepLevelUp.
message_no > 0x190)) {
6704 if (motion == 3 && GamePad.
Down(PAD_CIRCLE | PAD_CROSS) != 0) {
6705 ItemMenuMode.
state = ITEM_MENU_STATE_IDLE;
6709 }
else if (state == WEP_EFFECT_STATE_CURE_HEAL_HP_PLAY || state == WEP_EFFECT_STATE_CURE_DRINK_PLAY || (state == WEP_EFFECT_STATE_CURE_AILMENT_PLAY && MenuWepLevelUp.
message_no < 0x190) || state == WEP_EFFECT_STATE_CURE_REPAIR_PLAY) {
6711 ItemMenuMode.
state = ITEM_MENU_STATE_IDLE;
6718 case ITEM_MENU_STATE_POWERUP_CONFIRM:
6719 if (GamePad.
Down(PAD_UP | PAD_DOWN) != 0) {
6720 if (ItemMenuMode.
confirm != 0) {
6726 ComMenuSePlay(MENU_SOUND_CURSOR);
6729 if (GamePad.
Down(PAD_CROSS) != 0) {
6730 if (ItemMenuMode.
confirm == 0) {
6732 s16 item_no = BtlHaveItemPt->
item_no;
6733 int result = ItemUseFunc(BtlMenuStatusPt, item_no, ItemMenuMode.
chara, ITEM_USE_ON_EQUIP_WEAPON, weapon);
6735 if ((u32) (result - 1) < 2) {
6736 int sounds[2] = {1, 0x18};
6737 ComMenuSePlay(sounds[result - 1]);
6740 if (ItemMenuMode.
use_target == ITEM_USE_ON_EQUIP_WEAPON) {
6745 if (ItemMenuMode.
use_target == ITEM_USE_ON_BOARD_WEAPON) {
6746 effect_x = 4.3f + 3.2f * (float) (ItemMenuMode.
board.
cursor % 5);
6751 MenuWepLevelUp.
CureEffect((
int) effect_x, (int) effect_y, effect, BtlMenuExReadBlock, WEP_EFFECT_CURE_REPAIR);
6752 InitHaveData(BtlHaveItemPt);
6753 ItemMenuMode.
state = ITEM_MENU_STATE_IDLE;
6754 ComMenuSePlay(SE_WEAPON_REPAIR);
6756 ItemMenuMode.
state = ITEM_MENU_STATE_IDLE;
6757 ComMenuSePlay(MENU_SOUND_REFUSE);
6759 }
else if (GamePad.
Down(PAD_CIRCLE) != 0) {
6760 ItemMenuMode.
state = ITEM_MENU_STATE_IDLE;
6761 ComMenuSePlay(MENU_SOUND_REFUSE);
6765 case ITEM_MENU_STATE_IDLE:
6766 switch (ItemMenuMode.
mode) {
6767 case ITEM_MENU_QUICK_SLOTS:
6768 case ITEM_MENU_CHARA:
6769 case ITEM_MENU_WEAPON:
6770 case ITEM_MENU_DEFENSE:
6772 case ITEM_MENU_TRUSH:
6775 case ITEM_MENU_BOARD: {
6776 int done = PersonalBoardKey();
6781 ItemMenuMode.
mode = ITEM_MENU_QUICK_SLOTS;
6784 ItemMenuMode.
mode = ITEM_MENU_CHARA;
6791 ItemMenuMode.
mode = ITEM_MENU_TRUSH;
6808 if (MenuExTextureReadFlag >= MENU_EX_TEX_READY && MenuWepLevelUp.
operation_kind == WEP_EFFECT_NONE) {
6809 if (GamePad.
Down(PAD_CROSS) != 0) {
6813 switch (ItemMenuMode.
mode) {
6814 case ITEM_MENU_QUICK_SLOTS: {
6815 int held = BtlHaveItemPt->
item_no;
6817 if ((held >= ITEM_ATTACH_START && held < ITEM_DUNGEON_START) || held >= ITEM_WEAPON_START) {
6818 ComMenuSePlay(MENU_SOUND_REFUSE);
6820 ComMenuSePlay(MENU_SOUND_REFUSE);
6826 if (*slot_item >= ITEM_DUNGEON_START) {
6827 slot_data = GetItemData(*slot_item);
6833 if (BtlHaveItemPt->
item_no >= ITEM_DUNGEON_START) {
6834 held_data = GetItemData(BtlHaveItemPt->
item_no);
6842 switch (held_kind) {
6846 if (slot_data == NULL) {
6856 if (*slot_qty >= 2) {
6866 if (slot_data == NULL) {
6872 if (*slot_item == BtlHaveItemPt->
item_no) {
6873 if (*slot_qty < 9) {
6878 }
else if (held_data == NULL) {
6880 }
else if (*slot_qty >= 2) {
6890 ComMenuSePlay(MENU_SOUND_REFUSE);
6893 if (*slot_qty == 0) {
6899 InitHaveData(BtlHaveItemPt);
6900 }
else if (take != 0) {
6901 BtlHaveItemPt->
item_no = *slot_item;
6902 BtlHaveItemPt->
slot_state = ITEM_MENU_QUICK_SLOTS;
6906 if (*slot_qty <= 0) {
6910 }
else if (ok != 0) {
6911 MenuDataSwap(slot_item, &BtlHaveItemPt->
item_no);
6915 BtlHaveItemPt->
volume = vol;
6917 if (*slot_item >= ITEM_DUNGEON_START) {
6923 if (BtlHaveItemPt->
item_no >= ITEM_DUNGEON_START) {
6924 BtlHaveItemPt->
slot_state = ITEM_MENU_QUICK_SLOTS;
6929 ComMenuSePlay(MENU_SOUND_CONFIRM);
6935 case ITEM_MENU_CHARA:
6937 ComMenuSePlay(MENU_SOUND_REFUSE);
6938 }
else if (info->
kind != ITEMKIND_ITEM) {
6939 ComMenuSePlay(MENU_SOUND_REFUSE);
6941 int chara = ItemMenuMode.
chara;
6942 int result = ItemUseFunc(BtlMenuStatusPt, BtlHaveItemPt->
item_no, chara, ITEM_USE_ON_CHARA, NULL);
6943 int sounds[4] = {2, 1, 0x18, -1};
6947 sound = sounds[result];
6953 ComMenuSePlay(MENU_SOUND_REFUSE);
6956 int effect = WEP_EFFECT_NONE;
6961 if ((use & 0x80) && (data->
kind_flags & 4)) {
6962 effect = WEP_EFFECT_CURE_DRINK;
6967 if ((use & 0x40) && (data->
kind_flags & 4)) {
6968 effect = WEP_EFFECT_CURE_HEAL_HP;
6971 ComMenuSePlay(SE_EFFECT_CHIME);
6975 effect = WEP_EFFECT_CURE_STATUS;
6978 int volume = GetMenuItemUseVolume();
6986 switch (BtlHaveItemPt->
item_no) {
6987 case ITEM_ANTIDOTE_DRINK:
6990 case ITEM_HOLY_WATER:
6996 case ITEM_MIGHTY_HEALING:
7006 effect = WEP_EFFECT_CURE_AILMENT;
7009 ComMenuSePlay(SE_EFFECT_CHIME);
7013 effect = WEP_EFFECT_CURE_AILMENT;
7015 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON) {
7016 ComMenuSePlay(SE_POWER_UP);
7023 if (BtlHaveItemPt->
item_no == ITEM_POCKET) {
7024 effect = WEP_EFFECT_CURE_POCKET;
7027 int volume = GetMenuItemUseVolume();
7032 if (BtlHaveItemPt->
item_no == ITEM_FRUIT_OF_EDEN) {
7033 effect = WEP_EFFECT_CURE_FRUIT_OF_EDEN;
7036 int volume = GetMenuItemUseVolume();
7041 if (BtlHaveItemPt->
item_no == ITEM_GOURD) {
7042 effect = WEP_EFFECT_CURE_GOURD;
7045 int volume = GetMenuItemUseVolume();
7050 if (BtlHaveItemPt->
item_no == ITEM_REVIVAL_POWDER) {
7051 effect = WEP_EFFECT_CURE_REVIVAL_POWDER;
7054 int volume = GetMenuItemUseVolume();
7060 ItemMenuMode.
state = ITEM_MENU_STATE_EFFECT;
7062 MenuWepLevelUp.
CureEffect((
int) effect_x, (int) effect_y, buffer, BtlMenuExReadBlock, effect);
7065 InitHaveData(BtlHaveItemPt);
7071 case ITEM_MENU_WEAPON: {
7072 int chara = ItemMenuMode.
chara;
7080 if (before == GetDefaultWeaponNo(ItemMenuMode.
chara)) {
7084 int held = BtlHaveItemPt->
item_no;
7086 if (held == ITEM_POWERUP_POWDER && is_default == 0) {
7089 if (target->
experience >= GetWeaponMaxExp(weapon)) {
7090 ComMenuSePlay(MENU_SOUND_REFUSE);
7091 }
else if (target->
level >= 99) {
7092 ComMenuSePlay(MENU_SOUND_REFUSE);
7093 }
else if (target->
item_no == ITEM_WEAPON_SERPENT_SWORD && GetMenuHebikiriFlag() == 0) {
7094 ComMenuSePlay(MENU_SOUND_REFUSE);
7096 ItemMenuMode.
state = ITEM_MENU_STATE_POWERUP_CONFIRM;
7097 ItemMenuMode.
use_target = ITEM_USE_ON_EQUIP_WEAPON;
7099 ComMenuSePlay(MENU_SOUND_CONFIRM);
7101 }
else if (held != ITEM_POWERUP_POWDER && held != ITEM_REPAIR_POWDER) {
7102 ComMenuSePlay(MENU_SOUND_REFUSE);
7104 int result = ItemUseFunc(BtlMenuStatusPt, held, ItemMenuMode.
chara, ITEM_USE_ON_BOARD_WEAPON, weapon);
7107 if ((u32) (result - 1) < 2) {
7108 s16 sounds[2] = {1, 0x18};
7109 ComMenuSePlay(sounds[result - 1]);
7112 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON) {
7113 if (before != after) {
7114 int who = ((
CUserStatus *) BtlMenuStatusPt)->cur_chara;
7116 if (ItemMenuMode.
chara == who) {
7117 EquipWeaponFrame(&DefaultWeapon, ItemMenuMode.
chara, CharaMainHandViewFlag);
7119 if (((
CUserStatus *) BtlMenuStatusPt)->cur_chara == CHARA_OSMOND) {
7120 NowMainEffect = &CharaMainEffectCrash;
7130 InitHaveData(BtlHaveItemPt);
7132 ComMenuSePlay(MENU_SOUND_REFUSE);
7138 case ITEM_MENU_DEFENSE:
7139 ComMenuSePlay(MENU_SOUND_REFUSE);
7141 case ITEM_MENU_BOARD: {
7142 s16 held = BtlHaveItemPt->
item_no;
7145 if (board->
cursor_area == PERSONAL_BOARD_AREA_TRASH) {
7146 if (held < ITEM_ATTACH_START) {
7147 ComMenuSePlay(MENU_SOUND_REFUSE);
7148 }
else if (IsEnableTrushThrow(held) != 0) {
7151 InitHaveData(BtlHaveItemPt);
7152 ComMenuSePlay(MENU_SOUND_CONFIRM);
7154 ComMenuSePlay(MENU_SOUND_REFUSE);
7160 if (ItemMenuMode.
board.
page == BOARD_PAGE_WEAPON) {
7169 int result = PersonalBoardItemGetorSwap(ItemMenuMode.
board.
cursor);
7172 ComMenuSePlay(MENU_SOUND_REFUSE);
7173 }
else if (result == 1) {
7174 if (BtlHaveItemPt->
item_no >= ITEM_ATTACH_START) {
7177 InitHaveData(BtlHaveItemPt);
7182 ComMenuSePlay(MENU_SOUND_CONFIRM);
7183 }
else if (result == 2) {
7184 float x = 4.3f + 3.2f * (float) (ItemMenuMode.
board.
cursor % 5);
7187 if (item == ITEM_REPAIR_POWDER) {
7189 MenuWepLevelUp.
CureEffect((
int) x, (int) y, effect, BtlMenuExReadBlock, WEP_EFFECT_CURE_REPAIR);
7192 if (ItemMenuMode.
board.
page == BOARD_PAGE_WEAPON) {
7193 if (item == ITEM_REPAIR_POWDER) {
7196 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON) {
7197 if (after != before) {
7198 EquipWeaponFrame(&DefaultWeapon, ItemMenuMode.
chara, CharaMainHandViewFlag);
7204 ComMenuSePlay(SE_WEAPON_REPAIR);
7207 if (item == ITEM_POWERUP_POWDER && before != GetDefaultWeaponNo(ItemMenuMode.
board.
cursor / 10)) {
7208 ItemMenuMode.
state = ITEM_MENU_STATE_POWERUP_CONFIRM;
7209 ItemMenuMode.
use_target = ITEM_USE_ON_BOARD_WEAPON;
7211 ComMenuSePlay(MENU_SOUND_CONFIRM);
7214 }
else if (result == 1) {
7215 ComMenuSePlay(MENU_SOUND_CONFIRM);
7217 ComMenuSePlay(MENU_SOUND_REFUSE);
7223 case ITEM_MENU_TRUSH:
7224 if (ItemTrushKey(thrown, thrown_vol, ItemMenuMode.
board.
cursor) != 0) {
7227 ComMenuSePlay(MENU_SOUND_CONFIRM);
7229 ComMenuSePlay(MENU_SOUND_REFUSE);
7234 }
else if (GamePad.
Down(PAD_CIRCLE) != 0) {
7235 ComMenuSePlay(MENU_SOUND_REFUSE);
7238 BattleMenuFlag = BTLMENU_STATE_ITEM_CLOSE;
7239 u_long128 *buffer = BtlMenuReadBuf;
7241 switch (BtlMenuMode) {
7242 case BATTLE_MENU_MODE_DUNGEON:
7243 BtlMenuExReadFlag = DngActItemModelReadStart(buffer);
7248 ItemMenuMode.
state = ITEM_MENU_STATE_CLOSE;
7251 ComMenuSePlay(MENU_SOUND_REFUSE);
7258 s16 held = BtlHaveItemPt->
item_no;
7261 case ITEM_MENU_TRUSH:
7262 switch (WhatIsKindofItem(held)) {
7263 case BOARD_PAGE_ITEM:
7267 case BOARD_PAGE_WEAPON: {
7268 int who = WhoIsWeaponEquip(held);
7272 item_no = weapons[10].
item_no;
7274 BtlHaveItemPt->
item_no = item_no;
7277 if (BtlHaveItemPt->
item_no < ITEM_WEAPON_START) {
7278 InitHaveData(BtlHaveItemPt);
7284 case BOARD_PAGE_ATTACH: {
7288 BtlHaveItemPt->
item_no = item_no;
7295 case ITEM_MENU_BOARD:
7296 PersonalBoardItemCancel();
7298 case ITEM_MENU_QUICK_SLOTS: {
7305 if (*slot_qty < 2 && *slot_item != held && held >= ITEM_DUNGEON_START) {
7306 MenuDataSwap(slot_item, &BtlHaveItemPt->
item_no);
7307 int held_vol = BtlHaveItemPt->
volume;
7309 if (held_vol <= 0) {
7315 BtlHaveItemPt->
volume = vol;
7317 }
else if (*slot_item == held && held >= ITEM_DUNGEON_START && *slot_qty < 9) {
7320 MenuDataSwap(slot_item, &BtlHaveItemPt->
item_no);
7321 int held_vol = BtlHaveItemPt->
volume;
7323 if (held_vol <= 0) {
7329 BtlHaveItemPt->
volume = vol;
7335 InitHaveData(BtlHaveItemPt);
7339 if (BtlHaveItemPt->
item_no < ITEM_ATTACH_START) {
7340 InitHaveData(BtlHaveItemPt);
7348 }
else if (GamePad.
Down(PAD_SQUARE) != 0) {
7349 switch (ItemMenuMode.
mode) {
7350 case ITEM_MENU_QUICK_SLOTS: {
7353 s16 *items = pack->
item;
7361 if (*slot_item > 0) {
7362 for (i = 0; 0 < *slot_qty || i < MenuItemPackPt->
num; i++) {
7364 items[i] = *slot_item;
7370 if (*slot_qty <= 0) {
7378 if (((
CUserStatus *) BtlMenuStatusPt)->overflow_flag != 0) {
7379 DeleteMenuTrushMark();
7383 ComMenuSePlay(MENU_SOUND_REFUSE);
7386 case ITEM_MENU_BOARD:
7387 case ITEM_MENU_DEFENSE:
7388 case ITEM_MENU_CHARA:
7390 case BOARD_PAGE_ITEM:
7391 SeitonItemBoard(MenuItemPackPt);
7393 if (((
CUserStatus *) BtlMenuStatusPt)->overflow_flag != 0) {
7397 ComMenuSePlay(MENU_SOUND_CONFIRM);
7399 case BOARD_PAGE_ATTACH:
7401 ComMenuSePlay(MENU_SOUND_CONFIRM);
7407 }
else if (GamePad.
Down(PAD_TRIANGLE) != 0) {
7409 s16 *items = MenuItemPackPt->
item;
7411 switch (ItemMenuMode.
mode) {
7412 case ITEM_MENU_QUICK_SLOTS: {
7416 if (*slot_item < ITEM_DUNGEON_START) {
7417 ComMenuSePlay(MENU_SOUND_REFUSE);
7421 ITEM_DATA *data = GetItemData(*slot_item);
7424 ComMenuSePlay(MENU_SOUND_REFUSE);
7428 int moving = IconAutoGet.
IsSameItem(*slot_item);
7431 ComMenuSePlay(MENU_SOUND_CONFIRM);
7433 ComMenuSePlay(MENU_SOUND_REFUSE);
7435 int space = IconAutoGet.
GetSpace();
7436 int qty = *slot_qty;
7437 int total = qty + moving;
7439 if (total >= 9 || space < 0) {
7440 ComMenuSePlay(MENU_SOUND_REFUSE);
7442 s16 held = BtlHaveItemPt->
item_no;
7444 if (held >= ITEM_DUNGEON_START && held == *slot_item && total == 8) {
7445 *slot_qty = qty + 1;
7447 ComMenuSePlay(MENU_SOUND_CONFIRM);
7451 for (
int i = 0; i < MenuItemPackPt->
num; i++) {
7452 int want = *slot_item;
7454 if ((want < ITEM_DUNGEON_START || want == items[i]) && (want >= ITEM_DUNGEON_START || held == items[i])) {
7455 int y = (int) (ItemMenuMode.
board.
y + (
float) (i / 5 * 0x28));
7457 if (y >= 0x78 && y < 0x119) {
7458 int x = i % 5 * 0x28 + 0x168;
7459 int vol = MenuItemPackPt->
item_vol[cursor];
7465 IconAutoGet.
IconMoveTarSet(space, cursor, want, vol, (
float) x, (float) y);
7481 if (BtlHaveItemPt->
item_no > 0 && BtlHaveItemPt->
item_no == *slot_item) {
7489 ComMenuSePlay(MENU_SOUND_CONFIRM);
7491 ComMenuSePlay(MENU_SOUND_REFUSE);
7499 case ITEM_MENU_BOARD:
7501 ComMenuSePlay(MENU_SOUND_REFUSE);
7502 }
else if (ItemMenuMode.
board.
page == BOARD_PAGE_WEAPON || ItemMenuMode.
board.
page == BOARD_PAGE_ATTACH) {
7503 ComMenuSePlay(MENU_SOUND_REFUSE);
7505 int space = IconAutoGet.
GetSpace();
7512 ComMenuSePlay(MENU_SOUND_REFUSE);
7517 int item_no = SearchBoardNowPosItemExist(ItemMenuMode.
board.
page, pos);
7519 if (item_no < ITEM_DUNGEON_START) {
7520 ComMenuSePlay(MENU_SOUND_REFUSE);
7527 ComMenuSePlay(MENU_SOUND_REFUSE);
7536 for (slot = 0; slot < 3; slot++) {
7545 if (slot_item < ITEM_DUNGEON_START) {
7551 if (same != 0 || empty >= 0) {
7558 ComMenuSePlay(MENU_SOUND_REFUSE);
7561 }
else if (empty >= 0) {
7565 int y = (int) (ItemMenuMode.
board.
y + (
float) (pos / 5 * 0x28));
7567 if (y >= 0x78 && y < 0x119) {
7568 IconAutoGet.
IconMoveTarSet(space, target, item_no, vol, (
float) (pos % 5 * 0x28 + 0x176), (
float) y);
7574 ComMenuSePlay(MENU_SOUND_CONFIRM);
7576 ComMenuSePlay(MENU_SOUND_REFUSE);
7589 switch (ItemMenuMode.
mode) {
7590 case ITEM_MENU_CHARA: {
7591 int hp = DebugGetHp(ItemMenuMode.
chara);
7592 int max_hp = DebugGetMaxHp(ItemMenuMode.
chara);
7594 if (GamePad.
On2(PAD_CROSS) && hp < max_hp) {
7598 if (GamePad.
On2(PAD_CIRCLE) && hp > 1) {
7602 if (GamePad.
On2(PAD_SQUARE)) {
7606 DebugSetHp(ItemMenuMode.
chara, hp);
7608 if (GamePad.
On2(PAD_TRIANGLE)) {
7609 float water = DebugGetWater(ItemMenuMode.
chara);
7615 DebugSetWater(ItemMenuMode.
chara, water);
7620 case ITEM_MENU_DEFENSE: {
7621 int defense = DebugGetDefense(ItemMenuMode.
chara);
7623 if (GamePad.
On2(PAD_CROSS) && defense < 999) {
7627 if (GamePad.
On2(PAD_CIRCLE) && 0 < defense) {
7631 DebugSetDefense(ItemMenuMode.
chara, defense);
7636 if (GamePad.
On2(PAD_SQUARE)) {
7637 switch (ItemMenuMode.
mode) {
7638 case ITEM_MENU_CHARA: {
7639 float water = DebugGetWater(ItemMenuMode.
chara) - 1.0f;
7645 DebugSetWater(ItemMenuMode.
chara, water);
7651 if (GamePad.
On2(PAD_TRIANGLE)) {
7652 switch (ItemMenuMode.
mode) {
7653 case ITEM_MENU_CHARA:
7655 case ITEM_MENU_DEFENSE: {
7657 int money = status->
money + 1000;
7659 if (money >= 0xFFFF) {
7660 status->
money = 0xFFFF;
7662 status->
money = money;
7670 if (GamePad.
Down(PAD_SELECT)) {
7671 ItemMenuMode.
state = ITEM_MENU_STATE_DEBUG_ITEMS;
7678 case ITEM_MENU_STATE_DEBUG_ITEMS:
7679 if (DebugItemGetKey() == -1) {
7680 ItemMenuMode.
state = ITEM_MENU_STATE_IDLE;
7686 if (old_mode != ItemMenuMode.
mode || old_cursor != ItemMenuMode.
board.
cursor || old_chara != ItemMenuMode.
chara || old_page != ItemMenuMode.
board.
page) {
7687 ComMenuSePlay(MENU_SOUND_CURSOR);
7690 if (GamePad.
Down(PAD_L2 | PAD_R2 | PAD_L1 | PAD_R1) != 0 && ItemMenuMode.
mode == ITEM_MENU_CHARA && old_chara == ItemMenuMode.
chara) {
7691 ComMenuSePlay(MENU_SOUND_REFUSE);
7695 int cursor = board->
cursor;
7700 if (GetCommonItemInfo(BtlHaveItemPt->
item_no) != NULL) {
7704 s16 held = BtlHaveItemPt->
item_no;
7706 if (held >= ITEM_ATTACH_START) {
7707 if (held == ITEM_ATTACH_SYNTHESIS_SPHERE) {
7714 int messages[7] = {-1, 0xC1, 0xBF, 0xBD, -1, -1, -1};
7715 int message = messages[ItemMenuMode.
mode];
7717 switch (ItemMenuMode.
mode) {
7718 case ITEM_MENU_QUICK_SLOTS: {
7721 if (*slot >= ITEM_DUNGEON_START) {
7722 message = *slot + 0x1F4;
7727 case ITEM_MENU_CHARA:
7728 chara_mes = ItemMenuMode.
chara;
7730 case ITEM_MENU_WEAPON:
7731 GetNowEquipWeaponDataForMsg(name_mes, value);
7733 case ITEM_MENU_DEFENSE:
7735 case ITEM_MENU_TRUSH:
7737 case BOARD_PAGE_ITEM: {
7740 if (item_no >= ITEM_DUNGEON_START) {
7741 message = item_no + 0x1F4;
7746 case BOARD_PAGE_WEAPON:
7747 for (
int i = 0; i < 6; i++) {
7752 if (weapon->
item_no >= ITEM_WEAPON_START) {
7753 message = GetWeaponMsgNo2(weapon->
item_no) + 0x1F4;
7754 value = weapon->
level;
7760 case BOARD_PAGE_ATTACH: {
7763 if (attach->item_no >= ITEM_ATTACH_START) {
7764 message = attach->item_no + 0x1F4;
7766 if (attach->item_no == ITEM_ATTACH_SYNTHESIS_SPHERE) {
7767 name_mes = GetWeaponMsgNo2(attach->sphere_weapon_no);
7770 value = GetAttachVolumeForMsg(attach);
7778 case ITEM_MENU_BOARD:
7780 case PERSONAL_BOARD_AREA_CELLS:
7781 switch (board->
page) {
7782 case BOARD_PAGE_ITEM: {
7783 s16 *slot = &MenuItemPackPt->
item[cursor];
7785 if (*slot >= ITEM_DUNGEON_START) {
7786 message = *slot + 0x1F4;
7791 case BOARD_PAGE_WEAPON: {
7792 int chara = board->
cursor / 10;
7797 if (weapon->
item_no >= ITEM_WEAPON_START) {
7798 message = GetWeaponMsgNo2(weapon->
item_no) + 0x1F4;
7799 value = weapon->
level;
7804 case BOARD_PAGE_ATTACH: {
7807 if (attach->item_no >= ITEM_ATTACH_START) {
7808 message = attach->item_no + 0x1F4;
7809 value = GetAttachVolumeForMsg(attach);
7811 if (attach->item_no == ITEM_ATTACH_SYNTHESIS_SPHERE) {
7812 name_mes = GetWeaponMsgNo2(attach->sphere_weapon_no);
7821 case PERSONAL_BOARD_AREA_TRASH:
7822 if (BtlHaveItemPt->
item_no < ITEM_ATTACH_START) {
7836 if (ItemMenuMode.
state != ITEM_MENU_STATE_DEBUG_ITEMS) {
7839 if (CommonMenuMes2.
mes_made != message) {
7843 int made_no = CommonMenuMes2.
mes_no[0];
7844 int made_value = CommonMenuMes2.
value;
7846 if ((name_mes > 0 && made_no != name_mes + 0x64) || (value >= 0 && made_value != value) || (chara_mes >= 0 && made_no != chara_mes + 0x32)) {
7853 CommonMenuMes2.
value = value;
7856 CommonMenuMes2.
mes_no[0] = name_mes + 0x64;
7859 if (chara_mes >= 0) {
7860 CommonMenuMes2.
mes_no[0] = chara_mes + 0x32;
7869 switch (ItemMenuMode.
mode) {
7870 case ITEM_MENU_QUICK_SLOTS:
7871 case ITEM_MENU_CHARA:
7872 case ITEM_MENU_WEAPON:
7873 case ITEM_MENU_DEFENSE:
7874 case ITEM_MENU_BOARD:
7875 case ITEM_MENU_TRUSH: {
7876 s16 names[6] = {0xB4, 0xB6, 0xB6, 0xB6, 0xB5, 0xB6};
7878 s16 name = names[ItemMenuMode.
mode];
7892void ItemMenuModeDraw() {
7893 BtlMenuTexBlockEnter();
7894 CharaStatus = TexManager.GetTexture(
"status", -1);
7896 switch (ItemMenuMode.
mode) {
7897 case ITEM_MENU_QUICK_SLOTS:
7898 case ITEM_MENU_CHARA:
7899 case ITEM_MENU_WEAPON:
7900 case ITEM_MENU_DEFENSE:
7901 case ITEM_MENU_BOARD:
7902 case ITEM_MENU_TRUSH: {
7903 ActiveItemDraw(0x3A, 0x4A, 0x80);
7904 DrawPersonalBoard(0x154, 0x78, ItemMenuMode.
board.
page, 0x80, 0);
7905 CommonTrushDraw(0x232, 0x10C, 0x80);
7906 CommonMoneyBoardDraw(0x163, 0x120, ((
CUserStatus *) BtlMenuStatusPt)->money, 0x80);
7910 ItemMenuCharaStatusDraw(0x3A, 0xB4, ItemMenuMode.
chara, 0x80);
7911 MenuTextureReload(BtlMenuReadBlock);
7913 int arrow_y = arrow_x;
7914 int arrow_w = arrow_x;
7916 switch (ItemMenuMode.
mode) {
7917 case ITEM_MENU_QUICK_SLOTS:
7918 case ITEM_MENU_CHARA:
7919 case ITEM_MENU_WEAPON:
7920 case ITEM_MENU_DEFENSE:
7928 case ITEM_MENU_BOARD:
7929 case ITEM_MENU_TRUSH:
7937 DrawBtlMenuLRCursor(arrow_x, arrow_y, arrow_w, 0x80);
7945 MenuTextureReload(AtoraNameMes.
tex_block);
7947 float widths[7] = {11.4f, 12.7f, 12.7f, 12.9f, 12.7f, 12.7f, 12.7f};
7948 s8 shift[7] = {0, 0, 0, 0, 0, -16, -16};
7949 float heights[7] = {1.2f, 1.2f, 1.2f, 1.2f, 1.2f, 2.4f, 2.4f};
7950 MenuHelpWinDraw(0x36, 0x174 + shift[BtlMenuNowLang], widths[BtlMenuNowLang], heights[BtlMenuNowLang], 0x80);
7952 float widths[7] = {11.4f, 12.7f, 12.7f, 12.7f, 12.7f, 12.7f, 12.7f};
7953 MenuHelpWinDraw(0x36, 0x154, widths[BtlMenuNowLang], 1.2f, 0x80);
7956 AtoraNameMes.
text_x = 0x4A;
7958 AtoraNameMes.
text_y = 0x178;
7960 AtoraNameMes.
text_y = 0x158;
7963 AtoraNameMes.
Step();
7967 MenuTextureReload(BtlMenuReadBlock);
7969 if (ItemMenuMode.
state == ITEM_MENU_STATE_DEBUG_ITEMS) {
7973 s16 cursor_pos[7][2] = {
7982 cursor_pos[0][0] = (ItemMenuMode.
board.
cursor << 6) + 0x3E;
7983 cursor_pos[5][1] = ItemMenuMode.
board.
cursor * 0x2C + 0x7E;
7984 int x = cursor_pos[ItemMenuMode.
mode][0];
7985 int y = cursor_pos[ItemMenuMode.
mode][1];
7988 switch (ItemMenuMode.
mode) {
7989 case ITEM_MENU_BOARD:
7991 case PERSONAL_BOARD_AREA_CELLS: {
7992 int cursor = board->
cursor;
7993 x = cursor % 5 * 0x28 + 0x148;
7995 y = cursor / 5 * 0x28 + 0x7C;
7998 case PERSONAL_BOARD_AREA_TRASH:
8009 int frame_x = x + 0x17;
8010 int frame_y = y - 2;
8012 if (ItemMenuMode.
mode == ITEM_MENU_CHARA) {
8024 switch (ItemMenuMode.
mode) {
8025 case ITEM_MENU_QUICK_SLOTS: {
8029 if (0 <= cursor && *slot >= ITEM_DUNGEON_START) {
8035 case ITEM_MENU_TRUSH:
8036 case ITEM_MENU_BOARD:
8039 if (SearchBoardNowPosItemExist(ItemMenuMode.
board.
page, cursor) >= ITEM_ATTACH_START) {
8051 s16 vibe_offset[3][2] = {
8056 x += vibe_offset[vibe][0];
8057 y += vibe_offset[vibe][1];
8058 vibe = (vibe << 5) + 0x40;
8059 SysCur[0] += ((float) x - SysCur[0]) / 4.0f;
8060 SysCur[1] += ((float) y - SysCur[1]) / 4.0f;
8067 if (board->
held_item.
item_no >= ITEM_ATTACH_START && ItemMenuMode.
state != ITEM_MENU_STATE_POWERUP_CONFIRM) {
8071 if (info != NULL && (info->
kind == ITEMKIND_WEAPON || info->
kind == ITEMKIND_ATTACH)) {
8072 MenuTextureReload(ItemMenuWeaponIconReadBlock);
8075 DrawMenuVibeItem((
int) SysCur[0], (
int) SysCur[1], 2, -0xC, 0x80);
8078 switch (ItemMenuMode.
state) {
8079 case ITEM_MENU_STATE_LOADING:
8080 case ITEM_MENU_STATE_OPEN:
8081 case ITEM_MENU_STATE_CLOSE: {
8084 switch (ItemMenuMode.
state) {
8085 case ITEM_MENU_STATE_LOADING:
8088 case ITEM_MENU_STATE_OPEN:
8089 alpha = 0x80 - ItemMenuMode.
counter * 8;
8091 case ITEM_MENU_STATE_CLOSE:
8092 alpha = ItemMenuMode.
counter * 5 + 0x40;
8104 FrameImageDraw(0x40, alpha);
8107 case ITEM_MENU_STATE_POWERUP_CONFIRM: {
8110 int holes = GetWeaponHoleNum(weapon->
item_no);
8112 for (
int i = 0; i < holes; i++) {
8120 if (CommonMenuMes1.
mes_made != 0xBC || CommonMenuMes1.
values[0] != filled || CommonMenuMes1.
values[1] != holes) {
8121 for (
int i = 0; i < 10; i++) {
8122 CommonMenuMes1.
mes_no[i] = -1;
8123 CommonMenuMes1.
values[i] = 0;
8128 CommonMenuMes1.
values[0] = filled;
8129 CommonMenuMes1.
values[1] = holes;
8134 case ITEM_USE_ON_EQUIP_WEAPON:
8135 case ITEM_USE_ON_BOARD_WEAPON: {
8137 MenuTextureReload(CommonMenuMes1.
tex_block);
8138 CommonMenuMes1.
auto_pos = MES_POS_AUTO;
8139 CommonMenuMes1.
text_x = 0xE2;
8140 CommonMenuMes1.
text_y = 0x92;
8141 CommonMenuMes1.
Step();
8144 MenuTextureReload(BtlMenuReadBlock);
8145 int hole_x = 0x13C - (holes * 0x12 + 0xA);
8146 DrawWepHole(hole_x, 0x5A, weapon, 1, 0x80);
8147 MenuTextureReload(ItemMenuWeaponIconReadBlock);
8148 DrawWepAttach(hole_x + 0xE, 0x60, weapon, 1, 0x80);
8149 MenuTextureReload(BtlMenuReadBlock);
8150 DrawDngYesNoDialog(0x114, 0xE6, 0x80);
8151 int yes_y = ItemMenuMode.
confirm * 0x1C + 0xE0;
8152 DrawMenuWaku(268.0f, (
float) (yes_y - 2), 0x60, 0x18, 0, StayTex, 0x80);
8153 DrawMenuObjectVibe(0xF2, yes_y, 0, 0x40);
8161 if (ItemMenuMode.
state != ITEM_MENU_STATE_DEBUG_ITEMS && ItemMenuMode.
state != ITEM_MENU_STATE_EFFECT) {
8162 DrawMenuWaku((
float) frame_x, (
float) frame_y, frame_w, frame_h, 0, StayTex, 0x80);
8163 DrawMenuObjectVibe((
int) SysCur[0], (
int) SysCur[1], big, vibe);
8170int ItemMenuModeKey() {
8171 if (ItemMenuMode.
mode == ITEM_MENU_TRUSH) {
8172 int count = TrushMoveMax[ItemMenuMode.
board.
page];
8179 if (GamePad.
Down(PAD_UP) != 0) {
8180 switch (ItemMenuMode.
mode) {
8181 case ITEM_MENU_WEAPON:
8182 case ITEM_MENU_DEFENSE:
8184 ItemMenuMode.
mode = ITEM_MENU_QUICK_SLOTS;
8186 case ITEM_MENU_TRUSH:
8198 ItemMenuMode.
mode = ITEM_MENU_QUICK_SLOTS;
8203 if (GamePad.
Down(PAD_DOWN) != 0) {
8204 switch (ItemMenuMode.
mode) {
8205 case ITEM_MENU_TRUSH: {
8219 case ITEM_MENU_QUICK_SLOTS:
8221 ItemMenuMode.
mode = ITEM_MENU_WEAPON;
8225 ItemMenuMode.
mode = ITEM_MENU_CHARA;
8230 if (GamePad.
Down(PAD_LEFT) != 0) {
8231 switch (ItemMenuMode.
mode) {
8232 case ITEM_MENU_QUICK_SLOTS:
8238 case ITEM_MENU_DEFENSE:
8239 ItemMenuMode.
mode = ITEM_MENU_WEAPON;
8241 case ITEM_MENU_CHARA:
8242 ItemMenuMode.
mode = ITEM_MENU_DEFENSE;
8244 case ITEM_MENU_TRUSH:
8245 ItemMenuMode.
mode = ITEM_MENU_CHARA;
8251 if (GamePad.
Down(PAD_RIGHT) != 0) {
8252 int old_mode = ItemMenuMode.
mode;
8254 switch (ItemMenuMode.
mode) {
8255 case ITEM_MENU_TRUSH:
8256 ItemMenuMode.
mode = ITEM_MENU_BOARD;
8260 case ITEM_MENU_QUICK_SLOTS:
8264 ItemMenuMode.
mode = ITEM_MENU_BOARD;
8270 case ITEM_MENU_WEAPON:
8271 ItemMenuMode.
mode = ITEM_MENU_DEFENSE;
8273 case ITEM_MENU_DEFENSE:
8274 ItemMenuMode.
mode = ITEM_MENU_CHARA;
8276 case ITEM_MENU_CHARA:
8277 ItemMenuMode.
mode = ITEM_MENU_BOARD;
8283 if (old_mode != ITEM_MENU_TRUSH && ItemMenuMode.
mode == ITEM_MENU_BOARD) {
8284 int rows[4] = {0, 2, 0, 0};
8293 ItemMenuMode.
mode = ITEM_MENU_TRUSH;
8301void ActiveItemDraw(
int x,
int y,
int alpha) {
8302 RECT digits = {0x90, 0xDC, 0xC, 0xC};
8304 MenuTextureReload(ItemMenuWeaponIconReadBlock);
8305 int slot_x = x + 0xE;
8307 DrawMenu2DSprite(CharaStatus,
CRect_i_(slot_x, y + 1, 0xE0, 0x4F),
CRect_i_(0, 0, 0xE0, 0x50), alpha);
8311 for (
int i = 0; i < 3; i++) {
8312 s16 item_no = items[i];
8314 if (item_no >= ITEM_DUNGEON_START) {
8315 if (item_no >= ITEM_DUNGEON_START) {
8316 slot_x = x + 0x22 + (i << 6);
8320 DrawMenu2DSprite(CharaStatus,
CRect_i_(slot_x, slot_y, 0x2C, 0x2C),
CRect_i_(0x128, 0, 0x2C, 0x2C), alpha);
8321 DrawIconParts(item_no, slot_x + 6, slot_y + 6, 0, 0x280, alpha, 0);
8322 s16 count = counts[i];
8325 DrawMenuNumber(count, slot_x + 0x26, slot_y + 0x1E, PerBoardTex, digits, 0, alpha);
8330 switch (BtlMenuMode) {
8331 case BATTLE_MENU_MODE_DUNGEON:
8332 DngActiveItemTextureCopy();
8344static void MenuCharaPolyDraw() {
8345 SetNowCharaMotionNo(ItemMenuMode.
chara);
8346 SetItemMenuColor(ItemMenuMode.
chara);
8347 MenuCharaFrame.
Step();
8349 if (ItemMenuMode.
chara == 0) {
8353 MenuCharaFrame.
Draw();
8354 SetItemMenuOldAmbient();
8357void ItemMenuCharaStatusDraw(
int x,
int y,
int chara,
int alpha) {
8361 if (CharaStatus != NULL) {
8362 MenuTextureReload(ItemMenuWeaponIconReadBlock);
8363 DrawMenu2DSprite(CharaStatus,
CRect_i_(x, y + 1, 0xFC, 0x85),
CRect_i_(0, 0x50, 0xFC, 0x86), alpha);
8364 int level = BtlMenuStatusPt->
defense[chara];
8365 RECT number_rect = {0x100, 0x60, 0xC, 0xE};
8366 DrawMenuNumber(level, x + 0x64, y + 0x24, CharaStatus, number_rect, 1, alpha);
8368 if (MenuExTextureReadFlag == MENU_EX_TEX_READY && chara < BtlMenuStatusPt->party_size) {
8369 MenuTextureReload(MenuExtendReadBlock);
8370 MGSetWindowRect(
CRect_i_(x + 0x82, 0x5D, 0x76, 0x3F));
8371 MenuPolygonDraw(alpha, MenuCharaPolyDraw);
8375 top.
r = top.
g = top.
b = bottom.
r = bottom.
g = bottom.
b = 0x80;
8378 MenuTextureReload(ItemMenuWeaponIconReadBlock);
8381 set2DSprite(GetVif1Packet(), CharaStatus,
CRect_i_(draw_x, draw_y + 1, 0x7E, 0x17),
CRect_i_(0x7E, 0xBE, 0x7E, 0x18), &top, &top, &bottom, &bottom, 1);
8384 MenuTextureReload(BtlMenuReadBlock);
8387 CharaStatusMsgDraw(draw_x, draw_y, chara, 0, alpha);
8389 int hp = status->
hp[chara];
8390 int max_hp = status->
max_hp[chara];
8403 weapon = &row[slot];
8407 float durability_max;
8408 durability_max = durability = 0.0f;
8410 if (weapon != NULL) {
8415 if (durability_max < 0.0f) {
8416 durability_max = 1.0f;
8419 MenuTextureReload(ItemMenuWeaponIconReadBlock);
8420 int hp_width = max_hp * 153 / 200;
8421 int durability_width = 153.0f * durability_max / 99.0f;
8422 CRect_i_ bar_src(0x154, 0, 4, 0x10);
8424 DrawMenu2DSprite(CharaStatus,
CRect_i_(x + 0x22, draw_y, hp_width, 0x10), bar_src, alpha);
8425 DrawMenu2DSprite(CharaStatus,
CRect_i_(x + 0x1A + hp_width, draw_y, 0xA, 0x10),
CRect_i_(0x154, 0, 0xA, 0x10), alpha);
8427 DrawMenu2DSprite(CharaStatus,
CRect_i_(x + 0x22, draw_y, durability_width, 0x10), bar_src, alpha);
8428 DrawMenu2DSprite(CharaStatus,
CRect_i_(x + 0x1A + durability_width, draw_y, 0xA, 0x10),
CRect_i_(0x158, 0, 0xA, 0x10), alpha);
8429 float thirst_value = BtlMenuStatusPt->
water_max[chara];
8430 int thirst = thirst_value / 10.0f;
8434 for (
int i = 0; i < thirst - 1; i++) {
8435 DrawMenu2DSprite(CharaStatus,
CRect_i_(draw_x, draw_y + 2, 0x12, 0x15),
CRect_i_(0x154, 0x10, 0x12, 0x14), alpha);
8439 DrawMenu2DSprite(CharaStatus,
CRect_i_(draw_x, draw_y + 2, 0x18, 0x15),
CRect_i_(0x166, 0x10, 0x18, 0x14), alpha);
8442 float hp_fill = (float) (hp_width * hp) / (float) max_hp;
8444 float low_hp = 0.3f * (float) max_hp;
8446 if ((
float) hp < low_hp) {
8450 if ((
float) hp < 0.15f * (float) max_hp) {
8456 memcpy(&gradation, info,
sizeof(gradation));
8457 gradation.
colors[3].
a = alpha;
8458 gradation.
colors[2].
a = alpha;
8459 gradation.
colors[1].
a = alpha;
8460 gradation.
colors[0].
a = alpha;
8462 int values[2] = {hp, max_hp};
8463 draw_x = x + 0x3C + hp_width;
8465 DrawStatusNumberNowAndMax(values, draw_x, draw_y, 1, alpha);
8467 int now_motion = MenuCharaFrame.
motion_no;
8469 if (hp_fill < low_hp) {
8475 if (motion != now_motion) {
8481 hp_fill = (float) durability_width * durability / durability_max;
8482 int durability_color;
8484 if (durability < 0.3f * durability_max) {
8485 durability_color = 0x1A;
8487 durability_color = 0x19;
8490 info = GetGradationColorInfo2(0x19);
8491 memcpy(&gradation, info,
sizeof(gradation));
8492 gradation.
colors[3].
a = alpha;
8493 gradation.
colors[2].
a = alpha;
8494 gradation.
colors[1].
a = alpha;
8495 gradation.
colors[0].
a = alpha;
8496 DrawMenuColorGradation(
CRect_i_(draw_x, draw_y, (
int) hp_fill, 6), &gradation.
colors[0], &gradation.
colors[1], &gradation.
colors[2], &gradation.
colors[3]);
8497 draw_x = x + 0x3C + durability_width;
8499 values[0] = GetDispVolumeForFloat(durability);
8500 values[1] = (int) durability_max;
8501 DrawStatusNumberNowAndMax(values, draw_x, draw_y, 1, alpha);
8504 int drops = (int) BtlMenuStatusPt->
water_now[chara] / 10;
8506 for (
int i = 0; i < drops; i++) {
8507 DrawMenu2DSprite(CharaStatus,
CRect_i_(draw_x, draw_y, 0x10, 0x14),
CRect_i_(0x128, 0x2C, 0x10, 0x14), alpha);
8511 drops = (int) BtlMenuStatusPt->
water_now[chara] % 10;
8514 DrawMenu2DSprite(CharaStatus,
CRect_i_(draw_x, draw_y, 0x10, 0x14),
CRect_i_(0x128 + (3 - (
int) (drops / 2.5f)) * 0x10, 0x2C, 0x10, 0x14), alpha);
8518 int party_size = BtlMenuStatusPt->
party_size;
8525 for (; i <= party_size; i++) {
8528 draw_x = x + 0x10 + chara * 0xC;
8529 DrawMenu2DSprite(CharaStatus,
CRect_i_(draw_x, draw_y - 1, 0x20, 0x1B),
CRect_i_(0, 0xD8, 0x20, 0x1C), alpha);
8530 DrawMenu2DSprite(CharaStatus,
CRect_i_(draw_x + 0x20, draw_y - 1, 0x5E, 0x1B),
CRect_i_(0x20, 0xD8, 0x4A, 0x1C), alpha);
8531 DrawMenu2DSprite(CharaStatus,
CRect_i_(draw_x + 0x7E, draw_y - 1, 0x20, 0x1B),
CRect_i_(0x6A, 0xD8, 0x20, 0x1C), alpha);
8534 tab = party_size - 1;
8537 draw_x = tab * 0xC + (x + 0x10 + after * 0x69);
8548 if (GetMenuLangFlag() > LANG_JAPANESE) {
8553 DrawMenu2DSprite(CharaStatus,
CRect_i_(draw_x, draw_y + 2, 0x1C, 0x13),
CRect_i_(tex_x, tex_y, 0x1C, 0x14), alpha);
8557 int item_no = weapon->
item_no;
8560 RetCTex(item_no, tex_x, tex_y);
8561 CTexture *icon = TexManager.GetTexture(
"wepicon", -1);
8563 if (icon != NULL && item_no >= ITEM_WEAPON_START) {
8564 MenuTextureReload(ItemMenuWeaponIconReadBlock);
8566 WeaponAllValueSet(weapon, &total, 0);
8567 DrawMenu2DSprite(icon,
CRect_i_(draw_x, draw_y, 0x20, 0x20),
CRect_i_(tex_x, tex_y, 0x20, 0x20), alpha);
8568 DrawMenuNumber(total.
attack, draw_x + 0x20, draw_y + 0x14, CharaStatus, number_rect, 1, alpha);
8571 MenuTextureReload(CommonMenuMes3.
tex_block);
8572 int mes_no = chara + 0xC2;
8574 if (CommonMenuMes3.
mes_made != mes_no) {
8578 int name_length = GetMsgLengthCharaName(chara);
8581 s8 char_width[7] = {8, 6, 6, 6, 6, 6, 6};
8582 s8 name_offset[7] = {0, 6, 6, 6, 6, 6, 6};
8583 int lang = BtlMenuNowLang;
8584 DrawMenuClsMes(&CommonMenuMes3, x + 0x5A + chara * 0xC - name_length * char_width[lang] + name_offset[lang], y - 0x12);
8588void ItemNaviCursor(
int item_no) {
8589 s8 shown[3] = {0, 0, 0};
8600 if (item_no >= ITEM_REGULAR_WATER && item_no <= ITEM_CHEESE) {
8604 if (item_no == ITEM_MELLOW_BANANA) {
8610 if ((u32) (item_no - ITEM_REPAIR_POWDER) < 2) {
8614 if (item_no == ITEM_REVIVAL_POWDER) {
8616 int chara = ItemMenuMode.
chara;
8619 if ((
float) status->
hp[chara] <= 0.0f) {
8628 if (BtlMenuMode == BATTLE_MENU_MODE_DUNGEON && item_no >= ITEM_THROBBING_CHERRY && item_no < ITEM_MEDUSA_POWDER && item_no != ITEM_BOMB_NUTS) {
8634 if (item_no == ITEM_DRAN_S_FEATHER) {
8649 for (
int i = 0; i < 3; i++) {
8650 if (shown[i] != 0 && ct % 60 < 30) {
8653 CRect_i_ texel(0xD8, 0, 0x28, 0x14);
8655 for (
int j = 0; j < 2; j++, py -= 0x14, texel.x -= 0x28) {
8656 DrawMenu2DSprite(BtStatus,
CRect_i_(px, py, texel.width, texel.height), texel, 0x80);
8666void CharaStatusMsgDraw(
int x,
int y,
int chara,
int per_member,
int alpha) {
8667 static float statusCnt = -PI;
8669 int bob_y = (int) ((
float) y + 4.0f * sinf(statusCnt));
8674 if (condition & AILMENT_GOO) {
8678 if (condition & AILMENT_CURSE) {
8682 if (condition & AILMENT_POISON) {
8686 if (condition & AILMENT_STAMINA) {
8690 if (condition & AILMENT_FREEZE) {
8694 if (BtlMenuStatusPt->
hp[chara] <= 0 || (condition & AILMENT_KNOCKED_OUT)) {
8699 int u = icon / 3 * 0x44 + 0x78;
8700 int v = icon % 3 * 0x24 + 0x14;
8701 DrawMenu2DSprite(BtStatus,
CRect_i_(x, bob_y, 0x44, 0x23),
CRect_i_(u, v, 0x44, 0x24), alpha);
8706 if (per_member != 0) {
8708 period = 50.0f * count;
8713 statusCnt += PI / period;
8715 if (!(statusCnt < PI)) {
8727static int BattleMenuAtoraKey() {
8728 switch (BtlEffectFlag) {
8729 case BTLEFFECT_PAGE_OPEN:
8730 if (ToFromSelect(0) != 0) {
8731 BtlEffectFlag = BTLEFFECT_NONE;
8736 case BTLEFFECT_PAGE_CLOSE:
8737 if (ToFromSelect(1) != 0) {
8738 MenuSelect[0] = BTLMENU_PAGE_ATLA;
8739 BattleMenuFlag = BTLMENU_STATE_ATLA_CLOSE;
8741 BattleMenuFlag = BTLMENU_STATE_MAIN;
8746 switch (MenuAtoraSelectKey()) {
8747 case ATORA_SELECT_CLOSE:
8748 BtlEffectFlag = BTLEFFECT_PAGE_CLOSE;
8751 case ATORA_SELECT_NONE:
8758 if (BtlEffectFlag != BTLEFFECT_NONE) {
8759 BtlEffectCt += 1.0f;
8767static int IsLoadMapNo();
8769static int MapNoTransFunc(
int map_no);
8771s16 MenuGrobalMapNoTbl[16] = {0, 200, 1, 201, 14, 2, 202, 3, 42, 203, 23, 4, 204, 40, 205, 60};
8790float mapo[4] = {0.0f, 0.0f, 0.0f, 1.0f};
8791float mapmovev[4] = {0.0f, 0.0f, 0.0f, 1.0f};
8804static void StartLoadWorldMap(
int region, u_long128 *buffer);
8806void InitMenuMove(
int mode,
int texture_block, u_long128 *buffer) {
8807 BtlMenuSaveDataPt = SaveData;
8808 MenuMove.
mode = mode;
8811 case MENU_MOVE_DUNGEON_ESCAPE:
8812 case MENU_MOVE_INTERIOR_OUT:
8813 MenuMapJumpMode = 0;
8816 CommonMenuMes3.
Preset(MES_PRESET_SYSTEM);
8817 CommonMenuMes3.
rows = 3;
8818 CommonMenuMes3.
auto_pos = MES_POS_NONE;
8819 SysCur[1] = MenuMove.
cursor * 26 + 174;
8820 MapMoveCursor = NULL;
8823 case MENU_MOVE_WORLD_MAP_DIRECT:
8826 StayTex = TexManager.GetTexture(
"stayframe", -1);
8828 StayTex = TexManager.GetTexture(
"stayfram", -1);
8832 case MENU_MOVE_WORLD_MAP:
8833 if (((s32 *) SaveData->
GetConfigData())[14] != 0 && SaveData->
VisitMap(MenuGrobalMapNoTbl[WORLD_PLACE_FIELD_S30], 0) > 0) {
8834 printf(
"clear!!!!\n");
8836 if (SaveData->
VisitMap(MenuGrobalMapNoTbl[WORLD_PLACE_DEMON_SHAFT] <= 0, 0) != 0) {
8837 SaveData->
VisitMap(MenuGrobalMapNoTbl[WORLD_PLACE_DEMON_SHAFT], 1);
8838 printf(
"demon shaft On!!!!!\n");
8842 printf(
"not clear \n");
8846 printf(
"not toki no kairou\n");
8850 printf(
"MapNo = %d\n", MapNo);
8851 MenuMapJumpMode = -1;
8852 MenuMove.
cursor = MapNoTransFunc(MapNo);
8855 printf(
"Now select map = %d\n", MenuMove.
cursor);
8856 printf(
"Now Load MapNo = %d\n", MenuMove.
load_map);
8857 NextWorldPos = TownOrDngPos[MenuMove.
cursor].
frame;
8859 buffer = MenuCalcBufAlignment(buffer);
8860 MenuMove.
last_place = WORLD_PLACE_DEMON_SHAFT;
8861 StartLoadWorldMap(MenuMove.
load_map, buffer);
8863 if (mode == MENU_MOVE_WORLD_MAP_DIRECT) {
8865 }
while (ReadBGSync() != 0);
8869 CommonMenuMes3.
Preset(MES_PRESET_NAME);
8870 CommonMenuMes3.
rows = 1;
8871 MapMoveCursor = NULL;
8873 case MENU_MOVE_FIRST_DUNGEON:
8875 MenuMapJumpMode = -1;
8876 CommonMenuMes3.
Preset(MES_PRESET_SYSTEM);
8877 CommonMenuMes3.
rows = 3;
8878 SysCur[1] = MenuMove.
cursor * 26 + 174;
8882 MenuMove.
state = MENU_MOVE_STATE_OPEN;
8888void GetTownOrDngPos() {
8889 MenuWorldTrans(&MenuCamera);
8891 MenuCharaFrame.
SetScale(scale, scale, scale);
8893 float ref[4] = {0.0f, 0.0f, -45.0f, 1.0f};
8894 float pos[4] = {0.0f, 0.0f, 60.0f, 1.0f};
8898 for (
int i = 0; i < 16; i++) {
8901 if (place != NULL) {
8902 if (GetVisitInfo(i, MenuMove.
mode) == 0) {
8910 if (frame == NULL) {
8911 printf(
"%d is NULL nothing\n", i);
8914 Get3DPosTo2DPos(frame, screen);
8915 place->
x = screen[0] - 4;
8916 place->
y = screen[1] - 0x2A;
8925 int message = CommonMenuMes3.
mes_made;
8929 switch (MenuMove.
state) {
8930 case MENU_MOVE_STATE_OPEN: {
8931 done = ToFromSelect(0);
8934 switch (MenuMove.
mode) {
8935 case MENU_MOVE_DUNGEON_ESCAPE:
8936 case MENU_MOVE_FIRST_DUNGEON:
8937 case MENU_MOVE_INTERIOR_OUT:
8940 case MENU_MOVE_WORLD_MAP:
8941 case MENU_MOVE_WORLD_MAP_DIRECT:
8942 if (MenuMove.
ready == 0) {
8943 MenuMove.
ready = LoadWorldMap();
8945 if (MenuMove.
ready != 0) {
8946 ComMenuSePlay(SE_WORLD_MAP_OPEN);
8964 if (done != 0 && MenuMove.
counter > 0x14 && MenuMove.
ready != 0 && ready != 0) {
8965 switch (MenuMove.
mode) {
8966 case MENU_MOVE_WORLD_MAP_DIRECT:
8969 BattleMenuFlag = BTLMENU_STATE_MOVE;
8973 MenuMove.
state = MENU_MOVE_STATE_SELECT;
8975 switch (MenuMove.
mode) {
8976 case MENU_MOVE_DUNGEON_ESCAPE:
8977 case MENU_MOVE_FIRST_DUNGEON:
8978 case MENU_MOVE_INTERIOR_OUT:
8980 case MENU_MOVE_WORLD_MAP_DIRECT:
8981 case MENU_MOVE_WORLD_MAP:
8990 case MENU_MOVE_STATE_CLOSE: {
8991 done = ToFromSelect(1);
8993 if (MenuMove.
mode == MENU_MOVE_WORLD_MAP_DIRECT) {
8997 if (done != 0 && MenuMove.
counter > 0x14) {
9001 switch (MenuMove.
mode) {
9002 case MENU_MOVE_WORLD_MAP_DIRECT:
9005 TexManager.DeleteTextureBlock(MenuMove.
tex_block);
9008 BattleMenuFlag = BTLMENU_STATE_MAIN;
9012 for (
int i = 0; i < 10; i++) {
9013 CommonMenuMes3.
mes_no[i] = -1;
9017 for (
int i = 0; i < 4; i++) {
9018 CommonMenuMes1.
mes_no[i] = -1;
9020 if (i >= 0 && i < 10) {
9030 case MENU_MOVE_STATE_ZOOM_IN:
9031 mapo[0] += mapmovev[0];
9032 mapo[1] += mapmovev[1];
9033 mapo[2] += mapmovev[2];
9036 MenuMove.
state = MENU_MOVE_STATE_CONFIRM;
9040 case MENU_MOVE_STATE_ZOOM_OUT:
9041 mapo[0] += mapmovev[0];
9042 mapo[1] += mapmovev[1];
9043 mapo[2] += mapmovev[2];
9049 MenuMove.
state = MENU_MOVE_STATE_SELECT;
9053 case MENU_MOVE_STATE_CONFIRM:
9054 switch (MenuMove.
cursor) {
9055 case WORLD_PLACE_WISE_OWL_FOREST:
9056 case WORLD_PLACE_FIELD_S04:
9057 case WORLD_PLACE_MUSKA_LACKA:
9058 case WORLD_PLACE_FIELD_S32:
9059 case WORLD_PLACE_SUN_MOON_TEMPLE:
9060 case WORLD_PLACE_FIELD_S13:
9061 case WORLD_PLACE_YELLOW_DROPS:
9062 case WORLD_PLACE_FIELD_S30:
9070 if (GamePad.
Down(PAD_CROSS) != 0) {
9071 MenuMapJumpMode = MenuGrobalMapNoTbl[MenuMove.
cursor];
9073 if (MapNo != MenuMapJumpMode) {
9075 ComMenuSePlay(MENU_SOUND_CONFIRM);
9076 }
else if (MenuMove.
mode == MENU_MOVE_WORLD_MAP_DIRECT) {
9078 MenuMapJumpMode = MapNo;
9081 ComMenuSePlay(MENU_SOUND_REFUSE);
9083 }
else if (GamePad.
Down(PAD_CIRCLE) != 0) {
9084 MenuMove.
state = MENU_MOVE_STATE_ZOOM_OUT;
9086 mapmovev[0] = -mapmovev[0];
9087 mapmovev[1] = -mapmovev[1];
9088 mapmovev[2] = -mapmovev[2];
9092 case MENU_MOVE_STATE_SELECT: {
9093 int old_cursor = MenuMove.
cursor;
9095 switch (MenuMove.
mode) {
9096 case MENU_MOVE_DUNGEON_ESCAPE:
9097 case MENU_MOVE_FIRST_DUNGEON:
9098 case MENU_MOVE_INTERIOR_OUT:
9099 if (GamePad.
Down(PAD_UP | PAD_DOWN) != 0) {
9100 if (MenuMove.
cursor != 0) {
9107 if (GamePad.
Down(PAD_CROSS) != 0) {
9110 if (MenuMove.
cursor == 0) {
9113 switch (MenuMove.
mode) {
9114 case MENU_MOVE_DUNGEON_ESCAPE:
9117 switch (EscapeDungeonMode()) {
9118 case ESCAPE_DNG_POWDER:
9119 BtlMenuStatusPt->
LostItem(ITEM_ESCAPE_POWDER);
9121 case ESCAPE_DNG_PAY: {
9125 money = status->
money;
9128 if (money - half >= 0xFFFF) {
9129 status->
money = 0xFFFF;
9131 status->
money += -half;
9138 MenuMapJumpMode = 1;
9140 case MENU_MOVE_FIRST_DUNGEON:
9141 MenuMapJumpMode = 0xC8;
9143 case MENU_MOVE_INTERIOR_OUT:
9144 SetInteriorOutFlag(1);
9146 MenuMove.
state = MENU_MOVE_STATE_INTERIOR_FADE;
9152 ComMenuSePlay(MENU_SOUND_CONFIRM);
9154 MenuMove.
state = MENU_MOVE_STATE_CLOSE;
9155 BattleMenuFlag = BTLMENU_STATE_MOVE_CLOSE;
9156 ComMenuSePlay(MENU_SOUND_REFUSE);
9160 switch (MenuMove.
mode) {
9161 case MENU_MOVE_DUNGEON_ESCAPE: {
9162 int escape = EscapeDungeonMode();
9163 s16 messages[3] = {0x131, 0x130, 0x12F};
9164 message = messages[escape];
9167 case MENU_MOVE_FIRST_DUNGEON:
9170 case MENU_MOVE_INTERIOR_OUT:
9176 case MENU_MOVE_WORLD_MAP:
9177 case MENU_MOVE_WORLD_MAP_DIRECT:
9182 if (DebugMode && GamePad.
Down2(PAD_CROSS)) {
9183 for (
int i = 0; i <= 15; i++) {
9184 if (GetVisitInfo(i, MenuMove.
mode) == 0) {
9185 int map = MenuGrobalMapNoTbl[i];
9186 printf(
"nowset mapID = %d\n", map);
9193 case WORLD_PLACE_NORUNE:
9194 case WORLD_PLACE_MATATAKI:
9195 case WORLD_PLACE_FIELD_S04:
9196 case WORLD_PLACE_QUEENS:
9197 case WORLD_PLACE_MUSKA_LACKA:
9198 case WORLD_PLACE_FIELD_S32:
9199 case WORLD_PLACE_FIELD_S13:
9200 case WORLD_PLACE_YELLOW_DROPS:
9201 case WORLD_PLACE_FIELD_S30:
9202 case WORLD_PLACE_DEMON_SHAFT:
9203 BtlMenuSaveDataPt->
VisitMap(map, 1);
9205 if (BtlMenuSaveDataPt->
VisitMap(map, 0) == 0) {
9206 printf(
" mapID = %d, visitflag=%d\n", map, BtlMenuSaveDataPt->
VisitMap(map, 0));
9208 printf(
"mapID = %d ,visitflag=%d\n", map, BtlMenuSaveDataPt->
VisitMap(map, 0));
9223 if (MenuMove.
cursor < 0) {
9224 MenuMove.
cursor = WORLD_PLACE_FIELD_S04;
9227 if (GamePad.
Down(PAD_CROSS) != 0) {
9229 MenuMapJumpMode = MenuGrobalMapNoTbl[MenuMove.
cursor];
9231 if (MenuMove.
mode != MENU_MOVE_WORLD_MAP_DIRECT && MapNo == MenuMapJumpMode) {
9233 ComMenuSePlay(MENU_SOUND_REFUSE);
9235 ComMenuSePlay(MENU_SOUND_CONFIRM);
9236 MenuMove.
state = MENU_MOVE_STATE_ZOOM_IN;
9238 float local[4] = {0.0f, 0.0f, 0.0f, 1.0f};
9239 MapMoveCursor->GetWorldPosition(world, local);
9240 mapmovev[0] = -world[0] / 15.0f;
9241 mapmovev[1] = -world[1] / 15.0f;
9250 if (old_cursor != MenuMove.
cursor) {
9251 ComMenuSePlay(MENU_SOUND_CURSOR);
9254 if (decided == 0 && GamePad.
Down(PAD_CIRCLE) != 0) {
9255 switch (MenuMove.
mode) {
9256 case MENU_MOVE_DUNGEON_ESCAPE:
9257 MenuMapJumpMode = 0;
9259 case MENU_MOVE_WORLD_MAP_DIRECT:
9261 case MENU_MOVE_WORLD_MAP:
9262 case MENU_MOVE_FIRST_DUNGEON:
9263 MenuMapJumpMode = -1;
9265 case MENU_MOVE_INTERIOR_OUT:
9266 SetInteriorOutFlag(0);
9270 if (MenuMove.
mode != MENU_MOVE_WORLD_MAP_DIRECT) {
9271 MenuMove.
state = MENU_MOVE_STATE_CLOSE;
9273 if (MenuMove.
mode != MENU_MOVE_WORLD_MAP_DIRECT) {
9274 BattleMenuFlag = BTLMENU_STATE_MOVE_CLOSE;
9278 ComMenuSePlay(MENU_SOUND_REFUSE);
9283 case MENU_MOVE_STATE_INTERIOR_FADE:
9284 if (!(BtlEffectCt <= 44.0f)) {
9292 int names[16] = {0, 1, 2, 3, 4, 5, 6, 7, 13, 8, 9, 10, 11, 14, 12, 15};
9293 int name = names[MenuMove.
cursor] + 0xA;
9295 if (message == 0x138 && CommonMenuMes3.
mes_no[0] != name) {
9296 CommonMenuMes3.
mes_no[0] = name;
9300 if ((u32) (help - 0x139) < 2 && CommonMenuMes2.
mes_no[0] != name) {
9301 CommonMenuMes2.
mes_no[0] = name;
9302 GetMsgLengthMenu(&CommonMenuMes2, name);
9304 CommonMenuMes2.
mes_no[0] = name;
9308 if (CommonMenuMes3.
mes_made != message) {
9312 if (CommonMenuMes2.
mes_made != help) {
9319void DrawMenuMove() {
9325 if (MenuMove.
mode == MENU_MOVE_WORLD_MAP_DIRECT) {
9326 MenuWorldTrans(&MenuCamera);
9327 FrameImageDraw(0x40, 0x80);
9330 BtlMenuTexBlockEnter();
9333 switch (MenuMove.
state) {
9334 case MENU_MOVE_STATE_OPEN:
9337 case MENU_MOVE_STATE_CLOSE:
9338 alpha = 0x80 - MenuMove.
counter * 8;
9352 switch (MenuMove.
mode) {
9353 case MENU_MOVE_DUNGEON_ESCAPE:
9354 case MENU_MOVE_INTERIOR_OUT:
9357 case MENU_MOVE_FIRST_DUNGEON:
9362 switch (MenuMove.
mode) {
9363 case MENU_MOVE_DUNGEON_ESCAPE: {
9365 DrawEscapeItem(0x32, 0x160, alpha);
9367 DrawEscapeItem(0x32, 0x140, alpha);
9372 CommonMenuMes3.
text_x = y - (size[2] >> 1) + 0xA;
9373 CommonMenuMes3.
text_y = 0x7E;
9376 if (MenuMove.
state == MENU_MOVE_STATE_CLOSE) {
9381 MenuTextureReload(BtlMenuReadBlock);
9382 DrawDngYesNoDialog(0x118, 0xDC, alpha);
9384 y = MenuMove.
cursor * 0x1C + 0xD2;
9387 case MENU_MOVE_INTERIOR_OUT:
9388 case MENU_MOVE_FIRST_DUNGEON: {
9392 CommonMenuMes3.
text_x = y - (size[2] >> 1) + 0xA;
9394 if (MenuMove.
mode == MENU_MOVE_FIRST_DUNGEON && CommonMenuMes3.
mes_made > 0 && size[2] >= 0x28 && size[3] < 0xC9) {
9395 CommonMenuMes3.
text_y = 0x94;
9396 MenuHelpWinDraw2(CommonMenuMes3.
text_x - 0x1A, CommonMenuMes3.
text_y - 4, 8.0f + (
float) size[2], 2.0f + (
float) size[3], alpha, 0, 0, StayTex);
9399 if (MenuMove.
mode == MENU_MOVE_INTERIOR_OUT && CommonMenuMes3.
mes_made > 0 && size[2] >= 0x28 && size[3] < 0xC9) {
9400 CommonMenuMes3.
text_y = 0x92;
9401 MenuHelpWinDraw2(CommonMenuMes3.
text_x - 0x1A, CommonMenuMes3.
text_y - 4, 8.0f + (
float) size[2], 2.0f + (
float) size[3], alpha, 0, 0, StayTex);
9406 MenuTextureReload(BtlMenuReadBlock);
9407 DrawDngYesNoDialog(0x118, 0xD8, alpha);
9409 y = MenuMove.
cursor * 0x1C + 0xD2;
9412 case MENU_MOVE_WORLD_MAP_DIRECT:
9413 case MENU_MOVE_WORLD_MAP: {
9420 int place = MapNoTransFunc(MapNo);
9440 SysCur[0] = (float) x;
9441 SysCur[1] = (float) y;
9445 int map_alpha = 0x80;
9447 switch (MenuMove.
state) {
9448 case MENU_MOVE_STATE_CLOSE:
9453 if (MenuMove.
ready != 0 && MenuCharaFrame.
frame != NULL) {
9454 DrawWorldMap(map_alpha);
9461 SysCur[0] += ((float) x - SysCur[0]) / ease;
9462 SysCur[1] += ((float) y - SysCur[1]) / ease;
9465 switch (MenuMove.
mode) {
9466 case MENU_MOVE_WORLD_MAP:
9467 case MENU_MOVE_WORLD_MAP_DIRECT:
9468 if (!((
float) abs((
int) (SysCur[0] - (
float) x)) <= 4.0f) && !((
float) abs((
int) (SysCur[1] - (
float) y)) <= 4.0f)) {
9472 if (MenuMove.
state != MENU_MOVE_STATE_CONFIRM || MenuMove.
state != MENU_MOVE_STATE_CLOSE) {
9479 int waku_x = x + 0x1A;
9483 switch (MenuMove.
mode) {
9484 case MENU_MOVE_DUNGEON_ESCAPE:
9485 case MENU_MOVE_FIRST_DUNGEON:
9486 case MENU_MOVE_INTERIOR_OUT:
9487 if (MenuMove.
cursor != 0) {
9494 case MENU_MOVE_WORLD_MAP:
9495 case MENU_MOVE_WORLD_MAP_DIRECT:
9498 CommonMenuMes3.
text_x = (int) ((
double) x - (double) width / 2.0);
9499 CommonMenuMes3.
text_y = y - 0x22;
9503 x = (int) SysCur[0];
9504 y = (int) SysCur[1];
9506 switch (MenuMove.
state) {
9507 case MENU_MOVE_STATE_SELECT:
9508 switch (MenuMove.
mode) {
9509 case MENU_MOVE_DUNGEON_ESCAPE:
9510 case MENU_MOVE_FIRST_DUNGEON:
9511 case MENU_MOVE_INTERIOR_OUT:
9512 DrawMenuWaku((
float) waku_x, (
float) waku_y, (
int) width, 0x1A, 0, StayTex, 0x80);
9513 DrawMenuObjectVibe(x, y, 1, 0x40);
9515 case MENU_MOVE_WORLD_MAP:
9516 case MENU_MOVE_WORLD_MAP_DIRECT: {
9520 CRect_i_ texel(0xE2, 0, 0x1E, 0x20);
9522 CRect_i_ texel(0xE0, 0, 0x20, 0x20);
9524 DrawObjectVibe(x + 2, y + 2, MenuMoveTex, texel, 0xA, 0x50);
9525 DrawObjectVibe(x, y, MenuMoveTex, texel, 0x80, 0x80);
9527 MenuHelpWinDraw2(CommonMenuMes3.
text_x - 0x18, CommonMenuMes3.
text_y - 0xE, 1.0f + width, 0.0f, 0x80, 0, 0, StayTex);
9533 case MENU_MOVE_STATE_OPEN:
9534 case MENU_MOVE_STATE_CLOSE:
9536 case MENU_MOVE_STATE_CONFIRM:
9537 MenuHelpWinDraw2(CommonMenuMes3.
text_x - 0x18, CommonMenuMes3.
text_y - 0xE, 1.0f + width, 0.0f, 0x80, 0, 0, StayTex);
9541 MenuTextureReload(CommonMenuMes3.
tex_block);
9543 if (arrived != 0 && (MenuMove.
state != MENU_MOVE_STATE_CONFIRM || MenuMove.
state != MENU_MOVE_STATE_CLOSE)) {
9544 switch (MenuMove.
state) {
9545 case MENU_MOVE_STATE_ZOOM_IN:
9546 alpha = 0x80 - MenuMove.
counter * 0xA;
9548 case MENU_MOVE_STATE_ZOOM_OUT:
9562 CommonMenuMes3.
Step();
9566 if (MenuMove.
state == MENU_MOVE_STATE_CONFIRM) {
9571 GetMainMenuRightHelpWinLangOffset(win_x, win_y, win_w, win_h);
9573 if (GetMenuLangFlag() > LANG_JAPANESE) {
9575 win_w = 1.2f + win_w;
9578 MenuHelpWinDraw((
int) win_x, (
int) win_y, win_w, win_h, 0x80);
9581 GetMainMenuRightHelpMsgLangOffset(text_x, text_y);
9582 CommonMenuMes2.
text_x = (int) (win_x + (
float) text_x);
9583 CommonMenuMes2.
text_y = (int) (win_y + (
float) text_y);
9584 CommonMenuMes2.
Step();
9588 if (MenuMove.
mode == MENU_MOVE_WORLD_MAP_DIRECT) {
9592 if (GetMenuLangFlag() > LANG_JAPANESE) {
9600 DrawMenu2DSprite(MenuMoveTex,
CRect_i_(0x3C, 0x28, title_w, 0x28),
CRect_i_(0, 0, title_w, 0x28), 0x80);
9603 if (MenuMove.
state == MENU_MOVE_STATE_INTERIOR_FADE && GetInteriorOutFlag() != 0) {
9610 AllFadeForMenu(alpha);
9613 switch (MenuMove.
state) {
9614 case MENU_MOVE_STATE_SELECT:
9615 case MENU_MOVE_STATE_CONFIRM:
9624void DrawEscapeItem(
int x,
int y,
int alpha) {
9626 float widths[7] = {8.6f, 9.0f, 9.0f, 11.0f, 9.0f, 9.0f, 9.0f};
9628 float widths[7] = {8.6f, 9.0f, 9.0f, 9.0f, 9.0f, 9.0f, 9.0f};
9633 float height = 1.0f;
9634 MenuHelpWinDraw(x, y, widths[BtlMenuNowLang], height, alpha);
9635 int row_y = y + 0x10;
9636 MenuTextureReload(BtlMenuReadBlock);
9638 if (PerBoardTex == NULL) {
9639 PerBoardTex = TexManager.GetTexture(
"perbrd", -1);
9642 int money = ((
CUserStatus *) BtlMenuStatusPt)->money;
9643 CommonMoneyBoardDraw(x, y - 0x1E, money, alpha);
9645 s8 shift[7] = {0, 0, 0, 34, 0, 0, 0};
9647 int count = GetNowItemNum(ITEM_ESCAPE_POWDER, MenuItemPackPt);
9648 CTexture *icon = RetCTex(0xAF, u, v);
9649 DrawMenu2DSprite(icon,
CRect_i_(x + 0x14, row_y, 0x20, 0x20),
CRect_i_(u, v, 0x20, 0x20), alpha);
9651 DrawMenu2DSprite(BtStatus,
CRect_i_(x + 0x86 + shift[BtlMenuNowLang], row_y + 8, 0x10, 0x10),
CRect_i_(0x60, 0x58, 0x10, 0x10), alpha);
9652 int number_x = x + 0xA2 + shift[BtlMenuNowLang];
9654 DrawMenu2DSprite(BtStatus,
CRect_i_(x + 0x86, row_y + 8, 0x10, 0x10),
CRect_i_(0x60, 0x58, 0x10, 0x10), alpha);
9655 int number_x = x + 0xA2;
9657 number_x += GetNumberKeta(count) * 6;
9658 DrawMenuNumber(count, number_x, row_y + 8, StayTex, NumberSprite[1], 2, alpha);
9659 s16 messages[7] = {0x138, 0x1A8, 0x1A8, 0x1A8, 0x1A8, 0x1A8, 0x1A8};
9661 if (CommonMenuMes1.
mes_made != messages[BtlMenuNowLang]) {
9662 CommonMenuMes1.
mes_no[0] = 0x113;
9663 CommonMenuMes1.
MakeMesWin(messages[BtlMenuNowLang]);
9666 if (BtlMenuNowLang > LANG_JAPANESE) {
9668 CommonMenuMes1.
line_pos[0].
x = x + 0x38;
9669 CommonMenuMes1.
line_pos[0].
y = row_y - 0x14;
9670 CommonMenuMes1.
line_pos[1].
x = x + 0x3C;
9674 MenuTextureReload(CommonMenuMes1.
tex_block);
9677 DrawMenuClsMes(&CommonMenuMes1, x + 0x38, row_y - 0x10);
9683inline void AddWorldMapFileName(
char *path,
int region) {
9684 char *files[6] = {
"matatagi.pac",
"queen.pac",
"musuka.pac",
"moon.pac",
"dark.pac",
"lastdng.pac"};
9686 strcat(path, files[region]);
9689static void StartLoadWorldMap(
int region, u_long128 *buffer) {
9693 if (region < 0 || region > 5) {
9697 GetPathReadDifferntLang(path);
9698 strcat(path,
"map/");
9699 AddWorldMapFileName(path, region);
9701 LoadFileBG(path, buffer, &size);
9705 if (ReadBGSync() == 0) {
9707 char img_format[32] =
"w_map_1%d.img";
9708 char cfg_format[32] =
"w_map1%d.cfg";
9711 sprintf(img, img_format, MenuMove.
load_map + 1);
9712 sprintf(cfg, cfg_format, MenuMove.
load_map + 1);
9714 {
"#frame_imagemove#640#" SCREEN_HEIGHT_STR
"#4", 0, 0},
9724 textures[1].
name = (
char *) GetPackFile((u_int *) file->
buffer,
"w_map_02.img", NULL);
9725 textures[2].
name = (
char *) GetPackFile((u_int *) file->
buffer, img, NULL);
9726 textures[3].
name = (
char *) GetPackFile((u_int *) file->
buffer,
"menumove.img", NULL);
9727 TexManager.DeleteTextureBlock(MenuMove.
tex_block);
9728 int blocks[2] = {0, -1};
9730 MenuTextureDelete(blocks);
9731 TexManager.CleanUpTextureList();
9732 BtlMenuTexBlockEnter();
9733 TexManager.LoadTextureBlockEX(-1, textures);
9734 MenuMoveTex = TexManager.GetTexture(
"menumove", -1);
9736 if (MenuMove.
mode == MENU_MOVE_WORLD_MAP_DIRECT) {
9737 InitMenuMesSet(MENU_MES_SET_WORLD_MAP, (
short *) GetPackFile((u_int *) file->
buffer,
"allmenu.mes", NULL));
9740 u_long128 *model = file->
buffer + ((((file->
size >> 6) + 1) << 6) >> 4);
9742 MenuExCashBuffer.
base = (u_char *) model;
9743 MenuExCashBuffer.
limit = 0xCF80;
9744 MenuExCashBuffer.
used = 0;
9745 MenuCharaFrame.
LoadPackData((u_int *) file->
buffer, cfg, &MenuExCashBuffer, &MenuExCashBuffer, NULL);
9754 MapMoveCursor = MenuCharaFrame.
frame->SearchFrame(TownOrDngPos[MenuMove.
cursor].frame);
9768static void LocalDrawWorldMap() {
9769 MenuCharaFrame.
SetScale(2.2f, 2.2f, 2.2f);
9771 MenuCharaFrame.
Step();
9772 MenuCharaFrame.
Draw();
9782static void DrawWorldMap(
int alpha) {
9784 MenuPolygonDraw(alpha, LocalDrawWorldMap);
9795int GetNearWorldPos(
int direction,
int *position) {
9796 if (direction == 0) {
9813 down = direction & 2;
9819 right = direction & 8;
9825 left = direction & 4;
9831 float length = sqrt(dx * dx + dy * dy);
9833 if (length != 0.0f) {
9837 if (length != 0.0f) {
9843 for (
int i = 0; i < 16; i++) {
9854 place->
dx = pos->
x - from->
x;
9855 place->
dy = pos->
y - from->
y;
9858 float nx = place->
dx;
9859 float ny = place->
dy;
9861 if (distance != 0.0f) {
9869 for (
int i = 0; i < 16;) {
9873 for (
int j = i + 1; j < 16; j++) {
9877 MenuDataSwap(place, other);
9889 int nearest_sq = 600000;
9891 for (
int i = 0; i < 16; i++) {
9894 if (place->
reachable > 0 && (!up || place->
dy < 0) && (!down || place->
dy > 0) && (!right || place->
dx > 0) && (!left || place->
dx < 0) && place->
distance_sq < nearest_sq) {
9895 nearest = place->
index;
9910static int WorldMapMoveKey() {
9913 position[0] = SysCur[0];
9914 position[1] = SysCur[1];
9917 if (GamePad.
Down(PAD_UP) != 0) {
9921 if (GamePad.
Down(PAD_DOWN) != 0) {
9925 if (GamePad.
Down(PAD_RIGHT) != 0) {
9929 if (GamePad.
Down(PAD_LEFT) != 0) {
9933 if (direction > 0) {
9934 direction = GetNearWorldPos(direction, position);
9936 if (direction < 16 && direction >= 0) {
9937 NextWorldPos = TownOrDngPos[direction].
frame;
9938 MenuMove.
cursor = direction;
9939 MapMoveCursor = MenuCharaFrame.
frame->SearchFrame(TownOrDngPos[MenuMove.
cursor].frame);
9953void DrawMapCheck(
int alpha) {
9955 s16 offset[16][2] = {0};
9960 for (
int i = 0; i < 16; i++) {
9966 if (frame != NULL) {
9969 Get3DPosTo2DPos(frame, pos);
9974 dst.x = pos[0] + offset[i][0];
9975 dst.y = pos[1] + offset[i][1];
9983 DrawMenu2DSprite(MenuMoveTex, dst, src, 0x80);
9996static int GetVisitInfo(
int place,
int menu_mode) {
9999 int map_no = MenuGrobalMapNoTbl[place];
10001 if (map_no >= 200) {
10006 case WORLD_PLACE_NORUNE:
10007 case WORLD_PLACE_MATATAKI:
10008 case WORLD_PLACE_FIELD_S04:
10009 case WORLD_PLACE_QUEENS:
10010 case WORLD_PLACE_MUSKA_LACKA:
10011 case WORLD_PLACE_FIELD_S32:
10012 case WORLD_PLACE_FIELD_S13:
10013 case WORLD_PLACE_YELLOW_DROPS:
10014 case WORLD_PLACE_FIELD_S30:
10015 case WORLD_PLACE_DEMON_SHAFT:
10024 visits = BtlMenuSaveDataPt->
VisitMap(map_no, 0);
10026 switch (NowGetGameFlagForBtlMenu(menu_mode)) {
10027 case MENU_MOVE_WORLD_MAP:
10028 case MENU_MOVE_WORLD_MAP_DIRECT:
10049static int IsLoadMapNo() {
10051 s8 map_region[80] = {
10116 for (
int map_no = 0; map_no < 80; map_no++) {
10117 if (BtlMenuSaveDataPt->
VisitMap(map_no, 0) && map_region[map_no] > region) {
10118 region = map_region[map_no];
10122 s8 dungeon_region[6] = {0, 1, 2, 3, 4, 5};
10124 for (
int dungeon = 1; dungeon <= 5; dungeon++) {
10125 if (BtlMenuSaveDataPt->
QuestDungeon(dungeon, 0) && dungeon_region[dungeon - 1] > region) {
10126 region = dungeon_region[dungeon - 1];
10140static int MapNoTransFunc(
int map_no) {
10144 s16 towns[5] = {WORLD_PLACE_NORUNE, WORLD_PLACE_MATATAKI, WORLD_PLACE_QUEENS, WORLD_PLACE_MUSKA_LACKA, WORLD_PLACE_YELLOW_DROPS};
10145 place = towns[map_no];
10148 if (map_no >= 11 && map_no < 200) {
10149 char fields[69] = {
10150 WORLD_PLACE_MATATAKI,
10151 WORLD_PLACE_MATATAKI,
10152 WORLD_PLACE_MATATAKI,
10153 WORLD_PLACE_FIELD_S04,
10154 WORLD_PLACE_FIELD_S04,
10155 WORLD_PLACE_FIELD_S04,
10156 WORLD_PLACE_FIELD_S04,
10157 WORLD_PLACE_FIELD_S04,
10158 WORLD_PLACE_QUEENS,
10159 WORLD_PLACE_QUEENS,
10160 WORLD_PLACE_FIELD_S13,
10161 WORLD_PLACE_FIELD_S32,
10162 WORLD_PLACE_FIELD_S13,
10163 WORLD_PLACE_FIELD_S30,
10164 WORLD_PLACE_FIELD_S30,
10165 WORLD_PLACE_GALLERY_OF_TIME,
10166 WORLD_PLACE_FIELD_S32,
10167 WORLD_PLACE_FIELD_S04,
10168 WORLD_PLACE_FIELD_S13,
10169 WORLD_PLACE_FIELD_S13,
10170 WORLD_PLACE_FIELD_S13,
10171 WORLD_PLACE_FIELD_S13,
10172 WORLD_PLACE_MATATAKI,
10173 WORLD_PLACE_SUN_MOON_TEMPLE,
10174 WORLD_PLACE_SHIPWRECK,
10175 WORLD_PLACE_FIELD_S32,
10176 WORLD_PLACE_MOON_SEA,
10177 WORLD_PLACE_FIELD_S30,
10178 WORLD_PLACE_SHIPWRECK,
10179 WORLD_PLACE_FIELD_S30,
10180 WORLD_PLACE_FIELD_S30,
10181 WORLD_PLACE_FIELD_S32,
10182 WORLD_PLACE_QUEENS,
10183 WORLD_PLACE_QUEENS,
10184 WORLD_PLACE_QUEENS,
10185 WORLD_PLACE_NORUNE,
10186 WORLD_PLACE_FIELD_S30,
10187 WORLD_PLACE_FIELD_S30,
10188 WORLD_PLACE_FIELD_S30,
10189 WORLD_PLACE_FIELD_S30,
10190 WORLD_PLACE_FIELD_S30,
10191 WORLD_PLACE_NORUNE,
10192 WORLD_PLACE_NORUNE,
10193 WORLD_PLACE_NORUNE,
10194 WORLD_PLACE_NORUNE,
10195 WORLD_PLACE_NORUNE,
10196 WORLD_PLACE_NORUNE,
10197 WORLD_PLACE_NORUNE,
10198 WORLD_PLACE_NORUNE,
10199 WORLD_PLACE_DEMON_SHAFT,
10200 WORLD_PLACE_DEMON_SHAFT,
10202 place = fields[map_no - 11];
10205 if (map_no >= 200) {
10206 s8 dungeons[6] = {WORLD_PLACE_DIVINE_BEAST_CAVE, WORLD_PLACE_WISE_OWL_FOREST, WORLD_PLACE_SHIPWRECK, WORLD_PLACE_SUN_MOON_TEMPLE, WORLD_PLACE_MOON_SEA, WORLD_PLACE_GALLERY_OF_TIME};
10208 place = dungeons[map_no];
10221static void BattleMenuOptionKey() {
10222 int transition_done = 0;
10224 switch (BtlEffectFlag) {
10225 case BTLEFFECT_PAGE_OPEN:
10226 transition_done = ToFromSelect(0);
10228 if (transition_done != 0) {
10229 BtlEffectFlag = BTLEFFECT_NONE;
10230 BtlEffectCt = 0.0f;
10234 case BTLEFFECT_PAGE_CLOSE:
10235 transition_done = ToFromSelect(1);
10239 if (BtlEffectFlag != BTLEFFECT_NONE) {
10240 BtlEffectCt += 1.0f;
10242 BtlEffectCt = 0.0f;
10245 int closed = MenuOptionKey();
10247 if (OptionMenuFadeOutStart() != 0) {
10248 BtlEffectFlag = BTLEFFECT_PAGE_CLOSE;
10250 if (transition_done != 0 && closed != 0) {
10251 MenuSelect[0] = BTLMENU_PAGE_OPTION;
10252 BattleMenuFlag = BTLMENU_STATE_OPTION_CLOSE;
10254 BattleMenuFlag = BTLMENU_STATE_MAIN;
10266static void BattleMenuSaveKey() {
10267 int transition_done = 0;
10269 switch (BtlEffectFlag) {
10270 case BTLEFFECT_PAGE_OPEN:
10271 transition_done = ToFromSelect(0);
10273 if (transition_done != 0) {
10274 BtlEffectFlag = BTLEFFECT_NONE;
10275 BtlEffectCt = 0.0f;
10279 case BTLEFFECT_PAGE_CLOSE:
10280 transition_done = ToFromSelect(1);
10284 if (BtlEffectFlag != BTLEFFECT_NONE) {
10285 BtlEffectCt += 1.0f;
10287 BtlEffectCt = 0.0f;
10292 if (SaveMenuEffectFadeOut() != 0) {
10293 BtlEffectFlag = BTLEFFECT_PAGE_CLOSE;
10295 if (transition_done != 0) {
10296 MenuSelect[0] = BTLMENU_PAGE_SAVE;
10298 BattleMenuFlag = BTLMENU_STATE_OPTION_CLOSE;
10300 BattleMenuFlag = BTLMENU_STATE_MAIN;
10305void BattleManualInit(
int *result, u_long128 *load_buffer) {
10306 InitMenuManual(result, load_buffer);
10309int BattleManualKey() {
10310 int transition_done = 0;
10312 switch (BtlEffectFlag) {
10313 case BTLEFFECT_PAGE_OPEN:
10314 transition_done = ToFromSelect(0);
10316 if (transition_done != 0) {
10317 BtlEffectFlag = BTLEFFECT_NONE;
10318 BtlEffectCt = 0.0f;
10322 case BTLEFFECT_PAGE_CLOSE:
10323 transition_done = ToFromSelect(1);
10327 if (BtlEffectFlag != BTLEFFECT_NONE) {
10328 BtlEffectCt += 1.0f;
10330 BtlEffectCt = 0.0f;
10335 if (GetNowManualMenuMode() == MANUAL_MODE_CLOSING) {
10336 BtlEffectFlag = BTLEFFECT_PAGE_CLOSE;
10338 if (transition_done != 0) {
10339 MenuSelect[0] = BTLMENU_PAGE_MANUAL;
10341 BattleMenuFlag = BTLMENU_STATE_SAVE_CLOSE;
10343 BattleMenuFlag = BTLMENU_STATE_MAIN;
10350static void BattleManualDraw() {
10361static void DrawStatusNumberNowAndMax(
int *values,
int x,
int y,
int color,
int alpha) {
10362 RECT digits = NumberSprite[0];
10364 if (values[0] < 0.3f * values[1]) {
10368 int end = DrawMenuNumber(values[1], x, y, StayTex, digits, color, alpha);
10369 DrawMenu2DSprite(StayTex,
CRect_i_(end - 11, y, 12, 12),
CRect_i_(0x78, digits.
y, 12, 12), alpha);
10370 DrawMenuNumber(values[0], end - 11, y, StayTex, digits, color, alpha);
10373void DrawWepHole(
int x,
int y,
WEAPON_HAVE *weapon,
int selected,
int alpha) {
10374 if (x < 10 || x > 620) {
10378 if (weapon == NULL) {
10383 u8 colors[3][3] = {
10384 {0x80, 0x80, 0x80},
10385 {0x28, 0x28, 0xA0},
10386 {0xFF, 0xE8, 0x02},
10390 for (
int i = 0; i < 6; i++) {
10391 if (data->
hole[i] - 1 < 0) {
10396 float width = 26.0f;
10397 float height = 12.0f;
10398 DrawMenu2DSprite(WepStatus,
CRect_i_(x + 8, y + 16, width, height),
CRect_i_(0xD4, 0x134, 0x1A, 0xD), alpha);
10409 CRect_i_ src(0xD4, src_y, 0x2A, 0x2A);
10410 DrawMenu2DSprite(WepStatus,
CRect_i_(x + 1, y + 2, 0x2A, 0x29), src, 0, 0, 0, alpha * 80 >> 7);
10413 if (data->
hole[i] == 2) {
10423 DrawMenu2DSprite(WepStatus,
CRect_i_(x, y + 1, 0x2A, 0x29), src, color[0], color[1], color[2], alpha);
10435 mode = MENU_CLSMES_OFF;
10465 for (
int i = 0; i < 10; i++) {
10469 for (
int i = 0; i < 8; i++) {
10483 for (
int i = 0; i < 10; i++) {
10507 weapon = selected_weapon;
10511 if (selected_weapon != NULL) {
10514 for (
int slot = 0; slot < 6; slot++) {
10518 if (attachment_flags != 0 && attachment_flags != 1) {
10528 for (
int bit = 1; bit <= 13; bit++) {
10530 int message_no = bit + 69;
10534 if (message_no != window->
mes_no[index]) {
10538 window->
mes_no[index] = message_no;
10543 for (clear_slot =
option_count; clear_slot < 10; clear_slot++) {
10545 window->
mes_no[clear_slot] = 0;
10548 if (changed != 0) {
10558 case MENU_CLSMES_OFF:
10560 case MENU_CLSMES_OPTIONS:
10561 case MENU_CLSMES_UNK_2:
10572static inline int MesLineX(
int x,
int len) {
10573 return x - len * 5;
10582 case MENU_CLSMES_OFF:
10584 case MENU_CLSMES_OPTIONS:
10585 case MENU_CLSMES_UNK_2:
10591 DrawMenu2DSprite(PerBoardTex,
CRect_i_(x + 0x1E, row_y - 0x17, 0x52, 0x17),
CRect_i_(0x80, 0x68, 0x52, 0x18),
alpha);
10592 DrawMenu2DSprite(PerBoardTex,
CRect_i_(x - 0x24, y - 10, 0x20, 0x20),
CRect_i_(0x80, 0x80, 0x20, 0x20),
alpha);
10593 CRect_i_ left(0x20, 0x80, 0x20, 0x18);
10594 CRect_i_ middle(0x40, 0x80, 0x14, 0x18);
10595 CRect_i_ right(0x78, 0x80, 0x8, 0x18);
10596 CRect_i_ icon_src(0xEC, 0x50, 0x14, 0x14);
10597 CTexture *face = TexManager.GetTexture(
"charaface", -1);
10599 for (option = 1; option <= 13; option++) {
10601 icon_src.
x -= icon_src.
width;
10605 if (IsWeaponOptionGoodOrBad(option)) {
10606 left.
y = middle.
y = right.
y = 0x80;
10608 left.
y = middle.
y = right.
y = 0x68;
10617 if (option == 8 && icon == 1) {
10621 if (option == 9 && icon == 2) {
10625 icon_src.
y = icon_src.
height * (icon - 1) + 0x50;
10629 DrawMenu2DSprite(face,
CRect_i_(x + 2, row_y + 2, 0x14, 0x15), icon_src,
alpha);
10635 x = (int) (x + 0xB);
void SetRef(CFrame *parent, float x, float y, float z)
void SetPos(CFrame *parent, float x, float y, float z)
void SetMotion(int no, int mode, float speed=-1.0f)
virtual void LoadPackData(unsigned int *pack, char *name, CDataAlloc2< 1 > *model_alloc, CDataAlloc2< 1 > *texture_alloc)
virtual void SetScale(float x, float y, float z)
virtual void SetRotation(float x, float y, float z)
virtual void Initialize()
virtual void SetPosition(float x, float y, float z)
virtual void ClothStep(int step)
int GetItem(int item_id, int qty)
int LostItem(int item_id)
s8 GetEquipWeaponSlot(int chara_no)
int SearchItemIndexNo(int item_id)
s32 GetActiveCharaStatus(int chara_no)
void MenuModeOn(int threshold)
void SetAutoRepeat(int mask, int initial_delay, int repeat_delay)
CMenuCursor * GetMenuCursor()
CDngStatusData * GetDngStatus()
s16 * GetCharaName(int chara_no)
int QuestDungeon(int dungeon_no, int add)
int VisitMap(int map_no, int add)
DNG_CONSUMABLE consumable_items[43]
WEAPON_HAVE chara_weapons[6][11]
s8 equipped_weapon_slot[6]
s32 res_limit_zone_current
void SetBuildUp(WEAPON_HAVE *have, CCharacter *character, CWeaponLevelUp *load_buffer, int tex_block)
void SetSnd(int from, int to, int step)
void SetLevelUpWeaponData()
void SetStatusBreak(WEAPON_HAVE *have, CCharacter *character, CWeaponLevelUp *load_buffer, int tex_block)
void SetLevelUpValue(WEAPON_HAVE *have, CCharacter *character, CWeaponLevelUp *load_buffer, int tex_block)
void WepRecover(WEAPON_HAVE *have, CCharacter *character, CWeaponLevelUp *load_buffer, int tex_block)
void CureEffect(int x, int y, CWeaponLevelUp *load_buffer, int tex_block, int kind)
int GetMesWidth_system(int mes_no)
void NeedMesWinWH(int mes_no, int *out)
int GetMesLen_system(int mes_no)
void SetBuff(short *buff)
MES_LINE_POS line_pos[10]
int MakeMesWin(int mes_no)
void SetBuff_system(short *buff)
DNG_CONSUMABLE * consumables