# HG changeset patch # User unc0rr # Date 1459278553 -10800 # Node ID 215b837c16f976a21a509f0bb592b1315ffc6432 # Parent f0dcdbb9b2fef96188c5d90547b12201228ce878# Parent cac74d9075be01a22c074b4f46f7bed6dbf352e2 merge default diff -r f0dcdbb9b2fe -r 215b837c16f9 QTfrontend/ui/page/pagedata.cpp --- a/QTfrontend/ui/page/pagedata.cpp Tue Mar 15 22:29:40 2016 +0300 +++ b/QTfrontend/ui/page/pagedata.cpp Tue Mar 29 22:09:13 2016 +0300 @@ -85,7 +85,7 @@ { QUrl finalUrl; if(url.host().isEmpty()) - finalUrl = QUrl("http://www.hedgewars.org" + url.path()); + finalUrl = QUrl("https://www.hedgewars.org" + url.path()); else finalUrl = url; @@ -195,7 +195,7 @@ void PageDataDownload::fetchList() { - request(QUrl("http://hedgewars.org/content.html")); + request(QUrl("https://hedgewars.org/content.html")); } diff -r f0dcdbb9b2fe -r 215b837c16f9 QTfrontend/ui/widget/feedbackdialog.cpp --- a/QTfrontend/ui/widget/feedbackdialog.cpp Tue Mar 15 22:29:40 2016 +0300 +++ b/QTfrontend/ui/widget/feedbackdialog.cpp Tue Mar 29 22:09:13 2016 +0300 @@ -85,7 +85,7 @@ "" "

%1

" "

%2

" - "

%3 known bugs

" + "

%3 known bugs

" "

%4

" "

