add dmeter2 header, isMagicFlag OK, setItem OK

This commit is contained in:
unknown 2020-12-06 14:38:26 -05:00
parent 59a3d00209
commit 819f178657
No known key found for this signature in database
GPG Key ID: 4312662758CE7D5A
3 changed files with 152 additions and 69 deletions

View File

@ -0,0 +1,103 @@
#include "dolphin/types.h"
struct dMeter2Info_c_vtable {
u32* addr1;
u32* addr2;
u32* dtor;
};
class dMeter2Info_c {
private:
dMeter2Info_c_vtable* vtable;
u8 unk4[4];
u32 unk8;
u32 unk12;
u32 unk16;
u32 unk20;
u32 unk24;
u32 unk28;
u32 unk32;
u32 unk36;
u8 unk40[16];
char mStageName[8];
struct cXyz position;
short angle;
u8 unk78;
u8 unk79;
u8 unk80;
u8 unk81[3];
float unk84;
float unk88;
float unk92;
float unk96;
float unk100;
float unk104;
float unk108;
float unk112;
float unk116;
float unk120;
float unk124;
float unk128;
u32 unk132;
u32 unk136;
u32 mMeterString;
u32 unk144;
u16 mMsgKeyWaitTimer;
u16 unk150;
u16 unk152;
u16 mHotSpringTimer;
u8 unk156[4];
u16 unk160;
u16 unk162;
u16 unk164;
u16 unk166;
s16 mFloatingMessageTimer;
u16 unk170;
u16 unk172;
u16 unk174;
u16 unk176;
u16 unk178;
u16 unk180;
u16 unk182;
u8 mDirectUseItem;
u8 unk185;
u8 unk186;
u8 unk187;
u8 unk188;
u8 unk189;
u8 unk190;
u8 unk191;
u8 mWarpStatus;
u8 unk193;
u8 unk194;
u8 unk195;
u32 unk196;
u32 unk200;
u8 unk204;
u8 unk205;
u8 unk206;
u8 unk207;
u32 unk208;
u32 unk212;
u8 unk216;
u8 unk217;
u8 unk218;
u8 unk219;
u8 unk220;
u8 unk221;
u8 mMiniGameCount;
u8 unk223;
u8 unk224;
u8 unk225;
u8 unk226;
u8 unk227[3];
u8 unk230;
u8 unk231;
u8 unk232;
char mSaveStageName[8];
u8 unk241;
u8 unk242;
u8 unk243[5];
};
extern dMeter2Info_c g_meter2_info;

View File

