Merge pull request #759 from DizzyEggg/fix_funcs

Some nonmatchings and fakematches
This commit is contained in:
PikalaxALT 2019-07-30 14:58:32 -04:00 committed by GitHub
commit 0aacbca46b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 197 additions and 786 deletions

View File

@ -5315,21 +5315,19 @@ static void sub_8102D8C(s16 a, s16 b, s16* c, s16* d, s8 e)
static void sub_8102DE4(struct Sprite* sprite) static void sub_8102DE4(struct Sprite* sprite)
{ {
int b; s16 y, yDelta;
s16 a;
int c;
u8 index; u8 index;
sprite->data[0]++; sprite->data[0]++;
b = sprite->data[0] * 5 - ((sprite->data[0] * 5 / 256) << 8); yDelta = sprite->data[0] * 5 - ((sprite->data[0] * 5 / 256) << 8);
sprite->data[4] += sprite->data[6]; sprite->data[4] += sprite->data[6];
sprite->data[5] += sprite->data[7]; sprite->data[5] += sprite->data[7];
sprite->pos1.x = sprite->data[4] >> 4; sprite->pos1.x = sprite->data[4] >> 4;
sprite->pos1.y = sprite->data[5] >> 4; sprite->pos1.y = sprite->data[5] >> 4;
sprite->pos2.y = Sin(b, 15); sprite->pos2.y = Sin(yDelta, 15);
a = (u16)sprite->pos1.y;
c = (u16)sprite->pos1.x;
if ((u32)((c + 16) << 16) > (0x110) << 16 || a < -16 || a > 0x80) y = sprite->pos1.y;
if (sprite->pos1.x < -16 || sprite->pos1.x > 256 || y < -16 || y > 128)
{ {
DestroySpriteAndMatrix(sprite); DestroySpriteAndMatrix(sprite);
} }
@ -5350,12 +5348,8 @@ static void sub_8102DE4(struct Sprite* sprite)
void sub_8102EB0(struct Sprite* sprite) void sub_8102EB0(struct Sprite* sprite)
{ {
int a;
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
{ gBattleAnimArgs[1] *= -1;
a = gBattleAnimArgs[1];
*(u16 *)&gBattleAnimArgs[1] = -a;
}
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[1]; sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[1];
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[2]; sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[2];
@ -5541,8 +5535,8 @@ static void sub_8103300(struct Sprite* sprite)
static void sub_8103320(struct Sprite* sprite) static void sub_8103320(struct Sprite* sprite)
{ {
s16 temp; s16 x1, x2;
s16 temp2;
sprite->data[1] += 4; sprite->data[1] += 4;
if (sprite->data[1] > 254) if (sprite->data[1] > 254)
{ {
@ -5564,20 +5558,21 @@ static void sub_8103320(struct Sprite* sprite)
if (sprite->data[1] > 0x9F) if (sprite->data[1] > 0x9F)
sprite->subpriority = sprite->data[2]; sprite->subpriority = sprite->data[2];
temp = gSineTable[sprite->data[1]]; x1 = gSineTable[sprite->data[1]];
sprite->pos2.x = (temp2 = temp >> 3) + (temp2 >> 1); x2 = x1 >> 3;
sprite->pos2.x = (x1 >> 3) + (x2 >> 1);
} }
void sub_8103390(struct Sprite* sprite) void sub_8103390(struct Sprite* sprite)
{ {
u8 bank; u8 battler;
if (gBattleAnimArgs[0] == 0) if (gBattleAnimArgs[0] == 0)
bank = gBattleAnimAttacker; battler = gBattleAnimAttacker;
else else
bank = gBattleAnimTarget; battler = gBattleAnimTarget;
sub_810310C(bank, sprite); sub_810310C(battler, sprite);
if (GetBattlerSide(bank) == B_SIDE_PLAYER) if (GetBattlerSide(battler) == B_SIDE_PLAYER)
{ {
StartSpriteAnim(sprite, 0); StartSpriteAnim(sprite, 0);
sprite->data[0] = 2; sprite->data[0] = 2;

View File

@ -2504,13 +2504,10 @@ void sub_815BE04(struct Sprite *sprite)
static void sub_815BF44(struct Sprite *sprite) static void sub_815BF44(struct Sprite *sprite)
{ {
int var0; s16 delta = sprite->data[3] + sprite->data[2];
s8 var1; sprite->pos2.y -= delta >> 8;
sprite->data[3] += sprite->data[2];
var0 = (u16)sprite->data[2] + (u16)sprite->data[3]; sprite->data[3] &= 0xFF;
var1 = var0 >> 8;
sprite->pos2.y -= var1;
sprite->data[3] = var0 & 0xFF;
if (sprite->data[4] == 0 && sprite->pos2.y < -8) if (sprite->data[4] == 0 && sprite->pos2.y < -8)
{ {
gSprites[sprite->data[6]].invisible = 0; gSprites[sprite->data[6]].invisible = 0;
@ -2543,19 +2540,12 @@ static void sub_815BFF4(struct Sprite *sprite)
static void sub_815C050(struct Sprite *sprite) static void sub_815C050(struct Sprite *sprite)
{ {
u16 d2;
register u16 d3 asm("r1");
int var0;
s8 var1;
if (!sprite->invisible) if (!sprite->invisible)
{ {
d2 = sprite->data[2]; s16 delta = sprite->data[3] + sprite->data[2];
d3 = sprite->data[3]; sprite->pos2.y -= delta >> 8;
var0 = d2 + d3; sprite->data[3] += sprite->data[2];
var1 = var0 >> 8; sprite->data[3] &= 0xFF;
sprite->pos2.y -= var1;
sprite->data[3] = var0 & 0xFF;
if (--sprite->data[1] == -1) if (--sprite->data[1] == -1)
{ {
sprite->invisible = 1; sprite->invisible = 1;

File diff suppressed because it is too large Load Diff