add a lot of dComIfGs inlines (#65)

* item_func inlines

* some getcheck func inlines

* remove asm

* format

* format

Co-authored-by: Pheenoh <pheenoh@gmail.com>
This commit is contained in:
TakaRikka 2021-01-05 08:48:08 -08:00 committed by GitHub
parent d89fb99506
commit e9607ae760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 412 additions and 366 deletions

View File

@ -1,12 +0,0 @@
/* 80141264 0013E1A4 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 80141268 0013E1A8 7C 08 02 A6 */ mflr r0
/* 8014126C 0013E1AC 90 01 00 14 */ stw r0, 0x14(r1)
/* 80141270 0013E1B0 7C 64 1B 78 */ mr r4, r3
/* 80141274 0013E1B4 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha
/* 80141278 0013E1B8 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l
/* 8014127C 0013E1BC 38 63 00 CC */ addi r3, r3, 0xcc
/* 80141280 0013E1C0 4B EF 2C 49 */ bl isFirstBit__21dSv_player_get_item_cCFUc
/* 80141284 0013E1C4 80 01 00 14 */ lwz r0, 0x14(r1)
/* 80141288 0013E1C8 7C 08 03 A6 */ mtlr r0
/* 8014128C 0013E1CC 38 21 00 10 */ addi r1, r1, 0x10
/* 80141290 0013E1D0 4E 80 00 20 */ blr

View File

@ -44,11 +44,6 @@ struct csXyz { // move later
class daAlink_c {
public:
// inlines
void dComIfGp_setZStatus(u8 status, u8 unk) {
g_dComIfG_gameInfo.getPlay().setZStatus(status, unk);
}
// member functions
u32 getE3Zhint(void);
const char* getAlinkArcName(void);

View File

@ -14,24 +14,24 @@
#include "d/d_vibration/d_vibration.h"
struct item_func {
float hearts; // bf80
u32 rupees; // bf84
s16 small_keys; // bf88
s16 kakera_heart; // bf8a
s16 magic; // bf8c
u16 unk; // bf8e
s16 magic_lv; // bf90
u8 unk2[2]; // bf92/93 // removed stuff?
u32 unk3; // bf94 //related to lantern?
u32 unk4; // bf98 //related to lantern?
u32 unk5; // bf9c //related to lantern?
u32 unk6; // bfa0 //related to oxygen?
u32 unk7; // bfa4 //related to oxygen?
u32 unk8; // bfa8 //related to oxygen?
u32 unk9; // bfac //related to oxygen?
u32 unk10; // bfb0 //related to oxygen?
s16 arrows; // bfb4
s16 seeds; // bfb6
float hearts; // bf80
u32 rupees; // bf84
s16 small_keys; // bf88
s16 max_life; // bf8a
s16 magic; // bf8c
u16 unk; // bf8e
s16 magic_lv; // bf90
u8 unk2[2]; // bf92/93 // removed stuff?
u32 unk3; // bf94 //related to lantern?
u32 unk4; // bf98 //related to lantern?
u32 unk5; // bf9c //related to lantern?
int oxygen; // bfa0
u32 unk7; // bfa4 //related to oxygen?
int max_oxygen; // bfa8
u32 unk9; // bfac //related to oxygen?
u32 unk10; // bfb0 //related to oxygen?
s16 arrows; // bfb4
s16 seeds; // bfb6
};
class dComIfG_camera_info_class {
@ -72,6 +72,19 @@ public:
field_0x4ec0[0x3B] = status;
field_0x4ec0[0x56] = unk;
}
void setItemLifeCount(float hearts, u8 unk) {
give_item.hearts += hearts;
unk_heart = unk;
}
void setItemRupeeCount(long rupees) { give_item.rupees += rupees; }
void setItemMagicCount(short magic) { give_item.magic += magic; }
void setItemMaxMagicCount(short max) { give_item.magic_lv += max; }
void setItemArrowNumCount(short arrows) { give_item.arrows += arrows; }
void setItemPachinkoNumCount(short seeds) { give_item.seeds += seeds; }
void setItemKeyNumCount(short keys) { give_item.small_keys += keys; }
void setItemMaxLifeCount(short max) { give_item.max_life += max; }
void setOxygen(long oxygen) { give_item.oxygen = oxygen; }
void setMaxOxygen(long max) { give_item.max_oxygen = max; }
private:
/* 0x00000 */ dBgS dbgs;
@ -132,6 +145,8 @@ public:
dDlst_peekZ_c& getdlstPeekZ() { return draw_list_list.dlstPeekZ; }
dComIfG_play_c& getPlay() { return play; }
dSv_memory_c& getMemory() { return info.getMemory(); }
dSv_event_c& getEvent() { return info.getEvent(); }
dSv_info_c& getInfo() { return info; }
private:
/* 0x00000 */ dSv_info_c info;
@ -166,6 +181,151 @@ private:
extern dComIfG_inf_c g_dComIfG_gameInfo;
int dComIfGs_isItemFirstBit(u8);
inline void dComIfGp_setZStatus(u8 status, u8 unk) {
g_dComIfG_gameInfo.getPlay().setZStatus(status, unk);
}
inline void dComIfGp_setItemLifeCount(float amount, u8 unk) {
g_dComIfG_gameInfo.getPlay().setItemLifeCount(amount, unk);
}
inline void dComIfGp_setItemRupeeCount(long amount) {
g_dComIfG_gameInfo.getPlay().setItemRupeeCount(amount);
}
inline void dComIfGp_setItemMagicCount(short amount) {
g_dComIfG_gameInfo.getPlay().setItemMagicCount(amount);
}
inline void dComIfGp_setItemMaxMagicCount(short max) {
g_dComIfG_gameInfo.getPlay().setItemMaxMagicCount(max);
}
inline void dComIfGp_setItemArrowNumCount(short amount) {
g_dComIfG_gameInfo.getPlay().setItemArrowNumCount(amount);
}
inline void dComIfGp_setItemPachinkoNumCount(short amount) {
g_dComIfG_gameInfo.getPlay().setItemPachinkoNumCount(amount);
}
inline void dComIfGp_setItemKeyNumCount(short amount) {
g_dComIfG_gameInfo.getPlay().setItemKeyNumCount(amount);
}
inline void dComIfGp_setItemMaxLifeCount(short max) {
g_dComIfG_gameInfo.getPlay().setItemMaxLifeCount(max);
}
inline void dComIfGs_onDungeonItemMap(void) {
g_dComIfG_gameInfo.getMemory().getTempFlags().onDungeonItemMap();
}
inline void dComIfGs_onDungeonItemCompass(void) {
g_dComIfG_gameInfo.getMemory().getTempFlags().onDungeonItemCompass();
}
inline void dComIfGs_onDungeonItemWarp(void) {
g_dComIfG_gameInfo.getMemory().getTempFlags().onDungeonItemWarp();
}
inline void dComIfGs_setItem(int slot, u8 i_no) {
g_dComIfG_gameInfo.getSaveFile().getPlayerItem().setItem(slot, i_no);
}
inline void dComIfGs_setOxygen(long amount) {
g_dComIfG_gameInfo.getPlay().setOxygen(amount);
}
inline void dComIfGs_setMaxOxygen(long max) {
g_dComIfG_gameInfo.getPlay().setMaxOxygen(max);
}
inline void dComIfGs_setOil(u16 amount) {
g_dComIfG_gameInfo.getSaveFile().getPlayerStatusA().setOil(amount);
}
inline void dComIfGs_setMaxOil(u16 max) {
g_dComIfG_gameInfo.getSaveFile().getPlayerStatusA().setMaxOil(max);
}
inline void dComIfGs_setWalletSize(u8 size) {
g_dComIfG_gameInfo.getSaveFile().getPlayerStatusA().setWalletSize(size);
}
inline void dComIfGs_setMagic(u8 amount) {
g_dComIfG_gameInfo.getSaveFile().getPlayerStatusA().setMagic(amount);
}
inline void dComIfGs_setMaxMagic(u8 max) {
g_dComIfG_gameInfo.getSaveFile().getPlayerStatusA().setMaxMagic(max);
}
inline void dComIfGs_setRupee(u16 amount) {
g_dComIfG_gameInfo.getSaveFile().getPlayerStatusA().setRupee(amount);
}
inline void dComIfGs_setLife(u16 amount) {
g_dComIfG_gameInfo.getSaveFile().getPlayerStatusA().setLife(amount);
}
inline void dComIfGs_setMaxLife(u8 max) {
g_dComIfG_gameInfo.getSaveFile().getPlayerStatusA().setMaxLife(max);
}
inline void dComIfGs_onDungeonItemBossKey(void) {
g_dComIfG_gameInfo.getMemory().getTempFlags().onDungeonItemBossKey();
}
inline void dComIfGs_setCollectSword(u8 sword_id) {
g_dComIfG_gameInfo.getSaveFile().getPlayerCollect().setCollect(SWORD_BITFIELD, sword_id);
}
inline void dComIfGs_setCollectShield(u8 shield_id) {
g_dComIfG_gameInfo.getSaveFile().getPlayerCollect().setCollect(SHIELD_BITFIELD, shield_id);
}
inline void dComIfGs_setCollectClothes(u8 clothes_id) {
g_dComIfG_gameInfo.getSaveFile().getPlayerCollect().setCollect(CLOTHING_BITFIELD, clothes_id);
}
inline void dComIfGs_setRodTypeLevelUp(void) {
g_dComIfG_gameInfo.getSaveFile().getPlayerItem().setRodTypeLevelUp();
}
inline void dComIfGs_setArrowNum(u8 amount) {
g_dComIfG_gameInfo.getSaveFile().getPlayerItemRecord().setArrowNum(amount);
}
inline void dComIfGs_setArrowMax(u8 max) {
g_dComIfG_gameInfo.getSaveFile().getPlayerItemMax().setArrowNum(max);
}
inline u8 dComIfGs_getPachinkoMax(void) {
return 50;
}
inline void dComIfGs_setEmptyBombBag(void) {
g_dComIfG_gameInfo.getSaveFile().getPlayerItem().setEmptyBombBag();
}
inline void dComIfGs_setEmptyBombBag(u8 type, u8 amount) {
g_dComIfG_gameInfo.getSaveFile().getPlayerItem().setEmptyBombBag(type, amount);
}
inline void dComIfGs_setEmptyBombBagItemIn(u8 type, bool unk) {
g_dComIfG_gameInfo.getSaveFile().getPlayerItem().setEmptyBombBagItemIn(type, unk);
}
inline void dComIfGs_setEmptyBottle(void) {
g_dComIfG_gameInfo.getSaveFile().getPlayerItem().setEmptyBottle();
}
inline void dComIfGs_setEmptyBottle(u8 type) {
g_dComIfG_gameInfo.getSaveFile().getPlayerItem().setEmptyBottle(type);
}
inline void dComIfGs_setEmptyBottleItemIn(u8 type) {
g_dComIfG_gameInfo.getSaveFile().getPlayerItem().setEmptyBottleItemIn(type);
}
inline void dComIfGs_onEventBit(u16 id) {
g_dComIfG_gameInfo.getSaveFile().getEventFlags().onEventBit(id);
}
inline void dComIfGs_onLightDropFlag(u8 area_id) {
g_dComIfG_gameInfo.getSaveFile().getLightDrop().onLightDropGetFlag(area_id);
}
inline void dComIfGs_onSwitch(int param1, int param2) {
g_dComIfG_gameInfo.getInfo().onSwitch(param1, param2);
}
inline bool dComIfGs_isDungeonItemMap(void) {
return g_dComIfG_gameInfo.getMemory().getTempFlags().isDungeonItemMap();
}
inline bool dComIfGs_isDungeonItemBossKey(void) {
return g_dComIfG_gameInfo.getMemory().getTempFlags().isDungeonItemBossKey();
}
inline u8 dComIfGs_getItem(int slot, bool unk) {
return g_dComIfG_gameInfo.getSaveFile().getPlayerItem().getItem(slot, unk);
}
inline BOOL dComIfGs_isCollectSword(u8 sword_id) {
return g_dComIfG_gameInfo.getSaveFile().getPlayerCollect().isCollect(SWORD_BITFIELD, sword_id);
}
inline BOOL dComIfGs_isCollectClothing(u8 clothing_id) {
return g_dComIfG_gameInfo.getSaveFile().getPlayerCollect().isCollect(CLOTHING_BITFIELD,
clothing_id);
}
inline u8 dComIfGs_checkBottle(u8 type) {
return g_dComIfG_gameInfo.getSaveFile().getPlayerItem().checkBottle(type);
}
inline BOOL dComIfGs_isLightDropGetFlag(u8 area_id) {
return g_dComIfG_gameInfo.getSaveFile().getLightDrop().isLightDropGetFlag(area_id);
}
// int dComIfGp_roomControl_getZoneNo(int zone_no) {
// return g_dComIfG_gameInfo.play.getRoomControl().getZoneNo(zone_no);
// }

View File

@ -1,18 +0,0 @@
/* 800987B4 000956F4 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 800987B8 000956F8 7C 08 02 A6 */ mflr r0
/* 800987BC 000956FC 90 01 00 14 */ stw r0, 0x14(r1)
/* 800987C0 00095700 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha
/* 800987C4 00095704 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l
/* 800987C8 00095708 38 63 00 9C */ addi r3, r3, 0x9c
/* 800987CC 0009570C 38 80 00 04 */ li r4, 4
/* 800987D0 00095710 38 A0 00 43 */ li r5, 0x43
/* 800987D4 00095714 4B F9 A7 E5 */ bl setItem__17dSv_player_item_cFiUc
/* 800987D8 00095718 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha
/* 800987DC 0009571C 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l
/* 800987E0 00095720 38 00 00 1E */ li r0, 0x1e
/* 800987E4 00095724 98 03 00 EC */ stb r0, 0xec(r3)
/* 800987E8 00095728 98 03 00 F8 */ stb r0, 0xf8(r3)
/* 800987EC 0009572C 80 01 00 14 */ lwz r0, 0x14(r1)
/* 800987F0 00095730 7C 08 03 A6 */ mtlr r0
/* 800987F4 00095734 38 21 00 10 */ addi r1, r1, 0x10
/* 800987F8 00095738 4E 80 00 20 */ blr

View File

@ -1,6 +0,0 @@
/* 80098AB0 000959F0 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha
/* 80098AB4 000959F4 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l
/* 80098AB8 000959F8 38 00 00 3C */ li r0, 0x3c
/* 80098ABC 000959FC 98 03 00 EC */ stb r0, 0xec(r3)
/* 80098AC0 00095A00 98 03 00 F8 */ stb r0, 0xf8(r3)
/* 80098AC4 00095A04 4E 80 00 20 */ blr

View File

@ -1,6 +0,0 @@
/* 80098AE0 00095A20 3C 60 80 40 */ lis r3, g_dComIfG_gameInfo@ha
/* 80098AE4 00095A24 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l
/* 80098AE8 00095A28 38 00 00 64 */ li r0, 0x64
/* 80098AEC 00095A2C 98 03 00 EC */ stb r0, 0xec(r3)
/* 80098AF0 00095A30 98 03 00 F8 */ stb r0, 0xf8(r3)
/* 80098AF4 00095A34 4E 80 00 20 */ blr

View File

@ -1,6 +1,7 @@
#ifndef D_ITEM_H_
#define D_ITEM_H_
#include "d/d_com/d_com_inf_game/d_com_inf_game.h"
#include "global.h"
int checkItemGet(u8, int);

View File

@ -331,10 +331,14 @@ public:
u16& getCurrentLanternOil() { return mCurrentLanternOil; }
u8& getScent() { return mEquipment[3]; }
void setWalletLV(u8 lv) { mCurrentWallet = lv; }
void setLanternOil(u16 amount) {
mMaxLanternOil = amount;
mCurrentLanternOil = amount;
}
void setOil(u16 oil) { mCurrentLanternOil = oil; }
void setMaxOil(u16 max) { mMaxLanternOil = max; }
void setWalletSize(u8 size) { mCurrentWallet = size; }
void setMagic(u8 magic) { mCurrentMagic = magic; }
void setMaxMagic(u8 max) { mMaxMagic = max; }
void setRupee(u16 rupees) { mCurrentRupees = rupees; }
void setLife(u16 life) { mCurrentHealth = life; }
void setMaxLife(u8 max) { mMaxHealth = max; }
private:
u16 mMaxHealth;
@ -349,8 +353,8 @@ private:
u8 unk18;
u8 mEquipment[6];
u8 mCurrentWallet;
u8 unk26;
u8 unk27;
u8 mMaxMagic;
u8 mCurrentMagic;
u8 mMagicFlag;
u8 unk29;
u8 unk30;
@ -491,7 +495,7 @@ public:
u8 addBottleNum(u8, s16);
u8 getBottleNum(u8) const;
void setBowAmount(u8 amount) { mBow = amount; }
void setArrowNum(u8 amount) { mBow = amount; }
private:
u8 mBow;
@ -507,7 +511,7 @@ public:
void setBombNum(u8, u8);
u8 getBombNum(u8) const;
void setBowCapacity(u8 max) { mItemCapacities[0] = max; }
void setArrowNum(u8 max) { mItemCapacities[0] = max; }
u8 getBowCapacity() { return mItemCapacities[0]; }
private:
@ -642,7 +646,6 @@ public:
dSv_player_get_item_c& getPlayerGetItem() { return player_get_item; }
void setPlayerStatusAWalletLV(u8 lv) { player_status_a.setWalletLV(lv); }
void setPlayerStatusAOil(u16 amount) { player_status_a.setLanternOil(amount); }
private:
dSv_player_status_a_c player_status_a;
@ -681,6 +684,12 @@ public:
bool isDungeonItem(int) const;
u8 getSmallKeys() { return small_key_flags; }
void onDungeonItemMap() { onDungeonItem(MAP_FLAG); }
bool isDungeonItemMap() const { return isDungeonItem(MAP_FLAG); }
void onDungeonItemCompass() { onDungeonItem(COMPASS_FLAG); }
void onDungeonItemWarp() { onDungeonItem(OOCCOO_NOTE_FLAG); }
void onDungeonItemBossKey() { onDungeonItem(BOSS_KEY_FLAG); }
bool isDungeonItemBossKey() const { return isDungeonItem(BOSS_KEY_FLAG); }
private:
u32 area_flags_bitfields1[2];
@ -854,7 +863,11 @@ public:
dSv_player_c& getPlayer() { return player; }
dSv_player_status_a_c& getPlayerStatusA() { return player.getPlayerStatusA(); }
dSv_player_get_item_c& getPlayerGetItem() { return player.getPlayerGetItem(); }
dSv_player_item_record_c& getPlayerItemRecord() { return player.getPlayerItemRecord(); }
dSv_player_item_max_c& getPlayerItemMax() { return player.getPlayerItemMax(); }
dSv_player_item_c& getPlayerItem() { return player.getPlayerItem(); }
dSv_player_collect_c& getPlayerCollect() { return player.getPlayerCollect(); }
dSv_light_drop_c& getLightDrop() { return player.getLightDrop(); }
dSv_event_c& getEventFlags() { return event_flags; }
void setPlayerStatusAWallet(u8 lv) { player.setPlayerStatusAWalletLV(lv); }
@ -894,6 +907,7 @@ public:
dSv_memory_c& getMemory() { return memory; }
dSv_zone_c* getZones() { return zones; }
dSv_player_c& getPlayer() { return save_file.getPlayer(); }
dSv_event_c& getEvent() { return events; }
private:
/* 0x000 */ dSv_save_c save_file;

View File

@ -1909,7 +1909,7 @@ void func_801415E4(void);
void func_8011E9F8(void);
void daAlink_c_NS_procHangWaitInit(void);
void func_8013BD54(void);
void dComIfGs_isItemFirstBit(void);
void dComIfGs_isItemFirstBit__FUc(u8);
void daAlink_c_NS_checkLetterItem(void);
void fopAcM_searchActorDistanceXZ(void);
void checkBottle__17dSv_player_item_cFUc(void);

View File

@ -13753,11 +13753,8 @@ asm void fopAcM_onSwitch(void) {
#include "d/d_a/d_a_alink/asm/func_80141230.s"
}
// dComIfGs_isItemFirstBit__FUc
// dComIfGs_isItemFirstBit(unsigned char)
asm void dComIfGs_isItemFirstBit(void) {
nofralloc
#include "d/d_a/d_a_alink/asm/func_80141264.s"
int dComIfGs_isItemFirstBit(u8 i_no) {
return g_dComIfG_gameInfo.getSaveFile().getPlayerGetItem().isFirstBit(i_no);
}
// dStage_stagInfo_GetSaveTbl__FP21stage_stag_info_class

File diff suppressed because it is too large Load Diff

View File

@ -41,8 +41,8 @@ void dSv_player_status_a_c::init() {
this->mEquipment[3] = NO_ITEM;
this->mEquipment[4] = NO_ITEM;
this->mCurrentWallet = WALLET;
this->unk26 = 0;
this->unk27 = 0;
this->mMaxMagic = 0;
this->mCurrentMagic = 0;
this->mMagicFlag = 0;
this->unk29 = 0;
this->unk30 = 0;