예제 #1
0
파일: Engine.java 프로젝트: Eway/whereigo
  /** invokes creation of clean new game environment */
  private void newGame() throws IOException {
    // starting game normally
    ui.debugMsg("Loading gwc...");
    if (gwcfile == null) throw new IOException("invalid cartridge file");

    ui.debugMsg("pre-setting properties...");
    player.rawset("CompletionCode", gwcfile.code);
    player.rawset("Name", gwcfile.member);

    ui.debugMsg("loading code...");
    byte[] lbc = gwcfile.getBytecode();

    ui.debugMsg("parsing...");
    LuaClosure closure =
        LuaPrototype.loadByteCode(new ByteArrayInputStream(lbc), state.getEnvironment());

    ui.debugMsg("calling...\n");
    state.call(closure, null, null, null);
    lbc = null;
    closure = null;
  }
예제 #2
0
파일: Engine.java 프로젝트: Eway/whereigo
 protected Engine(CartridgeFile cf, OutputStream out) throws IOException {
   gwcfile = cf;
   savegame = cf.getSavegame();
   if (out != null) log = new PrintStream(out);
 }