My fix removes the only occurrence of cmp() in magic.py, so we should drop the line importing past.builtins.cmp. Updated patch accordingly, also improved commit message.
Attached patch v2, hoping bugtracker can handle attachments.
Python 3 port introduced at least five severe bugs. * Customizing action keys via Options, Control prints 2 deprecation warnings and no longer works, changed keys aren't saved. Not being able to remap keys makes it hard for users of non-English keyboards. (controls.py) * Playing as Nyx and casting Ice ([D][S]) or Implosion ([D][W]) instantly crashes the game due to 3 exceptions. (magic.py) * Playing as Pyralis and using Spin-slash ([C][S]) hangs gameplay, you have to abort the current level to be able to move again. (play_level.py) Bug-Debian: https://bugs.debian.org/1001823 Signed-off-by: Jens Rottmann --- ardentryst/controls.py +++ python3fix/controls.py @@ -35,7 +35,7 @@ class SET2: def __init__(self, keycodes, x, y, set): self.set = set - self.keys = [Key(keycodes[c], x + ((8-c)%3) * 32, y + (c/3)*30, "B-" + str(((11-c)/3)*3 - (11-c)%3), set) for c in range(9)] + self.keys = [Key(keycodes[c], x + ((8-c)%3) * 32, y + (c//3)*30, "B-" + str(((11-c)//3)*3 - (11-c)%3), set) for c in range(9)] class Key: def __init__(self, keycode, x, y, binding, set): --- ardentryst/magic.py +++ python3fix/magic.py @@ -21,7 +21,6 @@ import pygame, math, random from pygame.locals import * -from past.builtins import cmp def ground_at(LEVEL, x, f=False): "Finds the y co-ordinate of the ground at position x." @@ -236,7 +235,7 @@ class Ice_1(Spell): def s_init(self): global DATA self.affected = [] - self.cant = self.caster.mp < 4 + self.cant = self.caster.mp[0] < 4 def s_blit(self, surf, ALT_X, ALT_Y): global DATA if not self.affected: @@ -441,7 +440,7 @@ class Implosion_1(Spell): def s_init(self): global DATA self.affected = [] - self.cant = self.caster.mp < 15 + self.cant = self.caster.mp[0] < 15 def s_blit(self, surf, ALT_X, ALT_Y): global DATA pic = DATA.mag_images["bubble.png"][0] @@ -472,7 +471,7 @@ class Implosion_1(Spell): if self.caster.mp[0] >= 15: self.affected.append(monster) - self.affected.sort(lambda x, y: cmp(y.maxhp, x.maxhp)) + self.affected.sort(key=lambda x: -x.maxhp) if len(self.affected): self.affected = self.affected[:1] --- ardentryst/play_level.py +++ python3fix/play_level.py @@ -4727,7 +4727,7 @@ class Character: self.mycombotime -= 1 if self.chainmove[1] and self.chainmove[1] > 0: self.chainmove[1] -= 1 - if self.chainmove[1] and self.chainmove[1] == 0: + if self.chainmove[1] == 0: cm = self.chainmove[:] self.chainmove = [None, None] getattr(self, cm[0])() --