DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
menu_draw.cpp
1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3#pragma name_counter 553
4
5#include "menu_draw.hpp"
6
7#include <libvu0.h>
8
9#include <cstdio>
10#include <cstdlib>
11#include <cstring>
12
13#include "battlemenu.hpp"
14#include "camera.hpp"
15#include "clsmes.hpp"
16#include "dataalloc.hpp"
17#include "dataread.hpp"
18#include "dun/gameloop.hpp"
19#include "editatra.hpp"
20#include "gamepad.hpp"
21#include "itemdata.hpp"
22#include "mainitemmodel.hpp"
23#include "mainselect.hpp"
24#include "memcard.hpp"
25#include "memorycardaccess.hpp"
26#include "menu_dungeon.hpp"
27#include "menu_inventory.hpp"
28#include "menu_misc.hpp"
29#include "menuitemstep.hpp"
30#include "mglib.hpp"
31#include "rect.hpp"
32#include "savedata.hpp"
33#include "shop.hpp"
34#include "snd.hpp"
35#include "texture.hpp"
36#include "userstatus.hpp"
37
39CUserStatus *PerBoardStatusPt;
40
41CTexture *PerBoardTex;
42
44PERSONAL_BOARD *PerBoardPt;
45
46char MenuGrobalDir[64];
47
49s8 MenuTrushMark[100];
50
51#include "editloop.hpp"
52#include "gameutil.hpp"
53#include "menuetc.hpp"
54#include "sysmes.hpp"
55
57static char AllMenuTextureDir[9] = "commenu/";
58
60static char *ComMenuContryName[7] = {"a_jpn/", "a_usa/", "a_eng/", "a_fre/", "a_ger/", "a_ita/", "a_spa/"};
61
62char *GetMenuTextureDir() {
63 return AllMenuTextureDir;
64}
65
66int GetMenuLangFlag() {
67 return LanguageCode;
68}
69
70char *GetNowSelectLanguage(int language) {
71 if ((language < 0) || (language >= 7)) {
72 language = 0;
73 }
74
75 return ComMenuContryName[language];
76}
77
78void GetPathReadDifferntLang(char *path) {
79 strcpy(path, GetMenuTextureDir());
80 strcat(path, GetNowSelectLanguage(GetMenuLangFlag()));
81}
82
83int LoadFileBGMenuData(char *name, u_long128 *buffer) {
84 int size;
85
86 if ((name == NULL) || (buffer == NULL)) {
87 return -1;
88 }
89
90 GetPathReadDifferntLang(MenuGrobalDir);
91 strcat(MenuGrobalDir, name);
92 LoadFileBG(MenuGrobalDir, buffer, &size);
93 return size;
94}
95
96int LoadFileMenuData(char *name, unsigned int *buffer) {
97 int size;
98
99 GetPathReadDifferntLang(MenuGrobalDir);
100 strcat(MenuGrobalDir, name);
101 LoadFile(MenuGrobalDir, buffer, &size);
102 return size;
103}
104
105u_long128 *BtlMenuBufferSet(int mode) {
106 u_long128 *buffer;
107
108 switch (mode) {
109 case BATTLE_MENU_MODE_DUNGEON:
110 buffer = (u_long128 *) read_buffer;
111 break;
112 case BATTLE_MENU_MODE_TOWN:
113 buffer = (u_long128 *) (EdMenuBuffer.base + EdMenuBuffer.used * 0x10);
114 }
115
116 return buffer;
117}
118
119u_long128 *MenuCalcBufAlignment(u_long128 *buffer) {
120 int offset = (int) buffer;
121 int remainder = offset & 0x3F;
122
123 if ((offset < 0) && (remainder != 0)) {
124 remainder -= 0x40;
125 }
126
127 if (remainder != 0) {
128 offset = ((offset >> 6) + 1) << 6;
129 }
130
131 return (u_long128 *) offset;
132}
133
134int GetAtoraMaxVillage() {
135 int max_village = 3;
136 int village;
137
138 for (village = 4; village >= 0; village--) {
139 if (SaveData->VisitMap(village, 0) || SaveData->QuestDungeon(village, 0)) {
140 max_village = village + 3;
141 break;
142 }
143 }
144
145 if (SaveData->QuestDungeon(5, 0)) {
146 max_village = 8;
147 }
148
149 if ((max_village < 3) || (max_village > 8)) {
150 max_village = 8;
151 }
152
153 return max_village;
154}
155
156int GetNowMapTransAtraMap(int map_no) {
157 int village = 0;
158 // clang-format off
159 s16 map_to_village[35] = {
160 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 4, 3, 4, 5, 5,
161 5, 3, 1, 4, 4, 4, 4, 1, 3, 2, 3, 4, 5, 2, 5,
162 4, 3, 2, 2, 2,
163 };
164 // clang-format on
165
166 if (map_no < 5) {
167 village = map_no;
168 } else if (map_no >= 0xB && map_no < 0x29) {
169 village = map_to_village[map_no - 0xB];
170 } else if (map_no >= 0xC8) {
171 village = map_no - 0xC8;
172 }
173
174 if (GetAtoraMaxVillage() - 3 < village) {
175 village = GetAtoraMaxVillage() - 3;
176 }
177
178 return village;
179}
180
181void MenuWorldTrans(CCamera *camera) {
182 sceVu0FMATRIX camera_matrix;
183 sceVu0FVECTOR eye_pos;
184 sceVu0FMATRIX view_matrix;
185 sceVu0FMATRIX unit_matrix;
186
187 MGSetProjection(800.0f);
188 camera->GetCameraMatrix(camera_matrix);
189 camera->Step(1);
190 camera->GetPos(eye_pos);
191 sceVu0UnitMatrix(unit_matrix);
192 sceVu0MulMatrix(view_matrix, unit_matrix, camera_matrix);
193 MGSetViewMatrix(view_matrix, eye_pos);
194}
195
196void MenuPolygonDraw(int ambient_alpha, void (*draw)()) {
197 float ref_pos[4] = {0.0f, 0.0f, -45.0f, 1.0f};
198 float eye_pos[4] = {0.0f, 0.0f, 60.0f, 1.0f};
199
200 MenuCamera.SetRef(ref_pos);
201 MenuCamera.SetPos(eye_pos);
202
203 float light_dir[4][4] = {
204 {0.3f, 0.0f, 0.0f, 0.0f},
205 {0.3f, 0.0f, 0.0f, 0.0f},
206 {0.3f, 0.0f, 0.0f, 0.0f},
207 {0.0f, 0.0f, 0.0f, 0.0f},
208 };
209 float light_colour[4][4] = {
210 {96.0f, 96.0f, 96.0f, 0.0f},
211 {0.0f, 0.0f, 0.0f, 0.0f},
212 {0.0f, 0.0f, 0.0f, 0.0f},
213 {0.0f, 0.0f, 0.0f, 0.0f},
214 };
215 float saved_ambient[4];
216 float ambient[4];
217 float saved_light_dir[4][4];
218 float saved_light_colour[4][4];
219
220 MGGetPLight(saved_light_dir, saved_light_colour);
221 MGGetAmbient(saved_ambient);
222 ambient[0] = ambient[1] = ambient[2] = 80.0f;
223 ambient[3] = (float) ambient_alpha;
224
225 float light_vector[4] = {0.3f, 1.0f, 0.3f, 0.0f};
226 float light_normal[4];
227
228 sceVu0Normalize(light_normal, light_vector);
229 light_dir[0][0] = light_normal[0];
230 light_dir[1][0] = light_normal[1];
231 light_dir[2][0] = light_normal[2];
232 MGSetPLight(light_dir, light_colour);
233 MGSetAmbient(ambient);
234 draw();
235 MGSetPLight(saved_light_dir, saved_light_colour);
236 MGSetAmbient(saved_ambient);
237}
238
239void Get3DPosTo2DPos(CFrame *frame, int *screen) {
240 float world[4];
241 float origin[4] = {0.0f, 0.0f, 0.0f, 1.0f};
242 int screen_pos[4];
243
244 frame->GetWorldPosition(world, origin);
245 MGRotTransPers2D(screen_pos, world, 0);
246 screen[0] = screen_pos[0];
247 screen[1] = screen_pos[1];
248}
249
250int GetMenuCommonFontW(int language, int style) {
251 s8 font_widths[7] = {16, 11, 11, 11, 11, 11, 11};
252 return font_widths[language];
253}
254
255int GetMenuCommonPutXY(ClsMes *mes, int x) {
256 int size[4];
257
258 if (mes == NULL) {
259 return 0;
260 }
261
262 int put_x = x;
263 mes->NeedMesWinWH(mes->mes_made, size);
264 put_x -= size[2] >> 1;
265 mes->text_x = put_x;
266 PORT_RETURN(put_x);
267}
268
272static inline void ResetMenuMes(ClsMes *mes) {
273 mes->text_columns = MES_WIN_COLUMNS;
274 mes->text_rows = 10;
275 mes->text_len = 0;
276 mes->text_width = 0;
277 mes->text_height = 0;
278 mes->fade = 0.0f;
279 mes->fade_in = true;
280 mes->text_rate = mes->text_rate_set;
281 mes->waiting = false;
282 mes->text_at = 0.0f;
283 mes->text_no = 0;
284 mes->text_from = 0;
285 mes->page_from = 0;
286 mes->InitMesWinTbl();
287 mes->clut_now = mes->clut_default;
288 mes->wait = 0;
289 mes->blink = 0;
290 mes->auto_page_wait = 0;
291 mes->mes_made = -1;
292 mes->edge_alpha = 0x80;
293
294 for (int i = 0; i < 10; i++) {
295 mes->mes_no[i] = -1;
296 }
297
298 for (int i = 0; i < 8; i++) {
299 mes->values[i] = 0;
300 }
301
302 mes->value = 0;
303 mes->value_signed = false;
304 mes->value_show = true;
305 mes->value_narrow = false;
306 mes->space_width = -1;
307 mes->space_area = -1;
308 mes->cursor_row = -1;
309 mes->cursor_y = 0;
310 mes->cursor_lit = false;
311
312 for (int i = 0; i < 10; i++) {
313 mes->line_pos[i].x = -1;
314 mes->line_pos[i].y = -1;
315 }
316}
317
318void InitMenuMesSet(int mode, short *messages) {
319 CommonMenuMes1.tex_buff = MesWinTexBuff_01;
320 CommonMenuMes2.tex_buff = MesWinTexBuff_02;
321 CommonMenuMes3.tex_buff = MesWinTexBuff_11;
322 AtoraNameMes.tex_buff = MesWinTexBuff_12;
323 ResetMenuMes(&CommonMenuMes1);
324 ResetMenuMes(&CommonMenuMes2);
325 ResetMenuMes(&CommonMenuMes3);
326 ResetMenuMes(&AtoraNameMes);
327 CommonMenuMes1.tex_block = 0x1A;
328 CommonMenuMes2.tex_block = 0x1A;
329 CommonMenuMes3.tex_block = 0x1A;
330 AtoraNameMes.tex_block = 0x1A;
331 CommonMenuMes1.SetBuff(messages);
332 CommonMenuMes2.SetBuff(messages);
333 CommonMenuMes3.SetBuff(messages);
334 AtoraNameMes.SetBuff(messages);
335 CommonMenuMes1.SetBuff_system(SystemMes);
336 CommonMenuMes2.SetBuff_system(SystemMes);
337 CommonMenuMes3.SetBuff_system(SystemMes);
338 AtoraNameMes.SetBuff_system(SystemMes);
339 CommonMenuMes1.mes_made = -1;
340 CommonMenuMes2.mes_made = -1;
341 CommonMenuMes3.mes_made = -1;
342 AtoraNameMes.mes_made = -1;
343
344 switch (GetMenuLangFlag()) {
345 case LANG_JAPANESE:
346 CommonMenuMes1.columns = 15;
347 CommonMenuMes1.rows = 3;
348 CommonMenuMes1.char_width = 0x10;
349 CommonMenuMes1.char_height = 0x16;
350 CommonMenuMes2.columns = 15;
351 CommonMenuMes2.rows = 3;
352 CommonMenuMes2.char_width = 0x10;
353 CommonMenuMes2.char_height = 0x16;
354 CommonMenuMes3.columns = 0x1D;
355 CommonMenuMes3.rows = 4;
356 CommonMenuMes3.char_width = 0x10;
357 CommonMenuMes3.char_height = 0x16;
358 AtoraNameMes.char_width = 0x10;
359 AtoraNameMes.char_height = 0x16;
360 break;
361 default:
362 case LANG_ENGLISH_US:
363 CommonMenuMes1.rows = 3;
364 CommonMenuMes1.char_width = 11;
365 CommonMenuMes1.char_height = 0x14;
366 CommonMenuMes1.narrow_gaiji_set = 2;
367 CommonMenuMes2.rows = 4;
368 CommonMenuMes2.char_width = 11;
369 CommonMenuMes2.char_height = 0x14;
370 CommonMenuMes2.narrow_gaiji_set = 2;
371 CommonMenuMes3.columns = 0x1D;
372 CommonMenuMes3.rows = 4;
373 CommonMenuMes3.char_width = 11;
374 CommonMenuMes3.char_height = 0x14;
375 CommonMenuMes3.narrow_gaiji_set = 2;
376 AtoraNameMes.char_width = 11;
377 AtoraNameMes.narrow_gaiji_set = 2;
378 break;
379 }
380
381 CommonMenuMes1.stay_frame = false;
382 CommonMenuMes2.stay_frame = false;
383 CommonMenuMes3.stay_frame = false;
384 AtoraNameMes.stay_frame = false;
385 CommonMenuMes1.auto_pos = MES_POS_NONE;
386 CommonMenuMes2.auto_pos = MES_POS_NONE;
387 CommonMenuMes3.auto_pos = MES_POS_NONE;
388 AtoraNameMes.auto_pos = MES_POS_NONE;
389 CommonMenuMes1.style = MES_EDGE_NONE;
390 CommonMenuMes2.style = MES_EDGE_NONE;
391 CommonMenuMes3.style = MES_EDGE_NONE;
392 AtoraNameMes.style = MES_EDGE_NONE;
393
394 switch (mode) {
395 case MENU_MES_SET_ALLMENU:
396 CommonMenuMes1.Preset(MES_PRESET_SYSTEM);
397 CommonMenuMes2.Preset(MES_PRESET_SYSTEM);
398 CommonMenuMes3.Preset(MES_PRESET_NAME);
399 AtoraNameMes.Preset(MES_PRESET_NAME);
400 CommonMenuMes1.value_show = false;
401 CommonMenuMes2.value_show = false;
402 CommonMenuMes3.value_show = false;
403 AtoraNameMes.value_show = true;
404 return;
405 case MENU_MES_SET_EVENT_ITEM:
406 CommonMenuMes2.Preset(MES_PRESET_SYSTEM);
407 CommonMenuMes2.centre_rows = true;
408 CommonMenuMes2.columns = 0x19;
409 CommonMenuMes2.rows = 4;
410 CommonMenuMes1.Preset(MES_PRESET_SYSTEM);
411 CommonMenuMes1.centre_rows = true;
412 return;
413 case MENU_MES_SET_SHOP:
414 CommonMenuMes1.Preset(MES_PRESET_SYSTEM);
415 CommonMenuMes2.Preset(MES_PRESET_SYSTEM);
416 CommonMenuMes3.Preset(MES_PRESET_FUKIDASHI);
417 AtoraNameMes.Preset(MES_PRESET_SYSTEM);
418 CommonMenuMes1.columns = 15;
419 CommonMenuMes1.rows = 3;
420 CommonMenuMes2.stay_frame = false;
421 CommonMenuMes2.value_signed = true;
422 CommonMenuMes2.value_show = false;
423 CommonMenuMes3.columns = 0x1E;
424 CommonMenuMes3.rows = 3;
425 CommonMenuMes3.page_arrow = true;
426 CommonMenuMes3.fade_speed = 0.1f;
427 AtoraNameMes.stay_frame = true;
428 AtoraNameMes.rows = 1;
429
430 switch (GetMenuLangFlag()) {
431 case LANG_JAPANESE:
432 CommonMenuMes3.char_width = 0x10;
433 CommonMenuMes3.char_height = 0x16;
434 return;
435 default:
436 case LANG_ENGLISH_US:
437 CommonMenuMes3.narrow_gaiji_set = 0;
438 CommonMenuMes3.char_width = 12;
439 CommonMenuMes3.char_height = 0x14;
440 return;
441 }
442 case MENU_MES_SET_NAME_ENTRY:
443 CommonMenuMes2.Preset(MES_PRESET_SYSTEM);
444 CommonMenuMes3.Preset(MES_PRESET_SYSTEM);
445 AtoraNameMes.Preset(MES_PRESET_SYSTEM);
446 CommonMenuMes2.style = MES_EDGE_DOUBLE;
447 CommonMenuMes3.style = MES_EDGE_DOUBLE;
448 AtoraNameMes.style = MES_EDGE_DOUBLE;
449 CommonMenuMes2.rows = 3;
450 CommonMenuMes3.rows = 2;
451 AtoraNameMes.rows = 1;
452 return;
453 case MENU_MES_SET_ATLA_NAME:
454 AtoraNameMes.Preset(MES_PRESET_NAME);
455 AtoraNameMes.rows = 1;
456 return;
457 case MENU_MES_SET_WORLD_MAP:
458 CommonMenuMes2.Preset(MES_PRESET_SYSTEM);
459 CommonMenuMes3.Preset(MES_PRESET_NAME);
460 CommonMenuMes3.rows = 1;
461 return;
462 case MENU_MES_SET_DUNGEON_ENTER:
463 CommonMenuMes2.Preset(MES_PRESET_SYSTEM);
464 CommonMenuMes2.char_width = 12;
465 CommonMenuMes2.rows = 2;
466 CommonMenuMes2.columns = 15;
467 default:
468 return;
469 }
470}
471
472void DrawMenuClsMes(ClsMes *message, int x, int y) {
473 if (message != NULL) {
474 message->text_x = x;
475 message->text_y = y;
476 message->Step();
477 message->DrawMesWin();
478 }
479}
480
481void ComMenuSePlay(int sound) {
482 if (sound >= 0) {
483 SndSePlay(sound, -1, 0);
484 }
485}
486
487void DrawMenu2DSprite(CTexture *texture, CRect_i_ screen, CRect_i_ texel, int alpha) {
488 set2DSprite(GetVif1Packet(), texture, screen, texel, alpha);
489}
490
491void DrawMenu2DSprite(CTexture *texture, CRect_i_ screen, CRect_i_ texel, unsigned char r, unsigned char g, unsigned char b, int alpha) {
492 set2DSprite(GetVif1Packet(), texture, screen, texel, r, g, b, alpha);
493}
494
495void DrawMenu2DSprite(CTexture *texture, CRect_i_ screen, CRect_i_ texel, spRGBA *top_left, spRGBA *top_right, spRGBA *bottom_left, spRGBA *bottom_right) {
496 set2DSprite(GetVif1Packet(), texture, screen, texel, top_left, top_right, bottom_left, bottom_right, 1);
497}
498
499void MenuTextureReload(int block) {
500 TexManager.ReloadTexture(GetVif1Packet(), block);
501}
502
503void MenuTextureDelete(int *blocks) {
504 for (int i = 0; blocks[i] != -1; i++) {
505 TexManager.DeleteTextureBlock(blocks[i]);
506 printf("delete block: %d\n", blocks[i]);
507 }
508}
509
510void AllFillBoxForMenu(unsigned char r, unsigned char g, unsigned char b, unsigned char alpha) {
511 if (r < 0 || r > 0xFF) {
512 r = 0x80;
513 }
514
515 if (g < 0 || g > 0xFF) {
516 g = 0x80;
517 }
518
519 if (b < 0 || b > 0xFF) {
520 b = 0x80;
521 }
522
523 if (alpha < 0 || alpha > 0xFF) {
524 alpha = 0x80;
525 }
526
527 MGFillBox(CRect_i_(0, 0, 0x2800, (SCREEN_HEIGHT << 4)), r, g, b, alpha);
528}
529
530void AllFadeForMenu(int alpha) {
531 AllFillBoxForMenu(0, 0, 0, (unsigned char) alpha);
532}
533
534void FrameImageDraw(int brightness, int alpha) {
535 sceGsTexa texa;
536 CTexture *texture = TexManager.GetTexture("frame_image", -1);
537
538 if (texture != NULL) {
539 TexManager.ReloadTexture(GetVif1Packet(), texture->block);
540 ((sceGsTex0 *) &texture->tex0)->bits.tcc = 0;
541 texa = mgTexa;
542 texa.AEM = 1;
543 texa.TA0 = 0x80;
544 MGSetGsTEXA(&texa);
545#ifdef PAL
546 DrawMenu2DSprite(texture, MenuDispRc, MenuDispRc, brightness, brightness, brightness, alpha);
547#else
548 set2DSprite(GetVif1Packet(), texture, MenuDispRc, MenuDispRc, brightness, brightness, brightness, alpha);
549#endif
550 MGSetGsTEXA(NULL);
551 }
552}
553
554void DrawMenuColorGradation(CRect_i_ &rect, spRGBA *top_left, spRGBA *top_right, spRGBA *bottom_left, spRGBA *bottom_right) {
555 set2DSpriteC4(GetVif1Packet(), rect, top_left, top_right, bottom_left, bottom_right);
556}
557
558void DrawMenuSideGradation(CRect_i_ &rect, spRGBA *left, spRGBA *right) {
559 set2DSpriteC4(GetVif1Packet(), rect, left, right, left, right);
560}
561
569static void DrawDontSetItemMark(int x, int y, int top, int bottom, int alpha) {
570 int position;
571 int length;
572 int source;
573
574 if (y < top - 31 || y > bottom - 1) {
575 return;
576 }
577
578 position = y;
579 length = 32;
580 source = 0xC0;
581 MenuTextureClip(position, source, length, top, bottom);
582 DrawMenu2DSprite(PerBoardTex, CRect_i_(x, position, 32, length), CRect_i_(0x13C, source, 32, length), alpha);
583}
584
585void DrawIconParts(int item_no, int x, int y, int top, int bottom, int alpha, int number) {
586 int position;
587 int u;
588 int v;
589 int length;
590 COM_ITEM_INFO *info;
591 CTexture *texture;
592
593 if (y < top - 31 || y > bottom - 1) {
594 return;
595 }
596
597 position = y;
598 info = GetCommonItemInfo(item_no);
599
600 if (info != NULL && info->icon_index >= 0) {
601 texture = RetCTex(item_no, u, v);
602
603 if (texture != NULL) {
604 length = 32;
605 MenuTextureClip(position, v, length, top, bottom);
606 CRect_i_ source(u, v, 32, length);
607 set2DSprite(GetVif1Packet(), texture, CRect_i_(x + 2, position + 1, 32, length), source, 0, 0, 0, alpha * 0x50 >> 7);
608 DrawMenu2DSprite(texture, CRect_i_(x, position, 32, length), source, alpha);
609 DrawAttachNumberOrWeapon(x, y, top, bottom, item_no, number, alpha, 0);
610 }
611 }
612}
613
614void DrawAttachNumberOrWeapon(int x, int y, int top, int bottom, int item_no, int value, int alpha, int vibe) {
615 int draw_y;
616 int u;
617 int v;
618 int height;
619
620 TexManager.GetTexture("wepicon", -1);
621
622 if (0 < value && item_no >= ITEM_ATTACH_STAT_START && item_no < ITEM_ATTACH_GEM_START) {
623 int number_x = x + 12;
624 draw_y = y + 10;
625 u = (value - 1) * 0x12 + 0x84;
626 v = 0xB0;
627 height = 0x14;
628 MenuTextureClip(draw_y, v, height, top, bottom - 2);
629
630 if (draw_y < bottom) {
631 CRect_i_ source(u, v, 0x12, height);
632
633 if (vibe != 0) {
634 DrawObjectVibe(number_x, draw_y, StayTex, source, 0x80, 0x80);
635 } else {
636 DrawMenu2DSprite(StayTex, CRect_i_(number_x, draw_y, 0x12, height), source, alpha);
637 }
638 }
639 }
640
641 if (item_no == ITEM_ATTACH_SYNTHESIS_SPHERE) {
642 CTexture *texture = RetCTex((s16) value, u, v);
643
644 if (texture != NULL) {
645 height = 0x20;
646 draw_y = y;
647 MenuTextureClip(draw_y, v, height, top, bottom);
648 CRect_i_ source(u, v, 0x20, height);
649
650 if (vibe != 0) {
651 DrawObjectVibe(x, draw_y, texture, source, 0x80, 0x80);
652 return;
653 }
654
655 DrawMenu2DSprite(texture, CRect_i_(x, draw_y, 0x20, height), source, (alpha * 0x80) >> 7);
656 }
657 }
658}
659
660void FadeTexX(int left_x, int left_width, int right_x, int right_width, char *name, int dim) {
661 CTexture texture = *TexManager.GetTexture(name, -1);
662 spRGBA left;
663 spRGBA right;
664
665 // Retail tests the local copy's address, which is never null, so a missing texture is not caught here.
666 if (&texture == NULL) {
667 return;
668 }
669
670 ((sceGsTex0 *) &texture.tex0)->bits.tcc = 0;
671 sceGsTexa texa = mgTexa;
672 texa.AEM = 1;
673 texa.TA0 = 0x80;
674 MGSetGsTEXA(&texa);
675 right.r = right.g = right.b = 0x40;
676 left.r = left.g = left.b = 0x40;
677
678 if (left_width != 0) {
679 right.a = 0x80;
680 left.a = 0x80;
681 set2DSprite(GetVif1Packet(), &texture, CRect_i_(0, 0, left_x, SCREEN_HEIGHT), CRect_i_(0, 0, left_x, (SCREEN_HEIGHT - 1)), &left, &right, &left, &right, 1);
682 }
683
684 left.a = 0x80;
685 right.a = 0;
686
687 if (dim == 1) {
688 right.a = 0x40;
689 }
690
691 set2DSprite(GetVif1Packet(), &texture, CRect_i_(left_x, 0, left_width, SCREEN_HEIGHT), CRect_i_(left_x, 0, left_width, (SCREEN_HEIGHT - 1)), &left, &right, &left, &right, 1);
692 left.a = 0;
693 right.a = 0x80;
694
695 if (dim == 1) {
696 left.a = 0x40;
697 }
698
699 set2DSprite(GetVif1Packet(), &texture, CRect_i_(right_x, 0, right_width, SCREEN_HEIGHT), CRect_i_(right_x, 0, right_width, (SCREEN_HEIGHT - 1)), &left, &right, &left, &right, 1);
700
701 if (right_width != 0) {
702 right.a = 0x80;
703 left.a = 0x80;
704 set2DSprite(GetVif1Packet(), &texture, CRect_i_(right_x + right_width, 0, 0x280 - right_x - right_width, SCREEN_HEIGHT), CRect_i_(right_x + right_width, 0, 0x280 - right_x - right_width, (SCREEN_HEIGHT - 1)), &left, &right, &left, &right, 1);
705 }
706
707 MGSetGsTEXA(NULL);
708}
709
710CTexture *RetCTex(short item_no, int &u, int &v) {
711 CTexture *texture;
712 COM_ITEM_INFO *info = GetCommonItemInfo(item_no);
713
714 if (info == NULL) {
715 return NULL;
716 }
717
718 int icon = info->icon_index;
719
720 if (icon < 0) {
721 return NULL;
722 }
723
724 u = ((icon + 8) % 8) << 5;
725 v = (icon >> 3) << 5;
726
727 switch (info->kind) {
728 case ITEMKIND_ITEM:
729 texture = ItemIcon;
730 break;
731 case ITEMKIND_ATTACH:
732 case ITEMKIND_WEAPON:
733 texture = WepIcon;
734 break;
735 }
736
737 return texture;
738}
739
740void MenuTextureClip(int &position, int &source, int &length, int minimum, int maximum) {
741 if (position < minimum && position + length > minimum) {
742 length = position + length - minimum;
743 source += minimum - position;
744 position = minimum;
745 }
746
747 if (position < maximum && position + length > maximum) {
748 length = maximum - position;
749 }
750}
751
752int GetNumberKeta(int value) {
753 int digits = 1;
754
755 while (value >= 10) {
756 value /= 10;
757 digits++;
758 }
759
760 return digits;
761}
762
763#ifdef PAL
764MENU_ICON_INFO MenuIcon[7][14] = {
765 {
766 {0, 0, 0x246, 0, 0x250, 0x28, 0x1E0, 0x48, 0x5E, 0x1E, 0xB},
767 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E0, 0x66, 0x3A, 0x1E, 0xC},
768 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x1E0, 0x84, 0x32, 0x1E, 0xD},
769 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1E0, 0xA2, 0xA0, 0x1E, 0xE},
770 {4, 0, 0x124, 0, 0x160, 0x28, 0x140, 0xC0, 0x72, 0x1E, 0x10},
771 {5, 0, 0x15E, 0, 0x190, 0x28, 0x140, 0xA2, 0x4E, 0x1E, 0x18},
772 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x212, 0x84, 0x6E, 0x1E, 0x1A},
773 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0xA0, 0x1E, 0xF},
774 {8, 0, 0x40, 0, 0xA0, 0x28, 0xA0, 0x48, 0xA0, 0x1E, 0x11},
775 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0xA0, 0x66, 0xA0, 0x1E, 0x12},
776 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0x66, 0x72, 0x1E, 0x16},
777 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0x140, 0x84, 0x8C, 0x1E, 0x17},
778 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x220, 0x66, 0x60, 0x1E, 0x13},
779 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0x140, 0x48, 0x9E, 0x1E, 0x15},
780 },
781 {
782 {0, 0, 0x246, 0, 0x250, 0x28, 0x1E0, 0x48, 0x30, 0x1E, 0xB},
783 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E0, 0x66, 0x4E, 0x1E, 0xC},
784 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x22E, 0x66, 0x4B, 0x1E, 0xD},
785 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1E0, 0xA2, 0x90, 0x1E, 0xE},
786 {4, 0, 0x124, 0, 0x160, 0x28, 0x170, 0x66, 0x4B, 0x1E, 0x10},
787 {5, 0, 0x15E, 0, 0x190, 0x28, 0x170, 0x48, 0x35, 0x1E, 0x18},
788 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1F1, 0x84, 0x5C, 0x1E, 0x1A},
789 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0x98, 0x1E, 0xF},
790 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xAA, 0x1E, 0x11},
791 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x8E, 0x1E, 0x12},
792 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0x89, 0x1E, 0x16},
793 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB4, 0x1E, 0x17},
794 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x210, 0x48, 0x70, 0x1E, 0x13},
795 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0xAD, 0x1E, 0x15},
796 },
797 {
798 {0, 0, 0x246, 0, 0x250, 0x28, 0x1E0, 0x48, 0x30, 0x1E, 0xB},
799 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E0, 0x66, 0x4E, 0x1E, 0xC},
800 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x22E, 0x66, 0x4B, 0x1E, 0xD},
801 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1E0, 0xA2, 0x90, 0x1E, 0xE},
802 {4, 0, 0x124, 0, 0x160, 0x28, 0x170, 0x66, 0x4B, 0x1E, 0x10},
803 {5, 0, 0x15E, 0, 0x190, 0x28, 0x170, 0x48, 0x35, 0x1E, 0x18},
804 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1F1, 0x84, 0x5C, 0x1E, 0x1A},
805 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0x98, 0x1E, 0xF},
806 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xAA, 0x1E, 0x11},
807 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x8E, 0x1E, 0x12},
808 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0x89, 0x1E, 0x16},
809 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB4, 0x1E, 0x17},
810 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x210, 0x48, 0x70, 0x1E, 0x13},
811 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0xAD, 0x1E, 0x15},
812 },
813 {
814 {0, 0, 0x246, 0, 0x250, 0x28, 0x1D0, 0x48, 0x3C, 0x1E, 0xB},
815 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E8, 0x66, 0x4A, 0x1E, 0xC},
816 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x232, 0x66, 0x4E, 0x1E, 0xD},
817 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1EA, 0xA2, 0x96, 0x1E, 0xE},
818 {4, 0, 0x124, 0, 0x160, 0x28, 0x170, 0x66, 0x4B, 0x1E, 0x10},
819 {5, 0, 0x15E, 0, 0x190, 0x28, 0x168, 0x48, 0x50, 0x1E, 0x18},
820 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x224, 0x84, 0x5C, 0x1E, 0x1A},
821 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1EE, 0xC0, 0x92, 0x1E, 0xF},
822 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xCC, 0x1E, 0x11},
823 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x94, 0x1E, 0x12},
824 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0xA6, 0x1E, 0x16},
825 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0x8E, 0x1E, 0x17},
826 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x236, 0x48, 0x4A, 0x1E, 0x13},
827 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0x82, 0x1E, 0x15},
828 },
829 {
830 {0, 0, 0x246, 0, 0x250, 0x28, 0x1AE, 0x66, 0x6E, 0x1E, 0xB},
831 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1B8, 0x4A, 0x46, 0x1E, 0xC},
832 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x21C, 0x66, 0x62, 0x1E, 0xD},
833 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1F0, 0xA2, 0x8C, 0x1E, 0xE},
834 {4, 0, 0x124, 0, 0x160, 0x28, 0x15E, 0x66, 0x50, 0x1E, 0x10},
835 {5, 0, 0x15E, 0, 0x190, 0x28, 0x15E, 0x48, 0x5C, 0x1E, 0x18},
836 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1F1, 0x84, 0x74, 0x1E, 0x1A},
837 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1EE, 0xC0, 0x90, 0x1E, 0xF},
838 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0x82, 0x1E, 0x11},
839 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x8E, 0x1E, 0x12},
840 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0x9E, 0x1E, 0x16},
841 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB4, 0x1E, 0x17},
842 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x1FE, 0x48, 0x82, 0x1E, 0x13},
843 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0xAD, 0x1E, 0x15},
844 },
845 {
846 {0, 0, 0x246, 0, 0x250, 0x28, 0x1CA, 0x48, 0x42, 0x1E, 0xB},
847 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1EA, 0x66, 0x3E, 0x1E, 0xC},
848 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x22E, 0x66, 0x52, 0x1E, 0xD},
849 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1DC, 0xA2, 0xA4, 0x1E, 0xE},
850 {4, 0, 0x124, 0, 0x160, 0x28, 0x16C, 0x66, 0x5A, 0x1E, 0x10},
851 {5, 0, 0x15E, 0, 0x190, 0x28, 0x162, 0x48, 0x56, 0x1E, 0x18},
852 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1F4, 0x84, 0x64, 0x1E, 0x1A},
853 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0xA2, 0x1E, 0xF},
854 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xAA, 0x1E, 0x11},
855 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x92, 0x1E, 0x12},
856 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0x98, 0x1E, 0x16},
857 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB6, 0x1E, 0x17},
858 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x212, 0x48, 0x6E, 0x1E, 0x13},
859 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0xBC, 0x1E, 0x15},
860 },
861 {
862 {0, 0, 0x246, 0, 0x250, 0x28, 0x1D2, 0x48, 0x4C, 0x1E, 0xB},
863 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E4, 0x66, 0x3E, 0x1E, 0xC},
864 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x224, 0x66, 0x5A, 0x1E, 0xD},
865 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1DA, 0xA2, 0x9E, 0x1E, 0xE},
866 {4, 0, 0x124, 0, 0x160, 0x28, 0x16C, 0x66, 0x4E, 0x1E, 0x10},
867 {5, 0, 0x15E, 0, 0x190, 0x28, 0x168, 0x48, 0x5E, 0x1E, 0x18},
868 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1EE, 0x84, 0x6A, 0x1E, 0x1A},
869 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1D2, 0xC0, 0xAE, 0x1E, 0xF},
870 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xAA, 0x1E, 0x11},
871 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x14A, 0xA2, 0x80, 0x1E, 0x12},
872 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x14E, 0xC0, 0x74, 0x1E, 0x16},
873 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB0, 0x1E, 0x17},
874 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x228, 0x48, 0x40, 0x1E, 0x13},
875 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA4, 0x48, 0xB0, 0x1E, 0x15},
876 },
877};
878#else
879MENU_ICON_INFO MenuIcon[7][14] = {
880 {
881 {0, 0, 0x246, 0, 0x250, 0x28, 0x1E0, 0x48, 0x5E, 0x1E, 0xB},
882 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E0, 0x66, 0x3A, 0x1E, 0xC},
883 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x1E0, 0x84, 0x32, 0x1E, 0xD},
884 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1E0, 0xA2, 0xA0, 0x1E, 0xE},
885 {4, 0, 0x124, 0, 0x160, 0x28, 0x140, 0xC0, 0x72, 0x1E, 0x10},
886 {5, 0, 0x15E, 0, 0x190, 0x28, 0x140, 0xA2, 0x4E, 0x1E, 0x18},
887 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x212, 0x84, 0x6E, 0x1E, 0x1A},
888 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0xA0, 0x1E, 0xF},
889 {8, 0, 0x40, 0, 0xA0, 0x28, 0xA0, 0x48, 0xA0, 0x1E, 0x11},
890 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0xA0, 0x66, 0xA0, 0x1E, 0x12},
891 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0x66, 0x72, 0x1E, 0x16},
892 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0x140, 0x84, 0x8C, 0x1E, 0x17},
893 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x220, 0x66, 0x60, 0x1E, 0x13},
894 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0x140, 0x48, 0x9E, 0x1E, 0x15},
895 },
896 {
897 {0, 0, 0x246, 0, 0x250, 0x28, 0x1E0, 0x48, 0x30, 0x1E, 0xB},
898 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E0, 0x66, 0x4E, 0x1E, 0xC},
899 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x22E, 0x66, 0x4B, 0x1E, 0xD},
900 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1E0, 0xA2, 0x8E, 0x1E, 0xE},
901 {4, 0, 0x124, 0, 0x160, 0x28, 0x170, 0x66, 0x4B, 0x1E, 0x10},
902 {5, 0, 0x15E, 0, 0x190, 0x28, 0x170, 0x48, 0x35, 0x1E, 0x18},
903 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1F1, 0x84, 0x5C, 0x1E, 0x1A},
904 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0x98, 0x1E, 0xF},
905 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xAA, 0x1E, 0x11},
906 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x8E, 0x1E, 0x12},
907 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0x89, 0x1E, 0x16},
908 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB4, 0x1E, 0x17},
909 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x210, 0x48, 0x70, 0x1E, 0x13},
910 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0xAD, 0x1E, 0x15},
911 },
912 {
913 {0, 0, 0x246, 0, 0x250, 0x28, 0x1E0, 0x48, 0x30, 0x1E, 0xB},
914 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E0, 0x66, 0x4E, 0x1E, 0xC},
915 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x22E, 0x66, 0x4B, 0x1E, 0xD},
916 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1E0, 0xA2, 0x85, 0x1E, 0xE},
917 {4, 0, 0x124, 0, 0x160, 0x28, 0x170, 0x66, 0x4B, 0x1E, 0x10},
918 {5, 0, 0x15E, 0, 0x190, 0x28, 0x170, 0x48, 0x35, 0x1E, 0x18},
919 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1F1, 0x84, 0x5C, 0x1E, 0x1A},
920 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0x98, 0x1E, 0xF},
921 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xAA, 0x1E, 0x11},
922 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x8E, 0x1E, 0x12},
923 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0x89, 0x1E, 0x16},
924 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB4, 0x1E, 0x17},
925 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x210, 0x48, 0x70, 0x1E, 0x13},
926 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0xAD, 0x1E, 0x15},
927 },
928 {
929 {0, 0, 0x246, 0, 0x250, 0x28, 0x1E0, 0x48, 0x30, 0x1E, 0xB},
930 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E0, 0x66, 0x4E, 0x1E, 0xC},
931 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x22E, 0x66, 0x4B, 0x1E, 0xD},
932 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1E0, 0xA2, 0x85, 0x1E, 0xE},
933 {4, 0, 0x124, 0, 0x160, 0x28, 0x170, 0x66, 0x4B, 0x1E, 0x10},
934 {5, 0, 0x15E, 0, 0x190, 0x28, 0x170, 0x48, 0x35, 0x1E, 0x18},
935 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1F1, 0x84, 0x5C, 0x1E, 0x1A},
936 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0x98, 0x1E, 0xF},
937 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xAA, 0x1E, 0x11},
938 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x8E, 0x1E, 0x12},
939 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0x89, 0x1E, 0x16},
940 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB4, 0x1E, 0x17},
941 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x210, 0x48, 0x70, 0x1E, 0x13},
942 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0xAD, 0x1E, 0x15},
943 },
944 {
945 {0, 0, 0x246, 0, 0x250, 0x28, 0x1E0, 0x48, 0x30, 0x1E, 0xB},
946 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E0, 0x66, 0x4E, 0x1E, 0xC},
947 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x22E, 0x66, 0x4B, 0x1E, 0xD},
948 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1E0, 0xA2, 0x85, 0x1E, 0xE},
949 {4, 0, 0x124, 0, 0x160, 0x28, 0x170, 0x66, 0x4B, 0x1E, 0x10},
950 {5, 0, 0x15E, 0, 0x190, 0x28, 0x170, 0x48, 0x35, 0x1E, 0x18},
951 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1F1, 0x84, 0x5C, 0x1E, 0x1A},
952 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0x98, 0x1E, 0xF},
953 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xAA, 0x1E, 0x11},
954 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x8E, 0x1E, 0x12},
955 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0x89, 0x1E, 0x16},
956 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB4, 0x1E, 0x17},
957 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x210, 0x48, 0x70, 0x1E, 0x13},
958 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0xAD, 0x1E, 0x15},
959 },
960 {
961 {0, 0, 0x246, 0, 0x250, 0x28, 0x1E0, 0x48, 0x30, 0x1E, 0xB},
962 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E0, 0x66, 0x4E, 0x1E, 0xC},
963 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x22E, 0x66, 0x4B, 0x1E, 0xD},
964 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1E0, 0xA2, 0x85, 0x1E, 0xE},
965 {4, 0, 0x124, 0, 0x160, 0x28, 0x170, 0x66, 0x4B, 0x1E, 0x10},
966 {5, 0, 0x15E, 0, 0x190, 0x28, 0x170, 0x48, 0x35, 0x1E, 0x18},
967 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1F1, 0x84, 0x5C, 0x1E, 0x1A},
968 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0x98, 0x1E, 0xF},
969 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xAA, 0x1E, 0x11},
970 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x8E, 0x1E, 0x12},
971 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0x89, 0x1E, 0x16},
972 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB4, 0x1E, 0x17},
973 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x210, 0x48, 0x70, 0x1E, 0x13},
974 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0xAD, 0x1E, 0x15},
975 },
976 {
977 {0, 0, 0x246, 0, 0x250, 0x28, 0x1E0, 0x48, 0x30, 0x1E, 0xB},
978 {1, 0, 0x20C, 0, 0x220, 0x28, 0x1E0, 0x66, 0x4E, 0x1E, 0xC},
979 {2, 0, 0x1D2, 0, 0x1F0, 0x28, 0x22E, 0x66, 0x4B, 0x1E, 0xD},
980 {3, 0, 0x198, 0, 0x1C0, 0x28, 0x1E0, 0xA2, 0x85, 0x1E, 0xE},
981 {4, 0, 0x124, 0, 0x160, 0x28, 0x170, 0x66, 0x4B, 0x1E, 0x10},
982 {5, 0, 0x15E, 0, 0x190, 0x28, 0x170, 0x48, 0x35, 0x1E, 0x18},
983 {6, 0, 0xA0, 0x84, 0x1A, 0x48, 0x1F1, 0x84, 0x5C, 0x1E, 0x1A},
984 {7, 0, 0x78, 0, 0xD0, 0x28, 0x1E0, 0xC0, 0x98, 0x1E, 0xF},
985 {8, 0, 0x40, 0, 0xA0, 0x28, 0x140, 0x84, 0xAA, 0x1E, 0x11},
986 {9, 0, 0x108, 0x84, 0xD8, 0x84, 0x140, 0xA2, 0x8E, 0x1E, 0x12},
987 {0xA, 0, 0xEA, 0, 0x130, 0x28, 0x140, 0xC0, 0x89, 0x1E, 0x16},
988 {0xB, 0, 0xB0, 0, 0x100, 0x28, 0xA0, 0x66, 0xB4, 0x1E, 0x17},
989 {0xC, 0, 0x108, 0xAC, 0xD8, 0xA4, 0x210, 0x48, 0x70, 0x1E, 0x13},
990 {0xD, 0, 0x198, 0, 0x1C0, 0x28, 0xA0, 0x48, 0xAD, 0x1E, 0x15},
991 },
992};
993#endif
994
995MENU_ICON_INFO *GetMenuIconInfo(int icon) {
996 return &MenuIcon[GetMenuLangFlag()][icon];
997}
998
999void DrawMainMenuIcon(int x, int y, int icon, int selected, int bright, int alpha) {
1000 if (StayTex == NULL) {
1001 StayTex = TexManager.GetTexture("stayframe", -1);
1002
1003 if (StayTex == NULL) {
1004 return;
1005 }
1006 }
1007
1008 MENU_ICON_INFO *info = GetMenuIconInfo(icon);
1009
1010 if (info == NULL) {
1011 return;
1012 }
1013
1014 int u = info->u;
1015 int v = info->v;
1016 s16 frame_size[2][2] = {
1017 {0x30, 0x20},
1018 {0x3A, 0x28}
1019 };
1020 int width = frame_size[selected][0];
1021 int height = frame_size[selected][1];
1022
1023 if (selected) {
1024 u = info->selected_u;
1025 v = info->selected_v;
1026
1027 if (icon == info->id) {
1028 width = 0x38;
1029 }
1030 }
1031
1032 set2DSprite(GetVif1Packet(), StayTex, CRect_i_(x, y, width, height - 1), CRect_i_(u, v, width, height), bright, bright, bright, alpha);
1033
1034 if (selected) {
1035 x += 0x44;
1036 y += 1;
1037 } else {
1038 x += 0x40;
1039 y -= 1;
1040 }
1041
1042 set2DSprite(GetVif1Packet(), StayTex, CRect_i_(x, y, info->label_width, info->label_height - 1), CRect_i_(info->label_u, info->label_v, info->label_width, info->label_height), bright, bright, bright, alpha);
1043}
1044
1045void DrawMenuVibeItem(int x, int y, int offset_x, int offset_y, int alpha) {
1046 int item_x = x + offset_x;
1047 int item_y = y + offset_y;
1048 s16 item_no = PerBoardPt->held_item.item_no;
1049 CRect_i_ shadow(0x80, 0x28, 0x20, 0x20);
1050 int u;
1051 int v;
1052 CTexture *texture = RetCTex(item_no, u, v);
1053
1054 if (texture != NULL) {
1055 DrawObjectVibe(x + 4, y + 2, TexManager.GetTexture("StayTex", -1), shadow, 0, 0x50);
1056 CRect_i_ source(u, v, 0x20, 0x20);
1057 DrawObjectVibe(item_x + 4, item_y + 2, texture, source, 0, 0x50);
1058 DrawObjectVibe(item_x, item_y, texture, source, 0x80, 0x80);
1059 int number = GetAttachVolumeForMsg(&PerBoardPt->held_attach);
1060
1061 if (item_no == ITEM_ATTACH_SYNTHESIS_SPHERE) {
1062 number = PerBoardPt->held_attach.sphere_weapon_no;
1063 }
1064
1065 DrawAttachNumberOrWeapon(item_x, item_y, 0, 0x280, item_no, number, 0x80, 1);
1066 }
1067}
1068
1069int GetMainMenuRightHelpWinLangOffset(float &x, float &y, float &width, float &height) {
1070 float offsets[7][4] = {
1071 {320.0f, 325.0f, 14.6f, 2.2f},
1072#ifdef PAL
1073 {318.0f, 352.0f, 15.6f, 2.7f},
1074 {318.0f, 352.0f, 15.6f, 2.7f},
1075 {318.0f, 352.0f, 15.6f, 2.7f},
1076 {318.0f, 352.0f, 15.6f, 2.7f},
1077 {318.0f, 352.0f, 15.6f, 2.7f},
1078 {318.0f, 352.0f, 15.6f, 2.7f},
1079#else
1080 {318.0f, 320.0f, 15.6f, 2.7f},
1081 {318.0f, 320.0f, 15.6f, 2.7f},
1082 {318.0f, 320.0f, 15.6f, 2.7f},
1083 {318.0f, 320.0f, 15.6f, 2.7f},
1084 {318.0f, 320.0f, 15.6f, 2.7f},
1085 {318.0f, 320.0f, 15.6f, 2.7f},
1086#endif
1087 };
1088 int lang = GetMenuLangFlag();
1089
1090 x = offsets[lang][0];
1091 y = offsets[lang][1];
1092 width = offsets[lang][2];
1093 height = offsets[lang][3];
1094 return 0;
1095}
1096
1097int GetMainMenuRightHelpMsgLangOffset(int &x, int &y) {
1098 s8 offsets[7][2] = {
1099 {18, 16},
1100 {20, 12},
1101 {20, 12},
1102 {20, 12},
1103#ifdef PAL
1104 {20, 14},
1105#else
1106 {20, 12},
1107#endif
1108 {20, 12},
1109 {20, 12},
1110 };
1111 int lang = GetMenuLangFlag();
1112
1113 x = offsets[lang][0];
1114 y = offsets[lang][1];
1115 return 1;
1116}
1117
1118void InitHaveData(IHAVEITEM *item) {
1119 memset(item, -1, 0x14U);
1120}
1121
1122void InitHaveWep(WEAPON_HAVE *weapon) {
1123 memset(weapon, 0, 0xF8U);
1124 weapon->item_no = -1;
1125}
1126
1127void InitHaveAttach(ATTACH_LIST *attachment) {
1128 memset(attachment, 0, 0x20U);
1129}
1130
1131void MenuDataSwap(s16 *first, s16 *second) {
1132 s16 saved;
1133
1134 if ((first == NULL) || (second == NULL)) {
1135 return;
1136 }
1137
1138 saved = *first;
1139 *first = *second;
1140 *second = saved;
1141}
1142
1143void MenuDataSwap(int *first, int *second) {
1144 int saved;
1145
1146 if ((first == NULL) || (second == NULL)) {
1147 return;
1148 }
1149
1150 saved = *first;
1151 *first = *second;
1152 *second = saved;
1153}
1154
1155void MenuDataSwap(WEAPON_HAVE *first, WEAPON_HAVE *second) {
1156 WEAPON_HAVE saved;
1157
1158 if ((first == NULL) || (second == NULL)) {
1159 return;
1160 }
1161
1162 memcpy(&saved, first, sizeof(WEAPON_HAVE));
1163 memcpy(first, second, sizeof(WEAPON_HAVE));
1164 memcpy(second, &saved, sizeof(WEAPON_HAVE));
1165}
1166
1167void MenuDataSwap(ATTACH_LIST *first, ATTACH_LIST *second) {
1168 ATTACH_LIST saved;
1169
1170 if ((first == NULL) || (second == NULL)) {
1171 return;
1172 }
1173
1174 memcpy(&saved, first, sizeof(ATTACH_LIST));
1175 memcpy(first, second, sizeof(ATTACH_LIST));
1176 memcpy(second, &saved, sizeof(ATTACH_LIST));
1177}
1178
1179void SetMenuTrushMark(ITEM_PACK *items) {
1180 int quick_count = 0;
1181 int i;
1182 int slot;
1183
1184 for (i = 0; i < 3; i++) {
1185 quick_count += items->quick_item_qty[i];
1186 }
1187
1188 for (slot = items->num - 1; slot >= 0; slot--) {
1189 if (items->item[slot] < ITEM_DUNGEON_START && quick_count > 0) {
1190 MenuTrushMark[slot] = 1;
1191 quick_count--;
1192 } else {
1193 MenuTrushMark[slot] = 0;
1194 }
1195 }
1196}
1197
1198void DeleteMenuTrushMark() {
1199 memset(MenuTrushMark, 0, sizeof(MenuTrushMark));
1200}
1201
1202void InitPersonalBoardMode(CUserStatus *status, PERSONAL_BOARD *board, int mode, int page) {
1203 PerBoardStatusPt = status;
1204 PerBoardPt = board;
1205
1206 if (PerBoardTex == NULL) {
1207 PerBoardTex = TexManager.GetTexture("perbrd", -1);
1208 }
1209
1210 PerBoardPt->menu_kind = mode;
1211 PerBoardPt->page = page;
1212 PerBoardPt->cursor = 0;
1213 PerBoardPt->top_row = 0;
1214 PerBoardPt->item_pack = &PerBoardStatusPt->item_pack;
1215 PerBoardPt->consumables = PerBoardStatusPt->consumable_items;
1216 int rows = PersonalRetMax(PerBoardPt->page) / 5;
1217
1218 if (rows <= 0) {
1219 rows = 1;
1220 }
1221
1222 PerBoardPt->y = 0x7F - PerBoardPt->top_row * 0x28;
1223 PerBoardPt->scroll = 140.0f + 114.0f * PerBoardPt->top_row / rows;
1224 PerBoardPt->cursor_area = PERSONAL_BOARD_AREA_CELLS;
1225 InitHaveData(&PerBoardPt->held_item);
1226 InitHaveWep(&PerBoardPt->weapon);
1227 PerBoardPt->held_equipped_slot = -1;
1228 PerBoardPt->trash_anim = 0;
1229 PerBoardPt->trash_frame = 0;
1230 DeleteMenuTrushMark();
1231 s16 full = BOARD_PAGE_NONE;
1232
1233 if (PerBoardStatusPt->overflow_flag != 0) {
1234 ITEM_PACK *pack = PerBoardPt->item_pack;
1235
1236 if (pack->item[pack->num] >= ITEM_DUNGEON_START) {
1237 full = BOARD_PAGE_ITEM;
1238 }
1239
1240 if (PerBoardPt->consumables[41].id >= ITEM_ATTACH_START) {
1241 full = BOARD_PAGE_ATTACH;
1242 }
1243
1244 for (int i = 0; i < 6; i++) {
1245 if (((CUserStatus *) PerBoardStatusPt)->chara_weapons[i][10].item_no >= ITEM_WEAPON_START) {
1246 full = BOARD_PAGE_WEAPON;
1247 break;
1248 }
1249 }
1250
1251 switch (full) {
1252 case BOARD_PAGE_ITEM:
1253 SetMenuTrushMark(pack);
1254 break;
1255 }
1256 }
1257}
1258
1259int BoardModeChangeKey() {
1260 int board_mode = PerBoardPt->page;
1261
1262 if (GamePad.Down(PAD_L2 | PAD_L1)) {
1263 switch (PerBoardPt->menu_kind) {
1264 case PERSONAL_BOARD_ITEM:
1265 PerBoardPt->page--;
1266
1267 if (PerBoardPt->page < BOARD_PAGE_ITEM) {
1268 PerBoardPt->page = BOARD_PAGE_ATTACH;
1269 }
1270
1271 break;
1272 case PERSONAL_BOARD_ATLA:
1273 case PERSONAL_BOARD_WEAPON_ATTACH:
1274 break;
1275 }
1276 }
1277
1278 if (GamePad.Down(PAD_R2 | PAD_R1)) {
1279 switch (PerBoardPt->menu_kind) {
1280 case PERSONAL_BOARD_ITEM:
1281 PerBoardPt->page++;
1282
1283 if (PerBoardPt->page > BOARD_PAGE_ATTACH) {
1284 PerBoardPt->page = BOARD_PAGE_ITEM;
1285 }
1286
1287 break;
1288 case PERSONAL_BOARD_ATLA:
1289 case PERSONAL_BOARD_WEAPON_ATTACH:
1290 break;
1291 }
1292 }
1293
1294 if (board_mode != PerBoardPt->page) {
1295 return 1;
1296 }
1297
1298 return 0;
1299}
1300
1301void PersonalBoardLimmitCheck() {
1302 int page = PerBoardPt->page;
1303 int *cursor = &PerBoardPt->cursor;
1304 int max = PersonalRetMax(page);
1305 int top_row = PerBoardPt->top_row;
1306 int last_top = max / 5 - 4;
1307
1308 if (last_top < 0) {
1309 last_top = 0;
1310 }
1311
1312 if (max - 1 < *cursor) {
1313 while (*cursor >= max) {
1314 *cursor -= 5;
1315 }
1316
1317 PerBoardPt->top_row = *cursor / 5 - 3;
1318
1319 if (PerBoardPt->top_row < 0) {
1320 PerBoardPt->top_row = 0;
1321 }
1322
1323 PerBoardPt->y = 0x7F - PerBoardPt->top_row * 0x28;
1324 int rows = max / 5;
1325
1326 if (rows <= 0) {
1327 rows = 4;
1328 }
1329
1330 PerBoardPt->scroll = 140.0f + 114.0f * PerBoardPt->top_row / rows;
1331 return;
1332 }
1333
1334 if (last_top < top_row) {
1335 if (last_top < 0) {
1336 last_top = 0;
1337 }
1338
1339 while (last_top < PerBoardPt->top_row) {
1340 PerBoardPt->top_row--;
1341 }
1342 }
1343}
1344
1345int PersonalBoardKeySub() {
1346 int exit_left = 0;
1347 int area = PerBoardPt->cursor_area;
1348 int page = PerBoardPt->page;
1349 int *cursor = &PerBoardPt->cursor;
1350 int max = PersonalRetMax(page);
1351
1352 if (GamePad.Down(PAD_UP) != 0) {
1353 switch (PerBoardPt->cursor_area) {
1354 case PERSONAL_BOARD_AREA_CELLS:
1355 if (*cursor > 4) {
1356 *cursor -= 5;
1357 }
1358
1359 if (*cursor / 5 < PerBoardPt->top_row) {
1360 PerBoardPt->top_row--;
1361 }
1362
1363 break;
1364 case PERSONAL_BOARD_AREA_TRASH:
1365 break;
1366 }
1367 }
1368
1369 if (GamePad.Down(PAD_DOWN) != 0) {
1370 switch (PerBoardPt->cursor_area) {
1371 case PERSONAL_BOARD_AREA_CELLS:
1372 if (*cursor < max - 5) {
1373 *cursor += 5;
1374 }
1375
1376 if (*cursor / 5 > PerBoardPt->top_row + 3) {
1377 PerBoardPt->top_row++;
1378 }
1379
1380 break;
1381 case PERSONAL_BOARD_AREA_TRASH:
1382 break;
1383 }
1384 }
1385
1386 if (GamePad.Down(PAD_RIGHT) != 0) {
1387 switch (PerBoardPt->cursor_area) {
1388 case PERSONAL_BOARD_AREA_TRASH:
1389 break;
1390 case PERSONAL_BOARD_AREA_CELLS: {
1391 int column = *cursor % 5;
1392
1393 if (column < 4) {
1394 (*cursor)++;
1395 } else if (column == 4 && PerBoardPt->menu_kind != PERSONAL_BOARD_ATLA) {
1396 PerBoardPt->cursor_area = PERSONAL_BOARD_AREA_TRASH;
1397 }
1398
1399 break;
1400 }
1401 }
1402 }
1403
1404 if (GamePad.Down(PAD_LEFT) != 0) {
1405 switch (PerBoardPt->cursor_area) {
1406 case PERSONAL_BOARD_AREA_TRASH:
1407 PerBoardPt->cursor_area = PERSONAL_BOARD_AREA_CELLS;
1408 break;
1409 case PERSONAL_BOARD_AREA_CELLS:
1410 if (*cursor % 5 == 0) {
1411 exit_left = 1;
1412 } else {
1413 (*cursor)--;
1414 }
1415
1416 break;
1417 }
1418 }
1419
1420 if (area != PerBoardPt->cursor_area) {
1421 ComMenuSePlay(MENU_SOUND_CURSOR);
1422 }
1423
1424 return exit_left;
1425}
1426
1427int PersonalBoardKey() {
1428 BoardModeChangeKey();
1429 PersonalBoardLimmitCheck();
1430 return PersonalBoardKeySub();
1431}
1432
1436int PersonalBoardItemPush(IHAVEITEM *item, int board_pos) {
1437 int enabled = false;
1438 int kind = WhatIsKindofItem(item->item_no);
1439
1440 if (kind == BOARD_PAGE_ITEM || kind < 0) {
1441 s16 *board_item = &PerBoardPt->item_pack->item[board_pos];
1442 s16 *board_volume = &PerBoardPt->item_pack->item_vol[board_pos];
1443
1444 if (MenuTrushMark[board_pos] == 1) {
1445 enabled = false;
1446 } else {
1447 MenuDataSwap(board_item, &item->item_no);
1448 MenuDataSwap(board_volume, &item->volume);
1449
1450 if (item->item_no >= ITEM_ATTACH_START) {
1451 item->from_page = BOARD_PAGE_ITEM;
1452 item->from_slot = PerBoardPt->cursor;
1453 }
1454
1455 if (item->item_no >= ITEM_DUNGEON_START || *board_item >= ITEM_DUNGEON_START) {
1456 enabled = true;
1457 }
1458 }
1459 }
1460
1461 return enabled;
1462}
1463
1464int PersonalBoardWeaponPush(IHAVEITEM *item, int board_pos) {
1465 int result = 0;
1466 int kind = WhatIsKindofItem(item->item_no);
1467 int chara = board_pos / 10;
1468 int slot = board_pos % 10;
1469 CUserStatus *status = PerBoardStatusPt;
1470 WEAPON_HAVE *weapons = status->chara_weapons[chara];
1471 WEAPON_HAVE *weapon = &weapons[slot];
1472 int weapon_no = weapon->item_no;
1473
1474 if (kind == BOARD_PAGE_ITEM) {
1475 if (weapon_no < ITEM_WEAPON_START) {
1476 return 0;
1477 }
1478
1479 if (item->item_no == ITEM_REPAIR_POWDER) {
1480 if (weapon->durability_f < weapon->durability) {
1481 weapon->durability_f = weapon->durability;
1482
1483 if (weapon->item_no == GetDefaultWeaponNo(chara)) {
1484 weapon->item_no++;
1485 WepDataListToHaveCopy(weapon->item_no, weapon);
1486 }
1487
1488 InitHaveData(item);
1489 result = 2;
1490 }
1491 }
1492
1493 if (item->item_no == ITEM_POWERUP_POWDER) {
1494 if (weapon->experience < GetWeaponMaxExp(weapon) && weapon->level < 99) {
1495 int item_no = weapon->item_no;
1496
1497 if (item_no != GetDefaultWeaponNo(chara)) {
1498 if (item_no == ITEM_WEAPON_SERPENT_SWORD) {
1499 if (GetMenuHebikiriFlag() != 0) {
1500 result = 2;
1501 }
1502 } else {
1503 result = 2;
1504 }
1505 }
1506 }
1507 }
1508 }
1509
1510 if (kind == BOARD_PAGE_WEAPON || kind < 0) {
1511 if (kind == BOARD_PAGE_WEAPON) {
1512 int owner = WhoIsWeaponEquip(item->item_no);
1513
1514 if (owner != chara) {
1515 result = 0;
1516 } else {
1517 int held = item->item_no;
1518 int placed = weapon->item_no;
1519 MenuDataSwap(&PerBoardPt->weapon, weapon);
1520 item->item_no = placed;
1521 weapon->item_no = held;
1522
1523 if (slot == PerBoardStatusPt->equipped_weapon_slot[owner]) {
1524 PerBoardPt->held_equipped_slot = slot;
1525 PerBoardStatusPt->equipped_weapon_slot[owner] = -1;
1526 } else if (PerBoardPt->held_equipped_slot >= 0) {
1527 PerBoardStatusPt->equipped_weapon_slot[owner] = slot;
1528 PerBoardPt->held_equipped_slot = -1;
1529 }
1530
1531 result = 1;
1532 item->from_page = BOARD_PAGE_WEAPON;
1533 item->from_slot = board_pos;
1534 }
1535 } else {
1536 PerBoardPt->held_equipped_slot = -1;
1537
1538 if (slot == PerBoardStatusPt->equipped_weapon_slot[chara]) {
1539 PerBoardPt->held_equipped_slot = slot;
1540 PerBoardStatusPt->equipped_weapon_slot[chara] = -1;
1541 }
1542
1543 item->from_page = BOARD_PAGE_WEAPON;
1544 item->from_slot = board_pos;
1545 item->item_no = weapon->item_no;
1546 memcpy(&PerBoardPt->weapon, weapon, sizeof(WEAPON_HAVE));
1547 InitHaveWep(weapon);
1548 weapon->item_no = 0;
1549
1550 if (weapon->item_no >= ITEM_WEAPON_START || item->item_no >= ITEM_WEAPON_START) {
1551 result = 1;
1552 }
1553 }
1554 }
1555
1556 return result;
1557}
1558
1562int PersonalBoardAttachPush(IHAVEITEM *item, int board_pos) {
1563 int enabled = false;
1564 int kind = WhatIsKindofItem(item->item_no);
1565
1566 if (kind == BOARD_PAGE_ATTACH || kind < 0) {
1567 item->from_page = BOARD_PAGE_ATTACH;
1568 item->from_slot = board_pos;
1569 CUserStatus *status = PerBoardStatusPt;
1570 DNG_CONSUMABLE *consumables = status->consumable_items;
1571 ATTACH_LIST *slot = (ATTACH_LIST *) &consumables[board_pos];
1572 s16 item_no = item->item_no;
1573 s16 slot_item_no = slot->item_no;
1574
1575 MenuDataSwap(slot, &PerBoardPt->held_attach);
1576 item->item_no = slot_item_no;
1577 slot->item_no = item_no;
1578
1579 if (item->item_no >= ITEM_ATTACH_START || slot->item_no >= ITEM_ATTACH_START) {
1580 enabled = true;
1581 }
1582 }
1583
1584 return enabled;
1585}
1586
1587int PersonalBoardItemGetorSwap(int board_pos) {
1588 int result = 0;
1589 IHAVEITEM *item = &PerBoardPt->held_item;
1590
1591 switch (PerBoardPt->page) {
1592 case BOARD_PAGE_ITEM:
1593 result = PersonalBoardItemPush(item, board_pos);
1594 break;
1595 case BOARD_PAGE_WEAPON:
1596 result = PersonalBoardWeaponPush(item, board_pos);
1597 break;
1598 case BOARD_PAGE_ATTACH:
1599 result = PersonalBoardAttachPush(item, board_pos);
1600 break;
1601 }
1602
1603 return result;
1604}
1605
1606void PersonalBoardItemCancel() {
1607 IHAVEITEM *have = &PerBoardPt->held_item;
1608 int cell = have->from_slot;
1609
1610 switch (have->from_page) {
1611 case BOARD_PAGE_ITEM: {
1612 s16 *item = &PerBoardPt->item_pack->item[cell];
1613 s16 *volume = &PerBoardPt->item_pack->item_vol[cell];
1614 MenuDataSwap(item, &have->item_no);
1615 MenuDataSwap(volume, &have->volume);
1616 } break;
1617 case BOARD_PAGE_WEAPON: {
1618 int chara;
1619 int slot;
1620 int held;
1621 held = have->item_no;
1622
1623 if (held >= ITEM_WEAPON_START) {
1624 chara = cell / 10;
1625 slot = cell % 10;
1626 WEAPON_HAVE *weapons = (WEAPON_HAVE *) ((char *) PerBoardStatusPt + chara * sizeof(PerBoardStatusPt->chara_weapons[0]) + 0x450C);
1627 WEAPON_HAVE *weapon = &weapons[slot];
1628 int placed = weapon->item_no;
1629 MenuDataSwap(&PerBoardPt->weapon, weapon);
1630 have->item_no = placed;
1631 weapon->item_no = held;
1632
1633 if (PerBoardPt->held_equipped_slot >= 0) {
1634 PerBoardStatusPt->equipped_weapon_slot[chara] = PerBoardPt->held_equipped_slot;
1635 PerBoardPt->held_equipped_slot = -1;
1636 } else if (slot == PerBoardStatusPt->equipped_weapon_slot[chara]) {
1637 PerBoardPt->held_equipped_slot = slot;
1638 PerBoardStatusPt->equipped_weapon_slot[chara] = -1;
1639 }
1640 }
1641
1642 break;
1643 }
1644 case BOARD_PAGE_ATTACH: {
1645 DNG_CONSUMABLE *items = PerBoardStatusPt->consumable_items;
1646 DNG_CONSUMABLE *item = &items[cell];
1647 int held = have->item_no;
1648 int placed = item->id;
1649 MenuDataSwap((ATTACH_LIST *) item, &PerBoardPt->held_attach);
1650 have->item_no = placed;
1651 item->id = held;
1652 break;
1653 }
1654 }
1655
1656 if (have->item_no < ITEM_ATTACH_START) {
1657 InitHaveData(have);
1658 InitHaveWep(&PerBoardPt->weapon);
1659 PerBoardPt->held_equipped_slot = -1;
1660 }
1661}
1662
1663int PersonalRetMax(int board_mode) {
1664 int max = 0;
1665
1666 switch (board_mode) {
1667 case BOARD_PAGE_ITEM:
1668 max = PerBoardPt->item_pack->num;
1669 break;
1670 case BOARD_PAGE_WEAPON:
1671 max = 60;
1672 break;
1673 case BOARD_PAGE_ATTACH:
1674 max = 40;
1675 break;
1676 case BOARD_PAGE_ATLA_VILLAGE:
1677 case BOARD_PAGE_ATLA_VILLAGE + 1:
1678 case BOARD_PAGE_ATLA_VILLAGE + 2:
1679 case BOARD_PAGE_ATLA_VILLAGE + 3:
1680 case BOARD_PAGE_ATLA_VILLAGE + 4:
1681 case BOARD_PAGE_ATLA_VILLAGE + 5:
1682 max = 120;
1683 break;
1684 }
1685
1686 return max;
1687}
1688
1689void DrawPersonalBoard(int x, int y, int board_mode, int alpha, int unused) {
1690 int max = PersonalRetMax(board_mode);
1691 int top = y + 9;
1692 int bottom = top + 0xA0;
1693 int left = x + 0x13;
1694 int row_y = y - 0x11;
1695 int mark;
1696
1697 row_y = row_y + 0x17 - PerBoardPt->top_row * 40;
1698 PerBoardPt->y += (row_y - PerBoardPt->y) / 4.0f;
1699 row_y = PerBoardPt->y;
1700
1701 switch (PerBoardPt->menu_kind) {
1702 case PERSONAL_BOARD_ATLA:
1703 case PERSONAL_BOARD_ITEM:
1704 MenuTextureReload(PerBoardTex->block);
1705 break;
1706 }
1707
1708 mark = 0;
1709
1710 switch (board_mode) {
1711 case BOARD_PAGE_WEAPON:
1712 mark = 2;
1713 break;
1714 }
1715
1716 DrawPerBoardDraw(mark, max, left, row_y, top, bottom, PerBoardTex, alpha);
1717
1718 switch (PerBoardPt->menu_kind) {
1719 case PERSONAL_BOARD_ATLA:
1720 MenuTextureReload(PerBoardTex->block);
1721 break;
1722 case PERSONAL_BOARD_ITEM:
1723 MenuTextureReload(ItemMenuWeaponIconReadBlock);
1724 break;
1725 }
1726
1727 CommonIconDraw(board_mode, max, left + 2, row_y + 6, top, bottom, alpha);
1728 MenuTextureReload(PerBoardTex->block);
1729 PersonalBoardOptionDraw(board_mode, max, x, y, PerBoardTex, alpha);
1730}
1731
1739static void DrawNowEquipWeaponMark(int x, int y, int top, int bottom, int alpha) {
1740 int position = y;
1741 int v = 0xC0;
1742 int length = 0x28;
1743
1744 MenuTextureClip(position, v, length, top, bottom);
1745
1746 if (position + length < top || bottom <= position) {
1747 return;
1748 }
1749
1750 MenuTextureReload(PerBoardTex->block);
1751 DrawMenu2DSprite(PerBoardTex, CRect_i_(x, position, 0x28, length), CRect_i_(0x114, v, 0x28, length), alpha);
1752}
1753
1754void CommonIconDraw(int page, int count, int x, int y, int top, int bottom, int alpha) {
1755 int value;
1756 int draw_x;
1757 int weapon_x = x + 4;
1758 int draw_y = y;
1759 CTexture *icon;
1760
1761 switch (page) {
1762 case BOARD_PAGE_ATTACH: {
1763 if (PerBoardPt->menu_kind == PERSONAL_BOARD_WEAPON_ATTACH) {
1764 MenuTextureReload(MenuShadowReadBlock);
1765 } else {
1766 icon = TexManager.GetTexture("wepicon", -1);
1767
1768 if (icon != NULL) {
1769 MenuTextureReload(icon->block);
1770 WepIcon = icon;
1771 }
1772 }
1773
1774 draw_x = x + 2;
1775 ATTACH_LIST *attach = (ATTACH_LIST *) PerBoardPt->consumables;
1776
1777 for (int i = 0; i < count; i++) {
1778 int id = attach[i].item_no;
1779
1780 if (id >= ITEM_ATTACH_STAT_START && id < ITEM_ATTACH_GEM_START) {
1781 value = attach[i].status[id - ITEM_ATTACH_STAT_START];
1782 }
1783
1784 if (id == ITEM_ATTACH_SYNTHESIS_SPHERE) {
1785 value = attach[i].sphere_weapon_no;
1786 }
1787
1788 DrawIconParts(id, draw_x, draw_y, top, bottom, alpha, value);
1789 draw_x += 0x28;
1790
1791 if (i % 5 == 4) {
1792 draw_x = x + 2;
1793 draw_y += 0x28;
1794 }
1795 }
1796
1797 break;
1798 }
1799 case BOARD_PAGE_ITEM: {
1800 draw_x = x;
1801 int quick;
1802 int slot;
1803 ITEM_PACK *pack = PerBoardPt->item_pack;
1804 s16 *items = pack->item;
1805 quick = 0;
1806
1807 for (slot = 0; slot < 3; slot++) {
1808 quick += pack->quick_item_qty[slot];
1809 }
1810
1811 for (int i = 0; i < count; i++) {
1812 DrawIconParts(items[i], draw_x, draw_y, top, bottom, alpha, 0);
1813
1814 if (MenuTrushMark[i] != 0) {
1815 DrawDontSetItemMark(draw_x, draw_y, top, bottom, alpha);
1816 }
1817
1818 draw_x += 0x28;
1819
1820 if (i % 5 == 4) {
1821 draw_x = x;
1822 draw_y += 0x28;
1823 }
1824 }
1825
1826 break;
1827 }
1828 case BOARD_PAGE_WEAPON: {
1829 int party;
1830 int item_no;
1831 WEAPON_HAVE *weapons;
1832 int chara = 0;
1833 weapons = PerBoardStatusPt->chara_weapons[0];
1834 icon = TexManager.GetTexture("wepicon", -1);
1835
1836 if (icon != NULL) {
1837 MenuTextureReload(icon->block);
1838 WepIcon = icon;
1839 }
1840
1841 draw_x = weapon_x;
1842 party = PerBoardStatusPt->party_size;
1843
1844 for (int i = 0; i < count; i++) {
1845 int slot = i % 10;
1846 item_no = weapons[slot].item_no;
1847 int equipped = PerBoardStatusPt->equipped_weapon_slot[i / 10];
1848
1849 if (party >= i / 10 + 1 && equipped >= 0 && slot == equipped) {
1850 DrawNowEquipWeaponMark(draw_x - 2, draw_y - 4, top + 1, bottom, alpha);
1851
1852 if (icon != NULL) {
1853 MenuTextureReload(icon->block);
1854 }
1855 }
1856
1857 DrawIconParts(item_no, draw_x, draw_y, top, bottom, alpha, 0);
1858 draw_x += 0x28;
1859
1860 if (i % 5 == 4) {
1861 draw_x = weapon_x;
1862 draw_y += 0x28;
1863
1864 if (i != 0 && slot == 9) {
1865 chara++;
1866 CUserStatus *status = PerBoardStatusPt;
1867 weapons = status->chara_weapons[chara];
1868 }
1869 }
1870 }
1871
1872 break;
1873 }
1874 case BOARD_PAGE_ATLA_VILLAGE:
1875 case BOARD_PAGE_ATLA_VILLAGE + 1:
1876 case BOARD_PAGE_ATLA_VILLAGE + 2:
1877 case BOARD_PAGE_ATLA_VILLAGE + 3:
1878 case BOARD_PAGE_ATLA_VILLAGE + 4:
1879 case BOARD_PAGE_ATLA_VILLAGE + 5: {
1880 int left = weapon_x - 2;
1881 draw_x = left;
1882
1883 for (int i = 0; i < 120; i++) {
1884 DrawAtoraParts(draw_x, draw_y, PerBoardPt->atla_elements[i], top, bottom - 4, alpha);
1885 draw_x += 0x28;
1886
1887 if (i % 5 == 4) {
1888 draw_x = left;
1889 draw_y += 0x28;
1890 }
1891 }
1892
1893 break;
1894 }
1895 }
1896}
1897
1898void PersonalBoardDrawWaku(int x, int y, CTexture *texture, int alpha) {
1899 DrawMenu2DSprite(texture, CRect_i_(x, y + 1, 0x14, 0xBF), CRect_i_(0, 0, 0x14, 0xC0), alpha);
1900 DrawMenu2DSprite(texture, CRect_i_(x + 0x14, y + 1, 0xC8, 0x13), CRect_i_(0x14, 0, 0xC8, 0x14), alpha);
1901 DrawMenu2DSprite(texture, CRect_i_(x + 0xDC, y + 1, 0x24, 0xBF), CRect_i_(0xDC, 0, 0x24, 0xC0), alpha);
1902 DrawMenu2DSprite(texture, CRect_i_(x + 0x14, y + 0xA1, 0xC8, 0x1F), CRect_i_(0x14, 0xA0, 0xC8, 0x20), alpha);
1903}
1904
1905void PersonalBoardOptionDraw(int board_mode, int count, int x, int y, CTexture *texture, int alpha) {
1906 PersonalBoardTagDraw(board_mode, x, y, texture, 0, alpha);
1907 PersonalBoardDrawWaku(x, y, texture, alpha);
1908 PersonalBoardScrlBarDraw(count, x, y, PerBoardPt->scroll, PerBoardPt->top_row, texture, alpha);
1909 PersonalBoardMaxDraw(count, x, y, texture, alpha);
1910}
1911
1912void PersonalBoardTagDraw(int tag, int x, int y, CTexture *texture, int shift, int alpha) {
1913 int bright = 0x80;
1914 int top;
1915 int row;
1916
1917 switch (PerBoardPt->menu_kind) {
1918 case PERSONAL_BOARD_WEAPON_ATTACH:
1919 bright = 0x40;
1920 case PERSONAL_BOARD_ITEM:
1921 for (int kind = 0, i = 0; i < 3; i++, kind++) {
1922 if (tag != kind) {
1923 top = y - 0x30;
1924 row = kind * 0x30;
1925 set2DSprite(GetVif1Packet(), texture, CRect_i_(x, top + 2, 0x100, 0x2F), CRect_i_(0x100, row, 0x100, 0x30), bright, bright, bright, alpha);
1926 }
1927 }
1928
1929 top = y - 0x30;
1930 row = tag * 0x30;
1931 DrawMenu2DSprite(texture, CRect_i_(x, top + 2, 0x100, 0x2F), CRect_i_(0x100, row, 0x100, 0x30), alpha);
1932 x = x + 0x12 + tag * 0x44;
1933 top = y - 0x4C;
1934 {
1935 s8 widths[7][3] = {
1936 {0x34, 0x45, 0x4E},
1937 {0x34, 0x45, 0x4E},
1938 {0x34, 0x45, 0x4E},
1939 {0x34, 0x45, 0x4E},
1940 {0x34, 0x45, 0x4E},
1941 {0x34, 0x45, 0x4E},
1942 {0x34, 0x45, 0x4E},
1943 };
1944 s8 sources[7][3] = {
1945 {0x00, 0x34, 0x79},
1946 {0x00, 0x34, 0x79},
1947 {0x00, 0x34, 0x79},
1948 {0x00, 0x34, 0x79},
1949 {0x00, 0x34, 0x79},
1950 {0x00, 0x34, 0x79},
1951 {0x00, 0x34, 0x79},
1952 };
1953 s8 offsets[7][3] = {
1954 {2, -8, -16},
1955 {2, -8, -16},
1956 {2, -8, -16},
1957 {2, -8, -16},
1958 {2, -8, -16},
1959 {2, -8, -16},
1960 {2, -8, -16},
1961 };
1962 int lang = GetMenuLangFlag();
1963 int width = widths[lang][tag];
1964 int source = sources[lang][tag];
1965
1966 x += offsets[lang][tag];
1967 x += shift;
1968
1969 if (shift == 0) {
1970 DrawMenu2DSprite(texture, CRect_i_(x, top + 1, width, 0x1B), CRect_i_(source, 0xC0, width, 0x1C), alpha);
1971 }
1972 }
1973 break;
1974 case PERSONAL_BOARD_ATLA:
1975 if (VillageBar != NULL) {
1976 MenuTextureReload(VillageBar->block);
1977 int last = 0;
1978 int village = 2;
1979 int max_village = GetAtoraMaxVillage();
1980 int step = 1;
1981 int count = 0;
1982
1983 top = y - 0x30;
1984
1985 while (step != 0) {
1986 village += step;
1987
1988 if (max_village < village) {
1989 village = max_village;
1990 }
1991
1992 if (village == tag) {
1993 if (step == 1 && village == max_village) {
1994 last = 1;
1995 } else if (step == -1) {
1996 last = 1;
1997 } else if (step == 1) {
1998 step = -1;
1999 village = max_village;
2000 }
2001 }
2002
2003 int index = village - 3;
2004 int left = x + index * 0x1A;
2005
2006 if (last) {
2007 DrawMenu2DSprite(VillageBar, CRect_i_(x, y - 0x12, 0x100, 0x13), CRect_i_(0, 0x90, 0x100, 0x14), alpha);
2008 bright = 0x80;
2009 }
2010
2011 int column = (index % 2) * 0x60;
2012 row = (index >> 1) * 0x30;
2013 set2DSprite(GetVif1Packet(), VillageBar, CRect_i_(left, top + 2, 0x60, 0x2F), CRect_i_(column, row, 0x60, 0x30), bright, bright, bright, alpha);
2014
2015 if (last) {
2016 break;
2017 }
2018
2019 if (++count >= 7) {
2020 break;
2021 }
2022 }
2023
2024 top = y - 0x5A;
2025 row = (tag - 3) * 0x28;
2026 DrawMenu2DSprite(VillageName, CRect_i_(x, top + 1, 0x100, 0x27), CRect_i_(0, row, 0x100, 0x28), alpha);
2027 }
2028
2029 break;
2030 }
2031}
2032
2033void PersonalBoardScrlBarDraw(int count, int x, int y, float &scroll, unsigned char top_row, CTexture *texture, int alpha) {
2034 int bar_x = x + 0xE8;
2035 int rows = count / 5;
2036
2037 if (rows <= 0) {
2038 rows = 1;
2039 }
2040
2041 int length = (int) (456.0f / rows - 8.0f);
2042
2043 if (114.0f < (float) length) {
2044 length = 0x69;
2045 }
2046
2047 CRect_i_ source(0xAE, 0x14, 8, 4);
2048 float bar_y = (float) (y + 0x16) + 114.0f * top_row / rows;
2049 bar_y = scroll + (bar_y - scroll) / 4.0f;
2050 scroll = bar_y;
2051 DrawMenu2DSprite(texture, CRect_i_(bar_x, (int) bar_y, 8, 4), source, alpha);
2052 source.y += 4;
2053 DrawMenu2DSprite(texture, CRect_i_(bar_x, (int) (4.0f + bar_y), 8, length + 1), source, alpha);
2054 source.y += 4;
2055 DrawMenu2DSprite(texture, CRect_i_(bar_x, (int) (4.0f + bar_y + length), 8, 4), source, alpha);
2056}
2057
2058void PersonalBoardMaxDraw(int num, int x, int y, CTexture *texture, int alpha) {
2059 int left = x + 0xD2;
2060 int top = y - 0x28;
2061
2062 DrawMenu2DSprite(texture, CRect_i_(left, top + 1, 0x30, 0x2F), CRect_i_(0x100, 0x90, 0x30, 0x30), alpha);
2063 RECT digits = {0x90, 0xDC, 12, 12};
2064 left = x + 0xF7;
2065 top = y - 0xE;
2066
2067 if (PerBoardPt->menu_kind == PERSONAL_BOARD_ATLA) {
2068 left += 2;
2069 }
2070
2071 DrawMenuNumber(num, left, top, texture, digits, 1, alpha);
2072 left = x + 0xF4;
2073 top = y - 0x22;
2074
2075 int max = 0;
2076 int full = 0;
2077 int item;
2078
2079 switch (PerBoardPt->page) {
2080 case BOARD_PAGE_ITEM:
2081 case BOARD_PAGE_WEAPON:
2082 case BOARD_PAGE_ATTACH:
2083 max = GetNowModeMaxNum(PerBoardPt->page, &full);
2084 item = PerBoardPt->held_item.item_no;
2085
2086 if (item >= ITEM_ATTACH_START) {
2087 int kind = WhatIsKindofItem(item);
2088
2089 if (kind == PerBoardPt->page) {
2090 max++;
2091 }
2092 }
2093
2094 if (num < max) {
2095 full = 1;
2096 }
2097
2098 break;
2099 case BOARD_PAGE_ATLA_VILLAGE:
2100 case BOARD_PAGE_ATLA_VILLAGE + 1:
2101 case BOARD_PAGE_ATLA_VILLAGE + 2:
2102 case BOARD_PAGE_ATLA_VILLAGE + 3:
2103 case BOARD_PAGE_ATLA_VILLAGE + 4:
2104 case BOARD_PAGE_ATLA_VILLAGE + 5:
2105 for (int i = 0; i < num; i++) {
2106 if (PerBoardPt->atla_elements[i] >= 0) {
2107 max++;
2108 }
2109 }
2110
2111 if (0 <= PerBoardPt->held_item.item_no) {
2112 max++;
2113 }
2114
2115 break;
2116 }
2117
2118 if (full) {
2119 digits.y += digits.height;
2120 }
2121
2122 DrawMenuNumber(max, left, top, texture, digits, 1, alpha);
2123}
2124
2132static void DrawPersonalBoardBase(int x, int y, int top, int bottom, int count, CTexture *texture, int alpha) {
2133 int v;
2134 int length;
2135 spRGBA upper;
2136 spRGBA lower;
2137 int step;
2138 int i;
2139
2140 if (y < top - 39 || y > bottom - 1) {
2141 return;
2142 }
2143
2144 v = 0x14;
2145 length = 0x28;
2146 MenuTextureClip(y, v, length, top, bottom);
2147 step = 9;
2148 upper.r = upper.g = upper.b = 0x80;
2149 lower.r = lower.g = lower.b = 0x80 - step;
2150 lower.a = alpha;
2151 upper.a = alpha;
2152
2153 for (i = 0; i < count; i++) {
2154 set2DSprite(GetVif1Packet(), texture, CRect_i_(x, y, 0x28, length), CRect_i_(0x20, v, 0x28, length), &upper, &lower, &upper, &lower, 1);
2155 upper.r = upper.g = upper.b = lower.r;
2156 lower.r = lower.g = lower.b = lower.r - step;
2157 step--;
2158 x += 0x28;
2159 }
2160}
2161
2162void DrawPerBoardDraw(int mark, int count, int x, int y, int top, int bottom, CTexture *texture, int alpha) {
2163 int row_y = y;
2164 int board_x = x;
2165
2166 for (int row = 0; row < 26; row++) {
2167 DrawPersonalBoardBase(board_x, row_y, top, bottom, 5, texture, alpha);
2168 int draw_mark = 0;
2169
2170 switch (mark) {
2171 case 0:
2172 break;
2173 case 1:
2174 if (row == 2) {
2175 draw_mark = 1;
2176 }
2177
2178 break;
2179 case 2:
2180 if (row % 2 == 0 && row != 0) {
2181 draw_mark = 1;
2182 }
2183
2184 break;
2185 }
2186
2187 if (draw_mark != 0) {
2188 int mark_x = x - 4;
2189 int mark_y = row_y - 8;
2190 int v = 0x3C;
2191 int height = 0x10;
2192
2193 if (top <= mark_y + 0x10 && mark_y < bottom) {
2194 MenuTextureClip(mark_y, v, height, top, bottom);
2195 int step = 9;
2196 spRGBA left;
2197 spRGBA right;
2198 left.r = left.g = left.b = 0x80;
2199 right.r = right.g = right.b = 0x80 - step;
2200 right.a = alpha;
2201 left.a = alpha;
2202
2203 for (int i = 0; i < 5; i++) {
2204 set2DSprite(GetVif1Packet(), texture, CRect_i_(mark_x, mark_y, 0x28, height), CRect_i_(0x20, v, 0x28, height), &left, &right, &left, &right, 1);
2205 left.r = left.g = left.b = right.r;
2206 right.r = right.g = right.b = right.r - step;
2207 step--;
2208 mark_x += 0x28;
2209 }
2210 }
2211 }
2212
2213 row_y += 0x28;
2214
2215 if (bottom < row_y) {
2216 break;
2217 }
2218 }
2219}
2220
2221/* The trash can's animation fields, which CommonTrushDraw reaches as one record. */
2223 s16 anim;
2224 u8 unk_02[2];
2225 s32 frame;
2226};
2227
2228void CommonTrushDraw(int x, int y, int alpha) {
2229 PERSONAL_BOARD *board = PerBoardPt;
2231 CRect_i_ source(0x190, 0x90, 0x30, 0x30);
2232 CRect_i_ dest(x, y + 1, 0x30, 0x2F);
2233
2234 switch (trash->anim) {
2235 case 1: {
2236 int frame = trash->frame;
2237
2238 if (frame <= 3 || frame > 12) {
2239 source.x -= 0x30;
2240 } else if (frame > 6 && frame <= 9) {
2241 source.x += 0x30;
2242 }
2243
2244 DrawMenu2DSprite(PerBoardTex, dest, source, alpha);
2245 trash->frame++;
2246
2247 if (frame > 15) {
2248 trash->anim = 0;
2249 trash->frame = 0;
2250 }
2251
2252 break;
2253 }
2254 default:
2255 if (board->cursor_area == PERSONAL_BOARD_AREA_TRASH) {
2256 source.x = 0x130;
2257 }
2258
2259 DrawMenu2DSprite(PerBoardTex, dest, source, alpha);
2260 break;
2261 }
2262}
2263
2264int IsEnableTrushThrow(int item_no) {
2265 int enable = false;
2266
2267 if (item_no >= ITEM_WEAPON_START) {
2268 int owner = WhoIsWeaponEquip(item_no);
2269 CUserStatus *status = PerBoardStatusPt;
2270 WEAPON_HAVE *weapons = status->chara_weapons[owner];
2271 int default_no = GetDefaultWeaponNo(owner);
2272
2273 for (int i = 0; i < 11; i++) {
2274 int weapon_no = weapons[i].item_no;
2275
2276 if (weapon_no == default_no || weapon_no == default_no + 1) {
2277 enable = true;
2278 break;
2279 }
2280 }
2281
2282 if (PerBoardStatusPt->party_size - 1 < owner) {
2283 enable = true;
2284 }
2285
2286 if (item_no == ITEM_WEAPON_SERPENT_SWORD) {
2287 int flag = GetMenuHebikiriFlag();
2288
2289 if (flag == 0) {
2290 enable = flag;
2291 }
2292 }
2293
2294 if (PerBoardPt->held_equipped_slot >= 0) {
2295 enable = false;
2296 }
2297 }
2298
2299 if (item_no >= ITEM_ATTACH_START && item_no < ITEM_WEAPON_START) {
2300 COM_ITEM_INFO *info = GetCommonItemInfo(item_no);
2301
2302 if (info != NULL) {
2303 switch (info->kind) {
2304 case ITEMKIND_ATTACH:
2305 if (GetAttachData(item_no) != NULL) {
2306 enable = true;
2307 }
2308
2309 break;
2310 case ITEMKIND_ITEM: {
2311 ITEM_DATA *data = GetItemData(item_no);
2312
2313 if (data != NULL) {
2314 if (data->kind_flags & 0x10) {
2315 enable = false;
2316 } else {
2317 enable = true;
2318 }
2319 }
2320
2321 break;
2322 }
2323 }
2324 }
2325 }
2326
2327 return enable;
2328}
2329
2330void CommonMoneyBoardDraw(int x, int y, int money, int alpha) {
2331 int top = y + 2;
2332
2333 DrawMenu2DSprite(PerBoardTex, CRect_i_(x, top, 0x1A, 0x1B), CRect_i_(0x160, 0xC0, 0x1A, 0x1C), alpha);
2334 DrawMenu2DSprite(PerBoardTex, CRect_i_(x + 0x1A, top, 0x2A, 0x1B), CRect_i_(0x17A, 0xC0, 0x20, 0x1C), alpha);
2335 DrawMenu2DSprite(PerBoardTex, CRect_i_(x + 0x44, top, 0x1A, 0x1B), CRect_i_(0x19A, 0xC0, 0x1A, 0x1C), alpha);
2336 RECT digits = {0, 0xDC, 12, 12};
2337 DrawMenuNumber(money, x + 0x55, y + 8, PerBoardTex, digits, 0, alpha);
2338}
2339
2340int SearchBoardNowPosItemExist(int page, int cell) {
2341 int item_no = -1;
2342
2343 switch (page) {
2344 case BOARD_PAGE_ITEM: {
2345 ITEM_PACK *pack = &PerBoardStatusPt->item_pack;
2346
2347 if (pack != NULL) {
2348 item_no = pack->item[cell];
2349 }
2350
2351 break;
2352 }
2353 case BOARD_PAGE_WEAPON: {
2354 int chara = cell / 10;
2355 int slot = cell % 10;
2356 CUserStatus *status = PerBoardStatusPt;
2357 WEAPON_HAVE *weapons = status->chara_weapons[chara];
2358 WEAPON_HAVE *weapon = &weapons[slot];
2359
2360 if (weapon != NULL) {
2361 item_no = weapon->item_no;
2362 }
2363
2364 break;
2365 }
2366 case BOARD_PAGE_ATTACH: {
2367 DNG_CONSUMABLE *items = PerBoardStatusPt->consumable_items;
2368
2369 if (items != NULL) {
2370 item_no = items[cell].id;
2371 }
2372
2373 break;
2374 }
2375 }
2376
2377 return item_no;
2378}
2379
2380int GetBoardSpace(int item_no, int *page) {
2381 int space = -1;
2382
2383 if (item_no < ITEM_ATTACH_START) {
2384 return -1;
2385 }
2386
2387 *page = WhatIsKindofItem(item_no);
2388 int max = PersonalRetMax(*page);
2389
2390 switch (*page) {
2391 case BOARD_PAGE_ITEM: {
2392 int quick;
2393 int i;
2394 ITEM_PACK *pack = &PerBoardStatusPt->item_pack;
2395 quick = 0;
2396
2397 for (i = 0; i < 3; i++) {
2398 quick += pack->quick_item_qty[i];
2399 }
2400
2401 for (i = 0; i < max - quick; i++) {
2402 if (pack->item[i] < ITEM_DUNGEON_START && MenuTrushMark[i] == 0) {
2403 space = i;
2404 break;
2405 }
2406 }
2407
2408 break;
2409 }
2410 case BOARD_PAGE_WEAPON: {
2411 int owner = WhoIsWeaponEquip(item_no);
2412 int i;
2413 CUserStatus *status = PerBoardStatusPt;
2414 WEAPON_HAVE *weapons = status->chara_weapons[owner];
2415
2416 for (i = 0; i < 10; i++) {
2417 if (weapons[i].item_no < ITEM_WEAPON_START) {
2418 space = i + owner * 10;
2419 break;
2420 }
2421 }
2422
2423 break;
2424 }
2425 case BOARD_PAGE_ATTACH: {
2426 int i;
2427 DNG_CONSUMABLE *items = PerBoardStatusPt->consumable_items;
2428
2429 for (i = 0; i < max; i++) {
2430
2431 if (items[i].id < ITEM_ATTACH_START) {
2432 space = i;
2433 break;
2434 }
2435 }
2436
2437 break;
2438 }
2439 }
2440
2441 return space;
2442}
2443
2444void SwapItem(ITEM_PACK *items, int first_pos, int second_pos) {
2445 s16 item = items->item[first_pos];
2446 s16 vol = items->item_vol[first_pos];
2447
2448 items->item[first_pos] = items->item[second_pos];
2449 items->item_vol[first_pos] = items->item_vol[second_pos];
2450 items->item[second_pos] = item;
2451 items->item_vol[second_pos] = vol;
2452}
2453
2455static int sort_table[9] = {9, 0, 1, 2, 3, 4, 5, 6, 7};
2456
2457int CompItem(int first_item_no, int second_item_no) {
2458 ITEM_DATA *first = GetItemData(first_item_no);
2459 ITEM_DATA *second = GetItemData(second_item_no);
2460 int first_rank = 0;
2461 int second_rank = 0;
2462
2463 if (first != NULL) {
2464 first_rank = sort_table[first->sort_key];
2465 }
2466
2467 if (second != NULL) {
2468 second_rank = sort_table[second->sort_key];
2469 }
2470
2471 if (first_item_no < ITEM_DUNGEON_START) {
2472 first_rank = 9;
2473 }
2474
2475 if (second_item_no < ITEM_DUNGEON_START) {
2476 second_rank = 9;
2477 }
2478
2479 if (first_rank > second_rank) {
2480 return 1;
2481 }
2482
2483 if (first_rank < second_rank) {
2484 return -1;
2485 }
2486
2487 if (first_item_no > second_item_no) {
2488 return 1;
2489 }
2490
2491 if (first_item_no < second_item_no) {
2492 return -1;
2493 }
2494
2495 return 0;
2496}
2497
2499static int sort_top_type = ITEM_SORT_FOOD;
2500
2501int SeitonItemBoardSub(ITEM_PACK *items) {
2502 int i;
2503 int j;
2504 int type = sort_top_type;
2505 int swapped;
2506
2507 for (i = 0; i < ITEM_SORT_COUNT; i++) {
2508 sort_table[type] = i;
2509 type++;
2510
2511 if (type >= ITEM_SORT_COUNT) {
2512 type = ITEM_SORT_NONE;
2513 }
2514 }
2515
2516 sort_table[ITEM_SORT_NONE] = 9;
2517 swapped = 0;
2518
2519 for (i = 0; i < items->num - 1; i++) {
2520 for (j = i + 1; j < items->num; j++) {
2521 if (CompItem(items->item[i], items->item[j]) > 0) {
2522 SwapItem(items, i, j);
2523 swapped = 1;
2524 }
2525 }
2526 }
2527
2528 return swapped;
2529}
2530
2531void SeitonItemBoard(ITEM_PACK *items) {
2532 if (items != NULL) {
2533 for (int i = 0; i < ITEM_SORT_COUNT; i++) {
2534 if (SeitonItemBoardSub(items) != 0) {
2535 break;
2536 }
2537
2538 sort_top_type++;
2539
2540 if (sort_top_type >= ITEM_SORT_COUNT) {
2541 sort_top_type = ITEM_SORT_FOOD;
2542 }
2543 }
2544 }
2545}
2546
2547int GetAttachKind(int item_no) {
2548 if ((item_no >= ITEM_ATTACH_START) && (item_no < ITEM_ATTACH_ATTACK)) {
2549 return ATTACHKIND_ELEMENT;
2550 }
2551
2552 if ((item_no >= ITEM_ATTACH_ATTACK) && (item_no < ITEM_ATTACH_AMETHYST)) {
2553 return ATTACHKIND_STAT;
2554 }
2555
2556 if ((item_no >= ITEM_ATTACH_AMETHYST) && (item_no < ITEM_ATTACH_GEM_END)) {
2557 return ATTACHKIND_GEM;
2558 }
2559
2560 if ((item_no >= ITEM_ATTACH_DINOSLAYER) && (item_no <= ITEM_ATTACH_SLAYER_END)) {
2561 return ATTACHKIND_SLAYER;
2562 }
2563
2564 return ATTACHKIND_OTHER;
2565}
2566
2568static int asort_table[5] = {5, 1, 2, 3, 4};
2569
2570int CompAttach(ATTACH_LIST *first, ATTACH_LIST *second) {
2571 int first_rank = asort_table[GetAttachKind(first->item_no)];
2572 int second_rank = asort_table[GetAttachKind(second->item_no)];
2573
2574 if (first->item_no < ITEM_ATTACH_START) {
2575 first_rank = 5;
2576 }
2577
2578 if (second->item_no < ITEM_ATTACH_START) {
2579 second_rank = 5;
2580 }
2581
2582 if (first_rank > second_rank) {
2583 return 1;
2584 }
2585
2586 if (first_rank < second_rank) {
2587 return -1;
2588 }
2589
2590 if (first->item_no > second->item_no) {
2591 return 1;
2592 }
2593
2594 if (first->item_no < second->item_no) {
2595 return -1;
2596 }
2597
2598 return 0;
2599}
2600
2602static int asort_top_type = 1;
2603
2604int SeitonAttachBoardSub(ATTACH_LIST *attachments) {
2605 int i;
2606 int j;
2607 int type = asort_top_type;
2608 int swapped;
2609
2610 for (i = 0; i < 5; i++) {
2611 asort_table[type] = i;
2612 type++;
2613
2614 if (type >= 5) {
2615 type = 0;
2616 }
2617 }
2618
2619 asort_table[0] = 5;
2620 swapped = 0;
2621
2622 for (i = 0; i < 39; i++) {
2623 for (j = i + 1; j < 40; j++) {
2624 if (CompAttach(&attachments[i], &attachments[j]) > 0) {
2625 MenuDataSwap(&attachments[i], &attachments[j]);
2626 swapped = 1;
2627 }
2628 }
2629 }
2630
2631 return swapped;
2632}
2633
2634int SeitonAttachBoard(ATTACH_LIST *attachments) {
2635 if (attachments == NULL) {
2636 return 0;
2637 }
2638
2639 for (int i = 0; i < 5; i++) {
2640 if (SeitonAttachBoardSub(attachments) != 0) {
2641 break;
2642 }
2643
2644 asort_top_type++;
2645
2646 if (asort_top_type >= 5) {
2647 asort_top_type = 0;
2648 }
2649 }
2650 PORT_RETURN(1);
2651}
2652
2653int WhatIsKindofItem(int item_no) {
2654 COM_ITEM_INFO *info = GetCommonItemInfo(item_no);
2655
2656 if (info == NULL) {
2657 return BOARD_PAGE_NONE;
2658 }
2659
2660 int board_kind[3] = {BOARD_PAGE_ATTACH, BOARD_PAGE_ITEM, BOARD_PAGE_WEAPON};
2661 return board_kind[info->kind];
2662}
2663
2664int WhoIsWeaponEquip(int weapon_no) {
2665 COM_ITEM_INFO *info;
2666 WEAPON_DATA *data;
2667
2668 info = GetCommonItemInfo(weapon_no);
2669
2670 if (info == NULL) {
2671 return -1;
2672 }
2673
2674 if (info->kind != ITEMKIND_WEAPON) {
2675 return -1;
2676 }
2677
2678 data = GetWeaponDataInfo((s32) info->index);
2679
2680 if (data != NULL) {
2681 return (s8) data->owner;
2682 }
2683
2684 return -1;
2685}
2686
2687int GetWeaponHoleNum(int weapon_no) {
2688 COM_ITEM_INFO *info = GetCommonItemInfo(weapon_no);
2689
2690 if (info == NULL) {
2691 return 0;
2692 }
2693
2694 if (info->kind != ITEMKIND_WEAPON) {
2695 return 0;
2696 }
2697
2698 WEAPON_DATA *data = GetWeaponData(weapon_no);
2699
2700 if (data == NULL) {
2701 return 0;
2702 }
2703
2704 int count = 0;
2705
2706 for (int i = 0; i <= 5; i++) {
2707 if (data->hole[i] > 0) {
2708 count++;
2709 }
2710 }
2711
2712 return count;
2713}
2714
2715int GetNowWeaponAttachNum(WEAPON_HAVE *weapon) {
2716 int count = 0;
2717
2718 if (weapon == NULL) {
2719 return 0;
2720 }
2721
2722 WEAPON_DATA *data = GetWeaponData(weapon->item_no);
2723
2724 if (data != NULL) {
2725 for (int i = 0; i < 6; i++) {
2726 if (data->hole[i] > 0 && weapon->attach[i].item_no >= ITEM_ATTACH_START) {
2727 count++;
2728 }
2729 }
2730 }
2731
2732 return count;
2733}
2734
2735int GetWeaponMaxExp(WEAPON_HAVE *weapon) {
2736 if (weapon == NULL) {
2737 return 0;
2738 }
2739
2740 WEAPON_DATA *data = GetWeaponData(weapon->item_no);
2741
2742 if (data == NULL) {
2743 return 1;
2744 }
2745
2746 int experience = *(s8 *) &data->exp_base;
2747
2748 for (int i = 0; i < weapon->level; i++) {
2749 experience += data->exp_per_level;
2750 }
2751
2752 if (experience > 999) {
2753 experience = 999;
2754 }
2755
2756 if (experience <= 0) {
2757 experience = 99;
2758 }
2759
2760 return experience;
2761}
2762
2763int GetNowItemNum(short item_no, ITEM_PACK *items) {
2764 int count = 0;
2765 int i;
2766 int j;
2767
2768 for (i = 0; i < items->num; i++) {
2769 if (items->item[i] == item_no) {
2770 count++;
2771 }
2772 }
2773
2774 for (j = 0; j < 3; j++) {
2775 if (items->quick_item_slot[j] == item_no) {
2776 count += items->quick_item_qty[j];
2777 }
2778 }
2779
2780 return count;
2781}
2782
2783void DeleteItemAfterUseItem(short item_no, ITEM_PACK *items) {
2784 int deleted = 0;
2785 int i;
2786
2787 for (i = 0; i < items->num; i++) {
2788 if (items->item[i] == item_no) {
2789 items->item[i] = -1;
2790 deleted = 1;
2791 break;
2792 }
2793 }
2794
2795 if (deleted == 0) {
2796 for (i = 0; i < 3; i++) {
2797 if (items->quick_item_slot[i] == item_no) {
2798 items->quick_item_qty[i]--;
2799
2800 if (items->quick_item_qty[i] <= 0) {
2801 items->quick_item_slot[i] = -1;
2802 }
2803
2804 break;
2805 }
2806 }
2807 }
2808}
2809
2810int GetNowModeMaxNum(int page, int *overflow) {
2811 CUserStatus *status = (CUserStatus *) SaveData->GetDngStatus();
2812 int count = 0;
2813
2814 switch (page) {
2815 case BOARD_PAGE_ITEM: {
2816 int i;
2817 int j;
2818 ITEM_PACK *pack = &status->item_pack;
2819 int num;
2820
2821 for (i = 0; i < (num = pack->num) + 3; i++) {
2822 if (pack->item[i] >= ITEM_DUNGEON_START) {
2823 count++;
2824 }
2825 }
2826
2827 for (j = 0; j < 3; j++) {
2828 if (pack->quick_item_slot[j] >= ITEM_DUNGEON_START) {
2829 count += pack->quick_item_qty[j];
2830 }
2831 }
2832
2833 if (overflow != NULL && num < count) {
2834 *overflow = true;
2835 }
2836
2837 break;
2838 }
2839 case BOARD_PAGE_WEAPON:
2840 for (int chara = 0; chara < 6; chara++) {
2841 int i;
2842 WEAPON_HAVE *weapons = status->chara_weapons[chara];
2843
2844 for (i = 0; i < 11; i++) {
2845 if (weapons[i].item_no >= ITEM_WEAPON_START) {
2846 count++;
2847
2848 if (i == 10 && overflow != NULL) {
2849 *overflow = chara + 1;
2850 }
2851 }
2852 }
2853 }
2854
2855 break;
2856 case BOARD_PAGE_ATTACH:
2857 int i;
2858 DNG_CONSUMABLE *items = status->consumable_items;
2859
2860 for (i = 0; i < 43; i++) {
2861 if (items[i].id >= ITEM_ATTACH_START) {
2862 count++;
2863 }
2864 }
2865
2866 if (overflow != NULL && count > 40) {
2867
2868 *overflow = true;
2869 }
2870
2871 break;
2872 }
2873
2874 return count;
2875}
2876
2877void WepDataListToHaveCopy(int weapon_no, WEAPON_HAVE *weapon) {
2878 WEAPON_DATA *data;
2879 int best;
2880 int best_value;
2881 int i;
2882 int j;
2883
2884 if (weapon != NULL && weapon_no > 0) {
2885 if (weapon_no < ITEM_ATTACH_START) {
2886 weapon_no += 0x100;
2887 }
2888
2889 data = GetWeaponData(weapon_no);
2890 memset(weapon, 0, sizeof(WEAPON_HAVE));
2891 weapon->item_no = weapon_no;
2892 weapon->attack = data->attack;
2893 weapon->endurance = data->endurance;
2894 weapon->speed = data->speed;
2895 weapon->magic = data->magic;
2896 weapon->durability = data->durability;
2897 weapon->durability_f = weapon->durability;
2898 best = 5;
2899 best_value = 0;
2900
2901 for (i = 0; i < 5; i++) {
2902 weapon->elem[i] = data->elem[i];
2903
2904 if (weapon->elem[i] > best_value) {
2905 best_value = weapon->elem[i];
2906 best = i;
2907 }
2908 }
2909
2910 weapon->best_elem = best;
2911
2912 for (j = 0; j < 10; j++) {
2913 weapon->vs_monster[j] = data->vs_monster[j];
2914 }
2915
2916 weapon->flags = data->flags;
2917
2918 if (IsDefaultWeapon(weapon->item_no) < 0) {
2919 int chance = rand() % 1000;
2920
2921 if (chance < 1000) {
2922 if (chance < 10) {
2923 weapon->flags |= WEAPONFLAG_DURABLE;
2924 }
2925
2926 if (chance > 989) {
2927 weapon->flags |= WEAPONFLAG_FRAGILE;
2928 }
2929 }
2930 }
2931 }
2932}
2933
2934void AttachDataListToHaveCopy(int attachment_no, ATTACH_LIST *attachment) {
2935 if ((attachment_no < ITEM_ATTACH_START) || (attachment_no >= ITEM_DUNGEON_START)) {
2936 return;
2937 }
2938
2939 if (attachment != NULL) {
2940 memcpy(attachment, GetAttachData(attachment_no), 0x20U);
2941 }
2942}
2943
2944int ItemDataToHaveCopy(int item_no) {
2945 int vol;
2946
2947 if (item_no < ITEM_DUNGEON_START || item_no > ITEM_WEAPON_START - 1) {
2948 return 0;
2949 }
2950
2951 ITEM_DATA *data = GetItemData(item_no);
2952
2953 if (data == NULL) {
2954 return -1;
2955 }
2956
2957 vol = data->vol;
2958
2959 if (item_no == ITEM_DRAN_S_FEATHER) {
2960 int angle = rand() % 360;
2961
2962 if (angle < 180) {
2963 angle += 180;
2964 }
2965
2966 vol = angle * 60;
2967 }
2968
2969 if (item_no >= ITEM_ANTI_FREEZE_AMULET && item_no <= ITEM_ANTIDOTE_AMULET) {
2970 vol = rand() % 5 + 3;
2971 }
2972
2973 printf("vol = %d\n", vol);
2974 return vol;
2975}
2976
2977void DrawFullSizePicture(CTexture *texture, int x, int y, int alpha) {
2978 if (texture != NULL) {
2979#ifdef PAL
2980 CRect_i_ rect(x, y, MenuDispRc.width, MenuDispRc.height);
2981 DrawMenu2DSprite(texture, rect, CRect_i_(0, 0, 640, 448), alpha);
2982#else
2983 DrawMenu2DSprite(texture, CRect_i_(x, y, MenuDispRc.width, MenuDispRc.height), MenuDispRc, alpha);
2984#endif
2985 }
2986}
virtual void Step(int steps)
Definition camera.cpp:13
void GetCameraMatrix(float(*matrix)[4])
Definition camera.cpp:153
void SetRef(CFrame *parent, float x, float y, float z)
Definition camera.cpp:124
void SetPos(CFrame *parent, float x, float y, float z)
Definition camera.cpp:103
void GetPos(float *pos)
Definition camera.cpp:230
int Down(int mask)
Definition gamepad.cpp:583
s32 x
Definition rect.hpp:18
s32 width
Definition rect.hpp:20
s32 height
Definition rect.hpp:21
CDngStatusData * GetDngStatus()
Definition savedata.cpp:250
int QuestDungeon(int dungeon_no, int add)
Definition savedata.cpp:535
int VisitMap(int map_no, int add)
Definition savedata.cpp:521
short block
Definition texture.hpp:52
u_long tex0
Definition texture.hpp:57
ITEM_PACK item_pack
DNG_CONSUMABLE consumable_items[43]
WEAPON_HAVE chara_weapons[6][11]
s8 equipped_weapon_slot[6]
s32 text_rows
Definition clsmes.hpp:158
s32 auto_pos
Definition clsmes.hpp:172
s32 text_y
Definition clsmes.hpp:152
s32 text_from
Definition clsmes.hpp:198
s32 cursor_y
Definition clsmes.hpp:225
s32 text_x
Definition clsmes.hpp:151
float text_rate_set
Definition clsmes.hpp:193
void DrawMesWin()
Definition clsmes.cpp:2619
s32 wait
Definition clsmes.hpp:204
s32 text_no
Definition clsmes.hpp:197
s32 char_height
Definition clsmes.hpp:154
void Step()
Definition clsmes.cpp:575
s32 mes_no[10]
Definition clsmes.hpp:216
void NeedMesWinWH(int mes_no, int *out)
Definition clsmes.cpp:1476
s32 page_from
Definition clsmes.hpp:199
s32 page_arrow
Definition clsmes.hpp:209
s32 narrow_gaiji_set
Definition clsmes.hpp:214
float fade_speed
Definition clsmes.hpp:186
s32 text_height
Definition clsmes.hpp:161
s32 text_width
Definition clsmes.hpp:160
s32 char_width
Definition clsmes.hpp:153
s32 text_columns
Definition clsmes.hpp:157
s32 text_len
Definition clsmes.hpp:159
s32 value
Definition clsmes.hpp:218
void InitMesWinTbl()
Definition clsmes.cpp:1265
s32 waiting
Definition clsmes.hpp:194
s32 cursor_lit
Definition clsmes.hpp:226
s32 auto_page_wait
Definition clsmes.hpp:206
s32 centre_rows
Definition clsmes.hpp:211
s32 fade_in
Definition clsmes.hpp:188
s32 space_width
Definition clsmes.hpp:222
s32 clut_now
Definition clsmes.hpp:203
s32 blink
Definition clsmes.hpp:205
void * tex_buff
Definition clsmes.hpp:233
s32 cursor_row
Definition clsmes.hpp:224
float fade
Definition clsmes.hpp:187
void SetBuff(short *buff)
Definition clsmes.cpp:456
s32 columns
Definition clsmes.hpp:155
s32 mes_made
Definition clsmes.hpp:207
s32 values[8]
Definition clsmes.hpp:217
s32 style
Definition clsmes.hpp:208
s32 value_narrow
Definition clsmes.hpp:221
s32 tex_block
Definition clsmes.hpp:227
s32 value_signed
Definition clsmes.hpp:219
float text_rate
Definition clsmes.hpp:192
s32 stay_frame
Definition clsmes.hpp:189
s32 edge_alpha
Definition clsmes.hpp:213
s32 clut_default
Definition clsmes.hpp:202
MES_LINE_POS line_pos[10]
Definition clsmes.hpp:228
s32 value_show
Definition clsmes.hpp:220
void SetBuff_system(short *buff)
Definition clsmes.cpp:462
void Preset(int style)
Definition clsmes.cpp:468
s32 rows
Definition clsmes.hpp:156
s32 space_area
Definition clsmes.hpp:223
float text_at
Definition clsmes.hpp:196
@ ITEM_SORT_FOOD
Definition itemdata.hpp:23
@ ITEM_SORT_COUNT
Definition itemdata.hpp:31
@ ITEM_SORT_NONE
Definition itemdata.hpp:22
@ WEAPONFLAG_FRAGILE
Definition itemdata.hpp:475
@ WEAPONFLAG_DURABLE
Definition itemdata.hpp:476
@ ATTACHKIND_STAT
Definition itemdata.hpp:645
@ ATTACHKIND_OTHER
Definition itemdata.hpp:648
@ ATTACHKIND_SLAYER
Definition itemdata.hpp:647
@ ATTACHKIND_GEM
Definition itemdata.hpp:646
@ ATTACHKIND_ELEMENT
Definition itemdata.hpp:644
s16 sphere_weapon_no
Definition itemdata.hpp:592
s16 volume
Definition shop.hpp:152
s32 from_page
Definition shop.hpp:148
s16 item_no
Definition shop.hpp:151
s32 from_slot
Definition shop.hpp:150
s16 kind_flags
Definition itemdata.hpp:528
s16 quick_item_slot[3]
s16 quick_item_qty[3]
s16 item_vol[103]
s16 item[103]
WEAPON_HAVE weapon
DNG_CONSUMABLE * consumables
ITEM_PACK * item_pack
ATTACH_LIST held_attach
IHAVEITEM held_item
Definition title.cpp:61
s32 height
Definition rect.hpp:37
int y
Definition title.cpp:63
s16 vs_monster[10]
Definition itemdata.hpp:666
s16 elem[5]
Definition itemdata.hpp:665
s16 exp_per_level
Definition itemdata.hpp:668
float durability_f
Definition itemdata.hpp:695
char vs_monster[10]
Definition itemdata.hpp:699
ATTACH_LIST attach[6]
Definition itemdata.hpp:701
u8 b
Definition rect.hpp:48
u8 g
Definition rect.hpp:47
u8 a
Definition rect.hpp:49
u8 r
Definition rect.hpp:46