Bapes
Forever Rain
- Joined
- Mar 9, 2004
- Messages
- 922
- Reaction score
- 0
- Location
- A road, with a house on it.
- Website
- frltd.blog125.fc2.com
Here its already public.
7Hump3Rcomments by drakken)
Damned666:
7Hump3Rcomments by drakken)
Code:
:1000178B pushad ; Preserve registers
:1000178C cmp byte ptr [100032C8], 01 ; Is multicommand on?
:10001793 jne 1000181C ; If not jump to the end
:10001799 mov dword ptr [10003820], ecx ; Store command parameters pointer
:1000179F mov byte ptr [10003824], dl ; Store command type
:100017A5 mov eax, 0068F3E0 ; First selected unit
:100017AA mov eax, dword ptr [eax] ; Get first selection unit pointer
:100017AC mov dword ptr [1000381A], eax ; Store first selection
:100017B1 mov bl, byte ptr [eax+64] ; Get unit type
:100017B4 mov byte ptr [1000381E], bl ; Store Unit type
:100017BA mov bl, byte ptr [eax+4C] ; Get unit owner
:100017BD mov byte ptr [1000381F], bl ; Store unit owner
:100017C3 mov ecx, 005BC6A8 ; unit list pointer
:100017C8 mov dword ptr [10003390], 00000000 ; counter??
:100017D2 jmp 10001810 ; jump to unit list cycle
* Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:10001813(C)
|
:100017D4 push ecx ; Store unit params pointer
:100017D5 mov bl, byte ptr [ecx+64] ; Get unit type
:100017D8 cmp byte ptr [1000381E], bl ; check unit type
:100017DE jne 1000180C ; jump if not the same type
:100017E0 mov bl, byte ptr [ecx+4C] ; get unit owner
:100017E3 cmp byte ptr [1000381F], bl ; check unit owner
:100017E9 jne 1000180C ; jump if not the same owner
:100017EB push ecx ; Store unit params again
:100017EC push 00000001 ; number of units to select
:100017EE call 10001085 ; local function to set selection
:100017F3 mov ecx, dword ptr [10003820] ; restore unit params pointer
:100017F9 movzx edx, byte ptr [10003824] ; restore command type
:10001800 call dword ptr [10003008] ; call command function
:10001806 inc dword ptr [10003390] ; counter??
* Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
|:100017DE(C), :100017E9(C)
|
:1000180C pop ecx
:1000180D mov ecx, dword ptr [ecx+04] ; Get pointer to previous unit
* Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:100017D2(U)
|
:10001810 cmp ecx, 00000000 ; Is pointer null? Are we done?
:10001813 jne 100017D4 ; If not start over
:10001815 popad ; else restore registers
:10001816 jmp dword ptr [10003379] ; jump back to sc
* Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:10001793(C)
|
:1000181C call dword ptr [10003008] ; Call original command
:10001822 popad ; restore registers
:10001823 jmp dword ptr [10003379] ; jump back to sc
Code:
MultiCmd proc
pushad ; Preserve registers
cmp MultiCommand, 01 ; Is multicommand on?
jne MA_END ; If not jump to end
mov eax, PlrNumOffset
mov al, byte ptr [eax] ; Get your player number
mov PlrNum, al ; Store Player number
mov ParamsPtr, ecx ; Store command parameters pointer
mov CommandByte, dl ; Store command type
mov eax, FirstSelection
mov eax, dword ptr [eax] ; Get first selection unit pointer
mov cl, byte ptr [eax+064h] ; Get unit type
mov UnitType, cl ; Store Unit type
mov ebp, UnitStructStart ; Unit list pointer
mov ebp, dword ptr [ebp] ; Get unit struct start
MA1:
mov al, byte ptr [ebp+04Ch] ; Get unit owner
cmp al, PlrNum ; Check unit owner
jne MA2 ; jump if not the same owner
mov al, byte ptr [ebp+064h] ; Get unit type
cmp al, UnitType ; Check unit type
jne MA2 ; jump if not the same type
xor ecx, ecx
mov cl, 01 ; Number of units to select
mov CurrentUnit, ebp
lea edx, CurrentUnit ; unit to select
call dword ptr [SetSelection] ; Set Selection function
sub esp, 00000008h
mov ecx, ParamsPtr ; set command parameters pointer
movzx edx, CommandByte ; set command type
call dword ptr [IssueCommand] ; call command function
MA2:
mov ebp, dword ptr [ebp] ; Get pointer to next unit
test ebp, ebp ; Is pointer null? Are we done?
jnz MA1 ; If not start over
mov MultiCommand, 00 ; Turn off MultiCommand
MA_END:
popad ; restore registers
add esp, 0000000Ch ; fix stack pointer
ret 0010h ; return to sc
MultiCmd endp