Esempio n. 1
0
	void destroy(DWORD OutClass)
	{
		if (g_local_in_mainproc)
		{
			CC_PutBegin();
			PUT_CONST("call YDTriggerClearTable(YDTriggerH2I(GetTriggeringTrigger())*"YDL_LOCALVAR_STEPS")", 1);
			CC_PutEnd();
		}
	}
Esempio n. 2
0
	void flush_in_trigger(DWORD This, DWORD OutClass)
	{
		if (global.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");
		}
	}
Esempio n. 3
0
	void construct(DWORD OutClass)
	{
		char buff[260];

		if (g_local_in_mainproc)
		{
			g_bDisableSaveLoadSystem = FALSE;

			CC_PutBegin();
			BLZSStrPrintf(buff, 260, "local integer "YDL_LOCALVAR_STEPS" = YDTriggerGetEx(integer, YDTriggerH2I(GetTriggeringTrigger()), 0x%08X)", SStrHash("GlobalsTriggerRunSteps"));
			PUT_CONST(buff, 1);
			PUT_CONST("set "YDL_LOCALVAR_STEPS" = "YDL_LOCALVAR_STEPS" + 3", 1);
			BLZSStrPrintf(buff, 260, "call YDTriggerSetEx(integer, YDTriggerH2I(GetTriggeringTrigger()), 0x%08X, "YDL_LOCALVAR_STEPS")", SStrHash("GlobalsTriggerRunSteps"));
			PUT_CONST(buff, 1);
			BLZSStrPrintf(buff, 260, "call YDTriggerSetEx(integer, YDTriggerH2I(GetTriggeringTrigger()), 0x%08X, "YDL_LOCALVAR_STEPS")", SStrHash("TriggerRunSteps"));
			PUT_CONST(buff, 1);
			CC_PutEnd();
		}
	}
Esempio n. 4
0
	void do_set(DWORD OutClass, const char* type_name, const char* var_name, const state& s, std::function<void(void)> func)
	{
		g_bDisableSaveLoadSystem = FALSE;
		char buff[260];

		CC_PutBegin();

		if (s.mother_id == (0x10000 | CC_GUIID_YDWETimerStartMultiple))
		{
			register_var[s.name].erase(var_name);
			BLZSStrPrintf(buff, 260, "call YDTriggerSetEx(%s, YDTriggerH2I(%s), 0x%08X, ", type_name, s.handle_string, SStrHash(var_name));
		}
		else if (s.mother_id == CC_GUIID_YDWETimerStartMultiple || s.mother_id == CC_GUIID_YDWERegisterTriggerMultiple)
		{
			BLZSStrPrintf(buff, 260, "call YDTriggerSetEx(%s, YDTriggerH2I(%s), 0x%08X, ", type_name, s.handle_string, SStrHash(var_name));
		}
		else
		{
			if (!SaveLoadCheck_Set(var_name, type_name))
			{
				char tmp[260];
				Utf8toAscii((char*)var_name, tmp, 260);
				ShowErrorN(OutClass, "WESTRING_ERROR_YDTRIGGER_LOCVAR", tmp, type_name, tmp, SaveLoadCheck_Get(var_name));
			}

			if (g_local_in_mainproc)
			{
				BLZSStrPrintf(buff, 260, "call YDTriggerSetEx(%s, YDTriggerH2I(GetTriggeringTrigger())*"YDL_LOCALVAR_STEPS", 0x%08X, ", type_name, SStrHash(var_name));
			}
			else
			{
				BLZSStrPrintf(buff, 260, "call YDTriggerSetEx(%s, YDTriggerH2I(GetTriggeringTrigger())*YDTriggerGetEx(integer, YDTriggerH2I(GetTriggeringTrigger()), 0x%08X), 0x%08X, ", type_name, SStrHash("TriggerRunSteps"), SStrHash(var_name));
			}
		}

		PUT_CONST(buff, 0);
		func();
		PUT_CONST(")", 1);

		CC_PutEnd();
	}
Esempio n. 5
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;
	}
}
Esempio n. 6
0
void _fastcall
CC_PutActionEx_ForLoop(DWORD This, DWORD OutClass, char* name, DWORD cc_guiid_type)
{
    char buff[260];
    char varname[260];

    CC_PutActionEx_ForLoop_GetVarName(This, cc_guiid_type, varname);

    CC_PutBegin();

    switch (cc_guiid_type)
    {
    case CC_GUIID_ForLoopA:
    case CC_GUIID_ForLoopB:
    case CC_GUIID_ForLoopAMultiple:
    case CC_GUIID_ForLoopBMultiple:
        BLZSStrPrintf(buff, 260, "set %s = ", varname);
        PUT_CONST(buff, 0);
        PUT_VAR(This, 0);
        PUT_CONST("", 1);

        BLZSStrPrintf(buff, 260, "set %sEnd = ", varname);
        PUT_CONST(buff, 0);
        PUT_VAR(This, 1);
        PUT_CONST("", 1);
        break;
    case CC_GUIID_ForLoopVar:
    case CC_GUIID_ForLoopVarMultiple:
    case CC_GUIID_YDWEForLoopLocVarMultiple:
        BLZSStrPrintf(buff, 260, "set %s = ", varname);
        PUT_CONST(buff, 0);
        PUT_VAR(This, 1);
        PUT_CONST("", 1);
        break;
    }

    PUT_CONST("loop", 1);

    CC_PutBegin();
    switch (cc_guiid_type)
    {
    case CC_GUIID_ForLoopA:
    case CC_GUIID_ForLoopAMultiple:
    case CC_GUIID_ForLoopB:
    case CC_GUIID_ForLoopBMultiple:
        BLZSStrPrintf(buff, 260, "exitwhen %s > %sEnd", varname, varname);
        PUT_CONST(buff, 1);
        break;
    case CC_GUIID_ForLoopVar:
    case CC_GUIID_ForLoopVarMultiple:
    case CC_GUIID_YDWEForLoopLocVarMultiple:
        BLZSStrPrintf(buff, 260, "exitwhen %s > ", varname);
        PUT_CONST(buff, 0);
        PUT_VAR(This, 2);
        PUT_CONST("", 1);
        break;
    }
    CC_PutEnd();

    switch (cc_guiid_type)
    {
    case CC_GUIID_ForLoopA:
    case CC_GUIID_ForLoopB:
        CC_PutVar_Code(This, OutClass, name, 2, CC_GUI_TYPE_ACTION);
        break;
    case CC_GUIID_ForLoopVar:
        CC_PutVar_Code(This, OutClass, name, 3, CC_GUI_TYPE_ACTION);
        break;
    case CC_GUIID_ForLoopAMultiple:
    case CC_GUIID_ForLoopBMultiple:
    case CC_GUIID_ForLoopVarMultiple:
    case CC_GUIID_YDWEForLoopLocVarMultiple:
        CC_PutBlock_Action(This, OutClass, name, 0);
        break;
    }

    CC_PutBegin();
    BLZSStrPrintf(buff, 260, "set %s = %s + 1", varname, varname);
    PUT_CONST(buff, 1);
    CC_PutEnd();

    PUT_CONST("endloop", 1);
    CC_PutEnd();
}
Esempio n. 7
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;
    }
}