@@ -314,31 +314,29 @@ const u16 gUnknown_080DAEE6[EKR_DISTANCE_MAX] = {
314314
315315#if NONMATCHING
316316
317+ // https://decomp.me/scratch/kcZgC
317318void ParseBattleHitToBanimCmd (void )
318319{
319- u16 r0 ;
320- s16 * anim_round ;
321320 u32 i ;
322321 s16 r3 ;
323322 s16 new_hp ;
324323 u16 distance ;
325- u32 distance_r4 ;
326- s16 * anim_round_r4 ;
324+ s16 distance_r4 ;
327325 u16 * r5 ;
328- s16 * anim_round_r5 ;
329326 struct Unit * unit_r6 ;
330327 struct BattleHit * hit = gBattleHitArray ;
331328 u16 * r8 , r9 , r10 ;
332329 u16 sp00 [2 ];
333330 struct BattleUnit * bul_sp04 , * bur_sp08 ;
334331 int round_sp0C , is_enemy ;
335- u32 distance_sp14 , distance_sp18 , distance_sp1C ;
332+ s32 distance_sp14 , distance_sp18 ;
333+ s16 distance_sp1C ;
336334
337335 for (i = 0 ; i < 0x14 ; i ++ )
338- gAnimRoundData [i ] = gAnimRoundData [ i ] | 0xFFFF ;
336+ gAnimRoundData [i ] = 0xFFFF ;
339337
340338 for (i = 0 ; i < 0x14 ; i ++ )
341- gEfxHpLut [2 + i ] = gEfxHpLut [ 2 + i ] | 0xFFFF ;
339+ gEfxHpLut [2 + i ] = 0xFFFF ;
342340
343341 gpEkrTriangleUnits [1 ] = NULL ;
344342 gpEkrTriangleUnits [0 ] = NULL ;
@@ -350,7 +348,7 @@ void ParseBattleHitToBanimCmd(void)
350348 return ;
351349 }
352350
353- if (gBattleStats .config & 0x40 )
351+ if (gBattleStats .config & BATTLE_CONFIG_REFRESH )
354352 {
355353 gAnimRoundData [0 ] = 0x6 ;
356354 gAnimRoundData [1 ] = 0x0 ;
@@ -364,24 +362,24 @@ void ParseBattleHitToBanimCmd(void)
364362 bul_sp04 = gpEkrBattleUnitLeft ;
365363 bur_sp08 = gpEkrBattleUnitRight ;
366364
367- if (GetItemIndex (bul_sp04 -> weaponBefore ) == 0x11 && distance == 0 )
365+ if (GetItemIndex (bul_sp04 -> weaponBefore ) == ITEM_SWORD_RUNESWORD && distance == 0 )
368366 distance_sp14 = 1 ;
369- if (GetItemIndex (bur_sp08 -> weaponBefore ) == 0x11 && distance_sp18 == 0 )
367+ if (GetItemIndex (bur_sp08 -> weaponBefore ) == ITEM_SWORD_RUNESWORD && distance_sp18 == 0 )
370368 distance_sp18 = 1 ;
371369
372- if (GetItemIndex (bul_sp04 -> weaponBefore ) == 0x28 && distance_sp14 == 0 )
370+ if (GetItemIndex (bul_sp04 -> weaponBefore ) == ITEM_AXE_HANDAXE && distance_sp14 == 0 )
373371 distance_sp14 = 1 ;
374- if (GetItemIndex (bur_sp08 -> weaponBefore ) == 0x28 && distance_sp18 == 0 )
372+ if (GetItemIndex (bur_sp08 -> weaponBefore ) == ITEM_AXE_HANDAXE && distance_sp18 == 0 )
375373 distance_sp18 = 1 ;
376374
377- if (GetItemIndex (bul_sp04 -> weaponBefore ) == 0x29 && distance_sp14 == 0 )
375+ if (GetItemIndex (bul_sp04 -> weaponBefore ) == ITEM_AXE_TOMAHAWK && distance_sp14 == 0 )
378376 distance_sp14 = 1 ;
379- if (GetItemIndex (bur_sp08 -> weaponBefore ) == 0x29 && distance_sp18 == 0 )
377+ if (GetItemIndex (bur_sp08 -> weaponBefore ) == ITEM_AXE_TOMAHAWK && distance_sp18 == 0 )
380378 distance_sp18 = 1 ;
381379
382- if (GetItemIndex (bul_sp04 -> weaponBefore ) == 0x2C && distance_sp14 == 0 )
380+ if (GetItemIndex (bul_sp04 -> weaponBefore ) == ITEM_AXE_HATCHET && distance_sp14 == 0 )
383381 distance_sp14 = 1 ;
384- if (GetItemIndex (bur_sp08 -> weaponBefore ) == 0x2C && distance_sp18 == 0 )
382+ if (GetItemIndex (bur_sp08 -> weaponBefore ) == ITEM_AXE_HATCHET && distance_sp18 == 0 )
385383 distance_sp18 = 1 ;
386384
387385 /* _08058332 */
@@ -436,37 +434,37 @@ void ParseBattleHitToBanimCmd(void)
436434 if (hit -> attributes & BATTLE_HIT_ATTR_CRIT )
437435 {
438436 if (!UnitHasMagicRank (unit_r6 ))
439- * r5 = gUnknown_080DAEA0 [( s16 ) distance_r4 ];
437+ * r5 = gUnknown_080DAEA0 [distance_r4 ];
440438 else
441- * r5 = gUnknown_080DAEC8 [( s16 ) distance_r4 ];
439+ * r5 = gUnknown_080DAEC8 [distance_r4 ];
442440 }
443441 else if (hit -> attributes & BATTLE_HIT_ATTR_SILENCER )
444442 {
445443 if (!UnitHasMagicRank (unit_r6 ))
446- * r5 = gUnknown_080DAEA0 [( s16 ) distance_r4 ];
444+ * r5 = gUnknown_080DAEA0 [distance_r4 ];
447445 else
448- * r5 = gUnknown_080DAEC8 [( s16 ) distance_r4 ];
446+ * r5 = gUnknown_080DAEC8 [distance_r4 ];
449447 }
450448 else if (r3 >= 0 )
451449 {
452450 if (!UnitHasMagicRank (unit_r6 ))
453- * r5 = gUnknown_080DAE8C [( s16 ) distance_r4 ];
451+ * r5 = gUnknown_080DAE8C [distance_r4 ];
454452 else
455- * r5 = gUnknown_080DAEBE [( s16 ) distance_r4 ];
453+ * r5 = gUnknown_080DAEBE [distance_r4 ];
456454 }
457455 else
458456 {
459457 switch (sub_80716B0 (2 )) {
460458 case 0 :
461- * r5 = gUnknown_080DAED2 [( s16 ) distance_r4 ];
459+ * r5 = gUnknown_080DAED2 [distance_r4 ];
462460 break ;
463461
464462 case 1 :
465- * r5 = gUnknown_080DAEDC [( s16 ) distance_r4 ];
463+ * r5 = gUnknown_080DAEDC [distance_r4 ];
466464 break ;
467465
468466 case 2 :
469- * r5 = gUnknown_080DAEE6 [( s16 ) distance_r4 ];
467+ * r5 = gUnknown_080DAEE6 [distance_r4 ];
470468 break ;
471469
472470 default :
@@ -478,38 +476,20 @@ void ParseBattleHitToBanimCmd(void)
478476 if (hit -> attributes & BATTLE_HIT_ATTR_MISS )
479477 {
480478 if (!UnitHasMagicRank (unit_r6 ))
481- * r5 = gUnknown_080DAE96 [( s16 ) distance_r4 ];
479+ * r5 = gUnknown_080DAE96 [distance_r4 ];
482480 else
483- * r5 = gUnknown_080DAEBE [( s16 ) distance_r4 ];
481+ * r5 = gUnknown_080DAEBE [distance_r4 ];
484482
485- * r8 = gUnknown_080DAEAA [( s16 ) distance_sp1C ];
483+ * r8 = gUnknown_080DAEAA [distance_sp1C ];
486484 }
487485 else
488486 {
489- * r8 = gUnknown_080DAEB4 [( s16 ) distance_sp1C ];
487+ * r8 = gUnknown_080DAEB4 [distance_sp1C ];
490488 }
491- /* _080584EC */
492- #ifndef NONMATCHING
493- {
494- register u16 * r3 asm("r3" );
495- anim_round = gAnimRoundData ;
496- anim_round_r5 = anim_round + round_sp0C * 2 ;
497- r0 = sp00 [0 ];
498489
499- asm("" ::"r" (unit_r6 = 0 ));
500-
501- * anim_round_r5 = r0 ;
502- anim_round_r4 = anim_round + ({round_sp0C * 2 + 1 ;});
503- r3 = sp00 ;
504- * anim_round_r4 = r3 [1 ];
505- }
506- #else
507- anim_round = gAnimRoundData ;
508- anim_round_r5 = anim_round + round_sp0C * 2 ;
509- * anim_round_r5 = sp00 [0 ];
510- anim_round_r4 = anim_round + ({round_sp0C * 2 + 1 ;});
511- * anim_round_r4 = sp00 [1 ];
512- #endif
490+ gAnimRoundData [round_sp0C * 2 ] = sp00 [POS_L ];
491+ gAnimRoundData [round_sp0C * 2 + 1 ] = sp00 [POS_R ];
492+
513493 if (0 == (hit -> attributes & BATTLE_HIT_ATTR_MISS ))
514494 {
515495 if (hit -> attributes & BATTLE_HIT_ATTR_DEVIL )
@@ -522,7 +502,7 @@ void ParseBattleHitToBanimCmd(void)
522502
523503 r9 = r9 + 1 ;
524504 gEfxHpLut [r9 * 2 ] = new_hp ;
525- * anim_round_r5 = ( u32 ) * anim_round_r5 | ({ 0xFFFF8000 + 0 ;}) ;
505+ gAnimRoundData [ round_sp0C * 2 ] |= ANIM_ROUND_DEVIL ;
526506 }
527507 else
528508 {
@@ -532,7 +512,7 @@ void ParseBattleHitToBanimCmd(void)
532512
533513 r10 = r10 + 1 ;
534514 gEfxHpLut [r10 * 2 + 1 ] = new_hp ;
535- * anim_round_r4 = ( u32 ) * anim_round_r4 | ({ 0xFFFF8000 + 0 ;}) ;
515+ gAnimRoundData [ round_sp0C * 2 + 1 ] |= ANIM_ROUND_DEVIL ;
536516 }
537517 }
538518 /* _080585B4 */
@@ -583,20 +563,20 @@ void ParseBattleHitToBanimCmd(void)
583563 r10 = r10 + 1 ;
584564 gEfxHpLut [r10 * 2 + 1 ] = new_hp ;
585565
586- if (hit -> attributes & 0x40 )
587- * anim_round_r4 |= 0x2000 ;
566+ if (hit -> attributes & BATTLE_HIT_ATTR_POISON )
567+ gAnimRoundData [ round_sp0C * 2 + 1 ] |= ANIM_ROUND_POISON ;
588568
589- if (hit -> attributes & 0x800 )
590- * anim_round_r5 |= 0x1000 ;
569+ if (hit -> attributes & BATTLE_HIT_ATTR_SILENCER )
570+ gAnimRoundData [ round_sp0C * 2 ] |= ANIM_ROUND_SILENCER ;
591571
592- if (hit -> attributes & 0x4000 )
593- * anim_round_r5 |= 0x800 ;
572+ if (hit -> attributes & BATTLE_HIT_ATTR_SURESHOT )
573+ gAnimRoundData [ round_sp0C * 2 ] |= ANIM_ROUND_SURE_SHOT ;
594574
595- if (hit -> attributes & 0x10000 )
596- * anim_round_r5 |= 0x200 ;
575+ if (hit -> attributes & BATTLE_HIT_ATTR_PIERCE )
576+ gAnimRoundData [ round_sp0C * 2 ] |= ANIM_ROUND_PIERCE ;
597577
598- if (hit -> attributes & 0x8000 )
599- * anim_round_r5 |= 0x400 ;
578+ if (hit -> attributes & BATTLE_HIT_ATTR_GREATSHLD )
579+ gAnimRoundData [ round_sp0C * 2 ] |= ANIM_ROUND_GREAT_SHIELD ;
600580 }
601581 /* _0805876C */
602582 else
@@ -608,20 +588,20 @@ void ParseBattleHitToBanimCmd(void)
608588 r9 = r9 + 1 ;
609589 gEfxHpLut [r9 * 2 ] = new_hp ;
610590
611- if (hit -> attributes & 0x40 )
612- * anim_round_r5 |= 0x2000 ;
591+ if (hit -> attributes & BATTLE_HIT_ATTR_POISON )
592+ gAnimRoundData [ round_sp0C * 2 ] |= ANIM_ROUND_POISON ;
613593
614- if (hit -> attributes & 0x800 )
615- * anim_round_r4 |= 0x1000 ;
594+ if (hit -> attributes & BATTLE_HIT_ATTR_SILENCER )
595+ gAnimRoundData [ round_sp0C * 2 + 1 ] |= ANIM_ROUND_SILENCER ;
616596
617- if (hit -> attributes & 0x4000 )
618- * anim_round_r4 |= 0x800 ;
597+ if (hit -> attributes & BATTLE_HIT_ATTR_SURESHOT )
598+ gAnimRoundData [ round_sp0C * 2 + 1 ] |= ANIM_ROUND_SURE_SHOT ;
619599
620- if (hit -> attributes & 0x10000 )
621- * anim_round_r4 |= 0x200 ;
600+ if (hit -> attributes & BATTLE_HIT_ATTR_PIERCE )
601+ gAnimRoundData [ round_sp0C * 2 + 1 ] |= ANIM_ROUND_PIERCE ;
622602
623- if (hit -> attributes & 0x8000 )
624- * anim_round_r4 |= 0x400 ;
603+ if (hit -> attributes & BATTLE_HIT_ATTR_GREATSHLD )
604+ gAnimRoundData [ round_sp0C * 2 + 1 ] |= ANIM_ROUND_GREAT_SHIELD ;
625605 }
626606 }
627607 }
0 commit comments