#4124 - misehert - Wed Mar 19, 2003 9:36 pm
I'm trying to add an animated game intro so the picture (in videobuffer) compresses in from both left and right to leave a vertical line down the middle. I have set this up using several 240x160 data frames and DMA, but the memory of data file is huge - over 1.0meg. Does anyone know a C/(C++) demo with source or a tutorial that shows how to manipulate picture with this type of animation effect?
_________________
Sorry, I'm just a Stoopid Noobie...
thank god for video x 4 - i can see again
#4127 - tepples - Wed Mar 19, 2003 11:13 pm
If you're thinking what I think you're thinking (an effect somewhat similar to that of closing an open book), remember that modes 3-5 can be Mode 7'd. Try increasing parameter 'a' of background 2's affine registers a bit every frame; it'll compress your image toward the left. Then increase 'x_origin' to compensate and keep the image centered.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#4170 - misehert - Fri Mar 21, 2003 11:41 pm
I'm still struggling with this. Some good advice above, and I've tried to read up on Mode 7, but it seems much more advanced for what I'm trying to do, I've been able to get the picture to squeeze in from the right, but I can't seem to move the x origin. Also when it does squeeze from the right it seems to cut in half each time, the x's just control the speed?
[code]DoIntro(void)
{
SetMode( MODE_4 | BG2_ENABLE );
REG_DMA3SAD = (u32)INTROPalette;
REG_DMA3DAD = (u32)BGPaletteMem;
REG_DMA3CNT = 256 | DMA_32NOW;
for (int x = 1; x < 16; x++)
{
REG_DMA3SAD = (u32)INTROData;
REG_DMA3DAD = (u32)VideoBuffer;
REG_DMA3CNT = (160*120) | DMA_32NOW;
Pause(10);
REG_BG2PA = 240 + x*x*x; //from trial and error
REG_BG2X = (-119-x*x)<<8;//can't get this to work to increase x origin
// REG_BG2HOFS = ?????; //or should this be the x origin?
}
}[/code]
#4174 - tepples - Sat Mar 22, 2003 2:40 am
Here's what works for me:
Let wid vary from 4 (collapsed) to 256 (full screen).
Code: |
int pa = 65536 / wid;
REG_BG2PA = pa;
REG_BG2X = (120<<8) - 120*pa;
|
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#4213 - misehert - Sun Mar 23, 2003 9:26 pm
Man, you were right on... how did you ever figure that out? I think I see the bit16 divided by bit 2 to bit 8 range, and the 120 for screen center x, but I'm in awe. Thanks.