Hey man, really awesome table, especially the army pointers, really great job!
Just want to ask, is it possible to make a last selected battle pointer? Did tried making one with pointer scan, but it didn't go well. ;p
Edit: I managed to find what I was looking for, which was CCombat Manager and CCombat. Now I just need to implement that like Army Finder. Does anyone know how to do that? So far I managed to change adressess. Below is the code, I just want to change finding army into finding combat the same way.
Code: Select all
{$lua}
if syntaxcheck then return end
{$asm}
[ENABLE]
alloc(newmem,$512)
label(pSelectedArmy)
label(pSelectedUnit)
label(pUserIndexArmy)
label(SetArmyIndex)
label(UpdateArmyPointer)
label(UpdateUnitPointer)
newmem:
align 8
pSelectedArmy:
dq 0
pSelectedUnit:
dq 0
pUserIndexArmy:
dd $-1
align 8
SetArmyIndex:
// rdx has index
push r15
mov r15, [pUserIndexArmy]
cmp edx, r15d
pop r15
je @f
mov dword ptr [pUserIndexArmy], edx
mov qword ptr [pSelectedArmy], 0
mov qword ptr [pSelectedUnit], 0
call UpdateArmyPointer
@@:
ret
UpdateArmyPointer:
// rdx has index
push rax
push rbx
push rcx
push rdx
mov rax, qword ptr [pGameState]
cmp rax, 0
je @f
mov rax, qword ptr [rax+A0] // v51: UPDATED
cmp rax, 0
je @f
mov rax, qword ptr [rax] // v51: UPDATED
cmp rax, 0
je @f
mov rax, [rax+90] // CCombat Manager // v51: UPDATED
cmp rax, 0
je @f
mov rax, [rax+08] // CCombat // v51: UPDATED
cmp rax, 0
je @f
and rdx, 00FFFFFF
cmp edx, dword ptr [rax+3C] // check length of array
add edx, edx // double it
mov rbx, [rax+rdx*8+8]
mov [pSelectedArmy], rbx
cmp rbx, 0
je @f
xor rdx, rdx
mov edx, dword ptr [rbx+EC] // Unit ID
call UpdateUnitPointer
@@:
pop rdx
pop rcx
pop rbx
pop rax
ret