| 1 | # |
| 2 | # (C) Copyright 2001 Alexandre Courbot |
| 3 | # Part of the Adonthell Project http://adonthell.linuxgames.com |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License. |
| 7 | # This program is distributed in the hope that it will be useful, |
| 8 | # but WITHOUT ANY WARRANTY. |
| 9 | # |
| 10 | # See the COPYING file for more details |
| 11 | # |
| 12 | |
| 13 | import adonthell |
| 14 | |
| 15 | |
| 16 | # -- switch submaps (character, new coordinates, new submap, |
| 17 | # direction the character shall face) |
| 18 | def switch_submap (mychar, x, y, submap, dir): |
| 19 | # -- deactivate schedule during teleport |
| 20 | if mychar.is_schedule_activated (): |
| 21 | mychar.set_schedule_active (False) |
| 22 | schedule_active = 1 |
| 23 | else: |
| 24 | schedule_active = 0 |
| 25 | |
| 26 | # -- only fade for the player |
| 27 | if mychar.get_id () == "Player": |
| 28 | # -- fade the new submap in if we teleport the player |
| 29 | adonthell.gamedata_engine ().fade_out () |
| 30 | mychar.jump_to (x, y, submap, dir) |
| 31 | adonthell.gamedata_engine ().fade_in () |
| 32 | else: |
| 33 | mychar.jump_to (x, y, submap, dir) |
| 34 | |
| 35 | # -- restore character's schedule |
| 36 | if schedule_active == 1: |
| 37 | mychar.set_schedule_active (True) |