DRA&RIC move a0, s0 carnage (#113)

This commit is contained in:
Alejandro Asenjo Nitti 2023-02-21 19:27:41 -03:00 committed by GitHub
parent 91df543b70
commit fa6dabde3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 82 deletions

View File

@ -615,46 +615,40 @@ INCLUDE_ASM("asm/us/dra/nonmatchings/75F54", func_80123788);
INCLUDE_ASM("asm/us/dra/nonmatchings/75F54", func_801238CC);
// move a0,s0 thing
// https://decomp.me/scratch/rJCCX
#ifndef NON_MATCHING
INCLUDE_ASM("asm/us/dra/nonmatchings/75F54", func_80123A60);
#else
void func_80123A60(Entity* entity) {
if (D_80072F2C & 0x01000000) {
Entity* player = &PLAYER;
#if 1
entity->posX.i.hi = PLAYER.posX.i.hi; //(u16) D_800733DA;
entity->posY.i.hi = PLAYER.posY.i.hi; //(u16) D_800733DE;
#else // This one generates the first missing move a0, s0 for some reason?
entity->posX.i.hi = (u16)D_800733DA;
entity->posY.i.hi = (u16)D_800733DE;
#endif
if (entity->step == 0) {
func_8011A328(entity, 0xB);
entity->unk34 = 0x04060000;
entity->step++;
}
if (PLAYER.animCurFrame == 5) {
entity->hitboxWidth = 12;
entity->hitboxHeight = 32;
entity->unk10 = 0x1C;
entity->unk12 = -0xC;
return;
}
if (PLAYER.animCurFrame == 6) {
entity->hitboxWidth = 10;
entity->hitboxHeight = 10;
entity->unk10 = 0x1C;
entity->unk12 = 0x10;
return;
}
goto block_7;
if (!(D_80072F2C & 0x01000000)) {
DestroyEntity(entity);
return;
}
block_7:
entity->posX.i.hi = player->posX.i.hi;
entity->posY.i.hi = player->posY.i.hi;
if (entity->step == 0) {
func_8011A328(entity, 0xB);
entity->unk34 = 0x04060000;
entity->step++;
}
if (player->animCurFrame == 5) {
entity->hitboxWidth = 12;
entity->hitboxHeight = 32;
entity->unk10 = 0x1C;
entity->unk12 = -0xC;
return;
}
if (player->animCurFrame == 6) {
entity->hitboxWidth = 10;
entity->hitboxHeight = 10;
entity->unk10 = 0x1C;
entity->unk12 = 0x10;
return;
}
DestroyEntity(entity);
}
#endif
INCLUDE_ASM("asm/us/dra/nonmatchings/75F54", func_80123B40);
@ -828,47 +822,40 @@ void func_80124164(POLY_GT4* poly, s32 colorIntensity, s32 y, s32 radius,
// teleport effect like when using library card (ID 0x42)
INCLUDE_ASM("asm/us/dra/nonmatchings/75F54", EntityTeleport);
// move a0,s0 thing
#ifndef NON_MATCHING
INCLUDE_ASM("asm/us/dra/nonmatchings/75F54", func_80124A8C);
#else
void func_80124A8C(Entity* entity) {
u32* playerStep = &PLAYER.step;
if (*playerStep == 4) {
s32 playerStep_temp = *playerStep; // might be !FAKE:
switch (entity->step) {
case 0:
entity->animSet = 0x11;
entity->accelerationY = -0x6000;
AccelerateX(0x4000);
entity->unk5A = 0x50;
entity->palette = 0x819F;
entity->unk4C = &D_800AE294;
entity->unk34 = 0x100000;
entity->facing = 0;
entity->posY.i.hi -= 16;
playerStep_temp = entity->step;
playerStep_temp++;
entity->posX.val += entity->accelerationX << 5;
entity->step = playerStep_temp;
break;
case 1:
entity->posX.val += entity->accelerationX;
entity->posY.val += entity->accelerationY;
if (entity->animFrameDuration < 0) {
DestroyEntity(entity);
}
break;
}
} else {
#ifdef PSY_Q_3_5
if (PLAYER.step != 0 || PLAYER.unk2E != 4) { // REAL: Matches with PSY-Q 3.5
#else
if (*(s32*)&PLAYER.step != 0x40000) { // !FAKE: Probably ASPSX
#endif
DestroyEntity(entity);
return;
}
switch (entity->step) {
case 0:
entity->animSet = 0x11;
entity->accelerationY = -0x6000;
AccelerateX(0x4000);
entity->unk5A = 0x50;
entity->palette = 0x819F;
entity->unk4C = &D_800AE294;
entity->unk34 = 0x100000;
entity->facing = 0;
entity->posY.i.hi -= 16;
entity->posX.val += entity->accelerationX << 5;
entity->step++;
break;
case 1:
entity->posX.val += entity->accelerationX;
entity->posY.val += entity->accelerationY;
if (entity->animFrameDuration < 0) {
DestroyEntity(entity);
}
break;
}
}
#endif
// dagger thrown when using subweapon
INCLUDE_ASM("asm/us/dra/nonmatchings/75F54", EntitySubwpnThrownDagger);
@ -1516,7 +1503,7 @@ INCLUDE_ASM("asm/us/dra/nonmatchings/75F54", func_80130E94);
#ifndef NON_EQUIVALENT
INCLUDE_ASM("asm/us/dra/nonmatchings/75F54", func_8013136C);
#else
void func_8012C600(void); /* extern */
void func_8012C600(void);
extern u16 D_8007412E;
extern s32 D_800741CC;
extern s32 D_800741D0;

View File

@ -144,7 +144,7 @@ extern s16 D_800ACF60[]; // collection of sounds?
extern s32 D_800ACFB4[];
extern s32 D_800ADC44;
extern s32 D_800AE270[];
extern s32* D_800AE294; // might not really be a pointer
extern AnimationFrame* D_800AE294;
extern s16 D_800AFDA6;
extern const char* c_strEquip;
extern const char* c_strSpells;

View File

@ -514,12 +514,10 @@ Entity* func_801606BC(Entity* srcEntity, u32 arg1, s32 arg2) {
INCLUDE_ASM("asm/us/ric/nonmatchings/20920", func_80160788);
// move a0,s0
#ifndef NON_MATCHING
INCLUDE_ASM("asm/us/ric/nonmatchings/20920", func_80160C38);
#else
void func_80160C38(Entity* entity) {
if (PLAYER.step == 17) {
if (PLAYER.step != 23) {
func_80156C60(entity);
} else {
entity->posX.i.hi = PLAYER.posX.i.hi;
entity->posY.i.hi = PLAYER.posY.i.hi;
entity->facing = PLAYER.facing;
@ -541,11 +539,8 @@ void func_80160C38(Entity* entity) {
if (PLAYER.animFrameIdx >= 8) {
func_80156C60(entity);
}
} else {
func_80156C60(entity);
}
}
#endif
// aspatch jumps to the wrong instruction
// Matches with PSY-Q 3.5 + aspsx 2.3.4