216
src/sm_ad.c
216
src/sm_ad.c
@@ -3,6 +3,18 @@
|
||||
#include "funcs.h"
|
||||
#include "enemy_types.h"
|
||||
|
||||
|
||||
#define kMotherBrain_HealthBasedPalettes_Brain ((uint16*)RomFixedPtr(0xade6a2))
|
||||
#define kMotherBrain_HealthBasedPalettes_BackLeg ((uint16*)RomFixedPtr(0xade742))
|
||||
#define kMotherBrain_FadePalToBlack ((uint16*)RomFixedPtr(0xade9e8))
|
||||
#define kMotherBrain_TransitionToFromGrey_Incr ((uint16*)RomFixedPtr(0xaded8a))
|
||||
#define kMotherBrain_TransitionToFromGrey_Decr ((uint16*)RomFixedPtr(0xaded9c))
|
||||
#define kMotherBrain_FadeToGray_Drained ((uint16*)RomFixedPtr(0xadef87))
|
||||
#define kMotherBrain_FadeToGray_RealDeath ((uint16*)RomFixedPtr(0xadf107))
|
||||
#define kMotherBrain_Phase3_TurnLightsBackOn ((uint16*)RomFixedPtr(0xadf273))
|
||||
|
||||
|
||||
|
||||
void nullsub_341(void) {}
|
||||
|
||||
static Func_V *const funcs_BE56D[16] = {
|
||||
@@ -12,14 +24,6 @@ static Func_V *const funcs_BE56D[16] = {
|
||||
MotherBrain_CalcHdma_Down, 0, 0, MotherBrain_CalcHdma_Down,
|
||||
};
|
||||
|
||||
#define kMotherBrain_HealthBasedPalettes_Brain ((uint16*)RomPtr(0xade6a2))
|
||||
#define kMotherBrain_HealthBasedPalettes_BackLeg ((uint16*)RomPtr(0xade742))
|
||||
#define kMotherBrain_FadePalToBlack ((uint16*)RomPtr(0xade9e8))
|
||||
#define kMotherBrain_TransitionToFromGrey_Incr ((uint16*)RomPtr(0xaded8a))
|
||||
#define kMotherBrain_TransitionToFromGrey_Decr ((uint16*)RomPtr(0xaded9c))
|
||||
#define kMotherBrain_FadeToGray_Drained ((uint16*)RomPtr(0xadef87))
|
||||
#define kMotherBrain_FadeToGray_RealDeath ((uint16*)RomPtr(0xadf107))
|
||||
#define kMotherBrain_Phase3_TurnLightsBackOn ((uint16*)RomPtr(0xadf273))
|
||||
|
||||
|
||||
void MotherBrain_CalcHdma(void) { // 0xADDE00
|
||||
@@ -59,43 +63,38 @@ void MotherBrain_CalcHdma_BeamAimedRight(void) { // 0xADDECE
|
||||
hdma_table_2[0] = 255;
|
||||
hdma_table_2[1] = 255;
|
||||
Enemy_MotherBrain *E = Get_MotherBrain(0);
|
||||
R18_ = kTanTable[(uint16)(2 * LOBYTE(E->mbn_var_3A)) >> 1];
|
||||
R20_ = kTanTable[(uint16)(2 * LOBYTE(E->mbn_var_3B)) >> 1];
|
||||
R18_ = kTanTable[LOBYTE(E->mbn_var_3A)];
|
||||
R20_ = kTanTable[LOBYTE(E->mbn_var_3B)];
|
||||
uint16 mbn_var_3F = E->mbn_var_3F;
|
||||
uint16 v2 = 2 * (mbn_var_3F - 32) - 25342;
|
||||
uint8 *v3 = RomPtr_7E(v2);
|
||||
*((uint16 *)v3 + 1) = 255;
|
||||
*((uint16 *)v3 + 2) = 255;
|
||||
uint16 v8 = v2;
|
||||
uint16 *v2 = hdma_table_2 + (mbn_var_3F - 32) + 1;
|
||||
v2[1] = 255;
|
||||
v2[2] = 255;
|
||||
uint16 *v8 = v2;
|
||||
do {
|
||||
uint16 v4 = R20_ + R24_;
|
||||
if (__CFADD__uint16(R20_, R24_))
|
||||
break;
|
||||
R24_ += R20_;
|
||||
*(uint16 *)RomPtr_7E(v2) = HIBYTE(v4) | 0xFF00;
|
||||
v2 -= 2;
|
||||
*v2-- = HIBYTE(v4) | 0xFF00;
|
||||
--mbn_var_3F;
|
||||
} while (mbn_var_3F != 32);
|
||||
do {
|
||||
*(uint16 *)RomPtr_7E(v2) = 255;
|
||||
v2 -= 2;
|
||||
*v2-- = 255;
|
||||
--mbn_var_3F;
|
||||
} while (mbn_var_3F != 32);
|
||||
uint16 v5 = v8 + 2;
|
||||
uint16 *v5 = v8 + 1;
|
||||
uint16 var_3F = gRam8000_Default(0)->var_3F;
|
||||
while (1) {
|
||||
uint16 v7 = R18_ + R22_;
|
||||
if (__CFADD__uint16(R18_, R22_))
|
||||
break;
|
||||
R22_ += R18_;
|
||||
*(uint16 *)RomPtr_7E(v5) = HIBYTE(v7) | 0xFF00;
|
||||
v5 += 2;
|
||||
*v5++ = HIBYTE(v7) | 0xFF00;
|
||||
if (++var_3F == 232)
|
||||
return;
|
||||
}
|
||||
do {
|
||||
*(uint16 *)RomPtr_7E(v5) = 255;
|
||||
v5 += 2;
|
||||
*v5++ = 255;
|
||||
++var_3F;
|
||||
} while (var_3F != 232);
|
||||
}
|
||||
@@ -141,112 +140,85 @@ void MotherBrain_CalcHdma_BeamAimedUp(void) {
|
||||
}
|
||||
|
||||
void MotherBrain_CalcHdma_Up_UpRight(void) { // 0xADE02C
|
||||
char v6; // t0
|
||||
int16 v8;
|
||||
|
||||
hdma_table_2[0] = 255;
|
||||
hdma_table_2[1] = 255;
|
||||
Enemy_MotherBrain *E = Get_MotherBrain(0);
|
||||
R18_ = kTanTable[(uint16)(2 * LOBYTE(E->mbn_var_3B)) >> 1];
|
||||
R20_ = kTanTable[(uint16)(2 * LOBYTE(E->mbn_var_3A)) >> 1];
|
||||
R18_ = kTanTable[LOBYTE(E->mbn_var_3B)];
|
||||
R20_ = kTanTable[LOBYTE(E->mbn_var_3A)];
|
||||
uint16 mbn_var_3D = E->mbn_var_3D;
|
||||
uint16 v2 = 2 * (mbn_var_3D - 32) - 25342;
|
||||
uint8 *v3 = RomPtr_7E(v2);
|
||||
*((uint16 *)v3 + 1) = 255;
|
||||
*((uint16 *)v3 + 2) = 255;
|
||||
uint16 *v2 = hdma_table_2 + (mbn_var_3D - 32) + 1;
|
||||
v2[1] = 255;
|
||||
v2[2] = 255;
|
||||
do {
|
||||
uint16 v4 = R18_ + R22_;
|
||||
if (__CFADD__uint16(R18_, R22_))
|
||||
v4 = -1;
|
||||
R22_ = v4;
|
||||
uint16 v5 = v4 & 0xFF00;
|
||||
v6 = v5;
|
||||
LOBYTE(v5) = HIBYTE(v5);
|
||||
HIBYTE(v5) = v6;
|
||||
R36 = v5;
|
||||
R36 = (v4 >> 8) & 0xff;
|
||||
uint16 v7 = R20_ + R24_;
|
||||
if (__CFADD__uint16(R20_, R24_))
|
||||
v7 = -1;
|
||||
R24_ = v7;
|
||||
v8 = R36 | v7 & 0xFF00;
|
||||
if (v8 == -1)
|
||||
uint16 v8 = R36 | v7 & 0xFF00;
|
||||
if (v8 == 0xffff)
|
||||
v8 = 255;
|
||||
*(uint16 *)RomPtr_7E(v2) = v8;
|
||||
v2 -= 2;
|
||||
*v2-- = v8;
|
||||
--mbn_var_3D;
|
||||
} while (mbn_var_3D != 32);
|
||||
}
|
||||
|
||||
void MotherBrain_CalcHdma_Up_Up(void) { // 0xADE0A6
|
||||
char v6; // t0
|
||||
int16 v8;
|
||||
|
||||
hdma_table_2[0] = 255;
|
||||
hdma_table_2[1] = 255;
|
||||
Enemy_MotherBrain *E = Get_MotherBrain(0);
|
||||
R18_ = kTanTable[(uint8)-LOBYTE(E->mbn_var_3B)];
|
||||
R20_ = kTanTable[(uint16)(2 * LOBYTE(E->mbn_var_3A)) >> 1];
|
||||
R20_ = kTanTable[LOBYTE(E->mbn_var_3A)];
|
||||
uint16 mbn_var_3D = E->mbn_var_3D;
|
||||
uint16 v2 = 2 * (mbn_var_3D - 32) - 25342;
|
||||
uint8 *v3 = RomPtr_7E(v2);
|
||||
*((uint16 *)v3 + 1) = 255;
|
||||
*((uint16 *)v3 + 2) = 255;
|
||||
uint16 *v2 = hdma_table_2 + (mbn_var_3D - 32) + 1;
|
||||
v2[1] = 255;
|
||||
v2[2] = 255;
|
||||
do {
|
||||
uint16 v4 = R22_ - R18_;
|
||||
if (R22_ < R18_)
|
||||
v4 = 0;
|
||||
R22_ = v4;
|
||||
uint16 v5 = v4 & 0xFF00;
|
||||
v6 = v5;
|
||||
LOBYTE(v5) = HIBYTE(v5);
|
||||
HIBYTE(v5) = v6;
|
||||
R26_ = v5;
|
||||
R26_ = (uint8)(v4 >> 8);
|
||||
uint16 v7 = R20_ + R24_;
|
||||
if (__CFADD__uint16(R20_, R24_))
|
||||
v7 = -1;
|
||||
R24_ = v7;
|
||||
v8 = R26_ | v7 & 0xFF00;
|
||||
if (v8 == -1)
|
||||
uint16 v8 = R26_ | v7 & 0xFF00;
|
||||
if (v8 == 0xffff)
|
||||
v8 = 255;
|
||||
*(uint16 *)RomPtr_7E(v2) = v8;
|
||||
v2 -= 2;
|
||||
*v2-- = v8;
|
||||
--mbn_var_3D;
|
||||
} while (mbn_var_3D != 32);
|
||||
}
|
||||
|
||||
void MotherBrain_CalcHdma_Up_UpLeft(void) { // 0xADE124
|
||||
char v6; // t0
|
||||
int16 v8;
|
||||
|
||||
hdma_table_2[0] = 255;
|
||||
hdma_table_2[1] = 255;
|
||||
Enemy_MotherBrain *E = Get_MotherBrain(0);
|
||||
R18_ = kTanTable[(uint8)-LOBYTE(E->mbn_var_3B)];
|
||||
R20_ = kTanTable[(uint8)-LOBYTE(E->mbn_var_3A)];
|
||||
uint16 mbn_var_3D = E->mbn_var_3D;
|
||||
uint16 v2 = 2 * (mbn_var_3D - 32) - 25342;
|
||||
uint8 *v3 = RomPtr_7E(v2);
|
||||
*((uint16 *)v3 + 1) = 255;
|
||||
*((uint16 *)v3 + 2) = 255;
|
||||
uint16 *v2 = hdma_table_2 + (mbn_var_3D - 32) + 1;
|
||||
v2[1] = 255;
|
||||
v2[2] = 255;
|
||||
do {
|
||||
uint16 v4 = R22_ - R18_;
|
||||
if (R22_ < R18_)
|
||||
v4 = 0;
|
||||
R22_ = v4;
|
||||
uint16 v5 = v4 & 0xFF00;
|
||||
v6 = v5;
|
||||
LOBYTE(v5) = HIBYTE(v5);
|
||||
HIBYTE(v5) = v6;
|
||||
R36 = v5;
|
||||
R36 = v4 >> 8;
|
||||
uint16 v7 = R24_ - R20_;
|
||||
if (R24_ < R20_)
|
||||
v7 = 0;
|
||||
R24_ = v7;
|
||||
v8 = R36 | v7 & 0xFF00;
|
||||
if (v8 == -1)
|
||||
uint16 v8 = R36 | v7 & 0xFF00;
|
||||
if (v8 == 0xffff)
|
||||
v8 = 255;
|
||||
*(uint16 *)RomPtr_7E(v2) = v8;
|
||||
v2 -= 2;
|
||||
*v2-- = v8;
|
||||
--mbn_var_3D;
|
||||
} while (mbn_var_3D != 32);
|
||||
}
|
||||
@@ -271,124 +243,92 @@ void MotherBrain_CalcHdma_Down(void) { // 0xADE1A6
|
||||
}
|
||||
|
||||
void MotherBrain_CalcHdma_Down_DownRight(void) { // 0xADE216
|
||||
int16 v1;
|
||||
char v6; // t0
|
||||
int16 v8;
|
||||
|
||||
hdma_table_2[0] = 255;
|
||||
hdma_table_2[1] = 255;
|
||||
Enemy_MotherBrain *E = Get_MotherBrain(0);
|
||||
R18_ = kTanTable[(uint16)(2 * LOBYTE(E->mbn_var_3A)) >> 1];
|
||||
R20_ = kTanTable[(uint16)(2 * LOBYTE(E->mbn_var_3B)) >> 1];
|
||||
v1 = E->mbn_var_3D - 32;
|
||||
uint16 v2 = 0x9D04;
|
||||
R18_ = kTanTable[LOBYTE(E->mbn_var_3A)];
|
||||
R20_ = kTanTable[LOBYTE(E->mbn_var_3B)];
|
||||
uint16 v1 = E->mbn_var_3D - 32;
|
||||
uint16 *dst = hdma_table_2 + 1;
|
||||
do {
|
||||
*(uint16 *)RomPtr_7E(v2) = 255;
|
||||
v2 += 2;
|
||||
--v1;
|
||||
} while (v1);
|
||||
*dst++ = 255;
|
||||
} while (--v1);
|
||||
uint16 mbn_var_3D = Get_MotherBrain(0)->mbn_var_3D;
|
||||
do {
|
||||
uint16 v4 = R18_ + R22_;
|
||||
if (__CFADD__uint16(R18_, R22_))
|
||||
v4 = -1;
|
||||
R22_ = v4;
|
||||
uint16 v5 = v4 & 0xFF00;
|
||||
v6 = v5;
|
||||
LOBYTE(v5) = HIBYTE(v5);
|
||||
HIBYTE(v5) = v6;
|
||||
R26_ = v5;
|
||||
R26_ = v4 >> 8;
|
||||
uint16 v7 = R20_ + R24_;
|
||||
if (__CFADD__uint16(R20_, R24_))
|
||||
v7 = -1;
|
||||
R24_ = v7;
|
||||
v8 = R26_ | v7 & 0xFF00;
|
||||
uint16 v8 = R26_ | v7 & 0xFF00;
|
||||
if (v8 == -1)
|
||||
v8 = 255;
|
||||
*(uint16 *)RomPtr_7E(v2) = v8;
|
||||
v2 += 2;
|
||||
*dst++ = v8;
|
||||
++mbn_var_3D;
|
||||
} while (mbn_var_3D != 232);
|
||||
}
|
||||
|
||||
void MotherBrain_CalcHdma_Down_Down(void) { // 0xADE293
|
||||
int16 v1;
|
||||
char v6; // t0
|
||||
int16 v8;
|
||||
|
||||
hdma_table_2[0] = 255;
|
||||
hdma_table_2[1] = 255;
|
||||
Enemy_MotherBrain *E = Get_MotherBrain(0);
|
||||
R18_ = kTanTable[(uint8)-LOBYTE(E->mbn_var_3A)];
|
||||
R20_ = kTanTable[(uint16)(2 * LOBYTE(E->mbn_var_3B)) >> 1];
|
||||
v1 = E->mbn_var_3D - 32;
|
||||
uint16 v2 = -25340;
|
||||
R20_ = kTanTable[LOBYTE(E->mbn_var_3B)];
|
||||
uint16 v1 = E->mbn_var_3D - 32;
|
||||
uint16 *dst = hdma_table_2 + 1;
|
||||
do {
|
||||
*(uint16 *)RomPtr_7E(v2) = 255;
|
||||
v2 += 2;
|
||||
--v1;
|
||||
} while (v1);
|
||||
*dst++ = 255;
|
||||
} while (--v1);
|
||||
uint16 mbn_var_3D = Get_MotherBrain(0)->mbn_var_3D;
|
||||
do {
|
||||
uint16 v4 = R22_ - R18_;
|
||||
if (R22_ < R18_)
|
||||
v4 = 0;
|
||||
R22_ = v4;
|
||||
uint16 v5 = v4 & 0xFF00;
|
||||
v6 = v5;
|
||||
LOBYTE(v5) = HIBYTE(v5);
|
||||
HIBYTE(v5) = v6;
|
||||
R26_ = v5;
|
||||
R26_ = v4 >> 8;
|
||||
uint16 v7 = R20_ + R24_;
|
||||
if (__CFADD__uint16(R20_, R24_))
|
||||
v7 = -1;
|
||||
R24_ = v7;
|
||||
v8 = R26_ | v7 & 0xFF00;
|
||||
if (v8 == -1)
|
||||
uint16 v8 = R26_ | v7 & 0xFF00;
|
||||
if (v8 == 0xffff)
|
||||
v8 = 255;
|
||||
*(uint16 *)RomPtr_7E(v2) = v8;
|
||||
v2 += 2;
|
||||
*dst++ = v8;
|
||||
++mbn_var_3D;
|
||||
} while (mbn_var_3D != 232);
|
||||
}
|
||||
|
||||
void MotherBrain_CalcHdma_Down_DownLeft(void) { // 0xADE314
|
||||
int16 v1;
|
||||
char v6; // t0
|
||||
int16 v8;
|
||||
|
||||
hdma_table_2[0] = 255;
|
||||
hdma_table_2[1] = 255;
|
||||
Enemy_MotherBrain *E = Get_MotherBrain(0);
|
||||
R18_ = kTanTable[(uint8)-LOBYTE(E->mbn_var_3A)];
|
||||
R20_ = kTanTable[(uint8)-LOBYTE(E->mbn_var_3B)];
|
||||
v1 = E->mbn_var_3D - 32;
|
||||
uint16 v2 = -25340;
|
||||
uint16 v1 = E->mbn_var_3D - 32;
|
||||
uint16 *dst = hdma_table_2 + 1;
|
||||
do {
|
||||
*(uint16 *)RomPtr_7E(v2) = 255;
|
||||
v2 += 2;
|
||||
--v1;
|
||||
} while (v1);
|
||||
*dst++ = 255;
|
||||
} while (--v1);
|
||||
uint16 mbn_var_3D = Get_MotherBrain(0)->mbn_var_3D;
|
||||
do {
|
||||
uint16 v4 = R22_ - R18_;
|
||||
if (R22_ < R18_)
|
||||
v4 = 0;
|
||||
R22_ = v4;
|
||||
uint16 v5 = v4 & 0xFF00;
|
||||
v6 = v5;
|
||||
LOBYTE(v5) = HIBYTE(v5);
|
||||
HIBYTE(v5) = v6;
|
||||
uint16 v5 = v4 >> 8;
|
||||
R26_ = v5;
|
||||
uint16 v7 = R24_ - R20_;
|
||||
if (R24_ < R20_)
|
||||
v7 = 0;
|
||||
R24_ = v7;
|
||||
v8 = R26_ | v7 & 0xFF00;
|
||||
uint16 v8 = R26_ | v7 & 0xFF00;
|
||||
if (!v8)
|
||||
v8 = 255;
|
||||
*(uint16 *)RomPtr_7E(v2) = v8;
|
||||
v2 += 2;
|
||||
*dst++ = v8;
|
||||
++mbn_var_3D;
|
||||
} while (mbn_var_3D != 232);
|
||||
}
|
||||
@@ -458,8 +398,6 @@ uint8 MotherBrain_EEF6(uint16 a) { // 0xADEEF6
|
||||
}
|
||||
|
||||
uint8 MotherBrain_FadeFromGray_Drained(uint16 a) { // 0xADEF0D
|
||||
int16 v3;
|
||||
|
||||
int v1 = a;
|
||||
if (!kMotherBrain_TransitionToFromGrey_Decr[v1])
|
||||
return 1;
|
||||
@@ -467,14 +405,11 @@ uint8 MotherBrain_FadeFromGray_Drained(uint16 a) { // 0xADEF0D
|
||||
WriteColorsToPalette(0x82, 0xad, j, 13);
|
||||
WriteColorsToPalette(0x122, 0xad, j, 13);
|
||||
WriteColorsToPalette(0x168, 0xad, j + 26, 5);
|
||||
v3 = *(uint16 *)RomPtr_AD(j + 36);
|
||||
*(uint16 *)&g_ram[0x17C] = v3;
|
||||
*(uint16 *)&g_ram[0x17C] = *(uint16 *)RomPtr_AD(j + 36);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8 MotherBrain_FadeToGray_Drained(uint16 a) { // 0xADEF4A
|
||||
int16 v3;
|
||||
|
||||
int v1 = a;
|
||||
if (!kMotherBrain_FadeToGray_Drained[v1])
|
||||
return 1;
|
||||
@@ -482,8 +417,7 @@ uint8 MotherBrain_FadeToGray_Drained(uint16 a) { // 0xADEF4A
|
||||
WriteColorsToPalette(0x82, 0xad, j, 15);
|
||||
WriteColorsToPalette(0x122, 0xad, j, 15);
|
||||
WriteColorsToPalette(0x168, 0xad, j + 30, 5);
|
||||
v3 = *(uint16 *)RomPtr_AD(j + 40);
|
||||
*(uint16 *)&g_ram[0x17C] = v3;
|
||||
*(uint16 *)&g_ram[0x17C] = *(uint16 *)RomPtr_AD(j + 40);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -525,4 +459,4 @@ void HandleMotherBrainBodyFlickering(void) { // 0xADF41C
|
||||
*(uint16 *)®_TM &= ~2u;
|
||||
v0->properties |= kEnemyProps_Invisible;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user