Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    177
  • comments
    531
  • views
    164019

lkjlkjhfhljklkjlkdhfSPAM

Sign in to follow this  
Scet

166 views

This is what we call bad algorithm design:


void RenderTile4bit(unsigned long X,unsigned long Y,unsigned long &Address,unsigned long Palette[256],unsigned long PaletteIndex,unsigned long Flip){
SrcPntr8=GetPointer8(Address);
switch(Flip){
case 0: LoopStart[2]=0;LoopEnd[2]=8;LoopStep[2]=1;LoopStart[3]=0;LoopEnd[3]=8;LoopStep[3]=1; break;
case 1: LoopStart[2]=0;LoopEnd[2]=8;LoopStep[2]=1;LoopStart[3]=8;LoopEnd[3]=0;LoopStep[3]=0xFFFFFFFF;X--; break;
case 2: LoopStart[2]=8;LoopEnd[2]=0;LoopStep[2]=0xFFFFFFFF;LoopStart[3]=0;LoopEnd[3]=8;LoopStep[3]=1;Y--; break;
case 3: LoopStart[2]=8;LoopEnd[2]=0;LoopStep[2]=0xFFFFFFFF;LoopStart[3]=8;LoopEnd[3]=0;LoopStep[3]=0xFFFFFFFF;X--;Y--; break;
default: break;};
for(unsigned long y=LoopStart[2];y!=LoopEnd[2];y+=LoopStep[2]){
for(unsigned long x=LoopStart[3];x!=LoopEnd[3];x+=LoopStep[3]){
PositionX=X+x;PositionY=Y+y;
if(x%2==0){
if((*SrcPntr8&0x0F)!=0){WritePixel(PositionX,PositionY,Palette[(*SrcPntr8&0x0F)+PaletteIndex]);}}else{
if((*SrcPntr8>>4)!=0){WritePixel(PositionX,PositionY,Palette[(*SrcPntr8>>4)+PaletteIndex]);}
SrcPntr8++;}}}
return;}

void RenderTile8bit(unsigned long X,unsigned long Y,unsigned long &Address,unsigned long Palette[256],unsigned long Flip){
SrcPntr8=GetPointer8(Address);
switch(Flip){
case 0: LoopStart[2]=0;LoopEnd[2]=8;LoopStep[2]=1;LoopStart[3]=0;LoopEnd[3]=8;LoopStep[3]=1; break;
case 1: LoopStart[2]=0;LoopEnd[2]=8;LoopStep[2]=1;LoopStart[3]=8;LoopEnd[3]=0;LoopStep[3]=0xFFFFFFFF;X--; break;
case 2: LoopStart[2]=8;LoopEnd[2]=0;LoopStep[2]=0xFFFFFFFF;LoopStart[3]=0;LoopEnd[3]=8;LoopStep[3]=1;Y--; break;
case 3: LoopStart[2]=8;LoopEnd[2]=0;LoopStep[2]=0xFFFFFFFF;LoopStart[3]=8;LoopEnd[3]=0;LoopStep[3]=0xFFFFFFFF;X--;Y--; break;
default: break;};
for(unsigned long y=LoopStart[2];y!=LoopEnd[2];y+=LoopStep[2]){
for(unsigned long x=LoopStart[3];x!=LoopEnd[3];x+=LoopStep[3]){
PositionX=X+x;PositionY=Y+y;
if(*SrcPntr8!=0){WritePixel(PositionX,PositionY,Palette[*SrcPntr8]); }
SrcPntr8++;}}
return;}








this is what's called better algorithm deisgn:


#define WritePixel(x,y,p) if(p!=0 && (unsigned)x<=255 && (unsigned)y<=255){ScreenMemory[y][x]=Palette

.Colour;}

void RenderTile(long X,long Y,unsigned char *Src,PaletteEntry *Palette,unsigned short Flip,bool Colours){
for(long i=0;i<0x40;i++){
if(bool(Flip&0x0001)){PositionX=(7-(i%8))+X;}else{PositionX=(i%8)+X;}
if(bool(Flip&0x0002)){PositionY=(7-(i/8))+Y;}else{PositionY=(i/8)+Y;}
if(!Colours){
if(i%2==0){
WritePixel(PositionX,PositionY,(*Src&0x0F));}else{
WritePixel(PositionX,PositionY,(*Src>>4));Src++;}
}else{WritePixel(PositionX,PositionY,*Src);Src++;}}
return;}








So I can now display the sprites and maps that where to the left of screen(negative) which has fixed a huge number of graphics problems.

Also after messing with LDR opcode I was ABLE TO RUN A GBA DEMO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!(add a million more !'s)!

HOORAY!!!! REAL PROGRESS!



hmmm I can't find the demo online, it was a plasma demo from gbadev.org. Anyway it runs really slow but at least it works [smile]

I'll keep downloading demos and seeing if I can get them working.

Edit: Also don't froget that Epson is run by Satan and Jebus commands you to boycott them.>
Sign in to follow this  


4 Comments


Recommended Comments

You didn't mention anything about us not being able to complain about your lack of you-know-what, so here goes..


TABS FFS

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!