예제 #1
0
void outdoor_record_type::port()
{
	int i,j;
	
	for (i = 0; i < 48; i++)
		for (j = 0; j < 48; j++)
			flip_short(&terrain[i][j]);
	for (i = 0; i < NUM_OUT_PLACED_SPECIALS; i++) 
		flip_rect(&special_rects[i]);
	for (i = 0; i < NUM_OUT_PLACED_SPECIALS; i++) 
		flip_short(&spec_id[i]);
	for (i = 0; i < 8; i++) 
		flip_rect(&exit_rects[i]);
	for (i = 0; i < 8; i++) 
		flip_short(&exit_dests[i]);
	for (i = 0; i < 4; i++) {
		wandering[i].port();
		special_enc[i].port();
		}
	for (i = 0; i < 8; i++) {
		preset[i].port();		
		}
	for (i = 0; i < 8; i++) 
		flip_rect(&info_rect[i]);
	flip_short(&is_on_surface);
	for (i = 0; i < 10; i++) 
		flip_short(&extra[i]);

}
예제 #2
0
void flip_rect(macRECT *s)
{
	flip_short(&(s->top));
	flip_short(&(s->bottom));
	flip_short(&(s->left));
	flip_short(&(s->right));
}
예제 #3
0
void outdoor_record_type::port()
{
	short i,j;
	
	for (i = 0; i < OUTDOOR_SIZE; i++)
		for (j = 0; j < OUTDOOR_SIZE; j++)
			flip_short(&terrain[i][j]);
	for (i = 0; i < NUM_OUT_PLACED_SPECIALS; i++) 
		flip_rect(&special_rects[i]);
	for (i = 0; i < NUM_OUT_PLACED_SPECIALS; i++) 
		flip_short(&spec_id[i]);
	for (i = 0; i < NUM_OUT_TOWN_ENTRANCES; i++) 
		flip_rect(&exit_rects[i]);
	for (i = 0; i < NUM_OUT_TOWN_ENTRANCES; i++) 
		flip_short(&exit_dests[i]);
	for (i = 0; i < 4; i++) {
		wandering[i].port();
		special_enc[i].port();
	}
	for (i = 0; i < 8; i++)
		preset[i].port();
	for (i = 0; i < NUM_OUT_DESCRIPTION_AREAS; i++)
		flip_rect(&info_rect[i]);
	flip_short(&is_on_surface);
	for (i = 0; i < 10; i++) 
		flip_short(&extra[i]);
}
예제 #4
0
void flip_rect(Rect *s)
{
	flip_short((short *) &(s->top));
	flip_short((short *) &(s->bottom));
	flip_short((short *) &(s->left));
	flip_short((short *) &(s->right));
	if(!cur_scen_is_mac) alter_rect(s);
}
예제 #5
0
void port_item_list(legacy::scen_item_data_type* old){
	short i;
	
	if (cur_scen_is_mac != mac_is_intel)
		return;
	
	for (i = 0; i < 400; i++) {
		flip_short(&(old->scen_items[i].variety));
		flip_short(&(old->scen_items[i].item_level));
		flip_short(&(old->scen_items[i].value));
	}
}
예제 #6
0
void tiny_tr_type::port()
{
	for (short i = 0; i < 32; i++){
		for (short j = 0; j < 32; j++){ 
			flip_short(&terrain[i][j]);
		}
	}
}
예제 #7
0
void big_tr_type::port()
{
	for (short i = 0; i < 64; i++){
		for (short j = 0; j < 64; j++){
			flip_short(&terrain[i][j]);
		}
	}
}
예제 #8
0
void ave_tr_type::port()
{
	for (short i = 0; i < 48; i++){
		for (short j = 0; j < 48; j++){ 
			flip_short(&terrain[i][j]);
		}
	}
}
예제 #9
0
void port_talk_nodes(legacy::talking_record_type* dummy_talk_ptr)
{
	short i;
	
	if (cur_scen_is_mac != mac_is_intel)
		return;
	for (i = 0; i < 60; i++) {
		flip_short(&dummy_talk_ptr->talk_nodes[i].personality);
		flip_short(&dummy_talk_ptr->talk_nodes[i].type);
		flip_short(&dummy_talk_ptr->talk_nodes[i].extras[0]);
		flip_short(&dummy_talk_ptr->talk_nodes[i].extras[1]);
		flip_short(&dummy_talk_ptr->talk_nodes[i].extras[2]);
		flip_short(&dummy_talk_ptr->talk_nodes[i].extras[3]);
	}
}
예제 #10
0
void port_tiny_t(legacy::tiny_tr_type* old)
{
	short i;
	if (cur_scen_is_mac != mac_is_intel)
		return;
	
	for (i =0 ; i < 16; i++) 
		flip_rect(&old->room_rect[i]);
	for (i =0 ; i < 30; i++) {
		flip_short(&old->creatures[i].spec1);
		flip_short(&old->creatures[i].spec2);
		flip_short(&old->creatures[i].monster_time);
		flip_short(&old->creatures[i].personality);
		flip_short(&old->creatures[i].special_on_kill);
		flip_short(&old->creatures[i].facial_pic);
	} 
}
예제 #11
0
void boat_record_type::port(){
	flip_short(&which_town);
}
예제 #12
0
void town_record_type::port()
{	
	short i,j;
	
	for (i = 0; i < 4; i++)
		for (j = 0; j < 6; j++)
			flip_short(&respawn_monsts[i][j]);
	for (i = 0; i < NUM_TOWN_PLACED_SPECIALS; i++)
		flip_rect(&special_rects[i]);
	flip_short(&lighting);
	flip_rect(&in_town_rect);
	for (i = 0; i < NUM_TOWN_PLACED_ITEMS; i++)
		preset_items[i].port();
	for (i = 0; i < NUM_TOWN_PLACED_FIELDS; i++)
		preset_fields[i].port();
	
	flip_short(&wall_1_sheet);
	flip_short(&wall_1_height);
	flip_short(&wall_2_height);
	flip_short(&wall_2_sheet);
	flip_short(&cliff_sheet);
	flip_short(&beam_type);
	flip_short(&environmental_sound);
	flip_short(&is_on_surface);
	flip_short(&town_kill_day);
	flip_short(&town_linked_event);
	flip_short(&external_floor_type);
	flip_short(&monster_respawn_chance);
	
	for (i =0 ; i < NUM_TER_SCRIPTS; i++) 
		ter_scripts[i].port();
	for (i = 0; i < NUM_TOWN_DESCRIPTION_AREAS; i++)
		flip_rect(&room_rect[i]);
	for (i = 0; i < NUM_TOWN_PLACED_CREATURES; i++) 
		creatures[i].port();
	
	for (i =0 ; i < 20; i++) 
		flip_short(&extra[i]);
	for (i =0 ; i < 4; i++) 
		flip_short(&exit_specs[i]);
	
	flip_short(&spec_on_entry);
	flip_short(&spec_on_entry_if_dead);
}
예제 #13
0
void port_out(legacy::outdoor_record_type *out)
{
	short i;
	
	if (cur_scen_is_mac != mac_is_intel)
		return;
	
	for (i = 0; i < 4; i++) {
		flip_short(&(out->wandering[i].spec_on_meet));
		flip_short(&(out->wandering[i].spec_on_win));
		flip_short(&(out->wandering[i].spec_on_flee));
		flip_short(&(out->wandering[i].cant_flee));
		flip_short(&(out->wandering[i].end_spec1));
		flip_short(&(out->wandering[i].end_spec2));
		flip_short(&(out->special_enc[i].spec_on_meet));
		flip_short(&(out->special_enc[i].spec_on_win));
		flip_short(&(out->special_enc[i].spec_on_flee));
		flip_short(&(out->special_enc[i].cant_flee));
		flip_short(&(out->special_enc[i].end_spec1));
		flip_short(&(out->special_enc[i].end_spec2));	
	}
	for (i = 0; i < 8; i++) 
		flip_rect(&(out->info_rect[i]));
	for (i = 0; i < 60; i++) 
		flip_spec_node(&(out->specials[i]));
}
예제 #14
0
void preset_field_type::port()
{
	flip_short(&field_type);
}
예제 #15
0
void in_town_on_ter_script_type::port()
{
	flip_short(&exists);
	for (short i = 0; i < 10; i++)
		flip_short(&memory_cells[i]);
}
예제 #16
0
void creature_start_type::port()
{
	flip_short(&number);
	flip_short(&facing);
	flip_short(&start_attitude);
	flip_short(&personality);
	flip_short(&extra_item);
	flip_short(&extra_item_2);
	flip_short(&extra_item_chance_1);
	flip_short(&extra_item_chance_2);
	flip_short(&hidden_class);
	flip_short(&character_id);
	flip_short(&time_flag);
	flip_short(&creature_time);
	flip_short(&attached_event);
	flip_short(&unique_char);
	flip_short(&act_at_distance);
	for (short i = 0; i < 10; i++)
		flip_short(&memory_cells[i]);
	
	for (short i = 0; i < 4; i++)
		flip_short(&extra[i]);
}
예제 #17
0
void item_type::port()
{
	flip_short(&which_item);
}
예제 #18
0
void out_wandering_type::port()
{
	short i;
	
	for (i = 0; i < 4; i++) {
		flip_short(&hostile[i]);
		flip_short(&hostile_amount[i]);
	}
	for (i = 0; i < 3; i++) {
		flip_short(&friendly[i]);
		flip_short(&friendly_amount[i]);
	}
	flip_short(&cant_flee);
	flip_short(&end_spec1);
	flip_short(&end_spec2);
	flip_short(&killed_flag1);
	flip_short(&killed_flag2);
	flip_short(&forced);
	flip_short(&check_every_turn);
	flip_short(&move_type);
	flip_short(&start_state_when_encountered);
	flip_short(&start_state_when_defeated);
	flip_short(&start_state_when_fled);
	flip_short(&random_move_chance);
}
예제 #19
0
void port_party(legacy::party_record_type* old){
	int i,j,k;
	flip_long(&old->age);
	flip_short(&old->gold);
	flip_short(&old->food);
	flip_short(&old->light_level);
	for(i = 0; i < 30; i++){
		flip_short(&old->boats[i].which_town);
		flip_short(&old->horses[i].which_town);
		flip_short(&old->party_event_timers[i]);
		flip_short(&old->global_or_town[i]);
		flip_short(&old->node_to_call[i]);
	}
	for(i = 0; i < 4; i++){
		flip_short(&old->creature_save[i].which_town);
		flip_short(&old->creature_save[i].friendly);
		for(j = 0; j < 60; j++){
			flip_short(&old->creature_save[i].dudes[j].active);
			flip_short(&old->creature_save[i].dudes[j].attitude);
			flip_short(&old->creature_save[i].dudes[j].m_d.health);
			flip_short(&old->creature_save[i].dudes[j].m_d.m_health);
			flip_short(&old->creature_save[i].dudes[j].m_d.mp);
			flip_short(&old->creature_save[i].dudes[j].m_d.max_mp);
			for(k = 0; k < 3; k++)
				flip_short(&old->creature_save[i].dudes[j].m_d.a[k]);
			flip_short(&old->creature_save[i].dudes[j].m_d.morale);
			flip_short(&old->creature_save[i].dudes[j].m_d.m_morale);
			flip_short(&old->creature_save[i].dudes[j].m_d.corpse_item);
			flip_short(&old->creature_save[i].dudes[j].m_d.corpse_item_chance);
			for(k = 0; k < 15; k++)
				flip_short(&old->creature_save[i].dudes[j].m_d.status[k]);
			flip_short(&old->creature_save[i].dudes[j].m_d.picture_num);
			flip_short(&old->creature_save[i].dudes[j].summoned);
			flip_short(&old->creature_save[i].dudes[j].monst_start.spec1);
			flip_short(&old->creature_save[i].dudes[j].monst_start.spec2);
			flip_short(&old->creature_save[i].dudes[j].monst_start.monster_time);
			flip_short(&old->creature_save[i].dudes[j].monst_start.personality);
			flip_short(&old->creature_save[i].dudes[j].monst_start.special_on_kill);
			flip_short(&old->creature_save[i].dudes[j].monst_start.facial_pic);
		}
		flip_short(&old->imprisoned_monst[i]);
	}
	flip_short(&old->in_boat);
	flip_short(&old->in_horse);
	for(i = 0; i < 10; i++){
		flip_short(&old->out_c[i].direction);
		flip_short(&old->out_c[i].what_monst.spec_on_meet);
		flip_short(&old->out_c[i].what_monst.spec_on_win);
		flip_short(&old->out_c[i].what_monst.spec_on_flee);
		flip_short(&old->out_c[i].what_monst.cant_flee);
		flip_short(&old->out_c[i].what_monst.end_spec1);
		flip_short(&old->out_c[i].what_monst.end_spec2);
	}
	for(i = 0; i < 5; i++)
		for(j = 0; j < 10; j++){
			flip_short(&old->magic_store_items[i][j].variety);
			flip_short(&old->magic_store_items[i][j].item_level);
			flip_short(&old->magic_store_items[i][j].value);
		}
	for(i = 0; i < 50; i++)
		flip_short(&old->journal_day[i]);
	for(i = 0; i < 140; i++){
		flip_short(&old->special_notes_str[i][0]);
		flip_short(&old->special_notes_str[i][1]);
	}
	for(i = 0; i < 120; i++){
		flip_short(&old->talk_save[i].personality);
		flip_short(&old->talk_save[i].town_num);
		flip_short(&old->talk_save[i].str1);
		flip_short(&old->talk_save[i].str2);
	}
	flip_short(&old->direction);
	flip_short(&old->at_which_save_slot);
	for(i = 0; i < 100; i++)
		flip_short(&old->key_times[i]);
	for(i = 0; i < 200; i++)
		flip_short(&old->m_killed[i]);
	flip_long(&old->total_m_killed);
	flip_long(&old->total_dam_done);
	flip_long(&old->total_xp_gained);
	flip_long(&old->total_dam_taken);
}
예제 #20
0
void port_scenario(legacy::scenario_data_type* temp_scenario)
{
	short i,j;
	
	if (cur_scen_is_mac != mac_is_intel)
		return;
	flip_short(&temp_scenario->flag_a);
	flip_short(&temp_scenario->flag_b);
	flip_short(&temp_scenario->flag_c);
	flip_short(&temp_scenario->flag_d);
	flip_short(&temp_scenario->flag_e);
	flip_short(&temp_scenario->flag_f);
	flip_short(&temp_scenario->flag_g);
	flip_short(&temp_scenario->flag_h);
	flip_short(&temp_scenario->flag_i);
	flip_short(&temp_scenario->intro_mess_pic);
	flip_short(&temp_scenario->intro_mess_len);
	flip_short(&temp_scenario->which_town_start);
	for (i = 0; i < 200; i++)
		for (j = 0; j < 5; j++)
			flip_short(&temp_scenario->town_data_size[i][j]);
	for (i = 0; i < 10; i++)
		flip_short(&temp_scenario->town_to_add_to[i]);
	for (i = 0; i < 10; i++)
		for (j = 0; j < 2; j++)
			flip_short(&temp_scenario->flag_to_add_to_town[i][j]);
	for (i = 0; i < 100; i++)
		for (j = 0; j < 2; j++)
			flip_short(&temp_scenario->out_data_size[i][j]);
	for (i = 0; i < 3; i++)
		flip_rect(&temp_scenario->store_item_rects[i]);
	for (i = 0; i < 3; i++)
		flip_short(&temp_scenario->store_item_towns[i]);
	for (i = 0; i < 50; i++)
		flip_short(&temp_scenario->special_items[i]);
	for (i = 0; i < 50; i++)
		flip_short(&temp_scenario->special_item_special[i]);
	flip_short(&temp_scenario->rating);
	flip_short(&temp_scenario->uses_custom_graphics);
	for (i = 0; i < 256; i++) {
		flip_short(&temp_scenario->scen_monsters[i].health);
		flip_short(&temp_scenario->scen_monsters[i].m_health);
		flip_short(&temp_scenario->scen_monsters[i].max_mp);
		flip_short(&temp_scenario->scen_monsters[i].mp);
		flip_short(&temp_scenario->scen_monsters[i].a[1]);
		flip_short(&temp_scenario->scen_monsters[i].a[0]);
		flip_short(&temp_scenario->scen_monsters[i].a[2]);
		flip_short(&temp_scenario->scen_monsters[i].morale);
		flip_short(&temp_scenario->scen_monsters[i].m_morale);
		flip_short(&temp_scenario->scen_monsters[i].corpse_item);
		flip_short(&temp_scenario->scen_monsters[i].corpse_item_chance);
		flip_short(&temp_scenario->scen_monsters[i].picture_num);
	}
	
	for (i = 0; i < 256; i++) {
		flip_short(&temp_scenario->ter_types[i].picture);
	}
	for (i = 0; i < 30; i++) {
		flip_short(&temp_scenario->scen_boats[i].which_town);
	}
	for (i = 0; i < 30; i++) {
		flip_short(&temp_scenario->scen_horses[i].which_town);
	}
	for (i = 0; i < 20; i++) 
		flip_short(&temp_scenario->scenario_timer_times[i]);
	for (i = 0; i < 20; i++) 
		flip_short(&temp_scenario->scenario_timer_specs[i]);
	for (i = 0; i < 256; i++) {
		flip_spec_node(&temp_scenario->scen_specials[i]);
	}
	for (i = 0; i < 10; i++)  {
		flip_short(&temp_scenario->storage_shortcuts[i].ter_type);
		flip_short(&temp_scenario->storage_shortcuts[i].property);
		for (j = 0; j < 10; j++)  {
			flip_short(&temp_scenario->storage_shortcuts[i].item_num[j]);
			flip_short(&temp_scenario->storage_shortcuts[i].item_odds[j]);
		}
	}
	flip_short(&temp_scenario->last_town_edited);
}
예제 #21
0
void port_pc(legacy::pc_record_type* old){
	int i;
	flip_short(&old->main_status);
	for(i = 0; i < 30; i++)
		flip_short(&old->skills[i]);
	flip_short(&old->max_health);
	flip_short(&old->cur_health);
	flip_short(&old->max_sp);
	flip_short(&old->cur_sp);
	flip_short(&old->experience);
	flip_short(&old->skill_pts);
	flip_short(&old->level);
	for(i = 0; i < 15; i++)
		flip_short(&old->status[i]);
	for(i = 0; i < 10; i++){
		flip_short(&old->items[i].variety);
		flip_short(&old->items[i].item_level);
		flip_short(&old->items[i].value);
	}
	flip_short(&old->which_graphic);
	flip_short(&old->weap_poisoned);
	flip_short(&old->race);
	flip_short(&old->exp_adj);
	flip_short(&old->direction);
}
예제 #22
0
void port_c_town(legacy::current_town_type* old){
	int i,j;
	flip_short(&old->town_num);
	flip_short(&old->difficulty);
	port_town(&old->town);
	flip_short(&old->monst.which_town);
	flip_short(&old->monst.friendly);
	for(j = 0; j < 60; j++){
		flip_short(&old->monst.dudes[j].active);
		flip_short(&old->monst.dudes[j].attitude);
		flip_short(&old->monst.dudes[j].m_d.health);
		flip_short(&old->monst.dudes[j].m_d.m_health);
		flip_short(&old->monst.dudes[j].m_d.mp);
		flip_short(&old->monst.dudes[j].m_d.max_mp);
		for(i = 0; i < 3; i++)
			flip_short(&old->monst.dudes[j].m_d.a[i]);
		flip_short(&old->monst.dudes[j].m_d.morale);
		flip_short(&old->monst.dudes[j].m_d.m_morale);
		flip_short(&old->monst.dudes[j].m_d.corpse_item);
		flip_short(&old->monst.dudes[j].m_d.corpse_item_chance);
		for(i = 0; i < 15; i++)
			flip_short(&old->monst.dudes[j].m_d.status[i]);
		flip_short(&old->monst.dudes[j].m_d.picture_num);
		flip_short(&old->monst.dudes[j].summoned);
		flip_short(&old->monst.dudes[j].monst_start.spec1);
		flip_short(&old->monst.dudes[j].monst_start.spec2);
		flip_short(&old->monst.dudes[j].monst_start.monster_time);
		flip_short(&old->monst.dudes[j].monst_start.personality);
		flip_short(&old->monst.dudes[j].monst_start.special_on_kill);
		flip_short(&old->monst.dudes[j].monst_start.facial_pic);
	}
}
예제 #23
0
void flip_spec_node(legacy::special_node_type *spec)
{
	flip_short(&(spec->type));
	flip_short(&(spec->sd1));
	flip_short(&(spec->sd2));
	flip_short(&(spec->pic));
	flip_short(&(spec->m1));
	flip_short(&(spec->m2));
	flip_short(&(spec->ex1a));
	flip_short(&(spec->ex1b));
	flip_short(&(spec->ex2a));
	flip_short(&(spec->ex2b));
	flip_short(&(spec->jumpto));
}
예제 #24
0
void port_dummy_t_d(short size,char *buffer)
{
	short i;
	legacy::big_tr_type *d1;
	legacy::ave_tr_type *d2;
	legacy::tiny_tr_type *d3;
	
	if (cur_scen_is_mac != mac_is_intel)
		return;
	
	switch (size) {
		case 0:
			d1 = (legacy::big_tr_type *) buffer;
			for (i =0 ; i < 16; i++) 
				flip_rect(&d1->room_rect[i]);
			for (i =0 ; i < 60; i++) {
				flip_short(&d1->creatures[i].spec1);
				flip_short(&d1->creatures[i].spec2);
				flip_short(&d1->creatures[i].monster_time);
				flip_short(&d1->creatures[i].personality);
				flip_short(&d1->creatures[i].special_on_kill);
				flip_short(&d1->creatures[i].facial_pic);
			}
			break;
			case 1:
			d2 = (legacy::ave_tr_type *) buffer;
			for (i =0 ; i < 16; i++) 
				flip_rect(&d2->room_rect[i]);
			for (i =0 ; i < 40; i++) {
				flip_short(&d2->creatures[i].spec1);
				flip_short(&d2->creatures[i].spec2);
				flip_short(&d2->creatures[i].monster_time);
				flip_short(&d2->creatures[i].personality);
				flip_short(&d2->creatures[i].special_on_kill);
				flip_short(&d2->creatures[i].facial_pic);
			}
			break;
			case 2:
			d3 = (legacy::tiny_tr_type *) buffer;
			for (i =0 ; i < 16; i++) 
				flip_rect(&d3->room_rect[i]);
			for (i =0 ; i < 30; i++) {
				flip_short(&d3->creatures[i].spec1);
				flip_short(&d3->creatures[i].spec2);
				flip_short(&d3->creatures[i].monster_time);
				flip_short(&d3->creatures[i].personality);
				flip_short(&d3->creatures[i].special_on_kill);
				flip_short(&d3->creatures[i].facial_pic);
			}
			break;
	} 
}
예제 #25
0
void scenario_data_type::port()
{	
	short i,j;
	
	flip_short(&out_width);
	flip_short(&out_height);
	flip_short(&min_level);
	flip_short(&max_level);
	flip_short(&rating);
	flip_short(&scen_label_pic);
	flip_short(&intro_pic_resources[0]);
	flip_short(&intro_pic_resources[1]);
	flip_short(&intro_pic_resources[2]);
	flip_short(&start_in_what_town);
	
	for (i = 0; i < 10; i++)  {
		flip_short(&town_to_add_to[i]);
		flip_short(&flag_to_add_to_town[i][0]);
		flip_short(&flag_to_add_to_town[i][1]);
		
		flip_short(&storage_shortcuts[i].ter_type);
		flip_short(&storage_shortcuts[i].property);
		for (j = 0; j < 10; j++)  {
			flip_short(&storage_shortcuts[i].item_num[j]);
			flip_short(&storage_shortcuts[i].item_odds[j]);
		}
	}
	
	for (i = 0; i < 30; i++)  {
		scen_boats[i].port();
		scen_horses[i].port();
	}
	
	flip_short(&last_town_edited);	
}
예제 #26
0
void port_town(legacy::town_record_type* dummy_town_ptr){
	short i;
	
	if (cur_scen_is_mac != mac_is_intel)
		return;
	flip_short(&dummy_town_ptr->town_chop_time);
	flip_short(&dummy_town_ptr->town_chop_key);
	flip_short(&dummy_town_ptr->lighting);
	for (i =0 ; i < 4; i++)
		flip_short(&dummy_town_ptr->exit_specs[i]);
	flip_rect(&dummy_town_ptr->in_town_rect);
	for (i =0 ; i < 64; i++) {
		flip_short(&dummy_town_ptr->preset_items[i].item_code);
		flip_short(&dummy_town_ptr->preset_items[i].ability);
	}
	for (i =0 ; i < 50; i++) {
		flip_short(&dummy_town_ptr->preset_fields[i].field_type);
	}
	flip_short(&dummy_town_ptr->max_num_monst);
	flip_short(&dummy_town_ptr->spec_on_entry);
	flip_short(&dummy_town_ptr->spec_on_entry_if_dead);
	for (i =0 ; i < 8; i++) 
		flip_short(&dummy_town_ptr->timer_spec_times[i]);
	for (i =0 ; i < 8; i++) 
		flip_short(&dummy_town_ptr->timer_specs[i]);
	flip_short(&dummy_town_ptr->difficulty);
	for (i =0 ; i < 100; i++) 
		flip_spec_node(&dummy_town_ptr->specials[i]);
	
}
예제 #27
0
void horse_record_type::port(){
	flip_short(&which_town);
}
예제 #28
0
파일: db_comb.c 프로젝트: kanzure/brlcad
int
rt_comb_import4(
    struct rt_db_internal *ip,
    const struct bu_external *ep,
    const mat_t matrix,		/* NULL if identity */
    const struct db_i *dbip,
    struct resource *resp)
{
    union record *rp;
    struct rt_tree_array *rt_tree_array;
    union tree *tree;
    struct rt_comb_internal *comb;
    size_t j;
    size_t node_count;

