示例#1
0
const char*	JSonDB::getAsString	(IDataRecord rec, u32 index, u32& len) {
	klb_assert(m_fieldType[index]==TYPE_STR,"Type does not match");
	klb_assert(index < m_recordEntry, "Field index out of range");
	RecordListHeader* pRecord = (RecordListHeader*)rec;
	const char* res;
	if (pRecord->fields[index].v.str != -1) {
		res = &mStringRecordBuffer[pRecord->fields[index].v.str];
		len = strlen(res);
	} else {
		res = NULL;
		len = 0;
	}
	return res;
}
示例#2
0
bool
CKLBUIScore::initUI(CLuaState& lua)
{
	int argc = lua.numArgs();

	// 引数の数が合わない場合
    if(argc < ARG_REQUIRE || argc > ARG_NUMS) { return false; }

	float   x            = lua.getFloat(ARG_X);
	float   y            = lua.getFloat(ARG_Y);
	u32     order        = lua.getInt(ARG_ORDER);
	s32     order_offset = lua.getInt(ARG_ODOFF);
	float   stepX        = lua.getFloat(ARG_STEP_X);
	float   stepY        = lua.getFloat(ARG_STEP_Y);
	int     column       = lua.getInt(ARG_COLS);
	bool    fillzero     = lua.getBool(ARG_FILLZERO);
	bool    anim_flag    = lua.getBool(ARG_ANIM);
	int     align        = (argc >= ARG_ALIGN)     ? lua.getInt(ARG_ALIGN)      : ALIGN_RIGHT;
	bool    countclip    = (argc >= ARG_COUNTCLIP) ? lua.getBool(ARG_COUNTCLIP) : false;

	const char * tex_list[10];
	lua.retValue(ARG_TEXTBL);	// 対象となる配列をスタックトップに積む
	lua.retNil();				// nil をスタックトップに積む
	int tex_cnt = 0;
	while(lua.tableNext()) {
		lua.retValue(-2);
		int idx = lua.getInt(-1) - 1;			// Lua配列の添え字は1からなので、-1する。
		const char * str = lua.getString(-1);

		// 与えられた配列のindexに整数以外が使われているときや、
		// 範囲を超えたものがある場合はエラー扱いとする。
		klb_assert((idx >= 0 && idx <= 9), "BAD INDEX [%s] in texture array.", str);
		if(idx < 0 || idx > 9) {	// 数値以外のインデックスが指定されていたり、範囲を超えている場合
			return false;
		}
		const char * texname = lua.getString(-2);	// テクスチャ名称が格納されている。
		tex_list[idx] = texname;
		tex_cnt++;
		lua.pop(2);
	}
	lua.pop(1);
	// テクスチャの数が足りなければエラーとする。
	if(tex_cnt != 10) {
		klb_assert(tex_cnt == 10, "%s(%d): The number of textures is insufficient. ", lua.getScriptName(), lua.getNumLine()); 
		return false;
	}

	return initCore(order, order_offset, x, y, tex_list, stepX, stepY, column, fillzero, anim_flag, align, countclip);
}
示例#3
0
void JSonDB::setString		(s32 idx, const unsigned char* str, s32 strLen) { 
	klb_assert(m_fieldType[idx]==TYPE_STR,"Type does not match");
	klb_assert(((u32)idx) < m_recordEntry, "Field index out of range");
	klb_assert((mStringRecordCount+strLen) < m_StringRecordBufferSize, "String buffer full");

	if (str && strLen) {
		memcpy(&mStringRecordBuffer[mStringRecordCount], str, strLen);
		mStringRecordBuffer[mStringRecordCount + strLen] = 0; // End string.

		m_currRecord->fields[idx].v.str = mStringRecordCount;
		mStringRecordCount += strLen + 1;
	} else {
		m_currRecord->fields[idx].v.str = -1;
	}
}
示例#4
0
const char *
CWin32Platform::SJIStoUTF8(const char * SJISstr)
{
	// UTF-8 は、一文字最長3バイト(日本語の場合)
	// Shift_JIS は、一文字最長2バイト。
	// 同じ文字列のバッファサイズが、utf-8より長くなることはない。
	size_t sizeBuffer = strlen(SJISstr) * 3 / 2 + 1;	// 1.5倍のバッファサイズ
	LPWSTR pwszBuf = new wchar_t [ sizeBuffer ];
	char * lastbuf = new char [ sizeBuffer ];
	klb_assert(0 != lastbuf, "string conv buf not enough memory.");

	MultiByteToWideChar(
		CP_ACP,
		0,
		SJISstr,
		-1,
		pwszBuf,
		(int)sizeBuffer);

	WideCharToMultiByte(
		CP_UTF8,
		0,
		pwszBuf,
		-1,
		lastbuf,
		(int)sizeBuffer,
		NULL,
		NULL);
	delete [] pwszBuf;

	return (const char *)lastbuf;
}
示例#5
0
bool 
CKLBUIMultiImgItem::initCore(u32 order,float x,float y, u32 index, IMGITEM* pIndexes, u32 max)
{
	if(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {
		return false;
	}

	setInitPos(x, y);

	// 領域を確保
	m_cntImg    = max;
	m_items     = pIndexes;
    if(!m_items) { return false; }
	m_idxMax    = m_cntImg - 1;	// 最大index値を追加する

	REFRESH_A;
	REFRESH_B;

	klb_assert((((s32)order) >= 0), "Order Problem");

	m_order     = order;
	setIndex(index);

	return true;
}
示例#6
0
s32	 JSonDB::addField(const unsigned char* str, s32 strLen) {
	klb_assert((m_stringAlloc + strLen+1) < DB_MAX_STRING_POOL_SIZE, "Field Name String pool too small.");
	memcpy(&m_stringBuffer[m_stringAlloc], str, strLen);
	m_fieldName[m_recordEntry] = (u16)m_stringAlloc;
	m_stringBuffer[m_stringAlloc + strLen] = 0; // End string.
	m_stringAlloc += strLen + 1;
	return m_recordEntry;
}
示例#7
0
int
CKLBFormIF::updateNode(CLuaState& lua, int argc, int base, CKLBNode * pParent, int nodeIndex, int subcmd, void * item, int index)
{
	CKLBNode * pNode = NULL;
	if(lua.isString(nodeIndex)) {
		const char * name = lua.getString(nodeIndex);
		if (name) {
			pNode = pParent->search(name);
		}
		klb_assert(pNode, "Node not found: name = \"%s\"", name);
	} else {
		pNode = (CKLBNode *)lua.getPointer(nodeIndex);
	}
	int ret = 0;

	if(base > argc) {
		lua.retBoolean(false);
		return 1;
	}

	if (!pNode) {
		lua.retNil();
		return 1;
	}

	CKLBUITask* pTask		= pNode->getUITask();
	u32 classID;
	if (pTask) {
		classID = pTask->getClassID();
	} else {
		classID = pNode->getClassID();
	}

	// 対象のノードによって、可能な操作が異なる。
	bool result;
	switch(classID)
	{
	default:					result = updateStandardNode(lua, argc, base, subcmd, pNode, ret, item, index);	break;
	case CLS_KLBUIELEMENT:		result = updateUIElement(lua, argc, base, subcmd, pNode, ret, item, index);		break;
	case CLS_KLBUISELECTABLE:	result = updateUISelectable(lua, argc, base, subcmd, pNode, ret, item, index);	break;
	case CLS_KLBUICONTAINER:	result = updateUIContainer(lua, argc, base, subcmd, pNode, ret, item, index);	break;
	case CLS_KLBUILABEL:
	case CLS_KLBLABEL:			result = updateLabelNode(lua, argc, base, subcmd, pNode, ret, item, index);		break;
	case CLS_KLBTEXTEDIT:
	case CLS_KLBUITEXTINPUT:	result = updateUITextEdit(lua, argc, base, subcmd, pNode, ret, item, index);	break;
	case CLS_KLBUIWEBVIEW:
	case CLS_KLBWEBVIEW:		result = updateUIWebView(lua, argc, base, subcmd, pNode, ret, item, index);	break;
	}
	// ここまでで処理されたコマンドが無い場合、標準コマンドを処理する。
	if(!result) {
		// コマンドとして解釈できなかったので、falseを返す。
		lua.retBoolean(false);
		ret = 1;
	}
	// 戻り値に相当するものはすでにLuaスタックに積んであるはずなので、戻り値の数を返す。
	return ret;
}
示例#8
0
s32 JSonDB::getFieldID(const unsigned char* str, s32 strLen) {
	klb_assert((m_stringAlloc + strLen+1) < DB_MAX_STRING_POOL_SIZE, "Field Name String pool too small for temp usage.");

	// Copy and create temp string (do NOT modify m_stringAlloc : no allocation really done)
	memcpy(&m_stringBuffer[m_stringAlloc], str, strLen);
	m_stringBuffer[m_stringAlloc + strLen] = 0; // End string.

	return this->getFieldIndex(&m_stringBuffer[m_stringAlloc]);
}
示例#9
0
void CKLBLuaLibENG::endNanoTime(int idx, s32* milli, s32* nano)
{
	s64 endTime = CPFInterface::getInstance().platform().nanotime();

	klb_assert(idx < SCRIPT_TIMER_COUNT, "Timer index %i is out of range 0..%i",idx, (SCRIPT_TIMER_COUNT-1));

	s64 deltaTime = endTime - ms_timers[idx];
	ms_timers[idx]	  = endTime;

	*nano	= (s32)(deltaTime % 1000000LL);
	*milli	= (s32)(deltaTime / 1000000LL);
}
示例#10
0
u32 
IFactory::getClassID(const char* luaFuncName, bool assertIfNotFound) {
	IFactory* pFactory = m_begin;
	while (pFactory) {
		if (strcmp(pFactory->m_funcName,luaFuncName)==0) {
			return pFactory->m_classID;
		}
		pFactory = pFactory->m_pNext;
	}

	klb_assert(!assertIfNotFound, "Can not find class ID from name %s", luaFuncName);
	return 0;
}
示例#11
0
int
CKLBLuaLibENG::luaStartNanoTime(lua_State * L)
{
	CLuaState lua(L);
	int argc = lua.numArgs();
	int idx = 0;
	if(argc >= 1) {
		idx = lua.getInt(1);
		klb_assert(idx < SCRIPT_TIMER_COUNT, "Timer index %i is out of range 0..%i",idx, (SCRIPT_TIMER_COUNT-1));
	}

	// Read time last.
	ms_timers[idx] = CPFInterface::getInstance().platform().nanotime();

	// Return nothing.
	return 0;
}
示例#12
0
int
CKLBLuaLibTASK::setProperty(lua_State * L)
{
	CLuaState lua(L);
	if(lua.numArgs() != 2) return 0;
    if(lua.isNil(1)) return 0;
    
    CKLBLuaTask * pTask = (CKLBLuaTask *)lua.getPointer(1);
    if(!pTask) return 0;

	CHECKTASK(pTask);

#if defined (DEBUG_RT_CHECK)
    klb_assert(pTask->getTaskType() >= CKLBTask::TASK_LUA_PROPERTY, "SCRIPT ERROR %s(%d): the task does not have property.",
               CKLBLuaEnv::getInstance().nowFile(), lua.getNumLine());
#endif
    if(pTask->getTaskType() < CKLBTask::TASK_LUA_PROPERTY) return 0;
    return ((CKLBLuaPropTask *)pTask)->setPropertyByScript(L);    
}
示例#13
0
void CKLBSplineNode::addKeysFixed(u8 splineIndex, u32 time, s32 fixedValue) {
	klb_assert(splineIndex < m_uiSplineCount, "Invalid index");

	// Find new key index and update key counter
	u32 idx = m_splinesKeyCount[splineIndex]++;

	// Get latest key memory storage
	s32* vector = m_splines[splineIndex];	// Select spline
	vector = &vector[idx * 4];				// Select vector in spline

	// Store time, value
	vector[0] = (s32)time;
	vector[1] = fixedValue;
	vector[2] = 0;
	vector[3] = 0;

	if (time > m_uiTotalTime) {
		m_uiTotalTime = time;
	}
}
示例#14
0
bool
CKLBUISimpleItem::initCore(u32 order, float x, float y, const char* asset)
{
	if(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) {
		return false;
	}

	setInitPos(x, y);

	klb_assert((((s32)order) >= 0), "Order Problem");

	m_order = order;

	setStrC(m_asset, asset);

	m_pNode = CKLBUtility::createNodeScript( m_asset, m_order, &m_handle);
	if(!m_pNode) {
		return false;
	}
	getNode()->addNode(m_pNode);

	return true;
}
示例#15
0
int
CKLBLuaLibENG::luaEndNanoTime(lua_State * L)
{
	// Read time first
	s64 endTime = CPFInterface::getInstance().platform().nanotime();

	CLuaState lua(L);
	int argc = lua.numArgs();
	int idx = 0;
	if(argc >= 1) {
		idx = lua.getInt(1);
		klb_assert(idx < SCRIPT_TIMER_COUNT, "Timer index %i is out of range 0..%i",idx, (SCRIPT_TIMER_COUNT-1));
	}
	s64 deltaTime = endTime - ms_timers[idx];
	ms_timers[idx]	  = endTime;	// ready for next call to end nanotime.

	s32 nano	= (s32)(deltaTime % 1000000LL);
	s32 milli	= (s32)(deltaTime / 1000000LL);

	lua.retInt(milli);
	lua.retInt(nano);

	return 2;
}
示例#16
0
int GameEngineMain(int argc, _TCHAR* argv[])
// int _main (int argc, const char * const* argv)
#endif
{
	bool bStdModuleExist = EngineStdReference();
	klb_assert(bStdModuleExist, "The links of a system are insufficient.");

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH);
	glutCreateWindow("GLEW Test");

	GLenum err = glewInit();
	if (GLEW_OK != err)
	{
	  /* Problem: glewInit failed, something is seriously wrong. */
	  fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
	}
	fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));

