Програма для анімації музичних творів

Курсовой проект - Компьютеры, программирование

Другие курсовые по предмету Компьютеры, программирование

mciSendStringA:Proc

extrn GetCursorPos: Proc

VT_BSTRequ 8

OF_EXIST equ 4000h

data

Coord:

XX dd 0

YY dd 0

MUZIKAdb "play arash.mp3",0

HKEY_CLASSES_ROOT\CLSID\{D45FD2FC-5C6E-11D1-9EC1-00C04FD7081F} [по умолчанию] = Microsoft Agent Server 2.0

CLSID_AgentServerdd 0d45fd2fch; Microsoft Agent Server 2.0

dw 5c6eh, 11d1h

db 9Eh,0C1h, 00h, 0C0h,4Fh,0D7h,08h,1Fh;

МЕТОДИ AgentServer:

Load = 1Ch

GetCharacterEx = 2Ch;

-------------------------------------------------------------------------------------------; HKEY_CLASSES_ROOT\Interface\{48D12BA0-5B77-11D1-9EC1-00C04FD7081F} [по умолчанию] = IAgentEx; HKEY_LOCAL_MACHINE\Software\CLASSES\Interface\{48D12BA0-5B77-11D1-9EC1-00C04FD7081F} [по умолчанию] = IAgentEx

IID_IAgentExdd 48d12ba0h; IAgentEx dw 5b77h,11d1h

db 9Eh,0C1h, 00h,0C0h,4Fh,0D7h,08h,1Fh;

МЕТОДИ IAgentEx:

SetLanguageID = 0C4h

SetSize = 28h

MoveTo = 70h

Show = 64h

Speak = 6Ch

GetAnimationNames = 0Ech

hide= 68h;

--------------------------------------------------------------------------------------------

IID_IEnumVARIANTdd 00020404h; IEnumVARIANT

dw 0000h,0000h

db 0C0h,00h, 00h,00h,00h,00h,00h,46h;

МЕТОДИ IEnumVARIANT:

Reset= 14h

Next= 0ch;

--------------------------------------

TITLE1db "Виконує дiю:",0

NUM1dd 0

IUNKNOWNdd 0

IVARdd 0;

------------------------------------------------------------------------------------------

hAgentdd 0

hAgentObjectdd 0

IChrIDdd 0

IReqIDdd 0

hAgentChardd 0

Var1dd 0

ADR1dd 0

TYPE_AGENTdd 0;

Вимовляння фрази:

BUF1db "Танцюють всі!!!",0

ACSdb "robby.acs",0; Варiант агента

FORMAT1db "Кiлькiсть дiй: %ld",0

NAME1db "Play",0.data?

OFSTRUCT db 8 dup(?)

FullName db 260 dup(?)

BUF2dw 500 dup(?)

TEXT1db 1000 dup(?)

_espdd ?

FETCHEDdd ?

MAS1db 20000 dup(?);

--------------------------------------------------------------------------------------------

code

Start:

Call CoInitialize,0; Initializes the COM library on the current thread

Call CoCreateInstance, offset CLSID_AgentServer, 0, 5, offset IID_IAgentEx, offset hAgentObject

test eax, eax

js STOP

call OpenFile,offset ACS,offset OFSTRUCT,OF_EXIST

cmp eax,-1

jz NOT_ACS

call MessageBoxA,0,offset FullName,offset ACS,0

Call MultiByteToWideChar,0,0,offset FullName,-1,offset BUF2,500

Call SysAllocString,offset BUF2

mov ADR1,eax

mov TYPE_AGENT,VT_BSTR NOT_ACS:

;----------------------------------------------------------------

mov edx,hAgentObject

mov edx,[edx]; Load Agent:

call [edx+Load],hAgentObject,TYPE_AGENT,0,ADR1,0,offset IChrID,offset IReqID

Call SysFreeString,ADR1

test eax, eax

js STOP

mov edx,hAgentObject

mov edx,[edx]

; 2ch = Get the Agent Character (GetCharacterEx)

call [edx+GetCharacterEx],hAgentObject,IChrID,offset hAgentChar ; Get the Agent Character

test eax, eax

js STOP

;====================================================

mov edx,hAgentChar

mov edx,[edx]

; 0c4h = SetLanguageID; 409-English,419-Russian,422-Ukrain

