-
Notifications
You must be signed in to change notification settings - Fork 28
402_functions_Merc
; Merc/Monster/Unit stuff
; STRUCT unknown_struct_540C30 ;struct ; 0x00 __unknown_number_00 // some enum value (seen: 3) ; 0x04 __unknown04 ; 0x08 pUnit ; 0x0C GUID // or -1 ; 0x10 eType ; 0x14 __unknown14 ; 0x18 __unknown18 ; 0x1C __unused_1C ; 0x20 __unused_20 ; 0x24 pTimer ; 0x28 __unknown_28 (set to 0 in func game.540C30) ; 0x2C __unknown_2C
; FN game.580800 mov eax,[ecx+A8] push eax push edx call game.627460 ; // some func that jumps somewhere? :/ ret 8 push ebp mov ebp,esp mov eax,[ebp+C] push edi push eax mov eax,[ecx+A8] mov edi,edx mov edx,[ebp+8] push edx add eax,1 push eax push 3 mov edx,edi ; edx = edi = pUnit call game.5417D0 ; game_get_unknown_struct_5417D0() mov ecx,edi ; ecx = pUnit call game.5541B0 ; is_unit_???_5541B0(pUnit) test eax,eax ; jne game.580853 ; if eax != 0 return eax;
push esi mov esi,edi ; esi = pUnit call game.580610 ; unknown... test eax,eax pop esi je game.580853 ; if eax == 0 return eax;
call game.580500 ; calc_stamina_580500() call game.5806F0 ; calc_mana_5806F0()
; J game.580853 pop edi pop ebp ret 8 ; END FN game.580800
; FN game.580500 ; calc_stamina_580500( ; )
; FN game.5806F0 ; calc_mana_5806F0( ; edi = pUnit ; ) push ebp mov ebp,esp sub esp,8 test edi,edi je game.5807ED ; if pUnit = null return
push ebx push esi push 0 push 8 ; Mana push edi call game.625480 ; eax = getStatValue_625480() push edi mov [ebp-8],eax call game.625D60 ; statlist_func_625D60() push 55 mov ebx,eax ; ebx = ManaValue push edi mov [ebp-4],ebx xor esi,esi call game.639DF0 ; maybe_movement_func_639DF0() test eax,eax jne game.580792 ; if !... // jump to mana recovery
; // get the mana recovery bonus for
; // the current unit
mov eax,[edi+4] ; eax = (pUnit).eClass test eax,eax jl game.5807EB ; if (pUnit).eClass == -1 return
mov ecx,[744304] ; cmp eax,[ecx+BC8] ; jge game.5807EB ; if (pUnit).eClass >= global.CharacterCount return
imul eax,eax,C4 ; C4 = length of character specific data (D2CharacterStats) add eax,[ecx+BC4] ; charStats = global.Characters[(pUnit).eClass] test eax,eax je game.5807EB ; if charStats == null return
movzx ecx,byte[eax+3A] ; ecx = charStats.ManaRegen imul ecx,ecx,19 ; ecx = ecx * 0x19 (25) test ecx,ecx ; jne game.580767 ; if ecx == 0 mov ecx,1D4C ; ecx = 1D4C (7500)
; J game.580767 mov eax,ebx ; eax = ManaValue cdq ; // some calculation for mana idiv ecx mov esi,eax cmp esi,1 ; jge game.580778 ; if esi < 1 mov esi,1 ; esi = 1 ; ; // probably until here the base regen ; // for the class is in esi? ;
push 64 push 0 push 1B ; ManaRecoveryBonus push edi call game.625480 ; eax = getStatValue_625480() mov edx,eax ; add edx,64 ; edx = manaRecoveryBonus += 0x64 mov ecx,esi ; ecx = val from previous calculation call game.483360 ; mov esi,eax
; J game.580792 push 0 push 1A ; ManaRecovery push edi call game.625480 ; eax = getStatValue_625480() add esi,eax ; esi += manaRecoveryValue cmp ebx,[ebp-8] ; jg game.5807C5 ; if manaValue > [ebp-8] // jump
test esi,esi ; jle game.5807C5 ; if esi <= 0 // jump
push 6A ; push edi call game.6256B0 mov ebx,eax test ebx,ebx je game.5807C2 push ebx push edi call game.6277E0 push ebx call game.626CD0 mov ebx,[ebp-4]
; J game.5807C5 mov ecx,[ebp-8] mov eax,ebx sub eax,ecx cmp esi,eax jle game.5807D2 mov esi,eax mov eax,ecx neg eax cmp esi,eax jge game.5807DC mov esi,eax test esi,esi je game.5807EB push 0 push esi push 8 push edi call game.6272B0
; J game.5807EB pop esi pop ebx
; J game.5807ED mov esp,ebp pop ebp ret ; END FN game.5806F0
; FN game.6256B0 push ebp mov ebp,esp mov eax,[ebp+8] ; pUnit = [ebp+8] mov eax,[eax+5C] ; statListNode = (pUnit).StatListNode test eax,eax jne game.6256C3 ; if statListNode == null return 0 ; J game.6256BD xor eax,eax pop ebp ret 8
; J game.6256C3 test [eax+10],80000000 je game.6256BD ; if statListNode.ListFlags 80000000 not set return 0
mov ecx,[ebp+C] push ecx ; push eax ; call game.625650 ; pop ebp ret 8 ; END FN game.6256B0
; FN game.625650 ; get_statlist_ptr_by_state_and_statlistex ( ; ; ) push ebp mov ebp,esp mov ecx,[ebp+8] ; ecx = pStatListNode (statlistex) test ecx,ecx jne game.625660 ; if ecx == null return 0 ; J game.62565A xor eax,eax pop ebp ret 8
; J game.625660 mov edx,[ebp+C] ; edx = state (seen: 6A (106)) test edx,edx je game.62565A ; if edx == null return 0
push esi mov esi,[ecx+10] ; esi = (pStatListNode).ListFlags and esi,80000000
je game.62568C ; if flag 80000000 not set // jump
mov eax,[ecx+3C] ; pMyLastList = (pStatListNode).pMyLastList test eax,eax ; je game.62568C ; if pMyLastList == 0 // jump
lea ebx,[ebx] ; // noop?
; J game.625680 ; // loop through the stat lists until find one ; // that matches the state ; cmp [eax+14],edx ; je game.6256A5 ; if (pMyLastList).State == state // return ptr to that list
mov eax,[eax+2C] ; eax = (pMyLastList).PreviousList test eax,eax ; jne game.625680 ; if prevList // jump back up
; // no list found via (pStatListNode).pMyLastList
test esi,esi je game.6256A3 ; if (pStatListNode).ListFlags == 0 // return 0
mov eax,[ecx+40] ; pMyStats = (pStatListNode).pMyStats test eax,eax ; je game.6256A3 ; if ! pMyStats // return 0
; J game.625697 ; // loop through the stat lists until find one ; // that matches the state ; cmp [eax+14],edx je game.6256A3 ; if (pMyStats).State == state // return ptr to that list
mov eax,[eax+2C] ; eax = (pMyStats).PreviousList test eax,eax jne game.625697 ; if prevList // jump back up
; // no list found via (pStatListNode).pMyStats
xor eax, eax pop esi pop ebp ret 8 ; END FN game.625650
; FN game.483360 push ebp mov ebp,esp push esi mov esi,[ebp+8] test esi,esi push edi mov edi,edx jne game.483376
pop edi xor eax,eax pop esi pop ebp ret 4
; J game.483376 cmp ecx,100000 jle game.483395
mov eax,ecx sar eax,4 cmp esi,eax mov eax,ecx jg game.4833A6
cdq idiv esi imul eax,edi pop edi pop esi pop ebp ret 4
; J game.483395 cmp edi,10000 jle game.4833CC
sar edx,4 cmp esi,edx jle game.4833BE
mov eax,ecx imul edi mov ecx,eax mov edi,edx mov eax,esi cdq push edx push eax push edi push ecx call game.684240 pop edi pop esi pop ebp ret 4
; J game.4833BE mov eax,edi cdq idiv esi pop edi pop esi imul eax,ecx pop ebp ret 4
; J game.4833CC mov eax,ecx imul eax,edi cdq pop edi idiv esi pop esi pop ebp ret 4 ; END FN game.483360
; FN game.639DF0 ; maybe_movement_func_639DF0 ; probably calculates some movement related things? ; velocity? direction? etc.. push ebp mov ebp,esp mov ecx,[ebp+8] ; pUnit = [ebp+8] test ecx,ecx ; je game.639E2A ; if pUnit == null return 0 mov eax,[ecx] test eax,eax jl game.639E2A ; if (pUnit).eType < 0 return 0 cmp eax,1 jle game.639E0A ; if (pUnit).eType in (TYPE_PLAYER, TYPE_MONSTER) // jump cmp eax,3 jne game.639E2A ; if (pUnit).eType != TYPE_MISSILE return 0
; J game.639E0A ; // for: TYPE_PLAYER, TYPE_MONSTER, TYPE_MISSILE mov eax,[ebp+C] ; test eax,eax jl game.639E2A ; if val?? < 0 return 0 mov edx,[744304] cmp eax,[edx+C4] jge game.649E2A ; if val >= XXX (some max value? 185 in this case) return 0
push eax push ecx call game.625B70 ; ret statlist_func_625B70() pop ebp ret 8
; J game.639E2A xor eax,eax pop ebp ret 8 ; END FN game.639DF0
; FN game.625B70 ; statlist_func_625B70( ; ) push ebp mov ebp,esp mov eax,[ebp+8] ; pUnit = [ebp+8] test eax,eax jne game.625B80 ; if pUnit == null return 0
; J game.625B7A xor eax,eax pop ebp ret 8
; J game.625B80 mov eax,[eax+5C] ; statListNode = (pUnit).StatListNode test eax,eax je game.625B7A ; if statListNode == null return 0
test [eax+10],80000000 ; je game.625B7A ; if (statListNode).ListFlags == 80000000 return 0
mov ecx,[ebp+C] ; ecx = (statListNode).OwnerGUID mov eax,[eax+58] ; eax = (StatListNode).StatFlags mov edx,ecx ; edx = ecx sar edx,5 ; edx = XXXXX(+ 3 high owner guid bits) // index in StatFlags array mov eax,[eax+edx4] ; eax = (StatListNode).StatFlags[edx] and ecx,1F ; ecx = 000(+ 5 low owner guid bits) and eax,[ecx4+6CE268] ; eax = eax & GLOBAL_ARRAY[(5lowbits of OwnerGUID =idx?)*4 (obj len)] pop ebp ret 8 ; END FN game.625B70
; FN game.625D60 ; statlist_func_625D60( ; ) push ebp mov ebp,esp mov eax,[ebp+8] ; pUnit = [ebp+8] test eax,eax jne game.625D6E ; if pUnit == null return 0 pop ebp-8 ; ret 4 ;
; J game.625D6E push ebx mov ebx,[eax+5C] ; statListNode = (pUnit).StatListNode test ebx,ebx je game.625D91 ; if statListNode == null return 0
mov eax,[744304] ; cmp [eax+BD4],9 ; jle game.625D91 ; if .... return 0
mov eax,[eax+BCC] add eax,B64 jne game.625D98 ; if ... ... // jump
; J game.625D91 xor eax,eax pop ebx pop ebp ret 4
; J game.625D98 push edi push eax mov edi,90000 call game.624F60 ; eax = statlist_func_625F60() pop edi pop ebx pop ebp ret 4 ; END FN game.625D60
; FN game.5417D0 ; game_get_unknown_struct_5417D0( ; ... ; ): unknown_struct_540C30 push ebp mov ebp,esp mov eax,edx mov edx,ecx mov ecx,[ebp+14] push ecx mov ecx,[ebp+10] push ecx mov ecx,[ebp+8] push 0 push eax mov eax,[ebp+C] call game.5416B0 pop ebp ret 10 ; END FN game.5417D0
; FN game.580610 ; maybe some func to calc hp? ; 4A = health regen ; 6 = hitpoints push ebx push 0 push 4A ; HealthRegen push esi call game.625480 ; eax = getStatValue_625480() mov ebx,eax test ebx,ebx je game.5806DD ; if ebx == 0 return 1
push edi push 0 push 6 ; Hitpoints push esi call game.625480 ; eax = getStatValue_625480() push esi mov edi,eax call game.625D10 add edi,ebx cmp edi,eax jle game.58065B .. .. // TODO .. ..
; J game.5806DD mov eax,1 pop ebx ret ; END FN game.580610
; FN game.625480 ; getStatValue_625480( ; ) push ebp mov ebp,esp mov eax,[ebp+8] ; eax = pUnit (some unit in ebp+8, player in this case) test eax,eax ; jne game.62548E ; if pUnit == null return 0 pop ebp ; ret C ;
; J game.62548E push ebx mov ebx,[eax+5C] ; statListNode = (pUnit).StatListNode test ebx,ebx ; jne game.62549D ; if statListNode == null return 0 xor eax,eax pop eax pop ebp ret C
; J game.62549D push edi ; mov edi,[ebp+C] ; edi = (statListNode).OwnerGUID test edi,edi jl game.6254C3 mov ecx,[744304] cmp edi,[ecx+BD4] jge game.6254C3 mov eax,edi imul eax,eax,144 add eax,[ecx+BCC] jne game.6254CB pop edi xor eax,eax pop ebx pop ebp ret C
; J game.6254CB push eax movzx eax,[ebp+10] shl edi,10 add edi,eax call game.624F60 ; eax = statlist_func_625F60() pop edi pop ebx pop ebp ret C
push ebp mov ebp,esp pop ebp jmp game.625350 ; jmp to other function o_O ; END FN game.625480
; FN game.624F60 ; statlist_func_625F60( ; D2ItemStatCost stat ; ebx: D2StatListEx pStatListNode ; ) push ebp mov ebp,esp push ecx mov eax,[ebx+10] ; eax = statList.ListFlags and eax,80000000 push esi mov [ebp-4],eax lea esi,[ebx+48] ; esi = statList.fullStats jne game.624F78 ; if !esi lea esi,[ebx+24] ; esi = statList.BaseStats mov eax,esi call game.624B90 ; calculation_game_624B90() test eax,eax jl game.624F8C ; // if eax < 0 // jump
mov ecx,[esi] lea eax,[ecx+eax*8] test eax,eax jne game.624F95
; J game.624F8C xor eax,eax pop esi mov esp,ebp pop ebp ret 4 ; return 0
; J game.624F95 mov esi,[ebp+8] ; stat // D2ItemStatCost test esi,esi mov eax,[eax+4] je game.624FD3 mov dl,byte[6CE270] test byte[esi+5],dl je game.624FD3 cmp [ebp-4],0 je game.624FD3 mov ecx,[ebx+44] ; pOwner = statList.pUnit // owner test ecx,ecx ; je game.624FD3 ; if !pOwner return
cmp [ecx],0 ; if pOwner.eType == TYPE_PLAYER // jump je game.624FC5
test ecx,ecx je game.624FD3 ; if !pOwner return cmp [ecx],1 jne game.624FD3 ; if pOwner.eType != TYPE_MONSTER // jump
; J game.624FC5 mov edx,[esi+2C] ; cmp eax,edx ; jge game.624FD3 ;
mov cl,[esi+18] shl edx,cl mov eax,edx
; J game.624FD3 pop esi mov esp,ebp pop ebp ret 4 ; END FN game.624F60
; FN game.624B90 (dunno... some calculation) ; calculation_game_624B90( ; eax = pos of D2StatArray ; ) push ebx mov ebx,[eax] ; ebx = address of Data push esi movsx esi,[eax+4] ; eax+4 = length of array xor ecx,ecx test esi,esi jle game.624BBF mov edi,edi mov eax,esi sub eax,ecx cdq sub eax,edx sar eax,1 add eax,ecx mov edx,[ebx+eax*8] cmp edi,edx jle game.624BB7 lea ecx,[eax+1] jmp game.624BBB jge game.624BC2 mov esi,eax cmp ecx,esi jl game.624BA0 or eax,FFFFFFFF pop esi pop ebx ret ; END FN game.624B90
; FN game.5541B0 ; determines if something needs to be done with unit ; // mode, type and flag C6 ; // maybe if unit is ignored for something ? ; // dead units return 1 ; ; is_unit_???_5541B0 ( ; ecx = pUnit ; ) push ebp mov ebp,esp push ecx, test ecx,ecx je game.5541EE ; if pUnit = null // jump
movz eax,byte[ecx+C6] ; FLAG_C6 = (pUnit).UnitFlag_C6 and eax,1 ; jne game.5541EE ; if FLAG_C6 set // jump
mov eax,[ecx] ; sub eax,0 ; je game.5541DC ; if (pUnit).eType == TYPE_PLAYER // jump
sub eax,1 jne game.5541EE ; if (pUnit).eType != TYPE_MONSTER // return 1
mov ecx,[ecx+10] test ecx,ecx je game.5541EE ; if (pUnit).eMode == MODE_DEATH // return 1
cmp ecx,C ; // is monster mode C also KICK? hmm! jmp game.5541E6 ; if (pUnit).eMode == MODE_KICK // return 1
; J game.5541DC mov ecx,[ecx+10] test ecx,ecx je game.5541EE ; if (pUnit).eMode == MODE_DEATH // return 1 cmp ecx,11 ; if (pUnit).eMode == MODE_DEAD // return 1
; J game.5541E6 je game.5541EE xor eax,eax ; return 0 mov esp,ebp pop ebp ret
; J game.5541EE mov eax,1 ; return 1 mov esp,ebp pop ebp ret ; END FN game.5541B0
; FN game.5416B0 ; ; ; returns unknown_struct_540C30 ; push ebp mov ebp,esp push ebx push esi mov ebx,ecx cmp ebx,F push edi mov esi,eax mov edi,edx jge game.5417BD cmp esi,FFFFFFFF jne game.5416E3 mov eax,[ebp+14] mov ecx,[ebp+10] push eax mov eax,[ebp+8] push ecx push 0 call game.5415E0 pop edi pop esi pop ebx pop ebp ret 10
; J game.5416E3 mov eax,[edi+A8] cmp esi,eax jg game.5416F0 lea esi,[eax+1] mov eax,[ebp+8] ; pUnit (owner? player?) = [ebp+8] test eax,eax je game.54171A ; if pUnit == null // jump
cmp [eax],1 ; jne game.54171A ; if pUnit.eType == MONSTER // jump
cmp ebx,2 ; jne game.54171A ; if ebx != 2 // jump
push 36 push eax call game.639DF0 ; maybe_movement_func_639DF0() test eax,eax ; je game.541717 mov ecx,[ebp+8] xor edx,edx call game.5544B0 mov eax,[ebp+8]
; J game.54171A mov ecx,edi call game.540DF0 ; cmp esi,FFFFFFFF ; mov edx,[ebp+10] mov ecx,[ebp+14] mov [eax+14],edx mov edx,[ebp+C] mov byte[eax],bl mov [eax+4],esi mov[eax+18],ecx mov[eax+2C],edx jne game.541741 xor ecx,ecx jmp game.54176A
; J game.541741 mov ecx,[eax+10] mov edx,[ecx4+6E0B9C] shl edx,6 and esi,8000003F jns game.54175B dec esi or esi,FFFFFFC0 inc esi mov ecx,[edi+B8] add edx,esi lea ecx,[ecx+edx4+504] mov [eax+1C],0 mov edx,[ecx] test edx,edx mov [eax+20],edx je game.54177D ; mov [edx+1C],eax ; mov [ecx],eax ; mov edx,[eax+4] cmp edx,FFFFFFFF mov ecx,[eax+10] mov ecx,[ecx4+6E0B9C] mov edi,[edi+B8] jne game.5417A0 lea ecx,[edi+ecx4+A04] jmp game.5417B6 shl edx,6 and esi,8000003F jns game.5417B0 dec edx or edx,FFFFFFC0 inc edx add ecx,edx lea ecx[edi+ecx*4+4] cmp [ecx],0 jne game.5417BD mov [ecx],eax pop edi pop esi pop ebx pop ebp ret 10 ; END FN game.5416B0
; FN game.540DF0 push esi push edi mov edi,eax ; pUnit = eax mov eax,[ecx+B8] ; push ecx call game.540C30 ; // TODO: go through this func mov esi,eax ; // to find out what is esi ; // pointer to unknown_struct_540C30 mov ecx,edi mov [esi+8,edi] call game.553980 ; pTimer = get_unit_timer_553980(pUnit) test eax,eax mov [esi+24],eax je game.540E16 ;
mov [eax+28],esi ; mov edx,esi ; pTimerNext = esi mov ecx,edi ; mov [esi+28],0 ; call game.553970 ; set_unit_timer_553970(pUnit, pTimerNext) test edi,edi mov eax,6 je game.540E31 ; if pUnit != null mov eax,[edi] ; test edi,edi ; mov [esi+10],eax ; [esi+10] = (pUnit).eType jne game.540E49 ; if pUnit != null // jump
or edi,FFFFFFFF and word[esi+2],FFFD mov [esi+C],edi pop edi mov eax,esi pop esi ret
; J game.540E49 mov edi,[edi+C] ; and word[esi+2],FFFD ; mov [esi+C],edi ; [esi+C] = (pUnit).GUID pop edi mov eax,esi ; return esi (pointer to unknown_struct_540C30) pop esi ret
; FN game.553970 ; set_unit_timer_553970( ; ecx = pUnit ; edx = pTimer ; ) test ecx,ecx ; if pUnit == null je game.55397A ; return mov [ecx+DC],edx ; (pUnit).pTimer = pTimer ret ; END FN game.553970
; FN game.553980 ; get_unit_timer_553980( ; ecx = pUnit ; ) test ecx,ecx ; if pUnit == null jne game.554987 ; return 0 xor eax,eax ; return (pUnit).pTimer ret mov eax,[ecx+DC] ret ; END FN game.553980
; START ------------------------ ; FN game.493240 ; game_493240 ( ; ecx (pUnit) // player? ; edx (seen: 7) // pet type? ; arg1 (seen: ... maybe not) ; arg2 (seen: 0) ; ) push ebp mov ebp,esp sub esp,104 test edx,edx push esi mov [ebp-4],edx ; jl game.49326E ; if edx < 0 // return 0
mov eax,[744304] ; eax = pGlobalData cmp edx[eax+BF0] ; jge game.49326E ; if edx > pGlobalData.unknownCount1 // return 0
mov esi,edx ; imul esi,esi,E0 ; add esi,[eax+BE8] ; esi = pGlobalData.unknownList1[edx] jne game.493277 ; if esi // jump ??
; J game.49326E xor eax,eax pop esi mov esp,ebp pop ebp ret 8
; J game.493277 mov eax,[ebp+C] ; eax = somearg test eax,eax ; push edi ; je game.49328B ; if eax == 0 // jump
movzx edi,byte[esi+4] ; // not analyzed and edi,[6CE27C] ; // not analyzed mov [eax],edi ; // not analyzed
; J game.49328B push 0 ; call game.478F20 ; cmp eax,FFFFFFFF ; mov ecx,[ebp+8] ; mov [ecx],eax ; jne game.4932A6 ; pop edi xor eax,eax pop esi mov esp,ebp pop ebp ret 8 mov ecx,eax call game.479120 mov [ebp+C],eax xor eax,eax lea ecx,[eax+1] lea edi,[esi+2F] lea edx,[esi+B2] push ebx nop movzx ebx,short[edx] cmp [ebp+C],ebx jne game.4932CC cmp [edi],al jne game.4932DC add ecx,1 add edx,2 add edi,20 cmp ecx,5 jl game.4932C0 jmp game.4932DE mov eax,ecx mov ecx,[ebp-4] mov edx,[7BEEAC] lea edi,[eax+ecx4] add edi,ecx cmp [edx+edi4],0 lea ebx,[edx+edi4] jne game.493327 shl eax,5 lea eax,[eax+esi+F] push eax lea ecx,[ebp-104] push game.6D9E50 push ecx call game.6823FD mov edx,[7BEEAC] add esp,C lea ecx,[ebp-104] lea ebx,[edx+edi4] call game.4520C0 mov [ebx],eax mov eax,[ebx] pop ebx pop edi pop esi mov esp,ebp pop ebp ret 8 ; END --------------------------
; START ------------------------ ; FN game.478F20 ; game_478F20 ( ; ecx pUnit ; edx someIdentifier (seen: 2,3,4,D,E,F,10,7) ; ) push ebp mov ebp,esp test ecx,ecx jne game.478F2E ; if ecx == null // return -1
or eax,FFFFFFFF pop ebp ret 4
mov eax,[7BB5BC] ; eax = GLOBAL_7BB5BC test eax,eax
mov ecx,[ecx+C] ; ecx = ecx.GUID push esi je game.478F5A ; if not GLOBAL_7BB5BC // return -1
mov esi,[ebp+8] mov edi,edi
; J game.478F40 cmp [eax+4],edx jne game.478F53 ; if eax.unknown_04 != someIdentifier // jump
cmp [eax+C],ecx ; jne game.478F53 ; if eax.unknown_0C == ecx.GUID // jump
test esi,esi jne game.478F62 ; if esi != 0 // jump
cmp [eax+20],esi ; je game.478F62 ; if eax.unknown_20 == 0 // jump
; J game.478F53 mov eax,[eax+30] ; eax = eax.unknown_30 test eax,eax jne game.478F40
; J game.478F5A or eax,FFFFFFFF pop esi pop ebp ret 4
; J game.478F62 mov eax,[eax+8] ; eax = eax.unknown_08 // guid of unit pop esi pop ebp ret 4 ; END --------------------------
; FN game.463990 ; game_463990 ( ; int ecx GUID ; int edx UnitType ; ) push edx ; mov eax,ecx ; shl edx,9 ; pUnitList = edx << 9 and eax,7F ; idxOrType = GUID & 01111111 // cleaned GUID? add edx,game.7A5E70 ; pUnitList += 7A5E70 call game.463940 ; ret ; return get_unit_463940( ; pUnitList, ; idxOrType, ; GUID, ; esp (= edx) ; ) ; END FN game.463990
; FN game.463940 ; get_unit_463940( ; edx = unitList ; eax = idxOrType (not sure if just index or type. somehow calculated from GUID o_O) ; ecx = GUID ; esp = {int, int, eType, ...} ??? ; arg1 unitType ; ) push ebp ; mov ebp,esp ; mov eax,[edx+eax4] ; pUnit = unitList[idxOrType] test eax,eax ; if !pUnit je game.46395F ; return null
lea ebx[ebx+00000000] ; cmp [eax+0C],ecx ; if (pUnit).GUID == GUID je game.463965 ; ecx = (pUnit).eType ; if ecx == unitType ; return pUnit
mov eax,[eax+000000e4] ; test eax,eax ; jne game.463950 ;
; J game.46395F xor eax,eax ; // return null ; J game.463961 pop ebp ; ret 0004 ; // return pUnit
; J game.463965 mov ecx,[eax] ; // ecx = (pUnit).eType cmp ecx,[ebp+08] ; // if ecx == unitType je game.463961 ; // return pUnit
push 5A ; call game.408090 ; push eax ; push game.6CC837 ; call game.408A60 ; add esp,0C ; push FFFFFFFF ; call game.681E09 ; ; END FN game.463940
; FN game.45FA40 ; // maybe render_unit_window or something? ; get_unit_name???_45FA40( ; ecx = pUnit ; esp = ??? ; ) push ebp ; mov ebp,esp ; sub esp,8 ; esp -= 8 push edi ; mov [ebp-8],ecx ; setInt(esp, pUnit) call game.464770 ; pParticleStream = get_unit_particle_stream_464770(pUnit) mov edi,eax ; test edi,edi ; je game.45FB10 ; if pParticleStream == null ; return mov eax,[edi+4] ; cmp eax,[edi] ; jle game.45FA7F ; if pParticleStream.__unknown04 <= pParticleStream.__unknown00 ; // jump push 1525 call game.408090 push eax push game.6CC837 call game.408A60 add esp.C push FFFFFFFF call game.681E09
; J game.45FA7F push ebx ; xor ebx,ebx ; ebx = 0 test eax,eax ; push esi ; jle game.45FAEA ; if pParticleStream.__unknown04 <= 0 ; // jump
jmp game.45FA90 lea esp,[esp]
; J game.45FA90 ; LOOP to fill some string mov edx,[7A5230] mov esi,edx imul esi,ebx add esi,[edi+C] lea eax,[ebp-4] push eax mov ecx,esi call game.52B920 test eax,eax je game.45FB0E mov al,byte [esi] cmp al,AF jae game.45FB15 movzx eax,al lea eax,[eax+eax2] mov ecx,[eax4+7114D4] cmp ecx,FFFFFFFF lea eax,[eax*4+7114D0] je game.45FAD4 movzx edx,word [ebp-4] cmp edx,ecx jne game.45FB1F mov eax,[eax+8] test eax,eax je game.45FB29 mov ecx,[ebp-8] mov edx,esi call eax add ebx,1 cmp ebx,[edi+4] jl game.45FA90
; J game.45FAEA mov eax,[edi+4] ; eax = pParticleStream.__unknown04 test eax,eax ; je game.45FB07 ; if pParticleStream.__unknown04 == 0 ; return 0 // (eax = 0) imul eax,[7A5230] ; push eax mov eax,[edi+C] ; push 0 push eax call game.681EF0 add esp,C
; J game.45FB07 mov [edi+4],0 pop esi pop ebx pop edi mov esp,ebp pop ebp ret
push 1531 jmp game.45FA65 push 1534 jmp game.45FA65 push 1536 jmp game.45FA65 ; END FN game.45FA40
; FN game.464770 ; get_unit_particle_stream_464770( ; ecx = pUnit ; ) test ecx,ecx jne game.464793 ; if pUnit ; return (pUnit).pParticleStream
push 8A5 ; call game.408090 ; push eax push game.6CC837 ; call game.408A60 ; add esp,C ; push FFFFFFFF ; call game.681E09 ;
; J game.464793 mov eax,[ecx+D8] ; ret ; ; END FN game.464770
; FN Game.BNGatewayAccess::CurGateway+352AD
edx = unitLists
eax = eClass
ecx = GUID
push ebp ; mov ebp,esp ; mov eax,[edx+eax*4] ; test eax,eax ; je +352CF ; lea ebx[ebx+00000000] ; cmp [eax+0C],ecx ; je +352D5 ; mov eax,[eax+000000e4] ; test eax,eax ; jne +352C0 ; xor eax,eax ; pop ebp ; ret 0004 ; mov ecx,[eax] ; cmp ecx,[ebp+08] ;