Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
Mario.Asm
Package: mario.rar [view]
Upload User: bfc2008
Upload Date: 2007-02-21
Package Size: 35k
Code Size: 19k
Category:
Game Program
Development Platform:
DOS
- .386
- .model flat,stdcall
- option casemap:none
- include Mario.inc
- include Gates.inc
- .const
- STBAR_GRIDS equ 4
- ;-- Margin
- LEFT_MARGIN equ 1
- TOP_MARGIN equ 1
- ;-- leading actor mov ;-- Back Scroll Mov
- ACTOR_LOW_SPEED equ 2
- ACTOR_HIGH_SPEED equ 4
- ACTOR_DROP_SPEED equ 4
- ACTOR_JUMP_SPEED equ 4 + ACTOR_DROP_SPEED
- ;-- Jump Height
- MAX_JUMP_HEIGHT equ 5
- ;-- Back Movie Time Interval
- BACK_MOVIE_INTERVAL equ 800
- FRAME_MOVIE_INTERVAL equ 20
- JUMP_MAX_TIME equ 350
- ;-- Game State --
- GS_PLAY equ 1000 ;-- Player can playing
- GS_STARTGAME equ 1001
- GS_PAUSE equ 1002 ;-- Pause
- GS_SELECT equ 1003 ;-- Select Control
- GS_GAMEOVER equ 1004 ;-- Game over
- GS_INFO equ 1005 ;-- Show Information
- .data
- szMessage db 'Message Hooked!!!',0
- Stbar_Parts dd 150,250,375,550
- FpsFmtStr db 'FPS = %d',0
- SmallFontName db 'Courier New',0
- szKeyDown db 'Key Down',0
- szKeyUp db 'Key Up',0
- .data?
- ;-- Sprite ---
- Sprite CSprite <?>
- ;-- Key State
- KeyState CKeyState <?>
- ;-- Gate Data Information ---
- GateInfo CGateInfo <?>
- ;-- Game State ---
- GameState dd ?
- ;-- Back Buffer
- hBackDc dd ?
- hBackBmp dd ?
- hBigFont dd ?
- hSmallFont dd ?
- ;-- Map Images
- hImagesBmp dd ?
- hImagesDc dd ?
- ;--- Map Mask Images
- hImagesMaskBmp dd ?
- hImagesMaskDc dd ?
- ;-- Actor Images
- hActorDc dd ?
- hActorBmp dd ?
- ;-- Actor Mask Images
- hActorMaskDc dd ?
- hActorMaskBmp dd ?
- ;--- Calc Frame Peer Second
- FrameCount dd ?
- TimeLamp1 dd ?
- szFpsBuffer db 256 dup(?)
- ;-- sence background movie control
- TimeBackMovieLamp dd ?
- CurrentBack dd ?
- ;-- sence control
- x_Detail dd ?
- x_Index dd ?
- x_nPos dd ?
- .code
- start:
- invoke GetModuleHandle,NULL
- mov hInstance,eax
- invoke GetCommandLine
- invoke InitCommonControls
- invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
- invoke ExitProcess,eax
- WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
- LOCAL bQuit :DWORD
- LOCAL wc:WNDCLASSEX
- LOCAL msg:MSG
- mov wc.cbSize,SIZEOF WNDCLASSEX
- mov wc.style,CS_HREDRAW or CS_VREDRAW
- mov wc.lpfnWndProc,OFFSET WndProc
- mov wc.cbClsExtra,NULL
- mov wc.cbWndExtra,DLGWINDOWEXTRA
- push hInst
- pop wc.hInstance
- mov wc.hbrBackground,COLOR_BTNFACE+1
- mov wc.lpszMenuName,OFFSET MenuName
- mov wc.lpszClassName,OFFSET ClassName
- invoke LoadIcon,NULL,IDI_APPLICATION
- mov wc.hIcon,eax
- mov wc.hIconSm,eax
- invoke LoadCursor,NULL,IDC_ARROW
- mov wc.hCursor,eax
- invoke RtlZeroMemory,Addr Sprite,SizeOf(CSprite)
- invoke RegisterClassEx,addr wc
- invoke CreateDialogParam,hInstance,addr DlgName,NULL,addr WndProc,NULL
- mov hWnd,eax
- invoke ShowWindow,hWnd,SW_SHOWNORMAL
- invoke UpdateWindow,hWnd
- invoke InitApp
- mov bQuit ,FALSE
- .while !(bQuit)
- invoke PeekMessage,addr msg,NULL,0,0,PM_REMOVE
- .if (eax)
- .if (msg.message == WM_QUIT )
- mov bQuit ,TRUE
- .else
- invoke TranslateMessage,addr msg
- invoke DispatchMessage,addr msg
- .endif
- .else
- ; Game Loop
- .if (bActive)
- invoke GameLoop
- .else
- invoke WaitMessage
- .endif
- .endif
- .endw
- invoke FreeRes
- mov eax,msg.wParam
- ret
- WinMain endp
- WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
- mov eax,uMsg
- .if eax==WM_INITDIALOG
- push hWin
- pop hWnd
- invoke GetDC,hWin
- mov hDc,eax
- invoke LoadRes
- invoke SelectGate,1
- push TRUE
- pop bActive
- .elseif eax==WM_COMMAND
- mov eax,wParam
- and eax,0FFFFh
- .if eax==IDM_FILE_EXIT
- invoke SendMessage,hWin,WM_CLOSE,0,0
- .elseif eax==IDM_HELP_ABOUT
- invoke ShellAbout,hWin,addr AppName,addr AboutMsg,NULL
- .endif
- ; .elseif eax==WM_SIZE
- .elseif eax==WM_CLOSE
- push FALSE
- pop bActive
- invoke ReleaseDC,hWin,hDc
- invoke DestroyWindow,hWin
- .elseif uMsg==WM_DESTROY
- invoke PostQuitMessage,NULL
- .else
- invoke DefWindowProc,hWin,uMsg,wParam,lParam
- ret
- .endif
- xor eax,eax
- ret
- WndProc endp
- GameLoop proc
- .if GameState != GS_GAMEOVER
- invoke KeyProc
- invoke CheckDrop
- invoke UpdateWnd
- invoke CheckGameOver
- .endif
- invoke Flip
- invoke CalcFps
- ret
- GameLoop endp
- LoadRes proc
- LOCAL lf:LOGFONT
- ; Create BackBuffer
- invoke CreateCompatibleBitmap,hDc,17*32,12*32
- mov hBackBmp,eax
- invoke CreateCompatibleDC,hDc
- mov hBackDc,eax
- invoke SelectObject,hBackDc,hBackBmp
- ;invoke SetTextColor,hBackDc,0h
- invoke SetBkMode,hBackDc,TRANSPARENT
- invoke RtlZeroMemory,Addr lf,SizeOf(LOGFONT)
- mov lf.lfHeight ,20
- mov lf.lfWidth ,12
- mov lf.lfWeight ,500
- ;invoke lstrcpy,Addr lf.lfFaceName,Addr SmallFontName
- invoke CreateFontIndirect,Addr lf
- mov hBigFont,eax
- mov lf.lfHeight ,15
- mov lf.lfWidth,10
- invoke CreateFontIndirect,Addr lf
- mov hSmallFont,eax
- invoke SelectObject,hBackDc,hSmallFont
- invoke DeleteObject,eax
- ; Create Map Images Buffer
- invoke LoadBitmap,hInstance,BM_IMAGES
- mov hImagesBmp,eax
- invoke CreateCompatibleDC,hDc
- mov hImagesDc,eax
- invoke SelectObject,hImagesDc,hImagesBmp
- ; Create Map Mask Buffer
- invoke CreateCompatibleDC,hDc
- mov hImagesMaskDc,eax
- invoke LoadBitmap,hInstance,BM_IMAGES_MASK
- mov hImagesMaskBmp,eax
- invoke SelectObject,hImagesMaskDc,hImagesMaskBmp
- ; Create Actor Buffer
- invoke CreateCompatibleDC,hDc
- mov hActorDc,eax
- invoke LoadBitmap,hInstance,BM_ACTOR
- mov hActorBmp ,eax
- invoke SelectObject,hActorDc,hActorBmp
- ; Create Actor Mask Buffer
- invoke CreateCompatibleDC,hDc
- mov hActorMaskDc,eax
- invoke LoadBitmap,hInstance,BM_ACTOR_MASK
- mov hActorMaskBmp,eax
- invoke SelectObject,hActorMaskDc,hActorMaskBmp
- push 0
- pop FrameCount
- invoke GetTickCount
- mov TimeLamp1,eax
- mov TimeBackMovieLamp ,eax
- push 0
- pop CurrentBack
- mov eax ,0
- mov x_Detail,eax
- mov x_Index,eax
- mov x_nPos,eax
- ret
- LoadRes endp
- FreeRes proc
- invoke DeleteObject,hBigFont
- invoke DeleteObject,hImagesBmp
- invoke DeleteObject,hBackBmp
- invoke DeleteObject,hImagesMaskBmp
- invoke DeleteObject,hActorBmp
- invoke DeleteObject,hActorMaskBmp
- invoke DeleteDC,hBackDc
- invoke DeleteDC,hImagesDc
- invoke DeleteDC,hImagesMaskDc
- invoke DeleteDC,hActorDc
- invoke DeleteDC,hActorMaskDc
- ret
- FreeRes endp
- KeyProc proc
- invoke GetAsyncKeyState,27
- .if eax >80000000h
- invoke SendMessage,hWnd,WM_CLOSE,0,0
- .endif
- invoke GetAsyncKeyState,'W' ; Up
- .if eax > 80000000h ; Key Down
- ; invoke MessageBox,hWnd,Addr szMessage,addr AppName,MB_OK
- push TRUE
- pop KeyState.bKeyWDown
- .else
- .if KeyState.bKeyWDown
- invoke MessageBox,hWnd,Addr szKeyUp,addr AppName,MB_OK
- push FALSE
- pop KeyState.bKeyWDown
- .endif
- .endif
- invoke GetAsyncKeyState,'S'
- .if eax > 80000000h
- invoke MessageBox,hWnd,Addr szMessage,Addr AppName,MB_OK
- .endif
- invoke GetAsyncKeyState,'A' ; left
- .if eax > 80000000h
- invoke CanMoveLeft
- .if eax
- invoke SpriteMoveLeft
- .endif
- push TRUE
- pop KeyState.bKeyADown
- .else
- .if KeyState.bKeyADown
- push 5
- pop Sprite.Frame
- push FALSE
- pop KeyState.bKeyADown
- .endif
- .endif
- invoke GetAsyncKeyState,'D' ; Right
- .if eax > 80000000h
- invoke CanMoveRight
- .if eax
- invoke SpriteMoveRight
- .endif
- push TRUE
- pop KeyState.bKeyDDown
- .else
- .if KeyState.bKeyDDown
- push 0
- pop Sprite.Frame
- push FALSE
- pop KeyState.bKeyDDown
- .endif
- .endif
- invoke GetAsyncKeyState,'J' ; Jump
- .if eax > 80000000h
- ; Key Down
- .if !KeyState.bKeyJDown
- .if Sprite.bOnLine
- invoke GetTickCount
- mov Sprite.JumpTimeLamp,eax
- push Sprite.y
- pop Sprite.JumpBaseY
- ;invoke MessageBox,hWnd,Addr AppName,Addr AppName,MB_OK
- .endif
- .endif
- invoke JumpProc
- push TRUE
- pop KeyState.bKeyJDown
- .else
- .if KeyState.bKeyJDown ;-- Key Up
- push FALSE
- pop KeyState.bKeyJDown
- .endif
- .endif
- invoke GetAsyncKeyState,'K'
- .if eax > 80000000h
- invoke MessageBox,hWnd,Addr szMessage,Addr AppName,MB_OK
- .endif
- invoke GetAsyncKeyState,VK_CONTROL ; Turbo
- .if eax > 80000000h
- push ACTOR_HIGH_SPEED
- pop Sprite.Speed
- .else
- push ACTOR_LOW_SPEED
- pop Sprite.Speed
- .endif
- ret
- KeyProc endp
- SpriteMoveLeft proc
- .if Sprite.x >0
- mov eax,Sprite.x_Detail
- sub eax,Sprite.Speed
- mov Sprite.x_Detail,eax
- cmp eax,0
- jg @@Other
- ;Sprite.x_Detail <0
- add Sprite.x_Detail,32
- dec Sprite.x
- @@Other:
- ;Sprite.x_Detail >0
- .else
- mov eax,Sprite.x_Detail
- sub eax,Sprite.Speed
- mov Sprite.x_Detail,eax
- cmp eax,0
- jg @@NotDo
- ; Sprite.x_Detail <0
- push 0
- pop Sprite.x_Detail
- @@NotDo:
- .endif
- mov eax,Sprite.x
- sub eax,x_Index
- .if eax <7
- .if x_Index > 0 ; Left Scroll Background
- mov eax,x_Detail
- sub eax ,Sprite.Speed
- mov x_Detail,eax
- cmp eax,0
- jg @@1
- ; x_Detail <0
- sub x_nPos ,12
- dec x_Index
- mov ebx ,x_Detail
- not ebx
- inc ebx
- mov eax,32
- sub eax,ebx
- mov x_Detail,eax
- @@1:
- .elseif x_Index == 0
- .if x_Detail > 0
- mov eax, x_Detail
- sub eax ,Sprite.Speed
- mov x_Detail,eax
- .endif
- .endif
- .endif
- .if Sprite.bOnLine
- invoke CanFrameMovie
- .if eax
- mov eax,Sprite.Frame
- inc eax
- .if (eax >8) || (eax <4)
- mov eax,5
- .endif
- mov Sprite.Frame,eax
- .endif
- .else
- push 9
- pop Sprite.Frame
- .endif
- ret
- SpriteMoveLeft endp
- SpriteMoveRight proc
- .if Sprite.x < 44 ; Not the Last screen
- mov eax,Sprite.x_Detail
- add eax,Sprite.Speed
- mov Sprite.x_Detail,eax
- .if eax > 31
- inc Sprite.x
- sub Sprite.x_Detail ,32
- .endif
- .else
- push 0
- pop Sprite.x_Detail
- .endif
- mov eax,Sprite.x
- sub eax,x_Index
- .if eax > 10 ; 17 -7
- mov eax , GateInfo.DataLen
- sub eax ,12*17
- .if x_nPos < eax ; Right Scroll Background
- mov eax , x_Detail
- add eax , Sprite.Speed
- mov x_Detail ,eax
- .if eax > 31
- add x_nPos ,12
- inc x_Index
- mov eax ,x_Detail
- sub eax,32
- mov x_Detail,eax
- .endif
- .endif
- .endif
- .if Sprite.bOnLine
- invoke CanFrameMovie
- .if eax
- mov eax,Sprite.Frame
- inc eax
- .if eax >3
- mov eax,0
- .endif
- mov Sprite.Frame,eax
- .endif
- .else
- push 4
- pop Sprite.Frame
- .endif
- ret
- SpriteMoveRight endp
- CanMoveLeft proc
- ; check Sprite can move left
- LOCAL x1:DWORD
- LOCAL y1:DWORD
- LOCAL n1:DWORD
- LOCAL n2:DWORD
- .if Sprite.x_Detail != 0
- mov eax ,TRUE
- .else
- ; Sprite.x_Detail == 0
- .if Sprite.x == 0
- mov eax ,FALSE
- .else
- ; Sprite.x != 0
- mov eax,Sprite.x
- dec eax
- mov x1,eax
- mov eax,Sprite.y
- mov y1,eax
- invoke ReadMapXY,x1,y1
- mov n1,eax
- inc y1
- invoke ReadMapXY,x1,y1
- mov n2,eax
- .if (n1!=MAP_BRICK)&& (n1!= MAP_BRICK1)
- .if Sprite.y_Detail == 0
- mov eax ,TRUE
- .else
- .if (n2!=MAP_BRICK)&&(n2!=MAP_BRICK1)
- mov eax ,TRUE
- .else
- mov eax,FALSE
- .endif
- .endif
- .else
- mov eax ,FALSE
- .endif
- .endif
- .endif
- ret
- CanMoveLeft endp
- CanMoveRight proc
- ; check Sprite can move right
- LOCAL x1:DWORD
- LOCAL y1:DWORD
- LOCAL n1:DWORD
- LOCAL n2:DWORD
- .if Sprite.x_Detail != 0
- mov eax ,TRUE ; can MoveRight
- .else
- mov eax,Sprite.x
- inc eax
- mov x1,eax
- push Sprite.y
- pop y1
- invoke ReadMapXY,x1,y1
- mov n1,eax
- inc y1
- invoke ReadMapXY,x1,y1
- mov n2,eax
- .if Sprite.y_Detail != 0
- .if (n1!=MAP_BRICK)&& (n1!= MAP_BRICK1)
- .if (n2!= MAP_BRICK)&&(n2!= MAP_BRICK1)
- mov eax,TRUE
- .else
- mov eax,FALSE
- .endif
- .else
- mov eax,FALSE
- .endif
- .else
- ;-- Sprite.y_Detail == 0
- .if (n1!= MAP_BRICK)&&(n1!=MAP_BRICK1)
- mov eax ,TRUE
- .else
- mov eax, FALSE
- .endif
- .endif
- .endif
- ret
- CanMoveRight endp
- JumpProc proc
- LOCAL dwTime:DWORD
- invoke GetTickCount
- mov dwTime,eax
- sub eax,Sprite.JumpTimeLamp
- .if eax < JUMP_MAX_TIME
- sub Sprite.y_Detail ,ACTOR_JUMP_SPEED
- cmp Sprite.y_Detail,0
- jg @@1
- dec Sprite.y
- add Sprite.y_Detail,32
- @@1:
- .endif
- ; mov eax,Sprite.y
- ; sub eax,Sprite.JumpBaseY
- ; .if eax< MAX_JUMP_HEIGHT
- ; .endif
- ret
- JumpProc endp
- InitApp proc
- invoke SendDlgItemMessage,hWnd,IDC_SBR1,SB_SETPARTS,STBAR_GRIDS,Addr Stbar_Parts
- invoke SendDlgItemMessage,hWnd,IDC_SBR1,SB_SETTEXT,0,Addr AppName
- ret
- InitApp endp
- UpdateWnd proc
- LOCAL x:DWORD
- LOCAL y:DWORD
- ;LOCAL dwTime:DWORD
- LOCAL x1:DWORD
- push esi
- ; Draw Map
- mov esi ,GateInfo.BaseAddress
- add esi,x_nPos
- mov eax,0
- sub eax,x_Detail
- mov x,eax ; x = - x_Detail
- @@1:
- mov y,0
- @@2:
- xor eax,eax
- mov al,[esi]
- inc esi
- shl eax,5
- mov x1,eax
- invoke BitBlt,hBackDc,x,y,32,32,hImagesDc,x1,0,SRCCOPY
- add y,32
- cmp y,12*32
- jb @@2
- add x,32
- cmp x,17*32
- jb @@1
- ; Draw Man
- ; Screen x = (Sprite.x - x_Index )*32 - x_Detail + Sprite.x_Detail
- mov eax,Sprite.x
- sub eax,x_Index
- shl eax ,5 ; eax = eax *32
- sub eax,x_Detail
- add eax,Sprite.x_Detail ; Screen x
- mov x,eax
- ; Screen y = Sprite.y *32 + Sprite.y_Detail
- mov eax,Sprite.y
- shl eax,5
- add eax,Sprite.y_Detail
- mov y,eax
- mov eax,Sprite.Frame
- shl eax,5
- mov x1,eax
- ;invoke BitBlt,hBackDc,x,y,32,32,hActorDc,x1,0,SRCINVERT
- invoke BitBlt,hBackDc,x,y,32,32,hActorMaskDc,x1,0,SRCAND
- invoke BitBlt,hBackDc,x,y,32,32,hActorDc,x1,0,SRCPAINT
- ;invoke BitBlt,hBackDc,x,y,32,32,hImagesMaskDc,7*32,0,SRCAND
- ;invoke BitBlt,hBackDc,x,y,32,32,hImagesDc,7*32,0,SRCPAINT
- invoke TextOut,hBackDc,10,10,Addr AppName,5
- pop esi
- ret
- UpdateWnd endp
- Flip proc
- invoke BitBlt,hDc,LEFT_MARGIN,TOP_MARGIN,17*32,12*32,hBackDc,0,0,SRCCOPY
- ret
- Flip endp
- SelectGate proc iGate:DWORD
- LOCAL nPos :DWORD
- ; Load Gate information
- mov eax,offset Gates
- mov GateInfo.BaseAddress,eax
- push 45 ; width 45
- pop GateInfo.dwWidth
- push 12*45
- pop GateInfo.DataLen
- push iGate
- pop GateInfo.Num
- ; refresh Gate information
- push esi
- mov esi,GateInfo.BaseAddress
- mov nPos ,-1
- @@1:
- mov al,[esi]
- inc esi
- inc nPos
- cmp al,MAP_MAN
- jnz @@1
- @@2:
- dec esi
- mov Byte ptr [esi],MAP_EMPTY
- xor edx,edx
- mov eax,nPos
- mov ebx ,12
- div ebx
- mov Sprite.x,eax
- mov Sprite.y,edx
- ;invoke wsprintf,Addr szFpsBuffer,Addr FpsFmtStr,Sprite.y
- ;invoke MessageBox,hWnd,Addr szFpsBuffer,Addr FpsFmtStr,MB_OK
- push GS_STARTGAME
- pop GameState
- mov eax ,0
- mov Sprite.x_Detail,eax
- mov Sprite.y_Detail,eax
- mov x_Detail,eax
- mov x_Index,eax
- push ACTOR_LOW_SPEED
- pop Sprite.Speed
- invoke RtlZeroMemory,Addr KeyState ,SizeOf(CKeyState)
- pop esi
- ret
- SelectGate endp
- ReadMapXY proc x:DWORD,y:DWORD
- ; return the (x,y) MapData
- push esi
- mov eax ,y
- cmp eax,0
- jl @@1
- ; eax > 0
- mov esi, GateInfo.BaseAddress
- xor edx,edx
- mov eax,x
- mov ebx,12
- mul ebx
- add eax,y ; x*12+ y
- add esi,eax
- xor eax,eax
- mov al,byte ptr [esi]
- jmp @@2
- @@1:
- ; -- eax <0
- mov eax,0FFh
- @@2:
- pop esi
- ret
- ReadMapXY endp
- CheckDrop proc
- LOCAL y1:DWORD
- LOCAL x1:DWORD
- push FALSE
- pop Sprite.bOnLine
- .if Sprite.y_Detail != 0
- add Sprite.y_Detail,ACTOR_DROP_SPEED
- .else ; Sprite.y_Detail == 0
- mov eax ,Sprite.y
- inc eax
- mov y1,eax
- invoke ReadMapXY,Sprite.x,y1
- .if (al!= MAP_BRICK)&& (al!= MAP_BRICK1)
- ; Drop
- .if Sprite.x_Detail != 0
- mov eax ,Sprite.x
- inc eax
- mov x1,eax
- invoke ReadMapXY,x1,y1
- .if (al!= MAP_BRICK)&&(al!= MAP_BRICK1)
- add Sprite.y_Detail ,ACTOR_DROP_SPEED
- .endif
- .else
- add Sprite.y_Detail,ACTOR_DROP_SPEED
- .endif
- .else ;-- al = MAP_BRICK
- push TRUE
- pop Sprite.bOnLine
- .endif
- .endif
- .if Sprite.y_Detail >= 32
- inc Sprite.y
- sub Sprite.y_Detail,32
- .endif
- ret
- CheckDrop endp
- CheckGameOver proc
- ; Set the Game State
- cmp Sprite.y,0
- jl @Exit
- ; Sprite.y > 0
- .if Sprite.y >11
- push GS_GAMEOVER
- pop GameState
- .endif
- @Exit:
- ret
- CheckGameOver endp
- CalcFps proc
- LOCAL dwDetal :DWORD
- LOCAL dwTime :DWORD
- add FrameCount ,1
- invoke GetTickCount
- mov dwTime,eax
- sub eax,TimeLamp1
- mov dwDetal,eax
- .if eax > 1000
- xor edx,edx
- mov eax,FrameCount
- div dwDetal
- invoke wsprintf,Addr szFpsBuffer,Addr FpsFmtStr,edx
- invoke SendDlgItemMessage,hWnd,IDC_SBR1,SB_SETTEXT,0,addr szFpsBuffer
- push 0
- pop FrameCount
- push dwTime
- pop TimeLamp1
- .endif
- ret
- CalcFps endp
- CanFrameMovie proc
- LOCAL dwTime:DWORD
- invoke GetTickCount
- mov dwTime,eax
- sub eax, Sprite.FrameTimeLamp
- .if eax > FRAME_MOVIE_INTERVAL ; if dwTime - FrameTimeLamp > FRAME_MOVIE_INTERVAL
- mov eax,dwTime
- mov Sprite.FrameTimeLamp,eax
- mov eax,TRUE
- .else
- mov eax,FALSE
- .endif
- ret
- CanFrameMovie endp
- end start