# HG changeset patch # User Matti Hamalainen # Date 1412587857 -10800 # Node ID 0934971107279cf49526ac34112003a711ad643a # Parent b738873f9ef28e603e403545d961c4c00c4e6c74 Indentation. diff -r b738873f9ef2 -r 093497110727 src/levels.cc --- a/src/levels.cc Mon Oct 06 05:04:36 2014 +0300 +++ b/src/levels.cc Mon Oct 06 12:30:57 2014 +0300 @@ -724,9 +724,9 @@ } } -// Ignore SEGS, SSECTORS and NODES + // Ignore SEGS, SSECTORS and NODES -// Read SECTORS + // Read SECTORS { const char *lump_name = "SECTORS"; verbmsg(" sectors\n"); @@ -931,9 +931,9 @@ n, SideDefs[n].sector); } -// Ignore REJECT and BLOCKMAP + // Ignore REJECT and BLOCKMAP -// Silly statistics + // Silly statistics verbmsg (" %d things, %d vertices, %d linedefs, %d sidedefs, %d sectors\n", (int) NumThings, (int) NumVertices, (int) NumLineDefs, @@ -955,7 +955,7 @@ void ForgetLevelData() /* SWAP! */ { -/* forget the things */ + /* forget the things */ NumThings = 0; if (Things != 0) FreeMemory(Things); @@ -963,25 +963,25 @@ things_angles++; things_types++; -/* forget the vertices */ + /* forget the vertices */ NumVertices = 0; if (Vertices != 0) FreeMemory(Vertices); Vertices = 0; -/* forget the linedefs */ + /* forget the linedefs */ NumLineDefs = 0; if (LineDefs != 0) FreeMemory(LineDefs); LineDefs = 0; -/* forget the sidedefs */ + /* forget the sidedefs */ NumSideDefs = 0; if (SideDefs != 0) FreeMemory(SideDefs); SideDefs = 0; -/* forget the sectors */ + /* forget the sectors */ NumSectors = 0; if (Sectors != 0) FreeMemory(Sectors); @@ -1055,7 +1055,7 @@ bool reuse_nodes = Level && !MadeMapChanges && yg_level_format != YGLF_ALPHA; -// Write the pwad header + // Write the pwad header WriteBytes(file, "PWAD", 4); // Pwad file file_write_i32(file, WAD_LL__); // Number of entries = 11 file_write_i32(file, 0); // Fix this up later @@ -1064,12 +1064,12 @@ else dir = 0; // Useless except to trap accidental dereferences -// The label (EnMm or MAPnm) + // The label (EnMm or MAPnm) l = WAD_LL_LABEL; lump_offset[l] = ftell(file); // By definition lump_size[l] = 0; // By definition -// Write the THINGS lump + // Write the THINGS lump l = WAD_LL_THINGS; lump_offset[l] = ftell(file); for (n = 0; n < NumThings; n++) @@ -1084,7 +1084,7 @@ if (Level) dir = dir->next; -// Write the LINEDEFS lump + // Write the LINEDEFS lump l = WAD_LL_LINEDEFS; lump_offset[WAD_LL_LINEDEFS] = ftell(file); for (n = 0; n < NumLineDefs; n++) @@ -1101,7 +1101,7 @@ if (Level) dir = dir->next; -// Write the SIDEDEFS lump + // Write the SIDEDEFS lump l = WAD_LL_SIDEDEFS; lump_offset[l] = ftell(file); for (n = 0; n < NumSideDefs; n++) @@ -1117,7 +1117,7 @@ if (Level) dir = dir->next; -// Write the VERTEXES lump + // Write the VERTEXES lump l = WAD_LL_VERTEXES; lump_offset[WAD_LL_VERTEXES] = ftell(file); if (reuse_nodes) @@ -1144,7 +1144,7 @@ if (Level) dir = dir->next; -// Write the SEGS, SSECTORS and NODES lumps + // Write the SEGS, SSECTORS and NODES lumps for (n = 0; n < 3; n++) { if (n == 0) @@ -1169,7 +1169,7 @@ dir = dir->next; } -// Write the SECTORS lump + // Write the SECTORS lump l = WAD_LL_SECTORS; lump_offset[l] = ftell(file); for (n = 0; n < NumSectors; n++) @@ -1186,7 +1186,7 @@ if (Level) dir = dir->next; -// Write the REJECT lump + // Write the REJECT lump l = WAD_LL_REJECT; lump_offset[l] = ftell(file); if (reuse_nodes) @@ -1204,7 +1204,7 @@ if (Level) dir = dir->next; -// Write the BLOCKMAP lump + // Write the BLOCKMAP lump l = WAD_LL_BLOCKMAP; lump_offset[l] = ftell(file); if (reuse_nodes) @@ -1221,7 +1221,7 @@ if (Level) dir = dir->next; -// Write the actual directory + // Write the actual directory long dir_offset = ftell(file); for (int L = 0; L < (int) WAD_LL__; L++) { @@ -1233,7 +1233,7 @@ file_write_name(file, wad_level_lump[L].name); } -/* Fix up the directory start information */ + /* Fix up the directory start information */ if (fseek(file, 8, SEEK_SET)) { char buf1[81]; @@ -1246,7 +1246,7 @@ } file_write_i32(file, dir_offset); -/* Close the file */ + /* Close the file */ if (fclose(file)) { char buf1[81]; @@ -1257,20 +1257,20 @@ return 1; } -/* The file is now up to date */ + /* The file is now up to date */ if (!Level || MadeMapChanges) cfg.remind_to_build_nodes = 1; MadeChanges = 0; MadeMapChanges = 0; -/* Update pointers in Master Directory */ + /* Update pointers in Master Directory */ OpenPatchWad(outfile); -/* This should free the old "*.bak" file */ + /* This should free the old "*.bak" file */ CloseUnusedWadFiles(); -/* Update MapMinX, MapMinY, MapMaxX, MapMaxY */ -// Probably not necessary anymore -- AYM 1999-04-05 + /* Update MapMinX, MapMinY, MapMaxX, MapMaxY */ + // Probably not necessary anymore -- AYM 1999-04-05 update_level_bounds(); return 0; } @@ -1309,7 +1309,7 @@ verbmsg("Reading texture names\n"); -// Doom alpha 0.4 : "TEXTURES", no names + // Doom alpha 0.4 : "TEXTURES", no names if (yg_texture_lumps == YGTL_TEXTURES && yg_texture_format == YGTF_NAMELESS) { @@ -1356,7 +1356,7 @@ ; } -// Doom alpha 0.5 : only "TEXTURES" + // Doom alpha 0.5 : only "TEXTURES" else if (yg_texture_lumps == YGTL_TEXTURES && (yg_texture_format == YGTF_NORMAL || yg_texture_format == YGTF_STRIFE11)) @@ -1420,7 +1420,7 @@ if (offsets != 0) FreeMemory(offsets); } -// Other iwads : "TEXTURE1" and possibly "TEXTURE2" + // Other iwads : "TEXTURE1" and possibly "TEXTURE2" else if (yg_texture_lumps == YGTL_NORMAL && (yg_texture_format == YGTF_NORMAL || yg_texture_format == YGTF_STRIFE11)) @@ -1642,17 +1642,18 @@ verbmsg("\n"); -/* sort the flats by names */ + /* sort the flats by names */ qsort(flat_list, NumFTexture, sizeof *flat_list, flat_list_entry_cmp); -/* Eliminate all but the last duplicates of a flat. Suboptimal. - Would be smarter to start by the end. */ + /* Eliminate all but the last duplicates of a flat. Suboptimal. + Would be smarter to start by the end. */ for (size_t n = 0; n < NumFTexture; n++) { size_t m = n; while (m + 1 < NumFTexture && !flat_list_entry_cmp(flat_list + n, flat_list + m + 1)) m++; + // m now contains the index of the last duplicate int nduplicates = m - n; if (nduplicates > 0) @@ -1674,9 +1675,11 @@ { if (!flat_list) return 0; + for (size_t n = 0; n < NumFTexture; n++) if (!y_strnicmp(name, flat_list[n].name, WAD_FLAT_NAME)) return 1; + return 0; }