initstars PROC
LOCAL color:DWORD
local xpos:DWORD
local ypos:DWORD
local counter:DWORD
local dwords:DWORD
mov counter, 0
mov dwords, 0
startinit:
invoke _random, 0FFFFFFh
mov color, eax
invoke _random, ScreenWidth-10
mov xpos, eax
invoke _random, ScreenHeight-1 ; STARS ARE 2 PIX HIGH!! - FIXED
mov ypos, eax
mov edx, dwords
mov eax, color
mov dword ptr [offset stardata+edx], eax
add edx, 4
mov eax, xpos
mov dword ptr [offset stardata+edx], eax
add edx, 4
mov eax, ypos
mov dword ptr [offset stardata+edx], eax
add edx, 4
mov dwords, edx
inc counter
cmp counter, NUM_STARS
je AllDone
jmp startinit
AllDone:
mov eax, 1
Ret
initstars EndP
and
MoveStars PROC
LOCAL color:DWORD
LOCAL xpos :DWORD
LOCAL ypos :DWORD
LOCAL dwords :DWORD
LOCAL counter:DWORD
mov counter, 0
mov dwords, 0
mov color, 0
mov xpos, 0
mov ypos, 0
startmove:
mov edx, dwords
mov eax, dword ptr [offset stardata+edx]
mov color, eax
add edx, 4
mov eax,dword ptr [offset stardata+edx]
mov xpos ,eax
add edx, 4
mov eax,dword ptr [offset stardata+edx]
mov ypos, eax
add edx, 4
add xpos, 2
cmp xpos, ScreenWidth-10
mov dwords, edx
je reseed
ja reseed ; because xp + 2 may not hit the limit so .... ja to be safe. stops it crashing too.
mov edx, dwords
sub edx, 12
mov eax, color
mov dword ptr [offset stardata+edx], eax
add edx, 4
mov eax, xpos
mov dword ptr [offset stardata+edx], eax
add edx ,4
mov eax, ypos
mov dword ptr [offset stardata+edx], eax
add edx, 4
mov dwords, edx
inc counter
cmp counter, NUM_STARS
je alldone
jmp startmove
alldone:
BeginBlt:
mov dwords, 0
mov counter, 0
StartBlt:
mov edx, dwords
mov eax, dword ptr [offset stardata+edx]
mov color, eax
add edx, 4
mov eax, dword ptr [offset stardata+edx]
mov xpos, eax
add edx, 4
mov eax, dword ptr [offset stardata+edx]
mov ypos, eax
add edx, 4
mov dwords, edx
invoke BlitStar, xpos, ypos, color
inc counter
cmp counter, NUM_STARS
je EndAlls
jmp StartBlt
EndAlls:
mov eax, 1
Ret
reseed:
invoke _random, 0FFFFFFh
mov color, eax
invoke _random, ScreenHeight-2
mov ypos, eax
mov xpos, 0
sub dwords, 12
mov edx, dwords
mov eax, color
mov dword ptr [offset stardata+edx], eax
add edx, 4
mov eax, xpos
mov dword ptr [offset stardata+edx], eax
add edx ,4
mov eax, ypos
mov dword ptr [offset stardata+edx], eax
add edx, 4
sub edx, 12
mov dwords, edx
jmp startmove
MoveStars endp
copy/paste those two replacing the orig and it should works :)