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 1b6640a 151/237: MOVED engi


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] Release_0-3-1 1b6640a 151/237: MOVED engine control into seperate script
Date: Mon, 25 Jul 2016 18:15:08 +0000 (UTC)

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

    MOVED engine control into seperate script
    FIXED intro text (trading post -> inn)
---
 scripts/actions/talk.py                            |    5 ++
 scripts/init.py                                    |    5 +-
 scripts/modules/intro.py                           |    8 +-
 scripts/schedules/Makefile.am                      |   12 +++
 scripts/schedules/control.py                       |   95 ++++++++++++++++++++
 .../schedules/mapcharacters/keyboard_control.py    |   81 +++--------------
 6 files changed, 131 insertions(+), 75 deletions(-)

diff --git a/scripts/actions/talk.py b/scripts/actions/talk.py
index b964741..f9255a3 100755
--- a/scripts/actions/talk.py
+++ b/scripts/actions/talk.py
@@ -25,11 +25,16 @@ class talk:
         args[0].set_schedule_active (1)
         args[1].set_schedule_active (1)
 
+        adonthell.gamedata_engine ().set_control_active (1)
+
     def run (self, requester):
         if requester.get_name() == adonthell.gamedata_player ().get_name():
             # -- deactivate the schedule of the characters involved
             self.myself.set_schedule_active (0)
             requester.set_schedule_active (0)
+            
+            # -- don't allow access to main menu and stuff
+            adonthell.gamedata_engine ().set_control_active (0)
 
             # -- look into the player's face
             self.myself.look_invert (requester.currentmove ())
diff --git a/scripts/init.py b/scripts/init.py
index 225a02a..408eda7 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -164,11 +164,7 @@ class title_screen:
         
         # -- once the menu is closed, see what we got
         retval = menu.get_result ()
-        print "Main menu closed with retval", retval
 
-        audio_pause_music ()
-        audio_unload_background (0)
-        
         # -- start new game
         if retval == 1:
             # -- let the player chose a name for his character
@@ -193,6 +189,7 @@ class title_screen:
             self.window.set_visible (0)
             self.cleanup ()
             gamedata_engine ().mapview_start ()
+            gamedata_engine ().set_control_active (1)
             gamedata_engine ().fade_in ()
 
         # -- quit the game
