<commit_before>from omg.util import *
from omg.lump import *
from omg.wad import NameGroup

import omg.lineinfo as lineinfo
import omg.thinginfo as thinginfo

Vertex = make_struct(
  "Vertex", """Represents a map vertex""",
  [["x", "h", 0],
   ["y", "h", 0]]
)

GLVertex = make_struct(
  "GLVertex", """Represents a map GL vertex""",
  [["x", "l", 0],
   ["y", "l", 0]]
)

Sidedef = make_struct(
  "Sidedef", """Represents a map sidedef""",
  [["off_x",  'h',  0  ],
   ["off_y",  'h',  0  ],
   ["tx_up",  '8s', "-"],
   ["tx_low", '8s', "-"],
   ["tx_mid", '8s', "-"],
   ["sector", 'h',  -1 ]]
)

Linedef = make_struct(
  "Linedef", """Represents a map linedef""",
  [["vx_a",   'h', -1],
   ["vx_b",   'h', -1],
   ["flags",  'h',  0],
   ["action", 'h',  0],
   ["tag",    'h',  0],
   ["front",  'h', -1],
   ["back",   'h', -1]],
  ["impassable", "block_monsters", "two_sided",
   "upper_unpeg", "lower_unpeg", "secret",
   "block_sound", "invisible", "automap"]
)

ZLinedef = make_struct(
  "Linedef", """Represents a map linedef (Hexen / ZDoom)""",
  [["vx_a",   'h', -1],
   ["vx_b",   'h', -1],
   ["flags",  'h',  0],
   ["action", 'b',  0],
   ["arg1",   'b',  0],
   ["arg2",   'b',  0],
   ["arg3",   'b',  0],
   ["arg4",   'b',  0],
   ["arg5",   'b',  0],
   ["front",  'h', -1],
   ["back",   'h', -1]],
  ["impassable", "block_monsters", "two_sided",
   "upper_unpeg", "lower_unpeg", "secret",
   "block_sound", "invisible", "automap",
   "repeat", "player_use", "monster_cross",
   "player_hit", "activate_any", "dummy",
   "block_all"]
)

Thing = make_struct(
  "Thing", """Represents a map thing""",
  [["x",     'h', 0],
   ["y",     'h', 0],
   ["angle", 'h', 0],
   ["type",  'h', 0],
   ["flags", 'h', 0]],
  ["easy", "medium", "hard", "deaf", "multiplayer"]
)

ZThing = make_struct(
  "Thing", """Represents a map thing (Hexen / ZDoom)""",
  [["tid",    'h', 0],
   ["x",      'h', 0],
   ["y",      'h', 0],
   ["height", 'h', 0],
   ["angle",  'h', 0],
   ["type",   'h', 0],
   ["flags",  'h', 0],
   ["action", 'b', 0],
   ["arg1",   'b', 0],
   ["arg2",   'b', 0],
   ["arg3",   'b', 0],
   ["arg4",   'b', 0],
   ["arg5",   'b', 0]],
  ["easy", "medium", "hard", "deaf", "dormant",
   "fighter", "cleric", "mage", "solo", "multiplayer", "deathmatch"]
)

Sector = make_struct(
  "Sector", """Represents a map sector""",
  [["z_floor",  'h',  0],
   ["z_ceil",   'h',  128],
   ["tx_floor", '8s', "FLOOR4_8"],
   ["tx_ceil",  '8s', "CEIL3_5"],
   ["light",    'h',  160],
   ["type",     'h',  0],
   ["tag",      'h',  0]]
)

Seg = make_struct(
  "Seg", """Represents a map seg""",
  [["vx_a",   'h', 0],
   ["vx_b",   'h', 0],
   ["angle",  'h', 0],
   ["line",   'h', 0],
   ["side",   'h', 0],
   ["offset", 'h', 0]]
)

SubSector = make_struct(
  "SubSector", """Represents a map subsector""",
  [["numsegs", 'h', 0],
   ["seg_a",   'H', 0]]
)

GLSeg = make_struct(
  "GLSeg", """Represents a map GL seg""",
  [["vx_a",    'h', 0],
   ["vx_b",    'h', 0],
   ["line",    'h', 0],
   ["side",    'h', 0],
   ["partner", 'h', 0]]
)

class MapEditor:
    """Doom map editor

    Data members:
        vertexes      List containing Vertex objects
        sidedefs      List containing Sidedef objects
        linedefs      List containing Linedef objects
        sectors       List containing Sector objects
        things        List containing Thing objects"""

    def __init__(self, from_lumps=None):
        """Create new, optionally from a lump group"""
        if from_lumps is not None:
            self.from_lumps(from_lumps)
        else:
            self.vertexes = []
            self.sidedefs = []
            self.linedefs = []
            self.sectors  = []
            self.things   = []
            self.segs     = []
            self.ssectors = []
<commit_msg>use unsigned map data fields where appropriate<commit_after>from omg.util import *
from omg.lump import *
from omg.wad import NameGroup

import omg.lineinfo as lineinfo
import omg.thinginfo as thinginfo