    BU_CK_EXTERNAL(ep);
    rp = (union record *)ep->ext_buf;
    if (dbip) RT_CK_DBI(dbip);

    if (rp[0].u_id != ID_COMB) {
	bu_log("rt_comb_import4: Attempt to import a non-combination\n");
	return -1;
    }

    /* Compute how many granules of MEMBER records follow */
    node_count = ep->ext_nbytes/sizeof(union record) - 1;

    if (node_count)
	rt_tree_array = (struct rt_tree_array *)bu_calloc(node_count, sizeof(struct rt_tree_array), "rt_tree_array");
    else
	rt_tree_array = (struct rt_tree_array *)NULL;

    for (j = 0; j < node_count; j++) {
	if (rp[j+1].u_id != ID_MEMB) {
	    bu_free((void *)rt_tree_array, "rt_comb_import4: rt_tree_array");
	    bu_log("rt_comb_import4(): granule in external buffer is not ID_MEMB, id=%d\n", rp[j+1].u_id);
	    return -1;
	}

	switch (rp[j+1].M.m_relation) {
	    case '+':
		rt_tree_array[j].tl_op = OP_INTERSECT;
		break;
	    case '-':
		rt_tree_array[j].tl_op = OP_SUBTRACT;
		break;
	    default:
		bu_log("rt_comb_import4() unknown op=x%x, assuming UNION\n", rp[j+1].M.m_relation);
		/* Fall through */
	    case 'u':
		rt_tree_array[j].tl_op = OP_UNION;
		break;
	}

	/* Build leaf node for in-memory tree */
	{
	    union tree *tp;
	    mat_t diskmat;
	    char namebuf[NAMESIZE+1];

	    RT_GET_TREE(tp, resp);
	    rt_tree_array[j].tl_tree = tp;
	    tp->tr_l.tl_op = OP_DB_LEAF;

	    /* bu_strlcpy not safe here, buffer size mismatch */
	    memset(namebuf, 0, NAMESIZE+1);
	    memcpy(namebuf, rp[j+1].M.m_instname, sizeof(rp[j+1].M.m_instname));

	    tp->tr_l.tl_name = bu_strdup(namebuf);

	    flip_mat_dbmat(diskmat, rp[j+1].M.m_mat, dbip->dbi_version < 0 ? 1 : 0);

	    /* Verify that rotation part is pure rotation */
	    if (fabs(diskmat[0]) > 1 || fabs(diskmat[1]) > 1 ||
		fabs(diskmat[2]) > 1 ||
		fabs(diskmat[4]) > 1 || fabs(diskmat[5]) > 1 ||
		fabs(diskmat[6]) > 1 ||
		fabs(diskmat[8]) > 1 || fabs(diskmat[9]) > 1 ||
		fabs(diskmat[10]) > 1)
	    {
		bu_log("ERROR: %s/%s improper scaling, rotation matrix elements > 1\n",
		       rp[0].c.c_name, namebuf);
	    }

	    /* Verify that perspective isn't used as a modeling transform */
	    if (!ZERO(diskmat[12])
		|| !ZERO(diskmat[13])
		|| !ZERO(diskmat[14]))
	    {
		bu_log("ERROR: %s/%s has perspective transform\n", rp[0].c.c_name, namebuf);
	    }

	    /* See if disk record is identity matrix */
	    if (bn_mat_is_identity(diskmat)) {
		if (matrix == NULL) {
		    tp->tr_l.tl_mat = NULL;	/* identity */
		} else {
		    tp->tr_l.tl_mat = bn_mat_dup(matrix);
		}
	    } else {
		if (matrix == NULL) {
		    tp->tr_l.tl_mat = bn_mat_dup(diskmat);
		} else {
		    mat_t prod;
		    bn_mat_mul(prod, matrix, diskmat);
		    tp->tr_l.tl_mat = bn_mat_dup(prod);
		}
	    }
/* bu_log("M_name=%s, matp=x%x\n", tp->tr_l.tl_name, tp->tr_l.tl_mat); */
	}
    }
    if (node_count)
	tree = db_mkgift_tree(rt_tree_array, node_count, &rt_uniresource);
    else
	tree = (union tree *)NULL;

