233 lines
5.5 KiB
C
233 lines
5.5 KiB
C
#include "equipment.h"
|
|
|
|
#include "common.h"
|
|
#include "element.h"
|
|
|
|
/* 45480 8016F580 */
|
|
u8 equipment_get_field_0x1b(EquipmentId index) {
|
|
return obEquipmentData[index].field_0x1b;
|
|
}
|
|
|
|
/* 45498 8016F598 */
|
|
u8 equipment_get_field_0x1c(EquipmentId index) {
|
|
return obEquipmentData[index].field_0x1c;
|
|
}
|
|
|
|
/* 454B0 8016F5B0 */
|
|
char* obEquipmentGetName(EquipmentId index) {
|
|
return obEquipmentData[index].name;
|
|
}
|
|
|
|
/* 454C8 8016F5C8 */
|
|
EquipmentType obEquipmentGetType(EquipmentId index) {
|
|
return obEquipmentData[index].type;
|
|
}
|
|
|
|
/* 454E0 8016F5E0 */
|
|
Element obEquipmentGetElement(EquipmentId index) {
|
|
Element element;
|
|
|
|
element = obEquipmentData[index].element;
|
|
if (element == ELEMENT_UNKNOWN_0x10) {
|
|
element = CHARACTER_SLOT[0].element;
|
|
}
|
|
return element;
|
|
}
|
|
|
|
/* 45514 8016F614 */
|
|
u8 equipment_get_field_0x6(EquipmentId index) {
|
|
return obEquipmentData[index].field_0x6;
|
|
}
|
|
|
|
/* 4552C 8016F62C */
|
|
u16 obEquipmentGetBuyPrice(EquipmentId index) {
|
|
return obEquipmentData[index].buy_price;
|
|
}
|
|
|
|
/* 45544 8016F644 */
|
|
s8 equipment_get_field_0x10(EquipmentId index) {
|
|
return obEquipmentData[index].field_0x10;
|
|
}
|
|
|
|
/* 4555C 8016F65C */
|
|
s8 obEquipmentGetStrength(EquipmentId index) {
|
|
s8 ret;
|
|
if (index == EQUIPMENT_ID_GALLANT_DOLL) {
|
|
ret = CHARACTER_SLOT[0].strength / 20;
|
|
} else {
|
|
ret = obEquipmentData[index].strength;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
/* 455AC 8016F6AC */
|
|
s8 obEquipmentGetVitality(EquipmentId index) {
|
|
s8 ret;
|
|
if (index == EQUIPMENT_ID_GALLANT_DOLL) {
|
|
ret = CHARACTER_SLOT[0].vitality / 20;
|
|
} else {
|
|
ret = obEquipmentData[index].vitality;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
/* 455FC 8016F6FC */
|
|
s8 obEquipmentGetIntelligence(EquipmentId index) {
|
|
s8 ret;
|
|
if (index == EQUIPMENT_ID_GALLANT_DOLL) {
|
|
ret = CHARACTER_SLOT[0].intelligence / 20;
|
|
} else {
|
|
ret = obEquipmentData[index].intelligence;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
/* 4564C 8016F74C */
|
|
s8 obEquipmentGetMentality(EquipmentId index) {
|
|
s8 ret;
|
|
if (index == EQUIPMENT_ID_GALLANT_DOLL) {
|
|
ret = CHARACTER_SLOT[0].mentality / 20;
|
|
} else {
|
|
ret = obEquipmentData[index].mentality;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
/* 4569C 8016F79C */
|
|
s8 obEquipmentGetAgility(EquipmentId index) {
|
|
s8 ret;
|
|
if (index == EQUIPMENT_ID_GALLANT_DOLL) {
|
|
ret = CHARACTER_SLOT[0].agility / 20;
|
|
} else {
|
|
ret = obEquipmentData[index].agility;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
/* 456EC 8016F7EC */
|
|
s8 obEquipmentGetDexterity(EquipmentId index) {
|
|
s8 ret;
|
|
if (index == EQUIPMENT_ID_GALLANT_DOLL) {
|
|
ret = CHARACTER_SLOT[0].dexterity / 20;
|
|
} else {
|
|
ret = obEquipmentData[index].dexterity;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
/* 4573C 8016F83C */
|
|
s8 obEquipmentGetResistanceStrike(EquipmentId index) {
|
|
return obEquipmentData[index].res_strike;
|
|
}
|
|
|
|
/* 45754 8016F854 */
|
|
s8 obEquipmentGetResistanceWind(EquipmentId index) {
|
|
return obEquipmentData[index].res_wind;
|
|
}
|
|
|
|
/* 4576C 8016F86C */
|
|
s8 obEquipmentGetResistanceFire(EquipmentId index) {
|
|
return obEquipmentData[index].res_fire;
|
|
}
|
|
|
|
/* 45784 8016F884 */
|
|
s8 obEquipmentGetResistanceEarth(EquipmentId index) {
|
|
return obEquipmentData[index].res_earth;
|
|
}
|
|
|
|
/* 4579C 8016F89C */
|
|
s8 obEquipmentGetResistanceWater(EquipmentId index) {
|
|
return obEquipmentData[index].res_water;
|
|
}
|
|
|
|
/* 457B4 8016F8B4 */
|
|
s8 obEquipmentGetResistanceVirtue(EquipmentId index) {
|
|
return obEquipmentData[index].res_holy;
|
|
}
|
|
|
|
/* 457CC 8016F8CC */
|
|
s8 obEquipmentGetResistanceBane(EquipmentId index) {
|
|
return obEquipmentData[index].res_dark;
|
|
}
|
|
|
|
/* 457E4 8016F8E4 */
|
|
u8 equipment_get_field_0x18_b68(EquipmentId index) {
|
|
return obEquipmentData[index].field_0x18 >> 6;
|
|
}
|
|
|
|
/* 45800 8016F900 */
|
|
u8 equipment_get_field_0x18_b46(EquipmentId index) {
|
|
return (obEquipmentData[index].field_0x18 >> 4) & 3;
|
|
}
|
|
|
|
/* 45820 8016F920 */
|
|
u8 equipment_get_field_0x18_b24(EquipmentId index) {
|
|
return (obEquipmentData[index].field_0x18 >> 2) & 3;
|
|
}
|
|
|
|
/* 45840 8016F940 */
|
|
u8 equipment_get_field_0x18_b12(EquipmentId index) {
|
|
return obEquipmentData[index].field_0x18 & 3;
|
|
}
|
|
|
|
/* 4585C 8016F95C */
|
|
u8 equipment_get_field_0x19_b68(EquipmentId index) {
|
|
return obEquipmentData[index].field_0x19 >> 6;
|
|
}
|
|
|
|
/* 45878 8016F978 */
|
|
u8 equipment_get_field_0x19_b46(EquipmentId index) {
|
|
return (obEquipmentData[index].field_0x19 >> 4) & 3;
|
|
}
|
|
|
|
/* 45898 8016F998 */
|
|
u8 equipment_get_field_0x19_b24(EquipmentId index) {
|
|
return (obEquipmentData[index].field_0x19 >> 2) & 3;
|
|
}
|
|
|
|
/* 458B8 8016F9B8 */
|
|
u8 equipment_get_field_0x19_b12(EquipmentId index) {
|
|
return obEquipmentData[index].field_0x19 & 3;
|
|
}
|
|
|
|
/* 458D4 8016F9D4 */
|
|
u8 equipment_get_field_0x1a_b7(EquipmentId index) {
|
|
return obEquipmentData[index].field_0x1a >> 7;
|
|
}
|
|
|
|
/* 458F0 8016F9F0 */
|
|
bool obEquipmentIsWeapon(EquipmentId index) {
|
|
s32 type = obEquipmentData[index].type;
|
|
|
|
if (type != 0) {
|
|
if (type < EQUIPMENT_TYPE_SMALL_SHIELD) {
|
|
return true;
|
|
}
|
|
if (type == EQUIPMENT_TYPE_FAN) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
INCLUDE_ASM(const s32, "equipment", obEquipmentGetFirstWeapon);
|
|
|
|
/* 45A50 8016FB50 */
|
|
EquipmentId obEquipmentGetFirstSpellbook(EquipmentId arg0, EquipmentId arg1, EquipmentId arg2, EquipmentId arg3) {
|
|
if (obEquipmentData[arg0].type == EQUIPMENT_TYPE_SPELLBOOK)
|
|
return arg0;
|
|
|
|
if (obEquipmentData[arg1].type == EQUIPMENT_TYPE_SPELLBOOK)
|
|
return arg1;
|
|
|
|
if (obEquipmentData[arg2].type == EQUIPMENT_TYPE_SPELLBOOK)
|
|
return arg2;
|
|
|
|
if (obEquipmentData[arg3].type == EQUIPMENT_TYPE_SPELLBOOK)
|
|
return arg3;
|
|
|
|
return 0;
|
|
}
|
|
|