mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-23 05:00:12 +00:00
decomp sub_8083568 thanks to @jiangzhengwenjz
This commit is contained in:
parent
973cad1733
commit
f2a2f684fd
@ -1,83 +0,0 @@
|
||||
#include "asm/constants/gba_constants.inc"
|
||||
#include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8083568
|
||||
sub_8083568:
|
||||
push {r4,r5,lr}
|
||||
lsls r2, 24
|
||||
lsrs r5, r2, 24
|
||||
ldr r2, _080835E0
|
||||
ldr r2, [r2]
|
||||
ldr r4, _080835E4
|
||||
adds r3, r2, r4
|
||||
movs r4, 0
|
||||
ldrsh r3, [r3, r4]
|
||||
subs r3, r0, r3
|
||||
ldr r0, _080835E8
|
||||
adds r2, r0
|
||||
movs r4, 0
|
||||
ldrsh r0, [r2, r4]
|
||||
subs r4, r1, r0
|
||||
movs r0, 0x10
|
||||
negs r0, r0
|
||||
cmp r3, r0
|
||||
blt _080835F8
|
||||
cmp r4, r0
|
||||
blt _080835F8
|
||||
cmp r3, 0xFF
|
||||
bgt _080835F8
|
||||
cmp r4, 0xAF
|
||||
bgt _080835F8
|
||||
ldr r1, _080835EC
|
||||
lsls r0, r5, 1
|
||||
adds r0, r5
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
movs r1, 0x8
|
||||
ldrsh r2, [r0, r1]
|
||||
adds r2, r3, r2
|
||||
ldr r1, _080835F0
|
||||
ands r2, r1
|
||||
ldrh r3, [r0, 0x2]
|
||||
movs r1, 0xFE
|
||||
lsls r1, 8
|
||||
ands r1, r3
|
||||
orrs r1, r2
|
||||
strh r1, [r0, 0x2]
|
||||
movs r1, 0xA
|
||||
ldrsh r2, [r0, r1]
|
||||
adds r2, r4, r2
|
||||
ldr r1, _080835F4
|
||||
ands r2, r1
|
||||
lsls r2, 4
|
||||
ldrh r3, [r0, 0x6]
|
||||
movs r1, 0xF
|
||||
ands r1, r3
|
||||
orrs r1, r2
|
||||
strh r1, [r0, 0x6]
|
||||
movs r1, 0
|
||||
movs r2, 0
|
||||
movs r3, 0
|
||||
bl AddSprite
|
||||
movs r0, 0x1
|
||||
b _080835FA
|
||||
.align 2, 0
|
||||
_080835E0: .4byte gDungeon
|
||||
_080835E4: .4byte 0x000181f0
|
||||
_080835E8: .4byte 0x000181f2
|
||||
_080835EC: .4byte gUnknown_202ED28
|
||||
_080835F0: .4byte 0x000001ff
|
||||
_080835F4: .4byte 0x00000fff
|
||||
_080835F8:
|
||||
movs r0, 0
|
||||
_080835FA:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8083568
|
||||
|
||||
.align 2, 0
|
@ -272,7 +272,7 @@ SECTIONS {
|
||||
asm/code_807FCD4.o(.text);
|
||||
src/code_8083288.o(.text);
|
||||
src/dungeon_range.o(.text);
|
||||
asm/code_808333C.o(.text);
|
||||
src/code_808333C.o(.text);
|
||||
src/dungeon_leader.o(.text);
|
||||
asm/code_8083654.o(.text);
|
||||
src/dungeon_music.o(.text);
|
||||
|
61
src/code_808333C.c
Normal file
61
src/code_808333C.c
Normal file
@ -0,0 +1,61 @@
|
||||
#include "global.h"
|
||||
#include "structs/str_dungeon.h"
|
||||
|
||||
struct unkStruct_202ED28
|
||||
{
|
||||
SpriteOAM sp;
|
||||
s16 unk8;
|
||||
s16 unkA;
|
||||
};
|
||||
|
||||
struct unkStruct_202ED28 gUnknown_202ED28[4]; // seeing index 3 used a lot
|
||||
|
||||
bool8 sub_8083568(s32 inX, s32 inY, u8 index) {
|
||||
s32 x;
|
||||
s32 y;
|
||||
SpriteOAM *sp;
|
||||
s32 tmp2;
|
||||
#ifdef NONMATCHING
|
||||
s32 tmp;
|
||||
#else
|
||||
register s32 tmp asm("r2");
|
||||
#endif
|
||||
|
||||
x = inX - gDungeon->cameraPixelPos.x;
|
||||
y = inY - gDungeon->cameraPixelPos.y;
|
||||
|
||||
if (x >= -16 && y >= -16 && x <= 255 && y <= 175)
|
||||
{
|
||||
struct unkStruct_202ED28 *ptr = gUnknown_202ED28;
|
||||
sp = &ptr[index].sp;
|
||||
|
||||
tmp = ptr[index].unk8;
|
||||
tmp = x + ptr[index].unk8;
|
||||
tmp &= SPRITEOAM_MASK_X;
|
||||
|
||||
x = sp->attrib2;
|
||||
tmp2 = (0xFE << 8);
|
||||
tmp2 &= x;
|
||||
tmp2 |= tmp;
|
||||
sp->attrib2 = tmp2;
|
||||
|
||||
tmp = ptr[index].unkA;
|
||||
tmp = y + ptr[index].unkA;
|
||||
tmp &= SPRITEOAM_MAX_UNK6_4;
|
||||
tmp <<= SPRITEOAM_SHIFT_UNK6_4;
|
||||
|
||||
x = sp->unk6;
|
||||
tmp2 = 0xF;
|
||||
tmp2 &= x;
|
||||
tmp2 |= tmp;
|
||||
sp->unk6 = tmp2;
|
||||
|
||||
|
||||
AddSprite(sp, 0, NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user