    RT_DB_INTERNAL_INIT(ip);
    ip->idb_major_type = DB5_MAJORTYPE_BRLCAD;
    ip->idb_type = ID_COMBINATION;
    ip->idb_meth = &OBJ[ID_COMBINATION];

    BU_ALLOC(comb, struct rt_comb_internal);
    RT_COMB_INTERNAL_INIT(comb);

    comb->tree = tree;

    ip->idb_ptr = (void *)comb;

    switch (rp[0].c.c_flags) {
	case DBV4_NON_REGION_NULL:
	case DBV4_NON_REGION:
	    comb->region_flag = 0;
	    break;
	case DBV4_REGION:
	    comb->region_flag = 1;
	    comb->is_fastgen = REGION_NON_FASTGEN;
	    break;
	case DBV4_REGION_FASTGEN_PLATE:
	    comb->region_flag = 1;
	    comb->is_fastgen = REGION_FASTGEN_PLATE;
	    break;
	case DBV4_REGION_FASTGEN_VOLUME:
	    comb->region_flag = 1;
	    comb->is_fastgen = REGION_FASTGEN_VOLUME;
	    break;
	default:
	    bu_log("WARNING: combination %s has illegal c_flag=x%x\n",
		   rp[0].c.c_name, rp[0].c.c_flags);
	    break;
    }

