diff --git a/AGK/AgkIde/AGKCommands.h b/AGK/AgkIde/AGKCommands.h index bfe66995..1e2365f5 100644 --- a/AGK/AgkIde/AGKCommands.h +++ b/AGK/AgkIde/AGKCommands.h @@ -236,5 +236,6 @@ static const char* const agk_identifiers[] = { "externalcommand", "externalcommandint", "externalcommandfloat", "externalcommandstring", "getappreceipt", "inapppurchaseactivatewithplan", "getinapppurchasesubnumplans", "getinapppurchasesubplannumperiods", "getinapppurchasesubplanprice", "getinapppurchasesubplanduration", "getinapppurchasesubplandurationunit", "getinapppurchasesubplanpaymenttype", "getinapppurchasesubplantags", "getinapppurchasesubplantoken", "getdisplaynumcutouts", "getdisplaycutouttop", "getdisplaycutoutbottom", "getdisplaycutoutleft", "getdisplaycutoutright", "getscreenboundssafetop", -"getscreenboundssafebottom", "getscreenboundssafeleft", "getscreenboundssaferight", "ispinappavailable", "pinapp", "isdarktheme", "getinapppurchaseisrenewing", +"getscreenboundssafebottom", "getscreenboundssafeleft", "getscreenboundssaferight", "ispinappavailable", "pinapp", "isdarktheme", "getinapppurchaseisrenewing", "lerp", "inverselerp", "map", "clamp", +"min", "max", "wrap", "sign", "wrapangle", "curvevalue", "curveangle", }; \ No newline at end of file diff --git a/AGK/AgkIde/media/main.agc.tags b/AGK/AgkIde/media/main.agc.tags index a4b5d289..3c5ea8eb 100644 --- a/AGK/AgkIde/media/main.agc.tags +++ b/AGK/AgkIde/media/main.agc.tags @@ -2119,3 +2119,14 @@ IsPinAppAvailable|Integer|()| PinApp||(Integer enable)| IsDarkTheme|Integer|()| GetInAppPurchaseIsRenewing|Integer|(Integer iID)| +Lerp|Float|(Float a, Float b, Float c)| +InverseLerp|Float|(Float a, Float b, Float c)| +Map|Float|(Float a, Float b, Float c, Float d, Float e)| +Clamp|Float|(Float a, Float b, Float c)| +Min|Float|(Float a, Float b)| +Max|Float|(Float a, Float b)| +Wrap|Float|(Float a, Float b, Float c)| +Sign|Integer|(Float a)| +WrapAngle|Float|(Float a)| +CurveValue|Float|(Float a, Float b, Float c)| +CurveAngle|Float|(Float a, Float b, Float c)| diff --git a/AGK/CommandParserNew/Final/CommandList.dat b/AGK/CommandParserNew/Final/CommandList.dat index 6226705d..74395ee0 100644 Binary files a/AGK/CommandParserNew/Final/CommandList.dat and b/AGK/CommandParserNew/Final/CommandList.dat differ diff --git a/AGK/CompilerNew/CommandList.h b/AGK/CompilerNew/CommandList.h index beea0ab6..102788d9 100644 --- a/AGK/CompilerNew/CommandList.h +++ b/AGK/CompilerNew/CommandList.h @@ -1,5 +1,5 @@ -int g_iAGKNumCommands = 2120; -stCommandOrig g_pAGKCommands[2120] = { +int g_iAGKNumCommands = 2131; +stCommandOrig g_pAGKCommands[2131] = { {"WorldToScreenX",{2},2,1}, {"WorldToScreenY",{2},2,1}, {"ScreenToWorldX",{2},2,1}, @@ -2119,5 +2119,16 @@ stCommandOrig g_pAGKCommands[2120] = { {"IsPinAppAvailable",{},1,0}, {"PinApp",{1},0,1}, {"IsDarkTheme",{},1,0}, - {"GetInAppPurchaseIsRenewing",{1},1,1} + {"GetInAppPurchaseIsRenewing",{1},1,1}, + {"Lerp",{2,2,2},2,3}, + {"InverseLerp",{2,2,2},2,3}, + {"Map",{2,2,2,2,2},2,5}, + {"Clamp",{2,2,2},2,3}, + {"Min",{2,2},2,2}, + {"Max",{2,2},2,2}, + {"Wrap",{2,2,2},2,3}, + {"Sign",{2},1,1}, + {"WrapAngle",{2},2,1}, + {"CurveValue",{2,2,2},2,3}, + {"CurveAngle",{2,2,2},2,3} }; \ No newline at end of file diff --git a/AGK/VSCode/Language Server Protocol/AGKCommands.h b/AGK/VSCode/Language Server Protocol/AGKCommands.h index 45ad4d2b..2d5578c0 100644 --- a/AGK/VSCode/Language Server Protocol/AGKCommands.h +++ b/AGK/VSCode/Language Server Protocol/AGKCommands.h @@ -100,6 +100,7 @@ static const sAGKCommand agk_commands[] = { {"chooserawfile","ChooseRawFile",{"ext"},{3},3,1}, {"chooserawfile","ChooseRawFile",{"ext","returnFullPath"},{3,1},3,2}, {"chr","Chr",{"asciivalue"},{1},3,1}, + {"clamp","Clamp",{"a","b","c"},{2,2,2},2,3}, {"clear3dparticlescolors","Clear3DParticlesColors",{"ID"},{1},0,1}, {"clear3dparticlesforces","Clear3DParticlesForces",{"ID"},{1},0,1}, {"clear3dparticlesscales","Clear3DParticlesScales",{"ID"},{1},0,1}, @@ -268,6 +269,8 @@ static const sAGKCommand agk_commands[] = { {"createzip","CreateZip",{"filename"},{3},1,1}, {"createzip","CreateZip",{"zipID","filename"},{1,3},0,2}, {"crouch3dphysicscharactercontroller","Crouch3DPhysicsCharacterController",{"objID"},{1},0,1}, + {"curveangle","CurveAngle",{"a","b","c"},{2,2,2},2,3}, + {"curvevalue","CurveValue",{"a","b","c"},{2,2,2},2,3}, {"debug3dphysicscharactercontroller","Debug3DPhysicsCharacterController",{"objID","isDebug"},{1,1},0,2}, {"debug3dphysicsworld","Debug3DPhysicsWorld",{},{},0,0}, {"decodeqrcode","DecodeQRCode",{"image"},{1},3,1}, @@ -1195,6 +1198,7 @@ static const sAGKCommand agk_commands[] = { {"inapppurchasesetup","InAppPurchaseSetup",{},{},0,0}, {"instanceobject","InstanceObject",{"objID"},{1},1,1}, {"instanceobject","InstanceObject",{"newobjID","objID"},{1,1},0,2}, + {"inverselerp","InverseLerp",{"a","b","c"},{2,2,2},2,3}, {"is3dphysicsragdollstatic","Is3dPhysicsRagdollStatic",{"objID"},{1},1,1}, {"isabsolutepath","IsAbsolutePath",{"szPath"},{3},1,1}, {"iscapturingimage","IsCapturingImage",{},{},1,0}, @@ -1215,6 +1219,7 @@ static const sAGKCommand agk_commands[] = { {"kicknetworkclient","KickNetworkClient",{"iNetID","client"},{1,1},0,2}, {"left","Left",{"strin","count"},{3,1},3,2}, {"len","Len",{"strin"},{3},1,1}, + {"lerp","Lerp",{"a","b","c"},{2,2,2},2,3}, {"loadconsentstatusadmob","LoadConsentStatusAdMob",{"szPubID","privacyPolicy"},{3,3},0,2}, {"loadfont","LoadFont",{"szFontFile"},{3},1,1}, {"loadfont","LoadFont",{"iFontID","szFontFile"},{1,3},0,2}, @@ -1263,9 +1268,12 @@ static const sAGKCommand agk_commands[] = { {"makecolor","MakeColor",{"red","green","blue"},{1,1,1},1,3}, {"makecolor","MakeColor",{"red","green","blue","alpha"},{1,1,1,1},1,4}, {"makefolder","MakeFolder",{"szName"},{3},1,1}, + {"map","Map",{"a","b","c","d","e"},{2,2,2,2,2},2,5}, + {"max","Max",{"a","b"},{2,2},2,2}, {"maximizewindow","MaximizeWindow",{},{},0,0}, {"message","Message",{"msg"},{3},0,1}, {"mid","Mid",{"strin","position","length"},{3,1,1},3,3}, + {"min","Min",{"a","b"},{2,2},2,2}, {"minimizeapp","MinimizeApp",{},{},0,0}, {"mod","Mod",{"a","b"},{1,1},1,2}, {"move3dphysicscharactercontroller","Move3DPhysicsCharacterController",{"objID","direction","velocity"},{1,1,2},0,3}, @@ -2031,6 +2039,7 @@ static const sAGKCommand agk_commands[] = { {"showimagecapturescreen","ShowImageCaptureScreen",{},{},1,0}, {"showrewardadadmob","ShowRewardAdAdMob",{},{},0,0}, {"showrewardadchartboost","ShowRewardAdChartboost",{},{},0,0}, + {"sign","Sign",{"a"},{2},1,1}, {"simplifypath","SimplifyPath",{"szPath"},{3},3,1}, {"sin","Sin",{"a"},{2},2,1}, {"sinrad","SinRad",{"a"},{2},2,1}, @@ -2122,6 +2131,8 @@ static const sAGKCommand agk_commands[] = { {"viewfile","ViewFile",{"szFilename"},{3},0,1}, {"worldtoscreenx","WorldToScreenX",{"x"},{2},2,1}, {"worldtoscreeny","WorldToScreenY",{"y"},{2},2,1}, + {"wrap","Wrap",{"a","b","c"},{2,2,2},2,3}, + {"wrapangle","WrapAngle",{"a"},{2},2,1}, {"writebyte","WriteByte",{"iFileID","b"},{1,1},0,2}, {"writefloat","WriteFloat",{"iFileID","f"},{1,2},0,2}, {"writeinteger","WriteInteger",{"iFileID","i"},{1,1},0,2}, diff --git a/AGK/apps/interpreter/AGKCommandEnums.h b/AGK/apps/interpreter/AGKCommandEnums.h index 940c60e4..6fee3d92 100644 --- a/AGK/apps/interpreter/AGKCommandEnums.h +++ b/AGK/apps/interpreter/AGKCommandEnums.h @@ -2120,6 +2120,17 @@ AGKI_ISPINAPPAVAILABLE_L_0,\ AGKI_PINAPP_0_L,\ AGKI_ISDARKTHEME_L_0,\ - AGKI_GETINAPPPURCHASEISRENEWING_L_L + AGKI_GETINAPPPURCHASEISRENEWING_L_L,\ + AGKI_LERP_F_F_F_F,\ + AGKI_INVERSELERP_F_F_F_F,\ + AGKI_MAP_F_F_F_F_F_F,\ + AGKI_CLAMP_F_F_F_F,\ + AGKI_MIN_F_F_F,\ + AGKI_MAX_F_F_F,\ + AGKI_WRAP_F_F_F_F,\ + AGKI_SIGN_L_F,\ + AGKI_WRAPANGLE_F_F,\ + AGKI_CURVEVALUE_F_F_F_F,\ + AGKI_CURVEANGLE_F_F_F_F #endif \ No newline at end of file diff --git a/AGK/apps/interpreter/AGKCommandSwitch.h b/AGK/apps/interpreter/AGKCommandSwitch.h index b3cdf975..2a87daa0 100644 --- a/AGK/apps/interpreter/AGKCommandSwitch.h +++ b/AGK/apps/interpreter/AGKCommandSwitch.h @@ -14576,5 +14576,89 @@ case AGKI_GETINAPPPURCHASEISRENEWING_L_L: m_pStack[ m_iStackPtr++ ].i = agk::GetInAppPurchaseIsRenewing( param0 ); break; } +case AGKI_LERP_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Lerp( param0, param1, param2 ); + break; +} +case AGKI_INVERSELERP_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::InverseLerp( param0, param1, param2 ); + break; +} +case AGKI_MAP_F_F_F_F_F_F: +{ + float param4 = m_pStack[ --m_iStackPtr ].f; + float param3 = m_pStack[ --m_iStackPtr ].f; + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Map( param0, param1, param2, param3, param4 ); + break; +} +case AGKI_CLAMP_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Clamp( param0, param1, param2 ); + break; +} +case AGKI_MIN_F_F_F: +{ + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Min( param0, param1 ); + break; +} +case AGKI_MAX_F_F_F: +{ + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Max( param0, param1 ); + break; +} +case AGKI_WRAP_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Wrap( param0, param1, param2 ); + break; +} +case AGKI_SIGN_L_F: +{ + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].i = agk::Sign( param0 ); + break; +} +case AGKI_WRAPANGLE_F_F: +{ + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::WrapAngle( param0 ); + break; +} +case AGKI_CURVEVALUE_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::CurveValue( param0, param1, param2 ); + break; +} +case AGKI_CURVEANGLE_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::CurveAngle( param0, param1, param2 ); + break; +} diff --git a/AGK/apps/interpreter/AGKCommandSwitch2D.h b/AGK/apps/interpreter/AGKCommandSwitch2D.h index 36fe5c01..383edb12 100644 --- a/AGK/apps/interpreter/AGKCommandSwitch2D.h +++ b/AGK/apps/interpreter/AGKCommandSwitch2D.h @@ -10786,3 +10786,87 @@ case AGKI_GETINAPPPURCHASEISRENEWING_L_L: m_pStack[ m_iStackPtr++ ].i = agk::GetInAppPurchaseIsRenewing( param0 ); break; } +case AGKI_LERP_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Lerp( param0, param1, param2 ); + break; +} +case AGKI_INVERSELERP_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::InverseLerp( param0, param1, param2 ); + break; +} +case AGKI_MAP_F_F_F_F_F_F: +{ + float param4 = m_pStack[ --m_iStackPtr ].f; + float param3 = m_pStack[ --m_iStackPtr ].f; + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Map( param0, param1, param2, param3, param4 ); + break; +} +case AGKI_CLAMP_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Clamp( param0, param1, param2 ); + break; +} +case AGKI_MIN_F_F_F: +{ + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Min( param0, param1 ); + break; +} +case AGKI_MAX_F_F_F: +{ + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Max( param0, param1 ); + break; +} +case AGKI_WRAP_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::Wrap( param0, param1, param2 ); + break; +} +case AGKI_SIGN_L_F: +{ + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].i = agk::Sign( param0 ); + break; +} +case AGKI_WRAPANGLE_F_F: +{ + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::WrapAngle( param0 ); + break; +} +case AGKI_CURVEVALUE_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::CurveValue( param0, param1, param2 ); + break; +} +case AGKI_CURVEANGLE_F_F_F_F: +{ + float param2 = m_pStack[ --m_iStackPtr ].f; + float param1 = m_pStack[ --m_iStackPtr ].f; + float param0 = m_pStack[ --m_iStackPtr ].f; + m_pStack[ m_iStackPtr++ ].f = agk::CurveAngle( param0, param1, param2 ); + break; +} diff --git a/AGK/apps/interpreter/AGKPluginCommandList.h b/AGK/apps/interpreter/AGKPluginCommandList.h index 4b0820e2..9ffbe662 100644 --- a/AGK/apps/interpreter/AGKPluginCommandList.h +++ b/AGK/apps/interpreter/AGKPluginCommandList.h @@ -9,7 +9,7 @@ struct AGKPluginFunction AGKVoidFunc pFunc; }; -int g_iNumAGKFunctions = 2133; +int g_iNumAGKFunctions = 2144; AGKPluginFunction g_ppAGKFunctionList[] = { {"ABS_F_F", (AGKVoidFunc) (float(*)(float)) (agk::Abs) }, {"ACOSRAD_F_F", (AGKVoidFunc) (float(*)(float)) (agk::ACosRad) }, @@ -105,6 +105,7 @@ AGKPluginFunction g_ppAGKFunctionList[] = { {"CHOOSERAWFILE_S_S", (AGKVoidFunc) (char*(*)(const char*)) (agk::ChooseRawFile) }, {"CHOOSERAWFILE_S_S_L", (AGKVoidFunc) (char*(*)(const char*,int)) (agk::ChooseRawFile) }, {"CHR_S_L", (AGKVoidFunc) (char*(*)(UINT)) (agk::Chr) }, + {"CLAMP_F_F_F_F", (AGKVoidFunc) (float(*)(float,float,float)) (agk::Clamp) }, {"CLEAR3DPARTICLESCOLORS_0_L", (AGKVoidFunc) (void(*)(UINT)) (agk::Clear3DParticlesColors) }, {"CLEAR3DPARTICLESFORCES_0_L", (AGKVoidFunc) (void(*)(UINT)) (agk::Clear3DParticlesForces) }, {"CLEAR3DPARTICLESSCALES_0_L", (AGKVoidFunc) (void(*)(UINT)) (agk::Clear3DParticlesScales) }, @@ -274,6 +275,8 @@ AGKPluginFunction g_ppAGKFunctionList[] = { {"CREATEZIP_0_L_S", (AGKVoidFunc) (void(*)(UINT,const char*)) (agk::CreateZip) }, {"CREATEZIP_L_S", (AGKVoidFunc) (UINT(*)(const char*)) (agk::CreateZip) }, {"CROUCH3DPHYSICSCHARACTERCONTROLLER_0_L", (AGKVoidFunc) (void(*)(UINT)) (agk::Crouch3DPhysicsCharacterController) }, + {"CURVEANGLE_F_F_F_F", (AGKVoidFunc) (float(*)(float,float,float)) (agk::CurveAngle) }, + {"CURVEVALUE_F_F_F_F", (AGKVoidFunc) (float(*)(float,float,float)) (agk::CurveValue) }, {"DEBUG3DPHYSICSCHARACTERCONTROLLER_0_L_L", (AGKVoidFunc) (void(*)(UINT,int)) (agk::Debug3DPhysicsCharacterController) }, {"DEBUG3DPHYSICSWORLD_0_0", (AGKVoidFunc) (void(*)()) (agk::Debug3DPhysicsWorld) }, {"DECODEQRCODE_S_L", (AGKVoidFunc) (char*(*)(UINT)) (agk::DecodeQRCode) }, @@ -1208,6 +1211,7 @@ AGKPluginFunction g_ppAGKFunctionList[] = { {"INAPPPURCHASESETUP_0_0", (AGKVoidFunc) (void(*)()) (agk::InAppPurchaseSetup) }, {"INSTANCEOBJECT_0_L_L", (AGKVoidFunc) (void(*)(UINT,UINT)) (agk::InstanceObject) }, {"INSTANCEOBJECT_L_L", (AGKVoidFunc) (UINT(*)(UINT)) (agk::InstanceObject) }, + {"INVERSELERP_F_F_F_F", (AGKVoidFunc) (float(*)(float,float,float)) (agk::InverseLerp) }, {"IS3DPHYSICSRAGDOLLSTATIC_L_L", (AGKVoidFunc) (int(*)(UINT)) (agk::Is3dPhysicsRagdollStatic) }, {"ISABSOLUTEPATH_L_S", (AGKVoidFunc) (int(*)(const char *)) (agk::IsAbsolutePath) }, {"ISCAPTURINGIMAGE_L_0", (AGKVoidFunc) (UINT(*)()) (agk::IsCapturingImage) }, @@ -1228,6 +1232,7 @@ AGKPluginFunction g_ppAGKFunctionList[] = { {"KICKNETWORKCLIENT_0_L_L", (AGKVoidFunc) (void(*)(UINT,UINT)) (agk::KickNetworkClient) }, {"LEFT_S_S_L", (AGKVoidFunc) (char*(*)(const char*,UINT)) (agk::Left) }, {"LEN_L_S", (AGKVoidFunc) (UINT(*)(const char*)) (agk::Len) }, + {"LERP_F_F_F_F", (AGKVoidFunc) (float(*)(float,float,float)) (agk::Lerp) }, {"LOADCONSENTSTATUSADMOB_0_S_S", (AGKVoidFunc) (void(*)(const char*,const char*)) (agk::LoadConsentStatusAdMob) }, {"LOADFONT_0_L_S", (AGKVoidFunc) (void(*)(UINT,const char *)) (agk::LoadFont) }, {"LOADFONT_L_S", (AGKVoidFunc) (UINT(*)(const char *)) (agk::LoadFont) }, @@ -1276,10 +1281,13 @@ AGKPluginFunction g_ppAGKFunctionList[] = { {"MAKECOLOR_L_L_L_L", (AGKVoidFunc) (UINT(*)(UINT,UINT,UINT)) (agk::MakeColor) }, {"MAKECOLOR_L_L_L_L_L", (AGKVoidFunc) (uint32_t(*)(uint32_t,uint32_t,uint32_t,uint32_t)) (agk::MakeColor) }, {"MAKEFOLDER_L_S", (AGKVoidFunc) (int(*)(const char*)) (agk::MakeFolder) }, + {"MAP_F_F_F_F_F_F", (AGKVoidFunc) (float(*)(float,float,float,float,float)) (agk::Map) }, {"MAXIMIZEWINDOW_0_0", (AGKVoidFunc) (void(*)()) (agk::MaximizeWindow) }, + {"MAX_F_F_F", (AGKVoidFunc) (float(*)(float,float)) (agk::Max) }, {"MESSAGE_0_S", (AGKVoidFunc) (void(*)(const char*)) (agk::Message) }, {"MID_S_S_L_L", (AGKVoidFunc) (char*(*)(const char*,UINT,int)) (agk::Mid) }, {"MINIMIZEAPP_0_0", (AGKVoidFunc) (void(*)()) (agk::MinimizeApp) }, + {"MIN_F_F_F", (AGKVoidFunc) (float(*)(float,float)) (agk::Min) }, {"MOD_L_L_L", (AGKVoidFunc) (int(*)(int,int)) (agk::Mod) }, {"MOVE3DPHYSICSCHARACTERCONTROLLER_0_L_F_F_F", (AGKVoidFunc) (void(*)(UINT,float,float,float)) (agk::Move3DPhysicsCharacterController) }, {"MOVE3DPHYSICSCHARACTERCONTROLLER_0_L_L_F", (AGKVoidFunc) (void(*)(UINT,int,float)) (agk::Move3DPhysicsCharacterController) }, @@ -2047,6 +2055,7 @@ AGKPluginFunction g_ppAGKFunctionList[] = { {"SHOWIMAGECAPTURESCREEN_L_0", (AGKVoidFunc) (UINT(*)()) (agk::ShowImageCaptureScreen) }, {"SHOWREWARDADADMOB_0_0", (AGKVoidFunc) (void(*)()) (agk::ShowRewardAdAdMob) }, {"SHOWREWARDADCHARTBOOST_0_0", (AGKVoidFunc) (void(*)()) (agk::ShowRewardAdChartboost) }, + {"SIGN_L_F", (AGKVoidFunc) (int(*)(float)) (agk::Sign) }, {"SIMPLIFYPATH_S_S", (AGKVoidFunc) (char*(*)(const char *)) (agk::SimplifyPath) }, {"SINRAD_F_F", (AGKVoidFunc) (float(*)(float)) (agk::SinRad) }, {"SIN_F_F", (AGKVoidFunc) (float(*)(float)) (agk::Sin) }, @@ -2138,6 +2147,8 @@ AGKPluginFunction g_ppAGKFunctionList[] = { {"VIEWFILE_0_S", (AGKVoidFunc) (void(*)(const char*)) (agk::ViewFile) }, {"WORLDTOSCREENX_F_F", (AGKVoidFunc) (float(*)(float)) (agk::WorldToScreenX) }, {"WORLDTOSCREENY_F_F", (AGKVoidFunc) (float(*)(float)) (agk::WorldToScreenY) }, + {"WRAPANGLE_F_F", (AGKVoidFunc) (float(*)(float)) (agk::WrapAngle) }, + {"WRAP_F_F_F_F", (AGKVoidFunc) (float(*)(float,float,float)) (agk::Wrap) }, {"WRITEBYTE_0_L_L", (AGKVoidFunc) (void(*)(UINT,int)) (agk::WriteByte) }, {"WRITEFLOAT_0_L_F", (AGKVoidFunc) (void(*)(UINT,float)) (agk::WriteFloat) }, {"WRITEINTEGER_0_L_L", (AGKVoidFunc) (void(*)(UINT,int)) (agk::WriteInteger) }, diff --git a/AGK/common/Source/Wrapper.cpp b/AGK/common/Source/Wrapper.cpp index 973ad6d6..3ab4dbd4 100644 --- a/AGK/common/Source/Wrapper.cpp +++ b/AGK/common/Source/Wrapper.cpp @@ -5895,16 +5895,184 @@ float agk::Pow( float a, float b ) return pow( a, b ); } +//****f* Core/Maths/Lerp +// FUNCTION +// Linearly interpolates between b and c by the fraction a. +// INPUTS +// a -- The interpolation factor (typically between 0 and 1). +// b -- The starting value. +// c -- The ending value. +// SOURCE +float agk::Lerp(float a, float b, float c) +//**** +{ + return b + a * (c - b); +} + +//****f* Core/Maths/InverseLerp +// FUNCTION +// Calculates the interpolation factor (a) given the values b and c, and a value a. +// INPUTS +// a -- The value to be normalized between b and c. +// b -- The starting value. +// c -- The ending value. +// SOURCE +float agk::InverseLerp(float a, float b, float c) +//**** +{ + return (a - b) / (c - b); +} + +//****f* Core/Maths/Map +// FUNCTION +// Maps a value from one range to another. +// INPUTS +// a -- The value to be mapped. +// b -- The minimum value of the input range. +// c -- The maximum value of the input range. +// d -- The minimum value of the output range. +// e -- The maximum value of the output range. +// SOURCE +float agk::Map(float a, float b, float c, float d, float e) +//**** +{ + float time = agk::InverseLerp(a, b, c); + return agk::Lerp(time, d, e); +} + +//****f* Core/Maths/Clamp +// FUNCTION +// Clamps a value between a minimum and maximum range. +// INPUTS +// a -- The value to be clamped. +// b -- The minimum value of the range. +// c -- The maximum value of the range. +// SOURCE +float agk::Clamp(float a, float b, float c) +//**** +{ + if (a < b) return b; + if (a > c) return c; + return a; +} + + +//****f* Core/Maths/Min +// FUNCTION +// Returns the minimum of two values. +// INPUTS +// a -- The first value. +// b -- The second value. +// SOURCE +float agk::Min(float a, float b) +//**** +{ + return fmin(a, b); +} + +//****f* Core/Maths/Max +// FUNCTION +// Returns the maximum of two values. +// INPUTS +// a -- The first value. +// b -- The second value. +// SOURCE +float agk::Max(float a, float b) +//**** +{ + return fmax(a, b); +} + +//****f* Core/Maths/Wrap +// FUNCTION +// Wraps a value within a specified range [min, max). +// INPUTS +// a -- The value to be wrapped. +// b -- The minimum value of the range. +// c -- The maximum value of the range (exclusive). +// SOURCE +float agk::Wrap(float a, float b, float c) +//**** +{ + if (b == c) return b; // If the range is zero, return the minimum value. + float range = c - b; + return b + fmod(fmod(a - b, range) + range, range); +} + +//****f* Core/Maths/WrapAngle +// FUNCTION +// Wraps an angle value within the range of 0 to 360 degrees. +// INPUTS +// a -- The angle value to be wrapped. +// SOURCE +float agk::WrapAngle(float a) +//**** +{ + float remainder = fmod(a, 360.0f); + if (remainder < 0.0f) remainder += 360.0f; + return remainder; +} + +//****f* Core/Maths/Sign +// FUNCTION +// Returns the sign of the value. +// INPUTS +// a -- The value whose sign is to be determined. +// SOURCE +int agk::Sign(float a) +//**** +{ + if (a > 0) return 1; + if (a < 0) return -1; + return 0; +} + +//****f* Core/Maths/CurveValue +// FUNCTION +// Moves a current value towards a destination value at a specified speed. +// INPUTS +// a -- The current value. +// b -- The destination value. +// c -- The speed of movement (number of iterations to reach destination). +// SOURCE +float agk::CurveValue(float a, float b, float c) +//**** +{ + if (c < 1.0f) c = 1.0f; + return a + ((b - a) / c); +} + +//****f* Core/Maths/CurveAngle +// FUNCTION +// Moves a current angle towards a destination angle at a specified angular speed. +// INPUTS +// a -- The current angle (in degrees). +// b -- The destination angle (in degrees). +// c -- The angular speed (number of iterations to reach destination). +// SOURCE +float agk::CurveAngle(float a, float b, float c) +//**** +{ + if (c < 1.0f) c = 1.0f; + float delta = agk::WrapAngle(b - a); + if (delta > 180.0f) { + delta -= 360.0f; + } + float angleToMove = delta / c; + a += angleToMove; + return agk::WrapAngle(a); +} + //****f* Core/Maths/Log // FUNCTION // Returns the natural logarithm of the given value. // INPUTS // a -- The input value // SOURCE -float agk::Log( float a ) +float agk::Log(float a) //**** { - return log( a ); + return log(a); } //****f* Core/Misc/SetSortTextures diff --git a/AGK/common/include/Wrapper.h b/AGK/common/include/Wrapper.h index 3c1649fd..a30e2e86 100644 --- a/AGK/common/include/Wrapper.h +++ b/AGK/common/include/Wrapper.h @@ -981,6 +981,17 @@ namespace AGK static int Mod( int a, int b ); static float FMod( float a, float b ); static float Pow( float a, float b ); + static float Lerp(float a, float b, float c); + static float InverseLerp(float a, float b, float c); + static float Map(float a, float b, float c, float d, float e); + static float Clamp(float a, float b, float c); + static float Min(float a, float b); + static float Max(float a, float b); + static float Wrap(float a, float b, float c); + static float WrapAngle(float a); + static int Sign(float a); + static float CurveValue(float a, float b, float c); + static float CurveAngle(float a, float b, float c); static float Log( float a ); // control functions diff --git a/AGK/plugins/Source/AGKLibraryCommands.cpp b/AGK/plugins/Source/AGKLibraryCommands.cpp index 41751718..7e16f0ea 100644 --- a/AGK/plugins/Source/AGKLibraryCommands.cpp +++ b/AGK/plugins/Source/AGKLibraryCommands.cpp @@ -2133,6 +2133,17 @@ int(*AGKCommand2129)( ) = 0; void(*AGKCommand2130)( int ) = 0; int(*AGKCommand2131)( ) = 0; int(*AGKCommand2132)( int ) = 0; +float(*AGKCommand2133)( float, float, float ) = 0; +float(*AGKCommand2134)( float, float, float ) = 0; +float(*AGKCommand2135)( float, float, float, float, float ) = 0; +float(*AGKCommand2136)( float, float, float ) = 0; +float(*AGKCommand2137)( float, float ) = 0; +float(*AGKCommand2138)( float, float ) = 0; +float(*AGKCommand2139)( float, float, float ) = 0; +int(*AGKCommand2140)( float ) = 0; +float(*AGKCommand2141)( float ) = 0; +float(*AGKCommand2142)( float, float, float ) = 0; +float(*AGKCommand2143)( float, float, float ) = 0; typedef void(*AGKVoidFunc)(void); AGKVoidFunc(*GetAGKFunction)( const char* ) = 0; @@ -4274,4 +4285,15 @@ extern "C" DLL_EXPORT void ReceiveAGKPtr( AGKVoidFunc ptr ) AGKCommand2130 = (void(*)(int)) GetAGKFunction( "PINAPP_0_L" ); AGKCommand2131 = (int(*)()) GetAGKFunction( "ISDARKTHEME_L_0" ); AGKCommand2132 = (int(*)(int)) GetAGKFunction( "GETINAPPPURCHASEISRENEWING_L_L" ); + AGKCommand2133 = (float(*)(float,float,float)) GetAGKFunction( "LERP_F_F_F_F" ); + AGKCommand2134 = (float(*)(float,float,float)) GetAGKFunction( "INVERSELERP_F_F_F_F" ); + AGKCommand2135 = (float(*)(float,float,float,float,float)) GetAGKFunction( "MAP_F_F_F_F_F_F" ); + AGKCommand2136 = (float(*)(float,float,float)) GetAGKFunction( "CLAMP_F_F_F_F" ); + AGKCommand2137 = (float(*)(float,float)) GetAGKFunction( "MIN_F_F_F" ); + AGKCommand2138 = (float(*)(float,float)) GetAGKFunction( "MAX_F_F_F" ); + AGKCommand2139 = (float(*)(float,float,float)) GetAGKFunction( "WRAP_F_F_F_F" ); + AGKCommand2140 = (int(*)(float)) GetAGKFunction( "SIGN_L_F" ); + AGKCommand2141 = (float(*)(float)) GetAGKFunction( "WRAPANGLE_F_F" ); + AGKCommand2142 = (float(*)(float,float,float)) GetAGKFunction( "CURVEVALUE_F_F_F_F" ); + AGKCommand2143 = (float(*)(float,float,float)) GetAGKFunction( "CURVEANGLE_F_F_F_F" ); } diff --git a/AGK/plugins/Source/AGKLibraryCommands.h b/AGK/plugins/Source/AGKLibraryCommands.h index f4719638..4280ad61 100644 --- a/AGK/plugins/Source/AGKLibraryCommands.h +++ b/AGK/plugins/Source/AGKLibraryCommands.h @@ -2144,6 +2144,17 @@ extern int(*AGKCommand2129)( ); extern void(*AGKCommand2130)( int ); extern int(*AGKCommand2131)( ); extern int(*AGKCommand2132)( int ); +extern float(*AGKCommand2133)( float, float, float ); +extern float(*AGKCommand2134)( float, float, float ); +extern float(*AGKCommand2135)( float, float, float, float, float ); +extern float(*AGKCommand2136)( float, float, float ); +extern float(*AGKCommand2137)( float, float ); +extern float(*AGKCommand2138)( float, float ); +extern float(*AGKCommand2139)( float, float, float ); +extern int(*AGKCommand2140)( float ); +extern float(*AGKCommand2141)( float ); +extern float(*AGKCommand2142)( float, float, float ); +extern float(*AGKCommand2143)( float, float, float ); class agk { @@ -4281,6 +4292,17 @@ class agk static inline void PinApp( int enable ) { AGKCommand2130( enable ); } static inline int IsDarkTheme( ) { return AGKCommand2131( ); } static inline int GetInAppPurchaseIsRenewing( int iID ) { return AGKCommand2132( iID ); } + static inline float Lerp( float a, float b, float c ) { return AGKCommand2133( a, b, c ); } + static inline float InverseLerp( float a, float b, float c ) { return AGKCommand2134( a, b, c ); } + static inline float Map( float a, float b, float c, float d, float e ) { return AGKCommand2135( a, b, c, d, e ); } + static inline float Clamp( float a, float b, float c ) { return AGKCommand2136( a, b, c ); } + static inline float Min( float a, float b ) { return AGKCommand2137( a, b ); } + static inline float Max( float a, float b ) { return AGKCommand2138( a, b ); } + static inline float Wrap( float a, float b, float c ) { return AGKCommand2139( a, b, c ); } + static inline int Sign( float a ) { return AGKCommand2140( a ); } + static inline float WrapAngle( float a ) { return AGKCommand2141( a ); } + static inline float CurveValue( float a, float b, float c ) { return AGKCommand2142( a, b, c ); } + static inline float CurveAngle( float a, float b, float c ) { return AGKCommand2143( a, b, c ); } }; #endif diff --git a/AGK_Build/Builds/Studio/AGKStudioWindows/readme.txt b/AGK_Build/Builds/Studio/AGKStudioWindows/readme.txt deleted file mode 100644 index f42713b5..00000000 --- a/AGK_Build/Builds/Studio/AGKStudioWindows/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Empty Folder Until Filled \ No newline at end of file