experimental/coach_goalie.s

Download file

Release 2026-11-04-r2 · SHA256 e81c08e8451d1a3ff36305c2c18653afccc53fa09d5bbe5e82a1b3ff1bc23bda · Click a line number for a direct link.

1| CPU coach chooses the strongest available keeper from its own unchanged roster.2| Hook native SetPlayer; D3 is the actual roster index passed into native loading.3 .ifndef WITH_TRANSFERS4 .equ WITH_TRANSFERS,05 .endif6 .text7 .globl _start8_start:9 movem.l %d0-%d2/%d4-%d7/%a0-%a6,-(%sp)10 cmpi.w #1,0xFFFFF07A11 bne.w done12 tst.w 0x34(%a3)13 bne.w done14 moveq #1,%d015 lea 0xFFFFC6CE,%a216 btst #6,0x62(%a3)17 beq.w team_ready18 moveq #2,%d019 adda.w #0x364,%a220team_ready:21 | Never override any team controlled by a human, including cooperative pads.22 lea 0xFFFFC328,%a023 moveq #3,%d124human_scan:25 cmp.w (%a0)+,%d026 beq.w done27 dbra %d1,human_scan28 tst.w 0x26(%a2)29 bmi.w done30 move.l 0x1E(%a2),%d031 cmpi.l #0x200,%d032 blo.w done33 cmpi.l #0x300000,%d034 bhs.w done35 jsr 0x9F4036 cmpi.w #1,%d037 blo.w done38 cmpi.w #4,%d039 bhi.w done40 move.w %d0,%d441 movea.l 0x1E(%a2),%a442 adda.w (%a4),%a443 moveq #0,%d644 moveq #-1,%d545 moveq #-1,%d746candidate:47    .if WITH_TRANSFERS48 jsr 0x23603449    .else50 movea.l %a4,%a151 adda.w (%a1),%a152 lea 8(%a1),%a453    .endif54 move.w %d6,%d055 add.w %d0,%d056 move.w 0x66(%a2,%d0.w),%d157 cmpi.w #-3,%d158 beq.w next59 cmpi.w #-4,%d160 beq.w next61 tst.w %d162 bgt.w next63 | 2*leg power +2*speed +3*defensive awareness +2*agility +four save traits.64 moveq #0,%d065 move.b 1(%a1),%d066 andi.w #15,%d067 add.w %d0,%d068 moveq #0,%d169 move.b 2(%a1),%d170 lsr.w #4,%d171 add.w %d1,%d172 add.w %d1,%d073 moveq #0,%d174 move.b 3(%a1),%d175 move.w %d1,%d276 andi.w #15,%d277 add.w %d2,%d278 add.w %d2,%d079 lsr.w #4,%d180 mulu.w #3,%d181 add.w %d1,%d082 moveq #0,%d183 move.b 6(%a1),%d184 move.w %d1,%d285 andi.w #15,%d286 add.w %d2,%d087 lsr.w #4,%d188 add.w %d1,%d089 moveq #0,%d190 move.b 7(%a1),%d191 move.w %d1,%d292 andi.w #15,%d293 add.w %d2,%d094 lsr.w #4,%d195 add.w %d1,%d096 cmp.w %d7,%d097 bgt.w select98 blt.w next99 cmp.w %d3,%d6100 bne.w next101select:102 move.w %d0,%d7103 move.w %d6,%d5104next:105 addq.w #1,%d6106 cmp.w %d4,%d6107 blo.w candidate108 tst.w %d5109 bmi.w done110 move.w %d5,%d3111 move.w %d5,0x26(%a2)112done:113 movem.l (%sp)+,%d0-%d2/%d4-%d7/%a0-%a6114 bclr #6,0x63(%a3)115 jmp 0x15AAA116