diff --git a/game/story.coffee b/game/story.coffee index d0360fa..bcc8278 100644 --- a/game/story.coffee +++ b/game/story.coffee @@ -46,6 +46,7 @@ room "plaza", room "shop", title: "The Shop" + #pic: "http://loremflickr.com/640/300/room,shop" ways: ["plaza", "shop-inside", "lair"] dsc: """ Being the only shop in town, this trendy establishment did not need a name. diff --git a/lib/room.coffee b/lib/room.coffee index 0f00c3c..b3af465 100644 --- a/lib/room.coffee +++ b/lib/room.coffee @@ -60,6 +60,17 @@ update_ways = (ways, name) -> for node in min_key addClass(document.getElementById("waylink-#{node}"), "destination") +picture_tag = (picture) -> + extension = picture.substr((~-picture.lastIndexOf(".") >>> 0) + 2) + if (extension == "webm") + return """ + + """ + return "Room illustration" + class SaletRoom extends undum.Situation constructor: (spec) -> undum.Situation.call(this, spec) @@ -69,6 +80,11 @@ class SaletRoom extends undum.Situation visited: 0 title: "Room" objects: {} + + # room illustration image, VN-style. Can be a GIF or WEBM. Can be a function. + pic: false + + dsc: false # room description extendSection: false distance: Infinity # distance to the destination clear: true # clear the screen on entering the room? @@ -148,6 +164,9 @@ class SaletRoom extends undum.Situation update_ways(@ways, @name) retval = "" + if @pic + retval += '
'+picture_tag(@pic.fcall(this, character, system, f))+'
' + # Print the room description if @dsc retval += markdown(@dsc.fcall(this, character, system, f)) diff --git a/sass/main.scss b/sass/main.scss index 215f965..1ac7a3a 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -95,6 +95,10 @@ body { @media (min-width: breakpoint-min(sm)) { @include make-col-offset(1); } + .pic { + text-align: center; + margin-bottom: 1em; + } p { hyphens: auto; }