[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[adonthell-wastesedge-commits] Release_0-3-1 6f37ab3 213/237: MADE Veran
From: |
Kai Sterker |
Subject: |
[adonthell-wastesedge-commits] Release_0-3-1 6f37ab3 213/237: MADE Veranda fully walkable |
Date: |
Mon, 25 Jul 2016 18:15:13 +0000 (UTC) |
tag: Release_0-3-1
commit 6f37ab3e84ad8c3aacd8d9108c81d10ca82e5bff
Author: adondev <adondev>
Commit: adondev <adondev>
MADE Veranda fully walkable
---
scripts/events/Makefile.am | 2 +-
scripts/events/brn_to_silverhair.py | 4 +-
.../events/{brn_to_silverhair.py => lft_to_vnd.py} | 13 +--
scripts/events/silverhair_to_brn.py | 4 +-
scripts/events/teleport.py | 7 +-
.../events/{brn_to_silverhair.py => vnd_to_lft.py} | 14 +--
scripts/init.py | 24 +---
scripts/modules/events.py | 5 +-
.../schedules/mapcharacters/keyboard_control.py | 118 +++++++-------------
9 files changed, 68 insertions(+), 123 deletions(-)
diff --git a/scripts/events/Makefile.am b/scripts/events/Makefile.am
index bdf5c8b..e5f5ae0 100755
--- a/scripts/events/Makefile.am
+++ b/scripts/events/Makefile.am
@@ -5,7 +5,7 @@ pkgdata_DATA = *.pyc
EXTRA_DIST = teleport.py cellar_to_bjarn.py fst_to_silverhair.py \
character_speak.py open_inn_door.py silverhair_to_fst.py \
silverhair_to_brn.py brn_to_silverhair.py search_chest.py \
- to_storage.py
+ to_storage.py lft_to_vnd.py vnd_to_lft.py
all:
$(adonthell_binary) -c
diff --git a/scripts/events/brn_to_silverhair.py
b/scripts/events/brn_to_silverhair.py
index db09241..c17b527 100644
--- a/scripts/events/brn_to_silverhair.py
+++ b/scripts/events/brn_to_silverhair.py
@@ -31,9 +31,11 @@ class brn_to_silverhair:
def run (self, submap, x, y, dir, name):
p = adonthell.gamedata_get_character (name)
p.set_val ("came_from_barn", 1)
-
+ p.set_val ("on_veranda", 0)
+
events.switch_submap (p, self.smdest, self.xdest, self.ydest,
self.destdir)
adonthell.audio_fade_out_background (500)
+
p.stand ()
p.go_west ()
adonthell.gamedata_get_character ("Imoen Silverhair").launch_action (p)
diff --git a/scripts/events/brn_to_silverhair.py b/scripts/events/lft_to_vnd.py
similarity index 75%
copy from scripts/events/brn_to_silverhair.py
copy to scripts/events/lft_to_vnd.py
index db09241..ca5adac 100644
--- a/scripts/events/brn_to_silverhair.py
+++ b/scripts/events/lft_to_vnd.py
@@ -10,12 +10,13 @@
# See the COPYING file for more details
#
-# -- Map Event to teleport a character from the barn into Silverhair's room
+# -- Map Event to teleport a character from the barn onto
+# the veranda
import adonthell
import events
-class brn_to_silverhair:
+class lft_to_vnd:
# Parameters:
# smdest: destination submap
@@ -30,10 +31,6 @@ class brn_to_silverhair:
def run (self, submap, x, y, dir, name):
p = adonthell.gamedata_get_character (name)
- p.set_val ("came_from_barn", 1)
-
+ p.set_val ("on_veranda", 1)
+
events.switch_submap (p, self.smdest, self.xdest, self.ydest,
self.destdir)
- adonthell.audio_fade_out_background (500)
- p.stand ()
- p.go_west ()
- adonthell.gamedata_get_character ("Imoen Silverhair").launch_action (p)
diff --git a/scripts/events/silverhair_to_brn.py
b/scripts/events/silverhair_to_brn.py
index 4b5dc4f..9cc9fc5 100644
--- a/scripts/events/silverhair_to_brn.py
+++ b/scripts/events/silverhair_to_brn.py
@@ -33,5 +33,7 @@ class silverhair_to_brn:
if p.get_val ("came_from_barn") == 1:
p.set_val ("came_from_barn", 0)
+ p.set_val ("on_veranda", 1)
+
events.switch_submap (p, self.smdest, self.xdest, self.ydest,
self.destdir)
- adonthell.audio_fade_out_background (500)
\ No newline at end of file
+ adonthell.audio_fade_out_background (500)
diff --git a/scripts/events/teleport.py b/scripts/events/teleport.py
index d726570..e4ae359 100644
--- a/scripts/events/teleport.py
+++ b/scripts/events/teleport.py
@@ -25,15 +25,12 @@ class teleport:
# xdest: X position on smdest
# ydest: Y position on smdest
# destdir: direction where to look at after the teleport
- # fade: if 0, won't fade in/out even if the trigger is the player
- def __init__ (self, eventinstance, smdest, xdest, ydest, destdir, fade =
1):
+ def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
self.smdest = smdest
self.xdest = xdest
self.ydest = ydest
self.destdir = destdir
- self.fade = fade
def run (self, submap, x, y, dir, name):
events.switch_submap (adonthell.gamedata_get_character (name),
- self.smdest, self.xdest, self.ydest,
self.destdir,
- self.fade)
+ self.smdest, self.xdest, self.ydest, self.destdir)
diff --git a/scripts/events/brn_to_silverhair.py b/scripts/events/vnd_to_lft.py
similarity index 75%
copy from scripts/events/brn_to_silverhair.py
copy to scripts/events/vnd_to_lft.py
index db09241..fcaf92e 100644
--- a/scripts/events/brn_to_silverhair.py
+++ b/scripts/events/vnd_to_lft.py
@@ -10,13 +10,13 @@
# See the COPYING file for more details
#
-# -- Map Event to teleport a character from the barn into Silverhair's room
+# -- Map Event to teleport a character from the barn onto
+# the veranda
import adonthell
import events
-class brn_to_silverhair:
-
+class vnd_to_lft:
# Parameters:
# smdest: destination submap
# xdest: X position on smdest
@@ -30,10 +30,6 @@ class brn_to_silverhair:
def run (self, submap, x, y, dir, name):
p = adonthell.gamedata_get_character (name)
- p.set_val ("came_from_barn", 1)
-
+ p.set_val ("on_veranda", 0)
+
events.switch_submap (p, self.smdest, self.xdest, self.ydest,
self.destdir)
- adonthell.audio_fade_out_background (500)
- p.stand ()
- p.go_west ()
- adonthell.gamedata_get_character ("Imoen Silverhair").launch_action (p)
diff --git a/scripts/init.py b/scripts/init.py
index 2f73f03..45cd8d9 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -778,7 +778,7 @@ class title_screen:
ev.submap = 21
ev.x = 0
ev.y = 7
- ev.set_script ("teleport", (0, 23, 12, STAND_WEST))
+ ev.set_script ("lft_to_vnd", (0, 23, 12, STAND_WEST))
lm.add_event (ev)
# From veranda to loft
@@ -787,25 +787,7 @@ class title_screen:
ev.submap = 0
ev.x = 24
ev.y = 12
- ev.set_script ("teleport", (21, 1, 7, STAND_EAST))
- lm.add_event (ev)
-
- # From veranda right to veranda left
- ev = enter_event ()
- ev.thisown = C
- ev.submap = 0
- ev.x = 19
- ev.y = 12
- ev.set_script ("teleport", (0, 16, 12, STAND_WEST, 0))
- lm.add_event (ev)
-
- # From veranda left to veranda right
- ev = enter_event ()
- ev.thisown = C
- ev.submap = 0
- ev.x = 17
- ev.y = 12
- ev.set_script ("teleport", (0, 20, 12, STAND_EAST, 0))
+ ev.set_script ("vnd_to_lft", (21, 1, 7, STAND_EAST))
lm.add_event (ev)
# From veranda to silverhair
@@ -817,7 +799,7 @@ class title_screen:
ev.set_script ("brn_to_silverhair", (13, 6, 4, STAND_WEST))
lm.add_event (ev)
- # From silverhair to loft
+ # From silverhair to veranda
ev = enter_event ()
ev.thisown = C
ev.submap = 13
diff --git a/scripts/modules/events.py b/scripts/modules/events.py
index 3965731..4a77e12 100755
--- a/scripts/modules/events.py
+++ b/scripts/modules/events.py
@@ -12,9 +12,10 @@
import adonthell
+
# -- switch submaps (character, new coordinates, new submap,
# direction the character shall face)
-def switch_submap (mychar, x, y, submap, dir, fade = 1):
+def switch_submap (mychar, x, y, submap, dir):
# -- deactivate schedule during teleport
if mychar.is_schedule_activated ():
mychar.set_schedule_active (0)
@@ -23,7 +24,7 @@ def switch_submap (mychar, x, y, submap, dir, fade = 1):
schedule_active = 0
# -- only fade for the player
- if mychar.get_id () == "Player" and fade != 0:
+ if mychar.get_id () == "Player":
# -- fade the new submap in if we teleport the player
adonthell.gamedata_engine ().fade_out ()
mychar.jump_to (x, y, submap, dir)
diff --git a/scripts/schedules/mapcharacters/keyboard_control.py
b/scripts/schedules/mapcharacters/keyboard_control.py
index 65bd46b..9d6f16b 100755
--- a/scripts/schedules/mapcharacters/keyboard_control.py
+++ b/scripts/schedules/mapcharacters/keyboard_control.py
@@ -12,69 +12,28 @@
# See the COPYING file for more details
#
-from adonthell import *
+import adonthell
class keyboard_control:
def __init__ (self, mapcharinstance):
self.myself = mapcharinstance
-
- # Opens the gate
- def open_gate (self):
- # Get the mapobjects
- gate_fore = gamedata_engine ().get_landmap ().get_mapobject (90)
- gate_back = gamedata_engine ().get_landmap ().get_mapobject (89)
-
- # Only open the gate if it's closed...
- if (gate_fore.get_animation (0).currentframe () == 0):
- # Plays the gate back animation
- gate_back.get_animation (0).next_frame ()
- # Plays the gate fore animation
- gate_fore.get_animation (0).next_frame ()
-
- # Update squares walkability
- sm = gamedata_engine ().get_landmap ().get_submap (0)
- sm.get_square (6, 17).set_walkable_south (0)
- sm.get_square (7, 17).set_walkable_south (0)
- sm.get_square (6, 18).set_walkable_west (1)
- sm.get_square (6, 19).set_walkable_west (1)
-
- # Close the gate
- def close_gate (self):
- # Get the mapobjects
- gate_fore = gamedata_engine ().get_landmap ().get_mapobject (90)
- gate_back = gamedata_engine ().get_landmap ().get_mapobject (89)
-
- # Only close the gate if it's opened
- if (gate_fore.get_animation (0).currentframe () == 4):
- # Plays the gate back animation
- gate_back.get_animation (0).next_frame ()
- # Plays the gate fore animation
- gate_fore.get_animation (0).next_frame ()
-
- # Update squares walkability
- sm = gamedata_engine ().get_landmap ().get_submap (0)
- sm.get_square (6, 17).set_walkable (0)
- sm.get_square (7, 17).set_walkable_south (1)
- sm.get_square (6, 18).set_walkable_west (0)
- sm.get_square (6, 19).set_walkable_west (0)
- sm.get_square (6, 20).set_walkable_west (0)
-
-
+ self.wnd = None
+
def run (self):
- if input_has_been_pushed (SDLK_o):
- self.open_gate ()
-
- if input_has_been_pushed (SDLK_c):
- self.close_gate ()
-
+ # -- allow smooth movement on the veranda
+ if self.myself.get_val ("on_veranda") == 1 and self.wnd == None:
+ self.enable_veranda_hack ()
+ elif self.myself.get_val ("on_veranda") != 1 and self.wnd != None:
+ self.disable_veranda_hack ()
+
# -- react to the action key
- if input_has_been_pushed (SDLK_SPACE):
+ if adonthell.input_has_been_pushed (adonthell.SDLK_SPACE):
# -- see whether a character(/object) is next to the player
p = self.myself.whosnext ()
# - Yes :)
- if p != None and p.currentmove () < WALK_NORTH:
+ if p != None and p.currentmove () < adonthell.WALK_NORTH:
# -- launch the other guy's (object's) action script
p.launch_action (self.myself)
@@ -83,33 +42,42 @@ class keyboard_control:
# -- otherwise launch an action event
elif p == None:
- evt = action_event ()
+ evt = adonthell.action_event ()
evt.submap = self.myself.submap ()
evt.x = self.myself.posx ()
evt.y = self.myself.posy ()
evt.dir = self.myself.currentmove ()
evt.c = self.myself
- event_handler_raise_event (evt)
-
+ adonthell.event_handler_raise_event (evt)
# -- move the player around
- if input_is_pushed (SDLK_UP): self.myself.go_north ()
- elif input_is_pushed (SDLK_DOWN): self.myself.go_south ()
- elif input_is_pushed (SDLK_RIGHT): self.myself.go_east ()
- elif input_is_pushed (SDLK_LEFT): self.myself.go_west ()
-
- # Special tip! :)
- elif input_has_been_pushed (SDLK_n):
- if self.myself.submap () < gamedata_engine ().get_landmap
().nbr_of_submaps () - 1:
- self.myself.jump_to (self.myself.submap () + 1, 5, 3)
- else:
- self.myself.jump_to (0, 7, 18)
-
- elif input_has_been_pushed (SDLK_p):
- if self.myself.submap () > 1:
- self.myself.jump_to (self.myself.submap () - 1, 5, 3)
- elif self.myself.submap () == 1:
- self.myself.jump_to (0, 7, 18)
- else:
- self.myself.jump_to (gamedata_engine ().get_landmap
().nbr_of_submaps () - 1, 5, 3)
-
+ elif adonthell.input_is_pushed (adonthell.SDLK_UP):
self.myself.go_north ()
+ elif adonthell.input_is_pushed (adonthell.SDLK_DOWN):
self.myself.go_south ()
+ elif adonthell.input_is_pushed (adonthell.SDLK_RIGHT):
self.myself.go_east ()
+ elif adonthell.input_is_pushed (adonthell.SDLK_LEFT):
self.myself.go_west ()
+
+ # -- BEGIN veranda hack
+ def enable_veranda_hack (self):
+ self.wnd = adonthell.win_container ()
+ self.wnd.set_visible (0)
+ self.wnd.thisown = 0
+ self.wnd.py_signal_connect (self.on_draw, adonthell.win_event_DRAW,
self.myself)
+ adonthell.win_manager_get_active ().add (self.wnd)
+
+ def disable_veranda_hack (self):
+ adonthell.win_manager_get_active ().remove (self.wnd)
+ del self.wnd
+ self.wnd = None
+
+ def on_draw (self, mychar):
+ if mychar.posx () >= 17 and mychar.posx () <= 19:
+ view = adonthell.gamedata_engine ().get_mapview ()
+
+ x = (mychar.posx () - view.posx () - mychar.base_x ()) * 20 \
+ + mychar.offx () - view.offx ()
+
+ y = (mychar.posy () - view.posy () - mychar.base_y ()) * 20 \
+ + mychar.offy () - view.offy ()
+
+ mychar.draw (x, y)
+ # -- END veranda hack
- [adonthell-wastesedge-commits] Release_0-3-1 eb644d3 229/237: FIXED Audio should now be in sync with the extro, (continued)
- [adonthell-wastesedge-commits] Release_0-3-1 eb644d3 229/237: FIXED Audio should now be in sync with the extro, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 4c2c7ff 214/237: Finished entrance for veranda effect., Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 148ae8b 012/237: This module has nothing to do here and may crash everything! (Alex), Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 ecf6760 220/237: ADDED Initial Game Data, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 623d0fc 190/237: *** empty log message ***, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 b27fa89 169/237: FIXED Erek's dialogue (I hope), Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 4306c41 202/237: FIXED Running Alek, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 f286520 193/237: ADDED line about Frostbloom's noise, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 cfc73d0 039/237: ADDED Alek Endhelm, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 dfabd4e 205/237: REMIXED some of the tunes, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 6f37ab3 213/237: MADE Veranda fully walkable,
Kai Sterker <=
- [adonthell-wastesedge-commits] Release_0-3-1 5b397b2 207/237: Varanda is now walkable, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 9b0ce0b 233/237: Fixed running alek animation, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 11fcf14 167/237: ADDED Searching of Silverhair's luggage, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 a447f09 156/237: FIXED some small plot holes, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 b2d5538 216/237: ADDED two more action events, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 de63776 087/237: Experimental Python scripting, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 5975389 197/237: Fixed a typo, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 95f5a33 223/237: FIXED some typos, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 4d12cf8 222/237: FIXED error message at startup, Kai Sterker, 2016/07/25
- [adonthell-wastesedge-commits] Release_0-3-1 397f0ce 209/237: Tuned the extro a bit, Kai Sterker, 2016/07/25