-
Notifications
You must be signed in to change notification settings - Fork 28
401_functions_ItemNames
; ItemNames.asm
; FN game.5267E0 ; copy_string_5267E0( ; ecx = pTarget ; edx = pSource ; )
mov eax,ecx ; eax = pTgtString push esi ; mov esi,eax ; esi = pTgtString
; J game.5267E5
; i = 0
; do
movzx ecx,word[edx] ; char = pSrcString[i]
mov word[esi],cx ; pTgtString[i] = char
movzx ecx,word[edx] ; char = pSrcString[i] // dunno why this is done again o_O
add esi,2 ;
add edx,2 ; i++
test cx,cx ;
jne game.5267E5 ; while (pSrcString[i] != \0) // null terminator
;
pop esi ;
ret ;
; END FN game.5267E0
; FN game.526700 ; append_string_526700( ; ecx = pTarget ; edx = pSource ; ) mov eax,ecx ; pStr = ecx cmp word[eax],0 ; if pStr[0] == 0 push esi mov esi,eax ; esi = pStr ; i = 0 ; j = 0 je game.526720 ; if pStr[i] == 0 ; // jump
jmp game.526710
lea ecx,[ecx] ; // noop? gets skipped too
; J game.526710 add esi,2 ; i++ cmp word[esi],0 ; if pStr[i] == 0 jne game.526710 ; lea esp,[esp] ; // noop
; J game.526720 ; do movzx ecx,word[edx] ; char = pSource[j] mov word[esi],cx ; pTarget[i] = char movzx ecx,word[edx] ; char = pSource[j] // ka... add esi,2 ; i++ add edx,2 ; j++ test cx,cx ; if pSource jne game.526720 ; while (pSource[j] != \0) pop esi ; ret ; ; END FN game.526700
; FN game.524A30 ; get_string_by_identifier ( ; short ecx = identifier ; ) ; push esi ; mov esi,ecx ; cmp si,4E20 ; jb game.524A61 ; if identifier >= 4E20 mov ecx,[8829D4] ; pStrTable = [8829D4] test ecx,ecx ; jne game.524A4B ; if not pStrTable
mov esi,2B46 ; identifier = 2B46 // probably something like 'UNKNOWN STRING??' jmp game.524A61 ; // jump to next table (directly to the one matching identifier)
mov edx,[8829C0] ; edx = [8829C0] lea eax,[esi-4E20] ; push eax ; // normalized identifier call game.524930 ; eax = get_string(ecx, edx, identifier - 4E20) test eax,eax jne game.524ABD ; if eax ; return eax
; J game.524A61 mov ecx,[8829D0] ; pStrTable = [8829D0] test ecx,ecx je game.524A88 ; cmp si,2710 ; jb game.524A88 ; if pStrTable && identifier >= 2710 lea edx,[esi-2710] ; push edx ; // normalized identifier mov edx,[8829BC] ; call game.524930 ; eax = get_string(ecx, edx, identifier - 2710) test eax,eax jne game.524ABD ; if eax ; return eax
; J game.524A88 mov ecx,[8829B4] ; pStrTable = [8829B4] test ecx,ecx jne game.524AB1 ; if pStrTable ; // jump and get string
; else // some fallback? not analyzed yet
push 246 ; call game.408090 ; push eax ; push game.6CC837 ; call game.408A60 ; add esp,C ; push FFFFFFFF ; call game.681E09 ;
; J game.524AB1 mov edx,[8829B8] push esi call game.524930 ; eax = get_string(ecx, edx, identifier)
; J game.524ABD pop esi ret
TODO .... ; END FN game.524A30
; FN game.524930 ; get_string(ecx,edx,identifier)
; FN game.5259C0 ; some_language_related_func
; FN game.48C060
; build_item_name ?
; FN game.4521C0 ; get_item_name_parts?
; FN game.48C060 ; get_full_item_name_with_description ?
; FN game.627EC0 ; ; example call: ; push 0 // IDX? [ebp+C] ; push pUnit (item) [ebp+8] ; call game.627EC0 ; ; // func used to find 'STEALTH' identifier (getRuneWordIdentifier?) ; get_magic_modifier_by_index(idx, pUnit); push ebp mov ebp,esp mov eax,[ebp+8] ; eax = pUnit test eax,eax je game.627EE2 ; if not pUnit ; return (short) 0 cmp [eax],4 ; jne game.627EE2 ; if pUnit.eType != TYPE_UNIT ; return (short) 0
mov eax,[eax+14] ; pUnitData = (pUnit).UnitData test eax,eax je game.627EE2 ; if not pUnitData ; return (short) 0 mov ecx,[ebp+C] ; ecx = IDX? mov ax,word[eax+ecx*2+38] ; // get magic modifier for IDX (0 = first modifier, 1 second, 2 third) pop ebp ret 8 ; return (short) modifier
xor ax,ax pop ebp ret 8 ; END FN game.627EC0
; FN game.6280A0 ; ; example call: ; push 4000000 (flag) ; push esi (pUnit) [ebp+8] ; mov ebx,eax ; call game.6280A0 ; item_has_item_flag_6280A0( ; pUnit item, ; flag ; ); push ebp ; mov ebp,esp ; mov eax,[ebp+8] ; test eax,eax ; je game.6280C0 ; if item == null ; return 0 cmp [eax],4 ; jne game.6280C0 ; if item.eType != TYPE_UNIT ; return 0
mov eax,[eax+14] ; test eax,eax ; je game.6280C0 ; if item.UnitData == null ; return 0
mov eax,[eax+18] ; itemFlags = (pUnitData).ItemFlags and eax,[ebp+C] ; itemFlags & flag pop ebp ; ret 10 ;
; J game.6280C0 xor eax,eax ; pop ebp ; ret 10 ; ; END FN game.6280A0