i doing z sorting and i was woring on a sorting function for it, i need a costum sorting function because ineed to keep track of which faces belong to what object and vicea versa, so i look up some sorting a algorithms and found quick sort.
the only problem is, is that it is recursive (massivly so).
i try to get from every angle and it didn't work any way, gosub and goto just give me erros and procedures would even allow me to call procedure with in a procedure
heres the code to the quick sort test
Code: Select all
Dim sortmeO(100)
Dim sortmeF(100)
OpenConsole()
PrintN("sorting...")
tot=100
For i=0 To 100
sortmeO(i)=Random(500)
sortmeF(i)=Random(500)
Next i
left=0
right=tot-1
qsort:
pivot=sortmeF(left)
l_hold=left
r_hold=right
While left < right
While sortmeF(right) >= pivot And left < right
right=right-1
Wend
If left = right
sortmeF(left) = sortmeF(right)
right=right+1
EndIf
While sortmeF(left) <= pivot And left < right
left=left+1
Wend
If left <> right
sortmeF(right) = sortmeF(left)
right=right-1
EndIf
Wend
sortmeF(left)=pivot
pivot=left
left=l_hold
right=r_hold
If left < pivot
right=pivot-1
FakeReturn
Goto qsort
EndIf
If right > pivot
left=pivot+1
FakeReturn
Goto qsort
EndIf
Return
is there some work around that i didn't see?
asm?
or is it just impossible and another "wish" for the next version
