Author Topic: xLIB 84C Edition  (Read 50801 times)

0 Members and 1 Guest are viewing this topic.

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #300 on: June 02, 2014, 07:13:54 pm »
Brief explanation of sprite collision function, it tests for collisions between rectangular coordinates so if you have say a sprite that is:

X = 10
Y = 10
W = 8
H = 8

And you wanted to test if this 'rectangle' overlaps with an enemy sprite at:

X = 15
Y = 15
W = 8
H = 8

Like so:


Then you can use the function to check:

real(4,6,1,10,10,8,8,15,15,8,8

In which case they do collide so the result will be a list:

{1,1,0

{1 = collision found
  1 = number of collisions found
  0 = index of collision passed with real( statement

And since there was only 1 set of coordinates passed the first index that collided is 0 (the red square).

Another case:

Rectangles at:

X = 10
Y = 10
W = 8
H = 8

Tested against others where:

X = 15
Y = 15
W = 8
H = 8

X = 48
Y = 32
W = 16
H = 16

X = 8
Y = 0
W = 64
H = 16

Like so:


The call would be: real(4,6,3,10,10,8,8,15,15,8,8,48,32,16,16,8,0,64,16

And the result would be:

{1,2,0,2

{1 = collision found (would be 0 if no collisions occured)
  2 = number of collisions found (green and red)
  0 = collision with index 0 (red)
  2 = collision with index 2 (green)

Index 1 is the orange square for which there was no collision.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #301 on: June 02, 2014, 11:15:57 pm »
Interesting, but I thought there were already similar collision routines available? Or is it just because they were bundled with getkey and this one is for people who want to getkey separately? This might be handy, though. I like collision boxes since this can make it much easier for games using larger sprites such as bosses or 16x16 games.

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #302 on: June 02, 2014, 11:20:53 pm »
There is already sprite<->tilemap collisions but no facility for sprite<->sprite collisions.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #303 on: June 02, 2014, 11:57:43 pm »
Oh right I see now. Thanks for the clarification :)

EDIT: Does the new xLIBC allow people to use Output() when using xLIBC drawing commands? Right now, you have to use real(0,1,0,1) before using Output, else it's screwed up, but then you are stuck with the gray bar at the screen top. Hexatron is doing a Celtic remake of Illusiat 11, but would like to get rid of the gray bar:

« Last Edit: June 03, 2014, 02:22:29 am by DJ Omnimaga »

Offline Hexatron

  • LV3 Member (Next: 100)
  • ***
  • Posts: 76
  • Rating: +2/-1
    • View Profile
Re: xLIB 84C Edition
« Reply #304 on: June 03, 2014, 04:53:06 pm »
Oh right I see now. Thanks for the clarification :)

EDIT: Does the new xLIBC allow people to use Output() when using xLIBC drawing commands? Right now, you have to use real(0,1,0,1) before using Output, else it's screwed up, but then you are stuck with the gray bar at the screen top. Hexatron is doing a Celtic remake of Illusiat 11, but would like to get rid of the gray bar:


No longer necessary (I did it in ASM), but it still would be a nice feature.

Offline merthsoft

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 241
  • Rating: +63/-1
    • View Profile
Re: xLIB 84C Edition
« Reply #305 on: June 03, 2014, 05:03:48 pm »
Why not just use xLib's draw string method?
Shaun

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #306 on: June 03, 2014, 06:28:42 pm »
He wanted to stick to the TI-OS ASCII characters so that he doesn't have to modify the entire game with many real( commands. The goal was to keep the game as it is, but still apply some minor updates such as color additions, perhaps an HUD or a logo and get rid of the surrounding gray/white.
« Last Edit: June 03, 2014, 06:30:29 pm by DJ Omnimaga »

Offline Hexatron

  • LV3 Member (Next: 100)
  • ***
  • Posts: 76
  • Rating: +2/-1
    • View Profile
Re: xLIB 84C Edition
« Reply #307 on: June 03, 2014, 06:55:32 pm »
Yeah.  It was more of a port than a total remake.

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #308 on: June 04, 2014, 02:23:15 am »
Well you can still draw to both sides of GRAM without setting half-res mode, you just need to do it in 2 calls.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #309 on: June 04, 2014, 03:14:08 am »
True but that's not really the issue: The issue was that every xLIBC drawing command (DrawShape, DrawSprite, DrawMap, DrawString and filling the screen) screws up the Output command no matter if you are in full or half res. TO fix Output you need to run real(0,1,0,1, which has the adverse effect or redrawing that ugly gray bar at the top of the screen.

Basically, Hexatron absolutely wants to use Output() without being stuck with the gray bar.

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #310 on: June 06, 2014, 04:41:53 am »
Good news, i fixed the Output( bug! Now xLIBC commands play nicely with the TIOS :).

Also i discovered that returning values into a List in Ans is SLOW. So slow that it halved the fps of the xLIBC DEMO :S. But the workaround is that I now create a user-defined list call "XL" that holds all the arguments needed. This is only for the Sprite Collision routines. But I probably should port it over to the getKey->List routine as well.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #311 on: June 06, 2014, 12:08:22 pm »
Awesome to hear :D. When this come out, I should tell Hexatron that he no longer needs his ASM routine to turn the screen black :P. Hopefully I can also find time to resume Reuben (thankfully the menu shouldn't be that hard now that I have a menu box routine done.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #312 on: June 07, 2014, 11:30:38 am »
Question: Does the new xLIBC version work with very large string files? (such as 60 KB large)

Also, is there a command to store a string to Str0-Str9 without copying it to Ans first? For example, something like real(6,3,"HELLO WORLD, MY NAME IS "+Sub("JAMESDAVIDMATT JOEY ",L1(25)*5+1,5)+"!",6) that would store to Str6 and work with strings of any size (or at least up to 8 KB or so).

The current issue is that when we need to copy a map to a string for use with the DrawMap command, it takes a crapload of RAM (enough RAM for the program containing the string data, plus twice or three times the RAM required to store the string).

Offline Hexatron

  • LV3 Member (Next: 100)
  • ***
  • Posts: 76
  • Rating: +2/-1
    • View Profile
Re: xLIB 84C Edition
« Reply #313 on: June 07, 2014, 11:13:46 pm »
If you want to free up RAM from using the string, just store the data to a string and put a :0 after it, so it resets ANS to 0.
For example:
  • "HI"->Str1:0
  • DISP Ans
returns 0 as Ans.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: xLIB 84C Edition
« Reply #314 on: June 08, 2014, 12:36:24 am »
Yeah this is not for displaying strings anyway, more for map data storage in my case (strings up to 7 or 9 KB in size)