Esempio n. 1
0
bool feature_type::is_jammed_door(void)
{
    if (!is_door()) return (FALSE);

    /* Jammed doors */
    if (f_flags3 & (FF3_DOOR_JAMMED)) return (TRUE);
    return (FALSE);
}
Esempio n. 2
0
internal 
void saveDoors(file_t* saveGame, map_element_t* map)
{
	writeFileComment(saveGame, "DOORS");

	int doorId = 1;
	for (map_element_t* p = map; p->type != END_OF_MAP; p++)
	{
		if (is_door(p))
		{
			writeFileKeyValue(saveGame, "DOOR", "%d %s", doorId, (p->type == DOOR) ? "CLOSED" : "OPEN");
			doorId++;
		}
	}

	writeFileComment(saveGame, "END_DOORS");
}
Esempio n. 3
0
/* direction should be 0 for horizontal walls and 1 for vertical walls */
void do_linedef(int y, int x, int ye, int xe, int direction) 
{
	/* walls */
	if((cave_feat[y][x] >= FEAT_MAGMA && is_floor_ish(cave_feat[ye][xe]))
	   || (is_floor_ish(cave_feat[y][x]) && cave_feat[ye][xe] >= FEAT_MAGMA)) {

		linedefs[++linedef_counter].flags=0;
		linedefs[linedef_counter].type=0;
		linedefs[linedef_counter].tag=0;
		linedefs[linedef_counter].right_sidedef_idx=++sidedef_counter;
		linedefs[linedef_counter].left_sidedef_idx=-1;

		sidedefs[sidedef_counter].x_texture_off=0;
		sidedefs[sidedef_counter].y_texture_off=0;
		memset(sidedefs[sidedef_counter].upper_texture, 0, 8);
		memset(sidedefs[sidedef_counter].lower_texture, 0, 8);
		memset(sidedefs[sidedef_counter].normal_texture, 0, 8);
		memcpy(sidedefs[sidedef_counter].upper_texture, "ROCK1", 5);
		memcpy(sidedefs[sidedef_counter].lower_texture, "ROCK1", 5);
		memcpy(sidedefs[sidedef_counter].normal_texture, "ROCK1", 5);

		if(vertex_idx[ye][xe]==-1) vertex_idx[ye][xe]=vertex_counter++;
		if(vertex_idx[y+1][x+1]==-1) vertex_idx[y+1][x+1]=vertex_counter++;
		
		/* wall left/top, floor right/bottom */
		if(cave_feat[y][x] >= FEAT_MAGMA && is_floor_ish(cave_feat[ye][xe])) {
			if(direction) {	
				linedefs[linedef_counter].from_vertex=vertex_idx[y+1][x+1];
				linedefs[linedef_counter].to_vertex=vertex_idx[ye][xe];
			} else {
				linedefs[linedef_counter].from_vertex=vertex_idx[ye][xe];
				linedefs[linedef_counter].to_vertex=vertex_idx[y+1][x+1];
			}
			sidedefs[sidedef_counter].sector=cave_sector_map[ye][xe];
		}

		/* floor left/top, wall right/bottom */
		if(is_floor_ish(cave_feat[y][x]) && cave_feat[ye][xe] >= FEAT_MAGMA) {
			if(direction) {	
				linedefs[linedef_counter].to_vertex=vertex_idx[y+1][x+1];
				linedefs[linedef_counter].from_vertex=vertex_idx[ye][xe];
			} else {
				linedefs[linedef_counter].to_vertex=vertex_idx[ye][xe];
				linedefs[linedef_counter].from_vertex=vertex_idx[y+1][x+1];
			}
			sidedefs[sidedef_counter].sector=cave_sector_map[y][x];
		}

		return;
	}

	/* doors */
	if((is_floor(cave_feat[y][x]) && is_door(cave_feat[ye][xe]))
	   || (is_door(cave_feat[y][x]) && is_floor(cave_feat[ye][xe])))
	{
		linedef_counter++;
		
		if(vertex_idx[ye][xe]==-1) vertex_idx[ye][xe]=vertex_counter++;
		if(vertex_idx[y+1][x+1]==-1) vertex_idx[y+1][x+1]=vertex_counter++;

		linedefs[linedef_counter].flags=0x4;
		linedefs[linedef_counter].type=1;
		linedefs[linedef_counter].right_sidedef_idx=++sidedef_counter;
		
		/* door left/top, floor right/bottom */
		if(is_door(cave_feat[y][x]) && is_floor(cave_feat[ye][xe])) {
			if(direction) {	
				linedefs[linedef_counter].from_vertex=vertex_idx[y+1][x+1];
				linedefs[linedef_counter].to_vertex=vertex_idx[ye][xe];
			} else {
				linedefs[linedef_counter].from_vertex=vertex_idx[ye][xe];
				linedefs[linedef_counter].to_vertex=vertex_idx[y+1][x+1];
			}
			sidedefs[sidedef_counter].sector=cave_sector_map[ye][xe];
			sidedefs[sidedef_counter+1].sector=cave_sector_map[y][x];
		}

		/* floor left/top, door right/bottom */
		if(is_floor(cave_feat[y][x]) && is_door(cave_feat[ye][xe])) {
			if(direction) {	
				linedefs[linedef_counter].to_vertex=vertex_idx[y+1][x+1];
				linedefs[linedef_counter].from_vertex=vertex_idx[ye][xe];
			} else {
				linedefs[linedef_counter].to_vertex=vertex_idx[ye][xe];
				linedefs[linedef_counter].from_vertex=vertex_idx[y+1][x+1];
			}
			sidedefs[sidedef_counter].sector=cave_sector_map[y][x];
			sidedefs[sidedef_counter+1].sector=cave_sector_map[ye][xe];
		}		
					
		sidedefs[sidedef_counter].x_texture_off=0;
		sidedefs[sidedef_counter].y_texture_off=0;
		memset(sidedefs[sidedef_counter].upper_texture, 0, 8);
		memset(sidedefs[sidedef_counter].lower_texture, 0, 8);
		memset(sidedefs[sidedef_counter].normal_texture, 0, 8);
		memcpy(sidedefs[sidedef_counter].lower_texture, "-", 1);
		memcpy(sidedefs[sidedef_counter].normal_texture, "-", 1);

		linedefs[linedef_counter].left_sidedef_idx=++sidedef_counter;

		sidedefs[sidedef_counter].x_texture_off=0;
		sidedefs[sidedef_counter].y_texture_off=0;
		memset(sidedefs[sidedef_counter].upper_texture, 0, 8);
		memset(sidedefs[sidedef_counter].lower_texture, 0, 8);
		memset(sidedefs[sidedef_counter].normal_texture, 0, 8);
		memcpy(sidedefs[sidedef_counter].upper_texture, "-", 1);
		memcpy(sidedefs[sidedef_counter].lower_texture, "-", 1);
		memcpy(sidedefs[sidedef_counter].normal_texture, "-", 1);

		if(cave_feat[y][x] == FEAT_SECRET
		   || cave_feat[ye][xe] == FEAT_SECRET) {
			memcpy(sidedefs[sidedef_counter-1].upper_texture, "ROCK1", 5);
			linedefs[linedef_counter].flags |= 0x20;
		} else {
			memcpy(sidedefs[sidedef_counter-1].upper_texture, "WOODMET1", 8);
		}

		if(is_door(cave_feat[ye][xe]))
		{
			if(sectors[cave_sector_map[ye][xe]].tag == -1) sectors[cave_sector_map[ye][xe]].tag=tag_counter++;
			linedefs[linedef_counter].tag = sectors[cave_sector_map[ye][xe]].tag;
			sectors[cave_sector_map[ye][xe]].ceiling_height=0;
		} 
		if(is_door(cave_feat[y][x]))
		{
			if(sectors[cave_sector_map[y][x]].tag == -1) sectors[cave_sector_map[y][x]].tag=tag_counter++;
			linedefs[linedef_counter].tag = sectors[cave_sector_map[y][x]].tag;
			sectors[cave_sector_map[y][x]].ceiling_height=0;
		}

		return;
	}

	/* floor left/top, floor right/top */
	if(is_floor_ish(cave_feat[y][x])
	   && is_floor_ish(cave_feat[ye][xe])) {

		if(vertex_idx[ye][xe]==-1) vertex_idx[ye][xe]=vertex_counter++;
		if(vertex_idx[y+1][x+1]==-1) vertex_idx[y+1][x+1]=vertex_counter++;

		linedefs[++linedef_counter].from_vertex=vertex_idx[ye][xe];
		linedefs[linedef_counter].to_vertex=vertex_idx[y+1][x+1];

		linedefs[linedef_counter].flags=0x4;
		linedefs[linedef_counter].type=0;
		linedefs[linedef_counter].tag=0;
		linedefs[linedef_counter].right_sidedef_idx=++sidedef_counter;
					
		sidedefs[sidedef_counter].x_texture_off=0;
		sidedefs[sidedef_counter].y_texture_off=0;
		memset(sidedefs[sidedef_counter].upper_texture, 0, 8);
		memset(sidedefs[sidedef_counter].lower_texture, 0, 8);
		memset(sidedefs[sidedef_counter].normal_texture, 0, 8);
		memcpy(sidedefs[sidedef_counter].upper_texture, "-", 1);
		memcpy(sidedefs[sidedef_counter].lower_texture, "-", 1);
		memcpy(sidedefs[sidedef_counter].normal_texture, "-", 1);
		sidedefs[sidedef_counter].sector=cave_sector_map[ye][xe];

		linedefs[linedef_counter].left_sidedef_idx=++sidedef_counter;

		sidedefs[sidedef_counter].x_texture_off=0;
		sidedefs[sidedef_counter].y_texture_off=0;
		memset(sidedefs[sidedef_counter].upper_texture, 0, 8);
		memset(sidedefs[sidedef_counter].lower_texture, 0, 8);
		memset(sidedefs[sidedef_counter].normal_texture, 0, 8);
		memcpy(sidedefs[sidedef_counter].upper_texture, "-", 1);
		memcpy(sidedefs[sidedef_counter].lower_texture, "-", 1);
		memcpy(sidedefs[sidedef_counter].normal_texture, "-", 1);
		sidedefs[sidedef_counter].sector=cave_sector_map[y][x];

		return;
	}

}
Esempio n. 4
0
bool feature_type::is_known_door(void)
{
    if (!is_door()) return (FALSE);
    if (is_secret_door())   return (FALSE);
    return (TRUE);
}
Esempio n. 5
0
bool feature_type::is_closed_door(void)
{
    if (!is_door()) return (FALSE);
    if (f_flags3 & (FF3_DOOR_CLOSED))  return (TRUE);
    return (FALSE);
}
Esempio n. 6
0
bool feature_type::is_secret_door(void)
{
    if (!is_door()) return (FALSE);
    if (f_flags1 & (FF1_SECRET))  return (TRUE);
    return (FALSE);
}