当前位置:网站首页>Developing NES games with C language (cc65) 04. Complete background

Developing NES games with C language (cc65) 04. Complete background

2022-07-28 12:28:00 firseve

Paste the CSDN The format is not adjusted , If you want to see a good format, click below

https://happysoul.github.io/nes/nesdoug/

 

Make a full screen background

( remarks : there RLE It is the author who turns the picture into NES You can recognize the loaded map , This is too difficult to translate ...)

 

NES Screen Tool

http://www.romhacking.net/utilities/802/

Local image download

 

 

I wrote another article about BMP File import NES Screen Tool My blog page . here …

https://nesdoug.com/2017/04/22/nes-screen-tool-bmp-import/

( I'll spend time translating later and put it at the end of this article ,BMP Variable mapping )

 

rl3.chr), And I have put my NES Screen tools (.nss) The file is saved as compressed rle file ,“Nametable / Save Nametable and Attributes / RLE Packaging for C head .h”. Now we can import it C Code , And print it to the background .

 

The complete name table is 1024 byte . We cannot perform this operation with the screen open , So turn it off , Then set the starting address , And call rle function .

 

ppu_off();

 

vram_adr(NAMETABLE_A);

 

vram_unrle(Girl3);

 

ppu_on_all();

 

up to now , I forgot to mention the palette . I have to change it to make it brown shadow . I will discuss this in more detail later .pal_bg() Set the color palette of the background .

 

 

https://github.com/nesdoug/04_FullBG/blob/master/fullBG.c

 

https://github.com/nesdoug/04_FullBG

 

adopt neslib We can easily change the brightness of the screen , You can use pal_bright(), Range of values 0-8 ( Corresponding black - white )4 It's normal

 

I borrowed Shiru Of “Chase” A function in the game , This function is very simple and practical .

pal_fade_to(0,4); // Black fades to normal

pal_fade_to(4,0); // From normal color to black

 

If you run fade.nes file , You will see it fade in and out in an infinite loop . Fade in and fade out can be used for transitions , For example, from titles to games , Or from one level to another .

 

https://github.com/nesdoug/05_Fade/blob/master/fade.c

 

https://github.com/nesdoug/05_Fade

 

 


 

 

 

 

NES Screen tools BMP Import

 

Latest version NES Screen Tool Improved BMP Import function . I'm going to have a try .BMP Must be 16 Color or 256 color . In my submission 16 Better color effect .

I found this picture on the Internet . I reduced the image to 256×240.

Use GIMP, I adjusted the saturation , Let him not distort .

 

 

My first attempt was to darken the background , And then convert to NES Color ( I used it before NES Palette makes a custom palette ). then , Images / Pattern / Indexes , And select NES palette . Then my image / Pattern / RBG. Then I image / Pattern / Indexes , Optimize to 16 color . This is ours ......

 

then , I imported NES Screen Tool, Only checked “ The distortion ”. This is what I got .

 

 

Um. , The effect is very poor , Then do it again , Adjust the resolution to 256x240, Sharpening , Darken the background .

 

Images / Pattern / Grayscale , Then the image / Pattern / RGB. Then I chose pencil tool ( Or brushes ), And change its mode to “ Color ” And chose orange , Then recolor the gray image like a two tone .( I also adjusted my level again ).

 

 

Now? ... Images / Pattern / Indexes , choice NES palette . Images / Pattern / RGB. Images / Pattern / Indexes , in the light of 4 Color is optimized . Images / Pattern / RGB. Images / Pattern / Indexes , in the light of 16 Color optimization .( If you have the final 16 Color ,NES Screen Tool It seems to do better ).

 

 

This is it. GIMP What the final version looks like in . Let's start from NES Screen Tool Import BMP( Check only ' The distortion ')......( I am here NES Screen Tool Some blocks have been modified in ).

 

 

A lot better .

 

Next time I will import it as a background , Compress it into RLE file .

原网站

版权声明
本文为[firseve]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/209/202207281126244763.html