mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-02 00:07:59 +00:00
DREAMWEB: replaced generated code with c++ style stubs
This commit is contained in:
parent
1a58262ca7
commit
6fe3e63ed1
@ -36,20 +36,19 @@ class cpp:
|
||||
self.failed = list(blacklist)
|
||||
self.translated = []
|
||||
self.proc_addr = []
|
||||
self.forwards = []
|
||||
self.methods = []
|
||||
self.fd.write("""%s
|
||||
|
||||
#include \"%s\"
|
||||
|
||||
namespace %s {
|
||||
|
||||
""" %(banner, header, namespace))
|
||||
|
||||
def expand_cb(self, match):
|
||||
name = match.group(0).lower()
|
||||
if len(name) == 2 and \
|
||||
((name[0] in ['a', 'b', 'c', 'd'] and name[1] in ['h', 'x', 'l']) or name in ['si', 'di', 'es', 'ds', 'cs']):
|
||||
return "context.%s" %name
|
||||
return "%s" %name
|
||||
|
||||
if self.indirection == -1:
|
||||
try:
|
||||
@ -74,7 +73,7 @@ namespace %s {
|
||||
if size == 0:
|
||||
raise Exception("invalid var '%s' size %u" %(name, size))
|
||||
if self.indirection == 0:
|
||||
value = "context.data.%s(k%s)" %("byte" if size == 1 else "word", name.capitalize())
|
||||
value = "data.%s(k%s)" %("byte" if size == 1 else "word", name.capitalize())
|
||||
elif self.indirection == -1:
|
||||
value = "%s" %g.offset
|
||||
self.indirection = 0
|
||||
@ -135,7 +134,7 @@ namespace %s {
|
||||
|
||||
m = re.match(r'seg\s+(.*?)$', expr)
|
||||
if m is not None:
|
||||
return "context.data"
|
||||
return "data"
|
||||
|
||||
match_id = True
|
||||
m = re.match(r'offset\s+(.*?)$', expr)
|
||||
@ -174,7 +173,7 @@ namespace %s {
|
||||
plus = ""
|
||||
match_id = False
|
||||
#print "COMMON_REG: ", reg, plus
|
||||
expr = "context.%s%s" %(reg, plus)
|
||||
expr = "%s%s" %(reg, plus)
|
||||
|
||||
expr = re.sub(r'\b([0-9][a-fA-F0-9]*)h', '0x\\1', expr)
|
||||
expr = re.sub(r'\b([0-1]+)b', parse_bin, expr)
|
||||
@ -188,9 +187,9 @@ namespace %s {
|
||||
|
||||
if indirection == 1:
|
||||
if size == 1:
|
||||
expr = "context.%s.byte(%s)" %(seg_prefix, expr)
|
||||
expr = "%s.byte(%s)" %(seg_prefix, expr)
|
||||
elif size == 2:
|
||||
expr = "context.%s.word(%s)" %(seg_prefix, expr)
|
||||
expr = "%s.word(%s)" %(seg_prefix, expr)
|
||||
else:
|
||||
expr = "@invalid size 0"
|
||||
elif indirection == 0:
|
||||
@ -238,12 +237,11 @@ namespace %s {
|
||||
jump_proc = True
|
||||
|
||||
if jump_proc:
|
||||
self.add_forward(name)
|
||||
return "{ %s(context); return; }" %name
|
||||
return "{ %s(); return; }" %name
|
||||
else:
|
||||
# TODO: name or self.resolve_label(name) or self.mangle_label(name)??
|
||||
if name in self.proc.retlabels:
|
||||
return "return /* (%s) */" % (name,)
|
||||
return "return /* (%s) */" % (name)
|
||||
return "goto %s" %self.resolve_label(name)
|
||||
|
||||
def _label(self, name):
|
||||
@ -256,17 +254,12 @@ namespace %s {
|
||||
print "+scheduling function %s..." %name
|
||||
self.proc_queue.append(name)
|
||||
|
||||
def add_forward(self, name):
|
||||
if name not in self.forwards and name not in self.failed:
|
||||
self.forwards.append(name)
|
||||
|
||||
def _call(self, name):
|
||||
name = name.lower()
|
||||
if name == 'ax':
|
||||
self.body += "\t__dispatch_call(context, %s);\n" %self.expand('ax', 2)
|
||||
self.body += "\t__dispatch_call(%s);\n" %self.expand('ax', 2)
|
||||
return
|
||||
self.body += "\t%s(context);\n" %name
|
||||
self.add_forward(name);
|
||||
self.body += "\t%s();\n" %name
|
||||
self.schedule(name)
|
||||
|
||||
def _ret(self):
|
||||
@ -289,111 +282,111 @@ namespace %s {
|
||||
self.body += "\t%s = %s;\n" %self.parse2(dst, src)
|
||||
|
||||
def _add(self, dst, src):
|
||||
self.body += "\tcontext._add(%s, %s);\n" %self.parse2(dst, src)
|
||||
self.body += "\t_add(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
def _sub(self, dst, src):
|
||||
self.body += "\tcontext._sub(%s, %s);\n" %self.parse2(dst, src)
|
||||
self.body += "\t_sub(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
def _and(self, dst, src):
|
||||
self.body += "\tcontext._and(%s, %s);\n" %self.parse2(dst, src)
|
||||
self.body += "\t_and(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
def _or(self, dst, src):
|
||||
self.body += "\tcontext._or(%s, %s);\n" %self.parse2(dst, src)
|
||||
self.body += "\t_or(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
def _xor(self, dst, src):
|
||||
self.body += "\tcontext._xor(%s, %s);\n" %self.parse2(dst, src)
|
||||
self.body += "\t_xor(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
def _neg(self, dst):
|
||||
dst = self.expand(dst)
|
||||
self.body += "\tcontext._neg(%s);\n" %(dst)
|
||||
self.body += "\t_neg(%s);\n" %(dst)
|
||||
|
||||
def _cbw(self):
|
||||
self.body += "\tcontext.ax.cbw();\n"
|
||||
self.body += "\tax.cbw();\n"
|
||||
|
||||
def _shr(self, dst, src):
|
||||
self.body += "\tcontext._shr(%s, %s);\n" %self.parse2(dst, src)
|
||||
self.body += "\t_shr(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
def _shl(self, dst, src):
|
||||
self.body += "\tcontext._shl(%s, %s);\n" %self.parse2(dst, src)
|
||||
self.body += "\t_shl(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
#def _sar(self, dst, src):
|
||||
# self.body += "\tcontext._sar(%s%s);\n" %self.parse2(dst, src)
|
||||
# self.body += "\t_sar(%s%s);\n" %self.parse2(dst, src)
|
||||
|
||||
#def _sal(self, dst, src):
|
||||
# self.body += "\tcontext._sal(%s, %s);\n" %self.parse2(dst, src)
|
||||
# self.body += "\t_sal(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
#def _rcl(self, dst, src):
|
||||
# self.body += "\tcontext._rcl(%s, %s);\n" %self.parse2(dst, src)
|
||||
# self.body += "\t_rcl(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
#def _rcr(self, dst, src):
|
||||
# self.body += "\tcontext._rcr(%s, %s);\n" %self.parse2(dst, src)
|
||||
# self.body += "\t_rcr(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
def _mul(self, src):
|
||||
src = self.expand(src)
|
||||
self.body += "\tcontext._mul(%s);\n" %(src)
|
||||
self.body += "\t_mul(%s);\n" %(src)
|
||||
|
||||
def _div(self, src):
|
||||
src = self.expand(src)
|
||||
self.body += "\tcontext._div(%s);\n" %(src)
|
||||
self.body += "\t_div(%s);\n" %(src)
|
||||
|
||||
def _inc(self, dst):
|
||||
dst = self.expand(dst)
|
||||
self.body += "\tcontext._inc(%s);\n" %(dst)
|
||||
self.body += "\t_inc(%s);\n" %(dst)
|
||||
|
||||
def _dec(self, dst):
|
||||
dst = self.expand(dst)
|
||||
self.body += "\tcontext._dec(%s);\n" %(dst)
|
||||
self.body += "\t_dec(%s);\n" %(dst)
|
||||
|
||||
def _cmp(self, a, b):
|
||||
self.body += "\tcontext._cmp(%s, %s);\n" %self.parse2(a, b)
|
||||
self.body += "\t_cmp(%s, %s);\n" %self.parse2(a, b)
|
||||
|
||||
def _test(self, a, b):
|
||||
self.body += "\tcontext._test(%s, %s);\n" %self.parse2(a, b)
|
||||
self.body += "\t_test(%s, %s);\n" %self.parse2(a, b)
|
||||
|
||||
def _js(self, label):
|
||||
self.body += "\tif (context.flags.s())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
self.body += "\tif (flags.s())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _jns(self, label):
|
||||
self.body += "\tif (!context.flags.s())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
self.body += "\tif (!flags.s())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _jz(self, label):
|
||||
self.body += "\tif (context.flags.z())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
self.body += "\tif (flags.z())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _jnz(self, label):
|
||||
self.body += "\tif (!context.flags.z())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
self.body += "\tif (!flags.z())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _jl(self, label):
|
||||
self.body += "\tif (context.flags.l())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
self.body += "\tif (flags.l())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _jg(self, label):
|
||||
self.body += "\tif (!context.flags.le())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
self.body += "\tif (!flags.le())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _jle(self, label):
|
||||
self.body += "\tif (context.flags.le())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
self.body += "\tif (flags.le())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _jge(self, label):
|
||||
self.body += "\tif (!context.flags.l())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
self.body += "\tif (!flags.l())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _jc(self, label):
|
||||
self.body += "\tif (context.flags.c())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
self.body += "\tif (flags.c())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _jnc(self, label):
|
||||
self.body += "\tif (!context.flags.c())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
self.body += "\tif (!flags.c())\n\t\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _xchg(self, dst, src):
|
||||
self.body += "\tcontext._xchg(%s, %s);\n" %self.parse2(dst, src)
|
||||
self.body += "\t_xchg(%s, %s);\n" %self.parse2(dst, src)
|
||||
|
||||
def _jmp(self, label):
|
||||
self.body += "\t%s;\n" %(self.jump_to_label(label))
|
||||
|
||||
def _loop(self, label):
|
||||
self.body += "\tif (--context.cx)\n\t\t%s;\n" %self.jump_to_label(label)
|
||||
self.body += "\tif (--cx)\n\t\t%s;\n" %self.jump_to_label(label)
|
||||
|
||||
def _push(self, regs):
|
||||
p = str();
|
||||
for r in regs:
|
||||
r = self.expand(r)
|
||||
p += "\tcontext.push(%s);\n" %(r)
|
||||
p += "\tpush(%s);\n" %(r)
|
||||
self.body += p
|
||||
|
||||
def _pop(self, regs):
|
||||
@ -402,35 +395,35 @@ namespace %s {
|
||||
self.temps_count -= 1
|
||||
i = self.temps_count
|
||||
r = self.expand(r)
|
||||
p += "\t%s = context.pop();\n" %r
|
||||
p += "\t%s = pop();\n" %r
|
||||
self.body += p
|
||||
|
||||
def _rep(self):
|
||||
self.body += "\twhile(context.cx--)\n\t"
|
||||
self.body += "\twhile(cx--)\n\t"
|
||||
|
||||
def _lodsb(self):
|
||||
self.body += "\tcontext._lodsb();\n"
|
||||
self.body += "\t_lodsb();\n"
|
||||
|
||||
def _lodsw(self):
|
||||
self.body += "\tcontext._lodsw();\n"
|
||||
self.body += "\t_lodsw();\n"
|
||||
|
||||
def _stosb(self, n):
|
||||
self.body += "\tcontext._stosb(%s);\n" %("" if n == 1 else n)
|
||||
self.body += "\t_stosb(%s);\n" %("" if n == 1 else n)
|
||||
|
||||
def _stosw(self, n):
|
||||
self.body += "\tcontext._stosw(%s);\n" %("" if n == 1 else n)
|
||||
self.body += "\t_stosw(%s);\n" %("" if n == 1 else n)
|
||||
|
||||
def _movsb(self, n):
|
||||
self.body += "\tcontext._movsb(%s);\n" %("" if n == 1 else n)
|
||||
self.body += "\t_movsb(%s);\n" %("" if n == 1 else n)
|
||||
|
||||
def _movsw(self, n):
|
||||
self.body += "\tcontext._movsw(%s);\n" %("" if n == 1 else n)
|
||||
self.body += "\t_movsw(%s);\n" %("" if n == 1 else n)
|
||||
|
||||
def _stc(self):
|
||||
self.body += "\tcontext.flags._c = true;\n "
|
||||
self.body += "\tflags._c = true;\n "
|
||||
|
||||
def _clc(self):
|
||||
self.body += "\tcontext.flags._c = false;\n "
|
||||
self.body += "\tflags._c = false;\n "
|
||||
|
||||
def __proc(self, name, def_skip = 0):
|
||||
try:
|
||||
@ -457,7 +450,7 @@ namespace %s {
|
||||
|
||||
self.proc_addr.append((name, self.proc.offset))
|
||||
self.body = str()
|
||||
self.body += "void %s(Context &context) {\n\tSTACK_CHECK(context);\n" %name;
|
||||
self.body += "void %sContext::%s() {\n\tSTACK_CHECK;\n" %(self.namespace, name);
|
||||
self.proc.optimize()
|
||||
self.unbounded = []
|
||||
self.proc.visit(self, skip)
|
||||
@ -505,7 +498,7 @@ namespace %s {
|
||||
fd = open(fname, "wt")
|
||||
fd.write("namespace %s {\n" %self.namespace)
|
||||
for p in procs:
|
||||
fd.write("void %s(Context &context) {\n\t::error(\"%s\");\n}\n\n" %(p, p))
|
||||
fd.write("void %sContext::%s() {\n\t::error(\"%s\");\n}\n\n" %(self.namespace, p, p))
|
||||
fd.write("} /*namespace %s */\n" %self.namespace)
|
||||
fd.close()
|
||||
|
||||
@ -526,13 +519,11 @@ namespace %s {
|
||||
print "continuing on %s" %name
|
||||
self.proc_done.append(name)
|
||||
self.__proc(name)
|
||||
self.methods.append(name)
|
||||
self.write_stubs("_stubs.cpp", self.failed)
|
||||
self.methods += self.failed
|
||||
done, failed = len(self.proc_done), len(self.failed)
|
||||
|
||||
for f in self.forwards:
|
||||
if f not in self.failed:
|
||||
self.fd.write("void %s(Context &context);\n" %f)
|
||||
|
||||
self.fd.write("\n")
|
||||
self.fd.write("\n".join(self.translated))
|
||||
self.fd.write("\n\n")
|
||||
@ -546,20 +537,19 @@ namespace %s {
|
||||
n += 1
|
||||
if (n & 0xf) == 0:
|
||||
data_impl += "\n\t\t"
|
||||
data_impl += "};\n\tcontext.ds.assign(src, src + sizeof(src));\n"
|
||||
data_impl += "};\n\tds.assign(src, src + sizeof(src));\n"
|
||||
self.hd.write(
|
||||
"""\n#include "dreamweb/runtime.h"
|
||||
|
||||
namespace %s {
|
||||
|
||||
void __dispatch_call(Context &context, unsigned addr);
|
||||
void __start(Context &context);
|
||||
class %sContext : public Context {
|
||||
public:
|
||||
void __start();
|
||||
void __dispatch_call(uint16 addr);
|
||||
|
||||
""" %(self.namespace))
|
||||
for f in self.failed:
|
||||
self.hd.write("\tvoid %s(Context &context);\n" %f)
|
||||
|
||||
offsets_decl = "\n"
|
||||
"""
|
||||
%(self.namespace, self.namespace))
|
||||
offsets = []
|
||||
for k, v in self.context.get_globals().items():
|
||||
if isinstance(v, op.var):
|
||||
@ -569,20 +559,21 @@ namespace %s {
|
||||
|
||||
offsets = sorted(offsets, key=lambda t: t[1])
|
||||
for o in offsets:
|
||||
offsets_decl += "\tconst static uint16 k%s = %s;\n" %o
|
||||
offsets_decl += "\n"
|
||||
self.hd.write(offsets_decl);
|
||||
self.hd.write("\tconst static uint16 k%s = %s;\n" %o)
|
||||
self.hd.write("\n")
|
||||
for p in set(self.methods):
|
||||
self.hd.write("\tvoid %s();\n" %p)
|
||||
|
||||
self.hd.write("\n}\n\n#endif\n")
|
||||
self.hd.write("};\n}\n\n#endif\n")
|
||||
self.hd.close()
|
||||
|
||||
self.fd.write("\nvoid __start(Context &context) { %s%s(context); \n}\n" %(data_impl, start))
|
||||
self.fd.write("\nvoid %sContext::__start() { %s%s(); \n}\n" %(self.namespace, data_impl, start))
|
||||
|
||||
self.fd.write("\nvoid __dispatch_call(Context &context, unsigned addr) {\n\tswitch(addr) {\n")
|
||||
self.fd.write("\nvoid %sContext::__dispatch_call(uint16 addr) {\n\tswitch(addr) {\n" %self.namespace)
|
||||
self.proc_addr.sort(cmp = lambda x, y: x[1] - y[1])
|
||||
for name,addr in self.proc_addr:
|
||||
self.fd.write("\t\tcase 0x%04x: %s(context); break;\n" %(addr, name))
|
||||
self.fd.write("\t\tdefault: ::error(\"invalid call to %04x dispatched\", (uint16)context.ax);")
|
||||
self.fd.write("\t\tcase 0x%04x: %s(); break;\n" %(addr, name))
|
||||
self.fd.write("\t\tdefault: ::error(\"invalid call to %04x dispatched\", (uint16)ax);")
|
||||
self.fd.write("\n\t}\n}\n\n} /*namespace*/\n")
|
||||
|
||||
self.fd.close()
|
||||
|
@ -61,7 +61,7 @@ class proc:
|
||||
if i + 1 >= len(stmts):
|
||||
break
|
||||
if isinstance(stmts[i + 1], cls):
|
||||
stmts[i + 1].repeat = 'context.cx'
|
||||
stmts[i + 1].repeat = 'cx'
|
||||
del stmts[i]
|
||||
i += 1
|
||||
return
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,76 +8,10 @@
|
||||
|
||||
namespace DreamGen {
|
||||
|
||||
void __dispatch_call(Context &context, unsigned addr);
|
||||
void __start(Context &context);
|
||||
|
||||
void randomnumber(Context &context);
|
||||
void quickquit(Context &context);
|
||||
void quickquit2(Context &context);
|
||||
void seecommandtail(Context &context);
|
||||
void multiget(Context &context);
|
||||
void multiput(Context &context);
|
||||
void multidump(Context &context);
|
||||
void frameoutnm(Context &context);
|
||||
void cls(Context &context);
|
||||
void printundermon(Context &context);
|
||||
void worktoscreen(Context &context);
|
||||
void width160(Context &context);
|
||||
void keyboardread(Context &context);
|
||||
void resetkeyboard(Context &context);
|
||||
void setkeyboardint(Context &context);
|
||||
void readfromfile(Context &context);
|
||||
void closefile(Context &context);
|
||||
void openforsave(Context &context);
|
||||
void openfilenocheck(Context &context);
|
||||
void openfilefromc(Context &context);
|
||||
void openfile(Context &context);
|
||||
void createfile(Context &context);
|
||||
void dontloadseg(Context &context);
|
||||
void mousecall(Context &context);
|
||||
void setmouse(Context &context);
|
||||
void gettime(Context &context);
|
||||
void allocatemem(Context &context);
|
||||
void deallocatemem(Context &context);
|
||||
void removeemm(Context &context);
|
||||
void setupemm(Context &context);
|
||||
void pitinterupt(Context &context);
|
||||
void getridofpit(Context &context);
|
||||
void setuppit(Context &context);
|
||||
void startdmablock(Context &context);
|
||||
void dmaend(Context &context);
|
||||
void restoreems(Context &context);
|
||||
void saveems(Context &context);
|
||||
void bothchannels(Context &context);
|
||||
void channel1only(Context &context);
|
||||
void channel0only(Context &context);
|
||||
void out22c(Context &context);
|
||||
void soundend(Context &context);
|
||||
void interupttest(Context &context);
|
||||
void disablesoundint(Context &context);
|
||||
void enablesoundint(Context &context);
|
||||
void checksoundint(Context &context);
|
||||
void setsoundoff(Context &context);
|
||||
void soundstartup(Context &context);
|
||||
void loadsecondsample(Context &context);
|
||||
void loadsample(Context &context);
|
||||
void loadspeech(Context &context);
|
||||
void saveseg(Context &context);
|
||||
void loadseg(Context &context);
|
||||
void savefileread(Context &context);
|
||||
void savefilewrite(Context &context);
|
||||
void error(Context &context);
|
||||
void generalerror(Context &context);
|
||||
void dosreturn(Context &context);
|
||||
void set16colpalette(Context &context);
|
||||
void mode640x480(Context &context);
|
||||
void showgroup(Context &context);
|
||||
void fadedos(Context &context);
|
||||
void doshake(Context &context);
|
||||
void vsync(Context &context);
|
||||
void setmode(Context &context);
|
||||
void readoneblock(Context &context);
|
||||
void showpcx(Context &context);
|
||||
class DreamGenContext : public Context {
|
||||
public:
|
||||
void __start();
|
||||
void __dispatch_call(uint16 addr);
|
||||
|
||||
const static uint16 kStartvars = 0;
|
||||
const static uint16 kProgresspoints = 1;
|
||||
@ -646,7 +580,762 @@ namespace DreamGen {
|
||||
const static uint16 kMenux = (80+40);
|
||||
const static uint16 kLenofreelrouts = (991-534);
|
||||
|
||||
|
||||
void bothchannels();
|
||||
void usewire();
|
||||
void getnamepos();
|
||||
void drawitall();
|
||||
void clearstartpal();
|
||||
void femalefan();
|
||||
void greyscalesum();
|
||||
void showgamereel();
|
||||
void identifyob();
|
||||
void trysoundalloc();
|
||||
void uselighter();
|
||||
void showmenu();
|
||||
void usepoolreader();
|
||||
void showgroup();
|
||||
void startdmablock();
|
||||
void useopenbox();
|
||||
void clearbuffers();
|
||||
void neterror();
|
||||
void storeit();
|
||||
void lockeddoorway();
|
||||
void isitworn();
|
||||
void putundertimed();
|
||||
void dumpmap();
|
||||
void multidump();
|
||||
void channel0only();
|
||||
void worktoscreenm();
|
||||
void removeemm();
|
||||
void mansatstill();
|
||||
void getobtextstart();
|
||||
void loadfolder();
|
||||
void decide();
|
||||
void dumppointer();
|
||||
void reelsonscreen();
|
||||
void getridofreels();
|
||||
void readkey();
|
||||
void louis();
|
||||
void entrytexts();
|
||||
void getreelstart();
|
||||
void buttonenter();
|
||||
void checkinput();
|
||||
void crosshair();
|
||||
void bresenhams();
|
||||
void getbackfromops();
|
||||
void frameoutv();
|
||||
void restoreall();
|
||||
void screenupdate();
|
||||
void addlength();
|
||||
void usetimedtext();
|
||||
void putundercentre();
|
||||
void checkobjectsize();
|
||||
void commandonly();
|
||||
void adjustlen();
|
||||
void deallocatemem();
|
||||
void mainscreen();
|
||||
void watchreel();
|
||||
void showfolder();
|
||||
void turnanypathoff();
|
||||
void openfilefromc();
|
||||
void gettime();
|
||||
void clearwork();
|
||||
void loadtraveltext();
|
||||
void worktoscreen();
|
||||
void getexpos();
|
||||
void fadedos();
|
||||
void multiget();
|
||||
void fadeupmonfirst();
|
||||
void drawfloor();
|
||||
void loadkeypad();
|
||||
void findsource();
|
||||
void clearendpal();
|
||||
void findtext1();
|
||||
void isryanholding();
|
||||
void interupttest();
|
||||
void usecashcard();
|
||||
void usewall();
|
||||
void opentomb();
|
||||
void buttonfour();
|
||||
void dosometalk();
|
||||
void lockmon();
|
||||
void dochange();
|
||||
void getanyaddir();
|
||||
void showsaveops();
|
||||
void intromonks1();
|
||||
void resetlocation();
|
||||
void oldtonames();
|
||||
void showdiscops();
|
||||
void advisor();
|
||||
void additionaltext();
|
||||
void kernchars();
|
||||
void othersmoker();
|
||||
void autosetwalk();
|
||||
void setuptimedtemp();
|
||||
void blocknametext();
|
||||
void useelevator5();
|
||||
void useelevator4();
|
||||
void useelevator1();
|
||||
void attendant();
|
||||
void useelevator3();
|
||||
void useelevator2();
|
||||
void buttonone();
|
||||
void keyboardread();
|
||||
void deltextline();
|
||||
void entercode();
|
||||
void getopenedsize();
|
||||
void getpersframe();
|
||||
void doshake();
|
||||
void resetkeyboard();
|
||||
void showpanel();
|
||||
void soundstartup();
|
||||
void slabdoora();
|
||||
void fadeupyellows();
|
||||
void slabdoorc();
|
||||
void slabdoorb();
|
||||
void slabdoore();
|
||||
void slabdoord();
|
||||
void adjustup();
|
||||
void readsetdata();
|
||||
void loadintotemp();
|
||||
void loadintroroom();
|
||||
void saveseg();
|
||||
void showblink();
|
||||
void mousecall();
|
||||
void train();
|
||||
void watchcount();
|
||||
void fadedownmon();
|
||||
void loadcart();
|
||||
void splitintolines();
|
||||
void bartender();
|
||||
void eden();
|
||||
void showdiary();
|
||||
void purgealocation();
|
||||
void updatepeople();
|
||||
void slabdoorf();
|
||||
void addtopeoplelist();
|
||||
void hangoncurs();
|
||||
void sparkydrip();
|
||||
void compare();
|
||||
void printcurs();
|
||||
void convertkey();
|
||||
void outofopen();
|
||||
void dealwithspecial();
|
||||
void dircom();
|
||||
void liftsprite();
|
||||
void dumpkeypad();
|
||||
void dumpzoom();
|
||||
void endgameseq();
|
||||
void cancelch0();
|
||||
void setbotleft();
|
||||
void findfirstpath();
|
||||
void showallfree();
|
||||
void loadold();
|
||||
void loadtempcharset();
|
||||
void useslab();
|
||||
void aboutturn();
|
||||
void usealtar();
|
||||
void createpanel2();
|
||||
void turnonpower();
|
||||
void manasleep2();
|
||||
void moretalk();
|
||||
void printslow();
|
||||
void loadroom();
|
||||
void starttalk();
|
||||
void delchar();
|
||||
void getanyad();
|
||||
void endgame();
|
||||
void monprint();
|
||||
void usepipe();
|
||||
void startloading();
|
||||
void getunderzoom();
|
||||
void candles();
|
||||
void backobject();
|
||||
void rollendcredits2();
|
||||
void reminders();
|
||||
void selectslot2();
|
||||
void runtap();
|
||||
void domix();
|
||||
void priesttext();
|
||||
void paneltomap();
|
||||
void obname();
|
||||
void getridoftemp3();
|
||||
void getridoftemp2();
|
||||
void usebalcony();
|
||||
void runendseq();
|
||||
void dumpdiarykeys();
|
||||
void disablesoundint();
|
||||
void checkifset();
|
||||
void showallex();
|
||||
void showrain();
|
||||
void openpoolboss();
|
||||
void buttontwo();
|
||||
void fillopen();
|
||||
void delsprite();
|
||||
void getroomspaths();
|
||||
void dumptextline();
|
||||
void fadescreendownhalf();
|
||||
void useplate();
|
||||
void candles1();
|
||||
void lookininterface();
|
||||
void manasleep();
|
||||
void isitdescribed();
|
||||
void hotelbell();
|
||||
void loadspeech();
|
||||
void cls();
|
||||
void printsprites();
|
||||
void dumptimedtext();
|
||||
void showallobs();
|
||||
void getnumber();
|
||||
void adjustleft();
|
||||
void calledenslift();
|
||||
void useclearbox();
|
||||
void entryanims();
|
||||
void nextfolder();
|
||||
void getfreead();
|
||||
void showarrows();
|
||||
void walkintoroom();
|
||||
void getridoftemptext();
|
||||
void printoutermon();
|
||||
void setuppit();
|
||||
void showpcx();
|
||||
void showdecisions();
|
||||
void checkspeed();
|
||||
void printchar();
|
||||
void showkeypad();
|
||||
void obtoinv();
|
||||
void removeobfrominv();
|
||||
void usecoveredbox();
|
||||
void openyourneighbour();
|
||||
void fadescreenuphalf();
|
||||
void getridoftempcharset();
|
||||
void heavy();
|
||||
void endpaltostart();
|
||||
void showkeys();
|
||||
void usekey();
|
||||
void locklighton();
|
||||
void useladderb();
|
||||
void spriteupdate();
|
||||
void usetempcharset();
|
||||
void discops();
|
||||
void printdirect();
|
||||
void delthisone();
|
||||
void makebackob();
|
||||
void middlepanel();
|
||||
void dumpwatch();
|
||||
void saveload();
|
||||
void monitorlogo();
|
||||
void loadposition();
|
||||
void wornerror();
|
||||
void entersymbol();
|
||||
void showword();
|
||||
void dirfile();
|
||||
void setmode();
|
||||
void walktotext();
|
||||
void pickupconts();
|
||||
void locklightoff();
|
||||
void wearwatch();
|
||||
void runintroseq();
|
||||
void doblocks();
|
||||
void showbyte();
|
||||
void allpalette();
|
||||
void findormake();
|
||||
void nextsymbol();
|
||||
void monks2text();
|
||||
void poolguard();
|
||||
void clearpalette();
|
||||
void cantdrop();
|
||||
void maptopanel();
|
||||
void calcmapad();
|
||||
void getridofall();
|
||||
void copper();
|
||||
void folderhints();
|
||||
void openhoteldoor();
|
||||
void removesetobject();
|
||||
void checkifperson();
|
||||
void frameoutfx();
|
||||
void blank();
|
||||
void drinker();
|
||||
void nextcolon();
|
||||
void placefreeobject();
|
||||
void delpointer();
|
||||
void loopchannel0();
|
||||
void initrain();
|
||||
void showleftpage();
|
||||
void rockstar();
|
||||
void adjustright();
|
||||
void putunderzoom();
|
||||
void vsync();
|
||||
void showseconduse();
|
||||
void turnpathoff();
|
||||
void findinvpos();
|
||||
void usetext();
|
||||
void hangonpq();
|
||||
void liftnoise();
|
||||
void workoutframes();
|
||||
void getbackfromob();
|
||||
void dumpsymbox();
|
||||
void loadgame();
|
||||
void getridoftemp();
|
||||
void showcity();
|
||||
void dumpsymbol();
|
||||
void disablepath();
|
||||
void buttonsix();
|
||||
void intro2text();
|
||||
void showouterpad();
|
||||
void getkeyandlogo();
|
||||
void selectob();
|
||||
void checkcoords();
|
||||
void dumpmenu();
|
||||
void chewy();
|
||||
void accesslighton();
|
||||
void dosreturn();
|
||||
void titles();
|
||||
void quickquit();
|
||||
void showpointer();
|
||||
void usecooker();
|
||||
void loadmenu();
|
||||
void checkforemm();
|
||||
void checkifpathison();
|
||||
void smallcandle();
|
||||
void receptionist();
|
||||
void selectslot();
|
||||
void edenscdplayer();
|
||||
void readoneblock();
|
||||
void fadeupmon();
|
||||
void paltoendpal();
|
||||
void fadetowhite();
|
||||
void textformonk();
|
||||
void loadsavebox();
|
||||
void fadescreenup();
|
||||
void soundend();
|
||||
void redes();
|
||||
void errormessage1();
|
||||
void clearchanges();
|
||||
void errormessage3();
|
||||
void deletetaken();
|
||||
void putundermenu();
|
||||
void checkifex();
|
||||
void intromagic2();
|
||||
void findobname();
|
||||
void edeninbath();
|
||||
void intromagic1();
|
||||
void showdiarypage();
|
||||
void useshield();
|
||||
void getbacktoops();
|
||||
void rollendcredits();
|
||||
void intro1text();
|
||||
void getmapad();
|
||||
void playchannel1();
|
||||
void playchannel0();
|
||||
void usemon();
|
||||
void steady();
|
||||
void pixelcheckset();
|
||||
void reexfrominv();
|
||||
void fillspace();
|
||||
void talk();
|
||||
void usedryer();
|
||||
void dumpeverything();
|
||||
void usehatch();
|
||||
void zoom();
|
||||
void outofinv();
|
||||
void viewfolder();
|
||||
void walking();
|
||||
void diarykeyp();
|
||||
void readabyte();
|
||||
void showframe();
|
||||
void random();
|
||||
void obicons();
|
||||
void frameoutbh();
|
||||
void channel1only();
|
||||
void playguitar();
|
||||
void lastfolder();
|
||||
void transfermap();
|
||||
void showreelframe();
|
||||
void showmonk();
|
||||
void diarykeyn();
|
||||
void set16colpalette();
|
||||
void convicons();
|
||||
void interviewer();
|
||||
void sparky();
|
||||
void purgeanitem();
|
||||
void madman();
|
||||
void createpanel();
|
||||
void turnpathon();
|
||||
void showmainops();
|
||||
void madmanstelly();
|
||||
void constant();
|
||||
void loadroomssample();
|
||||
void getblockofpixel();
|
||||
void paltostartpal();
|
||||
void bossman();
|
||||
void getridofpit();
|
||||
void convnum();
|
||||
void nothelderror();
|
||||
void readheader();
|
||||
void getsetad();
|
||||
void getyad();
|
||||
void reconstruct();
|
||||
void soldier1();
|
||||
void getundercentre();
|
||||
void checkforexit();
|
||||
void loadseg();
|
||||
void makeheader();
|
||||
void setkeyboardint();
|
||||
void priest();
|
||||
void readmouse();
|
||||
void powerlighton();
|
||||
void savefilewrite();
|
||||
void printmessage2();
|
||||
void loadnews();
|
||||
void rollem();
|
||||
void makeworn();
|
||||
void examineobtext();
|
||||
void startup();
|
||||
void savegame();
|
||||
void startpaltoend();
|
||||
void showicon();
|
||||
void findopenpos();
|
||||
void describeob();
|
||||
void deleteexframe();
|
||||
void folderexit();
|
||||
void useplinth();
|
||||
void wheelsound();
|
||||
void actualsave();
|
||||
void autolook();
|
||||
void checkbasemem();
|
||||
void transfertext();
|
||||
void searchforsame();
|
||||
void enablesoundint();
|
||||
void getback1();
|
||||
void setlocation();
|
||||
void fadefromwhite();
|
||||
void animpointer();
|
||||
void usewindow();
|
||||
void wearshades();
|
||||
void onedigit();
|
||||
void pitinterupt();
|
||||
void deleverything();
|
||||
void fadescreendown();
|
||||
void findxyfrompath();
|
||||
void namestoold();
|
||||
void getxad();
|
||||
void openinv();
|
||||
void lookatplace();
|
||||
void useaxe();
|
||||
void examineob();
|
||||
void buttonnought();
|
||||
void useelvdoor();
|
||||
void putbackobstuff();
|
||||
void useladder();
|
||||
void realcredits();
|
||||
void handclap();
|
||||
void smokebloke();
|
||||
void showexit();
|
||||
void printundermon();
|
||||
void buttonnine();
|
||||
void findallopen();
|
||||
void loadintotemp3();
|
||||
void loadintotemp2();
|
||||
void gamer();
|
||||
void personnametext();
|
||||
void quitsymbol();
|
||||
void readfromfile();
|
||||
void initialinv();
|
||||
void showslots();
|
||||
void dofade();
|
||||
void hangon();
|
||||
void settopright();
|
||||
void findsetobject();
|
||||
void singlekey();
|
||||
void seecommandtail();
|
||||
void getundertimed();
|
||||
void hangone();
|
||||
void carparkdrip();
|
||||
void usediary();
|
||||
void deleteexobject();
|
||||
void frameoutnm();
|
||||
void moneypoke();
|
||||
void destselect();
|
||||
void restoreems();
|
||||
void lastdest();
|
||||
void removefreeobject();
|
||||
void trapdoor();
|
||||
void openlouis();
|
||||
void buttonthree();
|
||||
void getundermenu();
|
||||
void randomnumber();
|
||||
void lookatcard();
|
||||
void helicopter();
|
||||
void scrollmonitor();
|
||||
void setsoundoff();
|
||||
void setpickup();
|
||||
void dropobject();
|
||||
void printmessage();
|
||||
void reexfromopen();
|
||||
void fillryan();
|
||||
void loadtemptext();
|
||||
void usestereo();
|
||||
void showcurrentfile();
|
||||
void copyname();
|
||||
void look();
|
||||
void setmouse();
|
||||
void checkone();
|
||||
void transferinv();
|
||||
void candles2();
|
||||
void pickupob();
|
||||
void error();
|
||||
void showopbox();
|
||||
void clearbeforeload();
|
||||
void biblequote();
|
||||
void doload();
|
||||
void afterintroroom();
|
||||
void blockget();
|
||||
void usetrainer();
|
||||
void allocatework();
|
||||
void addtopresslist();
|
||||
void walkandexamine();
|
||||
void dmaend();
|
||||
void quickquit2();
|
||||
void twodigitnum();
|
||||
void madmantext();
|
||||
void dumpcurrent();
|
||||
void textforend();
|
||||
void showdiarykeys();
|
||||
void dontloadseg();
|
||||
void madmode();
|
||||
void intro3text();
|
||||
void allocatemem();
|
||||
void sortoutmap();
|
||||
void doorway();
|
||||
void useopened();
|
||||
void inventory();
|
||||
void powerlightoff();
|
||||
void getroomdata();
|
||||
void showoutermenu();
|
||||
void signon();
|
||||
void deleteextext();
|
||||
void foghornsound();
|
||||
void showrightpage();
|
||||
void openhoteldoor2();
|
||||
void examicon();
|
||||
void showgun();
|
||||
void switchryanon();
|
||||
void louischair();
|
||||
void saveems();
|
||||
void locationpic();
|
||||
void getflagunderp();
|
||||
void dolook();
|
||||
void opentvdoor();
|
||||
void triggermessage();
|
||||
void finalframe();
|
||||
void plotreel();
|
||||
void swapwithopen();
|
||||
void makesprite();
|
||||
void dreamweb();
|
||||
void droperror();
|
||||
void openfilenocheck();
|
||||
void calledensdlift();
|
||||
void checkinside();
|
||||
void gates();
|
||||
void selectlocation();
|
||||
void showwatch();
|
||||
void turnanypathon();
|
||||
void restorereels();
|
||||
void setwalk();
|
||||
void printboth();
|
||||
void useroutine();
|
||||
void zoomicon();
|
||||
void hotelcontrol();
|
||||
void findpathofpoint();
|
||||
void issetobonmap();
|
||||
void getdestinfo();
|
||||
void drunk();
|
||||
void dumpblink();
|
||||
void setuptimeduse();
|
||||
void grafittidoor();
|
||||
void input();
|
||||
void nextdest();
|
||||
void getdimension();
|
||||
void makecaps();
|
||||
void read();
|
||||
void fadescreenups();
|
||||
void checkdest();
|
||||
void initman();
|
||||
void loadpalfromiff();
|
||||
void facerightway();
|
||||
void startup1();
|
||||
void findlen();
|
||||
void showsymbol();
|
||||
void mugger();
|
||||
void atmospheres();
|
||||
void out22c();
|
||||
void loadpersonal();
|
||||
void gettingshot();
|
||||
void settopleft();
|
||||
void searchforstring();
|
||||
void clearsprites();
|
||||
void obpicture();
|
||||
void selectopenob();
|
||||
void widedoor();
|
||||
void security();
|
||||
void printasprite();
|
||||
void buttonfive();
|
||||
void soundonreels();
|
||||
void usegun();
|
||||
void autoappear();
|
||||
void findnextcolon();
|
||||
void readmouse4();
|
||||
void openryan();
|
||||
void readmouse1();
|
||||
void showman();
|
||||
void readmouse2();
|
||||
void newplace();
|
||||
void movemap();
|
||||
void loadsample();
|
||||
void usecardreader1();
|
||||
void usecardreader2();
|
||||
void usecardreader3();
|
||||
void tattooman();
|
||||
void usehandle();
|
||||
void quitkey();
|
||||
void openfile();
|
||||
void usecharset1();
|
||||
void makenextblock();
|
||||
void showpuztext();
|
||||
void addalong();
|
||||
void width160();
|
||||
void incryanpage();
|
||||
void dodoor();
|
||||
void eraseoldobs();
|
||||
void buttoneight();
|
||||
void opensarters();
|
||||
void findexobject();
|
||||
void errormessage2();
|
||||
void usechurchhole();
|
||||
void searchforfiles();
|
||||
void monkspeaking();
|
||||
void fadecalculation();
|
||||
void waitframes();
|
||||
void clearrest();
|
||||
void getreelframeax();
|
||||
void barwoman();
|
||||
void roomname();
|
||||
void credits();
|
||||
void madmanrun();
|
||||
void randomnum1();
|
||||
void keeper();
|
||||
void afternewroom();
|
||||
void getexad();
|
||||
void aide();
|
||||
void openforsave();
|
||||
void closefile();
|
||||
void delcurs();
|
||||
void randomaccess();
|
||||
void calcfrframe();
|
||||
void intromagic3();
|
||||
void initialmoncols();
|
||||
void checkforshake();
|
||||
void usebuttona();
|
||||
void cancelch1();
|
||||
void getnextword();
|
||||
void generalerror();
|
||||
void actualload();
|
||||
void allocateload();
|
||||
void saveposition();
|
||||
void mode640x480();
|
||||
void openeden();
|
||||
void execcommand();
|
||||
void obsthatdothings();
|
||||
void updatesymbolbot();
|
||||
void findpuztext();
|
||||
void usechurchgate();
|
||||
void monkandryan();
|
||||
void allocatebuffers();
|
||||
void swapwithinv();
|
||||
void usecontrol();
|
||||
void buttonseven();
|
||||
void redrawmainscrn();
|
||||
void finishedwalking();
|
||||
void findallryan();
|
||||
void channel0tran();
|
||||
void buttonpress();
|
||||
void parseblaster();
|
||||
void callhotellift();
|
||||
void makemainscreen();
|
||||
void intromonks2();
|
||||
void usewinch();
|
||||
void setbotright();
|
||||
void readmouse3();
|
||||
void showfirstuse();
|
||||
void setupemm();
|
||||
void usefullcart();
|
||||
void transfertoex();
|
||||
void getlocation();
|
||||
void geteitherad();
|
||||
void placesetobject();
|
||||
void drawflags();
|
||||
void zoomonoff();
|
||||
void updatesymboltop();
|
||||
void showryanpage();
|
||||
void printlogo();
|
||||
void allpointer();
|
||||
void checksoundint();
|
||||
void clearreels();
|
||||
void malefan();
|
||||
void dosaveload();
|
||||
void createname();
|
||||
void readcitypic();
|
||||
void getpersontext();
|
||||
void intoinv();
|
||||
void showtime();
|
||||
void parser();
|
||||
void hangonw();
|
||||
void intro();
|
||||
void hangonp();
|
||||
void fadescreendowns();
|
||||
void showloadops();
|
||||
void getridoftempsp();
|
||||
void scanfornames();
|
||||
void setallchanges();
|
||||
void newgame();
|
||||
void examinventory();
|
||||
void standardload();
|
||||
void undertextline();
|
||||
void findroominloc();
|
||||
void sitdowninbar();
|
||||
void shownames();
|
||||
void savefileread();
|
||||
void emergencypurge();
|
||||
void usemenu();
|
||||
void alleybarksound();
|
||||
void usecart();
|
||||
void intromusic();
|
||||
void makename();
|
||||
void processtrigger();
|
||||
void monmessage();
|
||||
void readdesticon();
|
||||
void randomnum2();
|
||||
void loadsecondsample();
|
||||
void transfercontoex();
|
||||
void multiput();
|
||||
void isitright();
|
||||
void businessman();
|
||||
void switchryanoff();
|
||||
void commandwithob();
|
||||
void panelicons1();
|
||||
void adjustdown();
|
||||
void withwhat();
|
||||
void openob();
|
||||
void createfile();
|
||||
void userailing();
|
||||
void accesslightoff();
|
||||
void usehole();
|
||||
void useobject();
|
||||
void mainman();
|
||||
void volumeadjust();
|
||||
void checkiffree();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -42,12 +42,6 @@
|
||||
#include "dreamweb/dreamweb.h"
|
||||
#include "dreamweb/dreamgen.h"
|
||||
|
||||
namespace DreamGen {
|
||||
void doshake(DreamGen::Context &context);
|
||||
void dofade(DreamGen::Context &context);
|
||||
void volumeadjust(DreamGen::Context &context);
|
||||
}
|
||||
|
||||
namespace DreamWeb {
|
||||
|
||||
DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc) :
|
||||
@ -100,8 +94,8 @@ void DreamWebEngine::waitForVSync() {
|
||||
setVSyncInterrupt(false);
|
||||
}
|
||||
|
||||
DreamGen::doshake(_context);
|
||||
DreamGen::dofade(_context);
|
||||
_context.doshake();
|
||||
_context.dofade();
|
||||
_system->updateScreen();
|
||||
}
|
||||
|
||||
@ -139,8 +133,8 @@ void DreamWebEngine::processEvents() {
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_c: //skip statue puzzle
|
||||
_context.data.byte(DreamGen::kSymbolbotnum) = 3;
|
||||
_context.data.byte(DreamGen::kSymboltopnum) = 5;
|
||||
_context.data.byte(DreamGen::DreamGenContext::kSymbolbotnum) = 3;
|
||||
_context.data.byte(DreamGen::DreamGenContext::kSymboltopnum) = 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -170,7 +164,7 @@ void DreamWebEngine::processEvents() {
|
||||
break;
|
||||
}
|
||||
|
||||
_context.data.byte(DreamGen::kLasthardkey) = hardKey;
|
||||
_context.data.byte(DreamGen::DreamGenContext::kLasthardkey) = hardKey;
|
||||
|
||||
// The rest of the keys are converted to ASCII. This
|
||||
// is fairly restrictive, and eventually we may want
|
||||
@ -213,7 +207,7 @@ Common::Error DreamWebEngine::run() {
|
||||
getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this);
|
||||
//http://martin.hinner.info/vga/timing.html
|
||||
|
||||
DreamGen::__start(_context);
|
||||
_context.__start();
|
||||
|
||||
getTimerManager()->removeTimerProc(vSyncInterrupt);
|
||||
|
||||
@ -294,13 +288,13 @@ uint DreamWebEngine::readFromSaveFile(uint8 *data, uint size) {
|
||||
void DreamWebEngine::keyPressed(uint16 ascii) {
|
||||
debug(2, "key pressed = %04x", ascii);
|
||||
uint8* keybuf = _context.data.ptr(5912, 16); //fixme: some hardcoded offsets are not added as consts
|
||||
uint16 in = (_context.data.word(DreamGen::kBufferin) + 1) & 0x0f;
|
||||
uint16 out = _context.data.word(DreamGen::kBufferout);
|
||||
uint16 in = (_context.data.word(DreamGen::DreamGenContext::kBufferin) + 1) & 0x0f;
|
||||
uint16 out = _context.data.word(DreamGen::DreamGenContext::kBufferout);
|
||||
if (in == out) {
|
||||
warning("keyboard buffer is full");
|
||||
return;
|
||||
}
|
||||
_context.data.word(DreamGen::kBufferin) = in;
|
||||
_context.data.word(DreamGen::DreamGenContext::kBufferin) = in;
|
||||
keybuf[in] = ascii;
|
||||
}
|
||||
|
||||
@ -326,11 +320,11 @@ void DreamWebEngine::mouseCall() {
|
||||
}
|
||||
|
||||
void DreamWebEngine::fadeDos() {
|
||||
_context.ds = _context.es = _context.data.word(DreamGen::kBuffers);
|
||||
_context.ds = _context.es = _context.data.word(DreamGen::DreamGenContext::kBuffers);
|
||||
return; //fixme later
|
||||
waitForVSync();
|
||||
//processEvents will be called from vsync
|
||||
uint8 *dst = _context.es.ptr(DreamGen::kStartpal, 768);
|
||||
uint8 *dst = _context.es.ptr(DreamGen::DreamGenContext::kStartpal, 768);
|
||||
getPalette(dst, 0, 64);
|
||||
for(int fade = 0; fade < 64; ++fade) {
|
||||
for(int c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors
|
||||
@ -379,9 +373,9 @@ void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int
|
||||
}
|
||||
|
||||
void DreamWebEngine::printUnderMonitor() {
|
||||
_context.es = _context.data.word(DreamGen::kWorkspace);
|
||||
_context.di = DreamGen::kScreenwidth * 43 + 76;
|
||||
_context.si = _context.di + 8 * DreamGen::kScreenwidth;
|
||||
_context.es = _context.data.word(DreamGen::DreamGenContext::kWorkspace);
|
||||
_context.di = DreamGen::DreamGenContext::kScreenwidth * 43 + 76;
|
||||
_context.si = _context.di + 8 * DreamGen::DreamGenContext::kScreenwidth;
|
||||
|
||||
Graphics::Surface *s = _system->lockScreen();
|
||||
if (!s)
|
||||
@ -397,8 +391,8 @@ void DreamWebEngine::printUnderMonitor() {
|
||||
++dst; ++src;
|
||||
}
|
||||
}
|
||||
_context._add(_context.di, DreamGen::kScreenwidth);
|
||||
_context._add(_context.si, DreamGen::kScreenwidth);
|
||||
_context._add(_context.di, DreamGen::DreamGenContext::kScreenwidth);
|
||||
_context._add(_context.si, DreamGen::DreamGenContext::kScreenwidth);
|
||||
}
|
||||
_context.cx = 0;
|
||||
_system->unlockScreen();
|
||||
@ -477,10 +471,10 @@ bool DreamWebEngine::loadSpeech(const Common::String &filename) {
|
||||
|
||||
void DreamWebEngine::soundHandler() {
|
||||
_context.push(_context.ax);
|
||||
volumeadjust(_context);
|
||||
_context.volumeadjust();
|
||||
_context.ax = _context.pop();
|
||||
|
||||
uint volume = _context.data.byte(DreamGen::kVolume);
|
||||
uint volume = _context.data.byte(DreamGen::DreamGenContext::kVolume);
|
||||
//.vol file loaded into soundbuf:0x4000
|
||||
//volume table at (volume * 0x100 + 0x3f00)
|
||||
//volume value could be from 1 to 7
|
||||
@ -496,13 +490,13 @@ void DreamWebEngine::soundHandler() {
|
||||
volume = (8 - volume) * Audio::Mixer::kMaxChannelVolume / 8;
|
||||
_mixer->setChannelVolume(_channelHandle[0], volume);
|
||||
|
||||
uint8 ch0 = _context.data.byte(DreamGen::kCh0playing);
|
||||
uint8 ch0 = _context.data.byte(DreamGen::DreamGenContext::kCh0playing);
|
||||
if (ch0 == 255)
|
||||
ch0 = 0;
|
||||
uint8 ch1 = _context.data.byte(DreamGen::kCh1playing);
|
||||
uint8 ch1 = _context.data.byte(DreamGen::DreamGenContext::kCh1playing);
|
||||
if (ch1 == 255)
|
||||
ch1 = 0;
|
||||
uint8 ch0loop = _context.data.byte(DreamGen::kCh0repeat);
|
||||
uint8 ch0loop = _context.data.byte(DreamGen::DreamGenContext::kCh0repeat);
|
||||
|
||||
if (_channel0 != ch0) {
|
||||
_channel0 = ch0;
|
||||
@ -517,11 +511,11 @@ void DreamWebEngine::soundHandler() {
|
||||
}
|
||||
}
|
||||
if (!_mixer->isSoundHandleActive(_channelHandle[0])) {
|
||||
_context.data.byte(DreamGen::kCh0playing) = 255;
|
||||
_context.data.byte(DreamGen::DreamGenContext::kCh0playing) = 255;
|
||||
_channel0 = 0;
|
||||
}
|
||||
if (!_mixer->isSoundHandleActive(_channelHandle[1])) {
|
||||
_context.data.byte(DreamGen::kCh1playing) = 255;
|
||||
_context.data.byte(DreamGen::DreamGenContext::kCh1playing) = 255;
|
||||
_channel1 = 0;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ private:
|
||||
Audio::SoundHandle _channelHandle[2];
|
||||
uint8 _channel0, _channel1;
|
||||
|
||||
DreamGen::Context _context;
|
||||
DreamGen::DreamGenContext _context;
|
||||
};
|
||||
|
||||
} // End of namespace DreamWeb
|
||||
|
@ -542,9 +542,9 @@ public:
|
||||
};
|
||||
|
||||
#ifndef NDEBUG
|
||||
# define STACK_CHECK(context) StackChecker checker(context)
|
||||
# define STACK_CHECK StackChecker checker(*this)
|
||||
#else
|
||||
# define STACK_CHECK(context) do {} while (0)
|
||||
# define STACK_CHECK do {} while (0)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -13,220 +13,220 @@ Common::String getFilename(Context &context) {
|
||||
return name;
|
||||
}
|
||||
|
||||
void multiget(Context &context) {
|
||||
unsigned w = (uint8)context.cl, h = (uint8)context.ch;
|
||||
unsigned x = (uint16)context.di, y = (uint16)context.bx;
|
||||
void DreamGenContext::multiget() {
|
||||
unsigned w = (uint8)cl, h = (uint8)ch;
|
||||
unsigned x = (uint16)di, y = (uint16)bx;
|
||||
unsigned src = x + y * kScreenwidth;
|
||||
unsigned dst = (uint16)context.si;
|
||||
context.es = context.ds;
|
||||
context.ds = context.data.word(kWorkspace);
|
||||
unsigned dst = (uint16)si;
|
||||
es = ds;
|
||||
ds = data.word(kWorkspace);
|
||||
if (y + h > 200)
|
||||
h = 200 - y;
|
||||
if (x + w > 320)
|
||||
w = 320 - x;
|
||||
//debug(1, "multiget %u,%u %ux%u -> segment: %04x->%04x", x, y, w, h, (uint16)context.ds, (uint16)context.es);
|
||||
//debug(1, "multiget %u,%u %ux%u -> segment: %04x->%04x", x, y, w, h, (uint16)ds, (uint16)es);
|
||||
for(unsigned l = 0; l < h; ++l) {
|
||||
uint8 *src_p = context.ds.ptr(src + kScreenwidth * l, w);
|
||||
uint8 *dst_p = context.es.ptr(dst + w * l, w);
|
||||
uint8 *src_p = ds.ptr(src + kScreenwidth * l, w);
|
||||
uint8 *dst_p = es.ptr(dst + w * l, w);
|
||||
memcpy(dst_p, src_p, w);
|
||||
}
|
||||
context.si += w * h;
|
||||
context.di = src + kScreenwidth * h;
|
||||
context.cx = 0;
|
||||
si += w * h;
|
||||
di = src + kScreenwidth * h;
|
||||
cx = 0;
|
||||
}
|
||||
|
||||
void multiput(Context &context) {
|
||||
unsigned w = (uint8)context.cl, h = (uint8)context.ch;
|
||||
unsigned x = (uint16)context.di, y = (uint16)context.bx;
|
||||
unsigned src = (uint16)context.si;
|
||||
void DreamGenContext::multiput() {
|
||||
unsigned w = (uint8)cl, h = (uint8)ch;
|
||||
unsigned x = (uint16)di, y = (uint16)bx;
|
||||
unsigned src = (uint16)si;
|
||||
unsigned dst = x + y * kScreenwidth;
|
||||
context.es = context.data.word(kWorkspace);
|
||||
es = data.word(kWorkspace);
|
||||
if (y + h > 200)
|
||||
h = 200 - y;
|
||||
if (x + w > 320)
|
||||
w = 320 - x;
|
||||
//debug(1, "multiput %ux%u -> segment: %04x->%04x", w, h, (uint16)context.ds, (uint16)context.es);
|
||||
//debug(1, "multiput %ux%u -> segment: %04x->%04x", w, h, (uint16)ds, (uint16)es);
|
||||
for(unsigned l = 0; l < h; ++l) {
|
||||
uint8 *src_p = context.ds.ptr(src + w * l, w);
|
||||
uint8 *dst_p = context.es.ptr(dst + kScreenwidth * l, w);
|
||||
uint8 *src_p = ds.ptr(src + w * l, w);
|
||||
uint8 *dst_p = es.ptr(dst + kScreenwidth * l, w);
|
||||
memcpy(dst_p, src_p, w);
|
||||
}
|
||||
context.si += w * h;
|
||||
context.di = dst + kScreenwidth * h;
|
||||
context.cx = 0;
|
||||
si += w * h;
|
||||
di = dst + kScreenwidth * h;
|
||||
cx = 0;
|
||||
}
|
||||
|
||||
void multidump(Context &context) {
|
||||
context.ds = context.data.word(kWorkspace);
|
||||
int w = (uint8)context.cl, h = (uint8)context.ch;
|
||||
int x = (int16)context.di, y = (int16)context.bx;
|
||||
void DreamGenContext::multidump() {
|
||||
ds = data.word(kWorkspace);
|
||||
int w = (uint8)cl, h = (uint8)ch;
|
||||
int x = (int16)di, y = (int16)bx;
|
||||
unsigned offset = x + y * kScreenwidth;
|
||||
//debug(1, "multidump %ux%u(segment: %04x) -> %d,%d(address: %d)", w, h, (uint16)context.ds, x, y, offset);
|
||||
context.engine->blit(context.ds.ptr(offset, w * h), kScreenwidth, x, y, w, h);
|
||||
context.si = context.di = offset + h * kScreenwidth;
|
||||
context.cx = 0;
|
||||
//debug(1, "multidump %ux%u(segment: %04x) -> %d,%d(address: %d)", w, h, (uint16)ds, x, y, offset);
|
||||
engine->blit(ds.ptr(offset, w * h), kScreenwidth, x, y, w, h);
|
||||
si = di = offset + h * kScreenwidth;
|
||||
cx = 0;
|
||||
}
|
||||
|
||||
void worktoscreen(Context &context) {
|
||||
context.ds = context.data.word(kWorkspace);
|
||||
void DreamGenContext::worktoscreen() {
|
||||
ds = data.word(kWorkspace);
|
||||
uint size = 320 * 200;
|
||||
context.engine->blit(context.ds.ptr(0, size), 320, 0, 0, 320, 200);
|
||||
context.di = context.si = size;
|
||||
context.cx = 0;
|
||||
engine->blit(ds.ptr(0, size), 320, 0, 0, 320, 200);
|
||||
di = si = size;
|
||||
cx = 0;
|
||||
}
|
||||
|
||||
void printundermon(Context &context) {
|
||||
context.engine->printUnderMonitor();
|
||||
void DreamGenContext::printundermon() {
|
||||
engine->printUnderMonitor();
|
||||
}
|
||||
|
||||
void cls(Context &context) {
|
||||
context.engine->cls();
|
||||
void DreamGenContext::cls() {
|
||||
engine->cls();
|
||||
}
|
||||
|
||||
void frameoutnm(Context &context) {
|
||||
unsigned w = (uint8)context.cl, h = (uint8)context.ch;
|
||||
unsigned pitch = (uint16)context.dx;
|
||||
unsigned src = (uint16)context.si;
|
||||
int x = (uint16)context.di, y = (uint16)context.bx;
|
||||
void DreamGenContext::frameoutnm() {
|
||||
unsigned w = (uint8)cl, h = (uint8)ch;
|
||||
unsigned pitch = (uint16)dx;
|
||||
unsigned src = (uint16)si;
|
||||
int x = (uint16)di, y = (uint16)bx;
|
||||
unsigned dst = x + y * pitch;
|
||||
//debug(1, "framenm %ux%u[pitch: %u]-> %d,%d, segment: %04x->%04x", w, h, pitch, x, y, (uint16)context.ds, (uint16)context.es);
|
||||
//debug(1, "framenm %ux%u[pitch: %u]-> %d,%d, segment: %04x->%04x", w, h, pitch, x, y, (uint16)ds, (uint16)es);
|
||||
for(unsigned l = 0; l < h; ++l) {
|
||||
uint8 *src_p = context.ds.ptr(src + w * l, w);
|
||||
uint8 *dst_p = context.es.ptr(dst + pitch * l, w);
|
||||
uint8 *src_p = ds.ptr(src + w * l, w);
|
||||
uint8 *dst_p = es.ptr(dst + pitch * l, w);
|
||||
memcpy(dst_p, src_p, w);
|
||||
}
|
||||
context.di += dst + pitch * h;
|
||||
context.si += w * h;
|
||||
context.cx = 0;
|
||||
di += dst + pitch * h;
|
||||
si += w * h;
|
||||
cx = 0;
|
||||
}
|
||||
|
||||
void seecommandtail(Context &context) {
|
||||
context.data.word(kSoundbaseadd) = 0x220;
|
||||
context.data.byte(kSoundint) = 5;
|
||||
context.data.byte(kSounddmachannel) = 1;
|
||||
context.data.byte(kBrightness) = 1;
|
||||
context.data.word(kHowmuchalloc) = 0x9360;
|
||||
void DreamGenContext::seecommandtail() {
|
||||
data.word(kSoundbaseadd) = 0x220;
|
||||
data.byte(kSoundint) = 5;
|
||||
data.byte(kSounddmachannel) = 1;
|
||||
data.byte(kBrightness) = 1;
|
||||
data.word(kHowmuchalloc) = 0x9360;
|
||||
}
|
||||
|
||||
void randomnumber(Context &context) {
|
||||
context.al = context.engine->randomNumber();
|
||||
void DreamGenContext::randomnumber() {
|
||||
al = engine->randomNumber();
|
||||
}
|
||||
|
||||
void quickquit(Context &context) {
|
||||
context.engine->quit();
|
||||
void DreamGenContext::quickquit() {
|
||||
engine->quit();
|
||||
}
|
||||
|
||||
void quickquit2(Context &context) {
|
||||
context.engine->quit();
|
||||
void DreamGenContext::quickquit2() {
|
||||
engine->quit();
|
||||
}
|
||||
|
||||
void keyboardread(Context &context) {
|
||||
void DreamGenContext::keyboardread() {
|
||||
::error("keyboardread"); //this keyboard int handler, must never be called
|
||||
}
|
||||
|
||||
void resetkeyboard(Context &context) {
|
||||
void DreamGenContext::resetkeyboard() {
|
||||
}
|
||||
|
||||
void setkeyboardint(Context &context) {
|
||||
void DreamGenContext::setkeyboardint() {
|
||||
}
|
||||
|
||||
void readfromfile(Context &context) {
|
||||
uint16 dst_offset = context.dx;
|
||||
uint16 size = context.cx;
|
||||
debug(1, "readfromfile(%04x:%u, %u)", (uint16)context.ds, dst_offset, size);
|
||||
context.ax = context.engine->readFromFile(context.ds.ptr(dst_offset, size), size);
|
||||
context.flags._c = false;
|
||||
void DreamGenContext::readfromfile() {
|
||||
uint16 dst_offset = dx;
|
||||
uint16 size = cx;
|
||||
debug(1, "readfromfile(%04x:%u, %u)", (uint16)ds, dst_offset, size);
|
||||
ax = engine->readFromFile(ds.ptr(dst_offset, size), size);
|
||||
flags._c = false;
|
||||
}
|
||||
|
||||
void closefile(Context &context) {
|
||||
context.engine->closeFile();
|
||||
context.data.byte(kHandle) = 0;
|
||||
void DreamGenContext::closefile() {
|
||||
engine->closeFile();
|
||||
data.byte(kHandle) = 0;
|
||||
}
|
||||
|
||||
void openforsave(Context &context) {
|
||||
const char *name = (const char *)context.ds.ptr(context.dx, 13);
|
||||
void DreamGenContext::openforsave() {
|
||||
const char *name = (const char *)ds.ptr(dx, 13);
|
||||
debug(1, "openforsave(%s)", name);
|
||||
context.engine->openSaveFileForWriting(name);
|
||||
engine->openSaveFileForWriting(name);
|
||||
}
|
||||
|
||||
void openfilenocheck(Context &context) {
|
||||
const char *name = (const char *)context.ds.ptr(context.dx, 13);
|
||||
void DreamGenContext::openfilenocheck() {
|
||||
const char *name = (const char *)ds.ptr(dx, 13);
|
||||
debug(1, "checksavefile(%s)", name);
|
||||
bool ok = context.engine->openSaveFileForReading(name);
|
||||
context.flags._c = !ok;
|
||||
bool ok = engine->openSaveFileForReading(name);
|
||||
flags._c = !ok;
|
||||
}
|
||||
|
||||
void openfilefromc(Context &context) {
|
||||
openfilenocheck(context);
|
||||
void DreamGenContext::openfilefromc() {
|
||||
openfilenocheck();
|
||||
}
|
||||
|
||||
void openfile(Context &context) {
|
||||
Common::String name = getFilename(context);
|
||||
void DreamGenContext::openfile() {
|
||||
Common::String name = getFilename(*this);
|
||||
debug(1, "opening file: %s", name.c_str());
|
||||
context.engine->openFile(name);
|
||||
context.cs.word(kHandle) = 1; //only one handle
|
||||
context.flags._c = false;
|
||||
engine->openFile(name);
|
||||
cs.word(kHandle) = 1; //only one handle
|
||||
flags._c = false;
|
||||
}
|
||||
|
||||
void createfile(Context &context) {
|
||||
void DreamGenContext::createfile() {
|
||||
::error("createfile");
|
||||
}
|
||||
|
||||
void dontloadseg(Context &context) {
|
||||
context.ax = context.es.word(context.di);
|
||||
context._add(context.di, 2);
|
||||
context.dx = context.ax;
|
||||
context.cx = 0;
|
||||
unsigned pos = context.engine->skipBytes(context.dx);
|
||||
context.dx = pos >> 16;
|
||||
context.ax = pos & 0xffff;
|
||||
context.flags._c = false;
|
||||
void DreamGenContext::dontloadseg() {
|
||||
ax = es.word(di);
|
||||
_add(di, 2);
|
||||
dx = ax;
|
||||
cx = 0;
|
||||
unsigned pos = engine->skipBytes(dx);
|
||||
dx = pos >> 16;
|
||||
ax = pos & 0xffff;
|
||||
flags._c = false;
|
||||
}
|
||||
|
||||
void mousecall(Context &context) {
|
||||
context.engine->mouseCall();
|
||||
void DreamGenContext::mousecall() {
|
||||
engine->mouseCall();
|
||||
}
|
||||
|
||||
void setmouse(Context &context) {
|
||||
context.data.word(kOldpointerx) = 0xffff;
|
||||
void DreamGenContext::setmouse() {
|
||||
data.word(kOldpointerx) = 0xffff;
|
||||
//warning("setmouse: fixme: add range setting");
|
||||
//set vertical range to 15-184
|
||||
//set horizontal range to 15-298*2
|
||||
}
|
||||
|
||||
void gettime(Context &context) {
|
||||
void DreamGenContext::gettime() {
|
||||
TimeDate t;
|
||||
g_system->getTimeAndDate(t);
|
||||
debug(1, "\tgettime: %02d:%02d:%02d", t.tm_hour, t.tm_min, t.tm_sec);
|
||||
context.ch = t.tm_hour;
|
||||
context.cl = t.tm_min;
|
||||
context.dh = t.tm_sec;
|
||||
context.data.byte(kSecondcount) = context.dh;
|
||||
context.data.byte(kMinutecount) = context.cl;
|
||||
context.data.byte(kHourcount) = context.ch;
|
||||
ch = t.tm_hour;
|
||||
cl = t.tm_min;
|
||||
dh = t.tm_sec;
|
||||
data.byte(kSecondcount) = dh;
|
||||
data.byte(kMinutecount) = cl;
|
||||
data.byte(kHourcount) = ch;
|
||||
}
|
||||
|
||||
void allocatemem(Context &context) {
|
||||
uint size = (context.bx + 2) * 16;
|
||||
void DreamGenContext::allocatemem() {
|
||||
uint size = (bx + 2) * 16;
|
||||
debug(1, "allocate mem, %u bytes", size);
|
||||
context.flags._c = false;
|
||||
SegmentRef seg = context.allocateSegment(size);
|
||||
context.ax = (uint16)seg;
|
||||
debug(1, "\tsegment address -> %04x", (uint16)context.ax);
|
||||
flags._c = false;
|
||||
SegmentRef seg = allocateSegment(size);
|
||||
ax = (uint16)seg;
|
||||
debug(1, "\tsegment address -> %04x", (uint16)ax);
|
||||
}
|
||||
|
||||
void deallocatemem(Context &context) {
|
||||
uint16 id = (uint16)context.es;
|
||||
void DreamGenContext::deallocatemem() {
|
||||
uint16 id = (uint16)es;
|
||||
debug(1, "deallocating segment %04x", id);
|
||||
context.deallocateSegment(id);
|
||||
deallocateSegment(id);
|
||||
|
||||
//fixing invalid entries in the sprite table
|
||||
context.es = context.data;
|
||||
es = data;
|
||||
uint tsize = 16 * 32;
|
||||
uint16 bseg = context.data.word(kBuffers);
|
||||
uint16 bseg = data.word(kBuffers);
|
||||
if (!bseg)
|
||||
return;
|
||||
SegmentRef buffers(&context);
|
||||
SegmentRef buffers(this);
|
||||
buffers = bseg;
|
||||
uint8 *ptr = buffers.ptr(kSpritetable, tsize);
|
||||
for(uint i = 0; i < tsize; i += 32) {
|
||||
@ -237,192 +237,167 @@ void deallocatemem(Context &context) {
|
||||
}
|
||||
}
|
||||
|
||||
void removeemm(Context &context) {
|
||||
void DreamGenContext::removeemm() {
|
||||
::error("removeemm");
|
||||
}
|
||||
|
||||
void setupemm(Context &context) {
|
||||
//fixme: double check this, but it seems that emm pages used only for sound
|
||||
void DreamGenContext::setupemm() {
|
||||
}
|
||||
|
||||
void pitinterupt(Context &context) {
|
||||
void DreamGenContext::pitinterupt() {
|
||||
::error("pitinterupt");
|
||||
}
|
||||
|
||||
void getridofpit(Context &context) {
|
||||
void DreamGenContext::getridofpit() {
|
||||
::error("getridofpit");
|
||||
}
|
||||
|
||||
void setuppit(Context &context) {
|
||||
void DreamGenContext::setuppit() {
|
||||
::error("setuppit");
|
||||
}
|
||||
|
||||
void startdmablock(Context &context) {
|
||||
void DreamGenContext::startdmablock() {
|
||||
::error("startdmablock");
|
||||
}
|
||||
|
||||
void dmaend(Context &context) {
|
||||
void DreamGenContext::dmaend() {
|
||||
::error("dmaend");
|
||||
}
|
||||
|
||||
void restoreems(Context &context) {
|
||||
void DreamGenContext::restoreems() {
|
||||
::error("restoreems");
|
||||
}
|
||||
|
||||
void saveems(Context &context) {
|
||||
void DreamGenContext::saveems() {
|
||||
::error("saveems");
|
||||
}
|
||||
|
||||
void bothchannels(Context &context) {
|
||||
void DreamGenContext::bothchannels() {
|
||||
::error("bothchannels");
|
||||
}
|
||||
|
||||
void channel1only(Context &context) {
|
||||
void DreamGenContext::channel1only() {
|
||||
::error("channel1only");
|
||||
}
|
||||
|
||||
void channel0only(Context &context) {
|
||||
void DreamGenContext::channel0only() {
|
||||
::error("channel0only");
|
||||
}
|
||||
|
||||
void out22c(Context &context) {
|
||||
void DreamGenContext::out22c() {
|
||||
::error("out22c");
|
||||
}
|
||||
|
||||
void soundstartup(Context &context) {
|
||||
void DreamGenContext::soundstartup() {}
|
||||
void DreamGenContext::soundend() {}
|
||||
void DreamGenContext::DreamGenContext::interupttest() {}
|
||||
void DreamGenContext::disablesoundint() {}
|
||||
void DreamGenContext::enablesoundint() {}
|
||||
void DreamGenContext::checksoundint() {
|
||||
data.byte(kTestresult) = 1;
|
||||
}
|
||||
|
||||
void soundend(Context &context) {
|
||||
}
|
||||
|
||||
void interupttest(Context &context) {
|
||||
::error("interupttest");
|
||||
}
|
||||
|
||||
void disablesoundint(Context &context) {
|
||||
warning("disablesoundint: STUB");
|
||||
}
|
||||
|
||||
void enablesoundint(Context &context) {
|
||||
warning("enablesoundint: STUB");
|
||||
}
|
||||
|
||||
void checksoundint(Context &context) {
|
||||
context.data.byte(kTestresult) = 1;
|
||||
warning("checksoundint: STUB");
|
||||
}
|
||||
|
||||
void setsoundoff(Context &context) {
|
||||
void DreamGenContext::setsoundoff() {
|
||||
warning("setsoundoff: STUB");
|
||||
}
|
||||
|
||||
void readheader(Context &context);
|
||||
|
||||
void loadsample(Context &context) {
|
||||
context.engine->loadSounds(0, (const char *)context.data.ptr(context.dx, 13));
|
||||
void DreamGenContext::loadsample() {
|
||||
engine->loadSounds(0, (const char *)data.ptr(dx, 13));
|
||||
}
|
||||
|
||||
void cancelch0(Context &context);
|
||||
void cancelch1(Context &context);
|
||||
|
||||
void loadsecondsample(Context &context) {
|
||||
uint8 ch0 = context.data.byte(kCh0playing);
|
||||
void DreamGenContext::loadsecondsample() {
|
||||
uint8 ch0 = data.byte(kCh0playing);
|
||||
if (ch0 >= 12 && ch0 != 255)
|
||||
cancelch0(context);
|
||||
uint8 ch1 = context.data.byte(kCh1playing);
|
||||
cancelch0();
|
||||
uint8 ch1 = data.byte(kCh1playing);
|
||||
if (ch1 >= 12)
|
||||
cancelch1(context);
|
||||
context.engine->loadSounds(1, (const char *)context.data.ptr(context.dx, 13));
|
||||
cancelch1();
|
||||
engine->loadSounds(1, (const char *)data.ptr(dx, 13));
|
||||
}
|
||||
|
||||
void createname(Context &context);
|
||||
|
||||
void loadspeech(Context &context) {
|
||||
cancelch1(context);
|
||||
context.data.byte(kSpeechloaded) = 0;
|
||||
createname(context);
|
||||
const char *name = (const char *)context.data.ptr(context.di, 13);
|
||||
void DreamGenContext::loadspeech() {
|
||||
cancelch1();
|
||||
data.byte(kSpeechloaded) = 0;
|
||||
createname();
|
||||
const char *name = (const char *)data.ptr(di, 13);
|
||||
//warning("name = %s", name);
|
||||
if (context.engine->loadSpeech(name))
|
||||
context.data.byte(kSpeechloaded) = 1;
|
||||
if (engine->loadSpeech(name))
|
||||
data.byte(kSpeechloaded) = 1;
|
||||
}
|
||||
|
||||
void saveseg(Context &context) {
|
||||
context.cx = context.es.word(context.di);
|
||||
context._add(context.di, 2);
|
||||
savefilewrite(context);
|
||||
void DreamGenContext::saveseg() {
|
||||
cx = es.word(di);
|
||||
_add(di, 2);
|
||||
savefilewrite();
|
||||
}
|
||||
|
||||
void savefilewrite(Context &context) {
|
||||
context.ax = context.engine->writeToSaveFile(context.ds.ptr(context.dx, context.cx), context.cx);
|
||||
void DreamGenContext::savefilewrite() {
|
||||
ax = engine->writeToSaveFile(ds.ptr(dx, cx), cx);
|
||||
}
|
||||
|
||||
void savefileread(Context &context) {
|
||||
context.ax = context.engine->readFromSaveFile(context.ds.ptr(context.dx, context.cx), context.cx);
|
||||
void DreamGenContext::savefileread() {
|
||||
ax = engine->readFromSaveFile(ds.ptr(dx, cx), cx);
|
||||
}
|
||||
|
||||
void loadseg(Context &context) {
|
||||
context.ax = context.es.word(context.di);
|
||||
context.di += 2;
|
||||
void DreamGenContext::loadseg() {
|
||||
ax = es.word(di);
|
||||
di += 2;
|
||||
|
||||
uint16 dst_offset = context.dx;
|
||||
uint16 size = context.ax;
|
||||
uint16 dst_offset = dx;
|
||||
uint16 size = ax;
|
||||
|
||||
debug(1, "loadseg(%04x:%u, %u)", (uint16)context.ds, dst_offset, size);
|
||||
context.ax = context.engine->readFromFile(context.ds.ptr(dst_offset, size), size);
|
||||
context.flags._c = false;
|
||||
debug(1, "loadseg(%04x:%u, %u)", (uint16)ds, dst_offset, size);
|
||||
ax = engine->readFromFile(ds.ptr(dst_offset, size), size);
|
||||
flags._c = false;
|
||||
}
|
||||
|
||||
void error(Context &context) {
|
||||
void DreamGenContext::error() {
|
||||
::error("error");
|
||||
}
|
||||
|
||||
void generalerror(Context &context) {
|
||||
void DreamGenContext::generalerror() {
|
||||
::error("generalerror");
|
||||
}
|
||||
|
||||
void commandonly(Context &context);
|
||||
|
||||
void dosreturn(Context &context) {
|
||||
context._cmp(context.data.byte(kCommandtype), 250);
|
||||
if (context.flags.z()) goto alreadydos;
|
||||
context.data.byte(kCommandtype) = 250;
|
||||
context.al = 46;
|
||||
commandonly(context);
|
||||
void DreamGenContext::dosreturn() {
|
||||
_cmp(data.byte(kCommandtype), 250);
|
||||
if (flags.z()) goto alreadydos;
|
||||
data.byte(kCommandtype) = 250;
|
||||
al = 46;
|
||||
commandonly();
|
||||
alreadydos:
|
||||
context.ax = context.data.word(kMousebutton);
|
||||
context._and(context.ax, 1);
|
||||
if (context.flags.z()) return;
|
||||
ax = data.word(kMousebutton);
|
||||
_and(ax, 1);
|
||||
if (flags.z()) return;
|
||||
|
||||
quickquit2(context);
|
||||
quickquit(context);
|
||||
quickquit2();
|
||||
quickquit();
|
||||
}
|
||||
|
||||
void set16colpalette(Context &context) {
|
||||
}
|
||||
void DreamGenContext::set16colpalette() {}
|
||||
|
||||
void mode640x480(Context &context) {
|
||||
void DreamGenContext::mode640x480() {
|
||||
// Video mode 12h: 640x480 pixels, 16 colors, I believe
|
||||
context.al = 0x12 + 128;
|
||||
context.ah = 0;
|
||||
al = 0x12 + 128;
|
||||
ah = 0;
|
||||
initGraphics(640, 480, true);
|
||||
}
|
||||
|
||||
void showgroup(Context &context) {
|
||||
context.engine->setPalette();
|
||||
void DreamGenContext::showgroup() {
|
||||
engine->setPalette();
|
||||
}
|
||||
|
||||
void fadedos(Context &context) {
|
||||
context.engine->fadeDos();
|
||||
void DreamGenContext::fadedos() {
|
||||
engine->fadeDos();
|
||||
}
|
||||
|
||||
void doshake(Context &context) {
|
||||
uint8 &counter = context.data.byte(kShakecounter);
|
||||
context._cmp(counter, 48);
|
||||
if (context.flags.z())
|
||||
void DreamGenContext::doshake() {
|
||||
uint8 &counter = data.byte(kShakecounter);
|
||||
_cmp(counter, 48);
|
||||
if (flags.z())
|
||||
return;
|
||||
|
||||
context._add(counter, 1);
|
||||
_add(counter, 1);
|
||||
static const int shakeTable[] = {
|
||||
0, -2, 3, -2, 0, 2, 4, -1,
|
||||
1, -3, 3, 2, 0, -2, 3, -2,
|
||||
@ -443,27 +418,27 @@ void doshake(Context &context) {
|
||||
1, -3, 3, 0,
|
||||
};
|
||||
int offset = shakeTable[counter];
|
||||
context.engine->setShakePos(offset >= 0? offset: -offset);
|
||||
engine->setShakePos(offset >= 0? offset: -offset);
|
||||
}
|
||||
|
||||
void vsync(Context &context) {
|
||||
context.engine->waitForVSync();
|
||||
void DreamGenContext::vsync() {
|
||||
engine->waitForVSync();
|
||||
}
|
||||
|
||||
void setmode(Context &context) {
|
||||
vsync(context);
|
||||
void DreamGenContext::setmode() {
|
||||
vsync();
|
||||
initGraphics(320, 200, false);
|
||||
}
|
||||
|
||||
void readoneblock(Context &context) {
|
||||
context.ds = context.data.word(kWorkspace);
|
||||
context.cx = 30000;
|
||||
context.dx = 0;
|
||||
readfromfile(context);
|
||||
void DreamGenContext::readoneblock() {
|
||||
ds = data.word(kWorkspace);
|
||||
cx = 30000;
|
||||
dx = 0;
|
||||
readfromfile();
|
||||
}
|
||||
|
||||
void showpcx(Context &context) {
|
||||
Common::String name = getFilename(context);
|
||||
void DreamGenContext::showpcx() {
|
||||
Common::String name = getFilename(*this);
|
||||
Common::File pcxFile;
|
||||
|
||||
if (!pcxFile.open(name)) {
|
||||
@ -478,8 +453,8 @@ void showpcx(Context &context) {
|
||||
// the color components have to be adjusted from 8 to 6 bits.
|
||||
|
||||
pcxFile.seek(16, SEEK_SET);
|
||||
context.es = context.data.word(kBuffers);
|
||||
maingamepal = context.es.ptr(4782, 768); //fixme: hardcoded offset
|
||||
es = data.word(kBuffers);
|
||||
maingamepal = es.ptr(4782, 768); //fixme: hardcoded offset
|
||||
pcxFile.read(maingamepal, 48);
|
||||
|
||||
memset(maingamepal + 48, 0xff, 720);
|
||||
|
Loading…
x
Reference in New Issue
Block a user