changeset 599:64992d05f523 pyweek12

Merge default branch ..r585
author Stefano Rivera <stefano@rivera.za.net>
date Sun, 10 Apr 2011 19:57:21 +0200
parents d350f124b67d (current diff) 9f3c2c0fcf01 (diff)
children 50ba0275a3a3
files
diffstat 19 files changed, 214 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Apr 10 19:54:21 2011 +0200
+++ b/.hgignore	Sun Apr 10 19:57:21 2011 +0200
@@ -4,3 +4,6 @@
 /\._[^/]*$
 /\.~lock\..*#$
 /\.DS_Store$
+^dist/
+^build/
+^.*\.egg-info/$
--- a/BUGS.txt	Sun Apr 10 19:54:21 2011 +0200
+++ b/BUGS.txt	Sun Apr 10 19:57:21 2011 +0200
@@ -1,4 +1,14 @@
 * When on the starting square, pressing the down button activates the door, causing your tails to lose charge.
+* End Tetsuo and Kinedo conversation broken
+* Short dialogue dialogs wrap the options too short.
+* Game Balance
+* Victory Scene sound
+* Re-instate final battle
+* Geisha is completely buggered
+* Kitsune skull for death
+* Unused sounds
+* Most interactions still need to give the relevant information once travesed, not just "Sigh"
+* Interacting with many items / players, puts you slightly below the floor.
 
 FIXED
 =====
--- a/data/game.json	Sun Apr 10 19:54:21 2011 +0200
+++ b/data/game.json	Sun Apr 10 19:57:21 2011 +0200
@@ -38,7 +38,7 @@
         "oil": { "type": "Oil", "level": "road", "pos": [17, 8] },
         "cannon": { "type": "Cannon", "level": "road", "pos": [57, 8], "broken": false, "block": true },
         "rice": { "type": "Rice", "level": "tea_house", "pos": [3, 8], "broken": false },
-        "documents": { "type": "Documents", "level": "tea_house", "pos": [7, 9] },
+        "documents": { "type": "Documents", "level": "tea_house", "pos": [7, 9], "broken": false },
         "vase": { "type": "Vase", "level": "geisha_room", "pos": [22, 4], "broken": false },
         "salmon": { "type": "Salmon", "level": "_limbo", "pos": [1, 3] },
         "no_mask": { "type": "NoMask", "level": "theatre", "pos": [10, 10], "broken": false },
--- a/data/levels/tea_house.json	Sun Apr 10 19:54:21 2011 +0200
+++ b/data/levels/tea_house.json	Sun Apr 10 19:57:21 2011 +0200
@@ -16,7 +16,7 @@
         "X=>............<>.......X",
         "X..?.........?..........X",
         "X=-->..?....<>.....?....X",