@ -3,11 +3,15 @@
#include "dolphin/types.h"
#define DEFAULT_SELECT_ITEM_INDEX 0
#define MAX_SELECT_ITEM 3
static const int MAX_ITEM_SLOTS = 24;
static const int ITEM_XY_MAX_DUMMY = 8;
static const int LIGHT_DROP_STAGE = 4;
static const int LETTER_INFO_BIT = 64;
enum Wallets {
WALLET,
BIG_WALLET,
@ -317,7 +321,7 @@ class dSv_player_status_a_c {
void setMixItemIndex(signed int, u8);
u8 getMixItemIndex(signed int) const;
u16 getRupeeMax(void) const;
bool isMagicFlag(u8) const;
int isMagicFlag(u8) const;
inline u16& getCurrentHealth() {
return current_health;
@ -494,9 +498,7 @@ class dSv_player_item_record_c {
u8 addBottleNum(u8, short);
u8 getBottleNum(u8) const;
void setBowAmount(u8 amount){
bow = amount;
}
void setBowAmount(u8 amount){ bow = amount; }
private:
u8 bow;
@ -512,9 +514,7 @@ class dSv_player_item_max_c {
void setBombNum(u8, u8);
u8 getBombNum(u8) const;
void setBowCapacity(u8 max){
item_capacities[0] = max;
}
void setBowCapacity(u8 max){ item_capacities[0] = max; }
private:
u8 item_capacities[8];
@ -530,9 +530,7 @@ class dSv_player_collect_c {
void onCollectMirror(u8);
bool isCollectMirror(u8) const;
u8 getPoeCount(){
return poe_count;
}
u8 getPoeCount(){ return poe_count; }
private:
u8 unk0[8];
@ -594,9 +592,7 @@ class dSv_fishing_info_c {
class dSv_player_info_c {
public:
void init(void);
inline char* getLinkName() {
return (char*)link_name;
}
char* getLinkName() { return (char*)link_name; }
private:
u32 unk0;
@ -640,37 +636,17 @@ class dSv_player_config_c {
class dSv_player_c {
public:
void init(void);
dSv_player_info_c& getPlayerInfo() {
return player_info;
}
dSv_player_status_a_c getPlayerStatusA() {
return player_status_a;
}
dSv_player_item_c& getPlayerItem(){
return player_item;
}
dSv_player_collect_c& getPlayerCollect(){
return player_collect;
}
dSv_player_item_record_c& getPlayerItemRecord(){
return player_item_record;
}
dSv_player_item_max_c& getPlayerItemMax(){
return player_item_max;
}
dSv_light_drop_c& getLightDrop(){
return light_drop;
}
dSv_player_get_item_c& getPlayerGetItem(){
return player_get_item;
}
dSv_player_info_c& getPlayerInfo() { return player_info; }
dSv_player_status_a_c& getPlayerStatusA() { return player_status_a; }
dSv_player_item_c& getPlayerItem(){ return player_item; }
dSv_player_collect_c& getPlayerCollect(){ return player_collect;}
dSv_player_item_record_c& getPlayerItemRecord(){ return player_item_record; }
dSv_player_item_max_c& getPlayerItemMax(){ return player_item_max;}
dSv_light_drop_c& getLightDrop(){ return light_drop; }
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);
}
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;
@ -726,7 +702,7 @@ class dSv_event_c {
void init(void);
void onEventBit(u16);
void offEventBit(u16);
bool isEventBit(u16) const;
int isEventBit(u16) const;
void setEventReg(u16, u8);
u8 getEventReg(u16) const;
@ -752,9 +728,7 @@ class dSv_memory_c {
public:
dSv_memory_c(void); // the assembly for this is in d_com_inf_game.s
void init(void);
inline dSv_memBit_c& getTempFlags() {
return temp_flags;
}
dSv_memBit_c& getTempFlags() { return temp_flags; }
private:
dSv_memBit_c temp_flags;
@ -835,17 +809,10 @@ class dSv_zone_c {
public:
dSv_zone_c(void); // the assembly for this is in d_com_inf_game.s
void init(int);
inline dSv_zoneBit_c& getZoneBit() {
return zone_bit;
}
dSv_zoneBit_c& getZoneBit() { return zone_bit;}
dSv_zoneActor_c& getZoneActor() { return zone_actor; }
inline s8& getUnk0() {
return unk0;
}
inline dSv_zoneActor_c& getZoneActor() {
return zone_actor;
}
s8& getUnk0() { return unk0; }
private:
s8 unk0;
@ -881,12 +848,11 @@ class dSv_save_c {
public:
void init(void);
dSv_memory2_c* getSave2(int);
inline dSv_player_c& getPlayer() {return player; }
dSv_player_c& getPlayer() {return player; }
dSv_player_status_a_c& getPlayerStatusA() {return player.getPlayerStatusA(); }
dSv_event_c& getEventFlags() {return event_flags;}
void setPlayerStatusAWallet(u8 lv){
player.setPlayerStatusAWalletLV(lv);
}
void setPlayerStatusAWallet(u8 lv){ player.setPlayerStatusAWalletLV(lv); }
static const int STAGE_MAX = 4;

View File

@ -83,9 +83,11 @@ u16 dSv_player_status_a_c::getRupeeMax(void) const {
return 0;
}
asm bool dSv_player_status_a_c::isMagicFlag(u8 i_magic) const {
nofralloc
#include "d/d_save/d_save/asm/func_80032AF8.s"
int dSv_player_status_a_c::isMagicFlag(u8 i_magic) const {
if (i_magic == 0) {
return g_dComIfG_gameInfo.save_file.getEventFlags().isEventBit(0x2304);
}
return (this->magic_flag & (u8)(1 << i_magic)) ? 1 : 0;
}
void dSv_player_status_b_c::init() {
@ -238,9 +240,21 @@ void dSv_player_item_c::init(void) {
}
}
asm void dSv_player_item_c::setItem(int current_items_index, u8 new_items_index) {
nofralloc
#include "d/d_save/d_save/asm/func_80032FB8.s"
void dSv_player_item_c::setItem(int current_items_index, u8 new_items_index) {
if (current_items_index < MAX_ITEM_SLOTS) {
this->items[current_items_index] = new_items_index;
this->setLineUpItem();
}
int select_item_index = DEFAULT_SELECT_ITEM_INDEX;
do {
if (current_items_index == g_dComIfG_gameInfo.save_file.getPlayerStatusA().getSelectItemIndex(select_item_index)) {
dComIfGp_setSelectItem(select_item_index);
}
select_item_index++;
} while (select_item_index < MAX_SELECT_ITEM);
}
#ifdef NONMATCHING
@ -1012,8 +1026,8 @@ void dSv_event_c::offEventBit(u16 i_no) {
}
// (u8) cast doesn't work here, thank u metrowerks
bool dSv_event_c::isEventBit(u16 i_no) const {
return this->events[(i_no >> 8)] & (i_no & 0xFF) ? true : false;
int dSv_event_c::isEventBit(u16 i_no) const {
return this->events[(i_no >> 8)] & (i_no & 0xFF) ? 1 : 0;
}
void dSv_event_c::setEventReg(u16 param_1, u8 param_2) {