Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mirroring maps #37

Open
Die4Ever opened this issue Apr 7, 2023 · 0 comments
Open

mirroring maps #37

Die4Ever opened this issue Apr 7, 2023 · 0 comments
Milestone

Comments

@Die4Ever
Copy link
Owner

Die4Ever commented Apr 7, 2023

some WIP code from buildmapbase.py...

    def MirrorMap(self):
        # TODO, need to figure out re-ordering of walls, they need to be counterclockwise
        # probably need to compare coordinates and do some sorting
        # actually reversing the list might be good enough, maybe the issue is with all the pointer/index dependencies?
        self.full_rewrite = True
        x=1
        y=-1

        self.startPos[0] *= x
        self.startPos[1] *= y

        for w in self.walls:
            w.pos[0] *= x
            w.pos[1] *= y

        for sect in self.sectors:
            shapes = [[]]
            wallptr = sect.wallptr
            numwalls = sect.wallnum
            for i in range(wallptr, wallptr + numwalls):
                shapes[-1].append(i)
                if self.walls[i].next_wall != -1:
                    shapes.append([])

            for shape in shapes:
                rev = shape.copy()
                rev.reverse()
                for a, b in zip(shape, rev):
                    if a >= b:
                        break
                    walla:Wall = self.walls[a]
                    wallb:Wall = self.walls[b]

                    next_wall_a = walla.next_wall
                    next_sector_wall_a = walla.next_sector_wall
                    next_sector_a = walla.next_sector

                    next_wall_b = wallb.next_wall
                    next_sector_wall_b = wallb.next_sector_wall
                    next_sector_b = wallb.next_sector

                    walla.next_wall = next_wall_b
                    #walla.next_sector_wall = next_sector_wall_b
                    #walla.next_sector = next_sector_b

                    wallb.next_wall = next_wall_a
                    #wallb.next_sector_wall = next_sector_wall_a
                    #wallb.next_sector = next_sector_a

                    self.walls[a] = wallb
                    self.walls[b] = walla

        for s in self.sprites:
            s.pos[0] *= x
            s.pos[1] *= y
@Die4Ever Die4Ever modified the milestones: v0.9.5, v1.0 Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant