diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2023-02-10 09:07:47 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-10 10:07:47 -0700 |
| commit | 539edcf07715b965ffbfff6278292681e9b3b131 (patch) | |
| tree | c9100a10723a0aba845e8df2d268e14f181e4f8b /src/d/d_insect.cpp | |
| parent | 6db94622247993b5a6bea411239f47841e99c1c4 (diff) | |
d_a_dmidna OK / f_op + misc cleanup (#276)
* some f_op / d_insect cleanup
* rename some vars according to tww
* d_a_dmidna OK
* remove asm
Diffstat (limited to 'src/d/d_insect.cpp')
| -rw-r--r-- | src/d/d_insect.cpp | 103 |
1 files changed, 36 insertions, 67 deletions
diff --git a/src/d/d_insect.cpp b/src/d/d_insect.cpp index 6d54fd86e3..d3d8c605f3 100644 --- a/src/d/d_insect.cpp +++ b/src/d/d_insect.cpp @@ -1,111 +1,80 @@ -// -// Generated By: dol2asm -// Translation Unit: d/d_insect -// +/** + * d_insect.cpp + * + */ #include "d/d_insect.h" -#include "dol2asm.h" -#include "dolphin/types.h" -#include "f_op/f_op_actor_mng.h" #include "d/com/d_com_inf_game.h" #include "d/menu/d_menu_insect.h" +#include "f_op/f_op_actor_mng.h" #include "m_Do/m_Do_lib.h" -// -// Forward References: -// - -// -// External References: -// - -extern "C" void Insect_Release__9dInsect_cFv(); - -// -// Declarations: -// - -inline int dComIfGs_isEventBit(u16 event) { - return g_dComIfG_gameInfo.info.getSavedata().getEvent().isEventBit(event); -} - -/* ############################################################################################## */ -SECTION_DATA extern void* __vt__9dInsect_c[3 + 1 /* padding */] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)Insect_Release__9dInsect_cFv, - /* padding */ - NULL, -}; - /* 8015E010-8015E078 158950 0068+00 0/0 0/0 13/13 .text __ct__9dInsect_cFv */ dInsect_c::dInsect_c() { - field_0x588 = -1; + m_itemId = -1; field_0x56C = 0; field_0x56D = 1; - field_0x58C = 0; - field_0x580 = 0xD6; + m_mode = 0; + m_itemNo = M_MAYFLY; field_0x584 = 0; field_0x585 = 0; } -/* ############################################################################################## */ - /* 8015E078-8015E26C 1589B8 01F4+00 0/0 0/0 24/24 .text Insect_GetDemoMain__9dInsect_cFv */ void dInsect_c::Insect_GetDemoMain() { - switch (field_0x58C) { + switch (m_mode) { case 0: if (fopAcM_checkCarryNow(this)) { - cLib_offBit(mAttentionInfo.mFlags,0x10); + cLib_offBit(mAttentionInfo.mFlags, 0x10); fopAcM_cancelCarryNow(this); - fopAcM_orderItemEvent(this,0,0); + fopAcM_orderItemEvent(this, 0, 0); mEvtInfo.i_onCondition(8); - field_0x588 = fopAcM_createItemForTrBoxDemo(¤t.pos,field_0x580,-1,fopAcM_GetRoomNo(this),0,0); - field_0x58C = 1; + m_itemId = fopAcM_createItemForTrBoxDemo(¤t.pos, m_itemNo, -1, + fopAcM_GetRoomNo(this), NULL, NULL); + m_mode = 1; - if (dMenu_Insect_c::isCatchNotGiveInsect(field_0x580) != 0) { + if (dMenu_Insect_c::isCatchNotGiveInsect(m_itemNo) != 0) { field_0x585 = 1; } } else { - cLib_onBit(mAttentionInfo.mFlags,0x10); + cLib_onBit(mAttentionInfo.mFlags, 0x10); } break; case 1: if (mEvtInfo.checkCommandItem()) { - if (field_0x588 != -1) { - dComIfGp_event_setItemPartnerId(field_0x588); + if (m_itemId != fpcM_ERROR_PROCESS_ID_e) { + dComIfGp_event_setItemPartnerId(m_itemId); } field_0x56D = 0; - field_0x58C = 2; + m_mode = 2; } else { - fopAcM_orderItemEvent(this,0,0); + fopAcM_orderItemEvent(this, 0, 0); mEvtInfo.i_onCondition(8); } break; case 2: - if (dComIfGp_evmng_endCheck("DEFAULT_GETITEM")) { + if (dComIfGp_evmng_endCheck("DEFAULT_GETITEM")) { i_dComIfGp_event_reset(); - if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[field_0x582]) || field_0x585 != 0) { + if (i_dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[m_saveBitNo]) || + field_0x585 != 0) + { field_0x56D = 1; - field_0x58C = 0; + m_mode = 0; if (field_0x584 == 0) { - fopAcM_createItem(¤t.pos,0,-1,-1,0,0,0); + fopAcM_createItem(¤t.pos, HEART, -1, -1, NULL, NULL, 0); field_0x584 = 1; } } else { fopAcM_delete(this); - } } break; } } -/* ############################################################################################## */ - /* 8015E26C-8015E3F8 158BAC 018C+00 0/0 0/0 3/3 .text CalcZBuffer__9dInsect_cFf */ void dInsect_c::CalcZBuffer(f32 param_0) { f32 camera_trim_height; @@ -114,20 +83,19 @@ void dInsect_c::CalcZBuffer(f32 param_0) { pos = current.pos; pos.y += 20.0f; - + mDoLib_project(&pos, &pos_projected); if (dComIfGp_getCamera(0)) { - camera_trim_height = *(f32*)&dComIfGp_getCamera(0)->mCamera.mCamSetup.mTypeTable; + camera_trim_height = dComIfGp_getCamera(0)->mCamera.mTrimHeight; } else { camera_trim_height = 0.0f; } - if (pos_projected.x > 0.0f && - pos_projected.x < 608.0f && - pos_projected.y > camera_trim_height && - pos_projected.y < 448.0f - camera_trim_height) { - dComIfGd_peekZ(pos_projected.x,pos_projected.y,&field_0x578); + if (pos_projected.x > 0.0f && pos_projected.x < 608.0f && + pos_projected.y > camera_trim_height && pos_projected.y < 448.0f - camera_trim_height) + { + dComIfGd_peekZ(pos_projected.x, pos_projected.y, &field_0x578); } else { field_0x578 = 0; } @@ -141,7 +109,8 @@ void dInsect_c::CalcZBuffer(f32 param_0) { pos_projected.z = -10.0f; } - field_0x57C = (((view_near + ((view_far * view_near) / pos_projected.z)) / (view_far - view_near)) + 1.0f) * 16777215.0f; + field_0x57C = + (((view_near + ((view_far * view_near) / pos_projected.z)) / (view_far - view_near)) + + 1.0f) * + 16777215.0f; } - -/* 80393D98-80393D98 0203F8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ |
