shithub: zelda3

Download patch

ref: e2cea92259ab384150ee7056695db359745f9987
parent: 654a13d1be36990d5d61175708dacdfb2e006456
author: Snesrev <snesrev@protonmail.com>
date: Thu Sep 29 22:57:10 EDT 2022

Fix Mothula L3/L4 sword damage (#126)

--- a/sprite.c
+++ b/sprite.c
@@ -2040,7 +2040,14 @@
 
   if (sprite_tiletype == 0x44) {
     if (sprite_F[k] && !sign8(sprite_give_damage[k])) {
-      Ancilla_CheckDamageToSprite_preset(k, 4);
+
+      // Some mothula bug fix because we changed damage class 4.
+      if (sprite_type[k] == 0x88 && (enhanced_features0 & kFeatures0_MiscBugFixes)) {
+        if (sprite_hit_timer[k] == 0)
+          Ancilla_CheckDamageToSprite_preset(k, 6);
+      } else {
+        Ancilla_CheckDamageToSprite_preset(k, 4);
+      }
       if (sprite_hit_timer[k]) {
         sprite_hit_timer[k] = 153;
         sprite_F[k] = 0;
@@ -2315,10 +2322,10 @@
   if ((sprite_flags3[k] & 0x40) || sprite_type[k] >= 0xD8)
     return;
   uint8 dmg = kEnemyDamages[damage_type_determiner * 8 | enemy_damage_data[sprite_type[k] * 16 | damage_type_determiner]];
-  AgahnimBalls_DamageAgahnim(k, dmg, a);
+  Sprite_GiveDamage(k, dmg, a);
 }
 
-void AgahnimBalls_DamageAgahnim(int k, uint8 dmg, uint8 r0_hit_timer) {  // 86edc5
+void Sprite_GiveDamage(int k, uint8 dmg, uint8 r0_hit_timer) {  // 86edc5
   if (dmg == 249) {
     Sprite_Func18(k, 0xe3);
     return;
--- a/sprite.h
+++ b/sprite.h
@@ -204,7 +204,7 @@
 void Sprite_Func15(int k, int a);
 void Sprite_CalculateSwordDamage(int k);
 void Sprite_ApplyCalculatedDamage(int k, int a);
-void AgahnimBalls_DamageAgahnim(int k, uint8 dmg, uint8 r0_hit_timer);
+void Sprite_GiveDamage(int k, uint8 dmg, uint8 r0_hit_timer);
 void Sprite_Func18(int k, uint8 new_type);
 void Sprite_MiniMoldorm_Recoil(int k);
 void Sprite_Func3(int k);
--- a/sprite_main.c
+++ b/sprite_main.c
@@ -22785,6 +22785,11 @@
 }
 
 void Sprite_88_Mothula(int k) {  // 9ebe7e
+  if (enhanced_features0 & kFeatures0_MiscBugFixes) {
+    // L4 sword and L3 spin slash can now damage Mothula
+    enemy_damage_data[0x884] = 1;
+    enemy_damage_data[0x885] = 1;
+  }
   Mothula_Main(k);
   if (Sprite_ReturnIfInactive(k))
     return;
@@ -24185,7 +24190,7 @@
     hb.r9_yhi = sprite_y_hi[k];
     Sprite_SetupHitBox(0, &hb);
     if (CheckIfHitBoxesOverlap(&hb)) {
-      AgahnimBalls_DamageAgahnim(0, 16, 0xa0);
+      Sprite_GiveDamage(0, 16, 0xa0);
       sprite_state[k] = 0;
       sprite_x_recoil[0] = sprite_x_vel[k];
       sprite_y_recoil[0] = sprite_y_vel[k];