Ejemplo n.º 1
0
/*!	\param bgnr	Number of background to be used for text.
*	\param bgcnt	Background control flags.
*	\param se0		Base screen entry. This allows a greater range in
*	  capabilities, like offset tile-starts and palettes.
*	\param clrs		Colors to use for the text. The palette entries
*	  used depends on \a se0 and \a bupofs.
*	\param bupofs	Flags for font bit-unpacking. Basically indicates
*	  pixel values (and hence palette use).
*/
void txt_init_se(int bgnr, u16 bgcnt, SCR_ENTRY se0, u32 clrs, u32 bupofs)
{
	REG_BGCNT[bgnr]= bgcnt;
	gptxt->dst0= se_mem[BFN_GET(bgcnt, BG_SBB)];	

	//ASM_CMT("pal");
	// prep palette
	int bpp= (bgcnt&BG_8BPP) ? 8 : 4;
	if(bpp==4)
	{
		// Add shading to my 4bit fonts in an uber-1337 way
		// Are you expected to understand this? 
		//   Nah, didn't think so either :P
		COLOR *palbank= pal_bg_bank[BFN_GET(se0, SE_PALBANK)];
		palbank[(bupofs+1)&15]= clrs&0xFFFF;
		palbank[(bupofs>>4)&15]= clrs>>16;
	}
Ejemplo n.º 2
0
/*!	\param obj0		Pointer to an object buffer to use for the characters.
*	\param attr2	Base attr2. This allows a greater range in
*	  capabilities, like offset tile-starts and palettes. 
*	\param clrs		Colors to use for the text. The palette entries
*	  used depends on \a se0 and \a bupofs.
*	\param bupofs	Flags for font bit-unpacking. Basically indicates
*	  pixel values (and hence palette use).
*/
void txt_init_obj(OBJ_ATTR *obj0, u16 attr2, u32 clrs, u32 bupofs)
{
	gptxt->dst0= (u16*)obj0;
	
	// What the hell am I doing? Shading my 1bpp font :p
	// (A 0xnm offset for a 1-4 bup gives m+1 for the real nybbles 
	//  and n for the empty nybble on its right)
	COLOR *pbank= pal_obj_bank[BFN_GET(attr2, ATTR2_PALBANK)];
	pbank[(bupofs+1)&15]= clrs&0xFFFF;
	pbank[(bupofs>>4)&15]= clrs>>16;
	
	//ASM_CMT("bup");
	// bup the tiles
	//BUP bup= { toncfontTilesLen, 1, 4, bupofs};
	//BitUnPack(toncfontTiles, &tile_mem[4][tileofs], &bup);
	txt_bup_1toX(&tile_mem[4][attr2&ATTR2_ID_MASK], toncfontTiles, 
		toncfontTilesLen, 4, bupofs);
}