mirror of
https://github.com/pret/pmd-red.git
synced 2026-09-30 04:47:58 -05:00
some more decomp and documenting
This commit is contained in:
@@ -261,7 +261,7 @@ _0801F026:
|
||||
ldrsh r4, [r2, r0]
|
||||
ldr r0, [r2, 0x10]
|
||||
adds r1, r4, 0
|
||||
bl sub_809309C
|
||||
bl unk_SetMoveToLastInLinkedSequence8_v2
|
||||
_0801F032:
|
||||
ldr r1, [r5]
|
||||
strh r0, [r1, 0x34]
|
||||
@@ -285,7 +285,7 @@ _0801F04C:
|
||||
ldrsh r4, [r2, r1]
|
||||
ldr r0, [r2, 0x10]
|
||||
adds r1, r4, 0
|
||||
bl sub_809324C
|
||||
bl unk_SetMoveToFirstInLinkedSequence8_v2
|
||||
b _0801F032
|
||||
.align 2, 0
|
||||
_0801F068: .4byte gUnknown_203B270
|
||||
|
||||
@@ -10863,7 +10863,7 @@ _0806305C:
|
||||
lsls r0, 1
|
||||
add r0, r9
|
||||
adds r1, r6, 0
|
||||
bl sub_8092F80
|
||||
bl unk_SetMoveToLastInLinkedSequence4
|
||||
ldr r1, _080630A4
|
||||
str r0, [r1]
|
||||
cmp r6, r0
|
||||
@@ -10917,7 +10917,7 @@ _080630DE:
|
||||
lsls r0, 1
|
||||
add r0, r9
|
||||
adds r1, r6, 0
|
||||
bl sub_8093130
|
||||
bl unk_SetMoveToFirstInLinkedSequence4
|
||||
ldr r1, _08063120
|
||||
str r0, [r1]
|
||||
cmp r6, r0
|
||||
|
||||
459
asm/moves_1.s
459
asm/moves_1.s
@@ -325,463 +325,4 @@ _08092F7A:
|
||||
bx r1
|
||||
thumb_func_end sub_8092F4C
|
||||
|
||||
thumb_func_start sub_8092F80
|
||||
sub_8092F80:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x80
|
||||
adds r7, r0, 0
|
||||
mov r8, r1
|
||||
lsls r0, r1, 3
|
||||
adds r0, r7, r0
|
||||
ldrb r2, [r0]
|
||||
movs r1, 0x80
|
||||
orrs r1, r2
|
||||
strb r1, [r0]
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_GetLinkedSequences4
|
||||
mov r0, sp
|
||||
bl unk_FindMoveFlag2Unk80InLinkedSequences44
|
||||
adds r3, r0, 0
|
||||
cmp r3, 0x2
|
||||
bhi _08092FCC
|
||||
lsls r1, r3, 5
|
||||
adds r0, r3, 0x1
|
||||
lsls r0, 5
|
||||
mov r2, sp
|
||||
adds r5, r0, r2
|
||||
adds r4, r1, r2
|
||||
movs r6, 0x3
|
||||
_08092FBA:
|
||||
ldr r2, [r4]
|
||||
ldr r3, [r4, 0x4]
|
||||
ldr r0, [r5]
|
||||
ldr r1, [r5, 0x4]
|
||||
stm r4!, {r0,r1}
|
||||
stm r5!, {r2,r3}
|
||||
subs r6, 0x1
|
||||
cmp r6, 0
|
||||
bge _08092FBA
|
||||
_08092FCC:
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_LinkedSequencesToMoves4
|
||||
movs r3, 0
|
||||
movs r5, 0x80
|
||||
movs r4, 0x7F
|
||||
adds r1, r7, 0
|
||||
_08092FDC:
|
||||
ldrb r2, [r1]
|
||||
adds r0, r5, 0
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
beq _08092FF0
|
||||
adds r0, r4, 0
|
||||
ands r0, r2
|
||||
strb r0, [r1]
|
||||
mov r8, r3
|
||||
b _08092FF8
|
||||
_08092FF0:
|
||||
adds r1, 0x8
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x3
|
||||
ble _08092FDC
|
||||
_08092FF8:
|
||||
mov r0, r8
|
||||
add sp, 0x80
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8092F80
|
||||
|
||||
thumb_func_start sub_8093008
|
||||
sub_8093008:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
ldr r4, _0809307C
|
||||
add sp, r4
|
||||
adds r7, r0, 0
|
||||
mov r8, r1
|
||||
lsls r0, r1, 3
|
||||
adds r0, r7, r0
|
||||
ldrb r2, [r0]
|
||||
movs r1, 0x80
|
||||
orrs r1, r2
|
||||
strb r1, [r0]
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_GetLinkedSequences8
|
||||
mov r0, sp
|
||||
bl unk_FindMoveFlag2Unk80InLinkedSequences88
|
||||
adds r3, r0, 0
|
||||
cmp r3, 0x6
|
||||
bhi _08093056
|
||||
lsls r1, r3, 6
|
||||
adds r0, r3, 0x1
|
||||
lsls r0, 6
|
||||
mov r2, sp
|
||||
adds r5, r0, r2
|
||||
adds r4, r1, r2
|
||||
movs r6, 0x7
|
||||
_08093044:
|
||||
ldr r2, [r4]
|
||||
ldr r3, [r4, 0x4]
|
||||
ldr r0, [r5]
|
||||
ldr r1, [r5, 0x4]
|
||||
stm r4!, {r0,r1}
|
||||
stm r5!, {r2,r3}
|
||||
subs r6, 0x1
|
||||
cmp r6, 0
|
||||
bge _08093044
|
||||
_08093056:
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_LinkedSequencesToMoves8
|
||||
movs r3, 0
|
||||
movs r5, 0x80
|
||||
movs r4, 0x7F
|
||||
adds r1, r7, 0
|
||||
_08093066:
|
||||
ldrb r2, [r1]
|
||||
adds r0, r5, 0
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
beq _08093080
|
||||
adds r0, r4, 0
|
||||
ands r0, r2
|
||||
strb r0, [r1]
|
||||
mov r8, r3
|
||||
b _08093088
|
||||
.align 2, 0
|
||||
_0809307C: .4byte 0xfffffe00
|
||||
_08093080:
|
||||
adds r1, 0x8
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x7
|
||||
ble _08093066
|
||||
_08093088:
|
||||
mov r0, r8
|
||||
movs r3, 0x80
|
||||
lsls r3, 2
|
||||
add sp, r3
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8093008
|
||||
|
||||
thumb_func_start sub_809309C
|
||||
sub_809309C:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
ldr r4, _08093110
|
||||
add sp, r4
|
||||
adds r7, r0, 0
|
||||
mov r8, r1
|
||||
lsls r0, r1, 3
|
||||
adds r0, r7, r0
|
||||
ldrb r2, [r0]
|
||||
movs r1, 0x80
|
||||
orrs r1, r2
|
||||
strb r1, [r0]
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_GetLinkedSequences8_v2
|
||||
mov r0, sp
|
||||
bl unk_FindMoveFlag2Unk80InLinkedSequences88_v2
|
||||
adds r3, r0, 0
|
||||
cmp r3, 0x6
|
||||
bhi _080930EA
|
||||
lsls r1, r3, 6
|
||||
adds r0, r3, 0x1
|
||||
lsls r0, 6
|
||||
mov r2, sp
|
||||
adds r5, r0, r2
|
||||
adds r4, r1, r2
|
||||
movs r6, 0x7
|
||||
_080930D8:
|
||||
ldr r2, [r4]
|
||||
ldr r3, [r4, 0x4]
|
||||
ldr r0, [r5]
|
||||
ldr r1, [r5, 0x4]
|
||||
stm r4!, {r0,r1}
|
||||
stm r5!, {r2,r3}
|
||||
subs r6, 0x1
|
||||
cmp r6, 0
|
||||
bge _080930D8
|
||||
_080930EA:
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_LinkedSequencesToMoves8_v2
|
||||
movs r3, 0
|
||||
movs r5, 0x80
|
||||
movs r4, 0x7F
|
||||
adds r1, r7, 0
|
||||
_080930FA:
|
||||
ldrb r2, [r1]
|
||||
adds r0, r5, 0
|
||||
ands r0, r2
|
||||
cmp r0, 0
|
||||
beq _08093114
|
||||
adds r0, r4, 0
|
||||
ands r0, r2
|
||||
strb r0, [r1]
|
||||
mov r8, r3
|
||||
b _0809311C
|
||||
.align 2, 0
|
||||
_08093110: .4byte 0xfffffe00
|
||||
_08093114:
|
||||
adds r1, 0x8
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x7
|
||||
ble _080930FA
|
||||
_0809311C:
|
||||
mov r0, r8
|
||||
movs r3, 0x80
|
||||
lsls r3, 2
|
||||
add sp, r3
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_809309C
|
||||
|
||||
thumb_func_start sub_8093130
|
||||
sub_8093130:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x80
|
||||
adds r7, r0, 0
|
||||
mov r8, r1
|
||||
lsls r0, r1, 3
|
||||
adds r0, r7, r0
|
||||
ldrb r2, [r0]
|
||||
movs r1, 0x80
|
||||
orrs r1, r2
|
||||
strb r1, [r0]
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_GetLinkedSequences4
|
||||
mov r0, sp
|
||||
bl unk_FindMoveFlag2Unk80InLinkedSequences44
|
||||
adds r1, r0, 0
|
||||
subs r0, r1, 0x1
|
||||
cmp r0, 0x2
|
||||
bhi _0809317C
|
||||
lsls r1, 5
|
||||
lsls r0, 5
|
||||
mov r2, sp
|
||||
adds r5, r0, r2
|
||||
adds r4, r1, r2
|
||||
movs r6, 0x3
|
||||
_0809316A:
|
||||
ldr r2, [r4]
|
||||
ldr r3, [r4, 0x4]
|
||||
ldr r0, [r5]
|
||||
ldr r1, [r5, 0x4]
|
||||
stm r4!, {r0,r1}
|
||||
stm r5!, {r2,r3}
|
||||
subs r6, 0x1
|
||||
cmp r6, 0
|
||||
bge _0809316A
|
||||
_0809317C:
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_LinkedSequencesToMoves4
|
||||
movs r1, 0
|
||||
movs r5, 0x80
|
||||
movs r4, 0x7F
|
||||
adds r2, r7, 0
|
||||
_0809318C:
|
||||
ldrb r3, [r2]
|
||||
adds r0, r5, 0
|
||||
ands r0, r3
|
||||
cmp r0, 0
|
||||
beq _080931A0
|
||||
adds r0, r4, 0
|
||||
ands r0, r3
|
||||
strb r0, [r2]
|
||||
mov r8, r1
|
||||
b _080931A8
|
||||
_080931A0:
|
||||
adds r2, 0x8
|
||||
adds r1, 0x1
|
||||
cmp r1, 0x3
|
||||
ble _0809318C
|
||||
_080931A8:
|
||||
mov r0, r8
|
||||
add sp, 0x80
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8093130
|
||||
|
||||
thumb_func_start sub_80931B8
|
||||
sub_80931B8:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
ldr r4, _0809322C
|
||||
add sp, r4
|
||||
adds r7, r0, 0
|
||||
mov r8, r1
|
||||
lsls r0, r1, 3
|
||||
adds r0, r7, r0
|
||||
ldrb r2, [r0]
|
||||
movs r1, 0x80
|
||||
orrs r1, r2
|
||||
strb r1, [r0]
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_GetLinkedSequences8
|
||||
mov r0, sp
|
||||
bl unk_FindMoveFlag2Unk80InLinkedSequences88
|
||||
adds r1, r0, 0
|
||||
subs r0, r1, 0x1
|
||||
cmp r0, 0x6
|
||||
bhi _08093206
|
||||
lsls r1, 6
|
||||
lsls r0, 6
|
||||
mov r2, sp
|
||||
adds r5, r0, r2
|
||||
adds r4, r1, r2
|
||||
movs r6, 0x7
|
||||
_080931F4:
|
||||
ldr r2, [r4]
|
||||
ldr r3, [r4, 0x4]
|
||||
ldr r0, [r5]
|
||||
ldr r1, [r5, 0x4]
|
||||
stm r4!, {r0,r1}
|
||||
stm r5!, {r2,r3}
|
||||
subs r6, 0x1
|
||||
cmp r6, 0
|
||||
bge _080931F4
|
||||
_08093206:
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_LinkedSequencesToMoves8
|
||||
movs r1, 0
|
||||
movs r5, 0x80
|
||||
movs r4, 0x7F
|
||||
adds r2, r7, 0
|
||||
_08093216:
|
||||
ldrb r3, [r2]
|
||||
adds r0, r5, 0
|
||||
ands r0, r3
|
||||
cmp r0, 0
|
||||
beq _08093230
|
||||
adds r0, r4, 0
|
||||
ands r0, r3
|
||||
strb r0, [r2]
|
||||
mov r8, r1
|
||||
b _08093238
|
||||
.align 2, 0
|
||||
_0809322C: .4byte 0xfffffe00
|
||||
_08093230:
|
||||
adds r2, 0x8
|
||||
adds r1, 0x1
|
||||
cmp r1, 0x7
|
||||
ble _08093216
|
||||
_08093238:
|
||||
mov r0, r8
|
||||
movs r3, 0x80
|
||||
lsls r3, 2
|
||||
add sp, r3
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80931B8
|
||||
|
||||
thumb_func_start sub_809324C
|
||||
sub_809324C:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
ldr r4, _080932C0
|
||||
add sp, r4
|
||||
adds r7, r0, 0
|
||||
mov r8, r1
|
||||
lsls r0, r1, 3
|
||||
adds r0, r7, r0
|
||||
ldrb r2, [r0]
|
||||
movs r1, 0x80
|
||||
orrs r1, r2
|
||||
strb r1, [r0]
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_GetLinkedSequences8_v2
|
||||
mov r0, sp
|
||||
bl unk_FindMoveFlag2Unk80InLinkedSequences88_v2
|
||||
adds r1, r0, 0
|
||||
subs r0, r1, 0x1
|
||||
cmp r0, 0x6
|
||||
bhi _0809329A
|
||||
lsls r1, 6
|
||||
lsls r0, 6
|
||||
mov r2, sp
|
||||
adds r5, r0, r2
|
||||
adds r4, r1, r2
|
||||
movs r6, 0x7
|
||||
_08093288:
|
||||
ldr r2, [r4]
|
||||
ldr r3, [r4, 0x4]
|
||||
ldr r0, [r5]
|
||||
ldr r1, [r5, 0x4]
|
||||
stm r4!, {r0,r1}
|
||||
stm r5!, {r2,r3}
|
||||
subs r6, 0x1
|
||||
cmp r6, 0
|
||||
bge _08093288
|
||||
_0809329A:
|
||||
adds r0, r7, 0
|
||||
mov r1, sp
|
||||
bl unk_LinkedSequencesToMoves8_v2
|
||||
movs r1, 0
|
||||
movs r5, 0x80
|
||||
movs r4, 0x7F
|
||||
adds r2, r7, 0
|
||||
_080932AA:
|
||||
ldrb r3, [r2]
|
||||
adds r0, r5, 0
|
||||
ands r0, r3
|
||||
cmp r0, 0
|
||||
beq _080932C4
|
||||
adds r0, r4, 0
|
||||
ands r0, r3
|
||||
strb r0, [r2]
|
||||
mov r8, r1
|
||||
b _080932CC
|
||||
.align 2, 0
|
||||
_080932C0: .4byte 0xfffffe00
|
||||
_080932C4:
|
||||
adds r2, 0x8
|
||||
adds r1, 0x1
|
||||
cmp r1, 0x7
|
||||
ble _080932AA
|
||||
_080932CC:
|
||||
mov r0, r8
|
||||
movs r3, 0x80
|
||||
lsls r3, 2
|
||||
add sp, r3
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_809324C
|
||||
|
||||
|
||||
.align 2,0
|
||||
|
||||
@@ -11,7 +11,7 @@ enum MoveFlag
|
||||
MOVE_FLAG_SET = 1 << 3, // This move can be triggered by pressing L+A instead of having to go to the move menu.
|
||||
MOVE_FLAG_LAST_USED = 1 << 4, // The most recent move used by the Pokémon.
|
||||
MOVE_FLAG_DISABLED = 1 << 5, // Disabled by an effect like Taunt.
|
||||
MOVE_FLAG_UNK80 = 1 << 7
|
||||
MOVE_FLAG_INTERNAL_MARKER = 1 << 7 // Possibly some kind of flag used internally to mark a move and find it again
|
||||
};
|
||||
|
||||
enum MoveFlag2
|
||||
|
||||
@@ -36,4 +36,19 @@ void unk_FixLinkedMovesSetEnabled8_v2(struct Move* move);
|
||||
void sub_8092D54(u8 *buffer, struct Move *move);
|
||||
extern void CopyAndResetMove(struct Move *, struct Move *);
|
||||
|
||||
void unk_GetLinkedSequences4(struct Move* moves, struct Move linkedSequences[4][4]);
|
||||
void unk_LinkedSequencesToMoves4(struct Move* moves, struct Move linkedSequences[4][4]);
|
||||
void unk_GetLinkedSequences8(struct Move* moves, struct Move linkedSequences[8][8]);
|
||||
void unk_LinkedSequencesToMoves8(struct Move* moves, struct Move linkedSequences[8][8]);
|
||||
void unk_GetLinkedSequences8_v2(struct Move* moves, struct Move linkedSequences[8][8]);
|
||||
void unk_LinkedSequencesToMoves8_v2(struct Move* moves, struct Move linkedSequences[8][8]);
|
||||
|
||||
int unk_FindMarkedMoveInLinkedSequences44(struct Move linkedSequences[4][4]);
|
||||
void unk_LinkedSequencesToMoves4(struct Move* moves, struct Move linkedSequences[4][4]);
|
||||
int unk_FindMarkedMoveInLinkedSequences88(struct Move linkedSequences[8][8]);
|
||||
void unk_LinkedSequencesToMoves8(struct Move* moves, struct Move linkedSequences[8][8]);
|
||||
int unk_FindMarkedMoveInLinkedSequences88_v2(struct Move linkedSequences[8][8]);
|
||||
void unk_LinkedSequencesToMoves8_v2(struct Move* moves, struct Move linkedSequences[8][8]);
|
||||
|
||||
|
||||
#endif // GUARD_MOVES_H
|
||||
|
||||
224
src/moves_1.c
224
src/moves_1.c
@@ -16,14 +16,6 @@ bool8 TryLinkMovesAfter(int param_1, struct Move* src_struct);
|
||||
bool8 sub_80933D8(int param_1, void* src_struct);
|
||||
bool8 DoesMoveCharge(u16 move);
|
||||
|
||||
void unk_GetLinkedSequences4(struct Move* moves, struct Move linkedSequences[4][4]);
|
||||
void unk_LinkedSequencesToMoves4(struct Move* moves, struct Move linkedSequences[4][4]);
|
||||
void unk_GetLinkedSequences8(struct Move* moves, struct Move linkedSequences[8][8]);
|
||||
void unk_LinkedSequencesToMoves8(struct Move* moves, struct Move linkedSequences[8][8]);
|
||||
|
||||
void unk_GetLinkedSequences8_v2(struct Move*, struct Move[8][8]);
|
||||
void unk_LinkedSequencesToMoves8_v2(struct Move*, struct Move[8][8]);
|
||||
|
||||
int unk_PrintMoveDescription(int, struct Move*, int, struct subStruct_203B240**);
|
||||
|
||||
extern void sub_80073B8(u32);
|
||||
@@ -40,6 +32,210 @@ extern u32 gUnknown_202DE30;
|
||||
extern u8* gPtrTypeText; // "Type"
|
||||
extern u8* gUnknown_810CF00; // "Range#=@.$m0 "
|
||||
|
||||
// the next 3 functions are the same, except the first
|
||||
// is for 4, then for 8 then for 8_v2
|
||||
int unk_SetMoveToLastInLinkedSequence4(struct Move* moves, int index) {
|
||||
struct Move* move;
|
||||
struct Move linkedSequence[4][4];
|
||||
s32 startIndex;
|
||||
int result;
|
||||
int i;
|
||||
|
||||
result = index;
|
||||
|
||||
move = &moves[index];
|
||||
move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER;
|
||||
unk_GetLinkedSequences4(moves, linkedSequence);
|
||||
|
||||
startIndex = unk_FindMarkedMoveInLinkedSequences44(linkedSequence);
|
||||
if (startIndex >= 0 && startIndex < 3) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
const struct Move temp = linkedSequence[startIndex][i];
|
||||
linkedSequence[startIndex][i] = linkedSequence[startIndex + 1][i];
|
||||
linkedSequence[startIndex + 1][i] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
unk_LinkedSequencesToMoves4(moves, linkedSequence);
|
||||
for (startIndex = 0; startIndex < 4; startIndex++) {
|
||||
if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) {
|
||||
moves[startIndex].moveFlags &= ~MOVE_FLAG_INTERNAL_MARKER;
|
||||
result = startIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int unk_SetMoveToLastInLinkedSequence8(struct Move* moves, int index) {
|
||||
struct Move* move;
|
||||
struct Move linkedSequence[8][8];
|
||||
s32 startIndex;
|
||||
int result;
|
||||
int i;
|
||||
|
||||
result = index;
|
||||
|
||||
move = &moves[index];
|
||||
move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER;
|
||||
unk_GetLinkedSequences8(moves, linkedSequence);
|
||||
|
||||
startIndex = unk_FindMarkedMoveInLinkedSequences88(linkedSequence);
|
||||
if (startIndex >= 0 && startIndex < 7) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
const struct Move temp = linkedSequence[startIndex][i];
|
||||
linkedSequence[startIndex][i] = linkedSequence[startIndex + 1][i];
|
||||
linkedSequence[startIndex + 1][i] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
unk_LinkedSequencesToMoves8(moves, linkedSequence);
|
||||
for (startIndex = 0; startIndex < 8; startIndex++) {
|
||||
if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) {
|
||||
moves[startIndex].moveFlags &= ~MOVE_FLAG_INTERNAL_MARKER;
|
||||
result = startIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int unk_SetMoveToLastInLinkedSequence8_v2(struct Move* moves, int index) {
|
||||
struct Move* move;
|
||||
struct Move linkedSequence[8][8];
|
||||
s32 startIndex;
|
||||
int result;
|
||||
int i;
|
||||
|
||||
result = index;
|
||||
|
||||
move = &moves[index];
|
||||
move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER;
|
||||
unk_GetLinkedSequences8_v2(moves, linkedSequence);
|
||||
|
||||
startIndex = unk_FindMarkedMoveInLinkedSequences88_v2(linkedSequence);
|
||||
if (startIndex >= 0 && startIndex < 7) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
const struct Move temp = linkedSequence[startIndex][i];
|
||||
linkedSequence[startIndex][i] = linkedSequence[startIndex + 1][i];
|
||||
linkedSequence[startIndex + 1][i] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
unk_LinkedSequencesToMoves8_v2(moves, linkedSequence);
|
||||
for (startIndex = 0; startIndex < 8; startIndex++) {
|
||||
if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) {
|
||||
moves[startIndex].moveFlags &= ~MOVE_FLAG_INTERNAL_MARKER;
|
||||
result = startIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// the next 3 functions are the same, but for
|
||||
// 4, 8 and 8_v2
|
||||
int unk_SetMoveToFirstInLinkedSequence4(struct Move* moves, int index) {
|
||||
struct Move* move;
|
||||
struct Move linkedSequence[4][4];
|
||||
s32 startIndex, prevIndex;
|
||||
int result;
|
||||
int i;
|
||||
|
||||
result = index;
|
||||
|
||||
move = &moves[index];
|
||||
move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER;
|
||||
unk_GetLinkedSequences4(moves, linkedSequence);
|
||||
|
||||
startIndex = unk_FindMarkedMoveInLinkedSequences44(linkedSequence);
|
||||
prevIndex = startIndex - 1;
|
||||
if (prevIndex >= 0 && prevIndex < 3) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
const struct Move temp = linkedSequence[startIndex][i];
|
||||
linkedSequence[startIndex][i] = linkedSequence[prevIndex][i];
|
||||
linkedSequence[prevIndex][i] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
unk_LinkedSequencesToMoves4(moves, linkedSequence);
|
||||
for (startIndex = 0; startIndex < 4; startIndex++) {
|
||||
if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) {
|
||||
moves[startIndex].moveFlags &= ~MOVE_FLAG_INTERNAL_MARKER;
|
||||
result = startIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int unk_SetMoveToFirstInLinkedSequence8(struct Move* moves, int index) {
|
||||
struct Move* move;
|
||||
struct Move linkedSequence[8][8];
|
||||
s32 startIndex, prevIndex;
|
||||
int result;
|
||||
int i;
|
||||
|
||||
result = index;
|
||||
|
||||
move = &moves[index];
|
||||
move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER;
|
||||
unk_GetLinkedSequences8(moves, linkedSequence);
|
||||
|
||||
startIndex = unk_FindMarkedMoveInLinkedSequences88(linkedSequence);
|
||||
prevIndex = startIndex - 1;
|
||||
if (prevIndex >= 0 && prevIndex < 7) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
const struct Move temp = linkedSequence[startIndex][i];
|
||||
linkedSequence[startIndex][i] = linkedSequence[prevIndex][i];
|
||||
linkedSequence[prevIndex][i] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
unk_LinkedSequencesToMoves8(moves, linkedSequence);
|
||||
for (startIndex = 0; startIndex < 8; startIndex++) {
|
||||
if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) {
|
||||
moves[startIndex].moveFlags &= ~MOVE_FLAG_INTERNAL_MARKER;
|
||||
result = startIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int unk_SetMoveToFirstInLinkedSequence8_v2(struct Move* moves, int index) {
|
||||
struct Move* move;
|
||||
struct Move linkedSequence[8][8];
|
||||
s32 startIndex, prevIndex;
|
||||
int result;
|
||||
int i;
|
||||
|
||||
result = index;
|
||||
|
||||
move = &moves[index];
|
||||
move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER;
|
||||
unk_GetLinkedSequences8_v2(moves, linkedSequence);
|
||||
|
||||
startIndex = unk_FindMarkedMoveInLinkedSequences88_v2(linkedSequence);
|
||||
prevIndex = startIndex - 1;
|
||||
if (prevIndex >= 0 && prevIndex < 7) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
const struct Move temp = linkedSequence[startIndex][i];
|
||||
linkedSequence[startIndex][i] = linkedSequence[prevIndex][i];
|
||||
linkedSequence[prevIndex][i] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
unk_LinkedSequencesToMoves8_v2(moves, linkedSequence);
|
||||
for (startIndex = 0; startIndex < 8; startIndex++) {
|
||||
if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) {
|
||||
moves[startIndex].moveFlags &= ~MOVE_FLAG_INTERNAL_MARKER;
|
||||
result = startIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool8 IsMoveSet(int index, struct Move* struct_ptr)
|
||||
{
|
||||
@@ -360,12 +556,12 @@ void unk_FixLinkedMovesSetEnabled8_v2(struct Move* moves) {
|
||||
unk_LinkedSequencesToMoves8_v2(moves, linkedSequences);
|
||||
}
|
||||
|
||||
int unk_FindMoveFlag2Unk80InLinkedSequences44(struct Move moves[4][4]) {
|
||||
int unk_FindMarkedMoveInLinkedSequences44(struct Move moves[4][4]) {
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
if ((moves[i][j].moveFlags & MOVE_FLAG_EXISTS) && (moves[i][j].moveFlags & MOVE_FLAG_UNK80)) {
|
||||
if ((moves[i][j].moveFlags & MOVE_FLAG_EXISTS) && (moves[i][j].moveFlags & MOVE_FLAG_INTERNAL_MARKER)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -459,12 +655,12 @@ void unk_LinkedSequencesToMoves4(struct Move* moves, struct Move linkedSequences
|
||||
}
|
||||
|
||||
// the next two functions are exactly the same
|
||||
int unk_FindMoveFlag2Unk80InLinkedSequences88(struct Move linkedSequences[8][8]) {
|
||||
int unk_FindMarkedMoveInLinkedSequences88(struct Move linkedSequences[8][8]) {
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (j = 0; j < 8; j++) {
|
||||
if ((linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) && (linkedSequences[i][j].moveFlags & MOVE_FLAG_UNK80)) {
|
||||
if ((linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) && (linkedSequences[i][j].moveFlags & MOVE_FLAG_INTERNAL_MARKER)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -475,12 +671,12 @@ int unk_FindMoveFlag2Unk80InLinkedSequences88(struct Move linkedSequences[8][8])
|
||||
|
||||
// I expect the intent was to check for a different flag in this one
|
||||
// or the argument is a struct type that does hold the moves as a field
|
||||
int unk_FindMoveFlag2Unk80InLinkedSequences88_v2(struct Move linkedSequences[8][8]) {
|
||||
int unk_FindMarkedMoveInLinkedSequences88_v2(struct Move linkedSequences[8][8]) {
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (j = 0; j < 8; j++) {
|
||||
if ((linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) && (linkedSequences[i][j].moveFlags & MOVE_FLAG_UNK80)) {
|
||||
if ((linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) && (linkedSequences[i][j].moveFlags & MOVE_FLAG_INTERNAL_MARKER)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user