コード例 #1
0
ファイル: floorcasting.c プロジェクト: tlepeche/Projets
void	floor_casting(t_env *e)
{
	int start;
	int end;

	init_floor(e);
	start = (HEIGHT + e->wall_h) / 2 + 1;
	start = (start > HEIGHT) ? HEIGHT : start;
	end = HEIGHT;
	while (start <= end)
	{
		e->currentdist = (double)HEIGHT / (double)(2 * start - HEIGHT);
		e->weight = e->currentdist / (double)e->walldist;
		e->cur_floorx = e->weight * e->floorxwall + (1.0 - e->weight) * e->posx;
		e->cur_floory = e->weight * e->floorywall + (1.0 - e->weight) * e->posy;
		e->t_floorx = (int)(e->cur_floorx * 64) % 64;
		e->t_floory = (int)(e->cur_floory * 64) % 64;
		choose_floor(e, start);
		start++;
	}
}
コード例 #2
0
ファイル: main.c プロジェクト: yoskhdia/Racanhack-bcc
/* p[0] = map, p[1] = &player, p[2] = bmap */
task_func floor_load(LPTCB t)
{
	int i, x, y, monscnt, id, bosscnt[2];
	struct _list *room_list;
	LPSPLAYER pl;
	LPSMONSTER mo;
	
	/* floor設定 */
	room_list = init_floor(t->p[0], t->p[2]);
	set_object(&x, &y, room_list, t->p[0], STAIRS);
	set_bmap_smell(t->p[2], x, y, SMELL_ST);
//	show_map2(t->p[2]);
	
	/* player設定 */
	pl = (LPSPLAYER)t->p[1];
	set_object(&x, &y, room_list, t->p[0], PLAYER);
	pl->x = x;
	pl->y = y;
	pl->fturn = 1;
	set_bmap_smell(t->p[2], x, y, SMELL_PL);
	
	/* monster設定 */
	chose_monscnt();
	monscnt = get_monscnt();
//	printf("monscnt: %d\n", monscnt);
	mo = get_mo_p();
	if(read_monster_area(floor_cnt, moarray) == 0){
		int chk;
		LPTCB mt;
		
		bosscnt[0] = bosscnt[1] = 0;
		for(i = 0; i < ENEMY_MAX; i++){
//			printf("%d: %d\n", i, moarray[i]);
			if(moarray[i] > 990000) bosscnt[0]++;
			else if(moarray[i] == 0) break;
			bosscnt[1]++;
		}
		
		/* ボス設定 */
		for(i = 0; i < bosscnt[0]; i++){
			if((chk = read_monster(moarray[i], mo+i)) == -1){
				list_free(room_list);
				game_end();
				return;
			}
			mt = create_monster(create_boss_monster(moarray[i]), get_des(moarray[i]), chk);
			mt->p[1] = t->p[1];
			mt->p[2] = t->p[2];
			
			set_object(&x, &y, room_list, t->p[0], MO_BOSS);
			(mo+i)->x = x;
			(mo+i)->y = y;
			set_bmap_smell(t->p[2], x, y, SMELL_BOSS);
		}
		
		/* 標準/Level monster設定 */
		for(i = bosscnt[0]; i < monscnt; i++){
			id = bosscnt[0] + get_random_range(0, bosscnt[1] - bosscnt[0]);
			if((chk = read_monster(moarray[id], mo+i)) == -1){
				list_free(room_list);
				game_end();
				return;
			}
			mt = create_monster(monster_move1, NULL, chk);
			mt->p[1] = t->p[1];
			mt->p[2] = t->p[2];
/*			printf("id: %d, name: %s, hp: %d, mp: %d, p: %d, d: %d\n",
				id, (mo+i)->name,(mo+i)->hp,(mo+i)->mp,(mo+i)->p,(mo+i)->d);
*/
			set_object(&x, &y, room_list, t->p[0], MONSTER);
			(mo+i)->x = x;
			(mo+i)->y = y;
			set_bmap_smell(t->p[2], x, y, SMELL_MO);
		}
	}
	
	/* キノコ設定 */
	init_mush(t->p[0], room_list);
	
	list_free(room_list);
	t->state = TASK_SLEEP;
}