12
« on: 2018-02-07 01:14:13 »
I'm not really sure if I need to preserve edi,ebx,esi here. Didn't check.
Still this nifty replacement I've made for the Enemy Skill mask ensures that, from now on, the enemy skills MISSING from the total are what count, not the ones that are PRESENT. See, originally, if one of your characters had a full enemy skill set, it would then stop all other enemy skills from learning all abilities. And if one of the materias had, say, Frog Song, then none of the others without it would gain it either.
Procedure CreateEnemySkillMask5CFB93; stdcall;
Begin
asm
push ebx
push esi
push edi
xor edi,edi
mov esi,$00FFFFFF
mov ecx,[esp+$10] //Starting address of character materia
@START:
xor ebx,ebx
@LABEL1:
cmp ebx,8
je @Label5
test edi,edi
jne @Label3
mov eax,[ecx+ebx*4+$40] // Retrieve Materia ID and AP in Weapon slot.
jmp @Label4
@Label3:
mov eax,[ecx+ebx*4+$60] // Retrieve Materia ID and AP in Armour slot.
@Label4:
cmp al,$FF //If no materia in slot, then jump to next slot.
je @Label2
xor edx,edx
mov dl,al
imul edx,edx,$14
mov dl,[edx+$DBDF6D] //retrieve formula ID for materia
and dl,$F
cmp dl,7 //materia is Enemy Skill
jne @Label2
shr eax,8
and esi,eax
or esi,$80000000
@LABEL2:
inc ebx
jmp @Label1
@LABEL5:
test edi,edi
jne @End
inc edi
jmp @START
@END:
mov eax,esi
pop edi
pop esi
pop ebx
end;
End;
Not rigorously tested yet, but seems to work.