46 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
| #pragma once
 | |
| #include "squirrel.h"
 | |
| #include "sqstdaux.h"
 | |
| #include "sqstdblob.h"
 | |
| #include "sqstdio.h"
 | |
| #include "sqstdmath.h"
 | |
| #include "sqstdstring.h"
 | |
| #include "sqstdsystem.h"
 | |
| #include <iostream>
 | |
| 
 | |
| typedef void *(*__GetGameManagerVoid)();
 | |
| static SQInteger GameManager_GameManager(HSQUIRRELVM v)
 | |
| {
 | |
|     void *GameManager = ((__GetGameManagerVoid)0x080CC18E)();
 | |
|     sq_pushuserpointer(v, GameManager);
 | |
|     return 1;
 | |
| }
 | |
| typedef void *(*__GameManagerByThis)(void *GameManager);
 | |
| static SQInteger GameManager_GetParty(HSQUIRRELVM v)
 | |
| {
 | |
|     SQUserPointer P;
 | |
|     sq_getuserpointer(v, 2, &P);
 | |
|     void *CParty = ((__GameManagerByThis)0x08294E10)(P);
 | |
|     if (CParty)
 | |
|         sq_pushuserpointer(v, CParty);
 | |
|     else
 | |
|         sq_pushinteger(v, 0);
 | |
|     return 1;
 | |
| }
 | |
| 
 | |
| static SQInteger register_GameManager_func(HSQUIRRELVM v, SQFUNCTION f, const char *fname)
 | |
| {
 | |
|     sq_pushroottable(v);
 | |
|     sq_pushstring(v, fname, -1);
 | |
|     sq_newclosure(v, f, 0); // create a new function
 | |
|     sq_newslot(v, -3, SQFalse);
 | |
|     sq_pop(v, 1); // pops the root table
 | |
| }
 | |
| 
 | |
| static void RegisterGameManager(HSQUIRRELVM v)
 | |
| {
 | |
|     // 获得GameManager对象
 | |
|     register_GameManager_func(v, GameManager_GameManager, _SC("Sq_GameManager_GameManager"));
 | |
|     // 获得队伍对象
 | |
|     register_GameManager_func(v, GameManager_GetParty, _SC("Sq_GameManager_GetParty"));
 | |
| } |