Author Topic: Checking/Accessing Eight Points Around One Point  (Read 7773 times)

0 Members and 2 Guests are viewing this topic.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Checking/Accessing Eight Points Around One Point
« Reply #15 on: September 29, 2010, 10:16:02 pm »
One of the few times the xor operator comes in handy :)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Checking/Accessing Eight Points Around One Point
« Reply #16 on: September 29, 2010, 10:21:22 pm »
Yup - Checkerboard patterns.  I've used it before in drawing things like this:
. . . . .
 . . . . .
. . . . .
 . . . . .

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Checking/Accessing Eight Points Around One Point
« Reply #17 on: September 29, 2010, 10:23:07 pm »
Ah, thanks :D So basically you use M and N to offset to the points I'm checking?

@Z
What do you mean about checkerboard patterns?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Checking/Accessing Eight Points Around One Point
« Reply #18 on: September 29, 2010, 10:24:45 pm »
For(A,1,8)
For(B,1,16)
If fpart(A/2) xor fpart(B/2)
Output(A,B,"O
End
End

Things like this. :)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Checking/Accessing Eight Points Around One Point
« Reply #19 on: September 29, 2010, 10:32:06 pm »
Ah ok. I gotcha.

Edit:
By the way that can be just:

Code: [Select]
For(A,1,8
For(B,1,16
If fPart(A/2) xor fPart(B/2
Output(A,B,"O
End
End
« Last Edit: September 29, 2010, 10:54:42 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

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: Checking/Accessing Eight Points Around One Point
« Reply #20 on: September 30, 2010, 12:29:55 am »
I'm not to sure if the title really says what I mean. But what I'm looking for is a good way to access or check or just be able to do something to the spots surrounding a single spot. But also, now that I think about the situation, I just need a way to get access the points surrounding a point. Whether eight, five, or three (I think those are all the options...).

Code: [Select]
123
4█5
678

█1
12

12
█3
45

Those are the points I mean. I have one method that in theory would work, haven't tested it yet, but it only works for checking all eight points. Which might work for the situation but if someone knows a better way I'd like to hear it :)

Thanks for any help.
You know, something like that would be VERY useful if I decided to do that dynamic bit-based tilemapper I wanted to make at one point in Axe, where walls are different depending of if there's a floor sprite at the top, bottom, left or right.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Checking/Accessing Eight Points Around One Point
« Reply #21 on: September 30, 2010, 12:33:52 am »
You know, something like that would be VERY useful if I decided to do that dynamic bit-based tilemapper I wanted to make at one point in Axe, where walls are different depending of if there's a floor sprite at the top, bottom, left or right.
I do something sort of like that for loading maps in F-Zero. They are stored as 64x64 bitmaps, but I unpack them into a 64x64 tilemap, checking adjacent tiles for whether I need a track boundary or a diagonal track tile.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

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: Checking/Accessing Eight Points Around One Point
« Reply #22 on: September 30, 2010, 12:37:19 am »
Nice. I want to give this a try because I had some RPGs that used maps where each tile was 1 bit and, while they are limited, those maps are really small in size.

EDIT: There was also a screenshot showing this in action:

Original topic:
http://ourl.ca/6544/106719

EDIT: I think they are called automated tiles.
« Last Edit: September 30, 2010, 12:50:02 am by DJ Omnimaga »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Checking/Accessing Eight Points Around One Point
« Reply #23 on: September 30, 2010, 07:05:04 pm »
Ah ok. I gotcha.

Edit:
By the way that can be just:

Code: [Select]
For(A,1,8
For(B,1,16
If fPart(A/2) xor fPart(B/2
Output(A,B,"O
End
End
No.
It must be one of these two:

Code: [Select]
For(A,1,8)
For(B,1,16)
If fPart(A/2) xor fPart(B/2
Output(A,B,"O
End
End

Code: [Select]
For(A,1,8
For(B,1,16
If fPart(A/2) xor fPart(B/2
Then
Output(A,B,"O
End
End
End
This is due to the For( glitch. :)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Checking/Accessing Eight Points Around One Point
« Reply #24 on: September 30, 2010, 07:21:56 pm »
But the glitch is only if the If statement is false. I ran both versions, mine and yours, and yours is technically slower (it's negligible). It's odd, I know, but ya. It doesn't really matter though.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

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: Checking/Accessing Eight Points Around One Point
« Reply #25 on: September 30, 2010, 07:28:53 pm »
If both are the same size, I would probably go with the non-glitchy one, because sometimes, the For() glitch triggers major slowdown until the next ON keypress even after exiting the For loop x.x
« Last Edit: September 30, 2010, 07:29:07 pm by DJ Omnimaga »

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Checking/Accessing Eight Points Around One Point
« Reply #26 on: September 30, 2010, 07:33:51 pm »
Well both the ones he just showed are the same size, it looks like anyways, and guarantee no slow down but when I tested his original one and mine I didn't experience any at all when I ran mine.
« Last Edit: September 30, 2010, 07:34:07 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Checking/Accessing Eight Points Around One Point
« Reply #27 on: September 30, 2010, 07:34:11 pm »
If both are the same size, I would probably go with the non-glitchy one, because sometimes, the For() glitch triggers major slowdown until the next ON keypress even after exiting the For loop x.x

Wow. TI has got to fix their bugs x.x

Has anyone contacted them about this one?

Also, hurrah for XOR actually being used!




Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Checking/Accessing Eight Points Around One Point
« Reply #28 on: September 30, 2010, 07:35:15 pm »
BrandonW fixed it, I believe. (Him or penguin, but I'm fairly sure it was BrandonW.)
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

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: Checking/Accessing Eight Points Around One Point
« Reply #29 on: September 30, 2010, 07:55:10 pm »
BrandonW did. I do not remember if his OS patch is compatible with other patches he made, though, and if it was for 2.53MP or not