115 lines
2.7 KiB
C
115 lines
2.7 KiB
C
#include "ability.h"
|
|
|
|
#include "common.h"
|
|
#include "equipment.h"
|
|
#include "class.h"
|
|
|
|
/* 44340 8016E440 */
|
|
char* obAbilityGetName(u8 index) {
|
|
return obAbilityData[index].name;
|
|
}
|
|
|
|
/* 44358 8016E458 */
|
|
u8 ability_get_field_0x4(u8 index) {
|
|
return obAbilityData[index].field_0x4;
|
|
}
|
|
|
|
/* 44370 8016E470 */
|
|
Element obAbilityGetElement(u8 index, u16 arg1, u16 arg2, s32 arg3, u16 arg4) {
|
|
u16 item_index;
|
|
|
|
if (obAbilityData[index].element != ELEMENT_INVALID && obAbilityData[index].element != 0xF)
|
|
return obAbilityData[index].element;
|
|
|
|
if (obAbilityData[index].field_0x4 == 3) {
|
|
item_index = obEquipmentGetFirstSpellbook(arg1, arg2, arg3, arg4);
|
|
} else {
|
|
item_index = obEquipmentGetFirstWeapon(arg1, arg2, arg3, arg4);
|
|
}
|
|
|
|
if (item_index == 0)
|
|
return ELEMENT_PHYSICAL;
|
|
|
|
return obEquipmentGetElement(item_index);
|
|
}
|
|
|
|
|
|
INCLUDE_ASM(const s32, "ability", func_8016E50C);
|
|
|
|
// INCLUDE_ASM(const s32, "ability", func_8016EA34);
|
|
|
|
/* 44934 8016EA34 */
|
|
u8 func_8016EA34(u8 portrait, u8 class, u8 arg2)
|
|
{
|
|
if (obClassData[portrait].field_0x45 != class)
|
|
portrait = class;
|
|
|
|
portrait = (obClassData[portrait].field_0x42 != 0xFF && arg2 < obClassData[portrait].field_0x42) ?
|
|
obClassData[portrait].field_0x41 :
|
|
(obClassData[portrait].field_0x44 != 0xFF && arg2 < obClassData[portrait].field_0x44) ?
|
|
obClassData[portrait].field_0x43 : portrait;
|
|
|
|
return portrait;
|
|
}
|
|
|
|
|
|
/* 449EC 8016EAEC */
|
|
u16 character_get_item(CharacterSlot* character, u8 slot) {
|
|
u16 item_id;
|
|
|
|
item_id = 0;
|
|
switch(slot) {
|
|
case 0:
|
|
item_id = character->item_upper_left;
|
|
break;
|
|
|
|
case 1:
|
|
item_id = character->item_upper_right;
|
|
break;
|
|
|
|
case 2:
|
|
item_id = character->item_lower_left;
|
|
break;
|
|
|
|
case 3:
|
|
item_id = character->item_lower_right;
|
|
break;
|
|
}
|
|
|
|
if (item_id == 0) {
|
|
item_id = FP_CLASS_GET_ITEM_1[slot](character->portrait, character->class);
|
|
}
|
|
return item_id;
|
|
}
|
|
|
|
|
|
INCLUDE_ASM(const s32, "ability", __character_handle_levelup);
|
|
|
|
INCLUDE_ASM(const s32, "ability", __character_initialise);
|
|
|
|
/* 453E0 8016F4E0 */
|
|
char *obItemGetName(u16 arg0) {
|
|
return obItemData[arg0].name;
|
|
}
|
|
|
|
/* 45400 8016F500 */
|
|
u8 item_get_field_0x4(u16 arg0) {
|
|
return obItemData[arg0].field_0x4;
|
|
}
|
|
|
|
/* 45420 8016F520 */
|
|
u8 item_get_field_0x5(u16 arg0) {
|
|
return obItemData[arg0].field_0x5;
|
|
}
|
|
|
|
/* 45440 8016F540 */
|
|
u8 item_get_field_0x8(u16 arg0) {
|
|
return obItemData[arg0].field_0x8;
|
|
}
|
|
|
|
/* 45460 8016F560 */
|
|
u8 item_get_field_0x9(u16 arg0) {
|
|
return obItemData[arg0].field_0x9;
|
|
}
|
|
|