static LICE_IBitmap *loadfunc(const char *filename, bool checkFileName, LICE_IBitmap *bmpbase) { if (checkFileName) { const char *p=filename; while (*p)p++; while (p>filename && *p != '\\' && *p != '/' && *p != '.') p--; if (stricmp(p,".pcx")) return 0; } return LICE_LoadPCX(filename,bmpbase); }
static void setup_materials(pl_Mat **mat) { // create our 3 materials, make the fourth null so that plMatMakeOptPal2() // knows where to stop mat[0] = new pl_Mat; mat[1] = new pl_Mat; mat[2] = new pl_Mat; mat[3] = 0; extern LICE_IBitmap *bmp; // set up material 0 (the ground) mat[0]->Smoothing = true; mat[0]->Lightable=true; mat[0]->Ambient[0] = 0.0; // these calculations are to get the mat[0]->Ambient[1] = 0.0; // distance shading to work right mat[0]->Ambient[2] = 0.0; mat[0]->Diffuse[0] = 1.0; mat[0]->Diffuse[1] = 1.0; mat[0]->Diffuse[2] = 1.0; mat[0]->FadeDist = 10000.0; mat[0]->Texture2 = LICE_LoadPCX("c:\\ground.pcx"); if (!mat[0]->Texture2) { mat[0]->Texture2 = new LICE_MemBitmap(400,400); // LICE_TexGen_Marble(mat[0]->Texture2,NULL,1.0,0.8,0.8,1.0f); LICE_TexGen_Noise(mat[0]->Texture2,NULL,1.0,1.0,1.0,1.0f,NOISE_MODE_WOOD,8); } mat[0]->Texture=mat[0]->Texture2; mat[0]->Texture2=bmp; mat[0]->TexCombineMode=LICE_BLIT_MODE_MUL|LICE_BLIT_FILTER_BILINEAR; mat[0]->Tex2CombineMode=LICE_BLIT_MODE_DODGE|LICE_BLIT_USE_ALPHA|LICE_BLIT_FILTER_BILINEAR; mat[0]->Tex2Scaling[1]= mat[0]->Tex2Scaling[0] = 40.0*LAND_SIZE/50000; mat[0]->TexScaling[1]= mat[0]->TexScaling[0] = 40.0*LAND_SIZE/50000; mat[0]->Tex2MapIdx=0; mat[0]->PerspectiveCorrect = 16; mat[0]->BackfaceIllumination=1.0; // set up material 1 (the sky) mat[1]->Lightable=true; mat[1]->Ambient[0] = 0.4; // these calculations are to get the mat[1]->Ambient[1] = 0.4; // distance shading to work right mat[1]->Ambient[2] = 0.4; mat[1]->Diffuse[0] = 1.0; mat[1]->Diffuse[1] = 1.0; mat[1]->Diffuse[2] = 1.0; mat[1]->FadeDist = 10000.0; mat[1]->Texture = LICE_LoadPCX("c:\\sky.pcx"); mat[1]->TexCombineMode=LICE_BLIT_MODE_MUL; mat[1]->TexScaling[1] = mat[1]->TexScaling[0] = 45.0*LAND_SIZE/50000; mat[1]->PerspectiveCorrect = 32; mat[1]->BackfaceCull=false; mat[1]->BackfaceIllumination=1.0; if (!mat[1]->Texture) { mat[1]->Texture = new LICE_MemBitmap(400,400); LICE_TexGen_Noise(mat[1]->Texture,NULL,0.0,0.0,1.0,1.0f,NOISE_MODE_WOOD,8); } mat[1]->Texture2=bmp; mat[1]->Tex2CombineMode= LICE_BLIT_MODE_HSVADJ|LICE_BLIT_FILTER_BILINEAR|LICE_BLIT_USE_ALPHA; mat[1]->Tex2Scaling[1] = mat[1]->Tex2Scaling[0] = 45.0*LAND_SIZE/50000*0.37; mat[1]->Tex2MapIdx=0; // set up material 2 (the second sky) mat[2]->Lightable=true; mat[2]->Smoothing=false; mat[2]->Ambient[0] = 0.2; // these calculations are to get the mat[2]->Ambient[1] = 0.2; // distance shading to work right mat[2]->Ambient[2] = 0.2; mat[2]->Diffuse[0] = 0.0; mat[2]->Diffuse[1] = 0.0; mat[2]->Diffuse[2] = 0.0; mat[2]->Texture = LICE_LoadPCX("c:\\sky2.pcx"); if (!mat[2]->Texture) { mat[2]->Texture = new LICE_MemBitmap(400,400); LICE_TexGen_Marble(mat[2]->Texture,NULL,0.3,0,0.4,0.4); } mat[2]->TexScaling[0] = mat[2]->TexScaling[1] = 10.0; //200.0*LAND_SIZE/50000; mat[2]->TexCombineMode=LICE_BLIT_MODE_COPY; mat[2]->PerspectiveCorrect = 16; mat[2]->Texture2=bmp; mat[2]->Tex2CombineMode= LICE_BLIT_MODE_HSVADJ|LICE_BLIT_FILTER_BILINEAR|LICE_BLIT_USE_ALPHA; mat[2]->Tex2Scaling[1] = mat[1]->Tex2Scaling[0] = 45.0*LAND_SIZE/50000*3.37; mat[2]->Tex2MapIdx=0; }