@@ -98,10 +98,10 @@ void Urchin_init(sUrchin* pThis, sGenericFormationPerTypeData* pConfig)
9898
9999 init3DModelRawData (pThis, &pThis->m5C_model , 0 , pThis->m0_fileBundle , pConfig->m8_modelOffset , nullptr , pStaticPose, nullptr , pConfig->mC_hotspotDefinitions );
100100 Baldor_initSub0Sub1 (pThis, &pThis->m5C_model , &pThis->mB6_numTargetables , pThis->mC0_targetable , pThis->mC4_position );
101- updateUrchinAnimationSequence (pThis, readSaturnS16 ( pConfig->m1C + 0x1C ) , 0 , 1 , 1 );
101+ updateUrchinAnimationSequence (pThis, pConfig->m1C [ 0 ]. m1C_animationOffset , 0 , 1 , 1 );
102102 pThis->mC8 = createBaldorSubTask0 (&pThis->m8 , 0 , &pThis->mB4 , pConfig->m0 );
103103
104- if (!readSaturnEA ( pConfig->m1C ) .isNull ())
104+ if (!pConfig->m1C [ 0 ]. m0 .isNull ())
105105 {
106106 FunctionUnimplemented ();
107107 }
@@ -148,7 +148,7 @@ void urchinUpdateSub0(sUrchin* pThis)
148148 {
149149 if ((pThis->mB0_flags & 0x10 ) == 0 )
150150 {
151- if ((cVar1 != 0 ) && (gBattleManager ->m10_battleOverlay ->m4_battleEngine ->m38C_battleMode == 0 ) && (gBattleManager ->m10_battleOverlay ->m4_battleEngine ->m38D_battleSubMode == 4 ))
151+ if ((cVar1 != 0 ) && (gBattleManager ->m10_battleOverlay ->m4_battleEngine ->m38C_battleMode == eBattleModes::m0_shootEnemyWithGun ) && (gBattleManager ->m10_battleOverlay ->m4_battleEngine ->m38D_battleSubMode == 4 ))
152152 {
153153 for (int i = 0 ; i < pThis->mB6_numTargetables ; i++)
154154 {
@@ -237,7 +237,43 @@ void urchinUpdateSub0(sUrchin* pThis)
237237
238238void urchinUpdateSub1 (sUrchin * pThis)
239239{
240- FunctionUnimplemented ();
240+ s8 cVar1 = enemyQuadrantsTable[pThis->mD0 ->mD [pThis->mAF ]][gBattleManager ->m10_battleOverlay ->m4_battleEngine ->m22C_dragonCurrentQuadrant ];
241+
242+ if ((pThis->mB0_flags & 8 ) == 0 )
243+ {
244+ if ((pThis->mB0_flags & 0x10 ) == 0 )
245+ {
246+ if ((cVar1 != 0 ) && (gBattleManager ->m10_battleOverlay ->m4_battleEngine ->m38C_battleMode == eBattleModes::m3_shootEnemeyWithHomingLaser) && (gBattleManager ->m10_battleOverlay ->m4_battleEngine ->m38D_battleSubMode == 4 ))
247+ {
248+ for (int i = 0 ; i < pThis->mB6_numTargetables ; i++)
249+ {
250+ if ((pThis->mC0_targetable [i].m5A <= gBattleManager ->m10_battleOverlay ->m4_battleEngine ->m394 ) && (pThis->mC0_targetable [i].m5A != 0 ))
251+ {
252+ pThis->mB8_delay = gBattleManager ->m10_battleOverlay ->m4_battleEngine ->m394 * 4 + 0xF ;
253+ pThis->mB0_flags |= 8 ;
254+ return ;
255+ }
256+ }
257+ }
258+ }
259+ else
260+ {
261+ stepAnimation (&pThis->m5C_model );
262+ if (pThis->mB8_delay -- < 0 )
263+ {
264+ for (int i = 0 ; i < pThis->mB6_numTargetables ; i++)
265+ {
266+ pThis->mC0_targetable [i].m50_flags &= ~0x100000 ;
267+ }
268+ pThis->mB0_flags &= ~0x10 ;
269+ pThis->mD0 ->m14 [pThis->mAE ].m18 |= 0x20 ;
270+ }
271+ }
272+ }
273+ else
274+ {
275+ assert (0 );
276+ }
241277}
242278
243279void urchinUpdateSub2 (sUrchin * pThis)
@@ -255,12 +291,30 @@ void urchinUpdateSub2(sUrchin* pThis)
255291
256292void urchinUpdateSub3 (s_3dModel* pModel, std::vector<sVec3_FP >& pPosition)
257293{
258- FunctionUnimplemented ();
294+ if (pModel->m40 )
295+ {
296+ int outputIndex = 0 ;
297+ for (int i=0 ; i<pModel->m12_numBones ; i++)
298+ {
299+ if (pModel->m44_hotpointData [i].size ())
300+ {
301+ for (int j = 0 ; j < (*pModel->m40 )[i].m4_count ; j++)
302+ {
303+ pPosition[outputIndex++] = pModel->m44_hotpointData [i][j];
304+ }
305+ }
306+ }
307+ }
259308}
260309
261310void urchinUpdateSub4 (sUrchin * pThis)
262311{
263- FunctionUnimplemented ();
312+ int uVar1 = pThis->mCC ->m28 [enemyQuadrantsTable[pThis->mD0 ->mD [pThis->mAF ]][gBattleManager ->m10_battleOverlay ->m4_battleEngine ->m22C_dragonCurrentQuadrant ]];
313+
314+ for (int i = 0 ; i < pThis->mB6_numTargetables ; i++)
315+ {
316+ pThis->mC0_targetable [i].m60 = uVar1;
317+ }
264318}
265319
266320void Urchin_update (sUrchin * pThis)
@@ -350,7 +404,7 @@ void Urchin_update(sUrchin* pThis)
350404 {
351405 pThis->mB0_flags &= ~4 ;
352406 }
353- else if (updateUrchinAnimationSequence (pThis, readSaturnS32 ( pThis->mCC ->m1C + pThis->mB1 * 0x24 + 0x1C ) , 1 , 1 , 1 ))
407+ else if (updateUrchinAnimationSequence (pThis, pThis->mCC ->m1C [ pThis->mB1 ]. m1C_animationOffset , 1 , 1 , 1 ))
354408 {
355409 pThis->mB0_flags &= ~4 ;
356410 }
0 commit comments