#define HEIGHT	(768)
#define WIDTH	(1024)
#define POS_X	(10)
#define POS_Y	(10)
//#define HEIGHT	(800)
//#define WIDTH	(400)
	int scrW	= WIDTH;
	int scrH	= HEIGHT;
	
	int fixedDelta = 0;

	*g_basePath = 0;
	*g_fileName = 0;
	g_pathExtern	= PATH_EXTERN;
	g_pathInstall	= PATH_INSTALL;

	g_fileName[0] = 0;

	bool hasDefaultFont = true;
	bool hasDefaultDB   = false;

	if (argc > 1) {
		int parse	= 1;
		int max		= argc;
		while (parse < max) {
			if(*argv[parse] == '-') {
				if (strcmp("-w",argv[parse]) == 0) {
					sscanf_s(argv[parse+1],"%i",&scrW);
				}

				if (strcmp("-h",argv[parse]) == 0) {
					sscanf_s(argv[parse+1],"%i",&scrH);
				}

				if (strcmp("-i",argv[parse]) == 0) {
					g_pathInstall = convertPath(argv[parse+1]);
				}

				if (strcmp("-e",argv[parse]) == 0) {
					g_pathExtern = convertPath(argv[parse+1]);
				}

				if (strcmp("-t",argv[parse]) == 0) {
					fixedDelta = atoi(argv[parse+1]);
				}

				if (strcmp("-enc", argv[parse]) == 0) {
					bool encrypt = false;
					if (stricmp(argv[parse+1],"true") == 0) {
						encrypt = true;
					}

					if (stricmp(argv[parse+1],"1") == 0) {
						encrypt = true;
					}

					CWin32Platform::setEncrypt(encrypt);
				}

				if (strcmp("-no", argv[parse]) == 0) {
					if (strcmp("defaultfont", argv[parse+1]) == 0) {
						hasDefaultFont = false;
					}
				}

				parse += 2;
			} else {
				// Specify the boot file
				const char* file = argv[parse];
				int lenf = strlen(file);
				
				memcpy(g_fileName, file, lenf);
				g_fileName[lenf] = 0;

				// ファイル名そのものは start.lua に相当する起動ファイルとする。
                // File name of the file used as a start.lua
				parse++;
			}
		}
	}

	CWin32PathConv& pathconv = CWin32PathConv::getInstance();
	pathconv.setPath(g_pathInstall, g_pathExtern);

	WNDCLASS wc;
	HWND hwnd;
	HDC hDC;
	HGLRC hRC;
	HINSTANCE hInstance = GetModuleHandle(NULL);

	// register window class
	wc.style = CS_OWNDC;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hInstance;
	wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
	wc.hCursor = LoadCursor( NULL, IDC_ARROW );
	wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
	wc.lpszMenuName = NULL;
	wc.lpszClassName = "GameEngineGL";
	RegisterClass( &wc );
	
	// create main window
	hwnd = CreateWindow(
		"GameEngineGL", "Playground", 
		WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE,
		0, 0, 256, 256,
		NULL, NULL, hInstance, NULL );