-        "X?....?pq?.......?pXXq.?X",
+        "X?....?XX?.......?pXXq.?X",
         "XXXXXXXXXXXXXXXXXXXXXXXXX"
     ],
     "enemies": [
--- a/data/levels/town.json	Sun Apr 10 19:54:21 2011 +0200
+++ b/data/levels/town.json	Sun Apr 10 19:57:21 2011 +0200
@@ -47,7 +47,7 @@
         "to_theatre": {"type": "Doorway", "pos": [13, 5], "facing": "right", "leadsto": "theatre.starting"},
         "to_tea_house": {"type": "Doorway", "pos": [29, 3], "facing": "right", "leadsto": "tea_house.starting"},
         "to_market": {"type": "Doorway", "pos": [44, 6], "facing": "right", "leadsto": "market.starting"},
-        "to_celestial_plane": {"type": "Doorway", "pos": [59, 14], "facing": "left", "leadsto": "celestial_plane.starting"}
+        "to_celestial_plane": {"type": "CelestialDoorway", "pos": [59, 14], "facing": "left", "leadsto": "celestial_plane.starting"}
     },
     "music" : {
         "track" : "ambient japanese music 2.ogg",
--- a/data/npcs/tetsuo.json	Sun Apr 10 19:54:21 2011 +0200
+++ b/data/npcs/tetsuo.json	Sun Apr 10 19:57:21 2011 +0200
@@ -17,7 +17,7 @@
     },
     "inspecting" : {
         "events" : [
-            { "matches" : "npcs.kaneda2.state ==  'preposterous'", "next": "state.shoddy" }
+            { "matches" : "npcs.kaneda2.state !=  'inspecting'", "next": "state.shoddy" }
         ]
     },
     "shoddy" : {
Binary file screenshots/r561-road-sm.png has changed
Binary file screenshots/r561-road.png has changed
--- a/scripts/build_unix.sh	Sun Apr 10 19:54:21 2011 +0200
+++ b/scripts/build_unix.sh	Sun Apr 10 19:57:21 2011 +0200
@@ -1,18 +1,16 @@
 #!/bin/bash
 
-GAME_NAME="nine_tails"
-MODULE_NAME="skaapsteker"
+GAME_NAME="nine-tales"
 
-SS_VERSION=`sed -nre 's/VERSION_STR = "(.*)"/\1/p' setup.py`
-BUILD_NAME="${GAME_NAME}-${SS_VERSION}"
-BUILD_FOLDER="build/${MODULE_NAME}"
+NT_VERSION=`sed -ne 's/VERSION_STR = "\(.*\)"/\1/p' setup.py`
+BUILD_NAME="${GAME_NAME}-${NT_VERSION}"
+BUILD_FOLDER="build/${GAME_NAME}"
 TARBALL_NAME="${BUILD_NAME}.tgz"
 
 rm -rf ${BUILD_FOLDER}
 mkdir -p ${BUILD_FOLDER} dist
 
-cp -r LICENSE.txt README.txt setup.py scripts skaapsteker ${BUILD_FOLDER}/
-cp -r data ${BUILD_FOLDER}/skaapsteker/
+hg archive ${BUILD_FOLDER}/ -I LICENSE.txt -I README.txt  -I setup.py -I run_game.py -I scripts -I data -I skaapsteker
 
 cd build
-tar czf ../dist/${TARBALL_NAME} ${MODULE_NAME}
+tar czf ../dist/${TARBALL_NAME} ${GAME_NAME}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/darwin-py2app.sh	Sun Apr 10 19:57:21 2011 +0200
@@ -0,0 +1,54 @@
+#!/bin/sh
+# Copyright 2009 Jeremy Thurgood <firxen+rinkhals@gmail.com>
+# GPL - see COPYING for details
+#
+# Usage: darwin-py2app
+
+GAME_NAME="nine-tales"
+
+NT_VERSION=`sed -ne 's/VERSION_STR = "\(.*\)"/\1/p' setup.py`
+BUILD_NAME="${GAME_NAME}-${NT_VERSION}"
+BUILD_FOLDER="build/${GAME_NAME}"
+DMG_NAME="${BUILD_NAME}.dmg"
+PY2APP_LOG="py2app.log"
+
+BASEDIR=`pwd`
+
+echo "=== Setting up build environment ==="
+
+./scripts/build_unix.sh
+
+cd ${BUILD_FOLDER}
+
+# find data -name '*.svg' -delete
+
+echo ""
+echo "=== Running python setup.py ==="
+echo "  Nine Tales version: ${NT_VERSION}"
+echo "  Writing log to ${PY2APP_LOG}"
+
+python setup.py py2app >${PY2APP_LOG} 2>&1
+
+echo ""
+echo "=== Removing useless cruft that just takes up space ==="
+echo ""
+
+for dir in docs examples tests; do
+    find "dist/" -path "*/Resources/lib/*/pygame/${dir}/*" -delete
+done
+
+echo "=== Building DMG ==="
+echo ""
+
+cd ${BASEDIR}
+
+pwd
+rm dist/${DMG_NAME} > /dev/null
+hdiutil create -srcfolder ${BUILD_FOLDER}/dist/*.app/ dist/${DMG_NAME}
+
+echo ""
+echo "=== Done ==="
+echo ""
+du -sh dist/* | sed 's/^/   /'
+echo ""
+
--- a/scripts/skaapsteker	Sun Apr 10 19:54:21 2011 +0200
+++ b/scripts/skaapsteker	Sun Apr 10 19:57:21 2011 +0200
@@ -2,7 +2,11 @@
 
 import os.path
 import sys
-sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
+
+if '__file__' in globals():
+    # protect against missing __file__ in Windows executable scripts
+    # (in these cases, assume skaapsteker is already on the path)
+    sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
 
 import skaapsteker.__main__
 if __name__ == "__main__":
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/wine-py2exe	Sun Apr 10 19:57:21 2011 +0200
@@ -0,0 +1,79 @@
+#!/bin/sh
+# wine-py2exe
+#
+# Usage: wine-py2exe
+
+NT_VERSION=`sed -nre 's/VERSION_STR = "(.*)"/\1/p' setup.py`
+BUILD_FOLDER="nine-tales-${NT_VERSION}"
+ZIP_NAME="${BUILD_FOLDER}.zip"
+PY2EXE_LOG="py2exe.log"
+
+WINE_PYTHON=`winepath "C:/Python26"`
+WINE_SYS32=`winepath "C:/windows/system32"`
+
+#
+# Run py2exe build under wine
+#
+
+echo "=== Running wine python setup.py ==="
+echo ""
+echo "  Nine Tales version: ${NT_VERSION}"
+echo "  Writing log to ${PY2EXE_LOG}."
+echo "  ---"
+echo "  Please make sure you have patched your py2exe run.exe"
+echo "  and run_w.exe with PETools (they need to have their"
+echo "  executable size correctly set)."
+echo ""
+
+rm -rf "dist/${BUILD_FOLDER}"
+mkdir -p "dist/${BUILD_FOLDER}"
+rm -rf "dist/${ZIP_NAME}"
+
+wine python setup.py py2exe >${PY2EXE_LOG} 2>&1
+
+#
+# Copy dependencies py2exe missed
+#
+
+echo "=== Copying dependencies that py2exe missed ==="
+echo ""
+
+DEST="dist/${BUILD_FOLDER}"
+
+cp -v "${WINE_SYS32}/python26.dll" "${DEST}"
+cp -v "${WINE_SYS32}/msvcr80.dll" "${DEST}"
+
+echo "'data' -> '${DEST}/data'"
+hg archive -I "path:data/" "${DEST}"
+
+echo "'${WINE_PYTHON}/Lib/site-packages/pygame' -> '${DEST}'"
+rm -rf "${DEST}/pygame"
+cp -R "${WINE_PYTHON}/Lib/site-packages/pygame" "${DEST}"
+rm -rf "${DEST}/pygame/examples" "${DEST}/pygame/tests" "${DEST}/pygame/docs"
+
+#echo "'docs/walkthrough.rst' -> '${DEST}/data'"
+#rm -f "${DEST}/walkthrough.rst"
+#cp "docs/walkthrough.rst" "${DEST}/walkthrough.rst"
+
+echo ""
+
+#
+# create zip file
+#
+
+echo "=== Creating zip of patched py2exe dist folder ==="
+echo ""
+echo "  Zip file: dist/${ZIP_NAME}"
+echo "  Build folder: dist/${BUILD_FOLDER}"
+echo ""
+
+cd dist
+rm -f "$ZIP_NAME"
+zip -r -q "$ZIP_NAME" "$BUILD_FOLDER"
+cd ..
+
+echo "=== Done ==="
+echo ""
+echo -n "  "; du -sh dist/${ZIP_NAME}
+echo -n "  "; du -sh dist/${BUILD_FOLDER}
+echo ""
--- a/setup.py	Sun Apr 10 19:54:21 2011 +0200
+++ b/setup.py	Sun Apr 10 19:57:21 2011 +0200
@@ -14,7 +14,7 @@
 VERSION_STR = "0.1"
 
 setup   (   # Metadata
-            name = "nine_tales",
+            name = "nine-tales",
             version = VERSION_STR,
             description = "Nine Tales of the Kitsune: Platformer for PyWeek 12",
 
@@ -98,7 +98,8 @@
                 ],
             },
             'py2app': {
-                'argv_emulation': 1,
+                'app': ['run_game.py'],
+                'argv_emulation': True,
                 'iconfile': 'data/icons/program/icon.icns',
 #                 'dist_dir': 'dist/nine-tales-%s' % VERSION_STR,
 #                 'bdist_base': 'build/bdist',
--- a/skaapsteker/__main__.py	Sun Apr 10 19:54:21 2011 +0200
+++ b/skaapsteker/__main__.py	Sun Apr 10 19:57:21 2011 +0200
@@ -39,7 +39,7 @@
             dest="level", help="Initial level")
         parser.add_option("--all-tails", action="store_true", default=False,
             dest='all_tails', help="Start with all the tails")
-        parser.add_option("--no-rects", action="store_false", default=True,
+        parser.add_option("--show-rects", action="store_true", default=False,
             dest="rects", help="Disable debugging rects")
     opts, _ = parser.parse_args(args or [])
     options['dvorak'] = opts.dvorak
--- a/skaapsteker/cutscene.py	Sun Apr 10 19:54:21 2011 +0200
+++ b/skaapsteker/cutscene.py	Sun Apr 10 19:57:21 2011 +0200
@@ -105,16 +105,21 @@
     wrap = False
     text = u"""
     Arrow keys control your movement.
-    Double-tap ← or → to sprint
     Z and X to perform attacks.
+    ↓ to pick up / drops items or perform actions.
 
 
     With the right tails, you can do the following:
      C to shift shape.
      V to make you invisible.
+     Double-tap ← or → to sprint.
      Double-tap ↑ to fly.
 
 
+    In conversation use ↑ and ↓ to select a response
+    and ↲ to speak.
+
+
     Dvorak users: Pass the --dvorak command-line argument
     """
     background = 'background_02_back.png'
--- a/skaapsteker/levelscene.py	Sun Apr 10 19:54:21 2011 +0200
+++ b/skaapsteker/levelscene.py	Sun Apr 10 19:57:21 2011 +0200
@@ -59,7 +59,7 @@
 
         for sprite in self._level.sprites:
             # XXX: NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!
-            if isinstance(sprite, base.Monster):
+            if isinstance(sprite, base.Monster) or isinstance(sprite, base.CelestialDoorway):
                 sprite.world = game_state.world
             self._world.add(sprite)
         npcs_and_items = game_state.create_sprites(self._level.name)
@@ -153,7 +153,7 @@
             self._world.freeze()
             self._dialogue = DialogueWidget(npc)
         else:
-            self._close_dialogue()
+            self._close_dialogue(npc)
 
     def _open_notification(self, text):
         if self._dialogue is not None:
--- a/skaapsteker/sprites/base.py	Sun Apr 10 19:54:21 2011 +0200
+++ b/skaapsteker/sprites/base.py	Sun Apr 10 19:57:21 2011 +0200
@@ -359,8 +359,8 @@
             return
         if hasattr(other, 'damage'):
             other.damage(self.DAMAGE)
-        if hasattr(self.source, 'steal_life'):
-            self.source.steal_life(self.DAMAGE)
+            if hasattr(self.source, 'steal_life'):
+                self.source.steal_life(self.DAMAGE)
         self.explode()
 
 
@@ -450,6 +450,16 @@
 
 
 
+class CelestialDoorway(Doorway):
+    def player_action(self, player):
+        from .. import engine
+        if len(self.world.fox.tails) < 8:
+            engine.OpenNotification.post(text="You need eight tails to enter the Celestial Plane.")
+            return
+        super(CelestialDoorway, self).player_action(player)
+
+
+
 class StartingDoorway(Doorway):
     actionable = False
 
--- a/skaapsteker/sprites/items.py	Sun Apr 10 19:54:21 2011 +0200
+++ b/skaapsteker/sprites/items.py	Sun Apr 10 19:57:21 2011 +0200
@@ -232,6 +232,16 @@
 class Salmon(Item):
     image_file = 'props/fish.png'
 
+    def __init__(self, *args, **kw):
+        super(Salmon, self).__init__(*args, **kw)
+        if self._me.level == 'geisha_room':
+            self.wants_updates = True
+
+    def update(self):
+        self.world.missions.fish_in_room = True
+        self.remove()
+        notify("What's that horrible smell?")
+
 
 
 ##################################################
@@ -271,16 +281,26 @@
     broken_image_file = 'props/rice-broken.png'
     breaking_sound = 'sounds/tearing-rice bag.ogg', 0.2
 
+    liftable = False
 
-class Documents(Item):
-    image_file = 'props/documents.png'
+    def smash(self):
+        super(Rice, self).smash()
+        if self.world.items.documents.broken:
+            self.world.missions.kanedas_agreement_disrupted = True
+
 
-    msg = "Let's see if they notice if I add a zero"
+class Documents(BreakableItem):
+    whole_image_file = 'props/documents.png'
+    broken_image_file = 'props/documents.png'
+
+    msg = "Let's see if they notice if I add a zero."
 
     def player_action(self, player):
-        if not self.world.missions.kanedas_agreement_disrupted:
+        if not self._me.broken:
+            notify(self.msg)
+        super(Documents, self).smash()
+        if self.world.items.rice.broken:
             self.world.missions.kanedas_agreement_disrupted = True
-            notify(self.msg)
 
 
 ##################################################
--- a/skaapsteker/sprites/npcs.py	Sun Apr 10 19:54:21 2011 +0200
+++ b/skaapsteker/sprites/npcs.py	Sun Apr 10 19:57:21 2011 +0200
@@ -73,9 +73,11 @@
         super(Kaneda, self).player_action(player)
 
     def update(self):
-        if self.world.missions.kumiko_disgraced and self.alive:
+        super(Kaneda, self).update()
+        if not self._me.present and self.alive and self._me.level == "tea_house":
             self.remove()
-        super(Kaneda, self).update()
+        elif self.world.missions.kumiko_disgraced and self.alive and self._me.level == 'geisha_room':
+            self.remove()
 
 
 class Tetsuo(NPC):