CSets and Transparency

Post Reply
User avatar
ZoriaRPG
ZC Developer
Posts: 67
Joined: Sat Feb 08, 2020 9:42 pm

CSets and Transparency

Post by ZoriaRPG »

Code: Select all

CSet	Behavior	Description	
0	Constant	Used for various GUI items such as status icons.	
1	Constant	Used for various GUI items such as status icons.	
2	Palette		Used for overworld and dungeon graphics such as trees, 
			walls, statues, etc.	
3	Palette		Used for overworld and dungeon graphics such as trees, 
			walls, statues, etc.
4	Palette		Used for overworld and dungeon graphics such as trees, 
			walls, statues, etc.
5	Constant	Used for overworld and dungeon graphics such as trees, 
			walls, statues, etc.	
6	Varies		Used for Link, the "Zelda" Guy and the "Merchant" Guy.	
			Changes when you acquire some items.
7	Constant	Used for sprites, typically blue and red enemies.	
8	Constant	Used for sprites and the remaining Guy and enemies.	
9	Palette		Used for sprites whose colour depends on the level.	 
10	Constant	Generally not used, but available for use by ZC to colour 
			various in-game visual items such as the player minimap 
			position indicator or the flashing compass/boss indicator 
			when the player has the compass.
			(See: Quest > Graphics > Misc Colors).	
11	Constant	Generally not used, but available for use by ZC to colour 
			various in-game UI elements items such as the message text, 
			and other in-game UI elements. 
			(See:  Quest > Graphics > Misc Colors).
12	Constant	Not used by ZC. You can do whatever you want with this CSet.	
13	Varies		Used for Extra Sprite Palettes (ESPs). 
			The last enemy on a screen with an ESP loads its palette 
			to this CSet.
14	VGA/UI		Used for some GUI elements. 
15	DVGA/UI		Used for the overall UI Theme (.ztheme).

TRANSPARENCY

When designing a palette, it is important to consider colours that ZC will blend to
generate translucent effects.

What occurs, is that allegro (the graphics library behind ZC) scans all of the colours
in your present palette, and for any admixture of two, it builds a set of colour blends,
based on the closest colour available in the palette that those two colours produce.

Thus, if you have a palette of all yellow and blue, no transparency effect can create green.
You need some green colours in the current palette for the blending routines to say y+b==g

If you want dark blues, dark greys and so forth, you need to provide some colours in he
palette for Allegro to use as substitutions for normal palette colours when you use
translucent effects.

Thus, it is critical that you reserve space in CSets for some shaded colours, if you want
this to be visually pleasing.

There are 32 colours reserved by e system for UI stuff (CSets 14 and 15; 0xE and 0xF).

These are VGA and DVGA (dark VGA), representing a standard se of VGA colours for UI
elements. As of 2.53.1, the user can edit CSet 0xF, as these colours are used for the theme
for ZQuest and ZC Player.

That technically makes these available to allegro for trans tables, but as these are all
theme-dependent, you can't rely on them for creating these effects

CSet 13 is used for extended sprite palettes, and thus loaded in depending on the enemies
on-screen, and likewise is unreliable for translucent effects.

You want to add shading colours to either constant CSets, or CSets that are based on level:

CSets 0, 1, 5, 7, 8, 10, 11 and 12 are all constant. Place colours that you want for
universal shading into these CSets.

CSets 2, 3, and 4 are loaded by level. Use them for shading colours that you want to use in
specific levels.

CSet 6 is used to draw the player sprite:
Some colours in it swap out depending on items obtained (e.g. red ring), so it is best to avoid it.

CSet 9 is used for enemies with a CSet that changes based on the current level palette.
Thus, this is also not a prudent candidate for translucent colour effects, but it is usable
if needed.

As long as you design your palette around these expectations, you can accomplish very solid effects
with transparent overlays, but you need to create a 'light' and a 'dark' colour for your overworld
and dungeon graphics.

A basic template for CSets might be:


Code: Select all

0x0 Transparent

0x1 Base 1
0x2 Base 2
0x3 Base 3
0x4 Base 4
0x5 Base 5
0x6 Highlight 1
0x7 Highlight 2

0x8 Dark 1
0x9 Dark 2
0xA Dark 3
0xB Dark 4
0xC Dark 5
0xD Dark Highlight 1
0xE Dark Highlight 2

0xF Black


Another Option
Four main colours, with a normal, a light, and a dark 'shade' per each.
This gives you a solid amount of flexibility.
e.g. Green, Brown, Yellow, Blue

Code: Select all

0x0 Transparent

0x1 Base 1 Normal
0x2 Base 2 Normal
0x3 Base 3 Normal
0x4 Base 4 Normal
0x5 Base 1 Dark
0x6 Base 2 Dark
0x7 Base 3 Dark

0x8 Base 4 Dark
0x9 Base 1 Light
0xA Base 2 Light
0xB Base 3 Light
0xC Base 4 Light
0xD Highlight 1
0xE Highlight 2

0xF Black

Post Reply