Example #1
0
struct entity* entity_init()
{
	char buffer[2] = {0};
	struct entity *ent = (struct entity*)malloc(sizeof(struct entity));
	entity_count++;
	sprintf(buffer, "%d", entity_count);
	strcat(ent->name, BASE_NAME);
	//strcat(ent->name, buffer);
	ent->gid = 0;
	ent->active = 0;
	ent->position = (struct vector2*)malloc(sizeof(struct vector2));
	set_vector2(ent->position, 0, 0);
	ent->prev_position = ent->position;
    ent->dimension = (struct vector2*)malloc(sizeof(struct vector2));
    set_vector2(ent->dimension, 0, 0);
	return ent;
}
Example #2
0
/*
 * set_M30620FCAFP(OAKS16)用のベクトルを設定する
 */
static void set_M30620FCAFP(FILE* pfo, int no, int m)
{
#ifdef OAKS16_JSP13
	struct VEC *v;
	int x;
#endif /* OAKS16_JSP13 */
	int i;

#ifdef OAKS16_JSP13
	if(no == 2){
		set_global(pfo, in_portid);
		set_global(pfo, out_portid);
		fputs(lf, pfo);
		fputs(func01, pfo);
		fputs(lf, pfo);
		fputs("_", pfo);
		fputs(in_portid, pfo);
		fputs(":", pfo);
		fputs(lf, pfo);
		fputs(func02, pfo);
		fputs(lf, pfo);
		fputs("_", pfo);
		fputs(out_portid, pfo);
		fputs(":", pfo);
		fputs(lf, pfo);
		fputs(func02, pfo);
		fputs(lf, pfo);
		fputs(lf, pfo);
		v = &vec_table[0][0];
		for(i = x = 0 ; i < num_vec[0] ; i++, v++){
			if(v->no >= 17 && v->no < 21){
				x = 1;
				break;
			}
		}
		if(x){
			fputs(func03, pfo);
			fputs(lf, pfo);
			v = &vec_table[0][0];
			for(i = x = 0 ; i < num_vec[0] ; i++, v++){
				if(v->no == 17 || v->no == 19){
					fputs(out_handler, pfo);
					fputs("1:", pfo);
					fputs(lf, pfo);
					fputs("\tmov.w\t#1, _", pfo);
					fputs(out_portid, pfo);
					fputs(lf, pfo);
					fputs("\tjmp\t_", pfo);
					fputs(v->no_label, pfo);
					fputs(lf, pfo);
					fputs(out_handler, pfo);
					fputs("2:", pfo);
					fputs(lf, pfo);
					fputs("\tmov.w\t#2, _", pfo);
					fputs(out_portid, pfo);
					fputs(lf, pfo);
					fputs("\tjmp\t_", pfo);
					fputs(v->no_label, pfo);
					fputs(lf, pfo);
					break;
				}
			}
			v = &vec_table[0][0];
			for(i = x = 0 ; i < num_vec[0] ; i++, v++){
				if(v->no == 18 || v->no == 20){
					fputs(in_handler, pfo);
					fputs("1:", pfo);
					fputs(lf, pfo);
					fputs("\tmov.w\t#1, _", pfo);
					fputs(in_portid, pfo);
					fputs(lf, pfo);
					fputs("\tjmp\t_", pfo);
					fputs(v->no_label, pfo);
					fputs(lf, pfo);
					fputs(in_handler, pfo);
					fputs("2:", pfo);
					fputs(lf, pfo);
					fputs("\tmov.w\t#2, _", pfo);
					fputs(in_portid, pfo);
					fputs(lf, pfo);
					fputs("\tjmp\t_", pfo);
					fputs(v->no_label, pfo);
					fputs(lf, pfo);
					break;
				}
			}
		}
	}
#endif /* OAKS16_JSP13 */

	set_comment(pfo, int_vec);
	fputs("\t.section\tvvector", pfo);
	fputs(lf, pfo);
	set_org(pfo, "VECTOR_ADR");
	for(i = 0 ; i < MAX_INT ; i++){
		if(no == 2){
			if(i >= 17 && i < 21)
				set_vector2(pfo, INT_STATE, i);
			else
				set_vector(pfo, INT_STATE, i);
		}
		else
			set_vector(pfo, INT_STATE, i);
	}
}