[Scummvm-cvs-logs] CVS: scummvm/saga script.cpp,1.18,1.19 script.h,1.10,1.11
Eugene Sandulenko
sev at users.sourceforge.net
Tue Aug 10 17:28:37 CEST 2004
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4554
Modified Files:
script.cpp script.h
Log Message:
Move CF_ commands to class and call them from wrappers. This will let us
remove global _vm later.
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- script.cpp 10 Aug 2004 18:31:33 -0000 1.18
+++ script.cpp 11 Aug 2004 00:27:43 -0000 1.19
@@ -486,31 +486,31 @@
return voice_lut;
}
-void CF_script_info(int argc, char *argv[], void *refCon) {
+void Script::scriptInfo(int argc, char *argv[]) {
uint32 n_entrypoints;
uint32 i;
char *name_ptr;
- if (((Script *)refCon)->currentScript() == NULL) {
+ if (currentScript() == NULL) {
return;
}
- if (!((Script *)refCon)->currentScript()->loaded) {
+ if (!currentScript()->loaded) {
return;
}
- n_entrypoints = ((Script *)refCon)->currentScript()->bytecode->n_entrypoints;
+ n_entrypoints = currentScript()->bytecode->n_entrypoints;
_vm->_console->print("Current script contains %d entrypoints:", n_entrypoints);
for (i = 0; i < n_entrypoints; i++) {
- name_ptr = (char *)((Script *)refCon)->currentScript()->bytecode->bytecode_p +
- ((Script *)refCon)->currentScript()->bytecode->entrypoints[i].name_offset;
+ name_ptr = (char *)currentScript()->bytecode->bytecode_p +
+ currentScript()->bytecode->entrypoints[i].name_offset;
_vm->_console->print("%lu: %s", i, name_ptr);
}
}
-void CF_script_exec(int argc, char *argv[], void *refCon) {
+void Script::scriptExec(int argc, char *argv[]) {
uint16 ep_num;
if (argc < 1) {
@@ -519,21 +519,29 @@
ep_num = atoi(argv[0]);
- if (((Script *)refCon)->_dbg_thread == NULL) {
+ if (_dbg_thread == NULL) {
_vm->_console->print("Creating debug thread...");
- ((Script *)refCon)->_dbg_thread = STHREAD_Create();
- if (((Script *)refCon)->_dbg_thread == NULL) {
+ _dbg_thread = STHREAD_Create();
+ if (_dbg_thread == NULL) {
_vm->_console->print("Thread creation failed.");
return;
}
}
- if (ep_num >= ((Script *)refCon)->currentScript()->bytecode->n_entrypoints) {
+ if (ep_num >= currentScript()->bytecode->n_entrypoints) {
_vm->_console->print("Invalid entrypoint.");
return;
}
- STHREAD_Execute(((Script *)refCon)->_dbg_thread, ep_num);
+ STHREAD_Execute(_dbg_thread, ep_num);
+}
+
+void CF_script_info(int argc, char *argv[], void *refCon) {
+ ((Script *)refCon)->scriptInfo(argc, argv);
+}
+
+void CF_script_exec(int argc, char *argv[], void *refCon) {
+ ((Script *)refCon)->scriptExec(argc, argv);
}
void CF_script_togglestep(int argc, char *argv[], void *refCon) {
Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- script.h 3 Aug 2004 00:40:16 -0000 1.10
+++ script.h 11 Aug 2004 00:27:43 -0000 1.11
@@ -110,6 +110,9 @@
void setBuffer(int idx, R_SCRIPT_DATABUF *ptr) { _dataBuf[idx] = ptr; }
R_SCRIPT_DATABUF *dataBuffer(int idx) { return _dataBuf[idx]; }
YS_DL_LIST *threadList() { return _threadList; }
+
+ void scriptInfo(int argc, char *argv[]);
+ void scriptExec(int argc, char *argv[]);
protected:
bool _initialized;
@@ -121,7 +124,7 @@
R_SCRIPTDATA *_currentScript;
R_SCRIPT_DATABUF *_dataBuf[R_SCRIPT_DATABUF_NUM];
YS_DL_LIST *_threadList;
-
+
public:
int _dbg_singlestep;
int _dbg_dostep;
More information about the Scummvm-git-logs
mailing list