Ejemplo n.º 1
0
	void return_before(DWORD This, DWORD OutClass)
	{
		if (global.mother_id == CC_GUIID_YDWETimerStartMultiple
			|| global.mother_id == CC_GUIID_YDWERegisterTriggerMultiple)
		{
			CC_PutLocal_End(This, OutClass, TRUE, FALSE);
		}
		else
		{
			CC_PutLocal_End(This, OutClass, FALSE, FALSE);
		}
	}
Ejemplo n.º 2
0
void _fastcall CC_PutExternFuncEx(DWORD This, DWORD OutClass, char* name)
{
	switch (*(DWORD*)(This+0x138))
	{
	case CC_GUIID_YDWETimerStartMultiple:
		{
			locvar::guard _tmp_guard_(CC_GUIID_YDWETimerStartMultiple, name, "GetExpiredTimer()");

			CC_PutExternFuncEx_TopDown(This, OutClass, name);

			char buff[260];
			BLZSStrPrintf(buff, 260, "function %sT takes nothing returns nothing", name);
			PUT_CONST(buff, 1);

			CC_PutLocal_Begin(This, OutClass, TRUE, FALSE);
			CC_PutBlock_Action(This, OutClass, name, 1);
			CC_PutLocal_End(This, OutClass, TRUE, TRUE);

			PUT_CONST("endfunction", 1);
			PUT_CONST("", 1);
		}
		break;
	case CC_GUIID_YDWERegisterTriggerMultiple:
		{
			locvar::guard _tmp_guard_(CC_GUIID_YDWERegisterTriggerMultiple, name, "GetTriggeringTrigger()");

			CC_PutExternFuncEx_TopDown(This, OutClass, name);

			char buff[260];
			BLZSStrPrintf(buff, 260, "function %sConditions takes nothing returns nothing", name);
			PUT_CONST(buff, 1);

			CC_PutLocal_Begin(This, OutClass, TRUE, FALSE);
			CC_PutBlock_Action(This, OutClass, name, 2);
			CC_PutLocal_End(This, OutClass, TRUE, TRUE);

			PUT_CONST("endfunction", 1);
			PUT_CONST("", 1);
		}
		break;
	default:
		CC_PutExternFuncEx_TopDown(This, OutClass, name);
		break;
	}
}
Ejemplo n.º 3
0
void _fastcall CC_PutExternFuncEx_TopDown(DWORD This, DWORD OutClass, char* name)
{
	char NewName[260];
	char buff[260];
	DWORD nVar, VarClass, Var, i;
	LONG flag = -1;

	nVar = *(DWORD*)(This+0x128);

	for (i = 0; i < nVar; i++)
	{
		Var = ((DWORD*)(*(DWORD*)((This)+0x12C)))[i];
		VarClass = GetGUIVar_Class(This, i);

		switch (GetGUIVar_Type(This, i))
		{
		case CC_VARTYPE_boolexpr:
		case CC_VARTYPE_boolcall:
			flag = 1;
			break;
		case CC_VARTYPE_code:
			flag = 2;
			break;
		case CC_VARTYPE_eventcall:
			flag = 0;
			break;
		default:
			flag = -1;
			break;
		}

		if ((2 == (*(DWORD*)(Var+0x08))) && (0 == BLZSStrCmp((char*)(Var+0x0C), "boolexpr", 0xFFFFFFFF)))
		{
			flag = 1;
		}
		else if (flag == -1 && VarClass == 0)
		{
			continue;
		}

		if (0 == BLZSStrCmp((char*)(VarClass+0x20), "Null", 0xFFFFFFFF))
			continue;

		BLZSStrPrintf(NewName, 260, "%s%03d", name, i+1);
		CC_PutExternFuncEx(VarClass, OutClass, NewName);

		if (*(DWORD*)(VarClass+0x138) == CC_GUIID_ReturnAction)
			continue;

		switch (*(DWORD*)(This+0x138))
		{   
		case CC_GUIID_IfThenElse:
		case CC_GUIID_GetBooleanAnd:
		case CC_GUIID_GetBooleanOr:
			flag = -1;
			break;
		}

		if (flag == 1)
		{
			BLZSStrPrintf(buff, 260, "function %s takes nothing returns boolean", NewName);
			PUT_CONST(buff, 1);

			CC_PutBegin();
			PUT_CONST("return (", 0); 
			CC_PutConditionEx(VarClass, OutClass, NewName);
			PUT_CONST(")", 1); 
			CC_PutEnd();

			PUT_CONST("endfunction", 1);
			PUT_CONST("", 1);
		}
		else if ((flag == 2) && (!((CC_GUIID_IfThenElse <= *(DWORD*)(This+0x138)) && (*(DWORD*)(This+0x138) <= CC_GUIID_ForLoopVarMultiple))))
		{
			BLZSStrPrintf(buff, 260, "function %s takes nothing returns nothing", NewName);
			PUT_CONST(buff, 1);

			CC_PutActionEx_Hook(VarClass, 0, OutClass, NewName, CC_GUI_TYPE_ACTION, 0);

			PUT_CONST("endfunction", 1);
			PUT_CONST("", 1);
		}
	}

	CC_PutExternFuncEx_Item(This, OutClass, name);

	switch (*(DWORD*)(This+0x138))
	{
	case CC_GUIID_ForGroupMultiple:
	case CC_GUIID_ForForceMultiple:
	case CC_GUIID_EnumDestructablesInRectAllMultiple:
	case CC_GUIID_EnumDestructablesInCircleBJMultiple:
	case CC_GUIID_EnumItemsInRectBJMultiple:
		{
			BLZSStrPrintf(buff, 260, "function %sA takes nothing returns nothing", name);
			PUT_CONST(buff, 1);

			CC_PutLocal_Begin(This, OutClass, FALSE, FALSE);

			CC_PutBlock_Action(This, OutClass, name, -1);

			CC_PutLocal_End(This, OutClass, FALSE, TRUE);

			PUT_CONST("endfunction", 1);
			PUT_CONST("", 1);
		}
		break;
	default:
		break;
	}
}
Ejemplo n.º 4
0
void _fastcall
CC_PutActionEx_Hook(DWORD This, DWORD EDX, DWORD OutClass, char* name, DWORD Type, DWORD Endl)
{
    char buff[260];

    switch (*(DWORD*)(This+0x138))
    {
    case CC_GUIID_IfThenElse:
    {
        CC_PutBegin();
        PUT_CONST("if (", 0);
        CC_PutVar_Code(This, OutClass, name, 0, CC_GUI_TYPE_CONDITION);
        PUT_CONST(") then", 1);
        CC_PutVar_Code(This, OutClass, name, 1, CC_GUI_TYPE_ACTION);
        PUT_CONST("else", 1);
        CC_PutVar_Code(This, OutClass, name, 2, CC_GUI_TYPE_ACTION);
        PUT_CONST("endif", 1);
        CC_PutEnd();

        break;
    }
    case CC_GUIID_IfThenElseMultiple:
    {
        CC_PutBegin();
        PUT_CONST("if (", 0);
        CC_PutBlock_Condition_And(This, OutClass, name, 0);
        PUT_CONST(") then", 1);
        CC_PutBlock_Action(This, OutClass, name, 1);
        PUT_CONST("else", 1);
        CC_PutBlock_Action(This, OutClass, name, 2);
        PUT_CONST("endif", 1);
        CC_PutEnd();

        break;
    }
    case CC_GUIID_YDWEEnumUnitsInRangeMultiple:
    {
        if (!g_bYDWEEnumUnitsInRangeMultipleFlag)
        {
            g_bYDWEEnumUnitsInRangeMultipleFlag = TRUE;

            CC_PutBegin();
            PUT_CONST("set ydl_group = CreateGroup()", 1);
            PUT_CONST("call YDTriggerEnumUintsInRange(ydl_group, ", 0);
            PUT_VAR(This, 0);
            PUT_CONST(", ", 0);
            PUT_VAR(This, 1);
            PUT_CONST(", ", 0);
            PUT_VAR(This, 2);
            PUT_CONST(")", 1);
            PUT_CONST("loop", 1);
            CC_PutBegin();
            PUT_CONST("set ydl_unit = FirstOfGroup(ydl_group)", 1);
            PUT_CONST("exitwhen ydl_unit == null", 1);
            PUT_CONST("call GroupRemoveUnit(ydl_group, ydl_unit)", 1);
            CC_PutEnd();
            CC_PutBlock_Action(This, OutClass, name, 0);
            PUT_CONST("endloop", 1);
            PUT_CONST("call DestroyGroup(ydl_group)", 1);
            CC_PutEnd();

            g_bYDWEEnumUnitsInRangeMultipleFlag = FALSE;
        }
    }
    break;
    case CC_GUIID_ForLoopA:
    case CC_GUIID_ForLoopB:
    case CC_GUIID_ForLoopVar:
    case CC_GUIID_ForLoopAMultiple:
    case CC_GUIID_ForLoopBMultiple:
    case CC_GUIID_ForLoopVarMultiple:
    case CC_GUIID_YDWEForLoopLocVarMultiple:
    {
        CC_PutActionEx_ForLoop(This, OutClass, name, *(DWORD*)(This+0x138));
        break;
    }
    case CC_GUIID_ReturnAction:
    {
        if (g_mother_id == CC_GUIID_YDWETimerStartMultiple
                || g_mother_id == CC_GUIID_YDWERegisterTriggerMultiple)
        {
            CC_PutLocal_End(This, OutClass, TRUE, FALSE);
        }
        else
        {
            CC_PutLocal_End(This, OutClass, FALSE, FALSE);
        }

        CC_PutBegin();
        PUT_CONST("return", 1);
        CC_PutEnd();
        break;
    }
    case CC_GUIID_YDWESetAnyTypeLocalVariable:
    {
        CC_PutBegin();

        if (g_mother_id == CC_GUIID_YDWETimerStartMultiple)
        {
            CC_Put_SetTimerParameters(This, OutClass, name, "GetExpiredTimer()");
        }
        else if (g_mother_id == (0x8000 | (int)CC_GUIID_YDWETimerStartMultiple))
        {
            CC_Put_SetTimerParameters(This, OutClass, name, g_handle_string);
        }
        else if (g_mother_id == CC_GUIID_YDWERegisterTriggerMultiple)
        {
            CC_Put_SetTimerParameters(This, OutClass, name, "GetTriggeringTrigger()");
        }
        else
        {
            CC_Put_TriggerLocalVar_Set(This, OutClass, name);
        }
        CC_PutEnd();
        break;
    }
    case CC_GUIID_YDWETimerStartMultiple:
    {
        CC_PutBegin();
        PUT_CONST("set "YDL_TIMER" = ", 0);
        PUT_VAR(This, 0);
        PUT_CONST("", 1);
        CC_PutEnd();

        CC_PutBlock_TimerParameters(This, OutClass, name, 0, YDL_TIMER);

        CC_PutBegin();
        PUT_CONST("call TimerStart("YDL_TIMER", ", 0);
        PUT_VAR(This, 1);
        PUT_CONST(", ", 0);
        PUT_VAR(This, 2);
        BLZSStrPrintf(buff, 260, ", function %sT)", name);
        PUT_CONST(buff, 1);
        CC_PutEnd();

        break;
    }
    case CC_GUIID_YDWETimerStartFlush:
        if (g_mother_id == CC_GUIID_YDWETimerStartMultiple)
        {
            g_bDisableSaveLoadSystem = FALSE;

            CC_PutBegin();
            PUT_CONST("call YDTriggerClearTable(YDTriggerH2I(GetExpiredTimer()))", 1);
            PUT_CONST("call DestroyTimer(GetExpiredTimer())", 1);
            CC_PutEnd();
        }
        else
        {
            ShowError(OutClass, "WESTRING_ERROR_YDTRIGGER_TIMER_FLUSH");
        }
        break;
    case CC_GUIID_TriggerSleepAction:
        CC_PutBegin();
        PUT_CONST("call TriggerSleepAction(", 0);
        PUT_VAR(This, 0);
        PUT_CONST(")", 1);
        if (g_mother_id != CC_GUIID_YDWETimerStartMultiple
                && g_mother_id != CC_GUIID_YDWERegisterTriggerMultiple)
        {
            CC_Put_TriggerLocalVar_Sleep_End(OutClass);
        }
        else
        {
            ShowError(OutClass, "WESTRING_ERROR_YDTRIGGER_ILLEGAL_WAIT");
        }
        CC_PutEnd();
        break;
    case CC_GUIID_PolledWait:
        CC_PutBegin();
        PUT_CONST("call PolledWait(", 0);
        PUT_VAR(This, 0);
        PUT_CONST(")", 1);
        if (g_mother_id != CC_GUIID_YDWETimerStartMultiple
                && g_mother_id != CC_GUIID_YDWERegisterTriggerMultiple)
        {
            CC_Put_TriggerLocalVar_Sleep_End(OutClass);
        }
        else
        {
            ShowError(OutClass, "WESTRING_ERROR_YDTRIGGER_ILLEGAL_WAIT");
        }
        CC_PutEnd();
        break;
    case CC_GUIID_YDWERegisterTriggerMultiple:
    {
        CC_PutBegin();
        PUT_CONST("set "YDL_TRIGGER" = ", 0);
        PUT_VAR(This, 0);
        PUT_CONST("", 1);
        CC_PutEnd();

        CC_PutBlock_TimerParameters(This, OutClass, name, 1, YDL_TRIGGER);

        // Event
        CC_PutBlock_Event(This, OutClass, name, 0, YDL_TRIGGER);

        CC_PutBegin();
        BLZSStrPrintf(buff, 260, "call TriggerAddCondition("YDL_TRIGGER", Condition(function %sConditions))", name);
			PUT_CONST(buff, 1); 
        CC_PutEnd();

        break;
    }
	case CC_GUIID_YDWERegisterTriggerFlush:
		if (g_mother_id == CC_GUIID_YDWERegisterTriggerMultiple)
		{
			g_bDisableSaveLoadSystem = FALSE;

			CC_PutBegin();
			PUT_CONST("call YDTriggerClearTable(YDTriggerH2I(GetTriggeringTrigger()))", 1);
			PUT_CONST("call DestroyTrigger(GetTriggeringTrigger())", 1);
			CC_PutEnd();
		}
		else
		{
			ShowError(OutClass, "WESTRING_ERROR_YDTRIGGER_TRIGGER_FLUSH");
		}
		break;
    case CC_GUIID_YDWESaveAnyTypeDataByUserData:
    {
        CC_PutBegin();
        CC_Put_YDWESaveAnyTypeDataByUserData(This, OutClass, name);
        CC_PutEnd();
        break;
    }
    case CC_GUIID_YDWEFlushAnyTypeDataByUserData:
    {
        CC_PutBegin();
        CC_Put_YDWEFlushAnyTypeDataByUserData(This, OutClass, name);
        CC_PutEnd();
        break;
    }
    case CC_GUIID_YDWEFlushAllByUserData:
    {
        CC_PutBegin();
        CC_Put_YDWEFlushAllByUserData(This, OutClass, name);
        CC_PutEnd();
        break;
    }
	case CC_GUIID_YDWEActivateTrigger:
		{
			LPCSTR lpszTrigVar = (char*)&GetGUIVar_Value(This, 0);
			LPCSTR lpszMode = (char*)&GetGUIVar_Value(This, 1);

			if (0 == BLZSStrCmp("gg_trg_", lpszTrigVar, sizeof("gg_trg_")-1))
			{
if (0 == BLZSStrCmp("OnOffOn", lpszMode, 0x7FFFFFFF))
{
	CC_PutBegin();
	BLZSStrPrintf(buff, 260, "call ExecuteFunc(\"InitTrig_%s_Orig\")", lpszTrigVar+(sizeof("gg_trg_")-1));
	PUT_CONST(buff, 1); 
	CC_PutEnd();
}
else if (0 == BLZSStrCmp("OnOffOff", lpszMode, 0x7FFFFFFF))
{
	CC_PutBegin();
	BLZSStrPrintf(buff, 260, "call InitTrig_%s_Orig()", lpszTrigVar+(sizeof("gg_trg_")-1));
	PUT_CONST(buff, 1); 
	CC_PutEnd();
}
			}

			break;
		}
	case CC_GUIID_AddTriggerEvent:
		{
			DWORD nVarClass = GetGUIVar_Class(This, 1);
			if (!nVarClass)
			{
return ;
			}

			CC_PutBegin();

			char szName[260];
			char szTrigName[260];

			CC_GetGUIName(nVarClass, 0, szName, 260);
			BLZSStrPrintf(buff, 260, "call %s(", szName);
			PUT_CONST(buff, 0);
			PUT_VAR(This, 0);

			DWORD nVar = *(DWORD*)(nVarClass+0x128);
			BLZSStrPrintf(szTrigName, 260, "%s002", name);
			for (DWORD i = 0; i < nVar; ++i)
			{
PUT_CONST(", ", 0);
CC_PutVar(nVarClass, 0, OutClass, szTrigName, i, 2, 1);
			}
			PUT_CONST(")", 1);

			CC_PutEnd();
		}
		break;
    default:
    {
        if (CC_PutAction_SearchVar(This, OutClass))
        {
ShowError(OutClass, "WESTRING_ERROR_YDTRIGGER_ANYPLAYER");
        }
        CC_PutActionEx(This, EDX, OutClass, name, Type, Endl);
    }
    break;
    }
}