[Scummvm-devel] SCI: Some more TODOs
Max Horn
max at quendi.de
Fri Feb 20 17:51:02 CET 2009
Hi folks,
here are some things that I think need to be done on SCI next. I
didn't want to just add them to the Wiki SCI/TODO page, because I hope
that here, some more people see them. I try to list everything in
rough order of difficulty, as I perceive it.
* Move everything into namespace SCI
* Replace all uses of gint8, etc. by our native types, to get rid of
the typedefs we use right now.
* more formatting fixes: TheSCI code puts return values on separate
lines all over the place, e.g.
int
_vocab_cmp_words(const void *word1, const void *word2) {
Take care of that and other formatting issues.
* check for places that use char or unsigned char for boolean values,
and change those to use type bool instead
* change names of structs and how they are declare, e.g.
typedef struct script_opcode_ {
unsigned opcode;
int arg1, arg2, arg3;
int pos, size;
} script_opcode;
->
struct ScriptOpcode {
unsigned opcode;
int arg1, arg2, arg3;
int pos, size;
};
* Replace sci_gettime and sci_get_current_time by
OSystem::getTimeAndDate and OSystem::getMillis
-> You first need to find out which is used where: Des the code try to
determine the current time? Use getTimeAndDate(). Does it try to
measure something, regulate timing? Using getMillis. It is possible
that some code actually really wants to get a higher resolution than
milli seconds, in that case get back to us and let's discuss what to do.
* Not specific to SCI, but: Replace "struct tm" in common/system.h
(and places that implement/use it) by a custom struct, which would be
a (partial) clone of struct tm, something like Common::OSystem::Time.
That way, we wouldn't have to use <time.h> anymore anywhere.
* Get rid of sci_sched_yield: This is used for two things:
1) gfx/resource/sci_pic_0.cpp -> analyze why it is used here, find a
way to replace it
2) ./sfx/mixer/soft.cpp to implement ACQUIRE_LOCK -> replace
ACQUIRE_LOCK and RELEASE_LOCK by using our mutex API. (And on the long
run, replace the SCI mixer by our mixer :-)
* I just made a big commit where I started to overhaul the file
handling in SCI. It's incomplete, and may cause regressions, but it is
a start. The biggest chunk left to take care of is engine/kfile.cpp,
and in there mostly handling of savegames (and possibly of writing to
other files -- if SCI ever does that?). This needs to be switched to
the savefile API. One problem there is that FreeSCI apparently stored
saves as multiple files, grouped by a directory. Does anybody know
whether the original Sierra SCI also did this? Our savefile API does
not (and will not) support subdirs. Some ideas on how to resolve this:
1) Fake subdirs by turning save_0/FILE into save_0_FILE. Or even
better, into TARGET-FILE.0 or something like that.
2) Revise the save/load code in SCI to put all those files into some
kind of archive file.
3) Maybe we don't need all those files? In a KQ4 save I made, there
were only two files: state, and KQ4.id, which seems redundant (could
be encoded into a header prefixed to 'state', plus the filename)
There are tons more things left to do, of course :-)
Max
More information about the Scummvm-devel
mailing list