") .arg(tr("Send us feedback!")) @@ -387,7 +387,7 @@ return; } - QString url = "http://hedgewars.org/feedback/?captcha&id="; + QString url = "https://hedgewars.org/feedback/?captcha&id="; url += QString::number(captchaID); QNetworkAccessManager *netManager = GetNetManager(); @@ -423,7 +423,7 @@ void FeedbackDialog::LoadCaptchaImage() { QNetworkAccessManager *netManager = GetNetManager(); - QUrl captchaURL("http://hedgewars.org/feedback/?gencaptcha"); + QUrl captchaURL("https://hedgewars.org/feedback/?gencaptcha"); QNetworkRequest req(captchaURL); genCaptchaRequest = netManager->get(req); } @@ -493,7 +493,7 @@ connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(finishedSlot(QNetworkReply*))); - QNetworkRequest header(QUrl("http://hedgewars.org/feedback/?submit")); + QNetworkRequest header(QUrl("https://hedgewars.org/feedback/?submit")); header.setRawHeader("Content-Length", QString::number(body.size()).toAscii()); header.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); diff -r f0dcdbb9b2fe -r 215b837c16f9 hedgewars/avwrapper/avwrapper.c --- a/hedgewars/avwrapper/avwrapper.c Tue Mar 15 22:29:40 2016 +0300 +++ b/hedgewars/avwrapper/avwrapper.c Tue Mar 29 22:09:13 2016 +0300 @@ -63,9 +63,19 @@ #define avcodec_open2(x, y, z) avcodec_open(x, y) #endif +#if LIBAVCODEC_VERSION_MAJOR < 55 +#define avcodec_default_get_buffer2(x, y ,z) avcodec_default_get_buffer(x, y) +#endif + #if LIBAVCODEC_VERSION_MAJOR < 56 +#if LIBAVCODEC_VERSION_MAJOR < 55 +#define av_frame_free av_freep +#else +#define av_frame_free avcodec_free_frame +#endif + #define av_frame_alloc avcodec_alloc_frame -#define av_frame_free av_freep +#define av_frame_unref avcodec_get_frame_defaults #define av_packet_rescale_ts rescale_ts static void rescale_ts(AVPacket *pkt, AVRational ctb, AVRational stb) @@ -333,15 +343,13 @@ g_pVFrame = av_frame_alloc(); if (!g_pVFrame) return FatalError("Could not allocate frame"); + av_frame_unref(g_pVFrame); g_pVFrame->width = g_Width; g_pVFrame->height = g_Height; g_pVFrame->format = AV_PIX_FMT_YUV420P; - g_pVFrame->linesize[0] = g_Width; - g_pVFrame->linesize[1] = g_Width/2; - g_pVFrame->linesize[2] = g_Width/2; - g_pVFrame->linesize[3] = 0; - return 0; + + return avcodec_default_get_buffer2(g_pVideo, g_pVFrame, 0); } static int WriteFrame(AVFrame* pFrame) @@ -418,11 +426,47 @@ } } -AVWRAP_DECL int AVWrapper_WriteFrame(uint8_t* pY, uint8_t* pCb, uint8_t* pCr) +AVWRAP_DECL int AVWrapper_WriteFrame(uint8_t *buf) { - g_pVFrame->data[0] = pY; - g_pVFrame->data[1] = pCb; - g_pVFrame->data[2] = pCr; + int x, y, stride = g_Width * 4; + uint8_t *data[3]; + + // copy pointers, prepare source + memcpy(data, g_pVFrame->data, sizeof(data)); + buf += (g_Height - 1) * stride; + + // convert to YUV 4:2:0 + for (y = 0; y < g_Height; y++) { + for (x = 0; x < g_Width; x++) { + int r = buf[x * 4 + 0]; + int g = buf[x * 4 + 1]; + int b = buf[x * 4 + 2]; + + int luma = (int)(0.299f * r + 0.587f * g + 0.114f * b); + data[0][x] = av_clip_uint8(luma); + + if (!(x & 1) && !(y & 1)) { + int r = (buf[x * 4 + 0] + buf[(x + 1) * 4 + 0] + + buf[x * 4 + 0 + stride] + buf[(x + 1) * 4 + 0 + stride]) / 4; + int g = (buf[x * 4 + 1] + buf[(x + 1) * 4 + 1] + + buf[x * 4 + 1 + stride] + buf[(x + 1) * 4 + 1 + stride]) / 4; + int b = (buf[x * 4 + 2] + buf[(x + 1) * 4 + 2] + + buf[x * 4 + 2 + stride] + buf[(x + 1) * 4 + 2 + stride]) / 4; + + int cr = (int)(-0.14713f * r - 0.28886f * g + 0.436f * b); + int cb = (int)( 0.615f * r - 0.51499f * g - 0.10001f * b); + data[1][x / 2] = av_clip_uint8(128 + cr); + data[2][x / 2] = av_clip_uint8(128 + cb); + } + } + buf += -stride; + data[0] += g_pVFrame->linesize[0]; + if (y & 1) { + data[1] += g_pVFrame->linesize[1]; + data[2] += g_pVFrame->linesize[2]; + } + } + return WriteFrame(g_pVFrame); } diff -r f0dcdbb9b2fe -r 215b837c16f9 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Tue Mar 15 22:29:40 2016 +0300 +++ b/hedgewars/hwengine.pas Tue Mar 29 22:09:13 2016 +0300 @@ -454,6 +454,7 @@ uLand.initModule; // computes land uLandPainted.initModule; // computes drawn land uIO.initModule; // sets up sockets + uScript.initModule; uTeams.initModule; // clear CurrentTeam variable diff -r f0dcdbb9b2fe -r 215b837c16f9 hedgewars/uAI.pas --- a/hedgewars/uAI.pas Tue Mar 15 22:29:40 2016 +0300 +++ b/hedgewars/uAI.pas Tue Mar 29 22:09:13 2016 +0300 @@ -163,6 +163,12 @@ AddAction(BestActions, aia_attack, aim_push, 10, 0, 0); AddAction(BestActions, aia_attack, aim_release, 10, 0, 0); end; + if HHHasAmmo(Me^.Hedgehog^, amVampiric) > 0 then + begin + AddAction(BestActions, aia_Weapon, Longword(amVampiric), 80, 0, 0); + AddAction(BestActions, aia_attack, aim_push, 10, 0, 0); + AddAction(BestActions, aia_attack, aim_release, 10, 0, 0); + end; end; AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0); diff -r f0dcdbb9b2fe -r 215b837c16f9 hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Tue Mar 15 22:29:40 2016 +0300 +++ b/hedgewars/uGearsHedgehog.pas Tue Mar 29 22:09:13 2016 +0300 @@ -685,6 +685,8 @@ vga: PVisualGear; ag, gi: PGear; begin +if Gear^.State and gstFrozen <> 0 then exit; + Gear^.Message:= gmDestroy; if (Gear^.Pos and posCaseExplode) <> 0 then if (Gear^.Pos and posCasePoison) <> 0 then @@ -1253,7 +1255,7 @@ HHGear^.Message:= HHGear^.Message or gmAttack; // check for case with ammo t:= CheckGearNear(HHGear, gtCase, 36, 36); - if (t <> nil) and (t^.State and gstFrozen = 0) then + if (t <> nil) then PickUp(HHGear, t) end; diff -r f0dcdbb9b2fe -r 215b837c16f9 hedgewars/uPhysFSLayer.pas --- a/hedgewars/uPhysFSLayer.pas Tue Mar 15 22:29:40 2016 +0300 +++ b/hedgewars/uPhysFSLayer.pas Tue Mar 29 22:09:13 2016 +0300 @@ -219,7 +219,7 @@ begin fp := cFontsPaths[i]; if fp <> nil then - pfsMount(ansistring(fp), PChar('/Fonts')); + pfsMount(ansistring(fp), _P'/Fonts'); end; {$ENDIF} diff -r f0dcdbb9b2fe -r 215b837c16f9 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Tue Mar 15 22:29:40 2016 +0300 +++ b/hedgewars/uScript.pas Tue Mar 29 22:09:13 2016 +0300 @@ -2603,7 +2603,7 @@ case lua_tointeger(L, 1) of HaltTestSuccess : rstring:= 'Success'; - HaltTestLuaError: rstring:= 'FAILED'; + HaltTestFailed: rstring:= 'FAILED'; else begin LuaCallError('Parameter must be either ' + params, call, params); diff -r f0dcdbb9b2fe -r 215b837c16f9 hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Tue Mar 15 22:29:40 2016 +0300 +++ b/hedgewars/uUtils.pas Tue Mar 29 22:09:13 2016 +0300 @@ -535,7 +535,6 @@ {$IFDEF USE_VIDEO_RECORDING} InitCriticalSection(logMutex); {$ENDIF} -{$I-} // if log is locked, write to the next one i:= 0; while(i < 7) do @@ -545,7 +544,6 @@ break; inc(i) end; -{$I+} {$ENDIF} //mobile stuff diff -r f0dcdbb9b2fe -r 215b837c16f9 hedgewars/uVideoRec.pas --- a/hedgewars/uVideoRec.pas Tue Mar 15 22:29:40 2016 +0300 +++ b/hedgewars/uVideoRec.pas Tue Mar 29 22:09:13 2016 +0300 @@ -58,7 +58,7 @@ filename, desc, soundFile, format, vcodec, acodec: PChar; width, height, framerateNum, framerateDen, vquality: LongInt): LongInt; cdecl; external AvwrapperLibName; function AVWrapper_Close: LongInt; cdecl; external AvwrapperLibName; -function AVWrapper_WriteFrame( pY, pCb, pCr: PByte ): LongInt; cdecl; external AvwrapperLibName; +function AVWrapper_WriteFrame(rgb: PByte): LongInt; cdecl; external AvwrapperLibName; type TFrame = record realTicks: LongWord; @@ -121,15 +121,6 @@ true) then exit(false); numPixels:= cScreenWidth*cScreenHeight; - YCbCr_Planes[0]:= GetMem(numPixels); - YCbCr_Planes[1]:= GetMem(numPixels div 4); - YCbCr_Planes[2]:= GetMem(numPixels div 4); - - if (YCbCr_Planes[0] = nil) or (YCbCr_Planes[1] = nil) or (YCbCr_Planes[2] = nil) then - begin - AddFileLog('Error: Could not allocate memory for video recording (YCbCr buffer).'); - exit(false); - end; RGB_Buffer:= GetMem(4*numPixels); if RGB_Buffer = nil then @@ -147,9 +138,6 @@ procedure StopVideoRecording; begin AddFileLog('StopVideoRecording'); - FreeMem(YCbCr_Planes[0], numPixels); - FreeMem(YCbCr_Planes[1], numPixels div 4); - FreeMem(YCbCr_Planes[2], numPixels div 4); FreeMem(RGB_Buffer, 4*numPixels); Close(cameraFile); if AVWrapper_Close() < 0 then @@ -159,36 +147,13 @@ SendIPC(_S'v'); // inform frontend that we finished end; -function pixel(x, y, color: LongInt): LongInt; -begin - pixel:= RGB_Buffer[(cScreenHeight-y-1)*cScreenWidth*4 + x*4 + color]; -end; - procedure EncodeFrame; -var x, y, r, g, b: LongInt; - s: shortstring; +var s: shortstring; begin // read pixels from OpenGL glReadPixels(0, 0, cScreenWidth, cScreenHeight, GL_RGBA, GL_UNSIGNED_BYTE, RGB_Buffer); - // convert to YCbCr 4:2:0 format - // Y - for y := 0 to cScreenHeight-1 do - for x := 0 to cScreenWidth-1 do - YCbCr_Planes[0][y*cScreenWidth + x]:= Byte(16 + ((16828*pixel(x,y,0) + 33038*pixel(x,y,1) + 6416*pixel(x,y,2)) shr 16)); - - // Cb and Cr - for y := 0 to cScreenHeight div 2 - 1 do - for x := 0 to cScreenWidth div 2 - 1 do - begin - r:= pixel(2*x,2*y,0) + pixel(2*x+1,2*y,0) + pixel(2*x,2*y+1,0) + pixel(2*x+1,2*y+1,0); - g:= pixel(2*x,2*y,1) + pixel(2*x+1,2*y,1) + pixel(2*x,2*y+1,1) + pixel(2*x+1,2*y+1,1); - b:= pixel(2*x,2*y,2) + pixel(2*x+1,2*y,2) + pixel(2*x,2*y+1,2) + pixel(2*x+1,2*y+1,2); - YCbCr_Planes[1][y*(cScreenWidth div 2) + x]:= Byte(128 + ((-2428*r - 4768*g + 7196*b) shr 16)); - YCbCr_Planes[2][y*(cScreenWidth div 2) + x]:= Byte(128 + (( 7196*r - 6026*g - 1170*b) shr 16)); - end; - - if AVWrapper_WriteFrame(YCbCr_Planes[0], YCbCr_Planes[1], YCbCr_Planes[2]) < 0 then + if AVWrapper_WriteFrame(RGB_Buffer) < 0 then halt(-1); // inform frontend that we have encoded new frame diff -r f0dcdbb9b2fe -r 215b837c16f9 misc/OfficialChallenges/racer_#20.hwmap --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/OfficialChallenges/racer_#20.hwmap Tue Mar 29 22:09:13 2016 +0300 @@ -0,0 +1,1 @@ +AAAG73icPdR7bBRFHAfw79zM/Gb3XntQyqNBSAVFm2qlAp4RUDRtA5FCiKASmwaMREs0hIeBIAp4lROKAmLkJWCiRAkGwhlQQ4xajr4o1xY4aGl4GKGPAIZTuFSw6+y2xz+ffH/fmdub3WTXXIHlMIfxNHwpOQGilQ+DWab2A5XYFEOlugmrxwWb3A7BTkWxYKdnOliLiyK3A88X4RjPl70IchcRdjvYt1GZ1FxF6ME+Kt0OVpr9lXSAXZzBHREU05MOCI3J4I4YSOGkA0JDMrgjRqiapIPenMEdrR9UQ9IBvXcyuCObouqSeqwD3tBJcw72F330dcDT+rf2aL2Z6lUq6QBMzuCOVovqSVotxnr0o3r6CAUNT9IB9qsZ3DHkUTtPaA7BKu9jp9vpO1dbTmhWIjSwjy1uB+u2WnvCAcbEDO6Ix9XKEw6wCzK4I55Ti+P2x2o1MNVJL6nFwEWqittTqQrYJK/H7S3yul6VHXH7O9kBPHo/jZfdcfuw7AaznO4xp3tNXo3bG+VVsFUUjdvPUxSoEmWneheKMlgpMa211xTTgGKdBoR1srpYqrV3IdPPqkynAWGdrGbKa/1vBuXpTqcBYZ0MIBUzYBxAP0j1k8UKYkaWvQj9sIJ+JJsWM6T9OWgFK75BC1jBTbOMpdtprZgEMyzC7f4c+Qe8Sylvl5F0/uOILN7lS9Fu+IO0bmtgOKURWKqqz/pzVTWoi/ISBmQWHHRSf8IwVXWCgnrVN1zUJgJhAgIzqCxhJIU+y12Rd9EcIgqumMPFlGuaaftMiEn7zCliyD6zkR/YbjbKHfCu4M3bvStkF7yDqOK0dxA39XPh5mn7XZ3EZU/PNiriIVA2r9hMP3sug857OjaorZ6ZMLNYxQbK55thrmITNxifsCMQZ3jOBf9I+XIi0C1K4Tsv6hKBOOXCHxDHO+R7rGCHr0i2NfmKqByBES6yDU4HXwnNbvKVyBL0Q7PvM1cviNHOrTrQXLeD96gYEPGN5/vh/ZXmRXyvUzO8PbQn4sumg/CmaRu8N2kffNfkU3s145I+JQvrfNWyEOIRZFexTthVZo7wNpk59CHMobSmyStojU4i55x+aprBDjl9aehGc6TI+dRZ+NTZouHttTplwczlnbVmrk5qsDgcpSHiDrgU6SivFHvgEBUPiDTESL4/Ki6IwXCIyt/5JohG3h4VN3gbREqDK3xXlG0WDA5Rz3y+DWwNr42yr3gt2PcaeZr/W0tTxTCwDyh/Nx2hfLBRcmYjG0VtTprVqL6Ws8DuyMURzT14ItIT0UzWp5LHIp57chl4tfgnwg/JZyDelr9ERFh3coQUEZGSRZClMhaRa+VbkH/rq1BYHgV1i3SEfpRPQAl5IKK+lGehIvJmRC0iBTWHRkE9S36oYv3qqgX6vdSpHepheQ7KkqfBFlDbSZZ0DnmJzic8hdRW69lL51s8vdR8is+j5gb+Da1pFEQzGsQceqVetNBnZ2QJ/dYgY7TnFDF6s4Eq6IUENdKSk8qib+tVGS2vV+U0tkaVy1t1aqU8VkOX1Moa9ZP+0qhVomudUSS6YCxTa9cZy4xCGKUytM4oNYKwLK5aQmO4gnVcE7zLg86oF8q56ST9Qoy7v2X0/bSaSydJ+JP0YkugkB6Cv4HKGwLz6RaC2TQZ/o/4O+uDSzyH1ls9LK/KPs7y9Gddp9AYnSiPjW1Rg9hY0EE2pVO+z57cpZmA/wEVf+kG \ No newline at end of file diff -r f0dcdbb9b2fe -r 215b837c16f9 share/hedgewars/Data/Maps/ClimbHome/map.lua --- a/share/hedgewars/Data/Maps/ClimbHome/map.lua Tue Mar 15 22:29:40 2016 +0300 +++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua Tue Mar 29 22:09:13 2016 +0300 @@ -61,7 +61,7 @@ if params["delaytime"] ~= nil then delayTime = params["delaytime"] end - if params["delaytime"] ~= nil then + if params["delayheight"] ~= nil then delayHeight = 32768-params["delayheight"] end if params["nocake"] ~= nil then addCake = false end @@ -390,6 +390,7 @@ SendStat(siPlayerKills, tostring(roundedFinishTime), loc(GetHogTeamName(CurrentHedgehog))) EndGame() + onAchievementsDeclaration() YouWon = true end elseif distanceFromWater < 0 and not YouLost then @@ -399,6 +400,7 @@ if deadHedgehogs >= totalHedgehogs then makeFinalMultiPlayerStats() EndGame() + onAchievementsDeclaration() end end @@ -550,6 +552,7 @@ if deadHedgehogs >= totalHedgehogs then makeFinalMultiPlayerStats() EndGame() + onAchievementsDeclaration() end makeMultiPlayerLoserStat(gear) end @@ -598,6 +601,7 @@ SendStat(siPointType, loc("points")) SendStat(siPlayerKills, actualHeight, loc(GetHogTeamName(CurrentHedgehog))) EndGame() + onAchievementsDeclaration() end function makeMultiPlayerLoserStat(gear) @@ -678,3 +682,9 @@ function getActualHeight(height) return 32640-height end + +function onAchievementsDeclaration() + for teamname, score in pairs(teamBests) do + DeclareAchievement("height reached", teamname, "ClimbHome", -score) + end +end diff -r f0dcdbb9b2fe -r 215b837c16f9 share/hedgewars/Data/Scripts/OfficialChallenges.lua --- a/share/hedgewars/Data/Scripts/OfficialChallenges.lua Tue Mar 15 22:29:40 2016 +0300 +++ b/share/hedgewars/Data/Scripts/OfficialChallenges.lua Tue Mar 29 22:09:13 2016 +0300 @@ -18,6 +18,7 @@ , ["60906776802,M-1389184823Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #17" , ["Border,70774747774,M-534640804Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #18" , ["Border,50512019610,M-1839546856Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #19" + , ["60715683005,M-281312897Scripts/Multiplayer/Racer.lua"] = "Racer Challenge #20" -- tech racer , ["Border,19661006772,M-975391975Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #1" , ["Border,19661306766,M-975391975Scripts/Multiplayer/TechRacer.lua"] = "Tech Racer #2" diff -r f0dcdbb9b2fe -r 215b837c16f9 share/hedgewars/Data/Themes/Hoggywood/clapper.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Hoggywood/clapper.svg Tue Mar 29 22:09:13 2016 +0300 @@ -0,0 +1,599 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Steven Hogberg + 13 + HW-003 + + + + diff -r f0dcdbb9b2fe -r 215b837c16f9 share/hedgewars/Data/Themes/Hoggywood/palm.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Hoggywood/palm.svg Tue Mar 29 22:09:13 2016 +0300 @@ -0,0 +1,784 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + + 2010-09-25T12:42:13 + Palm Tree, made with another file I made called Jungle Leaf. + https://openclipart.org/detail/86761/palm-tree-by-stevepetmonkey + + + stevepetmonkey + + + + + Coconut Tree + Jungle + Jungle Leaf + Palm + Palm Tree + + + + + + + + + + + diff -r f0dcdbb9b2fe -r 215b837c16f9 tools/CMakeLists.txt --- a/tools/CMakeLists.txt Tue Mar 15 22:29:40 2016 +0300 +++ b/tools/CMakeLists.txt Tue Mar 29 22:09:13 2016 +0300 @@ -13,7 +13,7 @@ find_package(SDL2_net REQUIRED) find_package(SDL2_ttf REQUIRED) find_package(SDL2_mixer REQUIRED) - + find_package(OggVorbis REQUIRED) find_package(PNG REQUIRED) if(NOT NOAUTOUPDATE) @@ -29,9 +29,9 @@ #use the associated tool from the libraries we've selected string(REGEX REPLACE "(.*)/include.*" "\\1" qt_base_dir "${QT_INCLUDE_DIR}") - #remove the ";-framework Cocoa" from the SDL_LIBRARY variable - string(REGEX REPLACE "(.*);-.*" "\\1" sdl_library_only "${SDL_LIBRARY}") - #remove the "libSDLmain.a" from the SDL_LIBRARY variable + #remove the ";-framework Cocoa" from the SDL2_LIBRARY variable + string(REGEX REPLACE "(.*);-.*" "\\1" sdl_library_only "${SDL2_LIBRARY}") + #remove the "libSDLmain.a" from the SDL2_LIBRARY variable string(REGEX REPLACE ".*;(.*)" "\\1" sdl_library_only "${sdl_library_only}") #get the neme of the library (harmelss if it is static) diff -r f0dcdbb9b2fe -r 215b837c16f9 tools/CreateMacBundle.cmake.in --- a/tools/CreateMacBundle.cmake.in Tue Mar 15 22:29:40 2016 +0300 +++ b/tools/CreateMacBundle.cmake.in Tue Mar 29 22:09:13 2016 +0300 @@ -1,33 +1,36 @@ - -execute_process(COMMAND stat ${frameworks_dir}/SDL.framework RESULT_VARIABLE doBundle OUTPUT_QUIET ERROR_QUIET) +# check for a well known-framework +execute_process(COMMAND stat ${frameworks_dir}/QtCore.framework RESULT_VARIABLE doBundle OUTPUT_QUIET ERROR_QUIET) +# prepare Frameworks directory execute_process(COMMAND mkdir -p ${frameworks_dir}) # macdeployqt will convert safely any absolute path library for 'hedgewars' execute_process(COMMAND ${macdeployqt_executable} ${CMAKE_BINARY_DIR}/Hedgewars.app OUTPUT_QUIET ERROR_QUIET) -if(NOT ${NOVIDEOREC}) - # but macdeployqt will not work for 'hwengine'; luckily the dylibs were already updated before - execute_process(COMMAND install_name_tool -change ${LIBAVCODEC_LIBRARY} @executable_path/../Frameworks/libavcodec.dylib ${engine_full_path}) - execute_process(COMMAND install_name_tool -change ${LIBAVFORMAT_LIBRARY} @executable_path/../Frameworks/libavformat.dylib ${engine_full_path}) - execute_process(COMMAND install_name_tool -change ${LIBAVUTIL_LIBRARY} @executable_path/../Frameworks/libavutil.dylib ${engine_full_path}) -endif() +if(doBundle EQUAL 1) + if(NOT ${NOVIDEOREC}) + # but macdeployqt will not work for 'hwengine' + # luckily most the dylibs are already updated before + execute_process(COMMAND install_name_tool -change ${LIBAVCODEC_LIBRARY} @executable_path/../Frameworks/libavcodec.dylib ${engine_full_path}) + execute_process(COMMAND install_name_tool -change ${LIBAVFORMAT_LIBRARY} @executable_path/../Frameworks/libavformat.dylib ${engine_full_path}) + execute_process(COMMAND install_name_tool -change ${LIBAVUTIL_LIBRARY} @executable_path/../Frameworks/libavutil.dylib ${engine_full_path}) + endif() -if(NOT ${NOPNG}) - #same here, for libpng and hwengine, let's assume the version pulled by macdeployqt is the same - #(yes libpng is pulled by macdeployqt even when NOVIDEOREC is active) - execute_process(COMMAND install_name_tool -change ${PNG_LIBRARY} @executable_path/../Frameworks/${PNG_LIBNAME} ${engine_full_path}) - execute_process(COMMAND install_name_tool -change ${ZLIB_LIBRARY} @executable_path/../Frameworks/${ZLIB_LIBNAME} ${engine_full_path}) -endif() + if(NOT ${NOPNG}) + # same here, for libpng and hwengine, let's assume the version pulled + # by macdeployqt matches (yes, libpng is pulled in by macdeployqt even + # when NOVIDEOREC is ON) + execute_process(COMMAND install_name_tool -change ${PNG_LIBRARY} @executable_path/../Frameworks/${PNG_LIBNAME} ${engine_full_path}) + execute_process(COMMAND install_name_tool -change ${ZLIB_LIBRARY} @executable_path/../Frameworks/${ZLIB_LIBNAME} ${engine_full_path}) + endif() -if(doBundle EQUAL 1) execute_process(COMMAND cp ${PNG_LIBRARY} ${frameworks_dir}) - execute_process(COMMAND cp -pPR ${sdl_library_only} ${frameworks_dir}) - execute_process(COMMAND cp -pPR ${SDLIMAGE_LIBRARY} ${frameworks_dir}) - execute_process(COMMAND cp -pPR ${SDLNET_LIBRARY} ${frameworks_dir}) - execute_process(COMMAND cp -pPR ${SDLTTF_LIBRARY} ${frameworks_dir}) - execute_process(COMMAND cp -pPR ${SDLMIXER_LIBRARY} ${frameworks_dir}) - execute_process(COMMAND cp -pPR ${OGG_LIBRARY} ${frameworks_dir}) - execute_process(COMMAND cp -pPR ${VORBIS_LIBRARY} ${frameworks_dir}) + execute_process(COMMAND cp -pPR ${sdl_library_only} ${frameworks_dir}) + execute_process(COMMAND cp -pPR ${SDL2IMAGE_LIBRARY} ${frameworks_dir}) + execute_process(COMMAND cp -pPR ${SDL2NET_LIBRARY} ${frameworks_dir}) + execute_process(COMMAND cp -pPR ${SDL2TTF_LIBRARY} ${frameworks_dir}) + execute_process(COMMAND cp -pPR ${SDL2MIXER_LIBRARY} ${frameworks_dir}) + execute_process(COMMAND cp -pPR ${OGG_LIBRARY} ${frameworks_dir}) + execute_process(COMMAND cp -pPR ${VORBIS_LIBRARY} ${frameworks_dir}) if(${SPARKLE_FOUND}) execute_process(COMMAND cp -pPR ${SPARKLE_LIBRARY} ${frameworks_dir})