Die4Ever / Die4Ever/build-engine-randomizer

mirroring maps

Open
#37 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
28
Forks
1
PR merge metrics
No merged PRs in 30d

Description

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
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.