Doh, no I don't. I must have had some old stuff laying around letting the images load outside of the resource file. After cleaning up my folders and trying to re-compile I'm getting an error:
Code: Select all
C:\Hugo\source\DPRK.hug:323: routine drawwindows: Error: Syntax error: loadpicture
I've noticed the flack's cafeteria code also seems to throw this if I don't have the image in place, so I need some sort of correction for using a resource files is my best guess. The actual game will load, but no pictures are displaying. I decided to clean up the source folder after I was having a hard time getting a 3rd image into the game.
Current code:
Code: Select all
!::
! Days in DPRK
!::
!:: Flags
!#set BETA ! Compile with the comments-in-transcripts library addition (requires "beta.h")
!#set GLK ! Compile with glk checks
#set HUGOFIX ! Compile with HugoFix Debugging Library commands available (type $? in game)
!#set HDX ! Compile as Hugo Debuggable Executable (see below for details)
!#set PRECOMPILED_LIBRARY ! Use a precompiled header library (see manual)
!#set VERBSTUBS ! Include the grammar and routines from verbstubs.g and verbstubs.h, respectively
!#set USE_ATTACHABLES ! Use attachable items
!#set USE_PLURAL_OBJECTS ! Use plural objects
!#set USE_VEHICLES ! Use vehicle objects
!$set VERSIONS ! Print library versions at compile time
!#set NO_AUX_MATH ! No advanced math needed
!#set NO_FONTS ! Don't use font effects
!#set NO_FUSES ! Don't use fuses
!#set NO_MENUS ! Don't use menus
!#set NO_RECORDING ! Don't allow transcripts
!#set NO_SCRIPTS ! Don't use character scripts
!#set NO_STRING_ARRAYS ! Don't use string arrays
!#set NO_VERBS ! Don't use any standard verbs
!#set NO_XVERBS ! Don't use any standard "out-of-world" verbs
!:: switches ! example how one can add compiler switches to source
!#switches -ls ! print compilation stats to .LST file
#ifset HUGOFIX
#set DEBUG
#endif
#ifset HDX
#switches -d ! if the -d switch is not set in the compiler itself, #set HDX will produce
! a Hugo Debuggable Executable (.HDX) with extension .HEX
#endif ! Sneaky!
!:: Pre-Hugolib.h Constants (some constants must be set before hugolib is included)
!constant AFTER_PERIOD " " ! include one space after full stops (as opposed to two)
!constant INDENT_SIZE 0 ! no indentation in room descriptions and room content listings
!:: Grammar Library Inclusions (grammar must come first)
! put your new grammar here
verb "screen"
* DoScreen
! new grammar needs to be defined before the including verblib
#include "verblib.g" ! Verb Library
#ifset PRECOMPILED_LIBRARY
#link "hugolib.hlb" ! Your Precompiled Library
#else
#include "hugolib.h" ! Standard Hugo Library
#endif
!:: Other Library Inclusions
#ifset BETA
#include "beta.h"
#endif
#ifset GLK
#include "glk.h"
#endif
#include "resource.h"
#include "window.h"
!:: Other constants and global variables
constant IFID "put-IFID here"
!:: Game Initialization routine
routine init
{
#ifset BETA
if word[1] = "script"
transcript_is_on = true
#endif
STATUSTYPE = 1 ! 0 = none :: 1 = score/turns :: 2 = time
counter = -1 ! 1 step before first turn
! If STATUSTYPE = 2 (time), counter is minutes since midnight, so a game that starts at 3 pm
! should have:
! counter = 899
! (900 minutes minus the one minute the main routine will add on the first turn)
TEXTCOLOR = BRIGHT_WHITE
BGCOLOR = BLACK
SL_TEXTCOLOR = LIGHT_RED
SL_BGCOLOR = BLACK
color TEXTCOLOR, BGCOLOR
verbosity = 2 ! 1 = normal (rooms described only if not previously
! described)
! 2 = full (rooms described every time they are entered)
display.title_caption = "Days in DPRK" ! used for GUI clients for title bar text.
prompt = ">"
window 0 ! resets the windows in case the player is restarting a game
cls
#ifset GLK
glkcheck
#endif
DEFAULT_FONT = PROP_ON
Font(DEFAULT_FONT)
!:: Opening Text
! "Intro to game"
print "" ! For a blank line between the intro and the game title
Font(BOLD_ON)
"Days in DPRK"
Font(BOLD_OFF)
"Three days from three different perspectives in the Democratic Peoples Republic of Korea"
#ifset BETA
string(_temp_string, serial$, 8)
"beta build: \B20";
StringPrint(_temp_string, 6, 8)
StringPrint(_temp_string, 0, 2)
StringPrint(_temp_string, 3, 5)
"\b"
#endif
print BANNER;
#ifset HUGOFIX
print " (Now with HugoFix Technology TM!)"
#else
print ""
#endif
! print IFID
#ifset BETA
"\n(\INOTE: This beta release is intended for testing only, not for
distribution to the general public. Please report any errors,
bugs, etc. to the author. To make a comment, type \"\B* COMMENT TEXT\b\" at the prompt.\i)"
#endif
player = you
location = streetcorner1
old_location = location
move player to location
old_location = location
FindLight(location)
DescribePlace(location)
location is visited
CalculateHolding(player)
#ifset USE_PLURAL_OBJECTS
InitPluralObjects
#endif
}
!:: Main game loop
#ifset PRECOMPILED_LIBRARY
replace main
{
#else
routine main
{
#endif
counter = counter + 1
! PrintStatusLine
DrawWindows
run location.each_turn
runevents
RunScripts
if speaking not in location
speaking = 0
}
player_character you "you"
{
}
!----------------------------------------------------------------------------
! STREET CORNER 1
!----------------------------------------------------------------------------
room streetcorner1 " PYONGYANG STREET INTERSECTION"
{
n_to {currentpicture = "statues" ! extension isn't necessary since we're using a resource file
return streetcorner2 ! so we still make it to the right room
}
long_desc
{
"You are standing with your group at a street intersection in Pyongyang. You have no idea what streets cross before you. Your attention is drawn to a traffic direction girl standing on a round platform in the middle of the intersection. The others in your group start pointing at her and taking pictures."
}
}
scenery trafficgirl "Traffic Girl"
{
nouns "traffic" "girl"
in streetcorner1
long_desc
{
currentpicture = "traffgirl1"
"The traffic girl is busy directing the few automobiles that drive by while trying to ignore the people taking pictures of her."
}
}
global currentpicture = "traffgirl1"
global currentstatus = "\nSTATUS \nCondition: Excellent \n Mood: Amused \n \n INVENTORY \n pack of cigarettes \n postcard \n digital camera \n $40"
!----------------------------------------------------------------------------
! STREET CORNER 2
!----------------------------------------------------------------------------
room streetcorner2 " THREE LARGE STATUES"
{
long_desc
{
"Here are the 3 statues of the 3 leaders."
currentpicture = "statues"
}
}
scenery statue "statue"
{
nouns "statues" "statue"
in streetcorner2
long_desc
{
"The statues are impressive."
}
}
!global currentpicture = "statues"
!global currentstatus = "\nSTATUS \nCondition: Excellent \n Mood: Amused \n \n INVENTORY \n pack of cigarettes \n postcard \n digital camera \n $40"
routine DoScreen
{
print "The screen width is "; number display.screenwidth; " characters."
print "The screen height is "; number display.screenheight; " characters."
print "The line length is "; number display.linelength; " characters."
print "The window lines height is "; number display.windowlines; " characters."
print "The status line height is "; number display.statusline_height; " characters."
print "This interpreter ";
if display.hasgraphics
"supports graphics."
else
"does not support graphics."
}
window_class pictureWindow
{
! The inventory window is the top-right rectangle of the screen:
win_left
return 1
win_top
return 1
win_right
{
if mod(display.screenwidth,2)
return (display.screenwidth/2 - 1)
else
return (display.screenwidth/2)
}
win_bottom
return display.screenheight/3
win_textcolor BLACK
win_backcolor BLACK
}
window_class statusWindow
{
! the description window is the top-left of the screen
win_left
{
return (marginWindow.win_left + 2)
}
win_top
return 1
win_right
return display.screenwidth
win_bottom
return display.screenheight/3
win_textcolor LIGHT_RED
win_backcolor BLACK
}
window_class marginWindow
{
! the description window is the top-left of the screen
win_left
{
if mod(display.screenwidth,2)
return (display.screenwidth/2 + 2)
else
return (display.screenwidth/2 + 3)
}
win_top
return 1
win_right
return display.screenwidth
win_bottom
return display.screenheight/3
win_textcolor LIGHT_RED
win_backcolor BLACK
}
routine DrawWindows
{
Font(PROP_OFF)
window (display.screenheight/3+1)
{
color BLUE, BLUE
cls
color TEXTCOLOR, BGCOLOR
}
run pictureWindow.win_init ! Initialize
window ! Re-open the last-defined
{ ! window (i.e., this one)
LoadPicture("DPRK",currentpicture)
}
run pictureWindow.win_end
run marginWindow.win_init
window
{
cls
}
run marginWindow.win_end
run statusWindow.win_init ! Initialize
window ! Re-open the last-defined
{ ! window (i.e., this one)
print currentstatus;
}
run statusWindow.win_end
}
replace PrintStatusline
{
if display.linelength < 80
display.statusline_height = 2
else
display.statusline_height = 1
Font(BOLD_OFF | ITALIC_OFF | UNDERLINE_OFF | PROP_OFF)
window 1, (display.screenheight/3 +2), display.screenwidth, (display.screenheight/3 +2 + display.statusline_height)
{
color SL_TEXTCOLOR, SL_BGCOLOR
cls
locate 1, 1
if not location
print "\_";
elseif not light_source
print "In the dark";
else
{
if FORMAT & DESCFORM_F: print "\_";
print capital location.name;
}
! (The part we're changing)
! print to 65; ! is 65 characters good for every window size? No!
! Instead, let's begin by writing the entire 'SCORE / MOVES' to array _temp_string
! (_temp_string is an array declared by the library)
text to _temp_string
if STATUSTYPE = 1
print number score; " / "; number counter;
elseif STATUSTYPE = 2
print HoursMinutes(counter);
text to 0
! Ok, we've closed off the string array
! Now, if the screen is wide enough, let's move to the end of the screen MINUS the length of the _temp_string array
! plus two extra spaces for good measure (so there's a little space to the right on the status bar)
if display.statusline_height = 1
print to (display.screenwidth - (StringLength(_temp_string) + 2));
else
{
locate 1, 2
if FORMAT & DESCFORM_F: print "\_";
}
! Now let's print it!
if STATUSTYPE = 1,2
StringPrint(_temp_string)
}
color TEXTCOLOR, BGCOLOR
Font(DEFAULT_FONT)
}
resource.h:
Code: Select all
resource "DPRK"
{
"images/traffgirl1.jpg"
"images/statues.jpg"
! Some more pictures here
}
I have an images folder sitting within the Hugo source folder.