Skip to content

Commit 4baf94a

Browse files
authored
Merge pull request #702 from minirop/some-cleanup
Some cleanup
2 parents eda9ed0 + 0d007b2 commit 4baf94a

17 files changed

+92
-114
lines changed

data/data_banim.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,13 @@ Img_SpellJavelinPaladin: @ 0x085DAFC4
489489
Pal_SpellJavelinPaladin: @ 0x085DB1E0
490490
.incbin "./graphics/efxmagic/Img_SpellJavelinPaladin.gbapal", 0x0, 0x20
491491

492-
.global Img_SpellJavelinPrgasusKnight
493-
Img_SpellJavelinPrgasusKnight: @ 0x085DB200
494-
.incbin "./graphics/efxmagic/Img_SpellJavelinPrgasusKnight.4bpp.lz"
492+
.global Img_SpellJavelinPegasusKnight
493+
Img_SpellJavelinPegasusKnight: @ 0x085DB200
494+
.incbin "./graphics/efxmagic/Img_SpellJavelinPegasusKnight.4bpp.lz"
495495

496-
.global Pal_SpellJavelinPrgasusKnight
497-
Pal_SpellJavelinPrgasusKnight: @ 0x085DB42C
498-
.incbin "./graphics/efxmagic/Img_SpellJavelinPrgasusKnight.gbapal", 0x0, 0x20
496+
.global Pal_SpellJavelinPegasusKnight
497+
Pal_SpellJavelinPegasusKnight: @ 0x085DB42C
498+
.incbin "./graphics/efxmagic/Img_SpellJavelinPegasusKnight.gbapal", 0x0, 0x20
499499

500500
.global Img_SpellJavelinFalcon
501501
Img_SpellJavelinFalcon: @ 0x085DB44C
File renamed without changes.

include/efxbattle.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,8 +935,8 @@ extern u16 Img_SpellJavelinSoldier[];
935935
extern u16 Pal_SpellJavelinSoldier[];
936936
extern u16 Img_SpellJavelinPaladin[];
937937
extern u16 Pal_SpellJavelinPaladin[];
938-
extern u16 Img_SpellJavelinPrgasusKnight[];
939-
extern u16 Pal_SpellJavelinPrgasusKnight[];
938+
extern u16 Img_SpellJavelinPegasusKnight[];
939+
extern u16 Pal_SpellJavelinPegasusKnight[];
940940
extern u16 Img_SpellJavelinFalcon[];
941941
extern u16 Pal_SpellJavelinFalcon[];
942942
extern u16 Img_SpellJavelinWyvernRider[];

include/efxmagic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ void StartSpellAnimJavelin(struct Anim * anim);
333333
void StartSpellAnimJavelinCavalier(struct Anim * anim);
334334
void StartSpellAnimJavelinSoldier(struct Anim * anim);
335335
void StartSpellAnimJavelinPaladin(struct Anim * anim);
336-
void StartSpellAnimJavelinPrgasusKnight(struct Anim * anim);
336+
void StartSpellAnimJavelinPegasusKnight(struct Anim * anim);
337337
void StartSpellAnimJavelinFalcon(struct Anim * anim);
338338
void StartSpellAnimJavelinWyvernRider(struct Anim * anim);
339339
void StartSpellAnimJavelinWyvernLord(struct Anim * anim);

include/ekrbattle.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -889,9 +889,9 @@ u16 IsItemDisplayedInBattle(u16 item);
889889
u16 IsWeaponLegency(u16 item);
890890
s16 EkrCheckWeaponSieglindeSiegmund(u16 item);
891891
bool EkrCheckAttackRound(u16 round);
892-
void SetBattleScriptted(void);
893-
void SetBattleUnscriptted(void);
894-
bool CheckBattleScriptted(void);
892+
void SetBattleScripted(void);
893+
void SetBattleUnscripted(void);
894+
bool CheckBattleScripted(void);
895895
// ??? GetEkrHit(???);
896896
// ??? GetEkrDmg(???);
897897
// ??? GetEkrCrit(???);

include/eventcall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ extern CONST_DATA EventListScr EventScr_Prologue_BeginningScene[];
203203
extern CONST_DATA EventListScr EventScr_Prologue_RenaisThroneCutscene[];
204204
extern CONST_DATA EventListScr EventScr_Prologue_GiveRapier[];
205205
extern CONST_DATA EventListScr EventScr_Prologue_ONeillSpawn[];
206-
extern CONST_DATA EventListScr EventScr_Prologue_OneEmimyLeft[];
206+
extern CONST_DATA EventListScr EventScr_Prologue_OneEnemyLeft[];
207207
extern CONST_DATA EventListScr EventScr_Prologue_ONeillAttack[];
208208
extern CONST_DATA EventListScr EventScr_Prologue_EndingScene[];
209209
extern CONST_DATA EventListScr EventScr_Prologue_EirikaAttacked[];

include/variables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ extern struct Unit* sUnitStackBase;
6363
extern struct Unit* sUnitStackTop;
6464
extern u8 sUnitStackSize;
6565

66-
extern int gBattleScriptted;
66+
extern int gBattleScripted;
6767
extern int gBaArenaFlag;
6868
// extern ??? gpActiveClassReelSpellProc
6969
// extern ??? gpActiveCRSpellBgColorProc

src/banim-battleparse.c

Lines changed: 53 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -314,31 +314,29 @@ const u16 gUnknown_080DAEE6[EKR_DISTANCE_MAX] = {
314314

315315
#if NONMATCHING
316316

317+
// https://decomp.me/scratch/kcZgC
317318
void 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
}

src/banim-efxmagic-phywpn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ void StartSpellAnimJavelinPaladin(struct Anim * anim)
419419
SpellFx_RegisterObjGfx(Img_SpellJavelinPaladin, 0x1000);
420420
}
421421

422-
void StartSpellAnimJavelinPrgasusKnight(struct Anim * anim)
422+
void StartSpellAnimJavelinPegasusKnight(struct Anim * anim)
423423
{
424424
struct ProcEfx * proc;
425425

@@ -432,8 +432,8 @@ void StartSpellAnimJavelinPrgasusKnight(struct Anim * anim)
432432
proc->hitted = CheckRoundMiss(GetAnimRoundTypeAnotherSide(anim));
433433

434434
NewEfxTeyariOBJ(anim, 1);
435-
SpellFx_RegisterObjPal(Pal_SpellJavelinPrgasusKnight, 0x20);
436-
SpellFx_RegisterObjGfx(Img_SpellJavelinPrgasusKnight, 0x1000);
435+
SpellFx_RegisterObjPal(Pal_SpellJavelinPegasusKnight, 0x20);
436+
SpellFx_RegisterObjGfx(Img_SpellJavelinPegasusKnight, 0x1000);
437437
}
438438

439439
void StartSpellAnimJavelinFalcon(struct Anim * anim)

src/banim-efxmagic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CONST_DATA SpellAnimFunc gEkrSpellAnimLut[] = {
1515
StartSpellAnimJavelinCavalier,
1616
StartSpellAnimJavelinSoldier,
1717
StartSpellAnimJavelinPaladin,
18-
StartSpellAnimJavelinPrgasusKnight,
18+
StartSpellAnimJavelinPegasusKnight,
1919
StartSpellAnimJavelinFalcon,
2020
StartSpellAnimJavelinWyvernRider,
2121
StartSpellAnimJavelinWyvernLord,

0 commit comments

Comments
 (0)