/*		"EngineGL", NULL,
		WS_THICKFRAME|WS_DISABLED,
		CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
		NULL, NULL, 
		hInstance, 
		NULL
	);*/
	
	if (!hwnd)
		return -1;

	// enable OpenGL for the window
	EnableOpenGL( hwnd, &hDC, &hRC );

	// COM Initialization
	CoInitialize(NULL);

	EnableWindow(hwnd, TRUE);

	DragAcceptFiles(hwnd, true);

	RECT area;
	area.left = 0;
	area.top = 0;
#ifdef _WIN32_WCE
	area.right = GetSystemMetrics(SM_CXSCREEN);
	area.bottom = GetSystemMetrics(SM_CYSCREEN);

	SetWindowLong(hwnd, GWL_STYLE, WS_POPUP);

	SetWindowPos(hwnd, HWND_TOPMOST,
					area.left, area.top,
					area.right, area.bottom,
					SWP_FRAMECHANGED);
#else
	// Window border hard coded
	//area.right = scrW + 8;
	//area.bottom = scrH + 27;
	////area.right = GetSystemMetrics(SM_CXSCREEN);
	////area.bottom = GetSystemMetrics(SM_CYSCREEN);
	int addW = GetSystemMetrics(SM_CXSIZEFRAME) * 2;
	int addH = GetSystemMetrics(SM_CYSIZEFRAME) * 2 + GetSystemMetrics(SM_CYCAPTION);
	area.right = scrW + addW;
	area.bottom = scrH + addH;
	

	/*
	AdjustWindowRect(
		&area,
		WS_SYSMENU|WS_THICKFRAME|WS_DISABLED,
		false
	);*/

	SetWindowPos(hwnd, HWND_TOP,
					area.left, area.top,
					area.right, area.bottom,
					SWP_NOMOVE);