Vertex = make_struct(
  "Vertex", """Represents a map vertex""",
  [["x", "h", 0],
   ["y", "h", 0]]
)

GLVertex = make_struct(
  "GLVertex", """Represents a map GL vertex""",
  [["x", "l", 0],
   ["y", "l", 0]]
)

Sidedef = make_struct(
  "Sidedef", """Represents a map sidedef""",
  [["off_x",  'h',  0  ],
   ["off_y",  'h',  0  ],
   ["tx_up",  '8s', "-"],
   ["tx_low", '8s', "-"],
   ["tx_mid", '8s', "-"],
   ["sector", 'H',  65535 ]]
)

Linedef = make_struct(
  "Linedef", """Represents a map linedef""",
  [["vx_a",   'H', 65535],
   ["vx_b",   'H', 63335],
   ["flags",  'H',  0],
   ["action", 'H',  0],
   ["tag",    'H',  0],
   ["front",  'H', 63335],
   ["back",   'H', 63335]],
  ["impassable", "block_monsters", "two_sided",
   "upper_unpeg", "lower_unpeg", "secret",
   "block_sound", "invisible", "automap"]
)

# TODO: update make_struct to support multi-bit flags somehow
# so the action activation bits work better
ZLinedef = make_struct(
  "Linedef", """Represents a map linedef (Hexen / ZDoom)""",
  [["vx_a",   'H', 63335],
   ["vx_b",   'H', 63335],
   ["flags",  'H',  0],
   ["action", 'B',  0],
   ["arg0",   'B',  0],
   ["arg1",   'B',  0],
   ["arg2",   'B',  0],
   ["arg3",   'B',  0],
   ["arg4",   'B',  0],
   ["front",  'H', 63335],
   ["back",   'H', 63335]],
  ["impassable", "block_monsters", "two_sided",
   "upper_unpeg", "lower_unpeg", "secret",
   "block_sound", "invisible", "automap",
   "repeat", "player_use", "monster_cross",
   "player_hit", "activate_any", "dummy",
   "block_all"]
)

Thing = make_struct(
  "Thing", """Represents a map thing""",
  [["x",     'h', 0],
   ["y",     'h', 0],
   ["angle", 'H', 0],
   ["type",  'H', 0],
   ["flags", 'H', 0]],
  ["easy", "medium", "hard", "deaf", "multiplayer"]
)

ZThing = make_struct(
  "Thing", """Represents a map thing (Hexen / ZDoom)""",
  [["tid",    'H', 0],
   ["x",      'h', 0],
   ["y",      'h', 0],
   ["height", 'h', 0],
   ["angle",  'H', 0],
   ["type",   'H', 0],
   ["flags",  'H', 0],
   ["action", 'B', 0],
   ["arg0",   'B', 0],
   ["arg1",   'B', 0],
   ["arg2",   'B', 0],
   ["arg3",   'B', 0],
   ["arg4",   'B', 0]],
  ["easy", "medium", "hard", "deaf", "dormant",
   "fighter", "cleric", "mage", "solo", "multiplayer", "deathmatch"]
)

Sector = make_struct(
  "Sector", """Represents a map sector""",
  [["z_floor",  'h',  0],
   ["z_ceil",   'h',  128],
   ["tx_floor", '8s', "FLOOR4_8"],
   ["tx_ceil",  '8s', "CEIL3_5"],
   ["light",    'H',  160],
   ["type",     'H',  0],
   ["tag",      'H',  0]]
)

Seg = make_struct(
  "Seg", """Represents a map seg""",
  [["vx_a",   'H', 0],
   ["vx_b",   'H', 0],
   ["angle",  'H', 0],
   ["line",   'H', 0],
   ["side",   'H', 0],
   ["offset", 'H', 0]]
)

SubSector = make_struct(
  "SubSector", """Represents a map subsector""",
  [["numsegs", 'H', 0],
   ["seg_a",   'H', 0]]
)

GLSeg = make_struct(
  "GLSeg", """Represents a map GL seg""",
  [["vx_a",    'H', 0],
   ["vx_b",    'H', 0],
   ["line",    'H', 0],
   ["side",    'H', 0],
   ["partner", 'H', 0]]
)

class MapEditor:
    """Doom map editor

    Data members:
        vertexes      List containing Vertex objects
        sidedefs      List containing Sidedef objects
        linedefs      List containing Linedef objects
        sectors       List containing Sector objects
        things        List containing Thing objects"""

    def __init__(self, from_lumps=None):
        """Create new, optionally from a lump group"""
        if from_lumps is not None:
            self.from_lumps(from_lumps)
        else:
            self.vertexes = []
            self.sidedefs = []
            self.linedefs = []
            self.sectors  = []
            self.things   = []
            self.segs     = []
            self.ssectors = []

{'fraction_non_alphanumeric': 0.24845916795069337, 'fraction_numerical': 0.026194144838212634, 'mean_word_length': 2.6602443609022557, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1483473', 'n_tokens_mistral': 3322, 'n_tokens_neox': 3148, 'n_words': 807}