ogrebattle64/src/item.c

504 lines
12 KiB
C

#include "common.h"
INCLUDE_ASM(const s32, "item", func_8016D200);
INCLUDE_ASM(const s32, "item", func_8016D254);
INCLUDE_ASM(const s32, "item", func_8016D2A8);
INCLUDE_ASM(const s32, "item", func_8016D2FC);
INCLUDE_ASM(const s32, "item", func_8016D350);
INCLUDE_ASM(const s32, "item", func_8016D3A4);
INCLUDE_ASM(const s32, "item", func_8016D3F8);
INCLUDE_ASM(const s32, "item", func_8016D44C);
INCLUDE_ASM(const s32, "item", func_8016D4A0);
INCLUDE_ASM(const s32, "item", func_8016D4F4);
INCLUDE_ASM(const s32, "item", func_8016D548);
INCLUDE_ASM(const s32, "item", func_8016D59C);
INCLUDE_ASM(const s32, "item", func_8016D5F0);
INCLUDE_ASM(const s32, "item", func_8016D644);
INCLUDE_ASM(const s32, "item", func_8016D698);
INCLUDE_ASM(const s32, "item", func_8016D6EC);
INCLUDE_ASM(const s32, "item", func_8016D740);
INCLUDE_ASM(const s32, "item", func_8016D794);
INCLUDE_ASM(const s32, "item", func_8016D7E8);
INCLUDE_ASM(const s32, "item", func_8016D83C);
INCLUDE_ASM(const s32, "item", func_8016D890);
INCLUDE_ASM(const s32, "item", func_8016D8E4);
INCLUDE_ASM(const s32, "item", func_8016D938);
INCLUDE_ASM(const s32, "item", func_8016D98C);
INCLUDE_ASM(const s32, "item", func_8016D9E0);
INCLUDE_ASM(const s32, "item", func_8016DA34);
INCLUDE_ASM(const s32, "item", func_8016DA88);
INCLUDE_ASM(const s32, "item", func_8016DADC);
INCLUDE_ASM(const s32, "item", func_8016DB30);
INCLUDE_ASM(const s32, "item", func_8016DB84);
/* 43AD8 8016DBD8 */
u8 class_get_field_0x2c(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].field_0x2c;
return CLASS_DATA[class].field_0x2c;
}
/* 43B2C 8016DC2C */
u8 class_get_ability_front(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].ability_front;
return CLASS_DATA[class].ability_front;
}
/* 43B80 8016DC80 */
u8 class_get_ability_front_hitcount(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].ability_front_hitcount;
return CLASS_DATA[class].ability_front_hitcount;
}
/* 43BD4 8016DCD4 */
u8 class_get_ability_middle(u8 portrait, u8 class) {
s32 var_v0;
if (CLASS_DATA[portrait].field_0x45 != class) {
var_v0 = class * 9;
} else {
var_v0 = CLASS_DATA[portrait].field_0x45 * 9;
}
return *(&CLASS_DATA->ability_middle + (var_v0 * 8));
}
/* 43C20 8016DD20 */
u8 class_get_ability_middle_hitcount(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].ability_middle_hitcount;
return CLASS_DATA[class].ability_middle_hitcount;
}
/* 43C74 8016DD74 */
u8 class_get_ability_back(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].ability_back;
return CLASS_DATA[class].ability_back;
}
/* 43CC8 8016DDC8 */
u8 class_get_ability_back_hitcount(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].ability_back_hitcount;
return CLASS_DATA[class].ability_back_hitcount;
}
/* 43D1C 8016DE1C */
u8 class_get_field_0x4(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].field_0x4;
return CLASS_DATA[class].field_0x4;
}
/* 43D70 8016DE70 */
u8 class_get_gender(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].gender;
return CLASS_DATA[class].gender;
}
/* 43DC4 8016DEC4 */
u8 class_get_leadership_rank(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].leadership_rank;
return CLASS_DATA[class].leadership_rank;
}
/* 43E18 8016DF18 */
u8 class_get_global_flag(u8 portrait, u8 class) {
u8 var_a1;
var_a1 = class;
if (D_8018ECE4[portrait].field_0x0 & 0x80) {
if (CLASS_DATA[portrait].field_0x45 == var_a1) {
var_a1 = portrait;
}
}
return D_8018ECE4[var_a1].field_0x0 & 0x3F;
}
/* 43E88 8016DF88 */
ItemId class_get_item_upper_left(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].item_upper_left;
return CLASS_DATA[class].item_upper_left;
}
/* 43EDC 8016DFDC */
ItemId class_get_item_upper_right(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].item_upper_right;
return CLASS_DATA[class].item_upper_right;
}
/* 43F30 8016E030 */
ItemId class_get_item_lower_left(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].item_lower_left;
return CLASS_DATA[class].item_lower_left;
}
/* 43F84 8016E084 */
ItemId class_get_item_lower_right(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].item_lower_right;
return CLASS_DATA[class].item_lower_right;
}
/* 43FD8 8016E0D8 */
char* class_get_ability_front_name(u8 portrait, u8 class) {
u8 var_v0;
if (CLASS_DATA[portrait].field_0x45 == class) {
var_v0 = CLASS_DATA[portrait].ability_front;
} else {
var_v0 = CLASS_DATA[class].ability_front;
}
return ability_get_name(var_v0);
}
/* 44040 8016E140 */
char* class_get_ability_middle_name(u8 portrait, u8 class) {
// Possible a C macro wrapping?
do {
char* ret = ability_get_name(CLASS_DATA[class].ability_middle);
return ret;
} while(0);
}
/* 44074 8016E174 */
char* class_get_ability_back_name(u8 portrait, u8 class) {
u8 var_v0;
if (CLASS_DATA[portrait].field_0x45 == class) {
var_v0 = CLASS_DATA[portrait].ability_back;
} else {
var_v0 = CLASS_DATA[class].ability_back;
}
return ability_get_name(var_v0);
}
/* 440DC 8016E1DC */
char* class_get_name(u8 portrait, u8 class) {
if (CLASS_DATA[portrait].field_0x45 == class)
return CLASS_DATA[portrait].name;
return CLASS_DATA[class].name;
}
INCLUDE_ASM(const s32, "item", func_8016E230);
INCLUDE_ASM(const s32, "item", func_8016E338);
/* 44340 8016E440 */
char* ability_get_name(u8 index) {
return ABILITY_DATA[index].name;
}
/* 44358 8016E458 */
u8 func_8016E458(u8 index) {
return ABILITY_DATA[index].field_0x0;
}
/* 44370 8016E470 */
Element ability_get_element(u8 index, u16 arg1, u16 arg2, s32 arg3, u16 arg4) {
u16 item_index;
if (ABILITY_DATA[index].element != ELEMENT_INVALID && ABILITY_DATA[index].element != 0xF)
return ABILITY_DATA[index].element;
if (ABILITY_DATA[index].field_0x0 == 3) {
item_index = func_8016FB50(arg1, arg2, arg3, arg4);
} else {
item_index = func_8016FA34(arg1, arg2, arg3, arg4);
}
if (item_index == 0)
return 0;
return item_get_element(item_index);
}
INCLUDE_ASM(const s32, "item", func_8016E50C);
INCLUDE_ASM(const s32, "item", func_8016EA34);
INCLUDE_ASM(const s32, "item", func_8016EAEC);
INCLUDE_ASM(const s32, "item", func_8016EBA4);
INCLUDE_ASM(const s32, "item", func_8016F11C);
INCLUDE_ASM(const s32, "item", func_8016F4E0);
INCLUDE_ASM(const s32, "item", func_8016F500);
INCLUDE_ASM(const s32, "item", func_8016F520);
INCLUDE_ASM(const s32, "item", func_8016F540);
INCLUDE_ASM(const s32, "item", func_8016F560);
/* 45480 8016F580 */
u8 func_8016F580(ItemId index) {
return ITEM_DATA[index].field_0x1b;
}
/* 45498 8016F598 */
u8 func_8016F598(ItemId index) {
return ITEM_DATA[index].field_0x1c;
}
/* 454B0 8016F5B0 */
char* item_get_name(ItemId index) {
return ITEM_DATA[index].name;
}
/* 454C8 8016F5C8 */
ItemType item_get_type(ItemId index) {
return ITEM_DATA[index].type;
}
/* 454E0 8016F5E0 */
Element item_get_element(ItemId index) {
Element element;
element = ITEM_DATA[index].element;
if (element == ELEMENT_UNKNOWN_0x10) {
element = CHARACTER_SLOT[0].element;
}
return element;
}
/* 45514 8016F614 */
u8 item_get_field_0x6(ItemId index) {
return ITEM_DATA[index].field_0x6;
}
/* 4552C 8016F62C */
u16 item_get_buy_price(ItemId index) {
return ITEM_DATA[index].buy_price;
}
/* 45544 8016F644 */
s8 item_get_field_0x10(ItemId index) {
return ITEM_DATA[index].field_0x10;
}
/* 4555C 8016F65C */
s8 item_get_strength(ItemId index) {
s8 ret;
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].strength / 20;
} else {
ret = ITEM_DATA[index].strength;
}
return ret;
}
/* 455AC 8016F6AC */
s8 item_get_vitality(ItemId index) {
s8 ret;
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].vitality / 20;
} else {
ret = ITEM_DATA[index].vitality;
}
return ret;
}
/* 455FC 8016F6FC */
s8 item_get_intelligence(ItemId index) {
s8 ret;
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].intelligence / 20;
} else {
ret = ITEM_DATA[index].intelligence;
}
return ret;
}
/* 4564C 8016F74C */
s8 item_get_mentality(ItemId index) {
s8 ret;
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].mentality / 20;
} else {
ret = ITEM_DATA[index].mentality;
}
return ret;
}
/* 4569C 8016F79C */
s8 item_get_agility(ItemId index) {
s8 ret;
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].agility / 20;
} else {
ret = ITEM_DATA[index].agility;
}
return ret;
}
/* 456EC 8016F7EC */
s8 item_get_dexterity(ItemId index) {
s8 ret;
if (index == ITEM_ID_GALLANT_DOLL) {
ret = CHARACTER_SLOT[0].dexterity / 20;
} else {
ret = ITEM_DATA[index].dexterity;
}
return ret;
}
/* 4573C 8016F83C */
s8 item_get_resistance_strike(ItemId index) {
return ITEM_DATA[index].res_strike;
}
/* 45754 8016F854 */
s8 item_get_resistance_wind(ItemId index) {
return ITEM_DATA[index].res_wind;
}
/* 4576C 8016F86C */
s8 item_get_resistance_fire(ItemId index) {
return ITEM_DATA[index].res_fire;
}
/* 45784 8016F884 */
s8 item_get_resistance_earth(ItemId index) {
return ITEM_DATA[index].res_earth;
}
/* 4579C 8016F89C */
s8 item_get_resistance_water(ItemId index) {
return ITEM_DATA[index].res_water;
}
/* 457B4 8016F8B4 */
s8 item_get_resistance_holy(ItemId index) {
return ITEM_DATA[index].res_holy;
}
/* 457CC 8016F8CC */
s8 item_get_resistance_dark(ItemId index) {
return ITEM_DATA[index].res_dark;
}
/* 457E4 8016F8E4 */
u8 item_get_field_0x18_b68(ItemId index) {
return ITEM_DATA[index].field_0x18 >> 6;
}
/* 45800 8016F900 */
u8 item_get_field_0x18_b46(ItemId index) {
return (ITEM_DATA[index].field_0x18 >> 4) & 3;
}
/* 45820 8016F920 */
u8 item_get_field_0x18_b24(ItemId index) {
return (ITEM_DATA[index].field_0x18 >> 2) & 3;
}
/* 45840 8016F940 */
u8 item_get_field_0x18_b12(ItemId index) {
return ITEM_DATA[index].field_0x18 & 3;
}
/* 4585C 8016F95C */
u8 item_get_field_0x19_b68(ItemId index) {
return ITEM_DATA[index].field_0x19 >> 6;
}
/* 45878 8016F978 */
u8 item_get_field_0x19_b46(ItemId index) {
return (ITEM_DATA[index].field_0x19 >> 4) & 3;
}
/* 45898 8016F998 */
u8 item_get_field_0x19_b24(ItemId index) {
return (ITEM_DATA[index].field_0x19 >> 2) & 3;
}
/* 458B8 8016F9B8 */
u8 item_get_field_0x19_b12(ItemId index) {
return ITEM_DATA[index].field_0x19 & 3;
}
/* 458D4 8016F9D4 */
u8 func_8016F9D4(ItemId index) {
return ITEM_DATA[index].field_0x1a >> 7;
}
/* 458F0 8016F9F0 */
u8 item_is_weapon(ItemId index) {
s32 type = ITEM_DATA[index].type;
if (type != 0) {
if (type < ITEM_TYPE_SMALL_SHIELD) {
return 1;
}
if (type == ITEM_TYPE_FAN) {
return 1;
}
}
return 0;
}
INCLUDE_ASM(const s32, "item", func_8016FA34);
INCLUDE_ASM(const s32, "item", func_8016FB50);
INCLUDE_ASM(const s32, "item", func_8016FBE0);
INCLUDE_ASM(const s32, "item", func_8016FCEC);