1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3#pragma name_counter 459
12#include "menu_draw.hpp"
18int asort_top_type__3 = 1;
21int sort_table__3[9] = {9, 0, 1, 2, 3, 4, 5, 6, 7};
24int asort_table__3[5] = {5, 1, 2, 3, 4};
48 switch (search_space) {
52 if ((item_no >= ITEM_DUNGEON_START) && (item_no <= ITEM_DUNGEON_END)) {
59 if (this->
weapons[slot_index].item_no >= ITEM_WEAPON_START) {
67 if (item_no < ITEM_ATTACH_START) {
80 s16 old_item_no = *item_slot;
81 *item_slot = *item_no;
82 *item_no = old_item_no;
85 s16 old_volume = *volume_slot;
86 *volume_slot = *volume;
110 memcpy(&old_attachment, slot,
sizeof(
ATTACH_LIST));
112 memcpy(attachment, &old_attachment,
sizeof(
ATTACH_LIST));
120 if (item_no < ITEM_ATTACH_START) {
126 if ((item_no > 0 && item_no < ITEM_ATTACH_START) || item_no >= ITEM_WEAPON_START) {
127 for (
int slot_index = 0; slot_index < 30; slot_index++) {
128 if (this->
weapons[slot_index].item_no == item_no) {
133 }
else if (item_no >= ITEM_ATTACH_START && item_no < ITEM_DUNGEON_START) {
134 for (
int slot_index = 0; slot_index < 30; slot_index++) {
135 if (this->
attachments[slot_index].item_no == item_no) {
140 }
else if (item_no >= ITEM_DUNGEON_START && item_no <= ITEM_DUNGEON_END) {
141 for (
int slot_index = 0; slot_index < 60; slot_index++) {
151 printf(
"itemNo [%d] is exist!\n", item_no);
153 printf(
"itemNo [%d] is none!\n", item_no);
160int CompChargeItem(
int first_item_no,
int second_item_no) {
161 ITEM_DATA *first = GetItemData(first_item_no);
162 ITEM_DATA *second = GetItemData(second_item_no);
164 int first_priority = 0;
165 int second_priority = 0;
168 first_priority = sort_table__3[first->
sort_key];
171 if (second != NULL) {
172 second_priority = sort_table__3[second->
sort_key];
175 if (first_item_no < ITEM_DUNGEON_START) {
179 if (second_item_no < ITEM_DUNGEON_START) {
183 if (second_priority < first_priority) {
187 if (first_priority < second_priority) {
191 if (second_item_no < first_item_no) {
195 if (first_item_no < second_item_no) {
203 int sort_type = sort_top_type__3;
209 sort_table__3[sort_type] = first_slot;
221 for (first_slot = 0; first_slot < 59; first_slot++) {
222 for (second_slot = first_slot + 1; second_slot < 60; second_slot++) {
252 int first_priority = asort_table__3[GetAttachKind(first->
item_no)];
253 int second_priority = asort_table__3[GetAttachKind(second->
item_no)];
257 first_item_no = first->
item_no;
259 if (ITEM_ATTACH_START > first_item_no) {
263 second_item_no = second->
item_no;
265 if (ITEM_ATTACH_START > second_item_no) {
269 if (second_priority < first_priority) {
273 if (first_priority < second_priority) {
277 if (first_item_no > second_item_no) {
281 if (first_item_no < second_item_no) {
291static int SeitonAttachBoardSub(
ATTACH_LIST *attachments) {
292 int sort_type = asort_top_type__3;
297 for (first_slot = 0; first_slot < 5; first_slot++) {
298 asort_table__3[sort_type] = first_slot;
301 if (sort_type >= 5) {
306 asort_table__3[0] = 5;
309 for (first_slot = 0; first_slot < 29; first_slot++) {
310 for (second_slot = first_slot + 1; second_slot < 30; second_slot++) {
311 if (CompChargeAttach(&attachments[first_slot], &attachments[second_slot]) > 0) {
312 MenuDataSwap(&attachments[first_slot], &attachments[second_slot]);
322 for (
int attempt = 0; attempt < 5; attempt++) {
323 if (SeitonAttachBoardSub(this->attachments) != 0) {
329 if (asort_top_type__3 >= 5) {
330 asort_top_type__3 = 0;
339 for (
int slot_index = 0; slot_index < slot_counts.
values[search_space]; slot_index++) {
341 empty_slot = slot_index;
ATTACH_LIST attachments[30]
int SearchSpace(int slot_index, int search_space)
int SearchItem(int item_no)
void GetAttachInfo(int slot_index, ATTACH_LIST *attachment)
void SetAttachToPos(int slot_index, ATTACH_LIST *attachment)
void SetWepToPos(int slot_index, WEAPON_HAVE *weapon)
int SeitonChargeItemBoardSub()
int GetNowModeSpace(int search_space)
void GetItemInfo(int slot_index, s16 *item_no, s16 *volume)
s16 dungeon_item_vols[60]
void GetWeaponInfo(int slot_index, WEAPON_HAVE *weapon)
void SetItemToPos(int slot_index, s16 *item_no, s16 *volume)
int CompChargeItem(int first_item_no, int second_item_no)
@ SEARCHSPACE_DUNGEON_ITEMS