Author Topic: [83+ xLIB] Scrolling Past the Screen in xLIB  (Read 4255 times)

0 Members and 1 Guest are viewing this topic.

Demon

  • Guest
[83+ xLIB] Scrolling Past the Screen in xLIB
« on: July 31, 2006, 03:24:00 pm »
What is a very fast way to scroll through a tilemap in xLIB when your cursor hits the edge of the screen?

I - Cursor size.
N - Where to start drawing tilemap - horiz.
O - Where to start drawign tilemap - vert.
L - cursor's horiz. coord (byte).
M - cursor's vert. coord (byte).

c1-->
CODE
ec1...
8:prgmPTMH
Repeat Ans
real(8
End
Ans->K
8:prgmPTMH
prgmPTMK
...c2
ec2
prgmPTMHc1
-->
CODE
ec1real(12,Ans,LB,MB,B-1+LB,B-1+MBc2
ec2
prgmPTMKc1
-->
CODE
ec1If K<5:Then
L+(K=3)-(K=2)->L
M+(K=1)-(K=4)->M
If L<0:Then
1->L
N-1->N
prgmPTMU
End
If L>10:Then
1->L
N+1->N
prgmPTMU
End
If M<0:Then
1->M
O-1->O
prgmPTMU
End
If M<8:Then
8->M
O+1->O
prgmPTMU
End
Endc2
ec2
prgmPTMHc1
-->
CODE
ec1real(2,1,N,O,L,M,0,J6,0,J4,Q,0,16/J
c2
ec2

Zeromus

  • Guest
[83+ xLIB] Scrolling Past the Screen in xLIB
« Reply #1 on: August 01, 2006, 03:15:00 am »
That may be a possiblity. When I was doing T14 (nonGS) I was going to use 256 sprites (-54125+255) and I just made my sprite editor scroll down when the cursor hit the edge (to the next pic)

Demon

  • Guest
[83+ xLIB] Scrolling Past the Screen in xLIB
« Reply #2 on: August 01, 2006, 12:14:00 pm »
Well I optimized it a bunch last night.  But I think it could be better...

B - Sprite size (8 or 16)
C - Sprite size - max bytes (2 for 8x8, 1 for 16x16)
H and V - Cursor coordinates.
I and J - The dimensions of the tilemap matrix.
L and M - Where to start drawing the tilemap from the matrix.
Q - The initial picture to get sprites from.

prgmPTMH - Deleted; now using PSE's hilite sub:
c1-->
CODE
ec1real(12,Ans,HB,VB,B+HB-1,B+VB-1c2
ec2

prgmPTMH
c1
-->
CODE
ec1If K<5:Then
H+(K=3)-(K=2->H
V+(K=1)-(K=4->V
(H>C6-1)-(H<->Y
If Ans:Then
(C6-1)(Ans=1->H
L+Y
Ans(Ans>=0)-(C6+Ans)I->L
prgmAPTMU:End
(V>C3-1)-(V<->Y
If Ans:Then
(C4-1)(Ans=1->V
M+Y
Ans(Ans>0)-(C4+Ans>J->M
prgmAPTMU:End
End
...c2
ec2

prgmAPTMU
c1
-->
CODE
ec1real(2,1,L,M,I,J,0,C6,0,C4,Q,0,16/Cc2
ec2

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[83+ xLIB] Scrolling Past the Screen in xLIB
« Reply #3 on: August 01, 2006, 04:44:00 pm »
You could do that, or if you wanted you could input which pic at the start of the program.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
[83+ xLIB] Scrolling Past the Screen in xLIB
« Reply #4 on: August 02, 2006, 03:49:00 am »
change

Ans(Ans>=0)-(C6+Ans)I->L

to
Ans(Ans>=0)-I(C6+Ans->L

save one more byte ^^
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

threefingeredguy

  • Guest
[83+ xLIB] Scrolling Past the Screen in xLIB
« Reply #5 on: August 02, 2006, 10:07:00 am »
-IC6-IAns+.5(Ans+abs(Ans->L

Not smaller, but it may be faster.

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[83+ xLIB] Scrolling Past the Screen in xLIB
« Reply #6 on: August 02, 2006, 02:56:00 pm »
QuoteBegin-threefingeredguy+Aug 2 2006, 04:07 PM-->
QUOTE (threefingeredguy @ Aug 2 2006, 04:07 PM)
-IC6-IAns+.5(Ans+abs(Ans->L

Not smaller, but it may be faster.  

 Seems like it is over complicating things a bit.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
[83+ xLIB] Scrolling Past the Screen in xLIB
« Reply #7 on: August 02, 2006, 02:59:00 pm »
no clue, but i think he want it optimised for speed anyway, make sure he get what it means tho >.>
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[83+ xLIB] Scrolling Past the Screen in xLIB
« Reply #8 on: August 02, 2006, 03:07:00 pm »
I think TFGs would be slower.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
[83+ xLIB] Scrolling Past the Screen in xLIB
« Reply #9 on: August 02, 2006, 03:16:00 pm »
aah I c, I dont know all optiomising tricks >.< *xlibman
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Dragon__lance

  • Guest
[83+ xLIB] Scrolling Past the Screen in xLIB
« Reply #10 on: August 03, 2006, 05:58:00 am »
yeah,for sure, TFG's is slower,i tested on the calc. /w xlibman's optimisations,it runs at 19 ticks,compared to 22 ticks ;)wink.gif