void Script_v2::o2_playMult(FuncParams &params) {
	uint16 multData = readUint16();

	startFunc(params);
	print("%d, %d", multData >> 1, multData & 0x01);
	endFunc();
}
void Script_v2::o2_handleGoblins(FuncParams &params) {
	startFunc(params);
	print("var32_%d, ", readUint16() * 4);
	print("var32_%d, ", readUint16() * 4);
	print("var32_%d, ", readUint16() * 4);
	print("var32_%d, ", readUint16() * 4);
	print("var32_%d, ", readUint16() * 4);
	print("var32_%d", readUint16() * 4);
	endFunc();
}
void Script_v2::o2_totSub(FuncParams &params) {
	startFunc(params);

	uint8 length = readUint8();
	if (!(length & 0x80)) {
		for (uint16 i = 0; i < length; i++)
			print("%c", (char) readUint8());
	} else
		print("%s", readExpr().c_str());

	print(", %d", readUint8());

	endFunc();
}
void Script_v2::o2_loadMapObjects(FuncParams &params) {
	int16 id;

	startFunc(params);

	print("%s, ", readVarIndex().c_str());

	id = (int16) readUint16();
	print("%d", id);
	if (id != -1) {
		int16 count = (int16) readUint16();
		print(", %d", count);
		for (int i = 0; i < count; i++)
			print(", %d", (int16) readUint16());
	}

	endFunc();
}
void Script_v6::o6_loadCursor(FuncParams &params) {
	int16 id = (int16) readUint16();

	startFunc(params);
	print("%d, ", id);
	if (id == -1) {
		print("%s, ", peekString());
		skip(9);
		print("%d, ", readUint16());
		print("%d", (int8) readUint8());
	} else if (id == -2) {
		print("%d, ", readUint16());
		print("%d, ", readUint16());
		print("%d", (int8) readUint8());
	} else {
		print("%d", (int8) readUint8());
	}
	endFunc();
}
void Script_v6::o6_createSprite(FuncParams &params) {
	uint32 pos;

	pos = getPos();
	skip(1);

	startFunc(params);
	if (peekUint8() == 0) {
		seek(pos);
		print("%d, ", readUint16());
		print("%d, ", readUint16());
		print("%d, ", readUint16());
	} else {
		seek(pos);
		print("%s, ", readExpr().c_str());
		print("%s, ", readExpr().c_str());
		print("%s, ", readExpr().c_str());
	}
	print("%d", readUint16());
	endFunc();
}
Beispiel #7
0
void ServiceMain(int argc, char** argv) 
{
	BOOL bRet;

	bRet = TRUE;
	ServiceStatus.dwServiceType     =SERVICE_WIN32; 
	ServiceStatus.dwCurrentState     =SERVICE_START_PENDING; 
	ServiceStatus.dwControlsAccepted   =SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
	ServiceStatus.dwWin32ExitCode    = 0; 
	ServiceStatus.dwServiceSpecificExitCode = 0; 
	ServiceStatus.dwCheckPoint     = 0;
	ServiceStatus.dwWaitHint     = 0; 
	hStatus = RegisterServiceCtrlHandler("SERVICENAME", (LPHANDLER_FUNCTION)ControlHandler);
	
	if (hStatus == (SERVICE_STATUS_HANDLE)0) 
	{
	   return;
	}

	ServiceStatus.dwCurrentState = SERVICE_RUNNING; 
	SetServiceStatus (hStatus, &ServiceStatus);


	while (ServiceStatus.dwCurrentState == SERVICE_RUNNING)
	{
		int result = startFunc();
		if (result)
		{
		 ServiceStatus.dwCurrentState = SERVICE_STOPPED; 
		 ServiceStatus.dwWin32ExitCode = -1; 
		 SetServiceStatus(hStatus, &ServiceStatus);
		 return;
		}
	}


	return;
}
void Script_v2::o2_playInfogrames(FuncParams &params) {
	startFunc(params);
	print("var8_%d", readUint16() * 4);
	endFunc();
}
void Script_v2::o2_loadMult(FuncParams &params) {
	uint16 id;
	bool hasImds;

	id = readUint16();
	if (id & 0x8000) {
		id &= 0x7FFF;
		skip(1);
	}

	startFunc(params);
	print("%d", id);
	endFunc();

	if (!_extTable)
		error("EXT file needed");

	uint32 size;
	byte *extData = _extTable->getItem(id - 30000, size);
	byte *data = extData;

	int32 count1, count2;

	count1 = ((int8) data[0]) + 1;
	hasImds = ((count1 & 0x80) != 0);
		count1 &= 0x7F;
	count2 = ((int8) data[1]) + 1;
	data += 2;
	// Statics
	for (int i = 0; i < count1; i++, data += 14) {
		int16 sSize;

		readExpr();
		sSize = (int16) readUint16();
		skip(sSize * 2);
		sSize = (int16) readUint16();
		skip(2 + sSize * 8);
	}
	// Anims
	for (int i = 0; i < count2; i++, data += 14) {
		readExpr();
		int16 sSize = (int16) readUint16();
		skip(2 + sSize * 8);
	}

	// FPS
	data += 2;

	// StaticKeys
	count1 = (int16) READ_LE_UINT16(data);
	data += 2 + count1 * 4;

	// AnimKeys
	for (int i = 0; i < 4; i++) {
		count1 = (int16) READ_LE_UINT16(data);
		data += 2 + count1 * 10;
	}

	// fadePal
	data += 5 * 16 * 3;

	// palFadeKeys
	count1 = (int16) READ_LE_UINT16(data);
	data += 2 + count1 * 7;

	// palKeys
	count1 = (int16) READ_LE_UINT16(data);
	data += 2 + count1 * 80;

	// textKeys
	count1 = (int16) READ_LE_UINT16(data);
	data += 2 + count1 * (4 + (hasImds ? 0 : 24));

	// soundKeys
	count1 = (int16) READ_LE_UINT16(data);
	data += 2;
	for (int i = 0; i < count1; i++, data += (12 + (hasImds ? 0 : 24))) {
		int16 cmd = (int16) READ_LE_UINT16(data + 2);

		if ((cmd == 1) || (cmd == 4))
			skip(2);
		else if (cmd == 3)
			skip(4);
	}

	// ImdKeys
	if (hasImds) {
		int16 sSize = (int16) readUint16();
		skip(sSize * 2);

		if (getVerScript() >= 51) {
			sSize = (int16) readUint16();
			if (sSize > 0)
				skip(sSize * 14);
		}
	}

	delete[] extData;
}