diff options
| author | LagoLunatic <LagoLunatic@users.noreply.github.com> | 2025-06-04 16:50:49 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-04 16:50:49 -0400 |
| commit | e24cbed36724b9ae422875a6da46b8c10d69ca19 (patch) | |
| tree | 144d0841819533767ff69dc541bd655f7adeaab4 /src/d | |
| parent | 08571c4865fed64bb39c422ae0b973f977af93b4 (diff) | |
Demo work (#786)
* Demo work
* Fix PAL
* Fix d_door weak func order and link it
* Fix d_door for demo
* JKernel OK on demo + misc
* tag_attention 100% on demo
* More demo work and fix some retail fakematches
Diffstat (limited to 'src/d')
| -rw-r--r-- | src/d/actor/d_a_arrow.cpp | 58 | ||||
| -rw-r--r-- | src/d/actor/d_a_bomb3.inc | 7 | ||||
| -rw-r--r-- | src/d/actor/d_a_bwdg.cpp | 6 | ||||
| -rw-r--r-- | src/d/actor/d_a_ghostship.cpp | 53 | ||||
| -rw-r--r-- | src/d/actor/d_a_npc_km1.cpp | 110 | ||||
| -rw-r--r-- | src/d/actor/d_a_npc_people.cpp | 7 | ||||
| -rw-r--r-- | src/d/actor/d_a_npc_photo.cpp | 2 | ||||
| -rw-r--r-- | src/d/actor/d_a_obj_barrel.cpp | 2 | ||||
| -rw-r--r-- | src/d/actor/d_a_obj_homen.cpp | 59 | ||||
| -rw-r--r-- | src/d/actor/d_a_obj_homensmoke.cpp | 7 | ||||
| -rw-r--r-- | src/d/actor/d_a_obj_ladder.cpp | 10 | ||||
| -rw-r--r-- | src/d/actor/d_a_obj_movebox.cpp | 5 | ||||
| -rw-r--r-- | src/d/actor/d_a_ship.cpp | 80 | ||||
| -rw-r--r-- | src/d/actor/d_a_swtdoor.cpp | 11 | ||||
| -rw-r--r-- | src/d/actor/d_a_tag_msg.cpp | 10 | ||||
| -rw-r--r-- | src/d/actor/d_a_tag_waterlevel.cpp | 3 | ||||
| -rw-r--r-- | src/d/actor/d_a_windmill.cpp | 34 | ||||
| -rw-r--r-- | src/d/d_door.cpp | 33 | ||||
| -rw-r--r-- | src/d/d_event.cpp | 63 | ||||
| -rw-r--r-- | src/d/d_item_data.cpp | 158 | ||||
| -rw-r--r-- | src/d/d_magma.cpp | 7 | ||||
| -rw-r--r-- | src/d/d_s_actor_data_mng.cpp | 18 | ||||
| -rw-r--r-- | src/d/d_s_open.cpp | 6 |
23 files changed, 526 insertions, 223 deletions
diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index 2e454da6..6a8376b6 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -317,21 +317,6 @@ void daArrow_c::arrowUseMp() { dComIfGp_setItemMagicCount(use_mp[mArrowType]); } -// This is a fake inline (not present in debug maps) which is required for ShieldReflect to match. -// It's possible that an inline similar to this was added to the final game even though it didn't exist in the demo, -// as this section of code was missing from the demo's version of ShieldReflect. -inline void setSphereCoordsFromXYAngles(cXyz& xyz, f32 mag, s16 targetAngleX, s16 targetAngleY) { - f32 normZ; - f32 normY; - f32 normX; - normX = cM_ssin(targetAngleY) * cM_scos(targetAngleX); - normY = -cM_ssin(targetAngleX); - normZ = cM_scos(targetAngleY) * cM_scos(targetAngleX); - xyz.x = normX * mag; - xyz.y = normY * mag; - xyz.z = normZ * mag; -} - /* 800D4DC0-800D50A0 .text ShieldReflect__9daArrow_cFv */ void daArrow_c::ShieldReflect() { f32 vel = speed.abs(); @@ -341,28 +326,31 @@ void daArrow_c::ShieldReflect() { s16 targetAngleX = link->getBodyAngleX(); fopAc_ac_c* ganondorf; - if (fopAcM_SearchByName(PROC_GND, &ganondorf) && dComIfGp_getAttention().LockonTruth() && dComIfGp_getAttention().LockonTarget(0) == ganondorf) { - cXyz ganondorfChestPos = ganondorf->current.pos; - ganondorfChestPos.y = 130.0f + REG8_F(0); - targetAngleX = -cLib_targetAngleX(&link->current.pos, &ganondorfChestPos); - fopAcM_SetParam(ganondorf, 0x23); - mSparkleTimer = 15 + REG0_S(3); - mpSparkleEmitter = dComIfGp_particle_set(dPa_name::ID_COMMON_03EE, &link->current.pos); + if (fopAcM_SearchByName(PROC_GND, &ganondorf)) { + dAttention_c& attention = dComIfGp_getAttention(); + if (attention.LockonTruth() && attention.LockonTarget(0) == ganondorf) { + cXyz ganondorfChestPos = ganondorf->current.pos; +#if VERSION == VERSION_DEMO + ganondorfChestPos.y += 130.0f + REG8_F(0); +#else + ganondorfChestPos.y = 130.0f + REG8_F(0); +#endif + targetAngleX = -cLib_targetAngleX(&link->current.pos, &ganondorfChestPos); +#if VERSION > VERSION_DEMO + fopAcM_SetParam(ganondorf, 0x23); + mSparkleTimer = 15 + REG0_S(3); + mpSparkleEmitter = dComIfGp_particle_set(dPa_name::ID_COMMON_03EE, &link->current.pos); +#endif + } } - // // Regswaps without creating a fake inline. - // // f1 -> f3: normY - // // f3 -> f1: normZ - // f32 normZ; - // f32 normY; - // f32 normX; - // normX = cM_ssin(targetAngleY) * cM_scos(targetAngleX); - // normY = -cM_ssin(targetAngleX); - // normZ = cM_scos(targetAngleY) * cM_scos(targetAngleX); - // speed.x = normX * vel; - // speed.y = normY * vel; - // speed.z = normZ * vel; - setSphereCoordsFromXYAngles(speed, vel, targetAngleX, targetAngleY); + Vec norm; + norm.x = cM_ssin(targetAngleY) * cM_scos(targetAngleX); + norm.y = -cM_ssin(targetAngleX); + norm.z = cM_scos(targetAngleY) * cM_scos(targetAngleX); + speed.x = norm.x * vel; + speed.y = norm.y * vel; + speed.z = norm.z * vel; shape_angle.x = cM_atan2s(-speed.y, -speed.absXZ()); shape_angle.y = cM_atan2s(-speed.x, -speed.z); diff --git a/src/d/actor/d_a_bomb3.inc b/src/d/actor/d_a_bomb3.inc index 05f2b018..02b73d12 100644 --- a/src/d/actor/d_a_bomb3.inc +++ b/src/d/actor/d_a_bomb3.inc @@ -198,9 +198,10 @@ BOOL daBomb_c::draw() { } if(fopAcM_GetModel(this) == 0 && mAcch.GetGroundH() != -G_CM3D_F_INF) { - cM3dGPla* pNormal = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd); - if(pNormal) { - dComIfGd_setSimpleShadow(¤t.pos, mAcch.GetGroundH(), 25.0f, pNormal->GetNP()); + cM3dGPla* triPla = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd); + cXyz* norm = triPla->GetNP(); + if(norm) { + dComIfGd_setSimpleShadow(¤t.pos, mAcch.GetGroundH(), 25.0f, norm); } } diff --git a/src/d/actor/d_a_bwdg.cpp b/src/d/actor/d_a_bwdg.cpp index 9b17f9b5..34957669 100644 --- a/src/d/actor/d_a_bwdg.cpp +++ b/src/d/actor/d_a_bwdg.cpp @@ -59,8 +59,8 @@ void daBwdg_packet_c::draw() { dKy_setLight_mine(mpTevStr); GFSetVtxDescv(l_vtxDescList); GFSetVtxAttrFmtv(GX_VTXFMT0, l_vtxAttrFmtList); - GFSetArray(GX_VA_POS, getPos(), sizeof(cXyz)); - GFSetArray(GX_VA_NRM, getNrm(), sizeof(cXyz)); + GFSetArray(GX_VA_POS, &mPos[m00010 * 0x1081], sizeof(cXyz)); + GFSetArray(GX_VA_NRM, &mNrm[m00010 * 0x1081], sizeof(cXyz)); GFSetArray(GX_VA_TEX0, l_texCoord, sizeof(cXy)); GFSetTevColorS10(GX_TEVREG0, mpTevStr->mColorC0); GFSetTevColor(GX_TEVREG1, mpTevStr->mColorK0); @@ -206,7 +206,7 @@ static BOOL daBwdg_IsDelete(bwdg_class* i_this) { /* 00000854-000008B0 .text daBwdg_Delete__FP10bwdg_class */ static BOOL daBwdg_Delete(bwdg_class* i_this) { - dComIfG_resDelete(&i_this->mPhase, "Bwdg"); + dComIfG_resDeleteDemo(&i_this->mPhase, "Bwdg"); if (i_this->heap) { dComIfG_Bgsp()->Release(i_this->mpBgW); } diff --git a/src/d/actor/d_a_ghostship.cpp b/src/d/actor/d_a_ghostship.cpp index 4a65df30..8aad02c5 100644 --- a/src/d/actor/d_a_ghostship.cpp +++ b/src/d/actor/d_a_ghostship.cpp @@ -35,7 +35,7 @@ static BOOL createHeap_CB(fopAc_ac_c* i_this) { /* 00000118-0000032C .text _createHeap__13daGhostship_cFv */ BOOL daGhostship_c::_createHeap() { J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectRes(m_arc_name, AYUSH_BDL_AYUSH)); - JUT_ASSERT(88, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(80, 88, 88, 88), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if(!mpModel) { @@ -43,7 +43,7 @@ BOOL daGhostship_c::_createHeap() { } J3DAnmTextureSRTKey* btk = static_cast<J3DAnmTextureSRTKey*>(dComIfG_getObjectRes(m_arc_name, AYUSH_BTK_AYUSH)); - JUT_ASSERT(95, btk != NULL); + JUT_ASSERT(VERSION_SELECT(87, 95, 95, 95), btk != NULL); if(!mBtk.init(modelData, btk, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false, 0)) { return false; @@ -286,7 +286,13 @@ bool daGhostship_c::_execute() { f32 dist = fopAcM_searchActorDistanceXZ(this, dComIfGp_getPlayer(0)); mbCanEnterShip = false; - if(moonPhase != dKy_moon_type_chk() || (time > 90.0f && time < 285.0f)) { + if(moonPhase != dKy_moon_type_chk() || +#if VERSION == VERSION_DEMO + (time > 90.0f && time < 330.0f) +#else + (time > 90.0f && time < 285.0f) +#endif + ) { dKy_pship_existense_cut(); mAlpha = 0.0f; } @@ -350,16 +356,27 @@ bool daGhostship_c::_execute() { } } - if(mAlpha == l_HIO.shipAlpha && dist < l_HIO.shipEnterDist && dComIfGs_getEventReg(0x8803) < 3 && !mbEnteredShip) { - mDoAud_seStart(JA_SE_LK_WARP_TO_G_SHIP); - stage_scls_info_class* scls_data = dComIfGd_getMeshSceneList(current.pos); - JUT_ASSERT(463, scls_data != NULL) - - u8 startCode = scls_data->mStart; - dComIfGs_setEventReg(0xC3FF, scls_data->mRoom); - dComIfGs_setEventReg(0x85FF, startCode); - dComIfGp_setNextStage("PShip", 0, 2); - mbEnteredShip = true; + if(mAlpha == l_HIO.shipAlpha && dist < l_HIO.shipEnterDist) { + u8 r29 = dComIfGs_getEventReg(0x8803); + if (r29 < 3 +#if VERSION > VERSION_DEMO + && !mbEnteredShip +#endif + ) { + mDoAud_seStart(JA_SE_LK_WARP_TO_G_SHIP); + stage_scls_info_class* scls_data = dComIfGd_getMeshSceneList(current.pos); + JUT_ASSERT(VERSION_SELECT(457, 463, 463, 463), scls_data != NULL) + + u8 startCode = scls_data->mStart; + dComIfGs_setEventReg(0xC3FF, scls_data->mRoom); + dComIfGs_setEventReg(0x85FF, startCode); +#if VERSION == VERSION_DEMO + dComIfGp_setNextStage("PShip", 0, r29); +#else + dComIfGp_setNextStage("PShip", 0, 2); + mbEnteredShip = true; +#endif + } } modeProcCall(); @@ -377,12 +394,22 @@ bool daGhostship_c::_execute() { mDoMtx_stack_c::copy(mpModel->getBaseTRMtx()); mDoMtx_stack_c::push(); +#if VERSION == VERSION_DEMO + mDoMtx_stack_c::transM(0.0f + REG10_F(0), 3200.0f + REG10_F(1), 75.0f); + mDoMtx_stack_c::YrotM(REG10_S(0)); +#else mDoMtx_stack_c::transM(0.0f, 3200.0f, 75.0f); +#endif mpCloth->setMtx(mDoMtx_stack_c::get()); mDoMtx_stack_c::pop(); +#if VERSION == VERSION_DEMO + mDoMtx_stack_c::transM(-900.0f + REG10_F(3), 2080.0f + REG10_F(4), 85.0f + REG10_F(5)); + mDoMtx_stack_c::YrotM(0x4000 + REG10_S(1)); +#else mDoMtx_stack_c::transM(-900.0f, 2080.0f, 85.0f); mDoMtx_stack_c::YrotM(0x4000); +#endif mpCloth2->setMtx(mDoMtx_stack_c::get()); mpCloth->setParam(0.45f, -1.5f, 0.875f, 1.0f, 1.0f, 0x100, 0, 900, -800, 7.0f, 6.0f); diff --git a/src/d/actor/d_a_npc_km1.cpp b/src/d/actor/d_a_npc_km1.cpp index f062f47e..eaa3ed81 100644 --- a/src/d/actor/d_a_npc_km1.cpp +++ b/src/d/actor/d_a_npc_km1.cpp @@ -10,14 +10,10 @@ #include "d/d_procname.h" #include "d/d_priority.h" #include "d/res/res_km.h" -#include "weak_bss_936_to_1036.h" -static daNpc_Km1_HIO_c l_HIO; -enum KM1_CONSTANTS{ - TEXPATTERN_END = 1, - ANM_END = 1, -}; +#include "weak_bss_936_to_1036.h" // IWYU pragma: keep +static daNpc_Km1_HIO_c l_HIO; /* 000000EC-00000144 .text __ct__15daNpc_Km1_HIO_cFv */ daNpc_Km1_HIO_c::daNpc_Km1_HIO_c() { @@ -43,15 +39,13 @@ daNpc_Km1_HIO_c::daNpc_Km1_HIO_c() { /* 00000144-000002F0 .text nodeCallBack_Km__FP7J3DNodei */ static BOOL nodeCallBack_Km(J3DNode* i_node, int i_calcTiming) { - if (i_calcTiming == J3DNodeCBCalcTiming_In) { J3DModel* model = j3dSys.getModel(); daNpc_Km1_c* km1Actor = (daNpc_Km1_c *)(model->getUserArea()); - u16 jointIdx; if (km1Actor) { static cXyz a_att_pos_offst(0.0f,0.0f,0.0f); static cXyz a_eye_pos_offst(20.0f,20.0f,0.0f); - jointIdx = ((J3DJoint*)(i_node))->getJntNo(); + u16 jointIdx = ((J3DJoint*)(i_node))->getJntNo(); mDoMtx_stack_c::copy(model->getAnmMtx(jointIdx)); if(jointIdx == km1Actor->getHeadJntNum()){ MTXMultVec(mDoMtx_stack_c::get(),&a_att_pos_offst,km1Actor->getAttPos()); @@ -62,9 +56,8 @@ static BOOL nodeCallBack_Km(J3DNode* i_node, int i_calcTiming) { mDoMtx_stack_c::XrotM(km1Actor->getBackbone_y()); mDoMtx_stack_c::ZrotM(km1Actor->getBackbone_x()); } - MtxP stack = mDoMtx_stack_c::get(); - cMtx_copy(stack,J3DSys::mCurrentMtx); - MTXCopy(stack,model->getAnmMtx(jointIdx)); + cMtx_copy(mDoMtx_stack_c::get(), J3DSys::mCurrentMtx); + model->setAnmMtx(jointIdx, mDoMtx_stack_c::get()); } } return TRUE; @@ -233,13 +226,13 @@ s32 daNpc_Km1_c::setAnm_anm(daNpc_Km1_c::anm_prm_c* i_anm_ptr) { /* 00000A24-00000A8C .text setAnm__11daNpc_Km1_cFv */ void daNpc_Km1_c::setAnm() { - static daNpc_Km1_c::anm_prm_c a_anm_prm_tbl2[3] = { + static daNpc_Km1_c::anm_prm_c a_anm_prm_tbl[3] = { {-1,-1,0.0f,0.0f,-1}, - {0,0,8.0f,1.0f,J3DFrameCtrl::EMode_LOOP}, + {ANM_WAIT,0,8.0f,1.0f,J3DFrameCtrl::EMode_LOOP}, {-1,-1,0.0f,0.0f,-1} }; - setAnm_tex(a_anm_prm_tbl2[field_0x7D0].field_0x1); - setAnm_anm(&a_anm_prm_tbl2[field_0x7D0]); + setAnm_tex(a_anm_prm_tbl[field_0x7D0].field_0x1); + setAnm_anm(&a_anm_prm_tbl[field_0x7D0]); } /* 00000A8C-00000A98 .text chngAnmTag__11daNpc_Km1_cFv */ @@ -275,13 +268,13 @@ void daNpc_Km1_c::ctrlAnmAtr() { /* 00000AE8-00000B50 .text setAnm_ATR__11daNpc_Km1_cFi */ void daNpc_Km1_c::setAnm_ATR(int param_1) { - static daNpc_Km1_c::anm_prm_c a_anm_prm_tbl3[1] = { - {0x00,0x00,8.0f,1.0f,J3DFrameCtrl::EMode_LOOP} + static daNpc_Km1_c::anm_prm_c a_anm_prm_tbl[1] = { + {ANM_WAIT,0x00,8.0f,1.0f,J3DFrameCtrl::EMode_LOOP} }; if(param_1 != 0){ - setAnm_tex(a_anm_prm_tbl3[field_0x7CB].field_0x1); + setAnm_tex(a_anm_prm_tbl[field_0x7CB].field_0x1); } - setAnm_anm((&a_anm_prm_tbl3[field_0x7CB])); + setAnm_anm((&a_anm_prm_tbl[field_0x7CB])); } @@ -408,15 +401,14 @@ void daNpc_Km1_c::lookBack() { /* 00000E94-00000F14 .text chkAttention__11daNpc_Km1_cFv */ bool daNpc_Km1_c::chkAttention() { - if(dComIfGp_getAttention().LockonTruth() != 0){ - return this == dComIfGp_getAttention().LockonTarget(0); + dAttention_c& attention = dComIfGp_getAttention(); + if(attention.LockonTruth() != 0){ + return this == attention.LockonTarget(0); }else{ - return this == dComIfGp_getAttention().ActionTarget(0); + return this == attention.ActionTarget(0); } } -const u32 fillerbytes[] = {0xFF000080,0x0000FF80}; - /* 00000F14-00000F78 .text setAttention__11daNpc_Km1_cFv */ void daNpc_Km1_c::setAttention() { @@ -462,9 +454,10 @@ bool daNpc_Km1_c::event_action() { } return true; } -static char* cut_name_tbl[] = {"ACTION"}; + /* 0000103C-00001144 .text privateCut__11daNpc_Km1_cFv */ void daNpc_Km1_c::privateCut() { + static char* cut_name_tbl[] = {"ACTION"}; int staffIdx = dComIfGp_evmng_getMyStaffId("Km1",NULL,0); if(staffIdx != -1){ @@ -614,20 +607,20 @@ u8 daNpc_Km1_c::demo() { }else{ field_0x7C7 = 1; dComIfGp_demo_getActor(demoActorID); -#if VERSION != VERSION_DEMO - dDemo_setDemoData(this,0x6A,mpMorf,"Km",0,0,0,0); -#endif + dDemo_setDemoData( + this, + dDemo_actor_c::ENABLE_TRANS_e | dDemo_actor_c::ENABLE_ROTATE_e | dDemo_actor_c::ENABLE_ANM_e | dDemo_actor_c::ENABLE_ANM_FRAME_e, + mpMorf, + "Km" + ); } return field_0x7C7; } /* 00001548-000016AC .text _draw__11daNpc_Km1_cFv */ bool daNpc_Km1_c::_draw() { - - J3DModelData *model_data; - J3DModel *model; - model = mpMorf->getModel(); - model_data = model->getModelData(); + J3DModel *model = mpMorf->getModel(); + J3DModelData *model_data = model->getModelData(); g_env_light.settingTevStruct(TEV_TYPE_ACTOR,¤t.pos,&tevStr); g_env_light.setLightTevColorType(model,&tevStr); mBtpAnm.entry(model_data,mBtpFrame); @@ -638,10 +631,19 @@ bool daNpc_Km1_c::_draw() { cXyz pos(current.pos.x,current.pos.y+150.0f,current.pos.z); mShadowId = dComIfGd_setRealShadow(mShadowId,1,field_0x6D4,&pos,800.0f,current.pos.y-mObjAcch.GetGroundH(),NULL); if(mShadowId == 0){ - cXyz* pFloorNrm = (cXyz*)dComIfG_Bgsp()->GetTriPla(mObjAcch.m_gnd.GetBgIndex(),mObjAcch.m_gnd.GetPolyIndex()); - dComIfGd_setSimpleShadow(¤t.pos,mObjAcch.GetGroundH(),40.0f,pFloorNrm); + dComIfGd_setSimpleShadow( + ¤t.pos, + mObjAcch.GetGroundH(), + 40.0f, + dComIfG_Bgsp()->GetTriPla(mObjAcch.m_gnd)->GetNP() + ); } - dSnap_RegistFig(0x58,this,1.0f,1.0f,1.0f); + dSnap_RegistFig(DSNAP_TYPE_KM1,this,1.0f,1.0f,1.0f); + + // Color literals for debug drawing. Unused in non-debug builds. + (GXColor){0xFF,0x00, 0x00, 0x80}; + (GXColor){0x00,0x00, 0xFF, 0x80}; + return true; } @@ -669,7 +671,7 @@ bool daNpc_Km1_c::_execute() { } eventOrder(); if(field_0x7C7 == 0){ - fopAcM_posMoveF(this,(cXyz*)&mStts); + fopAcM_posMoveF(this, mStts.GetCCMoveP()); } setMtx(); setCollision(60.0f,150.0f); @@ -680,7 +682,7 @@ bool daNpc_Km1_c::_execute() { bool daNpc_Km1_c::_delete() { fopAcM_GetID(this); - dComIfG_resDelete(&field_0x6C4,"Km"); + dComIfG_resDeleteDemo(&field_0x6C4,"Km"); if(mpMorf != NULL){ mpMorf->stopZelAnime(); @@ -697,15 +699,16 @@ bool daNpc_Km1_c::_delete() { /* 0000188C-000018AC .text CheckCreateHeap__FP10fopAc_ac_c */ static BOOL CheckCreateHeap(fopAc_ac_c* actor) { - return ((daNpc_Km1_c*)actor)->CreateHeap(); } /* 000018AC-00001A1C .text _create__11daNpc_Km1_cFv */ cPhs_State daNpc_Km1_c::_create() { - static int a_heap_size_tbl[1] = {0x000272E0}; - fopAcM_SetupActor(this,daNpc_Km1_c); + +#if VERSION > VERSION_DEMO + fopAcM_SetupActor(this, daNpc_Km1_c); +#endif if (!decideType(fopAcM_GetParam(this) & 0xFF )) { @@ -722,6 +725,11 @@ cPhs_State daNpc_Km1_c::_create() { l_HIO.mNo = mDoHIO_createChild("金持ちム−ル",&l_HIO); } l_HIO.field_0x8 += 1; + +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(this, daNpc_Km1_c); +#endif + if(fopAcM_entrySolidHeap(this,CheckCreateHeap,a_heap_size_tbl[field_0x7D3])){ fopAcM_SetMtx(this,mpMorf->mpModel->getBaseTRMtx()); fopAcM_setCullSizeBox(this,-60.0f,-20.0f,-80.0f,60.0f,160.0f,60.0f); @@ -738,12 +746,12 @@ cPhs_State daNpc_Km1_c::_create() { /* 00001E4C-00002158 .text CreateHeap__11daNpc_Km1_cFv */ BOOL daNpc_Km1_c::CreateHeap() { - static u8 a_tex_pattern_num_tbl[1] = {0}; + static u8 a_tex_pattern_num_tbl[1] = {TEXPATTERN_MABA}; J3DModelData *a_mdl_data; a_mdl_data = (J3DModelData*)dComIfG_getObjectIDRes("Km",KM_BDL_KM); - JUT_ASSERT(0x52D,a_mdl_data != NULL); + JUT_ASSERT(VERSION_SELECT(1316, 1325, 1325, 1325) ,a_mdl_data != NULL); mpMorf = new mDoExt_McaMorf( a_mdl_data, NULL, NULL, @@ -755,22 +763,21 @@ BOOL daNpc_Km1_c::CreateHeap() { if(mpMorf->getModel()) { m_head_jnt_num = a_mdl_data->getJointName()->getIndex("head"); - JUT_ASSERT(0x540,m_head_jnt_num >= 0); + JUT_ASSERT(VERSION_SELECT(1335, 1344, 1344, 1344), m_head_jnt_num >= 0); m_backbone_jnt_num = a_mdl_data->getJointName()->getIndex("backbone"); - JUT_ASSERT(0x542,m_backbone_jnt_num >= 0); + JUT_ASSERT(VERSION_SELECT(1337, 1346, 1346, 1346), m_backbone_jnt_num >= 0); field_0x7CD = a_tex_pattern_num_tbl[field_0x7D3]; if (initTexPatternAnm(false) != 0) { field_0x6D4 = mDoExt_J3DModel__create(a_mdl_data,0x20000,0x11020203); if (field_0x6D4 != 0) { for (u16 i = 0; i < a_mdl_data->getJointNum(); i += 1) { - if ((i == getHeadJntNum()) || (i == getBackboneJntNum())) { + if ((i == m_head_jnt_num) || (i == m_backbone_jnt_num)) { mpMorf->mpModel->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack_Km); } } mpMorf->getModel()->setUserArea((u32)this); mAcchCir.SetWall(30.0f,60.0f); - mObjAcch.Set(¤t.pos,&old.pos,(fopAc_ac_c *)this,1, - &mAcchCir,&speed,NULL,NULL); + mObjAcch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, &mAcchCir, fopAcM_GetSpeed_p(this)); return TRUE; } } @@ -781,32 +788,27 @@ BOOL daNpc_Km1_c::CreateHeap() { } /* 00002158-00002178 .text daNpc_Km1_Create__FP10fopAc_ac_c */ static cPhs_State daNpc_Km1_Create(fopAc_ac_c* obj) { - (static_cast<daNpc_Km1_c*>(obj))->_create(); } /* 00002178-00002198 .text daNpc_Km1_Delete__FP11daNpc_Km1_c */ static BOOL daNpc_Km1_Delete(daNpc_Km1_c* obj) { - (static_cast<daNpc_Km1_c*>(obj))->_delete(); } /* 00002198-000021B8 .text daNpc_Km1_Execute__FP11daNpc_Km1_c */ static BOOL daNpc_Km1_Execute(daNpc_Km1_c* obj) { - (static_cast<daNpc_Km1_c*>(obj))->_execute(); } /* 000021B8-000021D8 .text daNpc_Km1_Draw__FP11daNpc_Km1_c */ static BOOL daNpc_Km1_Draw(daNpc_Km1_c* obj) { - (static_cast<daNpc_Km1_c*>(obj))->_draw(); } /* 000021D8-000021E0 .text daNpc_Km1_IsDelete__FP11daNpc_Km1_c */ static BOOL daNpc_Km1_IsDelete(daNpc_Km1_c*) { return TRUE; - } static actor_method_class l_daNpc_Km1_Method = { diff --git a/src/d/actor/d_a_npc_people.cpp b/src/d/actor/d_a_npc_people.cpp index 251ec3f9..4fd86e74 100644 --- a/src/d/actor/d_a_npc_people.cpp +++ b/src/d/actor/d_a_npc_people.cpp @@ -4711,15 +4711,16 @@ bool daNpcPeople_c::_execute() { if(getPrmArg0() == 0) { cXyz diff = current.pos - home.pos; f32 mag = diff.abs(); + f32 f3 = 20.0f; mag -= 180.0f; if(mag < 0.0f) { mag = 0.0f; } - if(mag > 20.0f) { - mag = 20.0f; + if(mag > f3) { + mag = f3; } - mStts.SetWeight(mag * 50.0f / 20.0f + 80.0f); + mStts.SetWeight(mag * 50.0f / f3 + 80.0f); } } diff --git a/src/d/actor/d_a_npc_photo.cpp b/src/d/actor/d_a_npc_photo.cpp index a60295d4..1ddada40 100644 --- a/src/d/actor/d_a_npc_photo.cpp +++ b/src/d/actor/d_a_npc_photo.cpp @@ -831,7 +831,7 @@ bool daNpcPhoto_c::_draw() { obj.SetGeo(temp, l_pso_photo.field_0x0C, l_pso_photo.field_0x10, l_pso_photo.field_0x14 + current.angle.y); dSnap_RegistSnapObj(obj); } else { - dSnap_RegistFig(DSNAP_TYPE_UNK5E, this, 1.0f, 1.0f, 1.0f); + dSnap_RegistFig(DSNAP_TYPE_NPC_PHOTO, this, 1.0f, 1.0f, 1.0f); } return true; } diff --git a/src/d/actor/d_a_obj_barrel.cpp b/src/d/actor/d_a_obj_barrel.cpp index b859270e..c5a84bcf 100644 --- a/src/d/actor/d_a_obj_barrel.cpp +++ b/src/d/actor/d_a_obj_barrel.cpp @@ -727,7 +727,7 @@ bool daObjBarrel::Act_c::_draw() { float gndH = mAcch.GetGroundH(); cM3dGPla* gndPlane = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd); cXyz *norm = gndPlane->GetNP(); - if (gndPlane && gndH != -G_CM3D_F_INF) { + if (norm && gndH != -G_CM3D_F_INF) { dComIfGd_setSimpleShadow(¤t.pos, gndH, attr().m02, norm); } } diff --git a/src/d/actor/d_a_obj_homen.cpp b/src/d/actor/d_a_obj_homen.cpp index b0d265fe..7e3e5e32 100644 --- a/src/d/actor/d_a_obj_homen.cpp +++ b/src/d/actor/d_a_obj_homen.cpp @@ -3,7 +3,9 @@ * Object - Wind Temple - Face stone Hookshot target */ +#pragma sym off #include "d/actor/d_a_obj_homen.h" +#pragma sym on #include "d/actor/d_a_player.h" #include "d/d_com_inf_game.h" #include "d/d_procname.h" @@ -39,8 +41,10 @@ struct Attr_c { /* 0x30 */ f32 field_0x30; /* 0x34 */ f32 field_0x34; /* 0x38 */ f32 field_0x38; +#if VERSION > VERSION_DEMO /* 0x3C */ u8 field_0x3C[0x50 - 0x3C]; /* 0x50 */ f32 field_0x50; +#endif }; // Size: 0x54 const Attr_c L_attr = { @@ -63,8 +67,10 @@ const Attr_c L_attr = { 105.0f, 92.0f, 200.0f, +#if VERSION > VERSION_DEMO {}, 25.0f, +#endif }; #ifdef DEBUG @@ -218,23 +224,47 @@ bool Act_c::create_heap() { }; J3DModelData* mdl_data = (J3DModelData*)dComIfG_getObjectRes(M_arcname, bdl_idx[mType]); - JUT_ASSERT(615, mdl_data != NULL); - if (mdl_data != NULL) { + JUT_ASSERT(VERSION_SELECT(578, 615, 615, 615), mdl_data != NULL); +#if VERSION > VERSION_DEMO + if (mdl_data != NULL) +#endif + { mpModel = mDoExt_J3DModel__create(mdl_data, 0, 0x11000002); } init_mtx(); +#if VERSION == VERSION_DEMO + int r28 = 0; +#endif + cBgD_t* bgw_data = (cBgD_t*)dComIfG_getObjectRes(M_arcname, dzb_idx[mType]); - JUT_ASSERT(628, bgw_data != NULL); - if (bgw_data != NULL) { + JUT_ASSERT(VERSION_SELECT(590, 628, 628, 628), bgw_data != NULL); +#if VERSION > VERSION_DEMO + if (bgw_data != NULL) +#endif + { mpBgW = new dBgW(); +#if VERSION == VERSION_DEMO + if (mpBgW != NULL && mpBgW->Set(bgw_data, cBgW::MOVE_BG_e, &mMtx)) { + r28 |= 1; + } +#else if (mpBgW != NULL && mpBgW->Set(bgw_data, cBgW::MOVE_BG_e, &mMtx) == true) { return false; } +#endif } +#if VERSION == VERSION_DEMO + bool ret = false; + if (mdl_data != NULL && r28 == 0) { + ret = true; + }; + return ret; +#else return mdl_data != NULL && mpModel != NULL && mpBgW != NULL; +#endif } /* 000002B4-000005B0 .text _create__Q210daObjHomen5Act_cFv */ @@ -315,7 +345,13 @@ cPhs_State Act_c::_create() { /* 000011A4-00001230 .text _delete__Q210daObjHomen5Act_cFv */ bool Act_c::_delete() { dComIfG_resDelete(&mPhase, M_arcname); - if (heap != NULL && mpBgW != NULL && mpBgW->ChkUsed()) { + if ( +#if VERSION > VERSION_DEMO + heap != NULL && +#endif + mpBgW != NULL && + mpBgW->ChkUsed() + ) { dComIfG_Bgsp()->Release(mpBgW); } return true; @@ -393,12 +429,19 @@ void Act_c::make_enemy() { int enemy_idx = param_get_enemy(); if (enemy_idx != 0xF && enemy_idx < ARRAY_SIZE(make_enemy_dat)) { - cXyz offset; - cXyz type_offsets[2] = { +#if VERSION == VERSION_DEMO + static cXyz y_offset[2] = { + cXyz(0.0f, 300.0f, 350.0f), + cXyz(0.0f, 0.0f, 0.0f), + }; +#else + cXyz y_offset[2] = { cXyz(0.0f, 300.0f, 350.0f), cXyz(0.0f, 0.0f, 25.0f), }; - cMtx_multVec(mMtx, &type_offsets[mType & 1], &offset); +#endif + cXyz offset; + cMtx_multVec(mMtx, &y_offset[mType & 1], &offset); fpc_ProcID enemy_id = fopAcM_create( make_enemy_dat[enemy_idx].proc_name, diff --git a/src/d/actor/d_a_obj_homensmoke.cpp b/src/d/actor/d_a_obj_homensmoke.cpp index ca3ab8de..f2a97781 100644 --- a/src/d/actor/d_a_obj_homensmoke.cpp +++ b/src/d/actor/d_a_obj_homensmoke.cpp @@ -76,7 +76,12 @@ namespace daObjHomensmoke { /* 000004C8-00000738 .text _execute__Q215daObjHomensmoke5Act_cFv */ bool Act_c::_execute() { - if (!mbInitialized) { +#if VERSION == VERSION_DEMO + if (m2D0 == NULL) +#else + if (!mbInitialized) +#endif + { static cXyz norse_offsetL(0.0f, 300.0f, 20.0f); static cXyz norse_offsetS(0.0f, 70.0f, 20.0f); if (mType == 0) { diff --git a/src/d/actor/d_a_obj_ladder.cpp b/src/d/actor/d_a_obj_ladder.cpp index 13b67f75..6b4aa89f 100644 --- a/src/d/actor/d_a_obj_ladder.cpp +++ b/src/d/actor/d_a_obj_ladder.cpp @@ -111,7 +111,10 @@ cPhs_State daObjLadder::Act_c::Mthd_Create() { if (phase_state == cPhs_COMPLEATE_e) { mType = prm_get_type(); - phase_state = MoveBGCreate(M_arcname, attr_type(mType).dzbId, dBgS_MoveBGProc_Trans, 0x900); + phase_state = MoveBGCreate( + M_arcname, attr_type(mType).dzbId, dBgS_MoveBGProc_Trans, + VERSION_SELECT(0x1700, 0x900, 0x900, 0x900) + ); JUT_ASSERT(0x1DE, (phase_state == cPhs_COMPLEATE_e) || (phase_state == cPhs_ERROR_e)); } @@ -128,7 +131,7 @@ BOOL daObjLadder::Act_c::Delete() { BOOL daObjLadder::Act_c::Mthd_Delete() { BOOL res = MoveBGDelete(); - dComIfG_resDelete(&mPhs, M_arcname); + dComIfG_resDeleteDemo(&mPhs, M_arcname); return res; } @@ -237,7 +240,8 @@ void daObjLadder::Act_c::mode_drop() { if (unk2DE >= 0) { unk2DE--; - current.pos.y = mGndY - (current.pos.y - mGndY) * 0.5f; + f32 temp = current.pos.y - mGndY; + current.pos.y = mGndY - temp * 0.5f; speed.y *= -0.5f; } else { current.pos.y = mGndY; diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index 79b2b7a0..d744d90c 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -1870,8 +1870,9 @@ namespace daObjMovebox { int temp = mBgc.mMaxGroundIdx; f32 groundH = mBgc.mGroundY[temp]; cM3dGPla* triPla = dComIfG_Bgsp()->GetTriPla(Bgc_c::M_gnd_work[temp]); - if (triPla && groundH != -G_CM3D_F_INF) { - dComIfGd_setSimpleShadow(¤t.pos, groundH, i_attr()->m10, triPla->GetNP(), shape_angle.y, 1.0f, NULL); + cXyz* norm = triPla->GetNP(); + if (norm && groundH != -G_CM3D_F_INF) { + dComIfGd_setSimpleShadow(¤t.pos, groundH, i_attr()->m10, norm, shape_angle.y, 1.0f, NULL); } } diff --git a/src/d/actor/d_a_ship.cpp b/src/d/actor/d_a_ship.cpp index 13830969..d0a08511 100644 --- a/src/d/actor/d_a_ship.cpp +++ b/src/d/actor/d_a_ship.cpp @@ -341,9 +341,11 @@ void daShip_c::setInitMessage() { else if (checkForceMessage()) { return; } +#if VERSION > VERSION_DEMO else if (dComIfGs_isEventBit(0x2110) && !dComIfGs_checkGetItem(dItem_BOMB_BAG_e)) { mNextMessageNo = 0x623; } +#endif else if (checkStateFlg(daSFLG_UNK800000_e)) { mNextMessageNo = 0x636; } @@ -612,7 +614,9 @@ BOOL daShip_c::setNextMessage(msg_class* msg) { } else if (currMessageNo == 0x1682) { dComIfGs_onEventBit(0x3d04); +#if VERSION > VERSION_DEMO mNextMessageNo = 0; +#endif } else if (currMessageNo == 0x1688) { dComIfGs_onEventBit(0x3f80); @@ -826,7 +830,7 @@ void daShip_c::setWaveAngle(short* param1, short* param2) { /* 00002314-000023E0 .text getWaterY__8daShip_cFv */ f32 daShip_c::getWaterY() { - float waterY; + f32 waterY; BOOL waterHit = mAcch.ChkWaterHit(); if (waterHit) { m03F8 = mAcch.m_wtr.GetHeight(); @@ -844,6 +848,9 @@ f32 daShip_c::getWaterY() { waterY = m03F8; } else { +#if VERSION == VERSION_DEMO + waterY = m03F4; +#else daPy_lk_c* link = daPy_getPlayerLinkActorClass(); if (link && link->mDemo.getDemoMode() == daPy_demo_c::DEMO_UNK44_e ) { waterY = 0.0f; @@ -851,6 +858,7 @@ f32 daShip_c::getWaterY() { else { waterY = m03F4; } +#endif } return waterY; } @@ -1087,32 +1095,23 @@ s16 daShip_c::getAimControllAngle(short referenceAngle) { /* 00002D90-00002EE0 .text setMoveAngle__8daShip_cFs */ void daShip_c::setMoveAngle(short moveAngle) { - float turnRate; - float maxTurnRate; - float minTurnRate; - short initialAngle; - bool cannotMove = FALSE; - if (mTornadoActor || mWhirlActor != 0) { - cannotMove = TRUE; - } - if (!cannotMove) { - initialAngle = shape_angle.y; - turnRate = 4.0f - std::abs(speedF) / 55.0f * 3.0f; - maxTurnRate = 3.6f; - minTurnRate = 0.1f; - if (turnRate > maxTurnRate) { - turnRate = maxTurnRate; - } - else if (turnRate < minTurnRate) { - turnRate = minTurnRate; + if (!checkForceMove()) { + s16 initialAngle = shape_angle.y; + f32 turnRate = 4.0f - std::abs(speedF) / 55.0f * 3.0f; + if (turnRate > 3.6f) { + turnRate = 3.6f; + } + else if (turnRate < 0.1f) { + turnRate = 0.1f; } if (m0388 >= 0xF) { - turnRate = maxTurnRate; + turnRate = 3.6f; } else { turnRate += ((3.6f - turnRate) * m0388) / 15.0f; } - shape_angle.y += (s32)(-turnRate * (moveAngle >> 6)); + s16 temp = -turnRate * (moveAngle >> 6); + shape_angle.y += temp; setControllAngle(getAimControllAngle(initialAngle)); current.angle.y = shape_angle.y; } @@ -1958,7 +1957,10 @@ BOOL daShip_c::procCraneUp_init() { dComIfGp_getVibration().StartShock(7, -0x31, cXyz(0.0f, 1.0f, 0.0f)); dComIfGp_getVibration().StartQuake(4, 1, cXyz(0.0f, 1.0f, 0.0f)); +#if VERSION > VERSION_DEMO speedF = 0.0f; +#endif + return TRUE; } @@ -2180,7 +2182,7 @@ BOOL daShip_c::procZevDemo() { fVar17 = local_70.absXZ(); if (!dComIfGp_evmng_getMyFloatP(mEvtStaffId, "rad")) { - JUT_ASSERT(0xE9D, 0); + JUT_ASSERT(VERSION_SELECT(3722, 3741, 3741, 3741), 0); } fVar3 = *dComIfGp_evmng_getMyFloatP(mEvtStaffId, "rad"); @@ -3449,7 +3451,10 @@ void daShip_c::setHeadAnm() { mCurMode == 9) { newFileIndex = SHIP_BCK_KYAKKAN1; } - else if ((!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02)) && + else if ( +#if VERSION > VERSION_DEMO + (!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02)) && +#endif (mSph.ChkTgHit() || mCyl[0].ChkTgHit() || mCyl[1].ChkTgHit() || mCyl[2].ChkTgHit())) { m03B4 = SHIP_BCK_FN_LOOK_L; @@ -3460,7 +3465,10 @@ void daShip_c::setHeadAnm() { } } else { - if ((!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02)) && + if ( +#if VERSION > VERSION_DEMO + (!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02)) && +#endif (mSph.ChkTgHit() || mCyl[0].ChkTgHit() || mCyl[1].ChkTgHit() || mCyl[2].ChkTgHit())) { m03B4 = SHIP_BCK_FN_LOOK_L; @@ -3474,7 +3482,9 @@ void daShip_c::setHeadAnm() { else if ((m03B4 == SHIP_BCK_FN_LOOK_L || m03B4 == SHIP_BCK_FN_LOOK_R) && std::fabsf(mpHeadAnm->getPlaySpeed()) < 0.01f && cM_rnd() < 0.4f && (g_Counter.mTimer & 0x1FF) == 0x1FF && +#if VERSION > VERSION_DEMO (!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02)) && +#endif !checkStateFlg(daSFLG_UNK40000000_e)) { newFileIndex = SHIP_BCK_AKIBI1; } @@ -4373,7 +4383,7 @@ BOOL daShip_c::createHeap() { m0392 = SHIP_BCK_FN_MAST_OFF2; } modelData = (J3DModelData *)dComIfG_getObjectRes(l_arcName, SHIP_BDL_FN_BODY); - JUT_ASSERT(0x1B5C, modelData != 0); + JUT_ASSERT(VERSION_SELECT(6969, 7004, 7004, 7004), modelData != 0); mpBodyAnm = new mDoExt_McaMorf( modelData, NULL, NULL, @@ -4398,7 +4408,7 @@ BOOL daShip_c::createHeap() { } modelData = (J3DModelData *)dComIfG_getObjectRes(l_arcName, SHIP_BDL_VFNCN); - JUT_ASSERT(0x1B81, modelData != 0); + JUT_ASSERT(VERSION_SELECT(7006, 7041, 7041, 7041), modelData != 0); mpCannonModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000002); if (mpCannonModel == NULL) { @@ -4406,7 +4416,7 @@ BOOL daShip_c::createHeap() { } modelData = (J3DModelData *)dComIfG_getObjectRes(l_arcName, SHIP_BDL_VFNCR); - JUT_ASSERT(0x1B8E, modelData != 0); + JUT_ASSERT(VERSION_SELECT(7019, 7054, 7054, 7054), modelData != 0); mpSalvageArmModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000002); if (mpSalvageArmModel == NULL) { @@ -4414,7 +4424,7 @@ BOOL daShip_c::createHeap() { } modelData = (J3DModelData *)dComIfG_getObjectRes("Link", LINK_BDL_ROPEEND); - JUT_ASSERT(0x1B9B, modelData != 0); + JUT_ASSERT(VERSION_SELECT(7032, 7067, 7067, 7067), modelData != 0); mpLinkModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000002); if (mpLinkModel == NULL) { @@ -4422,7 +4432,7 @@ BOOL daShip_c::createHeap() { } modelData = (J3DModelData *)dComIfG_getObjectRes(l_arcName, SHIP_BDL_FN_HEAD_H); - JUT_ASSERT(0x1BA8, modelData != 0); + JUT_ASSERT(VERSION_SELECT(7045, 7080, 7080, 7080), modelData != 0); m03B4 = SHIP_BCK_FN_LOOK_L; @@ -4602,9 +4612,13 @@ cPhs_State daShip_c::create() { mWhirlID = fpcM_ERROR_PROCESS_ID_e; mWhirlActor = NULL; +#if VERSION == VERSION_DEMO + mTactWarpID = fpcM_ERROR_PROCESS_ID_e; +#else if (mNextMode != MODE_START_MODE_WARP_e) { mTactWarpID = fpcM_ERROR_PROCESS_ID_e; } +#endif if (checkStateFlg(daSFLG_SAIL_ON_e) != 0) { mPart = PART_STEER_e; @@ -4625,7 +4639,13 @@ cPhs_State daShip_c::create() { } } - if ((dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) == dStageType_SEA_e) || !strcmp(dComIfGp_getStartStageName(), "Hyrule") || !strcmp(dComIfGp_getStartStageName(), "Ocean")) { + if ( + (dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) == dStageType_SEA_e) + || !strcmp(dComIfGp_getStartStageName(), "Hyrule") +#if VERSION > VERSION_DEMO + || !strcmp(dComIfGp_getStartStageName(), "Ocean") +#endif + ) { m03CC = 4; } else { diff --git a/src/d/actor/d_a_swtdoor.cpp b/src/d/actor/d_a_swtdoor.cpp index 059ebdef..316b0af0 100644 --- a/src/d/actor/d_a_swtdoor.cpp +++ b/src/d/actor/d_a_swtdoor.cpp @@ -28,10 +28,11 @@ static BOOL daSwtdoor_Execute(swtdoor_class* i_this) { i_this->home.pos.y -= 10.0f; MtxTrans(i_this->current.pos.x, i_this->current.pos.y + i_this->home.pos.y, i_this->current.pos.z, false); - mDoMtx_YrotM(*calc_mtx, i_this->current.angle.y); - mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); - mDoMtx_ZrotM(*calc_mtx, i_this->current.angle.z); - i_this->model->setBaseTRMtx(*calc_mtx); + cMtx_YrotM(*calc_mtx, i_this->current.angle.y); + cMtx_XrotM(*calc_mtx, i_this->current.angle.x); + cMtx_ZrotM(*calc_mtx, i_this->current.angle.z); + J3DModel * model = i_this->model; + model->setBaseTRMtx(*calc_mtx); return TRUE; } @@ -42,7 +43,7 @@ static BOOL daSwtdoor_IsDelete(swtdoor_class* i_this) { /* 000001C4-000001F4 .text daSwtdoor_Delete__FP13swtdoor_class */ static BOOL daSwtdoor_Delete(swtdoor_class* i_this) { - dComIfG_resDelete(&i_this->mPhs, "Swtdoor"); + dComIfG_resDeleteDemo(&i_this->mPhs, "Swtdoor"); return TRUE; } diff --git a/src/d/actor/d_a_tag_msg.cpp b/src/d/actor/d_a_tag_msg.cpp index 376cd432..ce2441e9 100644 --- a/src/d/actor/d_a_tag_msg.cpp +++ b/src/d/actor/d_a_tag_msg.cpp @@ -68,7 +68,7 @@ BOOL daTag_Msg_c::arrivalTerms() { u16 eventFlag; swBit = (int)(getSwbit2() & 0xFF); eventFlag = getEventFlag(); - if ((s32)swBit != 0xff && dComIfGs_isSwitch(swBit, current.roomNo) == 0) { + if ((s32)swBit != 0xff && dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo(this)) == 0) { return FALSE; } else if (eventFlag != 0xffff && dComIfGs_isEventBit(eventFlag) == 0) { @@ -115,7 +115,9 @@ BOOL daTag_Msg_c::otherCheck() { return FALSE; } } - targetAngle = (s16)(targetAngle + 0x7FFF) - player->current.angle.y; + + s16 r3 = targetAngle + 0x7FFF; + targetAngle = r3 - player->current.angle.y; if (targetAngle < 0) { targetAngle = -targetAngle; } @@ -184,7 +186,7 @@ static BOOL daTag_Msg_actionHunt(daTag_Msg_c* a_this) { a_this->setActio(3); swBit = a_this->getSwbit(); if ((swBit & 0xff) != 0xff) { - dComIfGs_onSwitch(swBit,a_this->current.roomNo); + dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(a_this)); } l_msgId = fpcM_ERROR_PROCESS_ID_e; l_msg = 0; @@ -241,7 +243,7 @@ cPhs_State daTag_Msg_c::create() { swBit = (int)(getSwbit() & 0xFF); if ((getMessage() == 0x9c5) && dComIfGs_isEventBit(0x502)) { setActio(0); - } else if ((s32)swBit != 0xff && dComIfGs_isSwitch(swBit, current.roomNo) != 0) { + } else if ((s32)swBit != 0xff && dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo(this)) != 0) { setActio(0); } else { setActio(1); diff --git a/src/d/actor/d_a_tag_waterlevel.cpp b/src/d/actor/d_a_tag_waterlevel.cpp index 4e7dfe1f..06f0e94c 100644 --- a/src/d/actor/d_a_tag_waterlevel.cpp +++ b/src/d/actor/d_a_tag_waterlevel.cpp @@ -69,7 +69,8 @@ namespace daTagWaterlevel { u8 sch_bit = dKy_get_schbit(); cLib_offBit(M_state, STATE_2); - if ((prm_sch & sch_bit & 0xFF)) { + bool temp = prm_sch & sch_bit & 0xFF; + if (temp) { target = 1.0f; if (!cLib_checkBit(get_state(), STATE_1)) { cLib_onBit(M_state, STATE_2); diff --git a/src/d/actor/d_a_windmill.cpp b/src/d/actor/d_a_windmill.cpp index 1740755d..6ddad754 100644 --- a/src/d/actor/d_a_windmill.cpp +++ b/src/d/actor/d_a_windmill.cpp @@ -120,9 +120,15 @@ const Vec daWindMill_c::m_cull_size[][2] = { /* 00000078-000000E8 .text _delete__12daWindMill_cFv */ bool daWindMill_c::_delete() { - if (heap != NULL && mpBgW != NULL) + if ( +#if VERSION > VERSION_DEMO + heap != NULL && +#endif + mpBgW != NULL + ) { dComIfG_Bgsp()->Release(mpBgW); - dComIfG_resDelete(&mPhs, m_arcname[mType]); + } + dComIfG_resDeleteDemo(&mPhs, m_arcname[mType]); return TRUE; } @@ -133,16 +139,14 @@ static BOOL CheckCreateHeap(fopAc_ac_c* i_ac) { /* 00000108-000002A0 .text CreateHeap__12daWindMill_cFv */ BOOL daWindMill_c::CreateHeap() { - J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes( -m_arcname[mType], m_bmdidx[mType]); - JUT_ASSERT(405, modelData != NULL); + J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes(m_arcname[mType], m_bmdidx[mType]); + JUT_ASSERT(VERSION_SELECT(399, 405, 405, 405), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0x80000,0x11000222); if (mpModel == NULL) { return FALSE; } - if (m_dzbidx[mType] != -1) { mpBgW = new dBgW(); if (mpBgW != NULL) { @@ -164,7 +168,6 @@ static BOOL nodeCallBack(J3DNode*, int); /* 000002A0-0000050C .text CreateInit__12daWindMill_cFv */ void daWindMill_c::CreateInit() { - /* Nonmatching */ fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); cXyz cullMin = m_cull_size[mType][0]; @@ -309,7 +312,6 @@ bool daWindMill_c::_execute() { /* 00000ECC-00001048 .text hane_move__12daWindMill_cFv */ void daWindMill_c::hane_move() { - /* Nonmatching */ f32 wind_float = 0.0f; search_wind(); @@ -320,8 +322,9 @@ void daWindMill_c::hane_move() { } } - f32 temp = 2500.0f; - cLib_addCalcAngleS(&mAngle[1], wind_float * temp, 0xF, 100, 10); + s16 target_angle = 2500; + target_angle = wind_float * target_angle; + cLib_addCalcAngleS(&mAngle[1], target_angle, 0xF, 100, 10); if (mAngle[2] <= mAngle[1] && mAngle[1] != 0) { if (mType == 0) { fopAcM_seStart(this, JA_SE_OBJ_WDUN_WMILL_L_RND, 0); @@ -354,9 +357,11 @@ void daWindMill_c::set_at() { }; int i; + s16 r0; switch (mType) { case 1: - if (mAngle[1] > 1000) { + r0 = 1000; + if (mAngle[1] > r0) { mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::ZXYrotM(current.angle.x, current.angle.y, mAngle[0] + mAngle[1]); mDoMtx_stack_c::multVec(&vec1, &vec1); @@ -379,7 +384,8 @@ void daWindMill_c::set_at() { } break; case 0: - if (mAngle[1] > 1000) { + r0 = 1000; + if (mAngle[1] > r0) { mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::ZXYrotM(current.angle.x, mAngle[0] + mAngle[1], current.angle.z); @@ -418,9 +424,11 @@ void daWindMill_c::set_co() { cXyz(0.0f, -350.0f, 70.0f), }; + s16 r0; switch (mType) { case 1: - if (mAngle[1] <= 1000) { + r0 = 1000; + if (mAngle[1] <= r0) { mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::ZXYrotM(current.angle.x, current.angle.y, mAngle[0] + mAngle[1]); diff --git a/src/d/d_door.cpp b/src/d/d_door.cpp index 9260d010..459ecb6b 100644 --- a/src/d/d_door.cpp +++ b/src/d/d_door.cpp @@ -9,7 +9,12 @@ #include "d/res/res_key.h" #include "d/res/res_hkyo.h" #include "d/actor/d_a_player.h" + +// Fakematch to fix weak function ordering of cSAngle::~cSAngle() and cSGlobe::~cSGlobe(). +#pragma sym off #include "SSystem/SComponent/c_angle.h" +#pragma sym on +#pragma nosyminline off /* 8006B39C-8006B3A8 .text getSwbit__12dDoor_info_cFv */ u8 dDoor_info_c::getSwbit() { @@ -111,7 +116,7 @@ s32 dDoor_info_c::frontCheck() { /* 8006B6F4-8006B824 .text drawCheck_local__12dDoor_info_cFv */ s32 dDoor_info_c::drawCheck_local() { - if (!adjoinPlayer() && !eventInfo.checkCommandDemoAccrpt() && !eventInfo.checkCommandDoor()) + if (!adjoinPlayer() && eventInfo.checkCommandDemoAccrpt() == FALSE && eventInfo.checkCommandDoor() == FALSE) return 0; if (getFRoomNo() == 0x3F || getBRoomNo() == 0x3F) @@ -174,7 +179,7 @@ void dDoor_info_c::startDemoProc() { fopAc_ac_c* player = dComIfGp_getPlayer(0); mStaffId = dComIfGp_evmng_getMyStaffId("SHUTTER_DOOR"); shape_angle.y = current.angle.y; - JUT_ASSERT(0x112, player); + JUT_ASSERT(VERSION_SELECT(271, 274, 274, 274), player); s16 delta = player->home.angle.y - home.angle.y; if (delta < 0) delta = -delta; @@ -310,13 +315,11 @@ void dDoor_info_c::closeEndCom() { cXyz pos(current.pos.x - rad * mAngleVec.x, current.pos.y, current.pos.z - rad * mAngleVec.z); s8 roomNo = fopAcM_GetRoomNo(player); - s16 angle; - if (dot > 0.0f) { - angle = current.angle.y; - } else { - angle = current.angle.y + 0x8000; - } - dComIfGs_setRestartRoom(pos, angle, roomNo); + dComIfGs_setRestartRoom( + pos, + dot > 0.0f ? current.angle.y : (s16)(current.angle.y + 0x8000), + roomNo + ); } /* 8006C0A4-8006C0EC .text getDemoAction__12dDoor_info_cFv */ @@ -466,7 +469,7 @@ BOOL dDoor_key2_c::keyProc() { /* 8006C650-8006C764 .text keyCreate_Nkey__12dDoor_key2_cFv */ BOOL dDoor_key2_c::keyCreate_Nkey() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Key", KEY_BDL_VLOCN); - JUT_ASSERT(0x2cc, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(713, 716, 716, 716), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if (mpModel == NULL) @@ -482,7 +485,7 @@ BOOL dDoor_key2_c::keyCreate_Nkey() { /* 8006C764-8006C910 .text keyCreate_Bkey__12dDoor_key2_cFv */ BOOL dDoor_key2_c::keyCreate_Bkey() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Key", KEY_BDL_VLOCB); - JUT_ASSERT(0x2e4, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(737, 740, 740, 740), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if (mpModel == NULL) @@ -500,7 +503,7 @@ BOOL dDoor_key2_c::keyCreate_Bkey() { case J3DErrType_OutOfMemory: return FALSE; default: - JUT_ASSERT(0x306, FALSE); + JUT_ASSERT(VERSION_SELECT(771, 774, 774, 774), FALSE); case J3DErrType_Success: return TRUE; } @@ -647,7 +650,7 @@ BOOL dDoor_msg_c::proc(cXyz* pos) { mState++; break; case 2: - JUT_ASSERT(0x3ba, m_msg); + JUT_ASSERT(VERSION_SELECT(951, 954, 954, 954), m_msg); if (m_msg->mStatus == fopMsgStts_MSG_TYPING_e) { switch (mMsgId) { case 0x1BBD: @@ -659,7 +662,7 @@ BOOL dDoor_msg_c::proc(cXyz* pos) { } break; case 3: - JUT_ASSERT(0x3ca, m_msg); + JUT_ASSERT(VERSION_SELECT(967, 970, 970, 970), m_msg); if (m_msg->mStatus == fopMsgStts_MSG_DISPLAYED_e) { switch (mMsgId) { case 0x1BBD: @@ -709,7 +712,7 @@ BOOL dDoor_hkyo_c::create() { return TRUE; J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Hkyo", HKYO_BDL_HKYO1); - JUT_ASSERT(0x41c, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(1049, 1052, 1052, 1052), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000202); if (mpModel == NULL) diff --git a/src/d/d_event.cpp b/src/d/d_event.cpp index b8fcccb5..a2357e95 100644 --- a/src/d/d_event.cpp +++ b/src/d/d_event.cpp @@ -21,8 +21,16 @@ dEvt_order_c::dEvt_order_c() {} /* 8006FE58-8006FEE8 .text orderOld__14dEvt_control_cFUsUsUsUsPvPvPCv */ s32 dEvt_control_c::orderOld(u16 eventType, u16 priority, u16 flag, u16 hindFlag, void* ac1, void* ac2, const void* eventName) { - s32 eventIdx = dComIfGp_evmng_getEventIdx((const char*)eventName); - return order(eventType, priority, flag, hindFlag, ac1, ac2, eventIdx, 0xFF); + return order( + eventType, + priority, + flag, + hindFlag, + ac1, + ac2, + (s32)dComIfGp_evmng_getEventIdx((const char*)eventName), + 0xFF + ); } /* 8006FEE8-8007002C .text order__14dEvt_control_cFUsUsUsUsPvPvsUc */ @@ -41,21 +49,23 @@ s32 dEvt_control_c::order(u16 eventType, u16 priority, u16 flag, u16 hindFlag, v pNewOrder->mEventInfoIdx = eventInfoIdx; if (pNewOrder->mPriority == 0) - JUT_ASSERT(0x93, FALSE); + JUT_ASSERT(147, FALSE); if (mOrderCount == 0) { mFirstOrderIdx = 0; pNewOrder->mNextOrderIdx = -1; } else { + dEvt_order_c* pQueue; s32 queueIdx = mFirstOrderIdx; - dEvt_order_c* pQueue = &mOrder[queueIdx]; + pQueue = &mOrder[queueIdx]; if (pNewOrder->mPriority < pQueue->mPriority) { mFirstOrderIdx = mOrderCount; pNewOrder->mNextOrderIdx = queueIdx; } else { s8 nextQueueIdx; while ((nextQueueIdx = pQueue->mNextOrderIdx) >= 0) { - if (pNewOrder->mPriority < mOrder[pQueue->mNextOrderIdx].mPriority) + dEvt_order_c* r6 = &mOrder[pQueue->mNextOrderIdx]; + if (pNewOrder->mPriority < r6->mPriority) break; pQueue = &mOrder[nextQueueIdx]; } @@ -97,7 +107,7 @@ void dEvt_control_c::setParam(dEvt_order_c* order) { /* 8007015C-8007018C .text beforeFlagProc__14dEvt_control_cFP12dEvt_order_c */ BOOL dEvt_control_c::beforeFlagProc(dEvt_order_c* order) { fopAc_ac_c* actor2 = order->mActor2; - if ((order->mFlag & dEvtFlag_TALK_e) && !actor2->eventInfo.chkCondition(dEvtCnd_CANTALK_e)) + if ((order->mFlag & dEvtFlag_TALK_e) && actor2->eventInfo.chkCondition(dEvtCnd_CANTALK_e) == FALSE) return false; return true; } @@ -143,7 +153,7 @@ BOOL dEvt_control_c::talkCheck(dEvt_order_c* order) { } if (!dComIfGp_evmng_order(mEventId)) - JUT_ASSERT(0x145, FALSE); + JUT_ASSERT(325, FALSE); return TRUE; } else { @@ -174,7 +184,7 @@ BOOL dEvt_control_c::talkXyCheck(dEvt_order_c* order) { return FALSE; } - if (actor2 == NULL || !actor2->eventInfo.chkCondition(dEvtCnd_CANTALKITEM_e)) { + if (actor2 == NULL || actor2->eventInfo.chkCondition(dEvtCnd_CANTALKITEM_e) == FALSE) { return FALSE; } @@ -219,7 +229,7 @@ BOOL dEvt_control_c::photoCheck(dEvt_order_c* order) { mbInPhoto = 0; if (dComIfGp_getPictureStatus() == 1) { - JUT_ASSERT(0x1a5, actor2); + JUT_ASSERT(421, actor2); if (!commonCheck(order, dEvtCnd_CANTALK_e, dEvtCmd_INTALK_e)) return FALSE; @@ -231,7 +241,7 @@ BOOL dEvt_control_c::photoCheck(dEvt_order_c* order) { } if (!dComIfGp_evmng_order(mEventId)) - JUT_ASSERT(0x1b5, FALSE); + JUT_ASSERT(437, FALSE); mbInPhoto = 1; mMode = dEvtMode_TALK_e; @@ -248,7 +258,7 @@ BOOL dEvt_control_c::catchCheck(dEvt_order_c* order) { fopAc_ac_c* actor2 = order->mActor2; fopAc_ac_c* actor1 = order->mActor1; - if (actor1 == NULL || (actor2 != NULL && !actor2->eventInfo.chkCondition(dEvtCnd_CANCATCH_e))) + if (actor1 == NULL || (actor2 != NULL && actor2->eventInfo.chkCondition(dEvtCnd_CANCATCH_e) == FALSE)) return FALSE; actor1->eventInfo.setCommand(dEvtCmd_INCATCH_e); @@ -258,8 +268,10 @@ BOOL dEvt_control_c::catchCheck(dEvt_order_c* order) { mItemNo = dComIfGp_att_getCatchChgItem(); mMode = dEvtMode_DEMO_e; if (mEventId != -1 && !dComIfGp_evmng_order(mEventId)) - JUT_ASSERT(0x1e3, FALSE); + JUT_ASSERT(483, FALSE); +#if VERSION > VERSION_DEMO onEventFlag(0x80); +#endif return TRUE; } @@ -288,7 +300,7 @@ BOOL dEvt_control_c::demoCheck(dEvt_order_c* order) { s16 eventId = order->mEventId; if (actor2 == NULL) { - JUT_ASSERT(0x21f, FALSE); + JUT_ASSERT(VERSION_SELECT(541, 543, 543, 543), FALSE); return FALSE; } @@ -336,7 +348,7 @@ BOOL dEvt_control_c::potentialCheck(dEvt_order_c* order) { fopAc_ac_c* actor1 = order->mActor1; fopAc_ac_c* actor2 = order->mActor2; if (actor1 == NULL || actor2 == NULL) - JUT_ASSERT(0x280, FALSE); + JUT_ASSERT(VERSION_SELECT(638, 640, 640, 640), FALSE); if (!beforeFlagProc(order)) return FALSE; @@ -357,7 +369,7 @@ BOOL dEvt_control_c::doorCheck(dEvt_order_c* order) { mEventId = actor2->eventInfo.getEventId(); if (mEventId != -1 && dComIfGp_getPEvtManager()->getEventData(mEventId) != NULL) { if (!dComIfGp_evmng_order(mEventId)) - JUT_ASSERT(0x2c0, FALSE); + JUT_ASSERT(VERSION_SELECT(702, 704, 704, 704), FALSE); } else { mEventId = -1; reset(); @@ -379,7 +391,7 @@ BOOL dEvt_control_c::itemCheck(dEvt_order_c* order) { mMode = dEvtMode_DEMO_e; mEventId = dComIfGp_evmng_getEventIdx(defaultEventName); if (!dComIfGp_evmng_order(mEventId)) - JUT_ASSERT(0x2ea, FALSE); + JUT_ASSERT(VERSION_SELECT(744, 746, 746, 746), FALSE); return TRUE; } else { return FALSE; @@ -398,7 +410,7 @@ BOOL dEvt_control_c::endProc() { case dEvtMode_COMPULSORY_e: break; default: - JUT_ASSERT(0x315, FALSE); + JUT_ASSERT(VERSION_SELECT(787, 789, 789, 789), FALSE); } mMode = dEvtMode_NONE_e; @@ -506,7 +518,7 @@ BOOL dEvt_control_c::checkStart() { case dEvtType_CHANGE_e: break; default: - JUT_ASSERT(0x39c, FALSE); + JUT_ASSERT(VERSION_SELECT(922, 924, 924, 924), FALSE); break; } @@ -595,8 +607,8 @@ BOOL dEvt_control_c::photoCheck() { if (actor1 == NULL) { return FALSE; } - if (!actor1->eventInfo.chkCondition(dEvtCnd_CANTALK_e) || - !actor2->eventInfo.chkCondition(dEvtCnd_CANTALK_e) + if (actor1->eventInfo.chkCondition(dEvtCnd_CANTALK_e) == FALSE || + actor2->eventInfo.chkCondition(dEvtCnd_CANTALK_e) == FALSE ) { return FALSE; } @@ -612,7 +624,7 @@ BOOL dEvt_control_c::photoCheck() { /* 80071270-80071418 .text moveApproval__14dEvt_control_cFPv */ s32 dEvt_control_c::moveApproval(void* actor) { fopAc_ac_c* i_ac = (fopAc_ac_c*)actor; - if (getMode() == dEvtMode_NONE_e) + if (runCheck() == FALSE) return dEvtMove_MOVE_e; switch (getMode()) { @@ -641,13 +653,20 @@ s32 dEvt_control_c::moveApproval(void* actor) { return dEvtMove_MOVE_e; if (fopAcM_CheckStatus(i_ac, fopAcStts_UNK800_e)) return dEvtMove_MOVE_e; +#if VERSION == VERSION_DEMO + if (dComIfGp_event_getMode() == dEvtMode_COMPULSORY_e && fopAcM_CheckStatus(i_ac, fopAcStts_BOSS_e)) + return dEvtMove_NOMOVE_e; +#else if ((dComIfGp_event_getMode() == dEvtMode_COMPULSORY_e || dComIfGp_event_getMode() == dEvtMode_TALK_e) && fopAcM_CheckStatus(i_ac, fopAcStts_BOSS_e)) return dEvtMove_NOMOVE_e; if (chkEventFlag(0x80) && fopAcM_CheckStatus(i_ac, fopAcStts_BOSS_e)) return dEvtMove_NOMOVE_e; +#endif if (fopAcM_CheckStatus(i_ac, fopAcStts_UNK4000_e)) return dEvtMove_MOVE_e; - return fopAcM_CheckStatus(i_ac, fopAcStts_CARRY_e) ? dEvtMove_MOVE_e : dEvtMove_NOMOVE_e; + if (fopAcM_CheckStatus(i_ac, fopAcStts_CARRY_e)) + return dEvtMove_MOVE_e; + return dEvtMove_NOMOVE_e; } /* 80071418-80071468 .text compulsory__14dEvt_control_cFPvPCcUs */ diff --git a/src/d/d_item_data.cpp b/src/d/d_item_data.cpp index 8cb33379..ddf58504 100644 --- a/src/d/d_item_data.cpp +++ b/src/d/d_item_data.cpp @@ -78,7 +78,7 @@ #include "d/res/res_vmapq.h" #include "d/res/res_varrl.h" #include "d/res/res_vbow.h" -#include "d/res/res_fa.h" +// #include "d/res/res_fa.h" #include "d/res/res_shinju_d.h" #include "d/res/res_shinju_f.h" #include "d/res/res_fwbin.h" @@ -959,7 +959,11 @@ dItem_data_item_resource dItem_data::item_resource[0x100] = { { // 0x17: noentry23 /* mArcname */ NULL, +#if VERSION == VERSION_DEMO + /* mTexture */ NULL, +#else /* mTexture */ item_texture_tbl[TEXTURE_IDX_HEART_UP_02], +#endif /* mBmdIdx */ -1, /* mSrtIdx */ -1, /* mSrtIdx2 */ -1, @@ -975,7 +979,11 @@ dItem_data_item_resource dItem_data::item_resource[0x100] = { { // 0x18: noentry24 /* mArcname */ NULL, +#if VERSION == VERSION_DEMO + /* mTexture */ NULL, +#else /* mTexture */ item_texture_tbl[TEXTURE_IDX_HEART_UP_02], +#endif /* mBmdIdx */ -1, /* mSrtIdx */ -1, /* mSrtIdx2 */ -1, @@ -991,7 +999,11 @@ dItem_data_item_resource dItem_data::item_resource[0x100] = { { // 0x19: noentry25 /* mArcname */ NULL, +#if VERSION == VERSION_DEMO + /* mTexture */ NULL, +#else /* mTexture */ item_texture_tbl[TEXTURE_IDX_HEART_UP_02], +#endif /* mBmdIdx */ -1, /* mSrtIdx */ -1, /* mSrtIdx2 */ -1, @@ -4699,7 +4711,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x0B80 +#else /* mHeapSize */ 0x0680 +#endif }, { // 0x01: dItem_GREEN_RUPEE_e @@ -4712,7 +4728,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x00, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x02: dItem_BLUE_RUPEE_e @@ -4725,7 +4745,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x01, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x03: dItem_YELLOW_RUPEE_e @@ -4738,7 +4762,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x02, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x04: dItem_RED_RUPEE_e @@ -4751,7 +4779,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x03, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x05: dItem_PURPLE_RUPEE_e @@ -4764,7 +4796,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x04, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x06: dItem_ORANGE_RUPEE_e @@ -4777,7 +4813,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x05, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x07: dItem_HEART_PIECE_e @@ -4790,7 +4830,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2420 +#else /* mHeapSize */ 0x0C40 +#endif }, { // 0x08: dItem_HEART_CONTAINER_e @@ -4803,7 +4847,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2500 +#else /* mHeapSize */ 0x0C60 +#endif }, { // 0x09: dItem_SMALL_MAGIC_e @@ -4816,7 +4864,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x0B80 +#else /* mHeapSize */ 0x0700 +#endif }, { // 0x0A: dItem_LARGE_MAGIC_e @@ -4829,7 +4881,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x0B80 +#else /* mHeapSize */ 0x0700 +#endif }, { // 0x0B: dItem_BOMB_5_e @@ -4842,7 +4898,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3500 +#else /* mHeapSize */ 0x0CC0 +#endif }, { // 0x0C: dItem_BOMB_10_e @@ -4855,7 +4915,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3500 +#else /* mHeapSize */ 0x0CC0 +#endif }, { // 0x0D: dItem_BOMB_20_e @@ -4868,7 +4932,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3500 +#else /* mHeapSize */ 0x0CC0 +#endif }, { // 0x0E: dItem_BOMB_30_e @@ -4881,7 +4949,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3500 +#else /* mHeapSize */ 0x0CC0 +#endif }, { // 0x0F: dItem_SILVER_RUPEE_e @@ -4894,7 +4966,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x06, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x10: dItem_ARROW_10_e @@ -4907,7 +4983,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0700 +#endif }, { // 0x11: dItem_ARROW_20_e @@ -4920,7 +5000,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2000 +#else /* mHeapSize */ 0x0B40 +#endif }, { // 0x12: dItem_ARROW_30_e @@ -4933,7 +5017,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3000 +#else /* mHeapSize */ 0x1000 +#endif }, { // 0x13: noentry19 @@ -4972,7 +5060,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3500 +#else /* mHeapSize */ 0x0780 +#endif }, { // 0x16: dItem_RECOVER_FAIRY_e @@ -5102,7 +5194,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VHAPL, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0FE0 +#endif }, { // 0x20: dItem_TELESCOPE_e @@ -5596,7 +5692,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VDOKL, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2000 +#else /* mHeapSize */ 0x08A0 +#endif }, { // 0x46: dItem_BOKOBABA_SEED_e @@ -5609,7 +5709,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VBOKL, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0720 +#endif }, { // 0x47: dItem_GOLDEN_FEATHER_e @@ -5622,7 +5726,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VHANL, /* mTevFrm */ -1, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2000 +#else /* mHeapSize */ 0x0EC0 +#endif }, { // 0x48: BOKO_BELT @@ -5635,7 +5743,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VBELL, /* mTevFrm */ -1, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2000 +#else /* mHeapSize */ 0x0760 +#endif }, { // 0x49: dItem_RED_JELLY_e @@ -5648,7 +5760,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VCHUL, /* mTevFrm */ 0x01, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0800 +#endif }, { // 0x4A: dItem_GREEN_JELLY_e @@ -5661,7 +5777,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VCHUL, /* mTevFrm */ 0x00, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0800 +#endif }, { // 0x4B: dItem_BLUE_JELLY_e @@ -5674,7 +5794,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VCHUL, /* mTevFrm */ 0x02, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0800 +#endif }, { // 0x4C: dItem_MAP_e @@ -6389,7 +6513,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VESAL, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0740 +#endif }, { // 0x83: dItem_HYOI_PEAR_e @@ -6402,7 +6530,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0680 +#endif }, { // 0x84: ESA1 @@ -6519,7 +6651,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ FDAI_BCK_FOBJ00, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x08E0 +#endif }, { // 0x8D: FLOWER_2 @@ -6532,7 +6668,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ FDAI_BCK_FOBJ01, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0860 +#endif }, { // 0x8E: FLOWER_3 @@ -6545,7 +6685,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ FDAI_BCK_FOBJ02, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0880 +#endif }, { // 0x8F: HEROS_FLAG @@ -6558,7 +6702,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1200 +#else /* mHeapSize */ 0x1100 +#endif }, { // 0x90: TAIRYO_FLAG @@ -6571,7 +6719,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1200 +#else /* mHeapSize */ 0x1100 +#endif }, { // 0x91: SALES_FLAG @@ -6597,7 +6749,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ FDAI_BCK_FOBJ06, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0760 +#endif }, { // 0x93: RED_FLAG diff --git a/src/d/d_magma.cpp b/src/d/d_magma.cpp index 837be2d6..e24e8c05 100644 --- a/src/d/d_magma.cpp +++ b/src/d/d_magma.cpp @@ -173,7 +173,12 @@ void dMagma_floor_c::draw() { /* 80075CB8-80075DD8 .text calc__14dMagma_floor_cFi */ void dMagma_floor_c::calc(int i_roomNo) { mDoMtx_stack_c::scaleS(1.0f, 0.05f, 1.0f); - if (strcmp(dComIfGp_getStartStageName(), "M_DragB") == 0 || strcmp(dComIfGp_getStartStageName(), "Xboss0") == 0) + if ( + strcmp(dComIfGp_getStartStageName(), "M_DragB") == 0 +#if VERSION > VERSION_DEMO + || strcmp(dComIfGp_getStartStageName(), "Xboss0") == 0 +#endif + ) mDoMtx_stack_c::transM(0.0f, -(mPos.y + 20.0f), 0.0f); else mDoMtx_stack_c::transM(0.0f, -(mPos.y + 30.0f), 0.0f); diff --git a/src/d/d_s_actor_data_mng.cpp b/src/d/d_s_actor_data_mng.cpp index 8f3ac628..74c99993 100644 --- a/src/d/d_s_actor_data_mng.cpp +++ b/src/d/d_s_actor_data_mng.cpp @@ -115,8 +115,20 @@ void dADM::SetData(void* pData) { pHeader += 3; } - if (FindTag('ACFN', &row, &rowOffs) && FindTag('ACNA', &name, &nameOffs) && FindTag('ACDS', &dat_size, &dataOffs)) { - JUT_ASSERT(202, row * name == dat_size); - mCharTbl.SetData((u32)pData, row, rowOffs, name, nameOffs, dat_size, dataOffs); + u32 tag; + tag = 'ACFN'; + if (!FindTag(tag, &row, &rowOffs)) { + return; } + tag = 'ACNA'; + if (!FindTag(tag, &name, &nameOffs)) { + return; + } + tag = 'ACDS'; + if (!FindTag(tag, &dat_size, &dataOffs)) { + return; + } + + JUT_ASSERT(202, row * name == dat_size); + mCharTbl.SetData((u32)pData, row, rowOffs, name, nameOffs, dat_size, dataOffs); } diff --git a/src/d/d_s_open.cpp b/src/d/d_s_open.cpp index 7cb6ef4b..d030b42b 100644 --- a/src/d/d_s_open.cpp +++ b/src/d/d_s_open.cpp @@ -72,11 +72,15 @@ BOOL dScnOpen_c::draw() { /* 80232D38-80232DD8 .text __dt__10dScnOpen_cFv */ dScnOpen_c::~dScnOpen_c() { +#if VERSION > VERSION_DEMO if (mpProc != NULL) +#endif delete mpProc; +#if VERSION > VERSION_DEMO if (solid_heap != NULL) +#endif mDoExt_destroySolidHeap(solid_heap); - dComIfG_resDelete(&mPhs, "Opening"); + dComIfG_resDeleteDemo(&mPhs, "Opening"); dComIfGp_setWindowNum(0); } |
