#718883 ardentryst: IndexError in Worm Woods

Package:
ardentryst
Source:
ardentryst
Submitter:
Kalle Olavi Niemitalo
Date:
2021-12-17 22:30:04 UTC
Severity:
normal
Tags:
#718883#5
Date:
2013-08-06 14:06:28 UTC
From:
To:
I was playing as Pyralis in Worm Woods (Sempridge5).  Normally,
if you try to jump above the top of the level, the hero hits a
ceiling.  However, at the left side of the NPC who asks for
Anneludine Shells, there is a hole in the ceiling.  By wearing
Winged Boots, Pyralis was able to jump through that hole and then
walk to the right above the ceiling.  When Pyralis was already
above the ceiling and jumped some more, the game ended with an
IndexError.  I guess the abs_y variable became negative.

Other observations:
* The error handler tried to create bugreport.txt, but that
  failed because /usr/games/ardentryst changes to the
  /usr/share/games/ardentryst directory and I don't have write
  access there.  It would be better to place bugreport.txt
  in the same directory as log.txt.
* /usr/share/games/ardentryst/Levels/Sempridge5 seems to be in
  Python Pickle format, and it's not obvious to me how it should
  be edited to block the hole in the ceiling.  There is code in
  mapping.py to convert maps from XML to Pickle, but the source
  package does not include any XML sources for maps, and I don't
  know whether the existing maps were even converted that way.

% ardentryst
Ext.reader.Sax2 not found
-------------------------------------------------------------------------------
            Ardentryst v.20090726 (1.71-Comet Unstable) 1:11 PM AEST
                               by Jordan Trudgett
-------------------------------------------------------------------------------

    Ardentryst Copyright (C) 2007, 2008, 2009 Jordan Trudgett
    This program comes with ABSOLUTELY NO WARRANTY.
    This is free software, and you are welcome to redistribute it
    under certain conditions; for details, see the COPYING file.

An error has occurred.
Traceback (most recent call last):
  File "/usr/share/games/ardentryst/ardentryst.py", line 4718, in <module>
    main()
  File "/usr/share/games/ardentryst/ardentryst.py", line 4419, in main
    handle_game(Game, True)
  File "/usr/share/games/ardentryst/ardentryst.py", line 3085, in handle_game
    PLAYLOCALS)#, "DEMO.dem")
  File "/usr/share/games/ardentryst/play_level.py", line 2880, in playlevel
    PLAYER.movement_jump_tick()
  File "/usr/share/games/ardentryst/play_level.py", line 5499, in movement_jump_tick
    if self.senseabove(): self.inertia[1] = max(0, self.inertia[1])
  File "/usr/share/games/ardentryst/play_level.py", line 5593, in senseabove
    s1 = self.sense("10", -60)
  File "/usr/share/games/ardentryst/play_level.py", line 5692, in sense
    looktile = LEVEL.map[abs_x/40][abs_y/40]
IndexError: list index out of range
Traceback (most recent call last):
  File "/usr/share/games/ardentryst/ardentryst.py", line 4722, in <module>
    handleException(e)
  File "/usr/share/games/ardentryst/ardentryst.py", line 683, in handleException
    open("bugreport.txt", "w").write(open(os.path.join(SAVEDIRECTORY, "log.txt"), "r").read())
IOError: [Errno 13] Permission denied: 'bugreport.txt'

#718883#10
Date:
2013-08-06 16:04:55 UTC
From:
To:
tag 718883 + upstream
thanks

#718883#17
Date:
2014-07-10 00:32:24 UTC
From:
To:
Kalle Olavi Niemitalo <kon@iki.fi> writes:

The ceiling appears to be an unintended feature.
There is no such ceiling in the Sempridge5 map data.
Instead, if the player character tries to jump above the map,
then abs_y becomes negative in play_level.Character.sense.
and the [abs_y/40] index becomes [-1], which Python interprets
as counting from the end of the array, so the collision check
ends up looking at the bottom of the map.
In this part of Worm Woods, there is a gap in the floor of the
lower level, and that then becomes the hole in the ceiling.

Therefore, fixing this bug should not involve editing the map data.
play_level.Character.sense should instead be changed to return False
if abs_y < 0.  It already has a similar check for abs_y >= 480.

#718883#22
Date:
2021-12-17 19:53:08 UTC
From:
To:
Fri Dec 17 19:25:21 2021| Playlevel called: Castle Centre
Traceback (most recent call last):
   File "/usr/share/games/ardentryst/ardentryst.py", line 4722, in <module>
     main()
   File "/usr/share/games/ardentryst/ardentryst.py", line 4423, in main
     handle_game(Game, True)
   File "/usr/share/games/ardentryst/ardentryst.py", line 3083, in handle_game
     Result = playlevel(player, level, [levelscript, npcscript], screen, Data, Fonts, soundbox, Game,
   File "/usr/share/games/ardentryst/play_level.py", line 2886, in playlevel
     PLAYER.arrow_tick()
   File "/usr/share/games/ardentryst/play_level.py", line 5325, in arrow_tick
     lm = LEVEL.map[int(arrow.x/40)][int(arrow.y/40)]
IndexError: list index out of range

#718883#27
Date:
2021-12-17 22:26:50 UTC
From:
To: