adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[adonthell-wastesedge-commits] Release_0-3-1 22178ae 058/237: Map gets o


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-1 22178ae 058/237: Map gets only updated if the main_menu or data_screen aren't displayed.
Date: Mon, 25 Jul 2016 18:14:57 +0000 (UTC)

tag: Release_0-3-1
commit 22178aea156fc672b8482fb6d7fbead9c7e54fb9
Author: adondev <adondev>
Commit: adondev <adondev>

    Map gets only updated if the main_menu or data_screen aren't displayed.
---
 scripts/init.py                       |    1 +
 scripts/modules/main_menu.py          |   15 +++++++++++++--
 scripts/modules/schedules.py          |   16 +++++++++-------
 scripts/schedules/keyboard_control.py |   17 +++++++++++++++--
 4 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/scripts/init.py b/scripts/init.py
index c9c4df2..2f4415c 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -570,6 +570,7 @@ if retval < 5:
         talan.stand_north ()
         talan.set_schedule ("talan")
 
+        # -- that's a clone for now
         alek = characters ["Alek Endhelm"]
         alek.set_dialogue ("dialogues/alek_start")
         alek.load ("servant2.mchar")
diff --git a/scripts/modules/main_menu.py b/scripts/modules/main_menu.py
index 0402f8e..3786100 100755
--- a/scripts/modules/main_menu.py
+++ b/scripts/modules/main_menu.py
@@ -208,18 +208,24 @@ class main_menu (win_container):
             self.lg.thisown = 0
             self.lg.set_activate (1)   
             if self.startup != 0:
-                self.quit = 0
+                # In game
+                self.set_visible (0)
+                gamedata_map_engine ().set_should_update_map (0)
+                self.lg.py_signal_connect (self.on_ingame_data_close, 
win_event_CLOSE)
             else:
+                # Title screen
                 self.lg.py_signal_connect (self.on_data_close, win_event_CLOSE)
             win_manager_add (self.lg)
             win_manager_set_focus (self.lg)
 
         # Save Game
         elif sel == 3:
-            self.quit = 0
             self.lg = data_screen (SAVE_SCREEN)
             self.lg.thisown = 0
             self.lg.set_activate(1)
+            self.set_visible (0)
+            gamedata_map_engine ().set_should_update_map (0)
+            self.lg.py_signal_connect (self.on_ingame_data_close, 
win_event_CLOSE)
             win_manager_add (self.lg)
             win_manager_set_focus (self.lg)
 
@@ -232,6 +238,11 @@ class main_menu (win_container):
         if retval == 1:
             self.quit = 0
 
+    def on_ingame_data_close (self, retval):
+        self.lg = None
+        gamedata_map_engine ().set_should_update_map (1)
+        self.quit = 0
+
     # -- Scrolls the different menu options into view
     def create_menu (self, moves, goals):
         done = len (self.labels)
diff --git a/scripts/modules/schedules.py b/scripts/modules/schedules.py
index 7a71ada..72d9443 100755
--- a/scripts/modules/schedules.py
+++ b/scripts/modules/schedules.py
@@ -177,13 +177,15 @@ class bubble (win_container):
 
     # -- draws the bubble above the character's head
     def on_update (self, mychar):
-        # -- but only if on the same submap as the player
-        if mychar.submap () == gamedata_player ().submap ():
-            x, y = self.get_window_pos (mychar)
-            self.move (x, y)
-            self.remain = self.remain - 1
-        else:
-            self.remain = 0
+        # -- but only if the map should be updated
+        if gamedata_map_engine ().should_update_map ():
+            # -- and if on the same submap as the player
+            if mychar.submap () == gamedata_player ().submap ():
+                x, y = self.get_window_pos (mychar)
+                self.move (x, y)
+                self.remain = self.remain - 1
+            else:
+                self.remain = 0
 
     # -- center the window above the characters head
     def get_window_pos (self, mychar):
diff --git a/scripts/schedules/keyboard_control.py 
b/scripts/schedules/keyboard_control.py
index 6b742b1..3c58d4d 100755
--- a/scripts/schedules/keyboard_control.py
+++ b/scripts/schedules/keyboard_control.py
@@ -1,11 +1,15 @@
 # -- When the menu is closing, react accordingly
 def on_menu_close (retval, player):
-    # -- Reactivate the player's schedule
-#    player.set_schedule_active (1)
+    # Tells the map engine to update the map
+    map_engine.set_should_update_map (1)
     # -- Quit was selected, so that's what we do :)
     if retval == 5:
         map_engine.quit ()
 
+# Reactive map update when data_screen closed
+def on_data_screen_close (retval, player):
+    map_engine.set_should_update_map (1)
+
 # Opens the gate
 def open_gate ():
     # Get the mapobjects
@@ -72,6 +76,9 @@ elif input_has_been_pushed (SDLK_ESCAPE):
     # -- open main menu without animation, with saving and background enabled
     menu = main_menu.main_menu (1, 1, 1)
     menu.thisown = C
+    
+    # Stop updating the map
+    map_engine.set_should_update_map (0)
 
     # -- this tells us when the main menu is closed
     menu.py_signal_connect (on_menu_close, win_event_CLOSE, (myself))
@@ -106,6 +113,9 @@ elif input_has_been_pushed (SDLK_p):
 elif input_has_been_pushed (SDLK_l):
     s = data_screen (LOAD_SCREEN)
     s.thisown = C
+    s.py_signal_connect (on_data_screen_close, win_event_CLOSE, None)
+    # Stop updating the map
+    map_engine.set_should_update_map (0)
     s.set_activate (1) 
     win_manager_add (s)
     win_manager_set_focus (s)
@@ -115,6 +125,9 @@ elif input_has_been_pushed (SDLK_l):
 elif input_has_been_pushed (SDLK_s):
     s = data_screen (SAVE_SCREEN)
     s.thisown = C
+    s.py_signal_connect (on_data_screen_close, win_event_CLOSE, None)
+    # Stop updating the map
+    map_engine.set_should_update_map (0)
     s.set_activate (1) 
     win_manager_add (s)
     win_manager_set_focus (s)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]