% Virtual World (vworld2.pl) % % Author: Donald Nute % Date: 12/1/1996 % Last modified: 11/13/1999 % % This program contains data and initialization routines for % vworld.pl % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% :- dynamic [vagent_data/6,vmap/3,vobject_icon/2,veff/3,vact/3,vreact/3, vcurrent/2,vstop/0,vstep/1,vrelocate_agent/0,vgame_over/0, movable/1,collectable/1,consumable/1,animate/1,key/7, agent/1,agent_predicates/1,agent_icon/1,vmake_menus/0]. % Information about some common entities. :- multifile vobject_icon/2, veff/3, consumable/1, collectable/1. v_icon(w,rbox). % Solid wall v_icon(f,fruit). % Nourishing food v_icon(c,rcross). % Cure v_icon(o,empty). % Empty space v_icon(p,door). % Portal v_icon(h2o,water). v_icon(s,snail). v_icon(grave,rip). v_icon(t,tree). v_icon(rk,rkey). v_icon(bk,bkey). v_icon(gk,gkey). v_icon(wk,wkey). v_icon(pk,pkey). v_icon(tk,tkey). v_icon(mk,mkey). v_icon(yk,ykey). v_icon(gb,gbutton). v_icon(rb,rbutton). v_icon(bx,bbox). v_icon(yx,ybox). v_icon(gx,gbox). v_icon(sx,sbox). v_icon(px,pbox). veff(f,25,0). veff(c,-1,-100). veff(o,-1,0). veff(p,-1,0). veff(w,-3,0). veff(rb,-1,0). veff(gb,-1,0). veff(h2o,-1,0). veff(h,-1,25). veff(1,-1,0). veff(2,-1,0). veff(3,-1,0). consumable(f). consumable(o). collectable(rk). collectable(bk). collectable(gk). collectable(wk). collectable(pk). collectable(tk). collectable(mk). collectable(yk). % vagent_icons(+List) stores a list of available icons for the agent. vagent_icons([billcat,fred,man,knight,princess,witch,troll,puppy]). % vcreate_screen creates the Virtual World dialog window. vcreate_screen :- wdcreate(vworld,`Virtual World`,0,0,640,480, [ws_popup,ws_sysmenu,ws_caption,ws_border]), wccreate((vworld,2),static,`Strength: `,3,3,47,20, [ws_child,ws_visible,ss_right]), wccreate((vworld,200),static,``,51,3,18,15, [ws_child,ws_visible,ss_left]), wccreate((vworld,3),static,`Damage: `,72,3,45,20, [ws_child,ws_visible,ss_right]), wccreate((vworld,300),static,``,119,3,18,15, [ws_child,ws_visible,ss_left]), wccreate((vworld,4),static,`Inventory: `,219,3,50,20, [ws_child,ws_visible,ss_right]), wccreate((vworld,400),static,``,273,3,240,15, [ws_child,ws_visible,ss_left]), wccreate((vworld,5),static,`Moves: `,140,3,45,20, [ws_child,ws_visible,ss_right]), wccreate((vworld,500),static,``,186,3,25,15, [ws_child,ws_visible,ss_left]), wccreate((vworld,6),static,`Last Move: `,516,3,60,20, [ws_child,ws_visible,ss_right]), wccreate((vworld,600),static,``,580,3,220,15, [ws_child,ws_visible,ss_left]), wccreate((vworld,1),grafix,``,15,20,610,418, [ws_child,ws_visible,ws_border]), window_handler(vworld,v_hndl). % vmake_menus creates the menu bar. vmake_menus :- wmcreate(vfile), vmnuadd(vworld,-1,`&File`,vfile), wmnuadd(vfile,-1,`Load &World`,2000), wmnuadd(vfile,-1,`&Load Agent`,2001), wmnuadd(vfile,-1,`&Save Agent`,2002), wmnuadd(vfile,-1,``,0), wmnuadd(vfile,-1,`e&Xit`,2003), wmnunbl(vfile,1,0), wmnunbl(vfile,2,0), wmcreate(vactions), vmnuadd(vworld,-1,`&Actions`,vactions), wmnuadd(vactions,-1,`&Run Agent`,4000), wmnuadd(vactions,-1,`s&Tep Agent`,4002), wmnuadd(vactions,-1,`Set Run &Limit`,4001), wmnuadd(vactions,-1,`&Stop Agent`,4003), wmnunbl(vactions,0,0), wmnunbl(vactions,1,0), wmnunbl(vactions,2,0), wmnunbl(vactions,3,0), wmcreate(voptions), vmnuadd(vworld,-1,`&Options`,voptions), wmnuadd(voptions,-1,`Change Agent &Icon`,5000), wmnuadd(voptions,-1,`Change Agent &Location`,5001), wmnuadd(voptions,-1,`Reset Agent &Strength`,5002), wmnuadd(voptions,-1,`Reset Agent &Damage`,5003), wmnuadd(voptions,-1,`Agent &View Mode`,5004), wmnuadd(voptions,-1,`&Manual Testing Mode`,5005), wmnuadd(voptions,-1,`&Debugging Mode`,5006), wmnunbl(voptions,0,0), wmnunbl(voptions,1,0), wmnunbl(voptions,2,0), wmnunbl(voptions,3,0), wmnunbl(voptions,4,1), wmnunbl(voptions,5,0), wmcreate(vhelp), vmnuadd(vworld,-1,`&Help`,vhelp), wmnuadd(vhelp,-1,`&Contents`,6000), wmnuadd(vhelp,-1,``,0), wmnuadd(vhelp,-1,`&About`,6001). % vload_icons loads the icons used to represent the objects % and actors in vworld. All icons are stored in the icon % library wvorld.nil. vload_icons :- forall((member(Icon, [empty, dark, bbox, ybox, rbox, gbox, sbox, pbox, rkey, bkey, ykey, gkey, pkey, mkey, tkey, wkey, man, fred, rip, door, fruit, hornet, puppy, snail, rbutton, gbutton, rcross, gcross, tree, sun, billcat, one, two, three, water, flower1, flower2, throne, spray_can, shield, sword, coin, knight, princess, dragon, troll, witch ], M), N is M - 1), gfx_icon_load(Icon,'vworld.nil',N)).