Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Peculiar problem with draw_mode_trans and rectfill

Credits go to Ceagon Xylas and CGamesPlay for helping out!
This thread is locked; no one can reply to it. rss feed Print
Peculiar problem with draw_mode_trans and rectfill
Jonatan Hedborg
Member #4,886
July 2004
avatar

I made a little prototype of a lighting system i plan to use in a rogue ike-esque game (only not ASCII-graphics). It works just as i want, except that when i remade it so that it draws black rectfill's over tiles (using varying alpha, to let the background show through) i got this odd grid - the borders of the rectfill's seems to be drawn without alpha-checking. Any ideas?
Windows exe, source and tiny image is in the attachment.

(i could probably just circumvent this, but i don't want to use OpenLayer for this, and as it's going to be turn-based, i don't think there should be any major performance issues...)

Thanks

Oh, and i realize the code is a mess, but it's just a simple prototype...

-------
Sweden: Free from the shackles of Democracy since 2008-06-18!

CGamesPlay
Member #2,559
July 2002
avatar

I can't open RAR files, and you can attach more than one file to a post.

Please attach an image and zip of the source.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Ceagon Xylas
Member #5,495
February 2005
avatar

Only from looks, it seems rectfill is a single pixel off (maybe -1,-1) from the tile that was drawn. I'll try and see if I can prove it in the source.

[edit]
The offending line:

rectfill(buffer, x*RECTSIZE, y*RECTSIZE, x*RECTSIZE+RECTSIZE, y*RECTSIZE+RECTSIZE, 0);
//I changed to the following and it seemed to appear correctly:
rectfill(buffer, x*RECTSIZE, y*RECTSIZE, x*RECTSIZE+RECTSIZE-1, y*RECTSIZE+RECTSIZE-1, 0);

Jonatan Hedborg
Member #4,886
July 2004
avatar

i have attached a zip with the source and the tiny image needed.

{"name":"591706","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/4\/243767902ac8f5559cb164a270c03268.jpg","w":823,"h":641,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/4\/243767902ac8f5559cb164a270c03268"}591706
And the image.

Xylas: That does not seem to work. But whats odder is that it worked before, when i did not use blending (only used rectfills with varying shades of grey)

-------
Sweden: Free from the shackles of Democracy since 2008-06-18!

Ceagon Xylas
Member #5,495
February 2005
avatar

Are you certain? Here's what happened when I did it. Perhaps you misread my post or I miscommunicated.
{"name":"591707","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/e\/8eab651a533444976245844ccce6d083.gif","w":806,"h":625,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/e\/8eab651a533444976245844ccce6d083"}591707

Quote:

But whats odder is that it worked before, when i did not use blending (only used rectfills with varying shades of gray)

Well, the reason you'd be getting the lines is the overlap of a semitransparent block with a semitransparent block.

Like:
{"name":"591709","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/3\/d39f780aaf2b8b834c54d8030e36d006.jpg","w":320,"h":200,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/3\/d39f780aaf2b8b834c54d8030e36d006"}591709

Jonatan Hedborg
Member #4,886
July 2004
avatar

Ah! Maybe you are right. It's just a fugly tile :)

And now it's pretty obvious why it happens... Gah.

-------
Sweden: Free from the shackles of Democracy since 2008-06-18!

Go to: