[Scummvm-cvs-logs] CVS: residual Makefile.common,1.7,1.8 engine.cpp,1.45,1.46 engine.h,1.14,1.15 lua.cpp,1.79,1.80 main.cpp,1.34,1.35

Pawel Kolodziejski aquadran at users.sourceforge.net
Sat Dec 25 10:24:02 CET 2004


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12626

Modified Files:
	Makefile.common engine.cpp engine.h lua.cpp main.cpp 
Log Message:
- allow reset lua global tables,
- allow access to some static funcs,
- clearing CallInfo structure after alloc and realloc,
- add base_ci_size of base_ci to task and state structure and handle it,
- add PAUSE tag to task,
- store funcs libs into lists,
- added few lua funcs used by engine
- added dummy save/restore callbacks/funcs
- changed restore engine key F5 to F7


Index: Makefile.common
===================================================================
RCS file: /cvsroot/scummvm/residual/Makefile.common,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Makefile.common	6 Oct 2004 19:42:24 -0000	1.7
+++ Makefile.common	25 Dec 2004 18:23:06 -0000	1.8
@@ -12,6 +12,8 @@
 	lua/lmem.o \
 	lua/lobject.o \
 	lua/lparser.o \
+	lua/lrestore.o \
+	lua/lsave.o \
 	lua/lstate.o \
 	lua/lstring.o \
 	lua/lstrlib.o \

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- engine.cpp	10 Dec 2004 07:26:03 -0000	1.45
+++ engine.cpp	25 Dec 2004 18:23:06 -0000	1.46
@@ -68,7 +68,7 @@
 			}
 			if (event.type == SDL_KEYUP && _controlsEnabled[event.key.keysym.sym]) {
 				// temporary hack for save/load request until game menu will work
-				if (event.key.keysym.sym == SDLK_F5) {
+				if (event.key.keysym.sym == SDLK_F7) {
 					_savegameLoadRequest = true;
 					continue;
 				} else if (event.key.keysym.sym == SDLK_F8) {
@@ -220,11 +220,11 @@
 	}
 }
 
-void Engine::savegameGzread(void *data, int32 size) {
+void Engine::savegameGzread(void *data, int size) {
 	gzread(Engine::instance()->_savegameFileHandle, data, size);
 }
 
-void Engine::savegameGzwrite(void *data, int32 size) {
+void Engine::savegameGzwrite(void *data, int size) {
 	gzwrite(Engine::instance()->_savegameFileHandle, data, size);
 }
 
@@ -254,19 +254,18 @@
 	//Render_Restore(savegameGzread);
 	//Primitive_Restore(savegameGzread);
 	//Smush_Restore(savegameGzread);
-	//lua_Restore(savegameGzread);
+	lua_Restore(savegameGzread);
 	//  unlock resources
 	gzclose(_savegameFileHandle);
 
-	//do_dofile("patch05.bin");
+	//bundle_dofile("patch05.bin");
 }
 
-void Engine::savegameCallback(void (*func)(void *, int32)) {
+void Engine::savegameCallback(SaveRestoreFunc func) {
 	lua_Object funcParam1;
 	lua_Object funcParam2;
 	bool unk1 = false;
 	bool unk2 = false;
-	//_savegameUnkFunc = func;
 
 	lua_beginblock();
 	lua_pushobject(lua_getglobal("system"));
@@ -322,7 +321,7 @@
 	//Render_Save(savegameGzwrite);
 	//Primitive_Save(savegameGzwrite);
 	//Smush_Save(savegameGzwrite);
-	//lua_Save(savegameGzwrite);
+	lua_Save(savegameGzwrite);
 
 	gzclose(_savegameFileHandle);
 }

Index: engine.h
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- engine.h	10 Dec 2004 07:26:03 -0000	1.14
+++ engine.h	25 Dec 2004 18:23:06 -0000	1.15
@@ -20,6 +20,7 @@
 
 #include "scene.h"
 #include "textobject.h"
+#include "lua.h"
 #include <cstdlib>
 #include <list>
 #include <SDL_keysym.h>
@@ -143,9 +144,9 @@
 
 	void savegameSave();
 	void savegameRestore();
-	static void savegameGzread(void *data, int32 size);
-	static void savegameGzwrite(void *data, int32 size);
-	void savegameCallback(void (*func)(void *, int32));
+	static void savegameGzread(void *data, int size);
+	static void savegameGzwrite(void *data, int size);
+	void savegameCallback(SaveRestoreFunc func);
 
 	bool _savegameLoadRequest;
 	bool _savegameSaveRequest;

Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- lua.cpp	10 Dec 2004 07:26:03 -0000	1.79
+++ lua.cpp	25 Dec 2004 18:23:06 -0000	1.80
@@ -1210,6 +1210,14 @@
 	Engine::instance()->_savegameSaveRequest = true;
 }
 
+static int SaveCallback(int tag, int value, SaveRestoreFunc saveFunc) {
+	return value;
+}
+
+static int RestoreCallback(int tag, int value, SaveRestoreFunc saveFunc) {
+	return value;
+}
+
 // Stub function for builtin functions not yet implemented
 
 static void stubWarning(char *funcName) {
@@ -2099,6 +2107,9 @@
 	lua_setglobal("SPECIAL");
 	lua_pushnumber(0x8000);
 	lua_setglobal("HOT");
+
+	saveCallback = SaveCallback;
+	restoreCallback	= RestoreCallback;
 }
 
 int bundle_dofile(const char *filename) {

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/main.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- main.cpp	10 Dec 2004 20:33:30 -0000	1.34
+++ main.cpp	25 Dec 2004 18:23:07 -0000	1.35
@@ -158,6 +158,7 @@
 	Engine::instance()->setMode(ENGINE_MODE_NORMAL);
 	Engine::instance()->mainLoop();
 
+	lua_removelibslists();
 	lua_close();
 
 	delete g_smush;





More information about the Scummvm-git-logs mailing list