Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Brightness setting and deficiency in GBA emulators   Message List  
Reply | Forward Message #14351 of 15019 |
I've been trying to use the GBA hardware's special effects to adjust the
brightness of selected sprites.

I've got a demo that works exactly as I'd hoped on VisualBoy Advance v1.5.1
(in that only the selected sprites have their brightness changed) but on the
real hardware all the sprites brightnesses change. It does different things
again on BoycottAdvance v0.2.8. I've put up the binary demonstrating this
online at:

http://www.davidsharp.com/brighttest.zip

The relevant samples of source code are below, I've stripped out large parts
of it to get down to the bare bones. Can anyone tell me if what I'm trying
to do is possible and if so where I'm going wrong?

I'm quite prepared to believe I'm doing something silly which is normally
not sensible and that's why the emulators don't handle it correctly.



// enable display
REG_BG1CNT = 0x4084;
REG_BG1HOFS = 0;
REG_BG1VOFS = 0;
SetMode(SCREENMODE1 | BG1ENABLE | OBJENABLE | OBJMAP1D );

// load tiled background and set up sprites on display as shown in PERN
tutorial, set sprites up as follows
// sprites[spriteNumber].attribute0 = COLOR_256 | y | SQUARE;
// sprites[spriteNumber].attribute1 = SIZE_16 | x;
// sprites[spriteNumber].attribute2 = charNumber;
// copy all sprite data to OAM

// select targets of colour FX
REG_BLDMOD = 0x1090; // bit 4 - use OBJ as 1st target, bit 7 - change
brightness, set bit 12 to say that OBJ is second target too (has no obvious
effect)

// set all the sprites in the top row to be the ones fading
int sprCount;
for(sprCount = OAM_LETTERS; sprCount < firstSpriteOfInstructions;
sprCount++)
{
sprites[sprCount].attribute0 &= ~(0xC00); // clear OBJ mode flag to
ensure Normal OBJ mode
sprites[sprCount].attribute0 |= 1 << 10; // set to semi-transparent mode
}

// set the bottom words to be the ones stuck not fading
for(sprCount = firstSpriteOfInstructions; sprCount < spriteNum; sprCount++)
{
sprites[sprCount].attribute0 &= ~(0xC00); // clear OBJ mode flag to
ensure Normal OBJ mode
}

copyAllOAM();

// set brightness to approx halfway between normal and white
REG_COLEY = 8;




Cheers
Dave





Mon Jun 9, 2003 10:01 pm

davesharp2002
Offline Offline
Send Email Send Email

Forward
Message #14351 of 15019 |
Expand Messages Author Sort by Date

I've been trying to use the GBA hardware's special effects to adjust the brightness of selected sprites. I've got a demo that works exactly as I'd hoped on...
David Sharp
davesharp2002
Offline Send Email
Jun 10, 2003
12:12 am

The problem with VisualBoyAdvance was that I had the Disable SFX option ticked on the video menu. Now I've got it matching the real hardware, I'm still curious...
David Sharp
davesharp2002
Offline Send Email
Jun 10, 2003
8:27 am

I think you have the blend flag backwards -- if you set it in REG_BLDMOD, it affects all sprites no matter if the blend flag is set for the sprite. Don't set...
Dennis Munsie
bea_dennis
Offline Send Email
Jun 10, 2003
6:56 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help