mirror of
https://github.com/pret/pmd-red.git
synced 2026-06-13 12:10:49 -05:00
more moves decomp
This commit is contained in:
parent
c747b82d16
commit
4844237add
260
asm/moves_2.s
260
asm/moves_2.s
|
|
@ -5,266 +5,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_80935B8
|
||||
sub_80935B8:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
adds r5, r0, 0
|
||||
movs r0, 0x63
|
||||
mov r12, r0
|
||||
movs r0, 0
|
||||
mov r8, r0
|
||||
movs r6, 0
|
||||
adds r4, r1, 0
|
||||
cmp r4, 0
|
||||
blt _08093606
|
||||
lsls r0, r4, 3
|
||||
adds r2, r5, r0
|
||||
ldrb r1, [r2]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08093606
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08093606
|
||||
movs r7, 0x1
|
||||
movs r3, 0x2
|
||||
_080935EC:
|
||||
subs r2, 0x8
|
||||
subs r4, 0x1
|
||||
cmp r4, 0
|
||||
blt _08093606
|
||||
ldrb r1, [r2]
|
||||
adds r0, r7, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08093606
|
||||
adds r0, r3, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _080935EC
|
||||
_08093606:
|
||||
adds r2, r4, 0x1
|
||||
mov r9, r2
|
||||
cmp r2, 0x3
|
||||
bgt _08093642
|
||||
lsls r0, r2, 3
|
||||
adds r3, r5, r0
|
||||
ldrb r1, [r3]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08093642
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08093642
|
||||
movs r6, 0x1
|
||||
movs r7, 0x2
|
||||
_08093628:
|
||||
adds r3, 0x8
|
||||
adds r2, 0x1
|
||||
cmp r2, 0x3
|
||||
bgt _08093642
|
||||
ldrb r1, [r3]
|
||||
adds r0, r6, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08093642
|
||||
adds r0, r7, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _08093628
|
||||
_08093642:
|
||||
cmp r6, 0
|
||||
bne _0809364A
|
||||
movs r0, 0x63
|
||||
b _080936CC
|
||||
_0809364A:
|
||||
movs r6, 0
|
||||
b _08093668
|
||||
_0809364E:
|
||||
ldrb r0, [r3, 0x4]
|
||||
cmp r12, r0
|
||||
ble _08093656
|
||||
mov r12, r0
|
||||
_08093656:
|
||||
cmp r0, 0
|
||||
bne _0809365C
|
||||
movs r6, 0x1
|
||||
_0809365C:
|
||||
ldrb r1, [r3, 0x1]
|
||||
movs r0, 0x20
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08093668
|
||||
movs r6, 0x1
|
||||
_08093668:
|
||||
subs r2, 0x1
|
||||
cmp r2, r4
|
||||
blt _0809367C
|
||||
lsls r0, r2, 3
|
||||
adds r3, r5, r0
|
||||
ldrb r1, [r3]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0809364E
|
||||
_0809367C:
|
||||
cmp r6, 0
|
||||
beq _080936C6
|
||||
mov r2, r9
|
||||
cmp r2, 0x3
|
||||
bgt _080936C0
|
||||
lsls r0, r2, 3
|
||||
adds r3, r5, r0
|
||||
ldrb r1, [r3]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080936C0
|
||||
movs r6, 0x2
|
||||
movs r4, 0xFD
|
||||
_08093698:
|
||||
ldrb r1, [r3]
|
||||
adds r0, r6, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080936C0
|
||||
adds r0, r4, 0
|
||||
ands r0, r1
|
||||
strb r0, [r3]
|
||||
movs r0, 0x1
|
||||
mov r8, r0
|
||||
adds r2, 0x1
|
||||
cmp r2, 0x3
|
||||
bgt _080936C0
|
||||
lsls r0, r2, 3
|
||||
adds r3, r5, r0
|
||||
ldrb r1, [r3]
|
||||
mov r0, r8
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _08093698
|
||||
_080936C0:
|
||||
mov r0, r8
|
||||
cmp r0, 0
|
||||
bne _080936CA
|
||||
_080936C6:
|
||||
mov r0, r12
|
||||
b _080936CC
|
||||
_080936CA:
|
||||
movs r0, 0
|
||||
_080936CC:
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80935B8
|
||||
|
||||
thumb_func_start sub_80936D8
|
||||
sub_80936D8:
|
||||
push {r4,lr}
|
||||
sub sp, 0x80
|
||||
adds r4, r0, 0
|
||||
mov r1, sp
|
||||
bl sub_8093784
|
||||
adds r0, r4, 0
|
||||
mov r1, sp
|
||||
bl sub_80937E0
|
||||
add sp, 0x80
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_80936D8
|
||||
|
||||
thumb_func_start sub_80936F4
|
||||
sub_80936F4:
|
||||
push {r4,lr}
|
||||
ldr r4, _08093718
|
||||
add sp, r4
|
||||
adds r4, r0, 0
|
||||
mov r1, sp
|
||||
bl sub_8093974
|
||||
adds r0, r4, 0
|
||||
mov r1, sp
|
||||
bl sub_8093A2C
|
||||
movs r3, 0x80
|
||||
lsls r3, 2
|
||||
add sp, r3
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08093718: .4byte 0xfffffe00
|
||||
thumb_func_end sub_80936F4
|
||||
|
||||
thumb_func_start sub_809371C
|
||||
sub_809371C:
|
||||
push {r4,lr}
|
||||
ldr r4, _08093740
|
||||
add sp, r4
|
||||
adds r4, r0, 0
|
||||
mov r1, sp
|
||||
bl sub_80939D0
|
||||
adds r0, r4, 0
|
||||
mov r1, sp
|
||||
bl sub_8093B40
|
||||
movs r3, 0x80
|
||||
lsls r3, 2
|
||||
add sp, r3
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08093740: .4byte 0xfffffe00
|
||||
thumb_func_end sub_809371C
|
||||
|
||||
thumb_func_start sub_8093744
|
||||
sub_8093744:
|
||||
push {r4-r7,lr}
|
||||
adds r7, r0, 0
|
||||
movs r4, 0
|
||||
movs r6, 0x1
|
||||
movs r5, 0x80
|
||||
_0809374E:
|
||||
movs r3, 0
|
||||
lsls r0, r4, 5
|
||||
adds r2, r0, r7
|
||||
_08093754:
|
||||
ldrb r1, [r2]
|
||||
adds r0, r6, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0809376A
|
||||
adds r0, r5, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0809376A
|
||||
adds r0, r4, 0
|
||||
b _0809377C
|
||||
_0809376A:
|
||||
adds r2, 0x8
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x3
|
||||
ble _08093754
|
||||
adds r4, 0x1
|
||||
cmp r4, 0x3
|
||||
ble _0809374E
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
_0809377C:
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8093744
|
||||
|
||||
thumb_func_start sub_8093784
|
||||
sub_8093784:
|
||||
push {r4-r7,lr}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,6 @@ bool8 MoveAffectedByMuzzled(u16 moveID);
|
|||
bool8 IsBlockedBySoundproof(struct PokemonMove *move);
|
||||
bool8 DoesMoveCharge(u16 move);
|
||||
|
||||
void sub_809371C(struct PokemonMove* move);
|
||||
|
||||
#endif // GUARD_MOVES_H
|
||||
|
|
|
|||
128
src/moves_1.c
128
src/moves_1.c
|
|
@ -8,7 +8,16 @@ u8 sub_8093468(int param_1, struct PokemonMove* src_struct);
|
|||
u8 sub_8093400(int param_1, struct PokemonMove* src_struct);
|
||||
u8 sub_80933D8(int param_1, void* src_struct);
|
||||
bool8 DoesMoveCharge(u16 move);
|
||||
void sub_809371C(struct PokemonMove*);
|
||||
|
||||
// second arg should be some sort of struct pointer
|
||||
void sub_8093784(int, u8*);
|
||||
void sub_80937E0(int, u8*);
|
||||
void sub_8093974(int, u8*);
|
||||
void sub_8093A2C(int, u8*);
|
||||
|
||||
void sub_80939D0(struct PokemonMove*, struct PokemonMove*);
|
||||
void sub_8093B40(struct PokemonMove*, struct PokemonMove*);
|
||||
|
||||
|
||||
int IsMoveSet(int index, struct PokemonMove* struct_ptr)
|
||||
{
|
||||
|
|
@ -221,4 +230,119 @@ int sub_8093560(int index, struct PokemonMove* moves, u16* dest) {
|
|||
counter++;
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
}
|
||||
|
||||
int sub_80935B8(struct PokemonMove *moves, int index) {
|
||||
int i;
|
||||
int last_index;
|
||||
int for_loop_any1;
|
||||
int any_move_linked;
|
||||
int pp;
|
||||
int v1;
|
||||
|
||||
pp = 99;
|
||||
any_move_linked = 0;
|
||||
for_loop_any1 = 0;
|
||||
|
||||
last_index = index;
|
||||
while (last_index >= 0) {
|
||||
struct PokemonMove *move = &moves[last_index];
|
||||
if (!((move->moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_LINKED))) {
|
||||
break;
|
||||
}
|
||||
|
||||
last_index--;
|
||||
}
|
||||
|
||||
// this is so stupid but it works
|
||||
for_loop_any1++;for_loop_any1--;
|
||||
|
||||
for (i = last_index + 1; i < 4; i++) {
|
||||
struct PokemonMove *move = &moves[i];
|
||||
if (!((move->moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_LINKED))) {
|
||||
break;
|
||||
}
|
||||
|
||||
for_loop_any1 = 1;
|
||||
}
|
||||
|
||||
if (!for_loop_any1) {
|
||||
return 99;
|
||||
}
|
||||
|
||||
v1 = 0;
|
||||
while (--i >= last_index) {
|
||||
struct PokemonMove* move = &moves[i];
|
||||
if (!(move->moveFlags & MOVE_FLAG_EXISTS)) {
|
||||
break;
|
||||
}
|
||||
if (pp > move->PP) {
|
||||
pp = move->PP;
|
||||
}
|
||||
if (!move->PP) {
|
||||
v1 = 1;
|
||||
}
|
||||
if (move->moveFlags2 & MOVE_FLAG_REPLACE) {
|
||||
v1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!v1) {
|
||||
return pp;
|
||||
}
|
||||
|
||||
for (i = last_index + 1; i < 4; i++) {
|
||||
struct PokemonMove* move = &moves[i];
|
||||
if (!(moves[i].moveFlags & MOVE_FLAG_EXISTS)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (move->moveFlags & MOVE_FLAG_LINKED) {
|
||||
move->moveFlags &= ~MOVE_FLAG_LINKED;
|
||||
any_move_linked = 1;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (any_move_linked) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return pp;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80936D8(int index) {
|
||||
u8 someStruct[0x80];
|
||||
sub_8093784(index, someStruct);
|
||||
sub_80937E0(index, someStruct);
|
||||
}
|
||||
|
||||
void sub_80936F4(int index) {
|
||||
u8 someStruct[0x80 * 4];
|
||||
sub_8093974(index, someStruct);
|
||||
sub_8093A2C(index, someStruct);
|
||||
}
|
||||
|
||||
void sub_809371C(struct PokemonMove* move) {
|
||||
struct PokemonMove moves[64];
|
||||
|
||||
sub_80939D0(move, moves);
|
||||
sub_8093B40(move, moves);
|
||||
}
|
||||
|
||||
int sub_8093744(struct PokemonMove moves[4][4], int index) {
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
if ((moves[i][j].moveFlags & 1) && (moves[i][j].moveFlags & 0x80)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user