Exemplo n.º 1
0
void CAppPalette::initColors()
{
   for (int colorIndex = 0;colorIndex < NumAppColors - 1;colorIndex++)
   {
      setPaletteEntry(colorIndex,getDefaultColor(colorIndex),PC_RESERVED);
   }

   setPaletteEntry(m_editIndex,colorWhite,PC_RESERVED);
}
CVideoDriverPalette3h::CVideoDriverPalette3h(uint8 *emulatedSourceAbsoluteAddress):CVideoDriverPalette(emulatedSourceAbsoluteAddress) {

	glyphs=new uint8[2048];
	FILE *glyphFile;
	glyphFile=fopen("data/font88.raw","r");
	if (glyphFile==NULL) {
		printf("Unable to open glyph file\n");
	} else {
		printf("glyph file opened\n");
	}

	fread(glyphs,2048,1,glyphFile);
	fclose(glyphFile);	

	for (int index=0; index<8; index++) {
		setPaletteEntry(index,(index&1)*127,((index&2)>>1)*127,((index&4)>>2)*127);
		setPaletteEntry(index+8,(index&1)*255,((index&2)>>1)*255,((index&4)>>2)*255);
	}

	// index 8 is dark grey (technically it should be black but that would be wasting a colour)
	setPaletteEntry(8,63,63,63);

	oldBuffer=new uint16[WIDTH_IN_CHARACTERS_3H*HEIGHT_IN_CHARACTERS_3H];
	memset(oldBuffer,0,WIDTH_IN_CHARACTERS_3H*HEIGHT_IN_CHARACTERS_3H*2);
	pageSwitchingEnabled=1;
}
CVideoDriverPalette4h::CVideoDriverPalette4h(uint8 *emulatedSourceAbsoluteAddress):CVideoDriverPalette(emulatedSourceAbsoluteAddress) {

	glyphs=new uint8[2048];
	FILE *glyphFile;
	glyphFile=fopen("data/font88.raw","r");
	if (glyphFile==NULL) {
		printf("Unable to open glyph file\n");
	} else {
		printf("glyph file opened\n");
	}

	fread(glyphs,2048,1,glyphFile);
	fclose(glyphFile);
	
	setPaletteEntry(0,0,0,0);
	setPaletteEntry(1,0,255,255);
	setPaletteEntry(2,255,0,255);
	setPaletteEntry(3,255,255,255);
}
CVideoDriverPaletteComposite::CVideoDriverPaletteComposite(uint8 *emulatedSourceAbsoluteAddress):CVideoDriverPalette(emulatedSourceAbsoluteAddress) {

	int index,index2;
	uint8 *tempPal=new uint8[48];
	uint8 r,g,b;
	glyphs=new uint8[2048];
	FILE *glyphFile;

	glyphFile=fopen("data/font88.raw","r");
	if (glyphFile==NULL) {
		printf("Unable to open glyph file\n");
	} else {
		printf("glyph file opened\n");
	}

	fread(glyphs,2048,1,glyphFile);
	fclose(glyphFile);
	
	tempPal[0]=0;
	tempPal[1]=0;
	tempPal[2]=0;
	tempPal[3]=0;
	tempPal[4]=0x55;
	tempPal[5]=0;
	tempPal[6]=0;
	tempPal[7]=0;
	tempPal[8]=0x55;
	tempPal[9]=0;
	tempPal[10]=0xff;
	tempPal[11]=0xff;
	tempPal[12]=0xaa;
	tempPal[13]=0x55;
	tempPal[14]=0x55;
	tempPal[15]=0xaa;
	tempPal[16]=0xaa;
	tempPal[17]=0xaa;
	tempPal[18]=0xaa;
	tempPal[19]=0;
	tempPal[20]=0xaa;
	tempPal[21]=0x55;
	tempPal[22]=0x55;
	tempPal[23]=0xff;
	tempPal[24]=0xaa;
	tempPal[25]=0;
	tempPal[26]=0;
	tempPal[27]=0;
	tempPal[28]=0xaa;
	tempPal[29]=0;
	tempPal[30]=0xaa;
	tempPal[31]=0xaa;
	tempPal[32]=0x55;
	tempPal[33]=0xaa;
	tempPal[34]=0xff;
	tempPal[35]=0x55;
	tempPal[36]=0xaa;
	tempPal[37]=0x00;
	tempPal[38]=0xaa;
	tempPal[39]=0xff;
	tempPal[40]=0xaa;
	tempPal[41]=0x55;
	tempPal[42]=0xff;
	tempPal[43]=0x55;
	tempPal[44]=0x55;
	tempPal[45]=0xff;
	tempPal[46]=0xff;
	tempPal[47]=0xff;

	for (index=0; index<16; index++) {
		for (index2=0; index2<16; index2++) {
			r=tempPal[index*3]+((tempPal[index2*3]-tempPal[index*3])/2);
			g=tempPal[index*3+1]+((tempPal[index2*3+1]-tempPal[index*3+1])/2);
			b=tempPal[index*3+2]+((tempPal[index2*3+2]-tempPal[index*3+2])/2);
			setPaletteEntry(index*16+index2,r,g,b);
		}
	}

	delete []tempPal;

}