Message-ID: <388492C5.4F7F7540@tiscalinet.it> Date: Tue, 18 Jan 2000 17:20:21 +0100 From: Night Walker X-Mailer: Mozilla 4.7 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Allegro: Again on fast palette and blending.... Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Thanx to Damian Yerrick, but this won't solve my problem: >>I must switch between palette tables quite fast: i must draw 8bpp >>RLE_SPRITE on a truecolor screen, and each sprite has different palette. >Or you could cache them in memory as truecolor before you draw them. >That would be faster. I am working on a Starcraft-like game, and i must be able to draw each unit in a different color, so each unit has a PALETTE array for each player; so i can't cache them, because it would take too much ram (4 times more, isn't it?) and because i have to use the same sprites with different palettes. >>I messed around with Allegro SRC but I found set_pallete() quite >>confusing. >>Passing entire arrays (the PALLETE type) by value as function parameters >>is not slow/unefficent? or are they automatically passed by reference? >>There is a way to simply redirect a pointer to a PALLETE table, thus >>changing palette with only an assignement "="? >>This will let me use blender maps/funx for transparency? >>How can I learn to use them (about this topic ALLEGRO.TXT is not very >>clear for a newbie) >PALETTE is defined as an array of RGB. >Functions that take a PALETTE actually take RGB *, which can be >accessed much the same way. typedef RGB PALETTE[PAL_SIZE]; //is quite ambiguos, but now's ok... >PALETTE pal; >// fill the palette somehow, then >set_palette(pal); /*From GFX.C ============================================== set_pallete_range() */ ... for (c=from; c<=to; c++) { _current_pallete[c] = p[c]; ... if (_color_depth != 8) pallete_color[c] = makecol(_rgb_scale_6[p[c].r], _rgb_scale_6[p[c].g], _rgb_scale_6[p[c].b]); ... //that's not a code i can call every time i must draw a unit!!! //EOF ===================================================== I was thinking about changing _current_pallete from an array to a pointer, fill all the pals i need in arrays and have _current_palette point the array i need, thus changing pal with a single assignement... Will it allow me to use blending? About Blending: Why are needed more than 1 blender func? How can I initialize them for a simple transparency (50%) effect? Thanx for your patience.... :-)))