1.0.0 • Published 8 years ago

oasys-converter v1.0.0

Weekly downloads
1
License
Unlicense
Repository
-
Last release
8 years ago
This program is used to compile a OASYS text-adventure game binary into
JavaScript. It will work regardless of OAC or OAA, 16-bits or 32-bits, big
endian or small endian.

The program index.js takes one optional argument, which is a prefix for
the output; for example you may enter "module.exports=" as the prefix. The
OASYS binary is on stdin, and JavaScript code on stdout.

The output is a function that takes four arguments: Save, Load, Quit,
Exit. Load, Quit, and Exit are values that the generated program will
yield in the specified circumstances, while Save is a function that takes
a Int32Array; it will yield the result of that function.

Calling the output function with the arguments specified above will
restart the game and return an array of two functions. The first is a
generator function which must be called first. The second is the function
to process input (call it with a string as its argument), and also returns
a generator or iterator, which should be processed in the same way by the
front-end.

You can call the next() method of the generators in order to achieve the
I/O data. If done is true, then it is finished and you should request
input from the user. Otherwise it will be either a string, which should be
output and then continue the generator (possibly after pausing if needed),
or it will be Load, Quit, Exit, or a return value from Save.

If Save, then it should somehow save the contents of the Int32Array that
was given; this is up to the front-end implementation.

If Load, then it should next() a Int32Array containing the same data that
was saved; if the load fails, next(0).

If Quit, then it should quit, possibly at the option of the user. If the
user decides not to quit, then just continue with next(); otherwise quit
or possibly restart.

If Exit, then it should forcibly end the game, possibly restarting (you
may ask the user if he wants to play again). You should not continue with
next() on the same generator after Exit is received.