#endif

	/* set as foreground window to give this app focus in case it doesn't have it */
	SetForegroundWindow(hwnd);
	ShowWindow(hwnd, SW_SHOWNORMAL);

	glClearColor(1.0f, 0.7f, 0.2039f, 0.0f);
	glDisable( GL_CULL_FACE );

	//

	// testCodeInit();

	CPFInterface& pfif = CPFInterface::getInstance();
	CWin32Platform * pPlatform = new CWin32Platform(hwnd);

	if (!hasDefaultFont) {
		pPlatform->setNoDefaultFont();
	}

	pfif.setPlatformRequest(pPlatform);
	GameSetup();	// client side setup

	// Can only access client AFTER GameSetup.
	pfif.client().setInitParam((hasDefaultDB   ? IClientRequest::ENGINE_USE_DEFAULTDB   : 0)
							|  (hasDefaultFont ? IClientRequest::ENGINE_USE_DEFAULTFONT : 0), NULL); 

	// sound initialize
	SoundSystemInitFor_Win32();
	CWin32AudioMgr::getInstance().init(hwnd);

	// set screen size
	pfif.client().setScreenInfo(false, scrW, scrH);
	// boot path
	if (strlen(g_fileName)) {
		pfif.client().setFilePath(g_fileName);
	} else {
		pfif.client().setFilePath(NULL);
	}
	if (!pfif.client().initGame()) {
		klb_assertAlways("Could not initialize game, most likely memory error");
	} else {
		static DWORD lastTime = GetTickCount();

		// Main message loop:
		bool quit = false;
		s32 frameTime = pfif.client().getFrameTime();
		IClientRequest& pClient = pfif.client();

		while (!quit)
		{
			/* relay message queue messages to windowproc's */
			MSG msg;
			while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
			{
				TranslateMessage(&msg);

				if (msg.message == WM_QUIT)
				{
					quit = true;
					break;
				}

				DispatchMessage(&msg);
			}

			if (!quit) {
				// This is not the safest or best way to handle timing, but this code
				// is only added to make the triangle rotate at a basically constant
				// rate, independent of the target (Win32) platform
				DWORD newTime   = GetTickCount();
				DWORD delta     = newTime - lastTime;

				// Handle rollover
				if (newTime < lastTime) {
					delta = 0;
				} else {
					if (delta > (DWORD)frameTime) {
						sendEvents();

						lastTime = newTime;
						//dglClear(GL_COLOR_BUFFER_BIT);
	
						//
						// Rendering complete.
						//		
						//testCodeLoop(delta);
						pClient.frameFlip(fixedDelta ? fixedDelta : delta);

						// pfIF.platform().flipFrame();
						SwapBuffers( hDC );
					}
                    // コントロール(ex. TextBox)が作られている場合、その再描画を行う
					// If a Control (ex TextBox) is done, redraw them.
					CWin32Widget::ReDrawControls();
				}
			}
			Sleep(1);
		}
	}

	pfif.client().finishGame();

	SoundSystemExitFor_Win32();

	delete pPlatform;

	// shutdown OpenGL
	DisableOpenGL( hwnd, hDC, hRC );

	CWin32AudioMgr::getInstance().release();

	// End of COM
	CoUninitialize();

	if(DestroyWindow (hwnd)) {
		printf("DestroyWindow SUCCESS\n");
    }
	return 0;
}
示例#17
0
void CKLBSplineNode::setAnimation(s32 milliSecondsPlayTime, s32 timeShift, u32 type, s32* keys, u32 keycount, u32 affected, float* arrayParam) {
	klb_assert(type <= NB_SPLINE, "Wrong spline type index");

	if (milliSecondsPlayTime == 0) {
		return;
	}

	timeShift			= (timeShift * 16384) / milliSecondsPlayTime;

	m_uiLocalTime		= timeShift;
	m_applyMask			= affected;
	m_uiLooptime		= 16384;	// Use time dilation.
	m_timeMultiplier	= ((16384<<8) / milliSecondsPlayTime);

	if (m_applyMask & ANM_X_COORD_0)		{  m_base[0] = arrayParam[0];  m_base[1] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }
	if (m_applyMask & ANM_Y_COORD_1)		{  m_base[2] = arrayParam[0];  m_base[3] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }
	if (m_applyMask & ANM_SCALE_COORD_2)	{  m_base[4] = arrayParam[0];  m_base[5] = arrayParam[1] - arrayParam[0];
											   m_base[6] = arrayParam[2];  m_base[7] = arrayParam[3] - arrayParam[2]; arrayParam+=4; }
	if (m_applyMask & ANM_R_COLOR_3)		{  m_base[8] = arrayParam[0];  m_base[9] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }
	if (m_applyMask & ANM_G_COLOR_4)		{ m_base[10] = arrayParam[0]; m_base[11] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }
	if (m_applyMask & ANM_B_COLOR_5)		{ m_base[12] = arrayParam[0]; m_base[13] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }
	if (m_applyMask & ANM_A_COLOR_6)		{ m_base[14] = arrayParam[0]; m_base[15] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }
	if (m_applyMask & ANM_SCALEX_COORD_7)	{  m_base[4] = arrayParam[0];  m_base[5] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }
	if (m_applyMask & ANM_SCALEY_COORD_8)	{  m_base[6] = arrayParam[0];  m_base[7] = arrayParam[1] - arrayParam[0]; arrayParam+=2; }
	if (m_applyMask & ANM_ROTATION_COORD_9)	{ m_base[16] = arrayParam[0]; m_base[17] = arrayParam[1] - arrayParam[0]; }

	m_loop			= ((m_applyMask & ANM_LOOPBIT	) != 0);
	m_pingpong	    = ((m_applyMask & ANM_PING_PONG	) != 0);
	
	switch (type) {
	case 0:			
		m_aKeyVector        = keys;
		m_uiTotalKeyCount	= keycount;
		if (keys == NULL) {
			m_uiSplineCount = 0;	// Force node to do nothing.
			return;
		}
		break;
	case 1:			m_aKeyVector = SplineTbl1;
		m_uiTotalKeyCount	= 2;
		break;
	case 2:			m_aKeyVector = SplineTbl2;
		m_uiTotalKeyCount	= 2;
		break;
	case 3:			m_aKeyVector = SplineTbl3;
		m_uiTotalKeyCount	= 2;
		break;
	case 4:			m_aKeyVector = SplineTbl4;
		m_uiTotalKeyCount	= 2;
		break;
	case 5:			m_aKeyVector = SplineTbl5;
		m_uiTotalKeyCount	= 2;
		break;
	case 6:			m_aKeyVector = SplineTbl6;
		m_uiTotalKeyCount	= 2;
		break;
	case 7:			m_aKeyVector = SplineTbl7;
		m_uiTotalKeyCount	= 2;
		break;
	case 9:			m_aKeyVector = SplineTbl9;
		m_uiTotalKeyCount	= 2;
		break;
	case 27:		m_aKeyVector = SplineTbl27;
		m_uiTotalKeyCount	= 2;
		break;
	case 28:		m_aKeyVector = SplineTbl28;
		m_uiTotalKeyCount	= 2;
		break;
	case 29:		m_aKeyVector = SplineTbl29;
		m_uiTotalKeyCount	= 2;
		break;
	default:		m_aKeyVector = SplineTbl1;
		m_uiTotalKeyCount	= 2;
		break;
	}

	m_uiLastLocalTime	= -timeShift;
	m_uiLastKey			= 0;
	m_startTime			= m_uiLastLocalTime;
	m_uiTotalTime		= 16384;
	m_uiSplineCount		= 1;
	m_mode				= 1;
}
示例#18
0
void JSonDB::setBool		(s32 idx, s32 value) {
	klb_assert(m_fieldType[idx]==TYPE_BOOL,"Type does not match");
	klb_assert(((u32)idx) < m_recordEntry, "Field index out of range");
	m_currRecord->fields[idx].v.b = value ? true : false;
}
示例#19
0
void CKLBAudioAsset::play(float volume) {
	klb_assert(m_handle, "Audio data is not init()");
	CPFInterface::getInstance().platform().playAudio(m_handle,10000000,volume,volume);
}
示例#20
0
int
CKLBUIScore::commandUI(CLuaState& lua, int argc, int cmd)
{
	int ret = 0;
	switch(cmd)
	{
	case UI_SCORE_RESET:
		setValue(0);
		m_bScoreUpdate = true;
		break;
	case UI_SCORE_SET:
		{
			if(argc != 3) {
				lua.retNil();
				ret = 1;
				break;
			}
			int value = lua.getInt(3);
			if(m_bCountClip && value >= m_maxvalue) value = m_maxvalue - 1;
			setValue(value);
		}
		break;
	case UI_SCORE_SETFLOAT:
		{
			if(argc != 4) {
				lua.retNil();
				ret = 1;
				break;
			}
			float value = lua.getFloat(3);
			int pos = lua.getInt(4);
			if(m_bCountClip && value >= m_maxvalue) value = m_maxvalue - 1;
			setValueFloat(value, pos);
		}
		break;
	case UI_SCORE_SETDOT:
		{
			if(argc != 5) {
				lua.retNil();
				ret = 1;
				break;
			}

			setDot(lua.getString(3), lua.getInt(4), lua.getInt(5));
		}
		break;
	case UI_SCORE_GET:
		{	
			int value = getValue();
			lua.retInt(value);
			ret = 1;
		}
		break;
	case UI_SCORE_ENTERANIM:
		{
			if(argc != 8) {
				lua.retBoolean(false);
				ret = 1;
				break;
			}
			s32  mspt       = lua.getInt(3);
			s32  tshift     = lua.getInt(4);
			bool onlychg    = lua.getBool(5);
			int  type       = lua.getInt(6);
			u32  affected   = lua.getInt(7);
			float mat[8];
			klb_assert(type > 0, "UI_Score: UI_SCORE_ENTERANIM type == 0");

			// 配列を読む
			lua.retValue(8);
			lua.retNil();
			while(lua.tableNext()) {
				lua.retValue(-2);
				int idx = lua.getInt(-1) - 1;
				klb_assert((idx >= 0 && idx < 8), "%s(%d): bad array index. UI_SCORE_ENTERANIM", lua.getScriptName(), lua.getNumLine());
				mat[idx] = lua.getFloat(-2);
				lua.pop(2);
			}
			lua.pop(1);

			klb_assert(type != 0, "Custom animation is not authorized (type 0)");
			m_pScoreNode->setEnterAnimation(mspt, tshift, onlychg, type, affected, mat);
		}
		break;
	case UI_SCORE_EXITANIM:
		{
			if(argc != 8) {
				lua.retBoolean(false);
				ret = 1;
				break;
			}
			s32  mspt       = lua.getInt(3);
			s32  tshift     = lua.getInt(4);
			bool onlychg    = lua.getBool(5);
			int  type       = lua.getInt(6);
			u32  affected   = lua.getInt(7);
			float mat[4];
			klb_assert(type > 0, "UI_Score: UI_SCORE_ENTERANIM type == 0");

			// 配列を読む
			lua.retValue(8);
			lua.retNil();
			while(lua.tableNext()) {
				lua.retValue(-2);
				int idx = lua.getInt(-1) - 1;
				mat[idx] = lua.getFloat(-2);
				lua.pop(2);
			}
			lua.pop(1);

			klb_assert(type != 0, "Custom animation is not authorized (type 0)");
			m_pScoreNode->setExitAnimation(mspt, tshift, onlychg, type, affected, mat);
		}
		break;
	case UI_SCORE_ALIGN:
		{
			bool bResult = false;
			if(argc == 3) {
				int align = lua.getInt(3);
				setAlign(align);
				bResult = true;
			}
			lua.retBool(bResult);
			ret = 1;
		}
		break;
	}
	return ret;
}
示例#21
0
float JSonDB::getAsFloat	(IDataRecord rec, u32 index) {
	klb_assert(m_fieldType[index]==TYPE_FLOAT,"Type does not match");
	klb_assert(index < m_recordEntry, "Field index out of range");
	RecordListHeader* pRecord = (RecordListHeader*)rec;
	return pRecord->fields[index].v.f;
}
示例#22
0
u32	JSonDB::getFieldType(u32 index) {
	klb_assert(((u32)index) < MAX_FIELD_PER_RECORD, "Invalid field index");
	return m_fieldType[index];
}
示例#23
0
void JSonDB::setFloat		(s32 idx, float value) {
	klb_assert(m_fieldType[idx]==TYPE_FLOAT,"Type does not match");
	klb_assert(((u32)idx) < m_recordEntry, "Field index out of range");
	m_currRecord->fields[idx].v.f = value;
}
示例#24
0
void JSonDB::setFieldType	(s32 field, u8 type) {
	klb_assert(((u32)field) < MAX_FIELD_PER_RECORD, "Invalid field index");
	m_fieldType[field] = type;
}
示例#25
0
bool CKLBAudioAsset::preLoad() {
	klb_assert(m_handle, "Audio data is not init()");
	return CPFInterface::getInstance().platform().preLoad(m_handle);
}
示例#26
0
void CKLBSplineNode::setTarget(u8 splineIndex, u8 targetParameter) {
	klb_assert(splineIndex < m_uiSplineCount, "Invalid index");

	// Do not verify target used twice.
	m_target[splineIndex] = targetParameter;
}
示例#27
0
void CKLBAudioAsset::release() {
	klb_assert(m_handle, "Audio data is not init()");
	CPFInterface::getInstance().platform().releaseAudio(m_handle);
}
示例#28
0
const char*	JSonDB::getFieldName(u32 index, u32& len) {
	klb_assert(index < m_recordEntry, "Field index out of range");
	len = strlen(&m_stringBuffer[m_fieldName[index]]);
	return &m_stringBuffer[m_fieldName[index]];
}