    if (comb->region_flag) {
	if (dbip->dbi_version < 0) {
	    comb->region_id = flip_short(rp[0].c.c_regionid);
	    comb->aircode = flip_short(rp[0].c.c_aircode);
	    comb->GIFTmater = flip_short(rp[0].c.c_material);
	    comb->los = flip_short(rp[0].c.c_los);
	} else {
	    comb->region_id = rp[0].c.c_regionid;
	    comb->aircode = rp[0].c.c_aircode;
	    comb->GIFTmater = rp[0].c.c_material;
	    comb->los = rp[0].c.c_los;
	}
    } else {
	/* set some reasonable defaults */
	comb->region_id = 0;
	comb->aircode = 0;
	comb->GIFTmater = 0;
	comb->los = 0;
    }

    comb->rgb_valid = rp[0].c.c_override;
    if (comb->rgb_valid) {
	comb->rgb[0] = rp[0].c.c_rgb[0];
	comb->rgb[1] = rp[0].c.c_rgb[1];
	comb->rgb[2] = rp[0].c.c_rgb[2];
    }
    if (rp[0].c.c_matname[0] != '\0') {
#define MAX_SS 128
	char shader_str[MAX_SS];

	memset(shader_str, 0, MAX_SS);

	/* copy shader info to a static string */

	/* write shader name.  c_matname is a buffer, bu_strlcpy not
	 * safe here.
	 */
	memcpy(shader_str, rp[0].c.c_matname, sizeof(rp[0].c.c_matname));

	bu_strlcat(shader_str, " ", MAX_SS);

	/* write shader parameters.  c_matparm is a buffer, bu_strlcpy
	 * not safe here.
	 */
	memcpy(shader_str+strlen(shader_str), rp[0].c.c_matparm, sizeof(rp[0].c.c_matparm));

	/* convert to TCL format and place into comb->shader */
	if (bu_shader_to_list(shader_str, &comb->shader)) {
	    bu_log("rt_comb_import4: Error: Cannot convert following shader to TCL format:\n");
	    bu_log("\t%s\n", shader_str);
	    bu_vls_free(&comb->shader);
	    return -1;
	}
    }
    /* XXX Separate flags for color inherit, shader inherit, (new) material inherit? */
    /* XXX cf: ma_cinherit, ma_minherit */
    /* This ? is necessary to clean up old databases with grunge here */
    comb->inherit = (rp[0].c.c_inherit == DB_INH_HIGHER) ? 1 : 0;
    /* Automatic material table lookup here? */
    if (comb->region_flag)
	bu_vls_printf(&comb->material, "gift%ld", comb->GIFTmater);

    if (rt_tree_array) bu_free((void *)rt_tree_array, "rt_tree_array");

    return 0;
}