Calculator Community > TI 68K

Best way to perform clipping with irregular shapes

(1/2) > >>

Michael0x18:
I asked this on Cemetech, but based on my prior experience they're mostly focused on the [e]Z80 calculators, and I'm basically the only new 68K programmer in the last several years, so I'm not optimistic about getting an answer. So I'm cross posting here, in the hopes that people here might be more familiar with the SDK.

Anyway, here goes:

I'm making a somewhat complicated RPG for the more recent 68K calcs, and I need to figure out how to test collisions with weird shapes, for example curved and diagonal walls. What I'm trying to do now is to draw the clipping data to a "virtual screen" and test pixels to sense collisions. Here are the questions I have regarding this topic:

1: Is there some way to redirect TIGCC/GCC4TI's sprite functions to a virtual buffer, and somehow tell it that this buffer isn't 240x128 pixels, but 256x256 pixels?

2: Is there better way to perform clipping operations?

3: In the event that I can't redirect the functions from the standard library, should I abuse ExtGraph's tile map engine or write something to copy data into the plane?

Thanks,
Michael

NonstickAtom785:
Hmm... what programming language is this in? I think I read somewhere that you could program on the 68k series with C. I could be misremembering though. In any case though clipping can be done by grabbing the pixels and rotating them in. I don't know how the TI-86k screen is setup but maybe this could be of some help. Just thought I would show some interest. Is there an emulator for this calculator?

Michael0x18:
Yeah this is in C.

To be clear, I'm using the GCC4TI SDK, running in WINE, because I couldn't get a native install to work correctly. I'm already using ExtGraph to draw the tiles, so using another few buffers probably wouldn't hurt.

Xeda112358:
I think what I would suggest is what you are already trying to do. For irregular collision boxes, I set a "collision buffer" the size of the screen (1bpp), and in that buffer I set the pixel on if it's a collision point, else off. Then when I am drawing the tile, so draw it's collision sprite to the collision buffer.

I have no idea how to do this on the 68k calcs :P

Michael0x18:
Okay, thank you. That's settled, then.
I currently have two different "collision buffers," which are each 256x256 pixels (one for each map layer, 8192 bytes each). GCC4TI's sprite routines expect a buffer that is 240x128 (the size of the 92's screen), but mine is larger. This essentially means that I can't use the built in sprite functions to draw it, unless there's something I can change to "edit" the size of the screen.

I'll try to come up with some code that draws it myself, but it'll take a while.

Thanks for the help!

Navigation

[0] Message Index

[#] Next page

Go to full version