diff options
Diffstat (limited to 'src/d/actor/d_a_obj_sw.cpp')
| -rw-r--r-- | src/d/actor/d_a_obj_sw.cpp | 350 |
1 files changed, 224 insertions, 126 deletions
diff --git a/src/d/actor/d_a_obj_sw.cpp b/src/d/actor/d_a_obj_sw.cpp index 1449894ddc..1f037f4cad 100644 --- a/src/d/actor/d_a_obj_sw.cpp +++ b/src/d/actor/d_a_obj_sw.cpp @@ -6,8 +6,8 @@ //#define VIRTUAL_3DLINEMAT #include "m_Do/m_Do_ext.h" #include "d/d_camera.h" - #include "d/actor/d_a_obj_sw.h" +#include "d/d_com_inf_game.h" #include "dol2asm.h" @@ -118,154 +118,239 @@ extern "C" extern void* __vt__19mDoExt_3DlineMat1_c[5]; extern "C" extern void* __vt__16Z2SoundObjSimple[8]; extern "C" u8 m_cpadInfo__8mDoCPd_c[256]; extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" u8 sincosTable___5JMath[65536]; -// -// Declarations: -// - -/* ############################################################################################## */ -/* 80CF30FC-80CF3100 000000 0004+00 1/1 0/0 0/0 .data l_color$3804 */ -SECTION_DATA static u8 l_color[4] = { - 0x14, - 0x0F, - 0x00, - 0xFF, -}; - /* 80CF0638-80CF0774 000078 013C+00 1/0 0/0 0/0 .text daObj_Sw_Draw__FP12obj_sw_class */ -static void daObj_Sw_Draw(obj_sw_class* param_0) { +static int daObj_Sw_Draw(obj_sw_class* i_this) { // NONMATCHING + static _GXColor l_color = { + 0x14, + 0x0F, + 0x00, + 0xFF, + }; + + fopAc_ac_c* a_this = &i_this->actor; + if (i_this->field_0x570 == 8) { + g_env_light.settingTevStruct(0, &a_this->current.pos, &a_this->tevStr); + obj_sc_s* sc_p = &i_this->field_0x5a8; + for (int i = 0; i < 8; i++) { + if (sc_p->field_0x0 != 0) { + g_env_light.setLightTevColorType_MAJI(sc_p->mpModelMorf->getModel(), &a_this->tevStr); + sc_p->mpModelMorf->entryDL(); + + if (i == 2 && i_this->field_0x864.mpModel != NULL) { + g_env_light.setLightTevColorType_MAJI(i_this->field_0x864.mpModel, &a_this->tevStr); + mDoExt_modelUpdateDL(i_this->field_0x864.mpModel); + } + } + sc_p = (obj_sc_s *)((s8*)sc_p + 100); + } + } else { + g_env_light.settingTevStruct(16, &a_this->current.pos, &a_this->tevStr); + i_this->field_0xd50.update(63, l_color, &a_this->tevStr); + dComIfGd_set3DlineMat(&i_this->field_0xd50); + } + + return 1; } -/* ############################################################################################## */ /* 80CF3278-80CF327C 000000 0004+00 3/3 0/0 0/0 .bss saru_ct */ -static u8 saru_ct[4]; +static int saru_ct; /* 80CF0774-80CF07F8 0001B4 0084+00 1/1 0/0 0/0 .text s_ks_sub__FPvPv */ -static void s_ks_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_ks_sub(void* i_actor, void* i_data) { + if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_NPC_KS) { + int swBit = fopAcM_GetParam(i_actor) >> 24; + if (swBit != 0xFF) { + if (dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo((fopAc_ac_c*)i_actor))) { + saru_ct++; + } + } + } + return NULL; } +struct path { + int field_0x0; + f32 field_0x4; + f32 field_0x8; + f32 field_0xc; +}; /* ############################################################################################## */ /* 80CF3100-80CF3210 000004 0110+00 3/3 0/0 0/0 .data sc_path */ -SECTION_DATA static u8 sc_path[272] = { - 0x00, 0x00, 0x00, 0x01, 0x45, 0xFF, 0x60, 0x00, 0x45, 0x53, 0x40, 0x00, 0xC6, 0x2A, 0x1C, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x46, 0x01, 0xC4, 0x00, 0x45, 0x5C, 0x40, 0x00, 0xC6, 0x30, 0x2C, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x46, 0x09, 0x18, 0x00, 0x45, 0x65, 0xD0, 0x00, 0xC6, 0x27, 0xA0, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x46, 0x09, 0x68, 0x00, 0x45, 0x65, 0xD0, 0x00, 0xC6, 0x32, 0x80, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x46, 0x10, 0xCC, 0x00, 0x45, 0x72, 0xF0, 0x00, 0xC6, 0x25, 0x68, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x46, 0x0C, 0xD4, 0x00, 0x45, 0x73, 0xE0, 0x00, 0xC6, 0x37, 0x5C, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x46, 0x0F, 0x80, 0x00, 0x45, 0x79, 0xD0, 0x00, 0xC6, 0x2F, 0x78, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x46, 0x10, 0x58, 0x00, 0x45, 0x80, 0xF8, 0x00, 0xC6, 0x39, 0xB8, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x46, 0x16, 0x60, 0x00, 0x45, 0x8F, 0xD0, 0x00, 0xC6, 0x36, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x46, 0x14, 0xA4, 0x00, 0x45, 0x97, 0xB0, 0x00, 0xC6, 0x3E, 0xC4, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x46, 0x0D, 0x64, 0x00, 0x45, 0x9D, 0x58, 0x00, 0xC6, 0x3C, 0x48, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x46, 0x08, 0x2C, 0x00, 0x45, 0x9E, 0xD8, 0x00, 0xC6, 0x38, 0x24, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x46, 0x03, 0xB0, 0x00, 0x45, 0xA2, 0xB0, 0x00, 0xC6, 0x31, 0xF0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x7C, 0x00, 0x45, 0xA7, 0x48, 0x00, 0xC6, 0x2F, 0xC8, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x45, 0xF5, 0x58, 0x00, 0x45, 0xAA, 0xA0, 0x00, 0xC6, 0x30, 0x14, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x45, 0xED, 0x78, 0x00, 0x45, 0xAD, 0x08, 0x00, 0xC6, 0x2E, 0xC8, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +static path sc_path[17] = { + {1, 8172.0f, 3380.0f, -10887.0f}, + {1, 8305.0f, 3524.0f, -11275.0f}, + {1, 8774.0f, 3677.0f, -10728.0f}, + {1, 8794.0f, 3677.0f, -11424.0f}, + {1, 9267.0f, 3887.0f, -10586.0f}, + {1, 9013.0f, 3902.0f, -11735.0f}, + {1, 9184.0f, 3997.0f, -11230.0f}, + {1, 9238.0f, 4127.0f, -11886.0f}, + {1, 9624.0f, 4602.0f, -11648.0f}, + {0, 9513.0f, 4854.0f, -12209.0f}, + {0, 9049.0f, 5035.0f, -12050.0f}, + {0, 8715.0f, 5083.0f, -11785.0f}, + {0, 8428.0f, 5206.0f, -11388.0f}, + {0, 8223.0f, 5353.0f, -11250.0f}, + {0, 7851.0f, 5460.0f, -11269.0f}, + {0, 7599.0f, 5537.0f, -11186.0f}, + {0, 0.0f, 0.0f, 0.0f}, + // 0x00000001, 0x45FF6000, 0x45534000, 0xC62A1C00, + // 0x00000001, 0x4601C400, 0x455C4000, 0xC6302C00, + // 0x00000001, 0x46091800, 0x4565D000, 0xC627A000, + // 0x00000001, 0x46096800, 0x4565D000, 0xC6328000, + // 0x00000001, 0x4610CC00, 0x4572F000, 0xC6256800, + // 0x00000001, 0x460CD400, 0x4573E000, 0xC6375C00, + // 0x00000001, 0x460F8000, 0x4579D000, 0xC62F7800, + // 0x00000001, 0x46105800, 0x4580F800, 0xC639B800, + // 0x00000001, 0x46166000, 0x458FD000, 0xC6360000, + // 0x00000000, 0x4614A400, 0x4597B000, 0xC63EC400, + // 0x00000000, 0x460D6400, 0x459D5800, 0xC63C4800, + // 0x00000000, 0x46082C00, 0x459ED800, 0xC6382400, + // 0x00000000, 0x4603B000, 0x45A2B000, 0xC631F000, + // 0x00000000, 0x46007C00, 0x45A74800, 0xC62FC800, + // 0x00000000, 0x45F55800, 0x45AAA000, 0xC6301400, + // 0x00000000, 0x45ED7800, 0x45AD0800, 0xC62EC800, + // 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; /* 80CF07F8-80CF08F8 000238 0100+00 1/1 0/0 0/0 .text s_ksdel_sub__FPvPv */ -static void s_ksdel_sub(void* param_0, void* param_1) { +static void* s_ksdel_sub(void* i_actor, void* i_data) { // NONMATCHING -} - -/* ############################################################################################## */ -/* 80CF3000-80CF3004 000000 0004+00 8/8 0/0 0/0 .rodata @3850 */ -SECTION_RODATA static u8 const lit_3850[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80CF3000, &lit_3850); - -/* 80CF3004-80CF3008 000004 0004+00 1/1 0/0 0/0 .rodata @3851 */ -SECTION_RODATA static f32 const lit_3851 = -1.0f; -COMPILER_STRIP_GATE(0x80CF3004, &lit_3851); + if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_NPC_KS) { + fopAcM_delete((fopAc_ac_c*)i_actor); -/* 80CF30EC-80CF30EC 0000EC 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80CF30EC = "Npc_ksw"; -#pragma pop + saru_ct++; + } + return NULL; +} /* 80CF08F8-80CF09A8 000338 00B0+00 3/3 0/0 0/0 .text anm_init__FP8obj_sc_sifUcf */ -static void anm_init(obj_sc_s* param_0, int param_1, f32 param_2, u8 param_3, f32 param_4) { - // NONMATCHING +static void anm_init(obj_sc_s* i_this, int param_2, f32 i_morf, u8 i_mode, f32 i_speed) { + i_this->mpModelMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("Npc_ksw", param_2), i_mode, i_morf, + i_speed, 0.0f, -1.0f, NULL); + i_this->field_0x3c = param_2; } -/* ############################################################################################## */ -/* 80CF3008-80CF300C 000008 0004+00 0/4 0/0 0/0 .rodata @3976 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3976 = 5.0f; -COMPILER_STRIP_GATE(0x80CF3008, &lit_3976); -#pragma pop - -/* 80CF300C-80CF3010 00000C 0004+00 0/5 0/0 0/0 .rodata @3977 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3977 = 1.0f; -COMPILER_STRIP_GATE(0x80CF300C, &lit_3977); -#pragma pop - -/* 80CF3010-80CF3014 000010 0004+00 0/3 0/0 0/0 .rodata @3978 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3978 = 2.0f; -COMPILER_STRIP_GATE(0x80CF3010, &lit_3978); -#pragma pop - -/* 80CF3014-80CF3018 000014 0004+00 0/4 0/0 0/0 .rodata @3979 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3979 = 40.0f; -COMPILER_STRIP_GATE(0x80CF3014, &lit_3979); -#pragma pop - -/* 80CF3018-80CF301C 000018 0004+00 0/1 0/0 0/0 .rodata @3980 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3980 = 25.0f; -COMPILER_STRIP_GATE(0x80CF3018, &lit_3980); -#pragma pop - -/* 80CF301C-80CF3020 00001C 0004+00 0/1 0/0 0/0 .rodata @3981 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3981 = 1700.0f; -COMPILER_STRIP_GATE(0x80CF301C, &lit_3981); -#pragma pop - -/* 80CF3020-80CF3024 000020 0004+00 0/1 0/0 0/0 .rodata @3982 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3982 = -35.0f; -COMPILER_STRIP_GATE(0x80CF3020, &lit_3982); -#pragma pop - -/* 80CF3024-80CF3028 000024 0004+00 0/2 0/0 0/0 .rodata @3983 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3983 = 30.0f; -COMPILER_STRIP_GATE(0x80CF3024, &lit_3983); -#pragma pop - /* 80CF09A8-80CF1008 0003E8 0660+00 1/1 0/0 0/0 .text sc_build__FP12obj_sw_class */ -static void sc_build(obj_sw_class* param_0) { - // NONMATCHING -} - -/* 80CF1008-80CF1044 000A48 003C+00 1/1 0/0 0/0 .text __dt__4cXyzFv */ -//cXyz::~cXyz() { -void __dt__4cXyzFv() { +static void sc_build(obj_sw_class* i_this) { // NONMATCHING + fopAc_ac_c* a_this = &i_this->actor; + obj_sc_s* sc_p = &i_this->field_0x5a8; + cXyz sp24, sp30; + + for (int i = 0; i < 8; i++) { + if (sc_p->field_0x34 != 0) { + sc_p->field_0x34--; + } + + s16 sVar1; + switch (sc_p->field_0x0) { + case 0: + anm_init(sc_p, 14, 5.0f, 2, 1.0f); + sc_p->field_0x0 = 1; + sc_p->field_0x10 = sc_p->field_0x4; + sc_p->field_0x1c.x = sc_path[sc_p->field_0x38].field_0x4; + sc_p->field_0x1c.y = sc_path[sc_p->field_0x38].field_0x8; + sc_p->field_0x1c.z = sc_path[sc_p->field_0x38].field_0xc; + break; + + case 1: + sp24 = sc_p->field_0x1c - sc_p->field_0x4; + cLib_addCalcAngleS2(&sc_p->field_0x2a, cM_atan2s(sp24.x, sp24.z), 1, 0x2000); + if (sc_p->field_0x34 == 0) { + sc_p->field_0x0 = 2; + anm_init(sc_p, 11, 2.0f, 0, 1.0f); + } + break; + + case 2: + if (sc_path[sc_p->field_0x38].field_0x0 == 1) { + if (sc_p->field_0x3c == 11) { + if (sc_p->mpModelMorf->isStop()) { + anm_init(sc_p, 12, 1.0f, 0, 1.0f); + sc_p->mSound.startSound(Z2SE_KOSARU_V_JUMP, 0, -1); + sc_p->mSound.startSound(Z2SE_KOSARU_JUMP_START, 0, -1); + sc_p->mSound.startSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + sc_p->field_0x30 = 40.0f; + } + } + } else { + sc_p->field_0x30 = 25.0f; + } + + sp24 = sc_p->field_0x1c - sc_p->field_0x4; + sVar1 = cM_atan2s(sp24.x, sp24.z); + cLib_addCalcAngleS2(&sc_p->field_0x2a, sVar1, 1, 0x2000); + cMtx_YrotS(*calc_mtx, sVar1); + cMtx_XrotM(*calc_mtx, -cM_atan2s(sp24.y, JMAFastSqrt(sp24.x * sp24.x + sp24.z * sp24.z))); + sp24.x = 0.0f; + sp24.y = 0.0f; + sp24.z = sc_p->field_0x30; + MtxPosition(&sp24, &sp30); + sc_p->field_0x4 += sp30; + sp24 = sc_p->field_0x1c - sc_p->field_0x4; + + if ((sp24.x * sp24.x + sp24.z * sp24.z) <= 1700.0f) { + sc_p->field_0x4 = sc_p->field_0x1c; + if (sc_p->field_0x38 == 16) { + sc_p->field_0x0 = 3; + anm_init(sc_p, 4, 2.0f, 2, 2.0f); + sc_p->field_0x30 = 0.0f; + sc_p->mSound.startSound(Z2SE_KOSARU_V_WAIT, 0, -1); + } else { + sc_p->field_0x38++; + sc_p->field_0x10 = sc_p->field_0x4; + sc_p->field_0x1c.x = sc_path[sc_p->field_0x38].field_0x4; + sc_p->field_0x1c.y = sc_path[sc_p->field_0x38].field_0x8; + sc_p->field_0x1c.z = sc_path[sc_p->field_0x38].field_0xc; + + if (sc_path[sc_p->field_0x38].field_0x0 == 1) { + anm_init(sc_p, 11, 2.0f, 0, 1.0f); + sc_p->field_0x30 = 0.0f; + } else if (sc_p->field_0x3c != 10) { + anm_init(sc_p, 10, 2.0f, 2, 1.0f); + } + } + } + break; + + case 3: + cLib_addCalcAngleS2(&sc_p->field_0x2a, a_this->current.angle.y + 0x8000, 2, 0x1000); + cMtx_YrotS(*calc_mtx, sc_p->field_0x2a); + sp24.x = 0.0f; + sp24.y = 0.0f; + sp24.z = -35.0f; + MtxPosition(&sp24, &sp30); + cLib_addCalc2(&sc_p->field_0x4.x, a_this->eyePos.x + sp30.x, 1.0f, 30.0f); + cLib_addCalc2(&sc_p->field_0x4.y, a_this->eyePos.y, 1.0f, 30.0f); + cLib_addCalc2(&sc_p->field_0x4.z, a_this->eyePos.z + sp30.z, 1.0f, 30.0f); + + if (sc_p->field_0x4.y <= a_this->eyePos.y + 1.0f) { + sp24 = sc_p->field_0x4 - a_this->eyePos; + anm_init(sc_p, 13, 5.0f, 0, 1.0f); + sc_p->field_0x0 = 10; + sc_p->mSound.startSound(Z2SE_KOSARU_V_WAIT, 0, -1); + + if (i == 7) { + i_this->field_0x576 = 2; + i_this->field_0x57c = 120; + int swBit = fopAcM_GetParam(a_this) >> 24; + if (swBit != 0xFF) { + dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(a_this)); + } + } + } + } + + if (sc_p->field_0x30 >= 30.0f) { + sc_p->field_0x35 = 1; + } + + sc_p = (obj_sc_s *)((s8*)sc_p + 100); + } } /* ############################################################################################## */ @@ -360,8 +445,21 @@ COMPILER_STRIP_GATE(0x80CF3060, &lit_4067); #pragma pop /* 80CF1044-80CF1384 000A84 0340+00 1/1 0/0 0/0 .text sc_move__FP12obj_sw_class */ -static void sc_move(obj_sw_class* param_0) { +static void sc_move(obj_sw_class* i_this) { // NONMATCHING + cXyz sp24, sp30; + + if (i_this->field_0x864.field_0x68 == 0) { + if (i_this->field_0x57a == 0) { + if (cM_rndF(1.0f) >= 0.2f) { + if (cM_rndF(1.0f) >= 0.33f) { + if (cM_rndF(1.0f) >= 0.5f) { + + } + } + } + } + } } /* ############################################################################################## */ |