call [edx+SetLanguageID],hAgentChar,409h;Set Language

test eax, eax

js STOP

;------------------------------

mov edx,hAgentChar

mov edx,[edx]

call [edx+SetSize],hAgentChar,250, 270 ; Розмір персонажу

;--------------------------------

mov edx, hAgentChar

mov edx,[edx]

call [edx+MoveTo],hAgentChar,100,200,1,offset Var1; MoveTo X,Y,Speed,Id

;--------------------------------

mov edx, hAgentChar

mov edx,[edx]

call [edx+show],hAgentChar,0,offset Var1; show

;--------------------------------

Call MultiByteToWideChar,0,0,offset BUF1,-1,offset BUF2,500

Call SysAllocString,offset BUF2

mov ADR1,eax

mov edx,hAgentChar

mov edx,[edx]

call [edx+speak],hAgentChar,eax,0,offset Var1; speak

Call SysFreeString,ADR1

;--------------------------------

mov edx,hAgentChar

mov edx,[edx]

call [edx+GetAnimationNames],hAgentChar,offset IUNKNOWN; GetAnimationNames

test eax, eax

js STOP

mov edx,IUNKNOWN

mov edx,[edx]

call [edx+0],IUNKNOWN,offset IID_IEnumVARIANT,offset IVAR ; QueryInterface

mov edx,IVAR

mov edx,[edx]

call [edx+Reset],IVAR; Reset

test eax, eax

js STOP

mov edx,IVAR

mov edx,[edx]

call [edx+Next],IVAR,200,offset MAS1,offset FETCHED; Next

test eax, eax

js STOP

mov eax,FETCHED

call _wsprintfA,offset TEXT1,offset FORMAT1,eax

add esp,12

;call MessageBoxA,0,offset TEXT1,offset TEXT1,0

call Sleep, 7000

call mciSendStringA,offset MUZIKA,0,0,0

call dija,13

call dija,14

call dija,13

call dija,22

call dija,14

call dija,13

call dija,29

call dija,30

call dija,14

call dija,13

call dija,14

call dija,13

call dija,30

call dija,11

call dija,11

call dija,11

call dija,32

call dija,11

call dija,11

call dija,11

call dija,54

call dija,25

call dija,25

call dija,25

call dija,54

call dija,23

call dija,23

call dija,23

call dija,11

call dija,23

call dija,23

call dija,23

call dija,11

call dija,11

call dija,11

call dija,32

call dija,11

call dija,11

call dija,11

call dija,54

call dija,30

call dija,36

call dija,37

call dija,14

call dija,13

call dija,22

call dija,36

call dija,37

call dija,14

call dija,13

call dija,22

call dija,36

call dija,11

call dija,11

call dija,11

call dija,32

call dija,11

call dija,11

call dija,11

call dija,12

call dija,14

call dija,13

call dija,14

call dija,13

call dija,14

call dija,13

call dija,22

call dija,27

call ExitProcess,0

;----------------------------------

mov edx,IVAR

mov edx,[edx]

call [edx+8],IVAR; Release

test eax, eax

js STOP

;--------------------------------

mov edx,hAgentChar

mov edx,[edx]

call [edx+hide],hAgentChar,0,offset Var1; hide

call MessageBoxA,0,offset BUF1,offset BUF1,0

STOP: call ExitProcess,0

;===============================================

Do_Gesture:; eax = address

;-----------------------------------------------------------

push eax

mov edx,hAgentChar

mov edx,[edx]

call [edx+58h],hAgentChar,1; Stop play

Call SysAllocString; eax

mov ADR1,eax

mov edx,hAgentChar

mov edx,[edx]

call [edx+50h],hAgentChar,eax,offset Var1; gesture

Call SysFreeString,ADR1

ERR1: ret

;----------------------------------

dija Proc p1:dword

call GetCursorPos, offset Coord

mov edx, hAgentChar

mov edx, [edx]

call [edx+MoveTo], hAgentChar, XX, YY, 1, offset IVAR

mov esi,offset MAS1+8

mov ecx,p1

LL1:push ecx

mov eax,[esi]

add esi,16

pop ecx

loop LL1

push eax

call Do_Gesture; eax - address

pop eax

; call MessageBoxW,0,eax,eax,0h

call Sleep,2500

ret

endp

end Start