Door Games Unlimited

Welcome, Guest.


Subject: Sprites and scrolling and BINs Date: Fri Jan 09 2015 17:55:06
From: echicken To: Kirkman

  Re: Sprites and scrolling and BINs
  By: Kirkman to All on Fri Jan 09 2015 15:00:36

 Ki> But I still don't understand the color values stored by
 Ki> frame.data[x][y].attr. In my case, I'm using green as the mask. What I
 Ki> have found is that if I load an ANSI image into the frame, the .attr for
 Ki> green characters is usually "2". But if I load the same image in BIN
 Ki> format, suddenly the green characters are "514." Why should these numbers
 Ki> be different? I don't get it.

I see that MCMLXXIX has already responded, but just thought I'd add a note:

If you look in sbbsdefs.js where the attributes are defined, you'll see, among
others:

GREEN = 2;
BG_BLACK = 0x200;

If you OR the values of GREEN and BG_BLACK:

var attr = 0x200|2;

You will find that attr == 514.

When you load a .ans into a frame, it likely contains sequences intended to
change the terminal's current colour attributes.  When Frame is parsing a .ans,
it keeps track of what the current attributes are, so they carry over from one
cell to the next.

However in a .bin file, each character is paired with an attribute, and Frame
should (arguably) be setting the attribute of each cell to the value read from
the file.  Evidently it doesn't do this, and the default attribute for the
frame is being applied (as MCMLXXIX explained.)  This may be by design, perhaps
it's necessary for transparency or helpful in some other situation.

---
echicken
electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
 ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com

Previous Message       Next Message
In Reply To: Sprites and scrolling and BINs (Kirkman)
Replies: Sprites and scrolling and BINs (MCMLXXIX)