try flying

This commit is contained in:
DizzyEggg 2019-03-05 16:52:40 +01:00
commit b9c216638c
2 changed files with 45 additions and 166 deletions

View File

@ -3,7 +3,7 @@
MAPS_DIR = $(DATA_ASM_SUBDIR)/maps
LAYOUTS_DIR = $(DATA_ASM_SUBDIR)/layouts
MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/))
MAP_DIRS := $(dir $(wildcard $(MAPS_DIR)/*/map.json))
MAP_CONNECTIONS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/connections.inc,$(MAP_DIRS))
MAP_EVENTS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/events.inc,$(MAP_DIRS))
MAP_HEADERS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/header.inc,$(MAP_DIRS))

View File

@ -548,7 +548,6 @@ void sub_810E2C8(struct Sprite *sprite)
}
}
// FAKEMATCHING
struct FeatherDanceData
{
u8 unk0_0a:1;
@ -654,6 +653,13 @@ void sub_810E314(struct Sprite *sprite)
}
#ifndef NONMATCHING
/*
Things I can't get to match:
1. data->unk0_1 bitfield behaviour. The way bits are read is different.
2. sprite->oam.priority--; sprite->oam.priority++; Nonmatching version tail-merges these, original does not.
3. sprite->pos2.x = (gSineTable[data->unk2] * var) >> 8; data->unk2 is very weirdly read at seemingly random moments inside the switch.
4. sinVal r6/r7 mismatch.
*/
void sub_810E520(struct Sprite *sprite)
{
u8 matrixNum, sinIndex, var;
@ -1722,11 +1728,8 @@ void sub_810EDD0(struct Sprite *sprite)
DestroyAnimSprite(sprite);
}
#ifdef NONMATCHING
void sub_810EE14(struct Sprite *sprite)
{
// NONMATCHING - Functionally equivalent - slight register swap at end
u32 matrixNum;
int t1, t2;
@ -1767,146 +1770,22 @@ void sub_810EE14(struct Sprite *sprite)
if (t2 > 128)
t2 = 128;
/* NONMATCHING
* compiles to:
* asr r0, r0, #0x1
strh r0, [r5, #0x26]
* needed:
* asrs r1, r0, 1
* strh r1, [r5, 0x26] */
sprite->pos2.y = (64 - t2) / 2;
t2 = (64 - t2) / 2;
sprite->pos2.y = t2;
if (sprite->data[2] == 24)
{
sub_80A749C(sprite);
DestroyAnimSprite(sprite);
}
break;
}
}
#else
NAKED
void sub_810EE14(struct Sprite *sprite)
{
asm_unified("push {r4,r5,lr}\n\
sub sp, 0x4\n\
adds r5, r0, 0\n\
movs r1, 0x2E\n\
ldrsh r0, [r5, r1]\n\
cmp r0, 0\n\
beq _0810EE28\n\
cmp r0, 0x1\n\
beq _0810EE80\n\
b _0810EEEC\n\
_0810EE28:\n\
ldr r0, =gBattleAnimArgs\n\
movs r2, 0\n\
ldrsh r0, [r0, r2]\n\
cmp r0, 0\n\
bne _0810EE40\n\
ldr r4, =gBattleAnimAttacker\n\
b _0810EE42\n\
.pool\n\
_0810EE40:\n\
ldr r4, =gBattleAnimTarget\n\
_0810EE42:\n\
ldrb r0, [r4]\n\
movs r1, 0\n\
bl GetBattlerSpriteCoord\n\
lsls r0, 24\n\
lsrs r0, 24\n\
strh r0, [r5, 0x20]\n\
ldrb r0, [r4]\n\
movs r1, 0x1\n\
bl GetBattlerSpriteCoord\n\
lsls r0, 24\n\
lsrs r0, 24\n\
strh r0, [r5, 0x22]\n\
movs r0, 0\n\
movs r3, 0x80\n\
lsls r3, 2\n\
strh r3, [r5, 0x30]\n\
movs r2, 0x80\n\
lsls r2, 1\n\
str r0, [sp]\n\
adds r0, r5, 0\n\
movs r1, 0\n\
bl TrySetSpriteRotScale\n\
ldrh r0, [r5, 0x2E]\n\
adds r0, 0x1\n\
strh r0, [r5, 0x2E]\n\
b _0810EEEC\n\
.pool\n\
_0810EE80:\n\
movs r1, 0x32\n\
ldrsh r0, [r5, r1]\n\
cmp r0, 0xB\n\
bgt _0810EE8E\n\
ldrh r0, [r5, 0x30]\n\
subs r0, 0x28\n\
b _0810EE92\n\
_0810EE8E:\n\
ldrh r0, [r5, 0x30]\n\
adds r0, 0x28\n\
_0810EE92:\n\
strh r0, [r5, 0x30]\n\
ldrh r0, [r5, 0x32]\n\
adds r0, 0x1\n\
movs r1, 0\n\
strh r0, [r5, 0x32]\n\
movs r2, 0x80\n\
lsls r2, 1\n\
movs r0, 0x30\n\
ldrsh r3, [r5, r0]\n\
str r1, [sp]\n\
adds r0, r5, 0\n\
bl TrySetSpriteRotScale\n\
ldrb r1, [r5, 0x3]\n\
lsls r1, 26\n\
lsrs r1, 27\n\
movs r0, 0xF4\n\
lsls r0, 6\n\
ldr r2, =gOamMatrices\n\
lsls r1, 3\n\
adds r1, r2\n\
movs r2, 0x6\n\
ldrsh r1, [r1, r2]\n\
bl __divsi3\n\
adds r1, r0, 0x1\n\
cmp r1, 0x80\n\
ble _0810EECC\n\
movs r1, 0x80\n\
_0810EECC:\n\
movs r0, 0x40\n\
subs r0, r1\n\
lsrs r1, r0, 31\n\
adds r0, r1\n\
asrs r1, r0, 1\n\
strh r1, [r5, 0x26]\n\
movs r1, 0x32\n\
ldrsh r0, [r5, r1]\n\
cmp r0, 0x18\n\
bne _0810EEEC\n\
adds r0, r5, 0\n\
bl sub_80A749C\n\
adds r0, r5, 0\n\
bl DestroyAnimSprite\n\
_0810EEEC:\n\
add sp, 0x4\n\
pop {r4,r5}\n\
pop {r0}\n\
bx r0\n\
.pool\n");
}
#endif
void sub_810EEF8(struct Sprite *sprite)
{
int v1, v2;
v1 = 0x1ff & Random2();
v2 = 0x7f & Random2();
int v1 = 0x1ff & Random2();
int v2 = 0x7f & Random2();
if (v1 % 2)
sprite->data[0] = 736 + v1;