diff --git a/scripts/modules/intro.py b/scripts/modules/intro.py
index 91a4020..8dc411d 100644
--- a/scripts/modules/intro.py
+++ b/scripts/modules/intro.py
@@ -67,11 +67,11 @@ cont.add (lab)
 wintext = ("One week out of Cirdanth, the trail had\nbecome hard. I had begun 
to wonder\ndays ago whether \
 it could still be called\na trail, but it was the only way the\ncaravans had.",
            "There were no caravans now, only me,\nand I had seen few others on 
the road.\nEven those had \
-become more scarce the\nfurther I went.",
+become more scarce\nthe further I went.",
            "It was easy to see why.",
            "The Lady Silverhair, intent on her\nmission, had gone on ahead 
while I was\nleft to complete \
 business in her name,\ntrusting me to follow in good speed.",
-           "A lone Half-Elf, may travel with much\nmore speed than an Elven 
lady and her\nservants, so she \
+           "A lone Half-Elf may travel with much\nmore speed than an Elven 
lady and her\nservants, so she \
 was now only a day\nahead.  The thought nearly caused me\nto forget \
 the harshness of the road.",
            "Still, Waste's Edge was a welcome sight.",
@@ -101,9 +101,9 @@ post of Waste's Edge?", "yellow", 130, 5, 500, 2),
            ("That it is, but this is all you'll see of it.", "red", 25, 5, 
300, 1),
            ("If you turn now and make haste, you should be able to make safe 
camping \
 before dark.", "red", 25, 5, 400, 1),
-           ("Turn back?  Whatever for?  And why is the gate of a free trading 
post locked \
+           ("Turn back?  Whatever for?  And why is the gate of a free Inn 
locked \
 against a footsore traveller?", "yellow", 130, 5, 500, 0),
-           ("I am sorry, traveller, but the post is barred and you must be 
off.", "red", 25, 5, 300, 0),
+           ("I am sorry, traveller, but the Inn is barred and you must be 
off.", "red", 25, 5, 300, 0),
            ("There has been trouble inside and I have instructions to turn 
away all who \
 need not be here.", "red", 25, 5, 400, 0),
            ("Trouble?  Why then, I must get inside.  My employer will need me 
close at \
diff --git a/scripts/schedules/Makefile.am b/scripts/schedules/Makefile.am
index c3bfa88..3e1d84c 100755
--- a/scripts/schedules/Makefile.am
+++ b/scripts/schedules/Makefile.am
@@ -1,3 +1,15 @@
 SUBDIRS = mapcharacters mapviews
 
 pkgdatadir = $(gamedatadir)/scripts/schedules
+
+pkgdata_DATA = *.pyc
+
+EXTRA_DIST = control.py
+
+all:
+       $(adonthell_binary) -c
+
+*.pyc: *.py
+
+clean:
+       rm -f *.pyc
diff --git a/scripts/schedules/control.py b/scripts/schedules/control.py
new file mode 100644
index 0000000..8280b79
--- /dev/null
+++ b/scripts/schedules/control.py
@@ -0,0 +1,95 @@
+#
+#  $Id$
+#
+#  (C) Copyright 2001 Kai Sterker <address@hidden>
+#  Part of the Adonthell Project http://adonthell.linuxgames.com
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License.
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY.
+#
+#  See the COPYING file for more details
+#
+
+from adonthell import *
+
+class control:
+
+    def run (self):
+        # -- bring up the main menu
+        if input_has_been_pushed (SDLK_ESCAPE):
+            import main_menu
+
+            # -- create main menu without animation, 
+            #    with saving and background enabled
+            menu = main_menu.main_menu (1, 1, 1)
+
+            # -- Stop updating the map
+            gamedata_engine ().set_update_map (0)
+            gamedata_engine ().set_control_active (0)
+
+            # -- open the main menu
+            gamedata_engine ().main (menu, "game_menu")
+            
+            # -- main menu closed -> see what to do
+            if menu.get_result () == 5:
+                # -- quit the game
+                gamedata_engine ().main_quit ()
+            else:
+                # -- continue
+                gamedata_engine ().set_update_map (1)
+                gamedata_engine ().set_control_active (1)
+           
+
+        # -- shortcut to the load screen
+        elif input_has_been_pushed (SDLK_l):
+            s = data_screen (LOAD_SCREEN)
+            s.set_activate (1) 
+
+            # -- Stop updating the map
+            gamedata_engine ().set_update_map (0)
+            gamedata_engine ().set_control_active (0)
+            
+            # -- open the load screen
+            gamedata_engine ().main (s, "load_screen")
+            
+            # -- continue
+            gamedata_engine ().set_update_map (1)
+            gamedata_engine ().set_control_active (1)
+            
+
+        # -- and to the save screen
+        elif input_has_been_pushed (SDLK_s):
+            s = data_screen (SAVE_SCREEN)
+            s.set_activate (1) 
+
+            # -- Stop updating the map
+            gamedata_engine ().set_update_map (0)
+            gamedata_engine ().set_control_active (0)
+            
+            # -- open the save screen
+            gamedata_engine ().main (s, "save_screen")
+
+            # -- continue
+            gamedata_engine ().set_update_map (1)
+            gamedata_engine ().set_control_active (1)
+
+
+        # -- python console
+        elif input_has_been_pushed (SDLK_TAB):
+            import console
+
+            c = console.console (globals ())
+            c.set_activate (1)
+
+            # -- Stop updating the map
+            gamedata_engine ().set_update_map (0)
+            gamedata_engine ().set_control_active (0)
+
+            # -- open the console
+            gamedata_engine ().main (c, "console")
+
+            # -- continue
+            gamedata_engine ().set_update_map (1)
+            gamedata_engine ().set_control_active (1)
diff --git a/scripts/schedules/mapcharacters/keyboard_control.py 
b/scripts/schedules/mapcharacters/keyboard_control.py
index 6a719a4..9be1a2d 100755
--- a/scripts/schedules/mapcharacters/keyboard_control.py
+++ b/scripts/schedules/mapcharacters/keyboard_control.py
@@ -1,3 +1,17 @@
+#
+#  $Id$
+#
+#  (C) Copyright 2001 Alexandre Courbot
+#  Part of the Adonthell Project http://adonthell.linuxgames.com
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License.
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY.
+#
+#  See the COPYING file for more details
+#
+
 from adonthell import *
 
 class keyboard_control:
@@ -77,28 +91,6 @@ class keyboard_control:
                 evt.c = self.myself
                 event_handler_raise_event (evt)
 
-        # -- bring up the main menu
-        elif input_has_been_pushed (SDLK_ESCAPE):
-            import main_menu
-
-            # -- create main menu without animation, with saving and 
background enabled
-            menu = main_menu.main_menu (1, 1, 1)
-
-            # -- Stop updating the map
-            gamedata_engine ().set_update_map (0)
-
-            # -- open the main menu
-            gamedata_engine ().main (menu, "game_menu")
-            
-            # -- main menu closed -> see what to do
-            if menu.get_result () == 5:
-                # -- quit the game
-                gamedata_engine ().main_quit ()
-            else:
-                # -- continue
-                gamedata_engine ().set_update_map (1)
-            
-            menu = None
 
         # -- move the player around
         if input_is_pushed (SDLK_UP): self.myself.go_north ()
@@ -121,48 +113,3 @@ class keyboard_control:
             else:
                 self.myself.jump_to (gamedata_engine ().get_landmap 
().nbr_of_submaps () - 1, 5, 3)
 
-        # -- shortcut to the load screen
-        elif input_has_been_pushed (SDLK_l):
-            s = data_screen (LOAD_SCREEN)
-            s.set_activate (1) 
-
-            # -- Stop updating the map
-            gamedata_engine ().set_update_map (0)
-            
-            # -- open the load screen
-            gamedata_engine ().main (s, "load_screen")
-            
-            # -- continue
-            gamedata_engine ().set_update_map (1)
-            
-        # -- and to the save screen
-        elif input_has_been_pushed (SDLK_s):
-            s = data_screen (SAVE_SCREEN)
-            s.set_activate (1) 
-
-            # -- Stop updating the map
-            gamedata_engine ().set_update_map (0)
-            
-            # -- open the save screen
-            gamedata_engine ().main (s, "save_screen")
-
-            # -- continue
-            gamedata_engine ().set_update_map (1)
-
-        # -- python console
-        elif input_has_been_pushed (SDLK_TAB):
-            import console
-
-            c = console.console (globals ())
-            c.set_activate (1)
-
-            # -- Stop updating the map
-            gamedata_engine ().set_update_map (0)
-
-            # -- open the console
-            gamedata_engine ().main (c, "console")
-
-            # -- continue
-            gamedata_engine ().set_update_map (1)
-
-            c = None



reply via email to

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