示例#1
0
void SGFixedGLState::Init()
{
    for(int i=0; i< NUM_LIGHTS; i++)
    {
        InitLight(i);
    }

    for(int i=0; i<NUM_LIGHTS_ENABLED_AT_START; i++)
    {
        m_light[i]->lightEnabled = true;
    }

    for(int i=0; i<NUM_TEXTURES; i++)
    {
        InitTexture(i);
    }

    InitMaterial();
    InitFog();

    SetLightingEnable(true);
    SetFogEnable(false);
    SetSeparateSpecularColorEnable(false);
    Set2SidedLightingEnable(false);
    
    SetTextureEnable(false);
    SetNormalizeEnable(true);

    m_changeFog = m_changeLight = m_changeMat = m_changeTexture = true;
}
示例#2
0
void Dungeon::LoadDungeon(int floor) //行く予定の階層の情報を読み込むかつ初期化
{
	switch (floor)
	{
	case 1:
		fp = fopen("./dungeon/dungeon1/floor1/map.cns", "r");
		strcpy(dungeon_name, "dungeon1/floor1");
		break;
	case 2:
		fp = fopen("./dungeon/dungeon1/floor2/map.cns", "r");
		strcpy(dungeon_name, "dungeon1/floor2");
		break;
	case 3:
		fp = fopen("./dungeon/dungeon1/floor3/map.cns", "r");
		strcpy(dungeon_name, "dungeon1/floor3");
		break;
	}
	floors = floor;

	//GraphFilter(kabe_handle, DX_GRAPH_FILTER_GAUSS, 32, 55600);

	if (fp == NULL) //エラーチェック
	{
		DrawString(0, 0, "Error!", GetColor(255, 0, 0));
		WaitKey();
	}

	fscanf(fp, "%d,%d", &x_max, &z_max);
	for (int i = 0; i < z_max; i++)
	{
		for (int i2 = 0; i2 < x_max; i2++)
		{
			fscanf(fp, "%d,", &map_data[i][i2]);
			//fscanf(fp, "%c");
		}
	}
	fscanf(fp, "%d,%d", &start_x, &start_z);
	fscanf(fp, "%d", &feel_flag);
	fscanf(fp, "%s", kabe_name);
	fscanf(fp, "%d,%d,%d", &fog_r, &fog_g, &fog_b);
	fscanf(fp, "%f,%f", &fog_start, &fog_goal);

	SetTransColor(255, 255, 255); //白を透過色に
	kabe_handle = LoadGraph(kabe_name);
	SetTransColor(0, 0, 0); //一応戻す


	if (kabe_handle == -1) //エラーチェック
	{
		DrawString(0, 0, "Error!", GetColor(255, 0, 0));
		WaitKey();
	}

	if (feel_flag)
	{
		int keep = 0;
		for (int i = 0; i < z_max / 2; i++)
		{
			for (int i2 = 0; i2 < x_max; i2++)
			{
				keep = map_data[i][i2];
				map_data[i][i2] = map_data[z_max - i - 1][i2];
				map_data[z_max - i - 1][i2] = keep;
			}
		}
	}

	//情報の初期化
	pos_x = start_x;
	pos_z = start_z;
	state = 0;
	time = 0;
	muki = 0;
	nowchoose = 0;
	state = 0;
	minimap_flag = 1;

	//カメラの初期化
	target_camera = VGet(pos_x * 100 + 50, 50, pos_z * 100 + 100);
	player_camera = VGet(pos_x * 100 + 50, 50, pos_z * 100);

	//フォグの設定
	SetFogEnable(TRUE);
	SetFogColor(fog_r, fog_g, fog_b);
	SetFogStartEnd(fog_start, fog_goal);

}