# HG changeset patch # User unc0rr # Date 1420317986 -10800 # Node ID dc587913987cea7683b9b6a138770441212b0454 # Parent 20a2d5e6930a08adc1f29852e4edb873e03e228c# Parent c882355f7bc3a4e443437414c80fc2266c3a447e merge default diff -r 20a2d5e6930a -r dc587913987c CMakeLists.txt --- a/CMakeLists.txt Thu Dec 18 00:03:53 2014 +0300 +++ b/CMakeLists.txt Sat Jan 03 23:46:26 2015 +0300 @@ -230,9 +230,8 @@ include(${CMAKE_MODULE_PATH}/cpackvars.cmake) -if(NOT BUILD_ENGINE_C) enable_testing() -endif(NOT BUILD_ENGINE_C) + add_custom_target(test COMMAND ${CMAKE_CTEST_COMMAND} -E '^todo/' --timeout 300 --schedule-random) add_custom_target(test_verbose COMMAND ${CMAKE_CTEST_COMMAND} -E '^todo/' --timeout 300 --schedule-random -V) diff -r 20a2d5e6930a -r dc587913987c ChangeLog.txt --- a/ChangeLog.txt Thu Dec 18 00:03:53 2014 +0300 +++ b/ChangeLog.txt Sat Jan 03 23:46:26 2015 +0300 @@ -8,10 +8,14 @@ + Highlander gamemode can now be used with custom weapon schemes (1-8=How probable to get this weapon. 9=All hogs get it) + New gameplay mode "Construction Mode" + New gameplay mode "TechRacer" + + New game play mode "DiagonalMaze" (generates a simple diagonal maze) + + Add 7 target practice missions, now with simple scoring + + Update RC Plane Challenge: Stats screen reworked and shows now several facts, simple ranking system based on used planes, some taunts in the game + New training/multiplayer mission: "Climb Home" + Game scheme screen has a "Script parameter" field now. This allows to make more customizable scripts/modes. + Network game rejoining. Note: Your team(s) will vanish after 3 turns. - + Visual and gameplay changes to "sea" - world edges. + + Visual and gameplay changes to "sea" - world edge, visual change to wrap world edge to allow seeing through the wrap, visual change to bounce worldedge + + The map of the Basketball Mission can be selected for regular games again ("BasketballField") + New engine command: /togglechat will disable/enable chat display (does not affect chat history display) + Change to Racer: first weapon/utility available will be automatically selected on start + Added some visual feedback to failed girder placement. @@ -31,22 +35,34 @@ + Moved room status filter to top left of rooms list. Lua API: + + New library: Params, makes parsing of script parameters easier + + New library: TargetPractice, used to generate target practice missions (the newly added missions use it) + More helpful syntax error messages. - + New hooks: onParameters(), onPreviewInit(). + + New hooks: + onParameters(paramString) -- called when script parameters are configured. the parameter contains the parameter(s) as text string + onPreviewInit() -- called during map preview initialization + onGearWaterSkip(gearUid) -- called when a gear skims the water without drowning (when hitting it with high speed at low angle). By checking gearUid you can figure out which gear that was. + New functions: - Dismissteam(teamname) + DismissTeam(teamname) -- removes a team from the game (note: if you used loc() on teamnames, don't forget to the translated teamname here too) GetGameFlag(gameflag) -- returns true/false PlaceSprite(x, y, sprite, frameIdx [, landFlag, ... ]) -- sprite refers to an id from the TSprite list SetWaterLine(waterline) -- moves water level to the specified y. the current value is in read-only global waterline SetNextWeapon() -- make current hedgehog switch to next weapon. e.g. use in trainings to preselect weapon SetWeapon(ammoType) -- decide which weapon the current hedgehog should equip + + Map Drawing: + -- to be used in onGameInit() -- first set MapGen to mgDrawn and then use the commands below + AddPoint(x, y [, width [, erase] ]) -- takes x,y location, a width (means start of a new line) and erase (if line should erase, not draw) + FlushPoints() -- makes sure that all the points/lines specified using the command above are actually applied to the map + New global enumerations: Mapgens: mgRandom, mgMaze, mgPerlin, mgDrawn TSprite values LandFlags: lfIndestructible, lfIce, lfBouncy + Changed functions: HogSay(gearUid, text, manner [, vgState]) -- now also allows you to make NON-Hedgehog gears speak, e.g. barrels... wait what?! - + + Changed hooks: + onHogAttack() can now be hooked with new parameter: onHogAttack(ammoType) - to conveniently find out which ammo/weapon is being used + * Fixes: + gfResetHealth is now a available like the other GameFlags 0.9.19 -> 0.9.20: + New campaign, A Space Adventure! + Password protected rooms diff -r 20a2d5e6930a -r dc587913987c QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Thu Dec 18 00:03:53 2014 +0300 +++ b/QTfrontend/hwform.cpp Sat Jan 03 23:46:26 2015 +0300 @@ -1832,7 +1832,7 @@ if (hwnet) { NetAmmoSchemeModel * netAmmo = new NetAmmoSchemeModel(hwnet); - connect(hwnet, SIGNAL(netSchemeConfig(QStringList &)), netAmmo, SLOT(setNetSchemeConfig(QStringList &))); + connect(hwnet, SIGNAL(netSchemeConfig(QStringList)), netAmmo, SLOT(setNetSchemeConfig(QStringList))); ui.pageNetGame->pGameCFG->GameSchemes->setModel(netAmmo); diff -r 20a2d5e6930a -r dc587913987c QTfrontend/model/ammoSchemeModel.cpp --- a/QTfrontend/model/ammoSchemeModel.cpp Thu Dec 18 00:03:53 2014 +0300 +++ b/QTfrontend/model/ammoSchemeModel.cpp Sat Jan 03 23:46:26 2015 +0300 @@ -845,7 +845,7 @@ return netScheme[index.column()]; } -void NetAmmoSchemeModel::setNetSchemeConfig(QStringList & cfg) +void NetAmmoSchemeModel::setNetSchemeConfig(QStringList cfg) { if(cfg.size() != netScheme.size()) { diff -r 20a2d5e6930a -r dc587913987c QTfrontend/model/ammoSchemeModel.h --- a/QTfrontend/model/ammoSchemeModel.h Thu Dec 18 00:03:53 2014 +0300 +++ b/QTfrontend/model/ammoSchemeModel.h Sat Jan 03 23:46:26 2015 +0300 @@ -70,7 +70,7 @@ QVariant data(const QModelIndex &index, int role) const; public slots: - void setNetSchemeConfig(QStringList & cfg); + void setNetSchemeConfig(QStringList cfg); private: QList netScheme; diff -r 20a2d5e6930a -r dc587913987c QTfrontend/net/newnetclient.cpp --- a/QTfrontend/net/newnetclient.cpp Thu Dec 18 00:03:53 2014 +0300 +++ b/QTfrontend/net/newnetclient.cpp Sat Jan 03 23:46:26 2015 +0300 @@ -32,7 +32,7 @@ #include "servermessages.h" #include "HWApplication.h" -char delimeter='\n'; +char delimiter='\n'; HWNewNet::HWNewNet() : isChief(false), @@ -74,7 +74,7 @@ { if (m_game_connected) { - RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit")); + RawSendNet(QString("QUIT%1%2").arg(delimiter).arg("User quit")); emit disconnected(tr("User quit")); } NetSocket.flush(); @@ -91,7 +91,7 @@ void HWNewNet::Disconnect() { if (m_game_connected) - RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit")); + RawSendNet(QString("QUIT%1%2").arg(delimiter).arg("User quit")); m_game_connected = false; NetSocket.disconnectFromHost(); @@ -108,9 +108,9 @@ myroom = room; if(password.isEmpty()) - RawSendNet(QString("CREATE_ROOM%1%2").arg(delimeter).arg(room)); + RawSendNet(QString("CREATE_ROOM%1%2").arg(delimiter).arg(room)); else - RawSendNet(QString("CREATE_ROOM%1%2%1%3").arg(delimeter).arg(room).arg(password)); + RawSendNet(QString("CREATE_ROOM%1%2%1%3").arg(delimiter).arg(room).arg(password)); isChief = true; } @@ -126,29 +126,29 @@ myroom = room; if(password.isEmpty()) - RawSendNet(QString("JOIN_ROOM%1%2").arg(delimeter).arg(room)); + RawSendNet(QString("JOIN_ROOM%1%2").arg(delimiter).arg(room)); else - RawSendNet(QString("JOIN_ROOM%1%2%1%3").arg(delimeter).arg(room).arg(password)); + RawSendNet(QString("JOIN_ROOM%1%2%1%3").arg(delimiter).arg(room).arg(password)); isChief = false; } void HWNewNet::AddTeam(const HWTeam & team) { - QString cmd = QString("ADD_TEAM") + delimeter + - team.name() + delimeter + - QString::number(team.color()) + delimeter + - team.grave() + delimeter + - team.fort() + delimeter + - team.voicepack() + delimeter + - team.flag() + delimeter + + QString cmd = QString("ADD_TEAM") + delimiter + + team.name() + delimiter + + QString::number(team.color()) + delimiter + + team.grave() + delimiter + + team.fort() + delimiter + + team.voicepack() + delimiter + + team.flag() + delimiter + QString::number(team.difficulty()); for(int i = 0; i < HEDGEHOGS_PER_TEAM; ++i) { - cmd.append(delimeter); + cmd.append(delimiter); cmd.append(team.hedgehog(i).Name); - cmd.append(delimeter); + cmd.append(delimiter); cmd.append(team.hedgehog(i).Hat); } RawSendNet(cmd); @@ -156,12 +156,12 @@ void HWNewNet::RemoveTeam(const HWTeam & team) { - RawSendNet(QString("REMOVE_TEAM") + delimeter + team.name()); + RawSendNet(QString("REMOVE_TEAM") + delimiter + team.name()); } void HWNewNet::NewNick(const QString & nick) { - RawSendNet(QString("NICK%1%2").arg(delimeter).arg(nick)); + RawSendNet(QString("NICK%1%2").arg(delimiter).arg(nick)); } void HWNewNet::ToggleReady() @@ -173,7 +173,7 @@ { QString msg = QString(buf.toBase64()); - RawSendNet(QString("EM%1%2").arg(delimeter).arg(msg)); + RawSendNet(QString("EM%1%2").arg(delimiter).arg(msg)); } void HWNewNet::RawSendNet(const QString & str) @@ -292,14 +292,14 @@ { // TODO: Warn user, disconnect qWarning() << "Server too old"; - RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("Server too old")); + RawSendNet(QString("QUIT%1%2").arg(delimiter).arg("Server too old")); Disconnect(); emit disconnected(tr("The server is too old. Disconnecting now.")); return; } - RawSendNet(QString("NICK%1%2").arg(delimeter).arg(mynick)); - RawSendNet(QString("PROTO%1%2").arg(delimeter).arg(*cProtoVer)); + RawSendNet(QString("NICK%1%2").arg(delimiter).arg(mynick)); + RawSendNet(QString("PROTO%1%2").arg(delimiter).arg(*cProtoVer)); netClientState = Connected; m_game_connected = true; emit adminAccess(false); @@ -331,7 +331,7 @@ if (lst[0] == "PING") { if (lst.size() > 1) - RawSendNet(QString("PONG%1%2").arg(delimeter).arg(lst[1])); + RawSendNet(QString("PONG%1%2").arg(delimiter).arg(lst[1])); else RawSendNet(QString("PONG")); return; @@ -873,7 +873,7 @@ { if (isChief) RawSendNet(QString("HH_NUM%1%2%1%3") - .arg(delimeter) + .arg(delimiter) .arg(team.name()) .arg(team.numHedgehogs())); } @@ -882,7 +882,7 @@ { if (isChief) RawSendNet(QString("TEAM_COLOR%1%2%1%3") - .arg(delimeter) + .arg(delimiter) .arg(team.name()) .arg(team.color())); } @@ -892,9 +892,9 @@ if (isChief) RawSendNet( QString("CFG%1%2%1%3") - .arg(delimeter) + .arg(delimiter) .arg(param) - .arg(value.join(QString(delimeter))) + .arg(value.join(QString(delimiter))) ); } @@ -911,7 +911,7 @@ { if(str != "") { - RawSendNet(QString("CHAT") + delimeter + str); + RawSendNet(QString("CHAT") + delimiter + str); QString action = HWProto::chatStringToAction(str); if (action != NULL) emit(roomChatAction(mynick, action)); @@ -924,7 +924,7 @@ { if(str != "") { - RawSendNet(QString("CHAT") + delimeter + str); + RawSendNet(QString("CHAT") + delimiter + str); QString action = HWProto::chatStringToAction(str); if (action != NULL) emit(lobbyChatAction(mynick, action)); @@ -935,7 +935,7 @@ void HWNewNet::SendTeamMessage(const QString& str) { - RawSendNet(QString("TEAMCHAT") + delimeter + str); + RawSendNet(QString("TEAMCHAT") + delimiter + str); } void HWNewNet::askRoomsList() @@ -978,23 +978,23 @@ if (netClientState == InGame) { netClientState = InRoom; - RawSendNet(QString("ROUNDFINISHED%1%2").arg(delimeter).arg(correctly ? "1" : "0")); + RawSendNet(QString("ROUNDFINISHED%1%2").arg(delimiter).arg(correctly ? "1" : "0")); } } void HWNewNet::banPlayer(const QString & nick) { - RawSendNet(QString("BAN%1%2").arg(delimeter).arg(nick)); + RawSendNet(QString("BAN%1%2").arg(delimiter).arg(nick)); } void HWNewNet::banIP(const QString & ip, const QString & reason, int seconds) { - RawSendNet(QString("BANIP%1%2%1%3%1%4").arg(delimeter).arg(ip).arg(reason).arg(seconds)); + RawSendNet(QString("BANIP%1%2%1%3%1%4").arg(delimiter).arg(ip).arg(reason).arg(seconds)); } void HWNewNet::banNick(const QString & nick, const QString & reason, int seconds) { - RawSendNet(QString("BANNICK%1%2%1%3%1%4").arg(delimeter).arg(nick).arg(reason).arg(seconds)); + RawSendNet(QString("BANNICK%1%2%1%3%1%4").arg(delimiter).arg(nick).arg(reason).arg(seconds)); } void HWNewNet::getBanList() @@ -1004,31 +1004,31 @@ void HWNewNet::removeBan(const QString & b) { - RawSendNet(QString("UNBAN%1%2").arg(delimeter).arg(b)); + RawSendNet(QString("UNBAN%1%2").arg(delimiter).arg(b)); } void HWNewNet::kickPlayer(const QString & nick) { - RawSendNet(QString("KICK%1%2").arg(delimeter).arg(nick)); + RawSendNet(QString("KICK%1%2").arg(delimiter).arg(nick)); } void HWNewNet::infoPlayer(const QString & nick) { - RawSendNet(QString("INFO%1%2").arg(delimeter).arg(nick)); + RawSendNet(QString("INFO%1%2").arg(delimiter).arg(nick)); } void HWNewNet::followPlayer(const QString & nick) { if (!isInRoom()) { - RawSendNet(QString("FOLLOW%1%2").arg(delimeter).arg(nick)); + RawSendNet(QString("FOLLOW%1%2").arg(delimiter).arg(nick)); isChief = false; } } void HWNewNet::consoleCommand(const QString & cmd) { - RawSendNet(QString("CMD%1%2").arg(delimeter).arg(cmd)); + RawSendNet(QString("CMD%1%2").arg(delimiter).arg(cmd)); } bool HWNewNet::allPlayersReady() @@ -1047,7 +1047,7 @@ void HWNewNet::updateRoomName(const QString & name) { - RawSendNet(QString("ROOM_NAME%1%2").arg(delimeter).arg(name)); + RawSendNet(QString("ROOM_NAME%1%2").arg(delimiter).arg(name)); } @@ -1085,17 +1085,17 @@ void HWNewNet::setServerMessageNew(const QString & msg) { - RawSendNet(QString("SET_SERVER_VAR%1MOTD_NEW%1%2").arg(delimeter).arg(msg)); + RawSendNet(QString("SET_SERVER_VAR%1MOTD_NEW%1%2").arg(delimiter).arg(msg)); } void HWNewNet::setServerMessageOld(const QString & msg) { - RawSendNet(QString("SET_SERVER_VAR%1MOTD_OLD%1%2").arg(delimeter).arg(msg)); + RawSendNet(QString("SET_SERVER_VAR%1MOTD_OLD%1%2").arg(delimiter).arg(msg)); } void HWNewNet::setLatestProtocolVar(int proto) { - RawSendNet(QString("SET_SERVER_VAR%1LATEST_PROTO%1%2").arg(delimeter).arg(proto)); + RawSendNet(QString("SET_SERVER_VAR%1LATEST_PROTO%1%2").arg(delimiter).arg(proto)); } void HWNewNet::askServerVars() @@ -1165,5 +1165,5 @@ .append("!hedgewars") , QCryptographicHash::Sha1).toHex(); - RawSendNet(QString("PASSWORD%1%2%1%3").arg(delimeter).arg(hash).arg(m_clientSalt)); + RawSendNet(QString("PASSWORD%1%2%1%3").arg(delimiter).arg(hash).arg(m_clientSalt)); } diff -r 20a2d5e6930a -r dc587913987c QTfrontend/net/newnetclient.h --- a/QTfrontend/net/newnetclient.h Thu Dec 18 00:03:53 2014 +0300 +++ b/QTfrontend/net/newnetclient.h Sat Jan 03 23:46:26 2015 +0300 @@ -36,7 +36,7 @@ class QSortFilterProxyModel; class QAbstractItemModel; -extern char delimeter; +extern char delimiter; class HWNewNet : public QObject { @@ -111,7 +111,7 @@ void roomNameUpdated(const QString & name); void askForRoomPassword(); - void netSchemeConfig(QStringList &); + void netSchemeConfig(QStringList); void paramChanged(const QString & param, const QStringList & value); void configAsked(); diff -r 20a2d5e6930a -r dc587913987c QTfrontend/res/html/about.html --- a/QTfrontend/res/html/about.html Thu Dec 18 00:03:53 2014 +0300 +++ b/QTfrontend/res/html/about.html Sat Jan 03 23:46:26 2015 +0300 @@ -74,7 +74,7 @@ English: Andrey Korotaev <unC0Rr@gmail.com>
Finnish: Nina Kuisma <ninnnu@gmail.com>, Janne Uusitupa
French: Antoine Turmel <geekshadow@gmail.com>, Clement Woitrain <sphrixclement@gmail.com>, Matisumi
- German: Peter Hüwe <PeterHuewe@gmx.de>, Mario Liebisch <mario.liebisch@gmail.com>, Richard Karolyi <sheepluva@ercatec.net>
+ German: Peter Hüwe <PeterHuewe@gmx.de>, Mario Liebisch <mario.liebisch@gmail.com>, Richard Karolyi <sheepluva@ercatec.net>, Wuzzy <almikes@aol.com>
Greek: <talos_kriti@yahoo.gr>
Italian: Luca Bonora <bonora.luca@gmail.com>, Marco Bresciani <m.bresciani@email.it>
Japanese: ADAM Etienne <etienne.adam@gmail.com>, Marco Bresciani <m.bresciani@email.it>
diff -r 20a2d5e6930a -r dc587913987c QTfrontend/ui/page/pagedrawmap.cpp --- a/QTfrontend/ui/page/pagedrawmap.cpp Thu Dec 18 00:03:53 2014 +0300 +++ b/QTfrontend/ui/page/pagedrawmap.cpp Sat Jan 03 23:46:26 2015 +0300 @@ -45,6 +45,7 @@ pbClear = addButton(tr("Clear"), pageLayout, 5, 0); pbOptimize = addButton(tr("Optimize"), pageLayout, 6, 0); + pbOptimize->setVisible(false); pbLoad = addButton(tr("Load"), pageLayout, 7, 0); pbSave = addButton(tr("Save"), pageLayout, 8, 0); diff -r 20a2d5e6930a -r dc587913987c cmake_modules/CheckHaskellModuleExists.cmake --- a/cmake_modules/CheckHaskellModuleExists.cmake Thu Dec 18 00:03:53 2014 +0300 +++ b/cmake_modules/CheckHaskellModuleExists.cmake Sat Jan 03 23:46:26 2015 +0300 @@ -30,11 +30,11 @@ "-DPARAMETERS=${PARAMETERS}" -cpp -c "${CMAKE_MODULE_PATH}/checkModule.hs" + RESULT_VARIABLE COMMAND_RESULT ERROR_VARIABLE BUILD_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE ) - - if("${BUILD_ERROR}" STREQUAL "") + if(${COMMAND_RESULT} EQUAL 0) message(STATUS "Looking for ${FUNCTION} in ${MODULE} - found") set(${VARIABLE} 1 CACHE INTERNAL "Have module ${MODULE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log diff -r 20a2d5e6930a -r dc587913987c gameServer/Actions.hs --- a/gameServer/Actions.hs Thu Dec 18 00:03:53 2014 +0300 +++ b/gameServer/Actions.hs Sat Jan 03 23:46:26 2015 +0300 @@ -415,11 +415,12 @@ processAction RemoveClientTeams = do (Just ci) <- gets clientIndex rnc <- gets roomsClients + n <- client's nick removeTeamActions <- io $ do rId <- clientRoomM rnc ci roomTeams <- room'sM rnc teams rId - return . Prelude.map (RemoveTeam . teamname) . Prelude.filter (\t -> teamownerId t == ci) $ roomTeams + return . Prelude.map (RemoveTeam . teamname) . Prelude.filter (\t -> teamowner t == n) $ roomTeams mapM_ processAction removeTeamActions diff -r 20a2d5e6930a -r dc587913987c gameServer/CoreTypes.hs --- a/gameServer/CoreTypes.hs Thu Dec 18 00:03:53 2014 +0300 +++ b/gameServer/CoreTypes.hs Sat Jan 03 23:46:26 2015 +0300 @@ -162,7 +162,6 @@ data TeamInfo = TeamInfo { - teamownerId :: ClientIndex, teamowner :: B.ByteString, teamname :: B.ByteString, teamcolor :: B.ByteString, @@ -170,6 +169,7 @@ teamfort :: B.ByteString, teamvoicepack :: B.ByteString, teamflag :: B.ByteString, + isOwnerRegistered :: Bool, difficulty :: Int, hhnum :: Int, hedgehogs :: [HedgehogInfo] diff -r 20a2d5e6930a -r dc587913987c gameServer/EngineInteraction.hs --- a/gameServer/EngineInteraction.hs Thu Dec 18 00:03:53 2014 +0300 +++ b/gameServer/EngineInteraction.hs Sat Jan 03 23:46:26 2015 +0300 @@ -102,6 +102,7 @@ , [eml ["eseed ", mParams Map.! "SEED"]] , [eml ["e$gmflags ", showB gameFlags]] , schemeFlags + , schemeAdditional , [eml ["e$template_filter ", mParams Map.! "TEMPLATE"]] , [eml ["e$mapgen ", mapgen]] , mapgenSpecific @@ -115,7 +116,7 @@ keys2 = Set.fromList ["AMMO", "SCHEME", "SCRIPT", "THEME"] sane = Set.null (keys1 Set.\\ Map.keysSet mParams) && Set.null (keys2 Set.\\ Map.keysSet prms) - && (not . null . drop 27 $ scheme) + && (not . null . drop 40 $ scheme) && (not . null . tail $ prms Map.! "AMMO") mapGenTypes = ["+rnd+", "+maze+", "+drawn+"] maybeScript = let s = head . fromMaybe ["Normal"] $ Map.lookup "SCRIPT" prms in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]] @@ -131,6 +132,7 @@ schemeFlags = map (\(v, (n, m)) -> eml [n, " ", showB $ (readInt_ v) * m]) $ filter (\(_, (n, _)) -> not $ B.null n) $ zip (drop (length gameFlagConsts) scheme) schemeParams + schemeAdditional = let scriptParam = B.tail $ scheme !! 41 in [eml ["e$scriptparam ", scriptParam] | not $ B.null scriptParam] ammoStr :: B.ByteString ammoStr = head . tail $ prms Map.! "AMMO" ammo = let l = B.length ammoStr `div` 4; ((a, b), (c, d)) = (B.splitAt l . fst &&& B.splitAt l . snd) . B.splitAt (l * 2) $ ammoStr in @@ -184,6 +186,7 @@ , ("e$healthdec", 1) , ("e$ropepct", 1) , ("e$getawaytime", 1) + , ("e$worldedge", 1) ] diff -r 20a2d5e6930a -r dc587913987c gameServer/HWProtoInRoomState.hs --- a/gameServer/HWProtoInRoomState.hs Thu Dec 18 00:03:53 2014 +0300 +++ b/gameServer/HWProtoInRoomState.hs Sat Jan 03 23:46:26 2015 +0300 @@ -41,7 +41,7 @@ chans <- roomClientsChans let nicks = map (nick . client rnc) . roomClients rnc $ clientRoom rnc ci - let allPlayersRegistered = all ((<) 0 . B.length . webPassword . client rnc . teamownerId) $ teams rm + let allPlayersRegistered = all isOwnerRegistered $ teams rm if (playersIn rm == readyPlayers rm || clientProto cl > 43) && not (isJust $ gameInfo rm) then if enoughClans rm then @@ -87,15 +87,19 @@ return [Warning $ loc "Restricted"] else if isMaster cl then return [ - ModifyRoom f, + ModifyRoom $ f (clientProto cl), AnswerClients chans ("CFG" : paramName : paramStrs)] else return [ProtocolError $ loc "Not room master"] where - f r = if paramName `Map.member` (mapParams r) then + f clproto r = if paramName `Map.member` (mapParams r) then r{mapParams = Map.insert paramName (head paramStrs) (mapParams r)} else - r{params = Map.insert paramName paramStrs (params r)} + r{params = Map.insert paramName (fixedParamStr clproto) (params r)} + fixedParamStr clproto + | clproto /= 49 = paramStrs + | paramName /= "SCHEME" = paramStrs + | otherwise = L.init paramStrs ++ [B.replicate 50 'X' `B.append` L.last paramStrs] handleCmd_inRoom ("ADD_TEAM" : tName : color : grave : fort : voicepack : flag : difStr : hhsInfo) @@ -103,11 +107,13 @@ | otherwise = do (ci, _) <- ask rm <- thisRoom + cl <- thisClient clNick <- clientNick clChan <- thisClientChans othChans <- roomOthersChans roomChans <- roomClientsChans cl <- thisClient + let isRegistered = (<) 0 . B.length . webPassword $ cl teamColor <- if clientProto cl < 42 then return color @@ -115,7 +121,7 @@ liftM (head . (L.\\) (map B.singleton ['0'..]) . map teamcolor . teams) thisRoom let roomTeams = teams rm let hhNum = let p = if not $ null roomTeams then minimum [hhnum $ head roomTeams, canAddNumber roomTeams] else 4 in newTeamHHNum roomTeams p - let newTeam = clNick `seq` TeamInfo ci clNick tName teamColor grave fort voicepack flag dif hhNum (hhsList hhsInfo) + let newTeam = clNick `seq` TeamInfo clNick tName teamColor grave fort voicepack flag isRegistered dif hhNum (hhsList hhsInfo) return $ if not . null . drop (maxTeams rm - 1) $ roomTeams then [Warning $ loc "too many teams"] @@ -152,6 +158,7 @@ handleCmd_inRoom ["REMOVE_TEAM", tName] = do (ci, _) <- ask r <- thisRoom + clNick <- clientNick let maybeTeam = findTeam r let team = fromJust maybeTeam @@ -159,18 +166,18 @@ return $ if isNothing $ maybeTeam then [Warning $ loc "REMOVE_TEAM: no such team"] - else if ci /= teamownerId team then + else if clNick /= teamowner team then [ProtocolError $ loc "Not team owner!"] else [RemoveTeam tName, ModifyClient (\c -> c{ teamsInGame = teamsInGame c - 1, - clientClan = if teamsInGame c == 1 then Nothing else Just $ anotherTeamClan ci team r + clientClan = if teamsInGame c == 1 then Nothing else Just $ anotherTeamClan clNick team r }) ] where - anotherTeamClan ci team = teamcolor . fromMaybe (error "CHECKPOINT 011") . find (\t -> (teamownerId t == ci) && (t /= team)) . teams + anotherTeamClan clNick team = teamcolor . fromMaybe (error "CHECKPOINT 011") . find (\t -> (teamowner t == clNick) && (t /= team)) . teams findTeam = find (\t -> tName == teamname t) . teams @@ -207,16 +214,18 @@ let maybeTeam = findTeam r let team = fromJust maybeTeam + maybeClientId <- clientByNick $ teamowner team + let teamOwnerId = fromJust maybeClientId return $ if not $ isMaster cl then [ProtocolError $ loc "Not room master"] - else if isNothing maybeTeam then + else if isNothing maybeTeam || isNothing maybeClientId then [] else [ModifyRoom $ modifyTeam team{teamcolor = newColor}, AnswerClients others ["TEAM_COLOR", teamName, newColor], - ModifyClient2 (teamownerId team) (\c -> c{clientClan = Just newColor})] + ModifyClient2 teamOwnerId (\c -> c{clientClan = Just newColor})] where findTeam = find (\t -> teamName == teamname t) . teams diff -r 20a2d5e6930a -r dc587913987c gameServer/HWProtoLobbyState.hs --- a/gameServer/HWProtoLobbyState.hs Thu Dec 18 00:03:53 2014 +0300 +++ b/gameServer/HWProtoLobbyState.hs Sat Jan 03 23:46:26 2015 +0300 @@ -105,7 +105,7 @@ : AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl] : [(AnswerClients [sendChan cl] $ "JOINED" : nicks) | not $ null nicks] ) - ++ [ModifyRoom (\r -> let (t', g') = moveTeams clTeams . fromJust $ gameInfo r in r{gameInfo = Just g', teams = t'}) | not $ null clTeams] + -- ++ [ModifyRoom (\r -> let (t', g') = moveTeams clTeams . fromJust $ gameInfo r in r{gameInfo = Just g', teams = t'}) | not $ null clTeams] ++ [AnswerClients [sendChan cl] ["CLIENT_FLAGS", "+h", nick $ fromJust owner] | isJust owner] ++ [sendStateFlags cl jRoomClients | not $ null jRoomClients] ++ answerFullConfig cl jRoom diff -r 20a2d5e6930a -r dc587913987c gameServer/OfficialServer/checker.hs --- a/gameServer/OfficialServer/checker.hs Thu Dec 18 00:03:53 2014 +0300 +++ b/gameServer/OfficialServer/checker.hs Sat Jan 03 23:46:26 2015 +0300 @@ -54,7 +54,7 @@ deriving Show serverAddress = "netserver.hedgewars.org" -protocolNumber = "47" +protocolNumber = "49" getLines :: Handle -> IO [B.ByteString] getLines h = g @@ -87,18 +87,18 @@ "ACHIEVEMENT" : typ : teamname : location : value : ps bs ps _ = [] -checkReplay :: Chan Message -> [B.ByteString] -> IO () -checkReplay coreChan msgs = do +checkReplay :: String -> String -> String -> Chan Message -> [B.ByteString] -> IO () +checkReplay home exe prefix coreChan msgs = do tempDir <- getTemporaryDirectory (fileName, h) <- openBinaryTempFile tempDir "checker-demo" B.hPut h . BW.pack . concat . map (fromMaybe [] . Base64.decode . B.unpack) $ msgs hFlush h hClose h - (_, _, Just hOut, _) <- createProcess (proc "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.20/bin/hwengine" + (_, _, Just hOut, _) <- createProcess (proc exe [fileName - , "--user-prefix", "/usr/home/unC0Rr/.hedgewars" - , "--prefix", "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.20/share/hedgewars/Data" + , "--user-prefix", home + , "--prefix", prefix , "--nomusic" , "--nosound" , "--stats-only" @@ -139,8 +139,8 @@ sendPacket packet = writeChan chan $ Packet packet -session :: B.ByteString -> B.ByteString -> Socket -> IO () -session l p s = do +session :: B.ByteString -> B.ByteString -> String -> String -> String -> Socket -> IO () +session l p home exe prefix s = do noticeM "Core" "Connected" coreChan <- newChan forkIO $ recvLoop s coreChan @@ -169,7 +169,7 @@ onPacket _ ["PING"] = answer ["PONG"] onPacket _ ["LOGONPASSED"] = answer ["READY"] onPacket chan ("REPLAY":msgs) = do - checkReplay chan msgs + checkReplay home exe prefix chan msgs warningM "Check" "Started check" onPacket _ ("BYE" : xs) = error $ show xs onPacket _ _ = return () @@ -187,18 +187,24 @@ updateGlobalLogger "Check" (setLevel DEBUG) updateGlobalLogger "Engine" (setLevel DEBUG) + d <- getHomeDirectory Right (login, password) <- runErrorT $ do - d <- liftIO $ getHomeDirectory conf <- join . liftIO . CF.readfile CF.emptyCP $ d ++ "/.hedgewars/settings.ini" l <- CF.get conf "net" "nick" p <- CF.get conf "net" "passwordhash" return (B.pack l, B.pack p) + Right (exeFullname, dataPrefix) <- runErrorT $ do + conf <- join . liftIO . CF.readfile CF.emptyCP $ d ++ "/.hedgewars/checker.ini" + l <- CF.get conf "engine" "exe" + p <- CF.get conf "engine" "prefix" + return (l, p) + Exception.bracket setupConnection (\s -> noticeM "Core" "Shutting down" >> sClose s) - (session login password) + (session login password (d ++ "/.hedgewars") exeFullname dataPrefix) where setupConnection = do noticeM "Core" "Connecting to the server..." diff -r 20a2d5e6930a -r dc587913987c hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/SDLh.pas Sat Jan 03 23:46:26 2015 +0300 @@ -1124,6 +1124,7 @@ function TTF_OpenFontRW(src: PSDL_RWops; freesrc: LongBool; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName; procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName; +procedure TTF_CloseFont(font: PTTF_Font); cdecl; external SDL_TTFLibName; (* SDL_mixer *) function Mix_Init(flags: LongInt): LongInt; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName{$ELSE}inline{$ENDIF}; diff -r 20a2d5e6930a -r dc587913987c hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/hwengine.pas Sat Jan 03 23:46:26 2015 +0300 @@ -112,10 +112,13 @@ if flagMakeCapture then begin flagMakeCapture:= false; + if flagDumpLand then + s:= '/Screenshots/mapdump_' + else s:= '/Screenshots/hw_'; {$IFDEF PAS2C} - s:= '/Screenshots/hw_' + inttostr(GameTicks); + s:= s + inttostr(GameTicks); {$ELSE} - s:= '/Screenshots/hw_' + FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()) + inttostr(GameTicks); + s:= s + FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()) + inttostr(GameTicks); {$ENDIF} // flash @@ -123,8 +126,8 @@ ScreenFade:= sfFromWhite; ScreenFadeValue:= sfMax; ScreenFadeSpeed:= 5; - - if MakeScreenshot(s, 1) then + + if (not flagDumpLand and MakeScreenshot(s, 1, 0)) or (flagDumpLand and MakeScreenshot(s, 1, 1) and MakeScreenshot(s, 1, 2)) then WriteLnToConsole('Screenshot saved: ' + s) else begin diff -r 20a2d5e6930a -r dc587913987c hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uAIAmmoTests.pas Sat Jan 03 23:46:26 2015 +0300 @@ -211,6 +211,7 @@ rTime:= 350; ap.ExplR:= 0; valueResult:= BadTurn; + timer:= 0; repeat rTime:= rTime + 300 + Level * 50 + random(300); Vx:= - windSpeed * rTime * 0.5 + (Targ.Point.X + AIrndSign(2) - mX) / rTime; @@ -253,7 +254,7 @@ EX:= trunc(x); EY:= trunc(y); // Try to prevent AI from thinking firing into water will cause a drowning - if (EY < cWaterLine-5) and (Timer > 0) and (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) > 21) then exit(BadTurn); + if (EY < cWaterLine-5) and (timer > 0) and (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) > 21) then exit(BadTurn); if Level = 1 then value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand) else value:= RateExplosion(Me, EX, EY, 101); diff -r 20a2d5e6930a -r dc587913987c hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uAIMisc.pas Sat Jan 03 23:46:26 2015 +0300 @@ -556,6 +556,7 @@ pX:= Point.x; pY:= Point.y; fallDmg:= 0; + dX:= 0; if (Flags and afTrackFall <> 0) and (Score > 0) and (dmg < Score) then begin dX:= (0.005 * dmg + 0.01) / Density; @@ -741,10 +742,11 @@ end; if dmg > 0 then begin + fallDmg:= 0; + pX:= Point.x; + pY:= Point.y; if (not dead) and (Score > 0) and (dmg < Score) then begin - pX:= Point.x; - pY:= Point.y; dX:= gdX * dmg / Density; dY:= gdY * dmg / Density; if dX < 0 then dX:= dX - 0.01 diff -r 20a2d5e6930a -r dc587913987c hedgewars/uCaptions.pas --- a/hedgewars/uCaptions.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uCaptions.pas Sat Jan 03 23:46:26 2015 +0300 @@ -48,10 +48,7 @@ if Length(s) = 0 then exit; if Captions[Group].Text <> s then - begin - FreeTexture(Captions[Group].Tex); - Captions[Group].Tex:= nil - end; + FreeAndNilTexture(Captions[Group].Tex); if Captions[Group].Tex = nil then begin @@ -73,7 +70,7 @@ begin for Group:= Low(TCapGroup) to High(TCapGroup) do if unload then - FreeTexture(Captions[Group].Tex) + FreeAndNilTexture(Captions[Group].Tex) else if length(Captions[Group].Text) > 0 then Captions[Group].Tex:= RenderStringTex(Captions[Group].Text, Captions[Group].Color, fntBig) end; @@ -97,8 +94,7 @@ inc(offset, Tex^.h + 2); if EndTime <= RealTicks then begin - FreeTexture(Tex); - Tex:= nil; + FreeAndNilTexture(Tex); Text:= ansistring(''); EndTime:= 0 end; @@ -114,10 +110,7 @@ var group: TCapGroup; begin for group:= Low(TCapGroup) to High(TCapGroup) do - begin - FreeTexture(Captions[group].Tex); - Captions[group].Tex:= nil - end + FreeAndNilTexture(Captions[group].Tex); end; end. diff -r 20a2d5e6930a -r dc587913987c hedgewars/uChat.pas --- a/hedgewars/uChat.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uChat.pas Sat Jan 03 23:46:26 2015 +0300 @@ -147,7 +147,7 @@ var color : TSDL_Color; begin if cl.Tex <> nil then - FreeTexture(cl.Tex); + FreeAndNilTexture(cl.Tex); if isInput then begin @@ -583,9 +583,9 @@ procedure freeModule; var i: ShortInt; begin - FreeTexture(InputStr.Tex); + FreeAndNilTexture(InputStr.Tex); for i:= 0 to MaxStrIndex do - FreeTexture(Strs[i].Tex); + FreeAndNilTexture(Strs[i].Tex); end; end. diff -r 20a2d5e6930a -r dc587913987c hedgewars/uCollisions.pas --- a/hedgewars/uCollisions.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uCollisions.pas Sat Jan 03 23:46:26 2015 +0300 @@ -97,7 +97,7 @@ if Gear^.CollisionIndex >= 0 then begin with cinfos[Gear^.CollisionIndex] do - ChangeRoundInLand(X, Y, Radius - 1, false, (Gear = CurrentHedgehog^.Gear) or ((Gear^.Kind = gtCase) and (Gear^.State and gstFrozen = 0))); + ChangeRoundInLand(X, Y, Radius - 1, false, ((CurrentHedgehog <> nil) and (Gear = CurrentHedgehog^.Gear)) or ((Gear^.Kind = gtCase) and (Gear^.State and gstFrozen = 0))); cinfos[Gear^.CollisionIndex]:= cinfos[Pred(Count)]; cinfos[Gear^.CollisionIndex].cGear^.CollisionIndex:= Gear^.CollisionIndex; Gear^.CollisionIndex:= -1; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uCommandHandlers.pas Sat Jan 03 23:46:26 2015 +0300 @@ -323,6 +323,7 @@ end; procedure chAttack_p(var s: shortstring); +var inbtwnTrgtAttks: Boolean; begin s:= s; // avoid compiler hint if CheckNoTeamOrHH then @@ -333,7 +334,9 @@ AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State)); if ((State and gstHHDriven) <> 0) then begin - FollowGear:= CurrentHedgehog^.Gear; + inbtwnTrgtAttks:= ((GameFlags and gfInfAttack) <> 0) and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0); + if (not inbtwnTrgtAttks) then + FollowGear:= CurrentHedgehog^.Gear; if not isExternalSource then SendIPC(_S'A'); Message:= Message or (gmAttack and InputMask); @@ -487,7 +490,8 @@ procedure chCapture(var s: shortstring); begin s:= s; // avoid compiler hint -flagMakeCapture:= true +flagMakeCapture:= true; +flagDumpLand:= LocalMessage and gmPrecise <> 0; end; procedure chRecord(var s: shortstring); diff -r 20a2d5e6930a -r dc587913987c hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uConsts.pas Sat Jan 03 23:46:26 2015 +0300 @@ -36,6 +36,7 @@ HaltTestSuccess = 0; HaltTestFailed = 10; HaltTestLuaError = 11; + HaltTestUnexpected = 12; sfMax = 1000; @@ -48,6 +49,7 @@ errmsgIncorrectUse = 'Incorrect use'; errmsgShouldntRun = 'This program shouldn''t be run manually'; errmsgWrongNumber = 'Wrong parameters number'; + errmsgLuaTestTerm = 'WARNING: Lua test terminated before the test was properly finished with EndLuaTest()!'; msgLoading = 'Loading '; msgOK = 'ok'; @@ -103,9 +105,9 @@ // To allow these to layer, going to treat them as masks. The bottom byte is reserved for objects // TODO - set lfBasic for all solid land, ensure all uses of the flags can handle multiple flag bits // lfObject and lfBasic are only to be different *graphically* in all other ways they should be treated the same - lfBasic = $8000; // white + lfBasic = $8000; // black lfIndestructible = $4000; // red - lfObject = $2000; + lfObject = $2000; // white lfDamaged = $1000; // lfIce = $0800; // blue lfBouncy = $0400; // green @@ -317,6 +319,7 @@ kSystemSoundID_Vibrate = $00000FFF; cMinPlayWidth = 200; + cWorldEdgeDist = 200; implementation diff -r 20a2d5e6930a -r dc587913987c hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uGears.pas Sat Jan 03 23:46:26 2015 +0300 @@ -215,7 +215,7 @@ begin if curHandledGear^.RenderTimer and (curHandledGear^.Timer > 500) and ((curHandledGear^.Timer mod 1000) = 0) then begin - FreeTexture(curHandledGear^.Tex); + FreeAndNilTexture(curHandledGear^.Tex); curHandledGear^.Tex:= RenderStringTex(ansistring(inttostr(curHandledGear^.Timer div 1000)), cWhiteColor, fntSmall); end; curHandledGear^.doStep(curHandledGear); diff -r 20a2d5e6930a -r dc587913987c hedgewars/uGearsHandlersMess.pas --- a/hedgewars/uGearsHandlersMess.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uGearsHandlersMess.pas Sat Jan 03 23:46:26 2015 +0300 @@ -804,6 +804,8 @@ move:= true else if (xx > snowRight) or (xx < snowLeft) then move:=true + else if (cGravity < _0) and (yy < LAND_HEIGHT-1200) then + move:=true // Solid pixel encountered else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then begin @@ -882,7 +884,10 @@ end else Land[ly, lx]:= lf; if gun then - LandPixels[ry, rx]:= (ExplosionBorderColor and (not AMask)) or (p^[px] and AMask) + LandPixels[ry, rx]:= (Gear^.Tint shr 24 shl RShift) or + (Gear^.Tint shr 16 and $FF shl GShift) or + (Gear^.Tint shr 8 and $FF shl BShift) or + (p^[px] and AMask) else LandPixels[ry, rx]:= addBgColor(LandPixels[ry, rx], p^[px]); end else allpx:= false @@ -917,7 +922,9 @@ end; Gear^.Pos:= 0; Gear^.X:= int2hwFloat(LongInt(GetRandom(snowRight - snowLeft)) + snowLeft); - Gear^.Y:= int2hwFloat(LAND_HEIGHT + LongInt(GetRandom(50)) - 1325); + if (cGravity < _0) and (yy < LAND_HEIGHT-1200) then + Gear^.Y:= int2hwFloat(LAND_HEIGHT - 50 - LongInt(GetRandom(50))) + else Gear^.Y:= int2hwFloat(LAND_HEIGHT + LongInt(GetRandom(50)) - 1250); Gear^.State:= Gear^.State or gstInvisible; end end; @@ -1264,15 +1271,22 @@ dec(Gear^.Health, Gear^.Damage); Gear^.Damage := 0 end; - if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Damage < Gear^.Health) and ((not SuddenDeathDmg and (WaterOpacity < $FF)) or (SuddenDeathDmg and (SDWaterOpacity < $FF))) then - begin - for i:=(Gear^.Health - Gear^.Damage) * 4 downto 0 do + + if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Health > 0) then + begin + // draw bubbles + if (not SuddenDeathDmg and (WaterOpacity < $FF)) or (SuddenDeathDmg and (SDWaterOpacity < $FF)) then begin - if Random(6) = 0 then - AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble); - Gear^.X := Gear^.X + Gear^.dX; - Gear^.Y := Gear^.Y + Gear^.dY; + for i:=(Gear^.Health * 4) downto 0 do + begin + if Random(6) = 0 then + AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble); + Gear^.X := Gear^.X + Gear^.dX; + Gear^.Y := Gear^.Y + Gear^.dY; + end; end; + // bullet dies underwater + Gear^.Health:= 0; end; if (Gear^.Health <= 0) @@ -1285,7 +1299,7 @@ cArtillery := false; // Bullet Hit - if (hwRound(Gear^.X) and LAND_WIDTH_MASK = 0) and (hwRound(Gear^.Y) and LAND_HEIGHT_MASK = 0) then + if ((Gear^.State and gstDrowning) = 0) and (hwRound(Gear^.X) and LAND_WIDTH_MASK = 0) and (hwRound(Gear^.Y) and LAND_HEIGHT_MASK = 0) then begin VGear := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBulletHit); if VGear <> nil then @@ -1651,6 +1665,7 @@ procedure doStepMine(Gear: PGear); var vg: PVisualGear; dxdy: hwFloat; + dmg: LongWord; begin if Gear^.Health = 0 then dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY); if (Gear^.State and gstMoving) <> 0 then @@ -1671,7 +1686,11 @@ if (Gear^.Health = 0) then begin if (dxdy > _0_4) and (Gear^.State and gstCollision <> 0) then - inc(Gear^.Damage, hwRound(dxdy * _50)); + begin + dmg:= hwRound(dxdy * _50); + inc(Gear^.Damage, dmg); + ScriptCall('onGearDamage', Gear^.UID, dmg) + end; if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then begin @@ -1810,7 +1829,7 @@ procedure doStepRollingBarrel(Gear: PGear); var - i: LongInt; + i, dmg: LongInt; particle: PVisualGear; dxdy: hwFloat; begin @@ -1838,7 +1857,9 @@ particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) end end; - inc(Gear^.Damage, hwRound(dxdy * _50)) + dmg:= hwRound(dxdy * _50); + inc(Gear^.Damage, dmg); + ScriptCall('onGearDamage', Gear^.UID, dmg) end; CalcRotationDirAngle(Gear); //CheckGearDrowning(Gear) @@ -2171,7 +2192,7 @@ then begin // norm speed vector to length of 2 for fire particles to keep flying in the same direction - f:= _2 / Distance(Gear^.dX, Gear^.dY); + f:= _1_9 / Distance(Gear^.dX, Gear^.dY); Gear^.dX:= Gear^.dX * f; Gear^.dY:= Gear^.dY * f; end @@ -2650,12 +2671,13 @@ HHGear^.Message := HHGear^.Message and (not gmAttack); HHGear^.State := HHGear^.State and (not gstAttacking); HHGear^.State := HHGear^.State or gstHHChooseTarget; - DeleteGear(Gear); isCursorVisible := true; warn:= AddVisualGear(Gear^.Target.X, oy, vgtNoPlaceWarn, 0, true); if warn <> nil then warn^.Tex := GetPlaceCollisionTex(lx, ty, sprHHTelepMask, 0); - PlaySound(sndDenied) + DeleteGear(Gear); + PlaySound(sndDenied); + exit end else begin @@ -3645,7 +3667,7 @@ begin Gear^.Damage:= i; //AddCaption('Fuel: '+inttostr(round(Gear^.Health/20))+'%', cWhiteColor, capgrpAmmostate); - FreeTexture(Gear^.Tex); + FreeAndNilTexture(Gear^.Tex); Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) + '%'), cWhiteColor, fntSmall) end; @@ -4564,7 +4586,7 @@ var x, y, rX, rY, t, tmp, initHealth: LongInt; oX, oY, ldX, ldY, sdX, sdY, sine, lx, ly, amp: hwFloat; - justCollided: boolean; + justCollided, justBounced: boolean; begin AllInactive := false; initHealth := Gear^.Health; @@ -4587,6 +4609,8 @@ // used for a work-around detection of area that is within land array, but outside borders justCollided := false; + // this variable is just to ensure we don't run in infinite loop due to precision errors + justBounced:= false; repeat lX := lX + ldX; @@ -4599,7 +4623,6 @@ amp := _128 * (_1 - hwSqr(int2hwFloat(Gear^.Health)/initHealth)); sine := amp * AngleSin(tmp mod 2048); sine.isNegative := (tmp < 2048); - inc(t,Gear^.Health div 313); Gear^.X := lX + (sine * sdX); Gear^.Y := ly + (sine * sdY); Gear^.dX := Gear^.X - oX; @@ -4608,6 +4631,40 @@ x := hwRound(Gear^.X); y := hwRound(Gear^.Y); + if WorldEdge = weWrap then + begin + if x > LongInt(rightX) then + repeat + dec(x, playWidth); + dec(rx, playWidth); + until x <= LongInt(rightX) + else if x < LongInt(leftX) then + repeat + inc(x, playWidth); + inc(rx, playWidth); + until x >= LongInt(leftX); + end + else if (WorldEdge = weBounce) then + begin + if (not justBounced) and ((x > LongInt(rightX)) or (x < LongInt(leftX))) then + begin + // reflect + lX:= lX - ldX + ((oX - lX) * 2); + lY:= lY - ldY; + Gear^.X:= oX; + Gear^.Y:= oY; + ldX.isNegative:= (not ldX.isNegative); + sdX.isNegative:= (not sdX.isNegative); + justBounced:= true; + continue; + end + else + justBounced:= false; + end; + + + inc(t,Gear^.Health div 313); + // if borders are on, stop outside land array if hasBorder and (((x and LAND_WIDTH_MASK) <> 0) or ((y and LAND_HEIGHT_MASK) <> 0)) then begin @@ -4704,7 +4761,6 @@ if (Gear^.Health <= (initHealth div 6)) then dec(Gear^.Radius) end; - until (Gear^.Health <= 0); DeleteGear(Gear); @@ -4805,7 +4861,7 @@ if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then begin Gear^.Damage:= i; - FreeTexture(Gear^.Tex); + FreeAndNilTexture(Gear^.Tex); Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) + '%'), cWhiteColor, fntSmall) end @@ -4882,7 +4938,7 @@ if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then begin Gear^.Damage:= i; - FreeTexture(Gear^.Tex); + FreeAndNilTexture(Gear^.Tex); Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) + '%'), cWhiteColor, fntSmall) end @@ -5487,7 +5543,7 @@ if (t <> Gear^.Damage) and ((GameTicks and $3F) = 0) then begin Gear^.Damage:= t; - FreeTexture(Gear^.Tex); + FreeAndNilTexture(Gear^.Tex); Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(t) + '%'), cWhiteColor, fntSmall) end; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uGearsHandlersRope.pas --- a/hedgewars/uGearsHandlersRope.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uGearsHandlersRope.pas Sat Jan 03 23:46:26 2015 +0300 @@ -28,12 +28,22 @@ uses uConsts, uFloat, uCollisions, uVariables, uGearsList, uSound, uGearsUtils, uAmmos, uDebug, uUtils, uGearsHedgehog, uGearsRender; +const + IsNilHHFatal = false; + procedure doStepRopeAfterAttack(Gear: PGear); var HHGear: PGear; tX: hwFloat; begin HHGear := Gear^.Hedgehog^.Gear; + if HHGear = nil then + begin + OutError('ERROR: doStepRopeAfterAttack called while HHGear = nil', IsNilHHFatal); + DeleteGear(Gear); + exit() + end; + tX:= HHGear^.X; if WorldWrap(HHGear) and (WorldEdge = weWrap) and ((TestCollisionXwithGear(HHGear, 1) <> 0) or (TestCollisionXwithGear(HHGear, -1) <> 0)) then @@ -121,9 +131,23 @@ haveDivided: boolean; wrongSide: boolean; begin - if GameTicks mod 4 <> 0 then exit; + HHGear := Gear^.Hedgehog^.Gear; + if HHGear = nil then + begin + OutError('ERROR: doStepRopeWork called while HHGear = nil', IsNilHHFatal); + DeleteGear(Gear); + exit() + end; - HHGear := Gear^.Hedgehog^.Gear; + if ((HHGear^.State and gstHHDriven) = 0) or + (CheckGearDrowning(HHGear)) or (Gear^.PortalCounter <> 0) then + begin + PlaySound(sndRopeRelease); + RopeDeleteMe(Gear, HHGear); + exit + end; + + if GameTicks mod 4 <> 0 then exit; tX:= HHGear^.X; if WorldWrap(HHGear) and (WorldEdge = weWrap) and @@ -137,14 +161,6 @@ end; tX:= HHGear^.X; - if ((HHGear^.State and gstHHDriven) = 0) or - (CheckGearDrowning(HHGear)) or (Gear^.PortalCounter <> 0) then - begin - PlaySound(sndRopeRelease); - RopeDeleteMe(Gear, HHGear); - exit - end; - HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shl 2; HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shl 2; if (Gear^.Message and gmLeft <> 0) and (TestCollisionXwithGear(HHGear, -1) = 0) then @@ -414,6 +430,13 @@ Gear^.Elasticity := Gear^.Elasticity + _1; HHGear := Gear^.Hedgehog^.Gear; + if HHGear = nil then + begin + OutError('ERROR: doStepRopeAttach called while HHGear = nil', IsNilHHFatal); + DeleteGear(Gear); + exit() + end; + DeleteCI(HHGear); if (HHGear^.State and gstMoving) <> 0 then diff -r 20a2d5e6930a -r dc587913987c hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uGearsHedgehog.pas Sat Jan 03 23:46:26 2015 +0300 @@ -505,9 +505,11 @@ end else Message:= Message and (not gmAttack); - end; + + ScriptCall('onHogAttack', ord(CurAmmoType)); + end; // of with Gear^, Gear^.Hedgehog^ do + TargetPoint.X := NoPointX; - ScriptCall('onHogAttack'); end; procedure AfterAttack; @@ -832,7 +834,9 @@ Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7; - if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) then + if (not cArtillery or + ((CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtBlowTorch))) and + ((Gear^.Message and gmPrecise) = 0) then MakeHedgehogsStep(Gear); SetAllHHToActive(false); diff -r 20a2d5e6930a -r dc587913987c hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uGearsList.pas Sat Jan 03 23:46:26 2015 +0300 @@ -143,14 +143,22 @@ procedure RemoveGearFromList(Gear: PGear); begin -TryDo((curHandledGear = nil) or (Gear = curHandledGear), 'You''re doing it wrong', true); +if (Gear <> GearsList) and (Gear <> nil) and (Gear^.NextGear = nil) and (Gear^.PrevGear = nil) then + begin + AddFileLog('Attempted to remove Gear #'+inttostr(Gear^.uid)+' from the list twice.'); + exit + end; +TryDo((Gear = nil) or (curHandledGear = nil) or (Gear = curHandledGear), 'You''re doing it wrong', true); if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear; if Gear^.PrevGear <> nil then Gear^.PrevGear^.NextGear:= Gear^.NextGear -else - GearsList:= Gear^.NextGear +else + GearsList:= Gear^.NextGear; + +Gear^.NextGear:= nil; +Gear^.PrevGear:= nil end; @@ -282,15 +290,22 @@ dy.isNegative:= false; dy.QWordValue:= QWord($3AD3) * GetRandom(7000) * 8; if GetRandom(2) = 0 then - dx := -dx - end; + dx := -dx; + Tint:= $FFFFFFFF + end + else + Tint:= (ExplosionBorderColor shr RShift and $FF shl 24) or + (ExplosionBorderColor shr GShift and $FF shl 16) or + (ExplosionBorderColor shr BShift and $FF shl 8) or $FF; State:= State or gstInvisible; - Health:= random(vobFrameTicks); + // use health field to store current frameticks + if vobFrameTicks > 0 then + Health:= random(vobFrameTicks) + else + Health:= 0; + // use timer to store currently displayed frame index if gear^.Timer = 0 then Timer:= random(vobFramesCount); - Damage:= (random(2) * 2 - 1) * (vobVelocity + random(vobVelocity)) * 8; - Tint:= ((ExplosionBorderColor and RMask) shl RShift) or - ((ExplosionBorderColor and GMask) shl GShift) or - ((ExplosionBorderColor and BMask) shl BShift) or $FF; + Damage:= (random(2) * 2 - 1) * (vobVelocity + random(vobVelocity)) * 8 end end; gtGrave: begin @@ -626,8 +641,7 @@ DeleteCI(Gear); -FreeTexture(Gear^.Tex); -Gear^.Tex:= nil; +FreeAndNilTexture(Gear^.Tex); // make sure that portals have their link removed before deletion if (Gear^.Kind = gtPortal) then @@ -648,7 +662,7 @@ end else*) begin - if (Gear <> CurrentHedgehog^.Gear) or (CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtKamikaze) then + if ((CurrentHedgehog = nil) or (Gear <> CurrentHedgehog^.Gear)) or (CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtKamikaze) then Gear^.Hedgehog^.Team^.Clan^.Flawless:= false; if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then begin @@ -659,7 +673,7 @@ end; team:= Gear^.Hedgehog^.Team; - if CurrentHedgehog^.Gear = Gear then + if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear = Gear) then begin AttackBar:= 0; FreeActionsList; // to avoid ThinkThread on drawned gear @@ -669,6 +683,7 @@ end; Gear^.Hedgehog^.Gear:= nil; + if Gear^.Hedgehog^.King then begin // are there any other kings left? Just doing nil check. Presumably a mortally wounded king will get reaped soon enough @@ -686,9 +701,9 @@ // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog // same stand for CheckHHDamage - if (Gear^.LastDamage <> nil) then + if (Gear^.LastDamage <> nil) and (CurrentHedgehog <> nil) then uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true) - else + else if CurrentHedgehog <> nil then uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true); inc(KilledHHs); @@ -699,7 +714,7 @@ with CurrentHedgehog^ do begin inc(Team^.stats.AIKills); - FreeTexture(Team^.AIKillsTex); + FreeAndNilTexture(Team^.AIKillsTex); Team^.AIKillsTex := RenderStringTex(ansistring(inttostr(Team^.stats.AIKills)), Team^.Clan^.Color, fnt16); end end; @@ -714,7 +729,10 @@ FollowGear:= nil; if lastGearByUID = Gear then lastGearByUID := nil; -RemoveGearFromList(Gear); +if (Gear^.Hedgehog = nil) or (Gear^.Hedgehog^.GearHidden <> Gear) then // hidden hedgehogs shouldn't be in the list + RemoveGearFromList(Gear) +else Gear^.Hedgehog^.GearHidden:= nil; + Dispose(Gear) end; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uGearsRender.pas Sat Jan 03 23:46:26 2015 +0300 @@ -168,6 +168,7 @@ procedure DrawRope(Gear: PGear); var roplen, i: LongInt; begin + if Gear^.Hedgehog^.Gear = nil then exit; if (cReducedQuality and rqSimpleRope) <> 0 then DrawRopeLinesRQ(Gear) else @@ -1204,9 +1205,12 @@ gtAirBomb: DrawSpriteRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); gtTeleport: begin HHGear:= Gear^.Hedgehog^.Gear; - if ((Gear^.State and gstAnimation) <> 0) then - DrawSpriteRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); - DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); + if HHGear <> nil then + begin + if ((Gear^.State and gstAnimation) <> 0) then + DrawSpriteRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0); + DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0) + end end; gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12); gtTarget: begin diff -r 20a2d5e6930a -r dc587913987c hedgewars/uGearsUtils.pas --- a/hedgewars/uGearsUtils.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uGearsUtils.pas Sat Jan 03 23:46:26 2015 +0300 @@ -81,6 +81,7 @@ fX, fY, tdX, tdY: hwFloat; vg: PVisualGear; i, cnt: LongInt; + wrap: boolean; begin if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')'); if Radius > 25 then KickFlakes(Radius, X, Y); @@ -101,9 +102,15 @@ dmgRadius:= Radius; dmgBase:= dmgRadius + cHHRadius div 2;*) dmgBase:= Radius shl 1 + cHHRadius div 2; + +// we might have to run twice if weWrap is enabled +wrap:= false; +repeat + fX:= int2hwFloat(X); fY:= int2hwFloat(Y); Gear:= GearsList; + while Gear <> nil do begin dmg:= 0; @@ -188,6 +195,27 @@ AddVisualGear(X, Y, vgtChunk) end; +if (WorldEdge = weWrap) then + begin + // already wrapped? let's not wrap again! + if wrap then + break; + + // Radius + 5 because that's the actual radius the explosion changes graphically + if X + (Radius + 5) > LongInt(rightX) then + begin + dec(X, playWidth); + wrap:= true; + end + else if X - (Radius + 5) < LongInt(leftX) then + begin + inc(X, playWidth); + wrap:= true; + end; + end; + +until (not wrap); + uAIMisc.AwareOfExplosion(0, 0, 0) end; @@ -670,6 +698,8 @@ if isImpact or isSkip then addSplashForGear(Gear, isSkip); + if isSkip then + ScriptCall('onGearWaterSkip', Gear^.uid); end else begin @@ -700,7 +730,7 @@ with CurrentHedgehog^ do begin inc(Team^.stats.AIKills); - FreeTexture(Team^.AIKillsTex); + FreeAndNilTexture(Team^.AIKillsTex); Team^.AIKillsTex := RenderStringTex(ansistring(inttostr(Team^.stats.AIKills)), Team^.Clan^.Color, fnt16); end; tempTeam := gear^.Hedgehog^.Team; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uIO.pas --- a/hedgewars/uIO.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uIO.pas Sat Jan 03 23:46:26 2015 +0300 @@ -180,7 +180,7 @@ repeat BlockRead(f, s[1], 255 - Length(ss), i); if i > 0 then - begin + begin s[0]:= char(i); ss:= ss + s; while (Length(ss) > 1)and(Length(ss) > byte(ss[1])) do diff -r 20a2d5e6930a -r dc587913987c hedgewars/uLand.pas --- a/hedgewars/uLand.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uLand.pas Sat Jan 03 23:46:26 2015 +0300 @@ -56,18 +56,18 @@ begin yd:= LAND_HEIGHT - 1; repeat - while (yd > 0) and (Land[yd, x] = 0) do dec(yd); + while (yd > 0) and (Land[yd, x] <> lfBasic) do dec(yd); if (yd < 0) then yd:= 0; - while (yd < LAND_HEIGHT) and (Land[yd, x] <> 0) do + while (yd < LAND_HEIGHT) and (Land[yd, x] = lfBasic) do inc(yd); dec(yd); yu:= yd; - while (yu > 0 ) and (Land[yu, x] <> 0) do dec(yu); - while (yu < yd ) and (Land[yu, x] = 0) do inc(yu); + while (yu > 0 ) and (Land[yu, x] = lfBasic) do dec(yu); + while (yu < yd ) and (Land[yu, x] <> lfBasic) do inc(yu); if (yd < LAND_HEIGHT - 1) and ((yd - yu) >= 16) then begin @@ -578,10 +578,19 @@ if hasBorder then begin - for y:= 0 to LAND_HEIGHT - 1 do - for x:= 0 to LAND_WIDTH - 1 do - if (y < topY) or (x < leftX) or (x > rightX) then + if WorldEdge = weNone then + begin + for y:= 0 to LAND_HEIGHT - 1 do + for x:= 0 to LAND_WIDTH - 1 do + if (y < topY) or (x < leftX) or (x > rightX) then + Land[y, x]:= lfIndestructible; + end + else if topY > 0 then + begin + for y:= 0 to LongInt(topY) - 1 do + for x:= 0 to LAND_WIDTH - 1 do Land[y, x]:= lfIndestructible; + end; // experiment hardcoding cave // also try basing cave dimensions on map/template dimensions, if they exist for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade @@ -665,6 +674,11 @@ end; PrettifyLandAlpha(); + +// adjust world edges for borderless maps +if (WorldEdge <> weNone) and (not hasBorder) then + InitWorldEdges(); + end; procedure GenPreview(out Preview: TPreview); diff -r 20a2d5e6930a -r dc587913987c hedgewars/uLandGenPerlin.pas --- a/hedgewars/uLandGenPerlin.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uLandGenPerlin.pas Sat Jan 03 23:46:26 2015 +0300 @@ -97,11 +97,6 @@ grad(p[BB ], x-N , y-N))); end; -function f(t: double): double; inline; -begin - f:= t * t * t * (t * (t * 6 - 15) + 10); -end; - procedure inoise_setup(); var i, ii, t: Longword; begin @@ -130,7 +125,8 @@ margin = 200; procedure GenPerlin; -var y, x, {dy, }di, dj, df, r, param1, param2, rCutoff, detail: LongInt; +var y, x, di, dj, r, param1, param2, rCutoff, detail: LongInt; +var df: Int64; begin param1:= cTemplateFilter div 3; param2:= cTemplateFilter mod 3; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uLandGraphics.pas Sat Jan 03 23:46:26 2015 +0300 @@ -527,15 +527,18 @@ end; end; +type TWrapNeeded = (wnNone, wnLeft, wnRight); // // - (dX, dY) - direction, vector of length = 0.5 // -procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt); +function DrawTunnel_real(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt): TWrapNeeded; var nx, ny, dX8, dY8: hwFloat; i, t, tx, ty, by, bx, stX, stY, ddy, ddx: Longint; despeckle : Boolean; begin // (-dY, dX) is (dX, dY) rotated by PI/2 +DrawTunnel_real:= wnNone; + stY:= hwRound(Y); stX:= hwRound(X); @@ -637,14 +640,38 @@ ny:= ny + dX; end; -tx:= Max(stX - HalfWidth * 2 - 4 - abs(hwRound(dX * ticks)), 0); +tx:= stX - HalfWidth * 2 - 4 - abs(hwRound(dX * ticks)); +ddx:= stX + HalfWidth * 2 + 4 + abs(hwRound(dX * ticks)); + +if WorldEdge = weWrap then + begin + if (tx < leftX) or (ddx < leftX) then + DrawTunnel_real:= wnLeft + else if (tx > rightX) or (ddx > rightX) then + DrawTunnel_real:= wnRight; + end; + +tx:= Max(tx, 0); ty:= Max(stY - HalfWidth * 2 - 4 - abs(hwRound(dY * ticks)), 0); -ddx:= Min(stX + HalfWidth * 2 + 4 + abs(hwRound(dX * ticks)), LAND_WIDTH) - tx; +ddx:= Min(ddx, LAND_WIDTH) - tx; ddy:= Min(stY + HalfWidth * 2 + 4 + abs(hwRound(dY * ticks)), LAND_HEIGHT) - ty; UpdateLandTexture(tx, ddx, ty, ddy, false) end; +procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt); +var wn: TWrapNeeded; +begin +wn:= DrawTunnel_real(X, Y, dX, dY, ticks, HalfWidth); +if wn <> wnNone then + begin + if wn = wnLeft then + DrawTunnel_real(X + int2hwFloat(playWidth), Y, dX, dY, ticks, HalfWidth) + else + DrawTunnel_real(X - int2hwFloat(playWidth), Y, dX, dY, ticks, HalfWidth); + end; +end; + function TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline; var lf: Word; begin @@ -772,7 +799,7 @@ function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture; var X, Y, bpp, h, w, row, col, numFramesFirstCol: LongInt; - p, pt: PByteArray; + p, pt: PLongWordArray; Image, finalSurface: PSDL_Surface; begin GetPlaceCollisionTex:= nil; @@ -800,23 +827,20 @@ if SDL_MustLock(finalSurface) then SDLTry(SDL_LockSurface(finalSurface) >= 0, true); -// draw on surface based on collisions -p:= PByteArray(@(PByteArray(Image^.pixels)^[ Image^.pitch * row * h + col * w * 4 ])); -pt:= PByteArray(@(PByteArray(finalSurface^.pixels)^)); +p:= PLongWordArray(@(PLongWordArray(Image^.pixels)^[ (Image^.pitch div 4) * row * h + col * w ])); +pt:= PLongWordArray(finalSurface^.pixels); -case bpp of - 4: for y:= 0 to Pred(h) do - begin - for x:= 0 to Pred(w) do - if (((PLongword(@(p^[x * 4]))^) and AMask) <> 0) - and (((cpY + y) <= Longint(topY)) or ((cpY + y) >= LAND_HEIGHT) or - ((cpX + x) <= Longint(leftX)) or ((cpX + x) >= Longint(rightX)) or (Land[cpY + y, cpX + x] <> 0)) then - (PLongword(@(pt^[x * 4]))^):= cWhiteColor - else - (PLongword(@(pt^[x * 4]))^):= 0; - p:= PByteArray(@(p^[Image^.pitch])); - pt:= PByteArray(@(pt^[finalSurface^.pitch])); - end; +for y:= 0 to Pred(h) do + begin + for x:= 0 to Pred(w) do + if ((p^[x] and AMask) <> 0) + and (((cpY + y) < Longint(topY)) or ((cpY + y) >= LAND_HEIGHT) or + ((cpX + x) < Longint(leftX)) or ((cpX + x) > Longint(rightX)) or (Land[cpY + y, cpX + x] <> 0)) then + pt^[x]:= cWhiteColor + else + (pt^[x]):= cWhiteColor and (not AMask); + p:= PLongWordArray(@(p^[Image^.pitch div 4])); + pt:= PLongWordArray(@(pt^[finalSurface^.pitch div 4])); end; if SDL_MustLock(Image) then diff -r 20a2d5e6930a -r dc587913987c hedgewars/uLandTexture.pas --- a/hedgewars/uLandTexture.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uLandTexture.pas Sat Jan 03 23:46:26 2015 +0300 @@ -169,10 +169,7 @@ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TEXSIZE, TEXSIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, Pixels(x,y)); end else if tex <> nil then - begin - FreeTexture(tex); - tex:= nil - end; + FreeAndNilTexture(tex); // nothing else to do if dirtyLandTexCount < 1 then @@ -284,13 +281,7 @@ for x:= 0 to LANDTEXARW - 1 do for y:= 0 to LANDTEXARH - 1 do with LandTextures[x, y] do - begin - if tex <> nil then - begin - FreeTexture(tex); - tex:= nil - end - end; + FreeAndNilTexture(tex); end; procedure freeModule; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uLandUtils.pas --- a/hedgewars/uLandUtils.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uLandUtils.pas Sat Jan 03 23:46:26 2015 +0300 @@ -2,9 +2,10 @@ interface procedure ResizeLand(width, height: LongWord); +procedure InitWorldEdges(); implementation -uses uUtils, uConsts, uVariables; +uses uUtils, uConsts, uVariables, uTypes; procedure ResizeLand(width, height: LongWord); var potW, potH: LongInt; @@ -31,4 +32,56 @@ end; end; +procedure InitWorldEdges(); +var cy, cx, lx, ly: LongInt; + found: boolean; +begin +playHeight:= LAND_HEIGHT; +topY:= 0; + +lx:= LongInt(LAND_WIDTH) - 1; + +if WorldEdge = weNone then + begin + playWidth:= LAND_WIDTH; + leftX := 0; + rightX:= lx; + EXIT; + end; + +ly:= LongInt(LAND_HEIGHT) - 1; + +// find most left land pixels and set leftX accordingly +found:= false; +for cx:= 0 to lx do + begin + for cy:= ly downto 0 do + if Land[cy, cx] <> 0 then + begin + leftX:= max(0, cx - cWorldEdgeDist); + // break out of both loops + found:= true; + break; + end; + if found then break; + end; + +// find most right land pixels and set rightX accordingly +found:= false; +for cx:= lx downto 0 do + begin + for cy:= ly downto 0 do + if Land[cy, cx] <> 0 then + begin + rightX:= min(lx, cx + cWorldEdgeDist); + // break out of both loops + found:= true; + break; + end; + if found then break; + end; + +playWidth := rightX + 1 - leftX; +end; + end. diff -r 20a2d5e6930a -r dc587913987c hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uMisc.pas Sat Jan 03 23:46:26 2015 +0300 @@ -28,7 +28,7 @@ procedure movecursor(dx, dy: LongInt); function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; -function MakeScreenshot(filename: shortstring; k: LongInt): boolean; +function MakeScreenshot(filename: shortstring; k: LongInt; dump: LongWord): boolean; function GetTeamStatString(p: PTeam): shortstring; {$IFDEF SDL2} function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline; @@ -221,12 +221,13 @@ // captures and saves the screen. returns true on success. // saved image will be k times smaller than original (useful for saving thumbnails). -function MakeScreenshot(filename: shortstring; k: LongInt): Boolean; +function MakeScreenshot(filename: shortstring; k: LongInt; dump: LongWord): boolean; var p: Pointer; size: QWord; image: PScreenshot; format: GLenum; ext: string[4]; + x,y: LongWord; begin {$IFDEF PNG_SCREENSHOTS} format:= GL_RGBA; @@ -236,7 +237,9 @@ ext:= '.bmp'; {$ENDIF} -size:= toPowerOf2(cScreenWidth) * toPowerOf2(cScreenHeight) * 4; +if dump > 0 then + size:= LAND_WIDTH*LAND_HEIGHT*4 +else size:= toPowerOf2(cScreenWidth) * toPowerOf2(cScreenHeight) * 4; p:= GetMem(size); // will be freed in SaveScreenshot() // memory could not be allocated @@ -248,18 +251,55 @@ end; // read pixels from the front buffer -glReadPixels(0, 0, cScreenWidth, cScreenHeight, format, GL_UNSIGNED_BYTE, p); - +if dump > 0 then + begin + for y:= 0 to LAND_HEIGHT-1 do + for x:= 0 to LAND_WIDTH-1 do + if dump = 2 then + PLongWordArray(p)^[y*LAND_WIDTH+x]:= LandPixels[LAND_HEIGHT-1-y, x] + else + begin + if Land[LAND_HEIGHT-1-y, x] and lfIndestructible = lfIndestructible then + PLongWordArray(p)^[y*LAND_WIDTH+x]:= (AMask or RMask) + else if Land[LAND_HEIGHT-1-y, x] and lfIce = lfIce then + PLongWordArray(p)^[y*LAND_WIDTH+x]:= (AMask or BMask) + else if Land[LAND_HEIGHT-1-y, x] and lfBouncy = lfBouncy then + PLongWordArray(p)^[y*LAND_WIDTH+x]:= (AMask or GMask) + else if Land[LAND_HEIGHT-1-y, x] and lfObject = lfObject then + PLongWordArray(p)^[y*LAND_WIDTH+x]:= $FFFFFFFF + else if Land[LAND_HEIGHT-1-y, x] and lfBasic = lfBasic then + PLongWordArray(p)^[y*LAND_WIDTH+x]:= AMask + else + PLongWordArray(p)^[y*LAND_WIDTH+x]:= 0 + end + end +else + begin + glReadPixels(0, 0, cScreenWidth, cScreenHeight, format, GL_UNSIGNED_BYTE, p); {$IFDEF USE_VIDEO_RECORDING} -ReduceImage(p, cScreenWidth, cScreenHeight, k); + ReduceImage(p, cScreenWidth, cScreenHeight, k) {$ENDIF} + end; // allocate and fill structure that will be passed to new thread New(image); // will be disposed in SaveScreenshot() -//image^.filename:= shortstring(UserPathPrefix) + filename + ext; +{if dump = 2 then + image^.filename:= shortstring(UserPathPrefix) + filename + '_landpixels' + ext +else if dump = 1 then + image^.filename:= shortstring(UserPathPrefix) + filename + '_land' + ext +else image^.filename:= shortstring(UserPathPrefix) + filename + ext;} image^.filename:= filename + ext; -image^.width:= cScreenWidth div k; -image^.height:= cScreenHeight div k; + +if dump <> 0 then + begin + image^.width:= LAND_WIDTH; + image^.height:= LAND_HEIGHT + end +else + begin + image^.width:= cScreenWidth div k; + image^.height:= cScreenHeight div k + end; image^.size:= size; image^.buffer:= p; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uRenderUtils.pas --- a/hedgewars/uRenderUtils.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uRenderUtils.pas Sat Jan 03 23:46:26 2015 +0300 @@ -304,15 +304,64 @@ end; end; +function GetNextSpeechLine(s: ansistring; ldelim: char; var startFrom: LongInt; out substr: ansistring): boolean; +var p, l, m, r: Integer; + newl, skip: boolean; + c : char; +begin + m:= Length(s); + + substr:= ''; + + SetLengthA(substr, m); + + // number of chars read + r:= 0; + + // number of chars to be written + l:= 0; + + newl:= true; + + for p:= max(1, startFrom) to m do + begin + + inc(r); + // read char from source string + c:= s[p]; + + // strip empty lines, spaces and newlines on beginnings of line + skip:= ((newl or (p = m)) and ((c = ' ') or (c = ldelim))); + + if (not skip) then + begin + newl:= (c = ldelim); + // stop if we went past the end of the line + if newl then + break; + + // copy current char to output substring + inc(l); + substr[l]:= c; + end; + + end; + + inc(startFrom, r); + + SetLengthA(substr, l); + + GetNextSpeechLine:= (l > 0); +end; function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture; -var textWidth, textHeight, x, y, w, h, i, j, pos, prevpos, line, numLines, edgeWidth, edgeHeight, cornerWidth, cornerHeight: LongInt; +var textWidth, textHeight, x, y, w, h, i, j, pos, line, numLines, edgeWidth, edgeHeight, cornerWidth, cornerHeight: LongInt; finalSurface, tmpsurf, rotatedEdge: PSDL_Surface; rect: TSDL_Rect; {$IFNDEF PAS2C} chars: set of char = [#9,' ',';',':','?','!',',']; {$ENDIF} - substr: shortstring; + substr: ansistring; edge, corner, tail: TSPrite; begin if cOnlyStats then exit(nil); @@ -362,27 +411,25 @@ {$IFNDEF PAS2C} s:= WrapText(s, #1, chars, i); {$ENDIF} - pos:= 1; prevpos:= 0; line:= 0; + pos:= 1; line:= 0; // Find the longest line for the purposes of centring the text. Font dependant. - while pos <= length(s) do + while GetNextSpeechLine(s, #1, pos, substr) do begin - if (s[pos] = #1) or (pos = length(s)) then - begin - inc(numlines); - if s[pos] <> #1 then inc(pos); - while s[prevpos+1] = ' ' do inc(prevpos); - substr:= copy(s, prevpos+1, pos-prevpos-1); - i:= 0; j:= 0; - TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(substr), @i, @j); - if i > w then - w:= i; - prevpos:= pos; - end; - inc(pos); + inc(numLines); + i:= 0; j:= 0; + TTF_SizeUTF8(Fontz[font].Handle, PChar(substr), @i, @j); + if i > w then + w:= i; end; end else numLines := 1; + if numLines < 1 then + begin + s:= '...'; + numLines:= 1; + end; + textWidth:=((w-(cornerWidth-edgeWidth)*2) div edgeWidth)*edgeWidth+edgeWidth; textHeight:=(((numlines * h + 2)-((cornerHeight-edgeWidth)*2)) div edgeWidth)*edgeWidth; @@ -468,30 +515,17 @@ j:= rect.h; SDL_FillRect(finalSurface, @rect, cWhiteColor); - pos:= 1; prevpos:= 0; line:= 0; - while pos <= length(s) do + pos:= 1; line:= 0; + while GetNextSpeechLine(s, #1, pos, substr) do begin - if (s[pos] = #1) or (pos = length(s)) then - begin - if s[pos] <> #1 then - inc(pos); - while s[prevpos+1] = ' 'do - inc(prevpos); - substr:= copy(s, prevpos+1, pos-prevpos-1); - if Length(substr) <> 0 then - begin - tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(substr), cNearBlackColorChannels); - rect.x:= edgeHeight + 1 + ((i - w) div 2); - // trying to more evenly position the text, vertically - rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h; - SDLTry(tmpsurf <> nil, true); - SDL_UpperBlit(tmpsurf, nil, finalSurface, @rect); - SDL_FreeSurface(tmpsurf); - inc(line); - prevpos:= pos; - end; - end; - inc(pos); + tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, PChar(substr), cNearBlackColorChannels); + rect.x:= edgeHeight + 1 + ((i - w) div 2); + // trying to more evenly position the text, vertically + rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h; + SDLTry(tmpsurf <> nil, true); + SDL_UpperBlit(tmpsurf, nil, finalSurface, @rect); + SDL_FreeSurface(tmpsurf); + inc(line); end; RenderSpeechBubbleTex:= Surface2Tex(finalSurface, true); diff -r 20a2d5e6930a -r dc587913987c hedgewars/uScript.pas --- a/hedgewars/uScript.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uScript.pas Sat Jan 03 23:46:26 2015 +0300 @@ -100,6 +100,7 @@ ScriptAmmoReinforcement : shortstring; ScriptLoaded : boolean; mapDims : boolean; + PointsBuffer: shortstring; procedure ScriptPrepareAmmoStore; forward; procedure ScriptApplyAmmoStore; forward; @@ -108,8 +109,10 @@ var LuaDebugInfo: lua_Debug; +procedure SetGlobals; forward; procedure LuaParseString(s: shortString); begin + SetGlobals; AddFileLog('[Lua] input string: ' + s); AddChatString(#3 + '[Lua] > ' + s); if luaL_dostring(luaState, Str2PChar(s)) <> 0 then @@ -190,6 +193,19 @@ CheckAndFetchParamCount:= true; end; +// check if is in range of count1 and count2 +function CheckAndFetchParamCountRange(L : Plua_State; count1, count2: LongInt; call, paramsyntax: shortstring; out actual: LongInt): boolean; inline; +begin + actual:= lua_gettop(L); + if (actual < count1) or (actual > count2) then + begin + LuaParameterCountError('at least ' + inttostr(count1) + ', but at most ' + inttostr(count2), call, paramsyntax, actual); + exit(false); + end; + + CheckAndFetchParamCountRange:= true; +end; + // check if is same or higher as minCount function CheckAndFetchLuaParamMinCount(L : Plua_State; minCount: LongInt; call, paramsyntax: shortstring; out actual: LongInt): boolean; inline; begin @@ -1053,16 +1069,16 @@ hh:= team^.Hedgehogs[j]; if (hh.Gear <> nil) or (hh.GearHidden <> nil) then begin - FreeTexture(hh.NameTagTex); + FreeAndNilTexture(hh.NameTagTex); hh.NameTagTex:= RenderStringTex(ansistring(hh.Name), clan^.Color, fnt16); RenderHealth(hh); end; end; - FreeTexture(team^.NameTagTex); + FreeAndNilTexture(team^.NameTagTex); team^.NameTagTex:= RenderStringTex(ansistring(clan^.Teams[i]^.TeamName), clan^.Color, fnt16); end; - FreeTexture(clan^.HealthTex); + FreeAndNilTexture(clan^.HealthTex); clan^.HealthTex:= makeHealthBarTexture(cTeamHealthWidth + 5, clan^.Teams[0]^.NameTagTex^.h, clan^.Color); end; @@ -1095,7 +1111,7 @@ begin gear^.Hedgehog^.Team^.TeamName := lua_tostring(L, 2); - FreeTexture(gear^.Hedgehog^.Team^.NameTagTex); + FreeAndNilTexture(gear^.Hedgehog^.Team^.NameTagTex); gear^.Hedgehog^.Team^.NameTagTex:= RenderStringTex(ansistring(gear^.Hedgehog^.Team^.TeamName), gear^.Hedgehog^.Team^.Clan^.Color, fnt16); end else @@ -1134,7 +1150,7 @@ begin gear^.Hedgehog^.Name:= lua_tostring(L, 2); - FreeTexture(gear^.Hedgehog^.NameTagTex); + FreeAndNilTexture(gear^.Hedgehog^.NameTagTex); gear^.Hedgehog^.NameTagTex:= RenderStringTex(ansistring(gear^.Hedgehog^.Name), gear^.Hedgehog^.Team^.Clan^.Color, fnt16) end end; @@ -2252,16 +2268,86 @@ lc_declareachievement:= 0 end; -// stuff for testing the lua API -function lc_endluatest(L : Plua_State) : LongInt; Cdecl; + +procedure ScriptFlushPoints(); begin - if CheckLuaParamCount(L, 1, 'EndLuaAPITest', 'LUA_API_TEST_SUCCESSFUL or LUA_API_TEST_FAILED') then + ParseCommand('draw ' + PointsBuffer, true, true); + PointsBuffer:= ''; +end; + + +function lc_addPoint(L : Plua_State) : LongInt; Cdecl; +var np, param: LongInt; +begin + if CheckAndFetchParamCountRange(L, 2, 4, 'AddPoint', 'x, y [, width [, erase] ]', np) then begin - WriteLnToConsole('Lua test finished'); - halt(lua_tointeger(L, 1)); - end - else - lua_pushnil(L); + // x + param:= LongInt(lua_tointeger(L,1)); + PointsBuffer:= PointsBuffer + char((param shr 8) and $FF); + PointsBuffer:= PointsBuffer + char((param and $FF)); + // y + param:= LongInt(lua_tointeger(L,2)); + PointsBuffer:= PointsBuffer + char((param shr 8) and $FF); + PointsBuffer:= PointsBuffer + char((param and $FF)); + // width + if np > 2 then + begin + param:= lua_tointeger(L,3); + param:= (param or $80); + // erase + if (np > 3) and lua_toboolean(L, 4) then + param:= (param or $40); + PointsBuffer:= PointsBuffer + char(param); + end + // no width defined + else + PointsBuffer:= PointsBuffer + char(0); + + // flush before shortstring limit length is reached + if length(PointsBuffer) > 245 then + ScriptFlushPoints(); + end; + lc_addPoint:= 0 +end; + + +function lc_flushPoints(L : Plua_State) : LongInt; Cdecl; +begin + if CheckLuaParamCount(L, 0, 'FlushPoints', '') then + if length(PointsBuffer) > 0 then + ScriptFlushPoints(); + lc_flushPoints:= 0 +end; + +// stuff for lua tests +function lc_endluatest(L : Plua_State) : LongInt; Cdecl; +var rstring: shortstring; +const + call = 'EndLuaTest'; + params = 'TEST_SUCCESSFUL or TEST_FAILED'; +begin + if CheckLuaParamCount(L, 1, call, params) then + begin + + case lua_tointeger(L, 1) of + HaltTestSuccess : rstring:= 'Success'; + HaltTestLuaError: rstring:= 'FAILED'; + else + begin + LuaCallError('Parameter must be either ' + params, call, params); + exit(0); + end; + end; + + if cTestLua then + begin + WriteLnToConsole('Lua test finished, result: ' + rstring); + halt(lua_tointeger(L, 1)); + end + else LuaError('Not in lua test mode, engine will keep running. Reported test result: ' + rstring); + + end; + lc_endluatest:= 0; end; /////////////////// @@ -2738,6 +2824,7 @@ ScriptSetInteger('gfLowGravity', gfLowGravity); ScriptSetInteger('gfLaserSight', gfLaserSight); ScriptSetInteger('gfInvulnerable', gfInvulnerable); +ScriptSetInteger('gfResetHealth', gfResetHealth); ScriptSetInteger('gfVampiric', gfVampiric); ScriptSetInteger('gfKarma', gfKarma); ScriptSetInteger('gfArtillery', gfArtillery); @@ -2947,17 +3034,17 @@ lua_register(luaState, _P'SetWaterLine', @lc_setwaterline); lua_register(luaState, _P'SetNextWeapon', @lc_setnextweapon); lua_register(luaState, _P'SetWeapon', @lc_setweapon); +// drawn map functions +lua_register(luaState, _P'AddPoint', @lc_addPoint); +lua_register(luaState, _P'FlushPoints', @lc_flushPoints); lua_register(luaState, _P'SetGearAIHints', @lc_setaihintsongear); lua_register(luaState, _P'HedgewarsScriptLoad', @lc_hedgewarsscriptload); lua_register(luaState, _P'DeclareAchievement', @lc_declareachievement); -if cTestLua then - begin - ScriptSetInteger('TEST_SUCCESSFUL' , HaltTestSuccess); - ScriptSetInteger('TEST_FAILED' , HaltTestFailed); - lua_register(luaState, _P'EndLuaTest', @lc_endluatest); - end; +ScriptSetInteger('TEST_SUCCESSFUL' , HaltTestSuccess); +ScriptSetInteger('TEST_FAILED' , HaltTestFailed); +lua_register(luaState, _P'EndLuaTest', @lc_endluatest); ScriptClearStack; // just to be sure stack is empty ScriptLoaded:= false; @@ -3051,6 +3138,7 @@ procedure initModule; begin mapDims:= false; +PointsBuffer:= ''; end; procedure freeModule; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uStore.pas --- a/hedgewars/uStore.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uStore.pas Sat Jan 03 23:46:26 2015 +0300 @@ -50,7 +50,6 @@ function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture; procedure RenderWeaponTooltip(atype: TAmmoType); procedure ShowWeaponTooltip(x, y: LongInt); -procedure FreeWeaponTooltip; procedure MakeCrossHairs; {$IFDEF USE_VIDEO_RECORDING} procedure InitOffscreenOpenGL; @@ -97,7 +96,9 @@ procedure InitZoom(zoom: real); begin SetScale(zoom); - UpdateViewLimits(); + // make sure view limits are updated + // because SetScale() doesn't do it, if zoom=cScaleFactor + updateViewLimits(); end; function WriteInRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: PChar): TSDL_Rect; @@ -475,7 +476,7 @@ tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, PChar(trAmmo[NameId]), cWhiteColorChannels); TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true); tmpsurf:= doSurfaceConversion(tmpsurf); - FreeTexture(NameTex); + FreeAndNilTexture(NameTex); NameTex:= Surface2Tex(tmpsurf, false); SDL_FreeSurface(tmpsurf) end; @@ -485,7 +486,7 @@ begin tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels); tmpsurf:= doSurfaceConversion(tmpsurf); - FreeTexture(CountTexz[i]); + FreeAndNilTexture(CountTexz[i]); CountTexz[i]:= Surface2Tex(tmpsurf, false); SDL_FreeSurface(tmpsurf) end; @@ -580,7 +581,7 @@ var s: shortstring; begin str(Hedgehog.Gear^.Health, s); -FreeTexture(Hedgehog.HealthTagTex); +FreeAndNilTexture(Hedgehog.HealthTagTex); Hedgehog.HealthTagTex:= RenderStringTex(ansistring(s), Hedgehog.Team^.Clan^.Color, fnt16) end; @@ -610,17 +611,17 @@ // loading failed if tmpsurf = nil then begin - - // anounce that loading failed - OutError(msgFailed, false); - // output sdl error if loading failed when data source was available if rwops <> nil then begin + // anounce that loading failed + OutError(msgFailed, false); + SDLTry(false, (imageFlags and ifCritical) <> 0); // rwops was already freed by IMG_Load_RW rwops:= nil; - end; + end else + OutError(msgFailed, (imageFlags and ifCritical) <> 0); exit; end; @@ -697,10 +698,7 @@ begin // free the mem of any previously assigned texture. This was previously only if the new one could be loaded, but, NoHat is usually a better choice if HH.HatTex <> nil then - begin - FreeTexture(HH.HatTex); - HH.HatTex:= nil - end; + FreeAndNilTexture(HH.HatTex); // load new hat surface if this hat is different than the one already loaded if newHat <> prevHat then @@ -843,8 +841,7 @@ GameLoaded(); {$ENDIF} WriteLnToConsole('Freeing progress surface... '); - FreeTexture(ProgrTex); - ProgrTex:= nil; + FreeAndNilTexture(ProgrTex); Step:= 0 end; @@ -982,7 +979,7 @@ end; // free old texture -FreeWeaponTooltip; +FreeAndNilTexture(WeaponTooltipTex); // image region i:= LongInt(atype) - 1; @@ -1022,13 +1019,6 @@ DrawTexture(x, y, WeaponTooltipTex) end; -procedure FreeWeaponTooltip; -begin -// free the existing texture (if there is any) -FreeTexture(WeaponTooltipTex); -WeaponTooltipTex:= nil -end; - {$IFDEF USE_VIDEO_RECORDING} {$IFDEF SDL2} procedure InitOffscreenOpenGL; @@ -1270,8 +1260,20 @@ end; procedure freeModule; +var fi: THWFont; begin StoreRelease(false); + // make sure fonts are cleaned up + for fi:= Low(THWFont) to High(THWFont) do + with Fontz[fi] do + begin + if Handle <> nil then + begin + TTF_CloseFont(Handle); + Handle:= nil; + end; + end; + TTF_Quit(); {$IFDEF SDL2} SDL_GL_DeleteContext(SDLGLcontext); diff -r 20a2d5e6930a -r dc587913987c hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uTeams.pas Sat Jan 03 23:46:26 2015 +0300 @@ -649,38 +649,38 @@ Delete(s, 1, 1); t:= 0; - while (t < cMaxTeams) and (TeamsArray[t] <> nil) and (TeamsArray[t]^.TeamName <> s) do + while (t < TeamsCount) and (TeamsArray[t]^.TeamName <> s) do inc(t); - if (t = cMaxTeams) or (TeamsArray[t] = nil) then + if t = TeamsCount then exit; TeamsArray[t]^.isGoneFlagPendingToBeSet:= true; if isSynced then - begin - for i:= 0 to Pred(cMaxTeams) do - with TeamsArray[i]^ do - begin - if (not hasGone) and isGoneFlagPendingToBeSet then + begin + for i:= 0 to Pred(TeamsCount) do + with TeamsArray[i]^ do begin - AddChatString('** '+ TeamName + ' is gone'); // TODO: localize - if not CurrentTeam^.ExtDriven then SendIPC(_S'f' + s); - hasGone:= true; - skippedTurns:= 0; - isGoneFlagPendingToBeSet:= false; - RecountTeamHealth(TeamsArray[i]) - end; - if hasGone and isGoneFlagPendingToBeUnset then - ParseCommand('/teamback s' + s, true); - end; - end + if (not hasGone) and isGoneFlagPendingToBeSet then + begin + AddChatString('** '+ TeamName + ' is gone'); // TODO: localize + if not CurrentTeam^.ExtDriven then SendIPC(_S'f' + s); + hasGone:= true; + skippedTurns:= 0; + isGoneFlagPendingToBeSet:= false; + RecountTeamHealth(TeamsArray[i]) + end; + if hasGone and isGoneFlagPendingToBeUnset then + ParseCommand('/teamback s' + s, true) + end + end else - begin + begin TeamsArray[t]^.isGoneFlagPendingToBeSet:= true; if (not CurrentTeam^.ExtDriven) or (CurrentTeam^.TeamName = s) or (CurrentTeam^.hasGone) then - ParseCommand('/teamgone s' + s, true); - end; + ParseCommand('/teamgone s' + s, true) + end; end; procedure chTeamBack(var s:shortstring); @@ -692,9 +692,9 @@ Delete(s, 1, 1); t:= 0; - while (t < cMaxTeams) and (TeamsArray[t] <> nil) and (TeamsArray[t]^.TeamName <> s) do + while (t < TeamsCount) and (TeamsArray[t]^.TeamName <> s) do inc(t); - if (t = cMaxTeams) or (TeamsArray[t] = nil) then + if t = TeamsCount then exit; if isSynced then @@ -715,12 +715,12 @@ end; end else - begin + begin TeamsArray[t]^.isGoneFlagPendingToBeUnset:= true; if not CurrentTeam^.ExtDriven then ParseCommand('/teamback s' + s, true); - end; + end; end; @@ -731,10 +731,10 @@ s:= s; t:= 0; -while (t < cMaxTeams) and (TeamsArray[t] <> nil) do +while t < TeamsCount do begin TeamsArray[t]^.hasGone:= true; - inc(t); + inc(t) end; AddChatString('** Good-bye!'); @@ -845,6 +845,7 @@ procedure freeModule; var i, h: LongWord; begin +CurrentHedgehog:= nil; if TeamsCount > 0 then begin for i:= 0 to Pred(TeamsCount) do @@ -852,28 +853,32 @@ for h:= 0 to cMaxHHIndex do with TeamsArray[i]^.Hedgehogs[h] do begin +// if Gear <> nil then +// DeleteGearStage(Gear, true); if GearHidden <> nil then Dispose(GearHidden); +// DeleteGearStage(GearHidden, true); - FreeTexture(NameTagTex); - FreeTexture(HealthTagTex); - FreeTexture(HatTex); + FreeAndNilTexture(NameTagTex); + FreeAndNilTexture(HealthTagTex); + FreeAndNilTexture(HatTex) end; with TeamsArray[i]^ do begin - FreeTexture(NameTagTex); - FreeTexture(GraveTex); - FreeTexture(AIKillsTex); - FreeTexture(FlagTex); + FreeAndNilTexture(NameTagTex); + FreeAndNilTexture(OwnerTex); + FreeAndNilTexture(GraveTex); + FreeAndNilTexture(AIKillsTex); + FreeAndNilTexture(FlagTex); end; - Dispose(TeamsArray[i]); - end; + Dispose(TeamsArray[i]) + end; for i:= 0 to Pred(ClansCount) do begin - FreeTexture(ClansArray[i]^.HealthTex); - Dispose(ClansArray[i]); + FreeAndNilTexture(ClansArray[i]^.HealthTex); + Dispose(ClansArray[i]) end end; TeamsCount:= 0; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uTextures.pas --- a/hedgewars/uTextures.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uTextures.pas Sat Jan 03 23:46:26 2015 +0300 @@ -27,7 +27,6 @@ function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; procedure PrettifySurfaceAlpha(surf: PSDL_Surface; pixels: PLongwordArray); procedure PrettifyAlpha2D(pixels: TLandArray; height, width: LongWord); -procedure FreeTexture(tex: PTexture); procedure FreeAndNilTexture(var tex: PTexture); procedure initModule; @@ -297,25 +296,20 @@ // deletes texture and frees the memory allocated for it. // if nil is passed nothing is done -procedure FreeTexture(tex: PTexture); -begin -if tex <> nil then - begin - if tex^.NextTexture <> nil then - tex^.NextTexture^.PrevTexture:= tex^.PrevTexture; - if tex^.PrevTexture <> nil then - tex^.PrevTexture^.NextTexture:= tex^.NextTexture - else - TextureList:= tex^.NextTexture; - glDeleteTextures(1, @tex^.id); - Dispose(tex); - end -end; - procedure FreeAndNilTexture(var tex: PTexture); begin - FreeTexture(tex); - tex:= nil + if tex <> nil then + begin + if tex^.NextTexture <> nil then + tex^.NextTexture^.PrevTexture:= tex^.PrevTexture; + if tex^.PrevTexture <> nil then + tex^.PrevTexture^.NextTexture:= tex^.NextTexture + else + TextureList:= tex^.NextTexture; + glDeleteTextures(1, @tex^.id); + Dispose(tex); + tex:= nil; + end; end; procedure initModule; @@ -324,13 +318,15 @@ end; procedure freeModule; +var tex: PTexture; begin if TextureList <> nil then WriteToConsole('FIXME FIXME FIXME. App shutdown without full cleanup of texture list; read game0.log and please report this problem'); while TextureList <> nil do begin - AddFileLog('Texture not freed: width='+inttostr(LongInt(TextureList^.w))+' height='+inttostr(LongInt(TextureList^.h))+' priority='+inttostr(round(TextureList^.priority*1000))); - FreeTexture(TextureList); + tex:= TextureList; + AddFileLog('Texture not freed: width='+inttostr(LongInt(tex^.w))+' height='+inttostr(LongInt(tex^.h))+' priority='+inttostr(round(tex^.priority*1000))); + FreeAndNilTexture(tex); end end; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uTypes.pas Sat Jan 03 23:46:26 2015 +0300 @@ -388,7 +388,7 @@ Hedgehogs: array[0..cMaxHHIndex] of THedgehog; CurrHedgehog: LongWord; NameTagTex, - OwnerTex: PTexture; + OwnerTex, GraveTex, AIKillsTex, FlagTex: PTexture; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uUtils.pas Sat Jan 03 23:46:26 2015 +0300 @@ -74,6 +74,7 @@ procedure Write(var f: textfile; s: shortstring); procedure WriteLn(var f: textfile; s: shortstring); function StrLength(s: PChar): Longword; +procedure SetLengthA(var s: ansistring; len: Longword); {$ENDIF} function isPhone: Boolean; inline; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uVariables.pas Sat Jan 03 23:46:26 2015 +0300 @@ -186,6 +186,7 @@ flagMakeCapture : boolean; + flagDumpLand : boolean; InitStepsFlags : Longword; RealTicks : Longword; @@ -2584,6 +2585,7 @@ cVampiric := false; cArtillery := false; flagMakeCapture := false; + flagDumpLand := false; bBetweenTurns := false; bWaterRising := false; isCursorVisible := false; @@ -2612,13 +2614,13 @@ dirtyLandTexCount:= 0; - vobFrameTicks:= 99999; + vobFrameTicks:= 0; vobFramesCount:= 4; vobCount:= 0; vobVelocity:= 10; vobFallSpeed:= 100; - vobSDFrameTicks:= 99999; + vobSDFrameTicks:= 0; vobSDFramesCount:= 4; vobSDCount:= 30 * cScreenSpace div LAND_WIDTH; vobSDVelocity:= 15; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uVideoRec.pas --- a/hedgewars/uVideoRec.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uVideoRec.pas Sat Jan 03 23:46:26 2015 +0300 @@ -239,7 +239,7 @@ thumbpath:= '/VideoTemp/' + RecPrefix; AddFileLog('Saving thumbnail ' + thumbpath); k:= max(max(cScreenWidth, cScreenHeight) div 400, 1); // here 400 is minimum size of thumbnail - MakeScreenshot(thumbpath, k); + MakeScreenshot(thumbpath, k, 0); thumbnailSaved:= true; end; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uVisualGears.pas Sat Jan 03 23:46:26 2015 +0300 @@ -205,9 +205,9 @@ vgtSmoke: DrawTextureF(SpritesData[sprSmoke].Texture, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 7 - Gear^.Frame, 1, SpritesData[sprSmoke].Width, SpritesData[sprSmoke].Height); vgtSmokeWhite: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame); vgtDust: if Gear^.State = 1 then - DrawSpriteRotatedF(sprSnowDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame, Gear^.Tag, Gear^.Angle) + DrawSpriteRotatedF(sprSnowDust, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 7 - Gear^.Frame, Gear^.Tag, Gear^.Angle) else - DrawSpriteRotatedF(sprDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame, Gear^.Tag, Gear^.Angle); + DrawSpriteRotatedF(sprDust, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 7 - Gear^.Frame, Gear^.Tag, Gear^.Angle); vgtFire: if (Gear^.State and gstTmpFlag) = 0 then DrawSprite(sprFlame, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy, (RealTicks shr 6 + Gear^.Frame) mod 8) else @@ -508,11 +508,11 @@ vg:= VisualGearLayers[i]; while vg <> nil do if vg^.Kind = vgtFlake then - begin - tmp:= vg^.NextGear; - DeleteVisualGear(vg); - vg:= tmp - end + begin + tmp:= vg^.NextGear; + DeleteVisualGear(vg); + vg:= tmp + end else vg:= vg^.NextGear; end; if hasBorder or (not cSnow) then diff -r 20a2d5e6930a -r dc587913987c hedgewars/uVisualGearsHandlers.pas --- a/hedgewars/uVisualGearsHandlers.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uVisualGearsHandlers.pas Sat Jan 03 23:46:26 2015 +0300 @@ -80,32 +80,41 @@ procedure doStepFlake(Gear: PVisualGear; Steps: Longword); var sign: real; moved: boolean; + vfc, vft: LongWord; begin if vobCount = 0 then exit; sign:= 1; with Gear^ do begin - inc(FrameTicks, Steps); - if not SuddenDeathDmg and (FrameTicks > vobFrameTicks) then + + X:= X + (cWindSpeedf * 400 + dX + tdX) * Steps * Gear^.Scale; + + if SuddenDeathDmg then begin - dec(FrameTicks, vobFrameTicks); - inc(Frame); - if Frame = vobFramesCount then - Frame:= 0 + Y:= Y + (dY + tdY + cGravityf * vobSDFallSpeed) * Steps * Gear^.Scale; + vfc:= vobSDFramesCount; + vft:= vobSDFrameTicks; end - else if SuddenDeathDmg and (FrameTicks > vobSDFrameTicks) then + else begin - dec(FrameTicks, vobSDFrameTicks); - inc(Frame); - if Frame = vobSDFramesCount then - Frame:= 0 + Y:= Y + (dY + tdY + cGravityf * vobFallSpeed) * Steps * Gear^.Scale; + vfc:= vobFramesCount; + vft:= vobFrameTicks; end; - X:= X + (cWindSpeedf * 400 + dX + tdX) * Steps * Gear^.Scale; - if SuddenDeathDmg then - Y:= Y + (dY + tdY + cGravityf * vobSDFallSpeed) * Steps * Gear^.Scale - else - Y:= Y + (dY + tdY + cGravityf * vobFallSpeed) * Steps * Gear^.Scale; + + if vft > 0 then + begin + inc(FrameTicks, Steps); + if FrameTicks > vft then + begin + dec(FrameTicks, vft); + inc(Frame); + if Frame = vfc then + Frame:= 0 + end; + end; + Angle:= Angle + dAngle * Steps; if Angle > 360 then Angle:= Angle - 360 diff -r 20a2d5e6930a -r dc587913987c hedgewars/uVisualGearsList.pas --- a/hedgewars/uVisualGearsList.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uVisualGearsList.pas Sat Jan 03 23:46:26 2015 +0300 @@ -102,12 +102,14 @@ Scale:= 1.0; if SuddenDeathDmg then begin - FrameTicks:= random(vobSDFrameTicks); + if vobSDFrameTicks > 0 then + FrameTicks:= random(vobSDFrameTicks); Frame:= random(vobSDFramesCount); end else begin - FrameTicks:= random(vobFrameTicks); + if vobFrameTicks > 0 then + FrameTicks:= random(vobFrameTicks); Frame:= random(vobFramesCount); end; Angle:= random(360); @@ -430,8 +432,7 @@ procedure DeleteVisualGear(Gear: PVisualGear); begin - FreeTexture(Gear^.Tex); - Gear^.Tex:= nil; + FreeAndNilTexture(Gear^.Tex); if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear; diff -r 20a2d5e6930a -r dc587913987c hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu Dec 18 00:03:53 2014 +0300 +++ b/hedgewars/uWorld.pas Sat Jan 03 23:46:26 2015 +0300 @@ -228,7 +228,7 @@ prevPoint.Y:= cScreenHeight div 2; //prevTargetPoint.X:= 0; //prevTargetPoint.Y:= 0; -WorldDx:= -(LAND_WIDTH div 2);// + cScreenWidth div 2; +WorldDx:= -(LongInt(leftX + (playWidth div 2))); // -(LAND_WIDTH div 2);// + cScreenWidth div 2; WorldDy:= -(LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2); //aligns it to the bottom of the screen, minus the border @@ -404,17 +404,12 @@ // for uStore texture resetting procedure ResetWorldTex; begin - FreeTexture(fpsTexture); - fpsTexture:= nil; - FreeTexture(timeTexture); - timeTexture:= nil; - FreeTexture(missionTex); - missionTex:= nil; - FreeTexture(recTexture); - recTexture:= nil; - FreeTexture(AmmoMenuTex); + FreeAndNilTexture(fpsTexture); + FreeAndNilTexture(timeTexture); + FreeAndNilTexture(missionTex); + FreeAndNilTexture(recTexture); + FreeAndNilTexture(AmmoMenuTex); AmmoMenuInvalidated:= true; - AmmoMenuTex:= nil; end; function GetAmmoMenuTexture(Ammo: PHHAmmo): PTexture; @@ -566,7 +561,7 @@ if(AmmoMenuInvalidated) then begin AmmoMenuInvalidated:= false; - FreeTexture(AmmoMenuTex); + FreeAndNilTexture(AmmoMenuTex); AmmoMenuTex:= GetAmmoMenuTexture(Ammo); {$IFDEF USE_LANDSCAPE_AMMOMENU} @@ -749,7 +744,7 @@ bShowAmmoMenu:= false; SetWeapon(Ammo^[Slot, Pos].AmmoType); bSelected:= false; - FreeWeaponTooltip; + FreeAndNilTexture(WeaponTooltipTex); {$IFDEF USE_TOUCH_INTERFACE}//show the aiming buttons + animation if (Ammo^[Slot, Pos].Propz and ammoprop_NeedUpDown) <> 0 then begin @@ -772,7 +767,7 @@ end end else - FreeWeaponTooltip; + FreeAndNilTexture(WeaponTooltipTex); if (WeaponTooltipTex <> nil) and (AMShiftX = 0) and (AMShiftY = 0) then {$IFDEF USE_LANDSCAPE_AMMOMENU} @@ -1032,7 +1027,7 @@ begin rect.w:= w; rect.x:= ViewLeftX; - DrawRect(rect, $30, $30, $30, $40, true); + DrawRect(rect, $10, $10, $10, $80, true); if WorldEdge = weBounce then DrawLineOnScreen(tmp - 1, ViewTopY, tmp - 1, ViewBottomY, 2, $54, $54, $FF, $FF); end; @@ -1044,7 +1039,7 @@ begin rect.w:= w; rect.x:= tmp; - DrawRect(rect, $30, $30, $30, $40, true); + DrawRect(rect, $10, $10, $10, $80, true); if WorldEdge = weBounce then DrawLineOnScreen(tmp - 1, ViewTopY, tmp - 1, ViewBottomY, 2, $54, $54, $FF, $FF); end; @@ -1682,7 +1677,7 @@ tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); tmpSurface:= doSurfaceConversion(tmpSurface); - FreeTexture(timeTexture); + FreeAndNilTexture(timeTexture); timeTexture:= Surface2Tex(tmpSurface, false); SDL_FreeSurface(tmpSurface) end; @@ -1700,7 +1695,7 @@ s:= inttostr(FPS) + ' fps'; tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels); tmpSurface:= doSurfaceConversion(tmpSurface); - FreeTexture(fpsTexture); + FreeAndNilTexture(fpsTexture); fpsTexture:= Surface2Tex(tmpSurface, false); SDL_FreeSurface(tmpSurface) end; @@ -1763,7 +1758,7 @@ s:= 'rec'; tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fntBig].Handle, Str2PChar(s), cWhiteColorChannels); tmpSurface:= doSurfaceConversion(tmpSurface); - FreeTexture(recTexture); + FreeAndNilTexture(recTexture); recTexture:= Surface2Tex(tmpSurface, false); SDL_FreeSurface(tmpSurface) end; @@ -1862,7 +1857,7 @@ uCursor.updatePosition(); {$ENDIF} z:= round(200/zoom); -inbtwnTrgtAttks := (CurrentHedgehog <> nil) and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0) and ((GameFlags and gfInfAttack) <> 0); +inbtwnTrgtAttks := ((GameFlags and gfInfAttack) <> 0) and (CurrentHedgehog <> nil) and ((CurrentHedgehog^.Gear = nil) or (CurrentHedgehog^.Gear <> FollowGear)) and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0); if autoCameraOn and (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and (not inbtwnTrgtAttks) then if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then begin @@ -1872,12 +1867,17 @@ end else begin - if abs(prevPoint.X - WorldDx - hwRound(FollowGear^.X)) > LongInt(rightX) - leftX - 100 then + if (WorldEdge = weWrap) then + cameraJump:= LongInt(playWidth) div 2 + 50 + else + cameraJump:= LongInt(rightX) - leftX - 100; + + if abs(prevPoint.X - WorldDx - hwRound(FollowGear^.X)) > cameraJump then begin - if (prevPoint.X - WorldDx) * 2 < LongInt((rightX + leftX)) then - cameraJump:= LongInt(rightX) - leftX - else - cameraJump:= LongInt(leftX) - rightX; + if prevPoint.X - WorldDx < LongInt(playWidth div 2) then + cameraJump:= LongInt(playWidth) + else + cameraJump:= -LongInt(playWidth); WorldDx:= WorldDx - cameraJump; end; @@ -2001,7 +2001,7 @@ if time = 0 then time:= 5000; missionTimer:= time; -FreeTexture(missionTex); +FreeAndNilTexture(missionTex); if icon > -1 then begin diff -r 20a2d5e6930a -r dc587913987c project_files/hwc/rtl/pas2c.h --- a/project_files/hwc/rtl/pas2c.h Thu Dec 18 00:03:53 2014 +0300 +++ b/project_files/hwc/rtl/pas2c.h Sat Jan 03 23:46:26 2015 +0300 @@ -61,7 +61,7 @@ typedef LongInt * PLongInt; typedef LongWord * PLongWord; typedef Integer * PInteger; -typedef int PtrInt; +typedef ptrdiff_t PtrInt; typedef wchar_t widechar; typedef wchar_t* PWideChar; typedef char Char; diff -r 20a2d5e6930a -r dc587913987c project_files/hwc/rtl/system.c --- a/project_files/hwc/rtl/system.c Thu Dec 18 00:03:53 2014 +0300 +++ b/project_files/hwc/rtl/system.c Sat Jan 03 23:46:26 2015 +0300 @@ -296,6 +296,11 @@ } LongInt fpcrtl_random(LongInt l) { + // random(0) is undefined in docs but effectively returns 0 in free pascal + if (l == 0) { + printf("WARNING: random(0) called!"); + return 0; + } return (LongInt) (rand() / (double) RAND_MAX * l); } diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/Hats/war_UNPeacekeeper02.png Binary file share/hedgewars/Data/Graphics/Hats/war_UNPeacekeeper02.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/Missions/Training/ClimbHome.png Binary file share/hedgewars/Data/Graphics/Missions/Training/ClimbHome.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/Missions/Training/ClimbHome@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/ClimbHome@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Bazooka_easy@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Bazooka_easy@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Bazooka_hard@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Bazooka_hard@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Cluster_Bomb@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Cluster_Bomb@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Grenade_easy@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Grenade_easy@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Grenade_hard@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Grenade_hard@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Homing_Bee@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Homing_Bee@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Shotgun@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Target_Practice_-_Shotgun@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Graphics/amRubber.png Binary file share/hedgewars/Data/Graphics/amRubber.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Locale/de.txt --- a/share/hedgewars/Data/Locale/de.txt Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Locale/de.txt Sat Jan 03 23:46:26 2015 +0300 @@ -130,7 +130,7 @@ 02:00=%1 ist ab jetzt ein Ex-Igel 02:00=%1 sieht sich die Radieschen von unten an 02:00=%1 hat aufgehört zu existieren -02:00=Verabschieden Sie sich von %1 +02:00=Wir verabschieden uns von %1 02:00=Für %1 gibt es keine Hoffnung mehr 02:00=%1 trat von der Lebensbühne ab 02:00=%1 erleidet ein spontanes multiples Organversagen @@ -153,6 +153,21 @@ 02:00=%1 spürt keinen Schmerz mehr 02:00=%1 muss nicht mehr leiden 02:00=%1 hat eine Abkürzung gefunden … +02:00=%1 war ohnehin nur Kanonenfutter +02:00=Mir kommen die Tränen, %1! +02:00=Man wird dich rächen, %1! +02:00=%1 wartet auf die Wiederbelebung. +02:00=%1 hat ein Nach-Tod-Erlebnis +02:00=%1 hat im Spiel des Lebens verloren +02:00=%1 wurde vernichtend geschlagen +02:00=%1 hat alle Lebenspunkte aufgebraucht +02:00=%1 wird nicht mehr auf Futtersuche gehen müssen +02:00=%1 schläft den ganz langen Winterschlaf +02:00=Warum musstest du sterben, %1? +02:00=Oh, nein, %1! Wir hatten noch so viel vor … +02:00=Jetzt braucht sich %1 nicht mehr vor dem Tod zu fürchten. +02:00=%1 wurde von den Schrecken des Krieges erlöst +02:00=Klappe zu, %1 tot! ; Hog (%1) drowned 02:01=%1 geht auf Tauchstation! @@ -221,6 +236,7 @@ 02:01=%1 lässt sich diese einmalige Tauchgelegenheit nicht entgehen 02:01=Und wir dachten %1 könnte nicht noch tiefer sinken … 02:01=%1 zieht eine Etage tiefer +02:01=Seht, %1 kann schwimmen! Nein, doch nicht … ; Round starts 02:02=Auf in die Schlacht! @@ -253,7 +269,6 @@ 02:02=Lassen Sie den Kampf in der Woche beginnen 02:02=Lassen Sie den Kampf des Tages beginnen 02:02=Lassen Sie den Kampf der Stunde beginnen -02:02=Tun Sie Ihr Bestes! 02:02=Zerstört den Feind! 02:02=Viel Glück! 02:02=Viel Spaß! @@ -292,6 +307,18 @@ 02:05=Ein Grund zur Hoffnung! 02:05=Frisch aus dem Jungbrunnen 02:05=Lebenszeit in Kisten +02:05=Hilfe ist in Sicht! +02:05=Das macht kranke Igel wieder gesund +02:05=Schlagt das Lazarett auf! +02:05=Erhöhe deine Lebenserwartung … +02:05=Erste Hilfe! +02:05=Endlich kommt Hilfe! +02:05=Gesundmacher aus der Luft! +02:05=Lebenspunkterhöhungsmittel! +02:05=Kiste des Lebens +02:05=Tankt eure Lebensenergie wieder auf! +02:05=Hat jemand »Hatschi!« gesagt? +02:05=Damit fühlt sich der Igel wieder pudelwohl! ; New ammo crate 02:06=Nachschub! @@ -312,13 +339,30 @@ 02:06=Was auch immer da drin ist, es ist bestimmt nicht Pizza 02:06=Einsammlen! 02:06=Eine Waffenkiste! -02:06=Lassen Sie nicht zu, dass sich der Feind sie holt! +02:06=Lasse nicht zu, dass der Feind sie holt! 02:06=Schönes neues Spielzeug! 02:06=Eine geheimnisvolle Kiste! 02:06=Ein eckiges Ü-Ei! 02:06=Die Holzkiste der Pandora! 02:06=Willst du mit mir spielen? 02:06=Quadratisch, praktisch, … gefährlich? +02:06=Diese Kiste bringt Bombenstimmung! +02:06=Damit kann man dem Feind so richtig einheizen +02:06=Jetzt geht die Party erst richtig los! +02:06=Damit kommt Freude auf! +02:06=Ob da eine Melonenbombe drin ist? +02:06=Das ist wie ein Kindergeburtstag! +02:06=Wir brauchen Waffen, viele Waffen! +02:06=Davon kann man nie genug haben. +02:06=Neue Waffen, um das Spiel etwas spannender zu machen +02:06=Neue Waffen braucht das Land! +02:06=Nichts für Weicheier! +02:06=Achtung: Inhalt hochexplosiv +02:06=Wer zuerst kommt, mahlt zuerst! +02:06=Für die Waffennarren +02:06=Damit schlägt das Herz jedes Waffennarren höher! +02:06=Waffenkiste: Nur echt mit dem Fragezeichen +02:06=Dies könnte die spielentscheidende Waffe sein! ; New utility crate 02:07=Nützliches? @@ -327,11 +371,23 @@ 02:07=Lieferung frei Haus! 02:07=Mehr als nur eine Kiste! 02:07=Weitere Hilfsmittel! -02:07=Extras für Sie! +02:07=Extras für dich! 02:07=Dies sollte gut sein! -02:07=Verwenden Sie diese mit Bedacht +02:07=Verwende diese mit Bedacht 02:07=Uff, diese Box ist schwer 02:07=Futter für Strategen +02:07=Heimwerker atmen auf! +02:07=Schaffe, schaffe, Häusle baue +02:07=Werkzeuge kann man immer gebrauchen +02:07=Auf diese Kisten können Sie bauen +02:07=Ein Geschenk der Techniker! +02:07=Strategen freuen sich! +02:07=Dies könnte deine Mobilität wiederherstellen … +02:07=Verschaffe dir einen strategischen Vorteil +02:07=Muttern und Schrauben! +02:07=Lieferung aus den Igelwerken! +02:07=Damit schlägt das Herz jedes Mechanikers höher! +02:07=So viele Möglichkeiten … ; Hog (%1) skips his turn 02:08=%1 ist so ein Langeweiler … @@ -392,7 +448,7 @@ 02:09=Das hat wohl nicht ganz geklappt, %1 02:09=%1 geht ein wenig zu sorglos mit gefährlichen Waffen um 02:09=%1 sollte eine Änderung der Laufbahn betrachten -02:09=Nein, nein, nein, %1, Sie müssen auf den Feind schießen! +02:09=Nein, nein, nein, %1, du musst auf den Feind schießen! 02:09=%1 bewegt sich einen Schritt näher zum Selbstmord 02:09=%1, Helfer des Feindes 02:09=%1 hatte das anders geplant @@ -418,6 +474,22 @@ 02:09=%1 wird vom Pech verfolgt 02:09=Auch %1 macht mal Fehler 02:09=Hoppla?! +02:09=%1 will unbedingt den Darwin-Award gewinnen +02:09=%1 macht sich lächerlich +02:09=%1 hat absolut nichts dazugelernt +02:09=%1 hat wohl nicht mehr alle Tassen im Schrank +02:09=%1 ist durchgeknallt +02:09=%1 bekommt so bald keine Beförderung mehr +02:09=%1 verstümmelt sich selbst +02:09=%1 mag Schmerzen +02:09=%1 ist heute auf dem falschen Bein aufgestanden +02:09=%1 schoss in die falsche Richtung +02:09=Das sah schmerzhaft aus! +02:09=%1 verwirrt den Feind +02:09=Was ist denn mit %1 los? +02:09=Keine Sorge, %1, nächstes Mal klappt’s bestimmt! +02:09=%1 ist eine Gefahr für sich selbst +02:09=%1 braucht keine Feinde mehr ; Hog (%1) shot an home run (using the bat and another hog) 02:10=Home Run! diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Locale/hedgewars_de.ts --- a/share/hedgewars/Data/Locale/hedgewars_de.ts Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Locale/hedgewars_de.ts Sat Jan 03 23:46:26 2015 +0300 @@ -275,7 +275,7 @@ %1 Please check your installation! - Ich konnte dieses Daten-Verzeichnis nicht öffnen: + Folgendes Daten-Verzeichnis konnte nicht geöffnet werden: %1 Bitte überprüfe deine Installation! @@ -1130,7 +1130,7 @@ Save - Wiederholung speichern + Speichern @@ -3456,13 +3456,15 @@ Unable to start server at %1. - Ich bin unfähig, den Server auf %1 zu starten. + Der Server konnte nicht gestartet werden. +Pfad: %1 Unable to run engine at %1 Error code: %2 - Ich bin unfähig, die Engine auf %1 laufen zu lassen. + Die Spiel-Engine konnte nicht gestartet werden. +Pfad: %1 Fehlercode: %2 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Locale/hedgewars_ru.ts --- a/share/hedgewars/Data/Locale/hedgewars_ru.ts Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Locale/hedgewars_ru.ts Sat Jan 03 23:46:26 2015 +0300 @@ -27,7 +27,7 @@ copy of %1 - + копия %1 @@ -616,11 +616,11 @@ Random perlin - + Случайная перлиновская Style: - + Стиль: @@ -690,7 +690,7 @@ Server authentication error - + Ошибка аутентификации сервера @@ -890,7 +890,7 @@ Open packages directory - + Открыть папку с пакетами @@ -945,7 +945,7 @@ Optimize - + Оптимизировать @@ -1007,10 +1007,10 @@ The best shot award was won by <b>%1</b> with <b>%2</b> pts. - + + Приз за лучший выстрел получает <b>%1</b> с <b>%2</b> пунктом урона. Приз за лучший выстрел получает <b>%1</b> с <b>%2</b> пунктами урона. - - + Приз за лучший выстрел получает <b>%1</b> с <b>%2</b> пунктами урона. @@ -1073,8 +1073,6 @@ (%1 %2) - - @@ -1096,7 +1094,7 @@ PageMain Downloadable Content - + Скачиваемые дополнения Play a game on a single computer @@ -1116,7 +1114,7 @@ Access the user created content downloadable from our website - + Доступ к скачиваемым с нашего сайта дополнениям, созданным пользователями Exit game @@ -1837,7 +1835,7 @@ Enable team tags by default - + Включить ярлыки команд по умолчанию Hog @@ -1845,7 +1843,7 @@ Enable hedgehog tags by default - + Включить ярлыки ежей по умолчанию Health @@ -1853,7 +1851,7 @@ Enable health tags by default - + Включить ярлыки уровня здоровья по умолчанию Translucent @@ -1861,7 +1859,7 @@ Enable translucent tags by default - + Включить прозрачность ярлыков по умолчанию @@ -2262,7 +2260,7 @@ Script parameter - + Параметр скрипта @@ -2429,8 +2427,6 @@ Do you really want to remove %1 file(s)? - - @@ -2623,7 +2619,7 @@ Reset - + Сбросить Set the default server port for Hedgewars @@ -2713,7 +2709,7 @@ Random Perlin - + Случайная перлиновская @@ -2763,7 +2759,7 @@ copy of %1 - + копия %1 @@ -2992,7 +2988,7 @@ speed up replay - + ускорить проигрывание @@ -3440,7 +3436,7 @@ restricted - + ограничено REMOVE_TEAM: no such team @@ -3496,7 +3492,7 @@ kicked - + выкинут Ping timeout @@ -3504,7 +3500,7 @@ bye - + пока No such room @@ -3512,7 +3508,7 @@ Joining restricted - + Вход ограничен Registered users only @@ -3528,7 +3524,7 @@ Restricted - + Ограничено Room version incompatible to your hedgewars version @@ -3552,15 +3548,15 @@ kick - + выкинуть map - + карта pause - пауза + пауза Reconnected too fast diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Locale/missions_de.txt --- a/share/hedgewars/Data/Locale/missions_de.txt Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Locale/missions_de.txt Sat Jan 03 23:46:26 2015 +0300 @@ -51,3 +51,28 @@ portal.name=Mission: Knifflige Portalherausforderung portal.desc="Benutze das Portalgerät, um dich schnell und weit zu bewegen; benutze es zum Töten; benutze es mit Vorsicht!" + +Target_Practice_-_Bazooka_easy.name=Zielübung: Bazooka (einfach) +Target_Practice_-_Bazooka_easy.desc="Nun gut, Soldat: Zerstör einfach die Zielscheiben so schnell, wie du kannst!" + +Target_Practice_-_Bazooka_hard.name=Zielübung: Bazooka (schwer) +Target_Practice_-_Bazooka_hard.desc="Kannst du die Zielscheiben treffen, auch wenn sie sehr weit weg sind?" + +Target_Practice_-_Cluster_Bomb.name=Zielübung: Splittergranate +Target_Practice_-_Cluster_Bomb.desc="Jemand braucht eine heiße Dusche!" + +Target_Practice_-_Shotgun.name=Zielübung: Schrotflinte +Target_Practice_-_Shotgun.desc="Erst schießen, dann fragen!" + +Target_Practice_-_Homing_Bee.name=Zielübung: Zielsuchende Biene +Target_Practice_-_Homing_Bee.desc="Die zielsuchende Biene zu benutzen ist kniffliger, als es aussieht!" + +Target_Practice_-_Grenade_easy.name=Zielübung: Granate (einfach) +Target_Practice_-_Grenade_easy.desc="Eine Aufwärmübung für den aufstrebenden Grenadier." + +Target_Practice_-_Grenade_hard.name=Zielübung: Granate (schwer) +Target_Practice_-_Grenade_hard.desc="Das ist nichts für Grünschnäbel! Wir werden die Zielscheiben an ein paar wirklich knifflige Stellen platzieren." + +ClimbHome.name=Herausforderung: Nach Hause klettern +ClimbHome.desc="Du bist weit von Zuhause weg und das Wasser steigt ständig. Klettere so hoch, wie du kannst!" + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Locale/missions_en.txt --- a/share/hedgewars/Data/Locale/missions_en.txt Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Locale/missions_en.txt Sat Jan 03 23:46:26 2015 +0300 @@ -1,53 +1,74 @@ -Basic_Training_-_Bazooka.name=Basic Bazooka Training -Basic_Training_-_Bazooka.desc="Using the wind to your advantage is key!" - -Basic_Training_-_Grenade.name=Basic Grenade Training -Basic_Training_-_Grenade.desc="Remember, you pull the pin out AND throw!" - -Basic_Training_-_Cluster_Bomb.name=Basic Cluster Bomb Training -Basic_Training_-_Cluster_Bomb.desc="Someone needs hot shower!" - -Basic_Training_-_Shotgun.name=Basic Shotgun Training -Basic_Training_-_Shotgun.desc="Shoot first, ask questions later!" - -Basic_Training_-_Sniper_Rifle.name=Basic Sniper Rifle Training -Basic_Training_-_Sniper_Rifle.desc="Boom, headshot!" - -Basic_Training_-_Rope.name=Basic Rope Training -Basic_Training_-_Rope.desc="Get out there and swing!" - -User_Mission_-_Dangerous_Ducklings.name=Mission: Dangerous Ducklings -User_Mission_-_Dangerous_Ducklings.desc="Alright, rookie! Time to put what we learned in Basic Training into practice!" - -User_Mission_-_Diver.name=Mission: Diver -User_Mission_-_Diver.desc="This 'amphibious assault' thing is harder than it looks..." - -User_Mission_-_Teamwork.name=Mission: Teamwork -User_Mission_-_Teamwork.desc="Sometimes, love hurts." - -User_Mission_-_Spooky_Tree.name=Mission: Spooky Tree -User_Mission_-_Spooky_Tree.desc="Lots of crates out here. I sure hope that bird ain't feeling hungry." - -User_Mission_-_Bamboo_Thicket.name=Mission: Bamboo Thicket -User_Mission_-_Bamboo_Thicket.desc="Death comes from above." - -User_Mission_-_That_Sinking_Feeling.name=Mission: That Sinking Feeling -User_Mission_-_That_Sinking_Feeling.desc="The water is rising rapidly and time is limited. Many have tried and failed. Can you save them all?" - -User_Mission_-_Newton_and_the_Hammock.name=Mission: Newton and the Hammock -User_Mission_-_Newton_and_the_Hammock.desc="Remember hoglets: The velocity of a body remains constant unless the body is acted upon by an external force!" - -User_Mission_-_The_Great_Escape.name=Mission: The Great Escape -User_Mission_-_The_Great_Escape.desc="You think you can cage me!?" - -User_Mission_-_Rope_Knock_Challenge.name=Challenge: Rope Knocking -User_Mission_-_Rope_Knock_Challenge.desc="Look behind you!" - -User_Mission_-_Nobody_Laugh.name=Mission: Nobody Laugh -User_Mission_-_Nobody_Laugh.desc="This ain't no joke." - -User_Mission_-_RCPlane_Challenge.name=Challenge: RC Plane -User_Mission_-_RCPlane_Challenge.desc="Feeling pretty confident, eh, flyboy?" - -portal.name=Mission: Portal Mind Challenge -portal.desc="Use the portal to move fast and far, use it to kill, use it with caution!" +Basic_Training_-_Bazooka.name=Basic Bazooka Training +Basic_Training_-_Bazooka.desc="Using the wind to your advantage is key!" + +Basic_Training_-_Grenade.name=Basic Grenade Training +Basic_Training_-_Grenade.desc="Remember, you pull the pin out AND throw!" + +Basic_Training_-_Cluster_Bomb.name=Basic Cluster Bomb Training +Basic_Training_-_Cluster_Bomb.desc="Someone needs hot shower!" + +Basic_Training_-_Shotgun.name=Basic Shotgun Training +Basic_Training_-_Shotgun.desc="Shoot first, ask questions later!" + +Basic_Training_-_Sniper_Rifle.name=Basic Sniper Rifle Training +Basic_Training_-_Sniper_Rifle.desc="Boom, headshot!" + +Basic_Training_-_Rope.name=Basic Rope Training +Basic_Training_-_Rope.desc="Get out there and swing!" + +User_Mission_-_Dangerous_Ducklings.name=Mission: Dangerous Ducklings +User_Mission_-_Dangerous_Ducklings.desc="Alright, rookie! Time to put what we learned in Basic Training into practice!" + +User_Mission_-_Diver.name=Mission: Diver +User_Mission_-_Diver.desc="This 'amphibious assault' thing is harder than it looks..." + +User_Mission_-_Teamwork.name=Mission: Teamwork +User_Mission_-_Teamwork.desc="Sometimes, love hurts." + +User_Mission_-_Spooky_Tree.name=Mission: Spooky Tree +User_Mission_-_Spooky_Tree.desc="Lots of crates out here. I sure hope that bird ain't feeling hungry." + +User_Mission_-_Bamboo_Thicket.name=Mission: Bamboo Thicket +User_Mission_-_Bamboo_Thicket.desc="Death comes from above." + +User_Mission_-_That_Sinking_Feeling.name=Mission: That Sinking Feeling +User_Mission_-_That_Sinking_Feeling.desc="The water is rising rapidly and time is limited. Many have tried and failed. Can you save them all?" + +User_Mission_-_Newton_and_the_Hammock.name=Mission: Newton and the Hammock +User_Mission_-_Newton_and_the_Hammock.desc="Remember hoglets: The velocity of a body remains constant unless the body is acted upon by an external force!" + +User_Mission_-_The_Great_Escape.name=Mission: The Great Escape +User_Mission_-_The_Great_Escape.desc="You think you can cage me!?" + +User_Mission_-_Rope_Knock_Challenge.name=Challenge: Rope Knocking +User_Mission_-_Rope_Knock_Challenge.desc="Look behind you!" + +User_Mission_-_Nobody_Laugh.name=Mission: Nobody Laugh +User_Mission_-_Nobody_Laugh.desc="This ain't no joke." + +User_Mission_-_RCPlane_Challenge.name=Challenge: RC Plane +User_Mission_-_RCPlane_Challenge.desc="Feeling pretty confident, eh, flyboy?" + +portal.name=Mission: Portal Mind Challenge +portal.desc="Use the portal to move fast and far, use it to kill, use it with caution!" + +Target_Practice_-_Bazooka_easy.name=Target Practice: Bazooka (easy) +Target_Practice_-_Bazooka_easy.desc="Alright, soldier, blow those targets up as fast as you can!" + +Target_Practice_-_Bazooka_hard.name=Target Practice: Bazooka (hard) +Target_Practice_-_Bazooka_hard.desc="Can you hit the targets even when they are very far away?" + +Target_Practice_-_Cluster_Bomb.name=Target Practice: Cluster Bomb +Target_Practice_-_Cluster_Bomb.desc="Someone needs hot shower!" + +Target_Practice_-_Shotgun.name=Target Practice: Shotgun +Target_Practice_-_Shotgun.desc="Shoot first, ask questions later!" + +Target_Practice_-_Homing_Bee.name=Target Practice: Homing Bee +Target_Practice_-_Homing_Bee.desc="Using the homing bee is trickier than it seems." + +Target_Practice_-_Grenade_easy.name=Target Practice: Grenade (easy) +Target_Practice_-_Grenade_easy.desc="A warm-up training for the aspiring grenadier." + +Target_Practice_-_Grenade_hard.name=Target Practice: Grenade (hard) +Target_Practice_-_Grenade_hard.desc="This is nothing for greenhorns! We will place the targets at some really tricky positions." \ No newline at end of file diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Locale/pl.txt --- a/share/hedgewars/Data/Locale/pl.txt Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Locale/pl.txt Sat Jan 03 23:46:26 2015 +0300 @@ -58,6 +58,7 @@ 00:54=Miotacz błota 00:55=Zamrażarka 00:56=Tasak +00:57=Guma 01:00=Walczmy! 01:01=Remis @@ -81,6 +82,9 @@ 01:19=Ekstremalne 01:20=%1 odbicie 01:21=Dźwięk wyciszony +01:22=Tryb AFK +01:23=Automatyczne wyłączanie kamery +01:24=Automatyczne włączanie kamery ; Event messages ; Hog (%1) died @@ -544,6 +548,7 @@ 03:54=Narzędzie 03:55=Przełammy lody! 03:56=Nie przytnij sobie igieł! +03:57=Narzędzie ; Weapon Descriptions (use | as line breaks) 04:00=Atakuj przeciwników zwykłym granatem.|Wybuchnie kiedy zapalnik skończy odliczanie.|1-5: Ustawia zapalnik|Atak: Przytrzymaj by rzucić z większą siłą @@ -604,6 +609,7 @@ 04:54=Wystrzel strumień kleistej mazi.|Buduj mosty, zasypuj wrogów, zatykaj tunele.|Uważaj by nie zasypać samego siebie! 04:55=Epoka lodowcowa powraca!!|Zamroź jeże, uczyń podłoże śliskim lub zapobiegnij|utonięciu zamrażając wodę.|Atak: Strzał 04:56=Rzuć w przeciwnika dwoma tasakami i zablokuj mu |drogę lub użyj ich do wspinaczki! Jednak uważaj! |Te tasaki są naprawdę ostre!|Atak: Przytrzymaj by rzucić z większą siłą (dwukrotnie) +04:57=Budowanie elastyczny pasek wykonany z gumy,|z których jeże i inne rzeczy|odbijają się bez obrażeń upadku.|Lewo/Prawo: Zmiana orientacji pasek gumy|Kursor: Umieść pasek gumy w aktualnej pozycji ; Game goal strings 05:00=Ustawienia gry diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/Basketball/CMakeLists.txt --- a/share/hedgewars/Data/Maps/Basketball/CMakeLists.txt Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Maps/Basketball/CMakeLists.txt Sat Jan 03 23:46:26 2015 +0300 @@ -1,8 +1,6 @@ install(FILES - map.png map.cfg map.lua - mask.png preview.png desc.txt DESTINATION ${SHAREPATH}Data/Maps/Basketball) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/Basketball/map.lua --- a/share/hedgewars/Data/Maps/Basketball/map.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Maps/Basketball/map.lua Sat Jan 03 23:46:26 2015 +0300 @@ -14,6 +14,7 @@ Explosives = 0 Delay = 500 SuddenDeathTurns = 99999 -- "disable" sudden death + Map = 'BasketballField' end function onGameStart() diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/Basketball/map.png Binary file share/hedgewars/Data/Maps/Basketball/map.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/Basketball/mask.png Binary file share/hedgewars/Data/Maps/Basketball/mask.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/BasketballField/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Maps/BasketballField/CMakeLists.txt Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,6 @@ +install(FILES + map.png + map.cfg + mask.png + preview.png + DESTINATION ${SHAREPATH}Data/Maps/BasketballField) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/BasketballField/map.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Maps/BasketballField/map.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,2 @@ +Nature +12 \ No newline at end of file diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/BasketballField/map.png Binary file share/hedgewars/Data/Maps/BasketballField/map.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/BasketballField/mask.png Binary file share/hedgewars/Data/Maps/BasketballField/mask.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/BasketballField/preview.png Binary file share/hedgewars/Data/Maps/BasketballField/preview.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/BasketballField/preview@2x.png Binary file share/hedgewars/Data/Maps/BasketballField/preview@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/CMakeLists.txt --- a/share/hedgewars/Data/Maps/CMakeLists.txt Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Maps/CMakeLists.txt Sat Jan 03 23:46:26 2015 +0300 @@ -2,6 +2,7 @@ Bamboo BambooPlinko Basketball + BasketballField Bath Battlefield Blizzard diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Maps/ClimbHome/map.lua --- a/share/hedgewars/Data/Maps/ClimbHome/map.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua Sat Jan 03 23:46:26 2015 +0300 @@ -14,6 +14,8 @@ local HH = {} local totalHedgehogs = 0 local deadHedgehogs = 0 +local currTeam = '' +local teams = {} local teamScoreStats = {} local teamBests = {} local MrMine -- in honour of sparkle's first arrival in the cabin @@ -30,7 +32,6 @@ local jokeAwardDamage = nil local recordBroken = false local ready = false --- TODO. Fix use of dummy team for scaling the graph. local showWaterStats = false -- uses the AI team to draw water height. local scaleGraph = false local dummyHog = nil @@ -57,7 +58,7 @@ dummyHog = AddHog(" ", 0, 1, "NoHat") HH[dummyHog] = nil totalHedgehogs = totalHedgehogs - 1 - if not showWaterStates then + if not showWaterStats then SendStat(siClanHealth, tostring(32640), " ") end SendStat(siClanHealth, tostring(32640), " ") @@ -68,6 +69,7 @@ if GetGearType(gear) == gtHedgehog then HH[gear] = 1 totalHedgehogs = totalHedgehogs + 1 + teams[GetHogTeamName(gear)] = 1 end end @@ -127,6 +129,7 @@ YouLost = false tauntNoo = false recordBroken = false + currTeam = GetHogTeamName(CurrentHedgehog) if CurrentHedgehog ~= nil then if CurrentHedgehog ~= dummyHog then SetGearPosition(CurrentHedgehog, 1951,32640) @@ -226,7 +229,7 @@ Cake = nil end - if Cake ~= nil and GetHealth(Cake) < 999990 and gearIsInCircle(CurrentHedgehog,cx,cy,450) then + if Cake ~= nil and GetHealth(Cake) < 999980 and gearIsInCircle(CurrentHedgehog,cx,cy,450) then FireBoom(cx,cy,200) -- todo animate DeleteGear(Cake) Cake = nil @@ -307,8 +310,6 @@ } end end - --- this block was moved out of the % 500 below because it was not triggering fast enough to give correct stats for all teams. if isSinglePlayer then if distanceFromWater < 0 and not YouLost and not YouWon then makeSinglePlayerLoserStats() @@ -351,7 +352,13 @@ if showWaterStats == true then SendStat(siClanHealth, tostring(getActualHeight(WaterLine)), " ") end - SendStat(siClanHealth, tostring(getActualHeight(y)), GetHogTeamName(CurrentHedgehog)) + for t,i in pairs(teams) do + if currTeam == t then + SendStat(siClanHealth, tostring(getActualHeight(y)), t) + else + SendStat(siClanHealth, '0', t) + end + end -- play taunts if not YouWon and not YouLost then @@ -531,7 +538,6 @@ else SendStat(siCustomAchievement, string.format(text, RecordHeightHogName)) end - SendStat(siPointType, "points") SendStat(siPlayerKills, actualHeight, loc(GetHogTeamName(CurrentHedgehog))) EndGame() end @@ -582,8 +588,8 @@ end checkAwards() for i = #ranking, 1, -1 do + SendStat(siPointType, loc("points")) SendStat(siPlayerKills, tostring(ranking[i].score), ranking[i].name) - SendStat(siPointType, "points") end end diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua --- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua Sat Jan 03 23:46:26 2015 +0300 @@ -526,7 +526,7 @@ -- bazooka - grenade - rope - parachute - deagle - btorch - construct - portal - rcplane SaveCampaignVar("HeroAmmo", GetAmmoCount(hero.gear, amBazooka)..GetAmmoCount(hero.gear, amGrenade).. GetAmmoCount(hero.gear, amRope)..GetAmmoCount(hero.gear, amParachute)..GetAmmoCount(hero.gear, amDEagle).. - GetAmmoCount(hero.gear, amBlowTorch)..GetAmmoCount(hero.gear, amConstruction).. + GetAmmoCount(hero.gear, amBlowTorch)..GetAmmoCount(hero.gear, amGirder).. GetAmmoCount(hero.gear, amPortalGun)..GetAmmoCount(hero.gear, amRCPlane)) AnimCaption(hero.gear, loc("Checkpoint reached!"), 5000) end @@ -542,7 +542,7 @@ AddAmmo(hero.gear, amBlowTorch, tonumber(ammo:sub(6,6))) -- weird, if 0 bazooka isn't displayed in the weapons menu if tonumber(ammo:sub(7,7)) > 0 then - AddAmmo(hero.gear, amConstruction, tonumber(ammo:sub(7,7))) + AddAmmo(hero.gear, amGirder, tonumber(ammo:sub(7,7))) end AddAmmo(hero.gear, amPortalGun, tonumber(ammo:sub(8,8))) AddAmmo(hero.gear, amRCPlane, tonumber(ammo:sub(9,9))) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua --- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1,186 +1,242 @@ --- Hedgewars Bazooka Training --- Scripting Example - --- Lines such as this one are comments - they are ignored --- by the game, no matter what kind of text is in there. --- It's also possible to place a comment after some real --- instruction as you see below. In short, everything --- following "--" is ignored. - ---------------------------------------------------------------- --- At first we implement the localization library using loadfile. --- This allows us to localize strings without needing to think --- about translations. --- We can use the function loc(text) to localize a string. - -HedgewarsScriptLoad("/Scripts/Locale.lua") - --- This variable will hold the number of destroyed targets. -local score = 0 --- This variable represents the number of targets to destroy. -local score_goal = 5 --- This variable controls how many milliseconds/ticks we'd --- like to wait before we end the round once all targets --- have been destroyed. -local end_timer = 1000 -- 1000 ms = 1 s --- This variable is set to true if the game is lost (i.e. --- time runs out). -local game_lost = false --- This variable will point to the hog's gear -local player = nil --- This variable will grab the time left at the end of the round -local time_goal = 0 - --- This is a custom function to make it easier to --- spawn more targets with just one line of code --- You may define as many custom functions as you --- like. -function spawnTarget() - -- add a new target gear - gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) - - -- move it to a random position within 0 and - -- LAND_WIDTH - the width of the map - FindPlace(gear, true, 0, LAND_WIDTH) - - -- move the target to a higher vertical position - -- to ensure it's not somewhere down below - x, y = GetGearPosition(gear) - SetGearPosition(gear, x, 0) -end - --- This function is called before the game loads its --- resources. --- It's one of the predefined function names that will --- be called by the game. They give you entry points --- where you're able to call your own code using either --- provided instructions or custom functions. -function onGameInit() - -- At first we have to overwrite/set some global variables - -- that define the map, the game has to load, as well as - -- other things such as the game rules to use, etc. - -- Things we don't modify here will use their default values. - - -- The base number for the random number generator - Seed = 1 - -- Game settings and rules - EnableGameFlags(gfMultiWeapon, gfOneClanMode, gfSolidLand) - -- Uncommenting this wouldn't do anything - --EnableGameFlags(gfMultiWeapon, gfOneClanMode, gfSolidLand) - -- Neither this - --DisableGameFlags(gfArtillery) - -- Uncommenting this would make the terrain damageable - --DisableGameFlags(gfSolidLand) - -- Uncommenting this would remove all flags set previously - --ClearGameFlags() - -- The time the player has to move each round (in ms) - TurnTime = 60000 - -- The frequency of crate drops - CaseFreq = 0 - -- The number of mines being placed - MinesNum = 0 - -- The number of explosives being placed - Explosives = 0 - -- The delay between each round - Delay = 0 - -- The map to be played - Map = "Bamboo" - -- The theme to be used - Theme = "Bamboo" - - -- Create the player team - AddTeam(loc("'Zooka Team"), 14483456, "Simple", "Island", "Default") - -- And add a hog to it - player = AddHog(loc("Hunter"), 0, 1, "NoHat") - SetGearPosition(player, 936, 136) -end - --- This function is called when the round starts --- it spawns the first target that has to be destroyed. --- In addition it shows the scenario goal(s). -function onGameStart() - -- Spawn the first target. - spawnTarget() - - -- Show some nice mission goals. - -- Parameters are: caption, sub caption, description, - -- extra text, icon and time to show. - -- A negative icon parameter (-n) represents the n-th weapon icon - -- A positive icon paramter (n) represents the (n+1)-th mission icon - -- A timeframe of 0 is replaced with the default time to show. - ShowMission(loc("Bazooka Training"), loc("Aiming Practice"), loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission."), -amBazooka, 0) -end - -function onNewTurn() - SetWeapon(amBazooka) -end - --- This function is called every game tick. --- Note that there are 1000 ticks within one second. --- You shouldn't try to calculate too complicated --- code here as this might slow down your game. -function onGameTick20() - -- If time's up, set the game to be lost. - -- We actually check the time to be "1 ms" as it - -- will be at "0 ms" right at the start of the game. - if TurnTimeLeft < 40 and TurnTimeLeft > 0 and score < score_goal then - game_lost = true - -- ... and show a short message. - ShowMission(loc("Bazooka Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0) - -- How about killing our poor hog due to his poor performance? - SetHealth(player, 0) - -- Just to be sure set the goal time to 1 ms - time_goal = 1 - end - -- If the goal is reached or we've lost ... - if score == score_goal or game_lost then - -- ... check to see if the time we'd like to - -- wait has passed and then ... - if end_timer == 0 then - -- ... end the game ... - EndGame() - else - -- ... or just lower the timer by 20ms. - -- Reset the time left to stop the timer - TurnTimeLeft = time_goal - end - end_timer = end_timer - 20 - end -end - --- This function is called when the game is initialized --- to request the available ammo and probabilities -function onAmmoStoreInit() - -- add an unlimited supply of bazooka ammo - SetAmmo(amBazooka, 9, 0, 0, 0) -end - --- This function is called when a new gear is added. --- We don't need it for this training, so we can --- keep it empty. --- function onGearAdd(gear) --- end - --- This function is called before a gear is destroyed. --- We use it to count the number of targets destroyed. -function onGearDelete(gear) - -- We're only interested in target gears. - if GetGearType(gear) == gtTarget then - -- Add one point to our score/counter - score = score + 1 - -- If we haven't reached the goal ... - if score < score_goal then - -- ... spawn another target. - spawnTarget() - else - if not game_lost then - -- Otherwise show that the goal was accomplished - ShowMission(loc("Bazooka Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0) - -- Also let the hogs shout "victory!" - PlaySound(sndVictory) - -- Save the time left so we may keep it. - time_goal = TurnTimeLeft - end - end - end -end +-- Hedgewars Bazooka Training +-- Scripting Example + +-- Lines such as this one are comments - they are ignored +-- by the game, no matter what kind of text is in there. +-- It's also possible to place a comment after some real +-- instruction as you see below. In short, everything +-- following "--" is ignored. + +--------------------------------------------------------------- +-- At first we implement the localization library using loadfile. +-- This allows us to localize strings without needing to think +-- about translations. +-- We can use the function loc(text) to localize a string. + +HedgewarsScriptLoad("/Scripts/Locale.lua") + +-- This variable will hold the number of destroyed targets. +local score = 0 +-- This variable represents the number of targets to destroy. +local score_goal = 5 +-- This variable controls how many milliseconds/ticks we'd +-- like to wait before we end the round once all targets +-- have been destroyed. +local end_timer = 1000 -- 1000 ms = 1 s +-- This variable is set to true if the game is lost (i.e. +-- time runs out). +local game_lost = false +-- This variable will point to the hog's gear +local player = nil +-- This variable will grab the time left at the end of the round +local time_goal = 0 +-- This variable stores the number of bazooka shots +local shots = 0 + +-- This is a custom function to make it easier to +-- spawn more targets with just one line of code +-- You may define as many custom functions as you +-- like. +function spawnTarget() + -- add a new target gear + gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) + + -- move it to a random position within 0 and + -- LAND_WIDTH - the width of the map + FindPlace(gear, true, 0, LAND_WIDTH) + + -- move the target to a higher vertical position + -- to ensure it's not somewhere down below + x, y = GetGearPosition(gear) + SetGearPosition(gear, x, 0) +end + +-- This function is called before the game loads its +-- resources. +-- It's one of the predefined function names that will +-- be called by the game. They give you entry points +-- where you're able to call your own code using either +-- provided instructions or custom functions. +function onGameInit() + -- At first we have to overwrite/set some global variables + -- that define the map, the game has to load, as well as + -- other things such as the game rules to use, etc. + -- Things we don't modify here will use their default values. + + -- The base number for the random number generator + Seed = 1 + -- Game settings and rules + EnableGameFlags(gfMultiWeapon, gfOneClanMode, gfSolidLand) + -- Uncommenting this wouldn't do anything + --EnableGameFlags(gfMultiWeapon, gfOneClanMode, gfSolidLand) + -- Neither this + --DisableGameFlags(gfArtillery) + -- Uncommenting this would make the terrain damageable + --DisableGameFlags(gfSolidLand) + -- Uncommenting this would remove all flags set previously + --ClearGameFlags() + -- The time the player has to move each round (in ms) + TurnTime = 60000 + -- The frequency of crate drops + CaseFreq = 0 + -- The number of mines being placed + MinesNum = 0 + -- The number of explosives being placed + Explosives = 0 + -- The delay between each round + Delay = 0 + -- The map to be played + Map = "Bamboo" + -- The theme to be used + Theme = "Bamboo" + + -- Create the player team + AddTeam(loc("'Zooka Team"), 14483456, "Simple", "Island", "Default") + -- And add a hog to it + player = AddHog(loc("Hunter"), 0, 1, "NoHat") + SetGearPosition(player, 936, 136) +end + +-- This function is called when the round starts +-- it spawns the first target that has to be destroyed. +-- In addition it shows the scenario goal(s). +function onGameStart() + -- Disable the graph in the stats screen, we don't need it + SendHealthStatsOff() + -- Spawn the first target. + spawnTarget() + + -- Show some nice mission goals. + -- Parameters are: caption, sub caption, description, + -- extra text, icon and time to show. + -- A negative icon parameter (-n) represents the n-th weapon icon + -- A positive icon paramter (n) represents the (n+1)-th mission icon + -- A timeframe of 0 is replaced with the default time to show. + ShowMission(loc("Bazooka Training"), loc("Aiming Practice"), loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission."), -amBazooka, 0) +end + +function onNewTurn() + SetWeapon(amBazooka) +end + +-- This function is called every game tick. +-- Note that there are 1000 ticks within one second. +-- You shouldn't try to calculate too complicated +-- code here as this might slow down your game. +function onGameTick20() + -- If time's up, set the game to be lost. + -- We actually check the time to be "1 ms" as it + -- will be at "0 ms" right at the start of the game. + if TurnTimeLeft < 40 and TurnTimeLeft > 0 and score < score_goal and not game_lost then + game_lost = true + -- ... and show a short message. + ShowMission(loc("Bazooka Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0) + -- How about killing our poor hog due to his poor performance? + SetHealth(player, 0) + -- Just to be sure set the goal time to 1 ms + time_goal = 1 + end + + if band(GetState(player), gstDrowning) == gstDrowning and game_lost == false and score < score_goal then + game_lost = true + time_goal = 1 + AddCaption(loc("You lose!"), 0xFFFFFFFF, capgrpGameState) + ShowMission(loc("Bazooka Training"), loc("Aiming practice"), loc("Oh no! You failed! Just try again."), -amSkip, 0) + end + + -- If the goal is reached or we've lost ... + if score == score_goal or game_lost then + -- ... check to see if the time we'd like to + -- wait has passed and then ... + if end_timer == 0 then + -- Let’s create some stats for the stats screen! + -- We will expose the number of hit targets hit, launched bazooka and the accuracy + + SendStat(siPointType, loc("hits")) + SendStat(siPlayerKills, tostring(score), loc("'Zooka Team")) + SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets."), score, score_goal)) + SendStat(siCustomAchievement, string.format(loc("You have launched %d bazookas."), shots)) + + -- We must avoid a division by zero + if(shots > 0) then + SendStat(siCustomAchievement, string.format(loc("Your accuracy was %.1f%%."), (score/shots)*100)) + end + if score == score_goal then + SendStat(siGameResult, "You have finished the bazooka training!") + SendStat(siCustomAchievement, string.format(loc("%.1f seconds were remaining."), (time_goal/1000), math.ceil(time_goal/12))) + end + if game_lost then + SendStat(siGameResult, "You lose!") + end + + -- Finally we end the game ... + EndGame() + else + -- ... or just lower the timer by 20ms. + -- Reset the time left to stop the timer + TurnTimeLeft = time_goal + end + end_timer = end_timer - 20 + end +end + +-- This function is called when the game is initialized +-- to request the available ammo and probabilities +function onAmmoStoreInit() + -- add an unlimited supply of bazooka ammo + SetAmmo(amBazooka, 9, 0, 0, 0) +end + +-- This function is called when a new gear is added. +-- We don't need it for this training, so we can +-- keep it empty. +-- function onGearAdd(gear) +-- end + +-- This function is called before a gear is destroyed. +-- We use it to count the number of targets destroyed. +function onGearDelete(gear) + -- We're only interested in target gears. + if GetGearType(gear) == gtTarget then + -- Add one point to our score/counter + score = score + 1 + -- If we haven't reached the goal ... + if score < score_goal then + -- ... spawn another target. + spawnTarget() + else + if not game_lost then + -- Otherwise show that the goal was accomplished + ShowMission(loc("Bazooka Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0) + -- Also let the hogs shout "victory!" + PlaySound(sndVictory) + -- Save the time left so we may keep it. + time_goal = TurnTimeLeft + end + end + end +end + +-- This function is called when a gear has been damaged. +-- We only use it to determine wheather our hog took damage in order to abort the mission. +function onGearDamage(gear, damage) + if GetGearType(gear) == gtHedgehog then + if not game_lost then + game_lost = true + AddCaption(loc("You lose!", 0xFFFFFFFF, capgrpGameState)) + ShowMission(loc("Bazooka Training") , loc("Aiming practice"), loc("Oh no! You failed! Just try again."), -amSkip, 0) + + time_goal = 1 + end + end +end + + +-- This function is called after a gear is added. +-- We use it to count the number of bazooka shots. +function onGearAdd(gear) + -- Count the number of bazooka shots for our stats + if GetGearType(gear) == gtShell then + shots = shots + 1 + end +end diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Training/Basic_Training_-_Sniper_Rifle.lua --- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Sniper_Rifle.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Sniper_Rifle.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1,312 +1,349 @@ --- Hedgewars SniperRifle Training --- Scripting Example - --- Lines such as this one are comments - they are ignored --- by the game, no matter what kind of text is in there. --- It's also possible to place a comment after some real --- instruction as you see below. In short, everything --- following "--" is ignored. - ---------------------------------------------------------------- --- At first we implement the localization library using loadfile. --- This allows us to localize strings without needing to think --- about translations. --- We can use the function loc(text) to localize a string. - -HedgewarsScriptLoad("/Scripts/Locale.lua") - --- This variable will hold the number of destroyed targets. -local score = 0 --- This variable represents the number of targets to destroy. -local score_goal = 31 --- This variable controls how many milliseconds/ticks we'd --- like to wait before we end the round once all targets --- have been destroyed. -local end_timer = 1000 -- 1000 ms = 1 s --- This variable is set to true if the game is lost (i.e. --- time runs out). -local game_lost = false --- This variable will point to the hog's gear -local player = nil --- This variable will grab the time left at the end of the round -local time_goal = 0 - -local target = nil - -local last_hit_time = 0 --- This is a custom function to make it easier to --- spawn more targets with just one line of code --- You may define as many custom functions as you --- like. -function spawnTarget(x, y) - -- add a new target gear - target = AddGear(x, y, gtTarget, 0, 0, 0, 0) - -- have the camera move to the target so the player knows where it is - FollowGear(target) -end - -function blowUp(x, y) - -- adds some TNT - gear = AddGear(x, y, gtDynamite, 0, 0, 0, 0) -end - -function onNewTurn() - SetWeapon(amSniperRifle) -end - --- This function is called before the game loads its --- resources. --- It's one of the predefined function names that will --- be called by the game. They give you entry points --- where you're able to call your own code using either --- provided instructions or custom functions. -function onGameInit() - -- At first we have to overwrite/set some global variables - -- that define the map, the game has to load, as well as - -- other things such as the game rules to use, etc. - -- Things we don't modify here will use their default values. - - -- The base number for the random number generator - Seed = 0 - -- Game settings and rules - GameFlags = gfMultiWeapon + gfOneClanMode + gfArtillery - -- The time the player has to move each round (in ms) - TurnTime = 150000 - -- The frequency of crate drops - CaseFreq = 0 - -- The number of mines being placed - MinesNum = 0 - -- The number of explosives being placed - Explosives = 0 - -- The delay between each round - Delay = 0 - -- The map to be played - Map = "Ropes" - -- The theme to be used - Theme = "City" - - -- Create the player team - AddTeam(loc("Sniperz"), 14483456, "Simple", "Island", "Default") - -- And add a hog to it - player = AddHog(loc("Hunter"), 0, 1, "Sniper") - SetGearPosition(player, 602, 1465) -end - --- This function is called when the round starts --- it spawns the first target that has to be destroyed. --- In addition it shows the scenario goal(s). -function onGameStart() - -- Spawn the first target. - spawnTarget(860,1020) - - -- Show some nice mission goals. - -- Parameters are: caption, sub caption, description, - -- extra text, icon and time to show. - -- A negative icon parameter (-n) represents the n-th weapon icon - -- A positive icon paramter (n) represents the (n+1)-th mission icon - -- A timeframe of 0 is replaced with the default time to show. - ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission."), -amSniperRifle, 0) -end - --- This function is called every game tick. --- Note that there are 1000 ticks within one second. --- You shouldn't try to calculate too complicated --- code here as this might slow down your game. -function onGameTick20() - if game_lost then - return - end - -- after a target is destroyed, show hog, then target - if (target ~= nil) and (TurnTimeLeft + 1300 < last_hit_time) then - -- move camera to the target - FollowGear(target) - elseif TurnTimeLeft + 300 < last_hit_time then - -- move camera to the hog - FollowGear(player) - end - -- If time's up, set the game to be lost. - -- We actually check the time to be "1 ms" as it - -- will be at "0 ms" right at the start of the game. - if TurnTimeLeft < 40 and TurnTimeLeft > 0 and score < score_goal then - game_lost = true - -- ... and show a short message. - ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0) - -- How about killing our poor hog due to his poor performance? - SetHealth(player, 0) - -- Just to be sure set the goal time to 1 ms - time_goal = 1 - end - -- If the goal is reached or we've lost ... - if score == score_goal or game_lost then - -- ... check to see if the time we'd like to - -- wait has passed and then ... - if end_timer == 0 then - -- ... end the game ... - EndGame() - else - -- ... or just lower the timer by 1. - -- Reset the time left to stop the timer - TurnTimeLeft = time_goal - end - end_timer = end_timer - 20 - end -end - --- This function is called when the game is initialized --- to request the available ammo and probabilities -function onAmmoStoreInit() - -- add an unlimited supply of shotgun ammo - SetAmmo(amSniperRifle, 9, 0, 0, 0) -end - --- This function is called when a new gear is added. --- We don't need it for this training, so we can --- keep it empty. --- function onGearAdd(gear) --- end - --- This function is called before a gear is destroyed. --- We use it to count the number of targets destroyed. -function onGearDelete(gear) - - if GetGearType(gear) == gtCase then - game_lost = true - return - end - - if (GetGearType(gear) == gtTarget) then - -- remember when the target was hit for adjusting the camera - last_hit_time = TurnTimeLeft - -- Add one point to our score/counter - score = score + 1 - -- If we haven't reached the goal ... - if score < score_goal then - -- ... spawn another target. - if score == 1 then - spawnTarget(1520,1350) - elseif score == 2 then - spawnTarget(1730,1040) - elseif score == 3 then - spawnTarget(2080,780) - elseif score == 4 then - AddCaption(loc("Good so far!") .. " " .. loc("Keep it up!")); - blowUp(1730,1226) - blowUp(1440,1595) - blowUp(1527,1575) - blowUp(1614,1595) - blowUp(1420,1675) - blowUp(1527,1675) - blowUp(1634,1675) - blowUp(1440,1755) - blowUp(1527,1775) - blowUp(1614,1755) - spawnTarget(1527,1667) - elseif score == 5 then - spawnTarget(1527,1667) - elseif score == 6 then - spawnTarget(2175,1300) - elseif score == 7 then - spawnTarget(2250,940) - elseif score == 8 then - spawnTarget(2665,1540) - elseif score == 9 then - spawnTarget(3040,1160) - elseif score == 10 then - spawnTarget(2930,1500) - elseif score == 11 then - AddCaption(loc("This one's tricky.")); - spawnTarget(700,720) - elseif score == 12 then - AddCaption(loc("Well done.")); - blowUp(914,1222) - blowUp(1050,1222) - blowUp(1160,1008) - blowUp(1160,1093) - blowUp(1160,1188) - blowUp(375,911) - blowUp(510,911) - blowUp(640,911) - blowUp(780,911) - blowUp(920,911) - blowUp(1060,913) - blowUp(1198,913) - spawnTarget(1200,730) - elseif score == 13 then - spawnTarget(1200,830) - elseif score == 14 then - spawnTarget(1430,450) - elseif score == 15 then - spawnTarget(796,240) - elseif score == 16 then - spawnTarget(300,10) - elseif score == 17 then - spawnTarget(2080,820) - elseif score == 18 then - AddCaption(loc("Demolition is fun!")); - blowUp(2110,920) - blowUp(2210,920) - blowUp(2200,305) - blowUp(2300,305) - blowUp(2300,400) - blowUp(2300,500) - blowUp(2300,600) - blowUp(2300,700) - blowUp(2300,800) - blowUp(2300,900) - blowUp(2401,305) - blowUp(2532,305) - blowUp(2663,305) - spawnTarget(2300,760) - elseif score == 19 then - spawnTarget(2300,760) - elseif score == 20 then - spawnTarget(2738,190) - elseif score == 21 then - spawnTarget(2590,-100) - elseif score == 22 then - AddCaption(loc("Will this ever end?")); - blowUp(2790,305) - blowUp(2930,305) - blowUp(3060,305) - blowUp(3190,305) - blowUp(3310,305) - blowUp(3393,613) - blowUp(2805,370) - blowUp(2805,500) - blowUp(2805,630) - blowUp(2805,760) - blowUp(2805,890) - blowUp(3258,370) - blowUp(3258,475) - blowUp(3264,575) - spawnTarget(3230,240) - elseif score == 23 then - spawnTarget(3230,290) - elseif score == 24 then - spawnTarget(3670,250) - elseif score == 25 then - spawnTarget(2620,-100) - elseif score == 26 then - spawnTarget(2870,300) - elseif score == 27 then - spawnTarget(3850,900) - elseif score == 28 then - spawnTarget(3780,300) - elseif score == 29 then - spawnTarget(3670,0) - elseif score == 30 then - AddCaption(loc("Last Target!")); - spawnTarget(3480,1200) - end - else - if not game_lost then - -- Otherwise show that the goal was accomplished - ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0) - -- Also let the hogs shout "victory!" - PlaySound(sndVictory) - -- Save the time left so we may keep it. - time_goal = TurnTimeLeft - end - end - end -end +-- Hedgewars SniperRifle Training +-- Scripting Example + +-- Lines such as this one are comments - they are ignored +-- by the game, no matter what kind of text is in there. +-- It's also possible to place a comment after some real +-- instruction as you see below. In short, everything +-- following "--" is ignored. + +--------------------------------------------------------------- +-- At first we implement the localization library using loadfile. +-- This allows us to localize strings without needing to think +-- about translations. +-- We can use the function loc(text) to localize a string. + +HedgewarsScriptLoad("/Scripts/Locale.lua") + +-- This variable will hold the number of destroyed targets. +local score = 0 +-- This variable will hold the number of shots from the sniper rifle +local shots = 0 +-- This variable represents the number of targets to destroy. +local score_goal = 31 +-- This variable controls how many milliseconds/ticks we'd +-- like to wait before we end the round once all targets +-- have been destroyed. +local end_timer = 1000 -- 1000 ms = 1 s +-- This variable is set to true if the game is lost (i.e. +-- time runs out). +local game_lost = false +-- This variable will point to the hog's gear +local player = nil +-- This variable will grab the time left at the end of the round +local time_goal = 0 + +local target = nil + +local last_hit_time = 0 +-- This is a custom function to make it easier to +-- spawn more targets with just one line of code +-- You may define as many custom functions as you +-- like. +function spawnTarget(x, y) + -- add a new target gear + target = AddGear(x, y, gtTarget, 0, 0, 0, 0) + -- have the camera move to the target so the player knows where it is + FollowGear(target) +end + +function blowUp(x, y) + -- adds some TNT + gear = AddGear(x, y, gtDynamite, 0, 0, 0, 0) +end + +function onNewTurn() + SetWeapon(amSniperRifle) +end + +-- This function is called before the game loads its +-- resources. +-- It's one of the predefined function names that will +-- be called by the game. They give you entry points +-- where you're able to call your own code using either +-- provided instructions or custom functions. +function onGameInit() + -- At first we have to overwrite/set some global variables + -- that define the map, the game has to load, as well as + -- other things such as the game rules to use, etc. + -- Things we don't modify here will use their default values. + + -- The base number for the random number generator + Seed = 0 + -- Game settings and rules + GameFlags = gfMultiWeapon + gfOneClanMode + gfArtillery + -- The time the player has to move each round (in ms) + TurnTime = 150000 + -- The frequency of crate drops + CaseFreq = 0 + -- The number of mines being placed + MinesNum = 0 + -- The number of explosives being placed + Explosives = 0 + -- The delay between each round + Delay = 0 + -- The map to be played + Map = "Ropes" + -- The theme to be used + Theme = "City" + + -- Create the player team + AddTeam(loc("Sniperz"), 14483456, "Simple", "Island", "Default") + -- And add a hog to it + player = AddHog(loc("Hunter"), 0, 1, "Sniper") + SetGearPosition(player, 602, 1465) +end + +-- This function is called when the round starts +-- it spawns the first target that has to be destroyed. +-- In addition it shows the scenario goal(s). +function onGameStart() + -- Disable graph in stats screen + SendHealthStatsOff() + -- Spawn the first target. + spawnTarget(860,1020) + + -- Show some nice mission goals. + -- Parameters are: caption, sub caption, description, + -- extra text, icon and time to show. + -- A negative icon parameter (-n) represents the n-th weapon icon + -- A positive icon paramter (n) represents the (n+1)-th mission icon + -- A timeframe of 0 is replaced with the default time to show. + ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission."), -amSniperRifle, 0) +end + +-- This function is called every game tick. +-- Note that there are 1000 ticks within one second. +-- You shouldn't try to calculate too complicated +-- code here as this might slow down your game. +function onGameTick20() + if game_lost then + return + end + -- after a target is destroyed, show hog, then target + if (target ~= nil) and (TurnTimeLeft + 1300 < last_hit_time) then + -- move camera to the target + FollowGear(target) + elseif TurnTimeLeft + 300 < last_hit_time then + -- move camera to the hog + FollowGear(player) + end + -- If time's up, set the game to be lost. + -- We actually check the time to be "1 ms" as it + -- will be at "0 ms" right at the start of the game. + if TurnTimeLeft < 40 and TurnTimeLeft > 0 and score < score_goal and game_lost == false then + game_lost = true + -- ... and show a short message. + AddCaption(loc("Time's up!")) + ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0) + -- and generate the stats and go to the stats screen + generateStats() + EndGame() + -- Just to be sure set the goal time to 1 ms + time_goal = 1 + end + -- If the goal is reached or we've lost ... + if score == score_goal or game_lost then + -- ... check to see if the time we'd like to + -- wait has passed and then ... + if end_timer == 0 then + -- ... end the game ... + generateStats() + EndGame() + else + -- ... or just lower the timer by 1. + -- Reset the time left to stop the timer + TurnTimeLeft = time_goal + end + end_timer = end_timer - 20 + end +end + +-- This function is called when the game is initialized +-- to request the available ammo and probabilities +function onAmmoStoreInit() + -- add an unlimited supply of shotgun ammo + SetAmmo(amSniperRifle, 9, 0, 0, 0) +end + +-- This function is called when a new gear is added. +-- We use it to count the number of shots, which we +-- in turn use to calculate the final score and stats +function onGearAdd(gear) + if GetGearType(gear) == gtSniperRifleShot then + shots = shots + 1 + end +end + +-- This function is called before a gear is destroyed. +-- We use it to count the number of targets destroyed. +function onGearDelete(gear) + + if GetGearType(gear) == gtCase then + game_lost = true + return + end + + if (GetGearType(gear) == gtTarget) then + -- remember when the target was hit for adjusting the camera + last_hit_time = TurnTimeLeft + -- Add one point to our score/counter + score = score + 1 + -- If we haven't reached the goal ... + if score < score_goal then + -- ... spawn another target. + if score == 1 then + spawnTarget(1520,1350) + elseif score == 2 then + spawnTarget(1730,1040) + elseif score == 3 then + spawnTarget(2080,780) + elseif score == 4 then + AddCaption(loc("Good so far!") .. " " .. loc("Keep it up!")); + blowUp(1730,1226) + blowUp(1440,1595) + blowUp(1527,1575) + blowUp(1614,1595) + blowUp(1420,1675) + blowUp(1527,1675) + blowUp(1634,1675) + blowUp(1440,1755) + blowUp(1527,1775) + blowUp(1614,1755) + spawnTarget(1527,1667) + elseif score == 5 then + spawnTarget(1527,1667) + elseif score == 6 then + spawnTarget(2175,1300) + elseif score == 7 then + spawnTarget(2250,940) + elseif score == 8 then + spawnTarget(2665,1540) + elseif score == 9 then + spawnTarget(3040,1160) + elseif score == 10 then + spawnTarget(2930,1500) + elseif score == 11 then + AddCaption(loc("This one's tricky.")); + spawnTarget(700,720) + elseif score == 12 then + AddCaption(loc("Well done.")); + blowUp(914,1222) + blowUp(1050,1222) + blowUp(1160,1008) + blowUp(1160,1093) + blowUp(1160,1188) + blowUp(375,911) + blowUp(510,911) + blowUp(640,911) + blowUp(780,911) + blowUp(920,911) + blowUp(1060,913) + blowUp(1198,913) + spawnTarget(1200,730) + elseif score == 13 then + spawnTarget(1200,830) + elseif score == 14 then + spawnTarget(1430,450) + elseif score == 15 then + spawnTarget(796,240) + elseif score == 16 then + spawnTarget(300,10) + elseif score == 17 then + spawnTarget(2080,820) + elseif score == 18 then + AddCaption(loc("Demolition is fun!")); + blowUp(2110,920) + blowUp(2210,920) + blowUp(2200,305) + blowUp(2300,305) + blowUp(2300,400) + blowUp(2300,500) + blowUp(2300,600) + blowUp(2300,700) + blowUp(2300,800) + blowUp(2300,900) + blowUp(2401,305) + blowUp(2532,305) + blowUp(2663,305) + spawnTarget(2300,760) + elseif score == 19 then + spawnTarget(2300,760) + elseif score == 20 then + spawnTarget(2738,190) + elseif score == 21 then + spawnTarget(2590,-100) + elseif score == 22 then + AddCaption(loc("Will this ever end?")); + blowUp(2790,305) + blowUp(2930,305) + blowUp(3060,305) + blowUp(3190,305) + blowUp(3310,305) + blowUp(3393,613) + blowUp(2805,370) + blowUp(2805,500) + blowUp(2805,630) + blowUp(2805,760) + blowUp(2805,890) + blowUp(3258,370) + blowUp(3258,475) + blowUp(3264,575) + spawnTarget(3230,240) + elseif score == 23 then + spawnTarget(3230,290) + elseif score == 24 then + spawnTarget(3670,250) + elseif score == 25 then + spawnTarget(2620,-100) + elseif score == 26 then + spawnTarget(2870,300) + elseif score == 27 then + spawnTarget(3850,900) + elseif score == 28 then + spawnTarget(3780,300) + elseif score == 29 then + spawnTarget(3670,0) + elseif score == 30 then + AddCaption(loc("Last Target!")); + spawnTarget(3480,1200) + end + else + if not game_lost then + -- Otherwise show that the goal was accomplished + ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Congratulations! You've eliminated all targets|within the allowed time frame."), 0, 0) + -- Also let the hogs shout "victory!" + PlaySound(sndVictory) + -- Save the time left so we may keep it. + time_goal = TurnTimeLeft + end + end + end +end + +-- This function calculates the final score of the player and provides some texts and +-- data for the final stats screen +function generateStats() + local accuracy = (score/shots)*100 + local end_score_targets = (score * 200) + local end_score_overall + if not game_lost then + local end_score_time = math.ceil(time_goal/5) + local end_score_accuracy = math.ceil(accuracy * 100) + end_score_overall = end_score_time + end_score_targets + end_score_accuracy + + SendStat(siGameResult, loc("You have successfully finished the sniper rifle training!")) + SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets (+%d points)."), score, score_goal, end_score_targets)) + SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots)) + SendStat(siCustomAchievement, string.format(loc("Accuracy bonus: +%d points"), end_score_accuracy)) + SendStat(siCustomAchievement, string.format(loc("You had %.2fs remaining on the clock (+%d points)."), (time_goal/1000), end_score_time)) + else + SendStat(siGameResult, loc("You lose!")) + + SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets (+%d points)."), score, score_goal, end_score_targets)) + SendStat(siCustomAchievement, string.format(loc("You have made %d shots."), shots)) + end_score_overall = end_score_targets + end + SendStat(siPlayerKills, tostring(end_score_overall), loc("Sniperz")) + SendStat(siPointType, loc("points")) +end diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Training/Target_Practice_-_Bazooka_easy.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/Target_Practice_-_Bazooka_easy.lua Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,35 @@ +HedgewarsScriptLoad("/Scripts/TargetPractice.lua") + +local params = { + ammoType = amBazooka, + gearType = gtShell, + missionTitle = "Target Practice: Bazooka (easy)", + wind = 50, + solidLand = true, + map = "Lonely_Island", + theme = "Island", + hog_x = 1439, + hog_y = 482, + hogName = loc("Zook"), + hogHat = "war_americanww2helmet", + teamName = loc("Team Zook"), + targets = { + { x = 1310, y = 756 }, + { x = 1281, y = 893 }, + { x = 1376, y = 670 }, + { x = 1725, y = 907 }, + { x = 1971, y = 914 }, + { x = 1098, y = 955 }, + { x = 1009, y = 877 }, + { x = 930, y = 711 }, + { x = 771, y = 744 }, + { x = 385, y = 405 }, + { x = 442, y = 780 }, + { x = 620, y = 639 }, + { x = 311, y = 239 }, + }, + time = 80000, + shootText = loc("You have launched %d bazookas."), +} + +TargetPracticeMission(params) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Training/Target_Practice_-_Bazooka_hard.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/Target_Practice_-_Bazooka_hard.lua Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,40 @@ +HedgewarsScriptLoad("/Scripts/TargetPractice.lua") + +local params = { + ammoType = amBazooka, + gearType = gtShell, + missionTitle = "Target Practice: Bazooka (hard)", + wind = 20, + solidLand = true, + artillery = true, + map = "SB_Grassy", + theme = "Castle", + hog_x = 2112, + hog_y = 913, + hogName = loc("Zook"), + hogHat = "war_americanww2helmet", + teamName = loc("Team Zook"), + targets = { + { x = 2660, y = 936 }, + { x = 2857, y = 629 }, + { x = 3044, y = 851 }, + { x = 3200, y = 441 }, + { x = 2931, y = 440 }, + { x = 3264, y = 370 }, + { x = 1880, y = 684 }, + { x = 1392, y = 672 }, + { x = 1587, y = 656 }, + { x = 1300, y = 840 }, + { x = 952, y = 814 }, + { x = 862, y = 634 }, + { x = 748, y = 794 }, + { x = 639, y = 548 }, + { x = 1730, y = 549 }, + { x = 1466, y = 566 }, + { x = 3716, y = 954 }, + }, + time = 180000, + shootText = loc("You have launched %d bazookas."), +} + +TargetPracticeMission(params) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Training/Target_Practice_-_Cluster_Bomb.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/Target_Practice_-_Cluster_Bomb.lua Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,33 @@ +HedgewarsScriptLoad("/Scripts/TargetPractice.lua") + +local params = { + ammoType = amClusterBomb, + gearType = gtClusterBomb, + missionTitle = "Cluster Bomb Training", + solidLand = false, + map = "Trash", + theme = "Golf", + hog_x = 756, + hog_y = 370, + hogName = loc("Private Nolak"), + hogHat = "war_desertgrenadier1", + teamName = loc("The Hogies"), + targets = { + { x = 628, y = 0 }, + { x = 891, y = 0 }, + { x = 1309, y = 0 }, + { x = 1128, y = 0 }, + { x = 410, y = 0 }, + { x = 1564, y = 0 }, + { x = 1248, y = 476 }, + { x = 169, y = 0 }, + { x = 1720, y = 0 }, + { x = 1441, y = 0 }, + { x = 599, y = 0 }, + { x = 1638, y = 0 }, + }, + time = 180000, + shootText = loc("You have thrown %d cluster bombs."), +} + +TargetPracticeMission(params) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Training/Target_Practice_-_Grenade_easy.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/Target_Practice_-_Grenade_easy.lua Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,30 @@ +HedgewarsScriptLoad("/Scripts/TargetPractice.lua") + +local params = { + ammoType = amGrenade, + gearType = gtGrenade, + missionTitle = "Target Practice: Grenade (easy)", + solidLand = true, + artillery = true, + map = "SB_Crystal", + theme = "Cave", + hog_x = 2039, + hog_y = 684, + hogName = loc("Grenadier"), + hogHat = "war_desertgrenadier2", + teamName = loc("Grenade Group"), + targets = { + { x = 1834, y = 747 }, + { x = 2308, y = 729 }, + { x = 1659, y = 718 }, + { x = 1196, y = 704 }, + { x = 2650, y = 826 }, + { x = 1450, y = 705 }, + { x = 2774, y = 848 }, + { x = 2970, y = 704 }, + }, + time = 80000, + shootText = loc("You have thrown %d grenades."), +} + +TargetPracticeMission(params) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Training/Target_Practice_-_Grenade_hard.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/Target_Practice_-_Grenade_hard.lua Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,41 @@ +HedgewarsScriptLoad("/Scripts/TargetPractice.lua") + +local params = { + ammoType = amGrenade, + gearType = gtGrenade, + missionTitle = "Target Practice: Grenade (hard)", + solidLand = true, + artillery = true, + map = "SB_Crystal", + theme = "Cave", + hog_x = 1456, + hog_y = 669, + hogName = loc("Grenadier"), + hogHat = "war_desertgrenadier2", + teamName = loc("Grenade Group"), + targets = { + { x = 1190, y = 694 }, + { x = 962, y = 680 }, + { x = 1090, y = 489 }, + { x = 1664, y = 666 }, + { x = 1584, y = 580 }, + { x = 2160, y = 738 }, + { x = 1836, y = 726 }, + { x = 618, y = 753 }, + { x = 837, y = 668 }, + { x = 2424, y = 405 }, + { x = 2310, y = 742 }, + { x = 294, y = 897 }, + { x = 472, y = 855 }, + { x = 2949, y = 724}, + { x = 3356, y = 926 }, + { x = 3734, y = 918 }, + { x = 170, y = 874 }, + + + }, + time = 180000, + shootText = loc("You have thrown %d grenades."), +} + +TargetPracticeMission(params) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Training/Target_Practice_-_Homing_Bee.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/Target_Practice_-_Homing_Bee.lua Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,35 @@ +HedgewarsScriptLoad("/Scripts/TargetPractice.lua") + +local params = { + ammoType = amBee, + gearType = gtBee, + missionTitle = "Target Practice: Homing Bee", + solidLand = true, + map = "Hedgewars", + theme = "Nature", + hog_x = 1990, + hog_y = 514, + hogHat = "NoHat", + teamGrave = "bp2", + targets = { + { x = 1949, y = 273 }, + { x = 1734, y = 322 }, + { x = 1574, y = 340 }, + { x = 1642, y = 474 }, + { x = 2006, y = 356 }, + { x = 1104, y = 285 }, + { x = 565, y = 440 }, + { x = 732, y = 350 }, + { x = 2022, y = 396 }, + { x = 366, y = 360 }, + { x = 556, y = 300 }, + { x = 902, y = 306 }, + { x = 924, y = 411 }, + { x = 227, y = 510 }, + { x = 150, y = 300 }, + }, + time = 120000, + shootText = loc("You have launched %d homing bees."), +} + +TargetPracticeMission(params) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Training/Target_Practice_-_Shotgun.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Missions/Training/Target_Practice_-_Shotgun.lua Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,38 @@ +HedgewarsScriptLoad("/Scripts/TargetPractice.lua") + +local params = { + ammoType = amShotgun, + gearType = gtShotgunShot, + missionTitle = "Target Practice: Shotgun", + solidLand = false, + map = "SB_Haunty", + theme = "Halloween", + hog_x = 320, + hog_y = 324, + hogHat = "NoHat", + hogGrave = "Bones", + targets = { + { x = 495, y = 501 }, + { x = 227, y = 530 }, + { x = 835, y = 934 }, + { x = 1075, y = 889 }, + { x = 887, y = 915 }, + { x = 1148, y = 750 }, + { x = 916, y = 915 }, + { x = 1211, y = 700 }, + { x = 443, y = 505 }, + { x = 822, y = 964 }, + { x = 1092, y = 819 }, + { x = 1301, y = 683 }, + { x = 1480, y = 661 }, + { x = 1492, y = 786 }, + { x = 1605, y = 562 }, + { x = 1545, y = 466 }, + { x = 1654, y = 392 }, + { x = 1580, y = 334 }, + { x = 1730, y = 222 }, + }, + time = 90000, +} + +TargetPracticeMission(params) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua --- a/share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1,343 +1,490 @@ -HedgewarsScriptLoad("/Scripts/Locale.lua") - -local player = nil -local RCGear = nil -local planesUsed = 0 -local cratesLeft = 0 - -function onGameInit() - - Seed = 1 - GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode + gfSolidLand - - TurnTime = 90 * 1000 - - Map = "Ropes" - Theme = "Eyes" - - CaseFreq = 0 - MinesNum = 0 - Explosives = 0 - - AddTeam(loc("Wannabe Flyboys"), 14483456, "Simple", "Island", "Default", "Hedgewars") - player = AddHog(loc("Ace"), 0, 80, "Gasmask") - SetGearPosition(player, 1380, 1500) - -end - - - -function onGameStart() - - ShowMission ( - loc("RC PLANE TRAINING"), - loc("a Hedgewars challenge"), - - loc("Collect or destroy all the health crates.") .. "|" .. - loc("Compete to use as few planes as possible!") .. "|" .. - "", -amRCPlane, 4000 - ) - - PlaceGirder(2192, 508, 6) - PlaceGirder(2192, 670, 6) - PlaceGirder(2193, 792, 2) - PlaceGirder(2100, 825, 4) - PlaceGirder(2009, 899, 6) - PlaceGirder(2084, 992, 4) - PlaceGirder(2145, 1087, 6) - PlaceGirder(2199, 1235, 5) - PlaceGirder(2308, 1296, 0) - PlaceGirder(2424, 1234, 7) - PlaceGirder(2473, 1129, 2) - PlaceGirder(2437, 1046, 1) - PlaceGirder(2409, 927, 6) - PlaceGirder(2408, 763, 6) - PlaceGirder(2404, 540, 6) - PlaceGirder(2426, 423, 3) - PlaceGirder(2550, 400, 4) - PlaceGirder(2668, 425, 1) - PlaceGirder(2707, 541, 6) - PlaceGirder(2706, 703, 6) - PlaceGirder(2705, 867, 6) - PlaceGirder(2779, 962, 4) - PlaceGirder(2894, 924, 3) - PlaceGirder(2908, 802, 6) - PlaceGirder(2907, 639, 6) - PlaceGirder(3052, 566, 4) - PlaceGirder(2971, 394, 4) - PlaceGirder(3103, 448, 7) - PlaceGirder(3047, 654, 0) - PlaceGirder(3043, 746, 6) - PlaceGirder(3265, 1583, 6) - PlaceGirder(3256, 1491, 4) - PlaceGirder(3187, 1401, 6) - PlaceGirder(3326, 1400, 6) - PlaceGirder(774, 530, 5) - PlaceGirder(922, 595, 4) - PlaceGirder(1079, 533, 7) - PlaceGirder(1139, 386, 6) - PlaceGirder(1074, 237, 5) - PlaceGirder(723, 381, 6) - PlaceGirder(781, 229, 7) - PlaceGirder(927, 746, 6) - PlaceGirder(874, 736, 0) - PlaceGirder(982, 737, 0) - PlaceGirder(2430, 1730, 4) - - PlaceGirder(1613, 1104, 7) - PlaceGirder(1564, 1256, 6) - PlaceGirder(1643, 1341, 5) - PlaceGirder(1780, 1372, 4) - PlaceGirder(1869, 1296, 7) - PlaceGirder(1858, 1163, 5) - PlaceGirder(1739, 1044, 5) - PlaceGirder(1621, 926, 5) - PlaceGirder(1597, 985, 5) - PlaceGirder(1449, 939, 4) - PlaceGirder(1473, 874, 4) - PlaceGirder(2092, 1352, 7) - PlaceGirder(2145, 1444, 7) - PlaceGirder(2004, 1443, 3) - PlaceGirder(1978, 1523, 2) - PlaceGirder(2021, 1596, 1) - PlaceGirder(2103, 1625, 0) - PlaceGirder(2208, 1551, 7) - PlaceGirder(2327, 1431, 7) - PlaceGirder(2395, 1478, 6) - PlaceGirder(2396, 1600, 2) - PlaceGirder(2495, 1285, 6) - PlaceGirder(2494, 1408, 2) - PlaceGirder(2547, 530, 0) - - PlaceGirder(2451, 1551, 0) - PlaceGirder(2551, 706, 6) - PlaceGirder(2551, 869, 6) - PlaceGirder(2623, 1016, 5) - PlaceGirder(2773, 1083, 4) - PlaceGirder(2924, 1019, 7) - PlaceGirder(2568, 1491, 7) - PlaceGirder(2618, 1346, 6) - PlaceGirder(2674, 1195, 7) - PlaceGirder(2822, 1142, 4) - PlaceGirder(2963, 1069, 7) - PlaceGirder(3067, 938, 5) - PlaceGirder(2803, 1373, 2) - PlaceGirder(2811, 1559, 2) - - tempG = SpawnHealthCrate(930, 557) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(979, 692) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(876, 703) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2309, 1260) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(1733, 1127) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(1738, 1320) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(3249, 1460) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(3051, 617) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2972, 353) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2548, 358) - - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2090, 1580) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(1752, 1753) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(1865, 1758) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(1985, 1760) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2429, 1760) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2810, 1480) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2800, 1277) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2806, 1107) - SetHealth(tempG, 25) - - PlaceGirder(1897, 903, 6) - PlaceGirder(1916, 784, 3) - PlaceGirder(2010, 732, 4) - PlaceGirder(2082, 639, 6) - PlaceGirder(2081, 516, 2) - PlaceGirder(1985, 487, 4) - PlaceGirder(1862, 407, 5) - PlaceGirder(1855, 224, 7) - PlaceGirder(2006, 163, 4) - PlaceGirder(2128, 187, 1) - PlaceGirder(2251, 213, 4) - PlaceGirder(2413, 213, 4) - PlaceGirder(1952, 618, 0) - PlaceGirder(957, 1068, 4) - PlaceGirder(794, 1069, 4) - PlaceGirder(728, 1163, 6) - PlaceGirder(728, 1287, 2) - PlaceGirder(802, 1342, 4) - PlaceGirder(966, 1342, 4) - PlaceGirder(674, 1032, 1) - PlaceGirder(554, 1011, 4) - PlaceGirder(445, 1056, 3) - PlaceGirder(422, 1174, 6) - PlaceGirder(369, 1341, 5) - PlaceGirder(495, 1313, 5) - PlaceGirder(568, 1379, 3) - PlaceGirder(577, 1202, 2) - PlaceGirder(744, 1490, 5) - PlaceGirder(760, 1617, 7) - PlaceGirder(622, 1693, 4) - PlaceGirder(476, 1623, 5) - PlaceGirder(376, 1697, 1) - PlaceGirder(955, 1746, 2) - PlaceGirder(1025, 1746, 2) - PlaceGirder(1090, 1745, 2) - PlaceGirder(1156, 1746, 2) - PlaceGirder(3806, 1530, 2) - PlaceGirder(3880, 1464, 2) - PlaceGirder(3738, 1458, 2) - PlaceGirder(3806, 1390, 2) - PlaceGirder(3805, 1588, 0) - PlaceGirder(3676, 1609, 3) - PlaceGirder(3930, 1615, 1) - PlaceGirder(3719, 1295, 0) - PlaceGirder(3888, 1294, 0) - PlaceGirder(3661, 1385, 2) - PlaceGirder(3955, 1377, 2) - PlaceGirder(3982, 1518, 0) - PlaceGirder(3378, 440, 2) - PlaceGirder(3447, 492, 4) - PlaceGirder(3564, 529, 1) - PlaceGirder(3596, 647, 6) - PlaceGirder(3521, 740, 4) - PlaceGirder(3524, 838, 4) - PlaceGirder(3644, 819, 3) - PlaceGirder(3691, 708, 6) - PlaceGirder(3690, 545, 6) - PlaceGirder(3612, 433, 5) - PlaceGirder(3463, 383, 4) - PlaceGirder(2815, 122, 7) - PlaceGirder(2960, 72, 4) - PlaceGirder(3032, 123, 2) - PlaceGirder(3063, 174, 0) - PlaceGirder(3095, 124, 2) - PlaceGirder(3169, 71, 4) - PlaceGirder(3320, 124, 5) - PlaceGirder(3210, 179, 2) - PlaceGirder(2932, 181, 2) - - tempG = SpawnHealthCrate(3804, 1461) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(3269, 1742) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(3066, 121) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(3207, 104) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2928, 103) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(1997, 202) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2253, 159) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2132, 774) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(2549, 490) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(3527, 694) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(3777, 78) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(1124, 1746) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(1056, 1740) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(993, 1742) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(799, 1298) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(577, 1126) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(596, 1463) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(3854, 1043) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(1944, 567) - SetHealth(tempG, 25) - tempG = SpawnHealthCrate(338, 1748) - SetHealth(tempG, 25) - - -end - ---function onGameTick() - - --if RCGear ~= nil then - -- AddCaption(GetTimer(RCGear)) - --end - ---end - -function onNewTurn() - TurnTimeLeft = -1 -end - -function onGearAdd(gear) - - if GetGearType(gear) == gtRCPlane then - RCGear = gear - planesUsed = planesUsed + 1 - end - - if GetGearType(gear) == gtCase then - cratesLeft = cratesLeft + 1 - end - -end - -function onGearDelete(gear) - - if GetGearType(gear) == gtRCPlane then - - RCGear = nil - AddCaption(loc("Planes Used:") .. " " .. planesUsed) - - elseif GetGearType(gear) == gtCase then - - AddCaption(loc("Crates Left:") .. " " .. cratesLeft) - cratesLeft = cratesLeft - 1 - - if cratesLeft == 0 then - - if planesUsed == 1 then - AddCaption(loc("Achievement Unlocked") .. ": " .. loc("Prestigious Pilot"),0xffba00ff,capgrpMessage2) - end - - ShowMission ( - loc("CHALLENGE COMPLETE"), - loc("Congratulations!"), - loc("Planes Used") .. ": " .. planesUsed .. "|" .. - "", 0, 0 - ) - - - - DismissTeam(loc("Wannabe Flyboys")) - end - - if RCGear ~= nil then - SetTimer(RCGear, GetTimer(RCGear) + 10000) - end - - end - -end - -function onAmmoStoreInit() - SetAmmo(amRCPlane, 9, 0, 0, 0) -end +HedgewarsScriptLoad("/Scripts/Locale.lua") + +local player = nil +local RCGear = nil +local planesUsed = 0 +local planeTimer = 0 +local planeUhOh = false +local cratesLeft = 0 +local crateStreak = 0 +local longestCrateStreak = 0 +local commentTimer = 0 +local missiles = 0 +local totalMissiles = 0 +local missileScanTimer = 0 +local nextComment = sndNone + +function onGameInit() + + Seed = 1 + GameFlags = gfInfAttack + gfInvulnerable + gfOneClanMode + gfSolidLand + + TurnTime = 90 * 1000 + + Map = "Ropes" + Theme = "Eyes" + + CaseFreq = 0 + MinesNum = 0 + Explosives = 0 + + AddTeam(loc("Wannabe Flyboys"), 14483456, "Simple", "Island", "Default", "Hedgewars") + player = AddHog(loc("Ace"), 0, 80, "Gasmask") + SetGearPosition(player, 1380, 1500) + +end + + + +function onGameStart() + + SendHealthStatsOff() + + ShowMission ( + loc("RC PLANE TRAINING"), + loc("a Hedgewars challenge"), + + loc("Collect or destroy all the health crates.") .. "|" .. + loc("Compete to use as few planes as possible!") .. "|" .. + "", -amRCPlane, 4000 + ) + + PlaceGirder(2192, 508, 6) + PlaceGirder(2192, 670, 6) + PlaceGirder(2193, 792, 2) + PlaceGirder(2100, 825, 4) + PlaceGirder(2009, 899, 6) + PlaceGirder(2084, 992, 4) + PlaceGirder(2145, 1087, 6) + PlaceGirder(2199, 1235, 5) + PlaceGirder(2308, 1296, 0) + PlaceGirder(2424, 1234, 7) + PlaceGirder(2473, 1129, 2) + PlaceGirder(2437, 1046, 1) + PlaceGirder(2409, 927, 6) + PlaceGirder(2408, 763, 6) + PlaceGirder(2404, 540, 6) + PlaceGirder(2426, 423, 3) + PlaceGirder(2550, 400, 4) + PlaceGirder(2668, 425, 1) + PlaceGirder(2707, 541, 6) + PlaceGirder(2706, 703, 6) + PlaceGirder(2705, 867, 6) + PlaceGirder(2779, 962, 4) + PlaceGirder(2894, 924, 3) + PlaceGirder(2908, 802, 6) + PlaceGirder(2907, 639, 6) + PlaceGirder(3052, 566, 4) + PlaceGirder(2971, 394, 4) + PlaceGirder(3103, 448, 7) + PlaceGirder(3047, 654, 0) + PlaceGirder(3043, 746, 6) + PlaceGirder(3265, 1583, 6) + PlaceGirder(3256, 1491, 4) + PlaceGirder(3187, 1401, 6) + PlaceGirder(3326, 1400, 6) + PlaceGirder(774, 530, 5) + PlaceGirder(922, 595, 4) + PlaceGirder(1079, 533, 7) + PlaceGirder(1139, 386, 6) + PlaceGirder(1074, 237, 5) + PlaceGirder(723, 381, 6) + PlaceGirder(781, 229, 7) + PlaceGirder(927, 746, 6) + PlaceGirder(874, 736, 0) + PlaceGirder(982, 737, 0) + PlaceGirder(2430, 1730, 4) + + PlaceGirder(1613, 1104, 7) + PlaceGirder(1564, 1256, 6) + PlaceGirder(1643, 1341, 5) + PlaceGirder(1780, 1372, 4) + PlaceGirder(1869, 1296, 7) + PlaceGirder(1858, 1163, 5) + PlaceGirder(1739, 1044, 5) + PlaceGirder(1621, 926, 5) + PlaceGirder(1597, 985, 5) + PlaceGirder(1449, 939, 4) + PlaceGirder(1473, 874, 4) + PlaceGirder(2092, 1352, 7) + PlaceGirder(2145, 1444, 7) + PlaceGirder(2004, 1443, 3) + PlaceGirder(1978, 1523, 2) + PlaceGirder(2021, 1596, 1) + PlaceGirder(2103, 1625, 0) + PlaceGirder(2208, 1551, 7) + PlaceGirder(2327, 1431, 7) + PlaceGirder(2395, 1478, 6) + PlaceGirder(2396, 1600, 2) + PlaceGirder(2495, 1285, 6) + PlaceGirder(2494, 1408, 2) + PlaceGirder(2547, 530, 0) + + PlaceGirder(2451, 1551, 0) + PlaceGirder(2551, 706, 6) + PlaceGirder(2551, 869, 6) + PlaceGirder(2623, 1016, 5) + PlaceGirder(2773, 1083, 4) + PlaceGirder(2924, 1019, 7) + PlaceGirder(2568, 1491, 7) + PlaceGirder(2618, 1346, 6) + PlaceGirder(2674, 1195, 7) + PlaceGirder(2822, 1142, 4) + PlaceGirder(2963, 1069, 7) + PlaceGirder(3067, 938, 5) + PlaceGirder(2803, 1373, 2) + PlaceGirder(2811, 1559, 2) + + tempG = SpawnHealthCrate(930, 557) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(979, 692) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(876, 703) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2309, 1260) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1733, 1127) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1738, 1320) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3249, 1460) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3051, 617) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2972, 353) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2548, 358) + + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2090, 1580) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1752, 1753) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1865, 1758) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1985, 1760) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2429, 1760) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2810, 1480) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2800, 1277) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2806, 1107) + SetHealth(tempG, 25) + + PlaceGirder(1897, 903, 6) + PlaceGirder(1916, 784, 3) + PlaceGirder(2010, 732, 4) + PlaceGirder(2082, 639, 6) + PlaceGirder(2081, 516, 2) + PlaceGirder(1985, 487, 4) + PlaceGirder(1862, 407, 5) + PlaceGirder(1855, 224, 7) + PlaceGirder(2006, 163, 4) + PlaceGirder(2128, 187, 1) + PlaceGirder(2251, 213, 4) + PlaceGirder(2413, 213, 4) + PlaceGirder(1952, 618, 0) + PlaceGirder(957, 1068, 4) + PlaceGirder(794, 1069, 4) + PlaceGirder(728, 1163, 6) + PlaceGirder(728, 1287, 2) + PlaceGirder(802, 1342, 4) + PlaceGirder(966, 1342, 4) + PlaceGirder(674, 1032, 1) + PlaceGirder(554, 1011, 4) + PlaceGirder(445, 1056, 3) + PlaceGirder(422, 1174, 6) + PlaceGirder(369, 1341, 5) + PlaceGirder(495, 1313, 5) + PlaceGirder(568, 1379, 3) + PlaceGirder(577, 1202, 2) + PlaceGirder(744, 1490, 5) + PlaceGirder(760, 1617, 7) + PlaceGirder(622, 1693, 4) + PlaceGirder(476, 1623, 5) + PlaceGirder(376, 1697, 1) + PlaceGirder(955, 1746, 2) + PlaceGirder(1025, 1746, 2) + PlaceGirder(1090, 1745, 2) + PlaceGirder(1156, 1746, 2) + PlaceGirder(3806, 1530, 2) + PlaceGirder(3880, 1464, 2) + PlaceGirder(3738, 1458, 2) + PlaceGirder(3806, 1390, 2) + PlaceGirder(3805, 1588, 0) + PlaceGirder(3676, 1609, 3) + PlaceGirder(3930, 1615, 1) + PlaceGirder(3719, 1295, 0) + PlaceGirder(3888, 1294, 0) + PlaceGirder(3661, 1385, 2) + PlaceGirder(3955, 1377, 2) + PlaceGirder(3982, 1518, 0) + PlaceGirder(3378, 440, 2) + PlaceGirder(3447, 492, 4) + PlaceGirder(3564, 529, 1) + PlaceGirder(3596, 647, 6) + PlaceGirder(3521, 740, 4) + PlaceGirder(3524, 838, 4) + PlaceGirder(3644, 819, 3) + PlaceGirder(3691, 708, 6) + PlaceGirder(3690, 545, 6) + PlaceGirder(3612, 433, 5) + PlaceGirder(3463, 383, 4) + PlaceGirder(2815, 122, 7) + PlaceGirder(2960, 72, 4) + PlaceGirder(3032, 123, 2) + PlaceGirder(3063, 174, 0) + PlaceGirder(3095, 124, 2) + PlaceGirder(3169, 71, 4) + PlaceGirder(3320, 124, 5) + PlaceGirder(3210, 179, 2) + PlaceGirder(2932, 181, 2) + + tempG = SpawnHealthCrate(3804, 1461) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3269, 1742) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3066, 121) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3207, 104) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2928, 103) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1997, 202) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2253, 159) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2132, 774) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(2549, 490) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3527, 694) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3777, 78) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1124, 1746) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1056, 1740) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(993, 1742) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(799, 1298) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(577, 1126) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(596, 1463) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(3854, 1043) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(1944, 567) + SetHealth(tempG, 25) + tempG = SpawnHealthCrate(338, 1748) + SetHealth(tempG, 25) + + +end + +--function onGameTick() + + --if RCGear ~= nil then + -- AddCaption(GetTimer(RCGear)) + --end + +--end + +function onGameTick20() + if RCGear ~= nil then + if(GetTimer(RCGear) < 3000 and planeUhOh == false) then + PlaySound(sndUhOh, player) + planeUhOh = true + end + planeTimer = planeTimer + 20 + end + if commentTimer > 0 then + commentTimer = commentTimer - 20 + elseif(nextComment ~= sndNone) then + PlaySound(nextComment, player) + nextComment = sndNone + end + if missileScanTimer > 0 then + missileScanTimer = missileScanTimer - 20 + else + if crateStreak == 0 and missiles == 3 then + PlaySound(sndMissed, player) + missiles = 4 + end + end +end + +function onNewTurn() + TurnTimeLeft = -1 +end + +function onGearAdd(gear) + + if GetGearType(gear) == gtRCPlane then + RCGear = gear + planesUsed = planesUsed + 1 + planeTimer = 0 + missiles = 0 + end + + if GetGearType(gear) == gtCase then + cratesLeft = cratesLeft + 1 + end + + if GetGearType(gear) == gtAirBomb then + totalMissiles = totalMissiles + 1 + end +end + +function onGearDelete(gear) + + if GetGearType(gear) == gtRCPlane then + + RCGear = nil + planeUhOh = false + missiles = 0 + AddCaption(string.format(loc("Planes used: %d"), planesUsed)) + + if(planeTimer < 2000 and crateStreak == 0) then + nextComment = sndStupid + commentTimer = math.min(2000-planeTimer, 800) + elseif(planeTimer < 5000 and crateStreak == 0) then + PlaySound(sndOops, player) + elseif(planesUsed == 72) then + PlaySound(sndStupid, player) + elseif(planesUsed == 50) then + PlaySound(sndNutter, player) + elseif(planesUsed == 30) then + PlaySound(sndOops, player) + end + + crateStreak = 0 + + elseif GetGearType(gear) == gtAirBomb then + missiles = missiles + 1 + missileScanTimer = 500 + + elseif GetGearType(gear) == gtCase then + + cratesLeft = cratesLeft - 1 + crateStreak = crateStreak + 1 + if(crateStreak > longestCrateStreak) then + longestCrateStreak = crateStreak + end + + AddCaption(string.format(loc("Crates left: %d"), cratesLeft)) + + if cratesLeft == 0 then + + local rank = "unknown" + local color = 0xFFFFFFFF + local sound = sndVictory + if planesUsed >= 156 then + rank = loc("Destroyer of planes") + color = 0xD06700FF + sound = sndLaugh + elseif planesUsed >= 98 then + rank = loc("Hopeless case") + color = 0xFF0000FF + elseif planesUsed >= 72 then + rank = loc("Drunk greenhorn") + color = 0xFF0040FF + elseif planesUsed >= 50 then + rank = loc("Greenhorn") -- a.k.a. "absolute beginner" + color = 0xFF0080FF + elseif planesUsed >= 39 then + rank = loc("Beginner") + color = 0xFF00BFFF + elseif planesUsed >= 30 then + rank = loc("Experienced beginner") + color = 0xFF00CCFF + elseif planesUsed >= 21 then + rank = loc("Below-average pilot") + color = 0xFF00FFFF + elseif planesUsed >= 17 then + rank = loc("Average pilot") + color = 0xBF00FFFF + elseif planesUsed >= 13 then + rank = loc("Above-average pilot") + color = 0x8000FFFF + elseif planesUsed >= 8 then + rank = loc("Professional pilot") + color = 0x4000FFFF + elseif planesUsed >= 5 then + rank = loc("Professional stunt pilot") + color = 0x0000FFFF + elseif planesUsed >= 3 then + rank = loc("Elite pilot") + color = 0x0040FFFF + elseif planesUsed == 2 then + rank = loc("Upper-class elite pilot") + color = 0x0080FFFF + elseif planesUsed == 1 then + rank = loc("Top-class elite pilot") + color = 0x00FFFFFF + sound = sndFlawless + else + rank = loc("Cheater") + color = 0xFF0000FF + sound = sndCoward + end + AddCaption(string.format(loc("Rank: %s"), rank), color, capgrpMessage2) + SendStat(siCustomAchievement, string.format(loc("Your rank: %s"), rank)) + if planesUsed == 1 then + AddCaption(loc("Flawless victory!")) + SendStat(siGameResult, loc("You have perfectly beaten the challenge!")) + SendStat(siCustomAchievement, loc("You have used only 1 RC plane. Outstanding!")) + else + AddCaption(loc("Victory!")) + SendStat(siGameResult, loc("You have finished the challenge!")) + SendStat(siCustomAchievement, string.format(loc("You have used %d RC planes."), planesUsed)) + end + + if(totalMissiles > 1) then + SendStat(siCustomAchievement, string.format(loc("You have dropped %d missiles."), totalMissiles)) + end + + if(longestCrateStreak > 5) then + if(planesUsed == 1) then + SendStat(siCustomAchievement, string.format(loc("In your best (and only) flight you took out %d crates with one RC plane!"), longestCrateStreak)) + else + SendStat(siCustomAchievement, string.format(loc("In your best flight you took out %d crates with one RC plane."), longestCrateStreak)) + end + end + + if(planesUsed == 2) then + SendStat(siCustomAchievement, loc("This was an awesome performance! But this challenge can be finished with even just one RC plane. Can you figure out how?")) + end + if(planesUsed == 1) then + SendStat(siCustomAchievement, loc("Congratulations! You have truly mastered this challenge! Don't forget to save the demo.")) + SendStat(siCustomAchievement, string.format(loc("You have gained an achievement: %s"), loc("Prestigious Pilot"))) + end + + ShowMission ( + loc("CHALLENGE COMPLETE"), + loc("Congratulations!"), + string.format(loc("Planes used: %d"), planesUsed) .. "|" .. + "", 0, 0 + ) + SetState(player, gstWinner) + PlaySound(sound, player) + + + DismissTeam(loc("Wannabe Flyboys")) + EndGame() + end + + if RCGear ~= nil then + SetTimer(RCGear, GetTimer(RCGear) + 10000) + end + end + +end + +function onAmmoStoreInit() + SetAmmo(amRCPlane, 9, 0, 0, 0) +end \ No newline at end of file diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/Draw.lua --- a/share/hedgewars/Data/Scripts/Draw.lua Thu Dec 18 00:03:53 2014 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -local PointsBuffer = '' -- A string to accumulate points in - -function AddPoint(x, y, width, erase) - PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) - if width then - width = bor(width,0x80) - if erase then - width = bor(width,0x40) - end - PointsBuffer = PointsBuffer .. string.char(width) - else - PointsBuffer = PointsBuffer .. string.char(0) - end - if #PointsBuffer > 245 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end -end - -function FlushPoints() - if #PointsBuffer > 0 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end -end diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.hwp Binary file share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.hwp has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1070,12 +1070,12 @@ {amLowGravity, "amLowGravity", 0, loc("Low Gravity"), 4*placeholder}, {amExtraDamage, "amExtraDamage", 0, loc("Extra Damage"), 6*placeholder}, - {amExtraTime, "amExtraTime", 0, loc("Extra Time"), 8*placeholder}, + {amExtraTime, "amExtraTime", 0, loc("Extra Time"), 8*placeholder} - {amResurrector, "amResurrector", 0, loc("Resurrector"), 8*placeholder}, - {amTardis, "amTardis", 0, loc("Tardis"), 2*placeholder}, + --{amResurrector, "amResurrector", 0, loc("Resurrector"), 8*placeholder}, + --{amTardis, "amTardis", 0, loc("Tardis"), 2*placeholder}, - {amSwitch, "amSwitch", 0, loc("Switch Hog"), 4*placeholder} + --{amSwitch, "amSwitch", 0, loc("Switch Hog"), 4*placeholder} } ---------------------------- @@ -1345,7 +1345,11 @@ placedCount = placedCount + 1 else - AddCaption("Invalid Placement",0xffba00ff,capgrpVolume) + if (clanPower[GetHogClan(CurrentHedgehog)] >= placedExpense) then + AddCaption(loc("Invalid Placement"),0xffba00ff,capgrpVolume) + else + AddCaption(loc("Insufficient Power"),0xffba00ff,capgrpVolume) + end PlaySound(sndDenied) end diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/Multiplayer/DiagonalMaze.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/DiagonalMaze.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Scripts/Multiplayer/DiagonalMaze.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1,4 +1,3 @@ -HedgewarsScriptLoad("/Scripts/Draw.lua") function onPreviewInit() onGameInit() diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/Multiplayer/Gravity.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/Gravity.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Scripts/Multiplayer/Gravity.lua Sat Jan 03 23:46:26 2015 +0300 @@ -17,7 +17,12 @@ function grav_onNewTurn() - SetGravity(gravity) + if delta ~= nil and period == nil then + SetGravity(gravity) + else + SetGravity(div(gravity, mln)) + end + wdGameTicks = GameTime if script2_onNewTurn ~= nil then diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1,7 +1,5 @@ ObjectList = {} -HedgewarsScriptLoad("/Scripts/Draw.lua") - -- Overall padding for roping freedom Padding = 430 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua Sat Jan 03 23:46:26 2015 +0300 @@ -290,7 +290,6 @@ local chainLength = 0 local shotsFired = 0 local shotsHit = 0 -local SurfTime = 0 local sniperHits = 0 local pointBlankHits = 0 --------------------- @@ -1105,7 +1104,6 @@ pointBlankHits = 0 chainLength = 0 chainCounter = 0 - SurfTime = 12 ------------------------- -- gaudy racer @@ -1160,6 +1158,19 @@ end +function onGearWaterSkip(gear) + if gear == CurrentHedgehog then + + for i = 0,(TeamsCount-1) do + if teamClan[i] == GetHogClan(CurrentHedgehog) and (teamSurfer[i] == false) then + teamSurfer[i] = true + AddCaption(loc("Surfer! +15 points!"),0xffba00ff,capgrpVolume) + AwardPoints(15) + end + end + + end +end function onGameTick() @@ -1328,30 +1339,6 @@ -------------- -------------- - ------------------------ - -- surfer achievement - ------------------------ - - if (WaterLine - GetY(CurrentHedgehog)) < 15 then - SurfTime = SurfTime -1 - end - - if SurfTime ~= 12 then - - SurfTime = SurfTime - 1 - if SurfTime <= 0 then - for i = 0,(TeamsCount-1) do - if teamClan[i] == GetHogClan(CurrentHedgehog) and (teamSurfer[i] == false) then - teamSurfer[i] = true - SurfTime = 12 - AddCaption(loc("Surfer! +15 points!"),0xffba00ff,capgrpVolume) - AwardPoints(15) - end - end - end - end - - dx, dy = GetGearVelocity(CurrentHedgehog) --WriteLnToConsole("I just got the velocity of currenthedgehog. It is dx: " .. dx .. "; dy: " .. dy) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua Sat Jan 03 23:46:26 2015 +0300 @@ -481,7 +481,7 @@ --AddCaption("don't load any map") elseif mapID == "1" then - --testmap1 + --simple testmap ------ GIRDER LIST ------ PlaceSprite(306, 530, sprAmGirder, 7, lfNormal) PlaceSprite(451, 474, sprAmGirder, 4, lfNormal) @@ -574,12 +574,6 @@ PlaceSprite(3649, 1275, sprAmGirder, 2, lfNormal) PlaceSprite(3514, 1750, sprAmGirder, 0, lfNormal) - ------ RUBBER BAND LIST ------ - - ------ LAND SPRITE LIST ------ - - ------ HEALTH CRATE LIST ------ - ------ AMMO CRATE LIST ------ tempG = SpawnAmmoCrate(1707, 1755, amBazooka) tempG = SpawnAmmoCrate(3983, 1873, amBazooka) @@ -609,7 +603,7 @@ elseif mapID == "2" then - -- land flags test map + -- simple land flags test map ------ GIRDER LIST ------ PlaceSprite(335, 622, sprAmGirder, 16,16384) PlaceSprite(474, 569, sprAmGirder, 13,16384) @@ -642,14 +636,208 @@ ------ AMMO CRATE LIST ------ tempG = SpawnAmmoCrate(472, 711, amBazooka) - tempG = SpawnUtilityCrate(540, 660, amParachute) - tempG = SpawnAmmoCrate(1155, 528, amBazooka) ------ UTILITY CRATE LIST ------ tempG = SpawnUtilityCrate(2006, 1102, amRope) + elseif mapID == "3" then + + -- more detailed landflag test map + ------ GIRDER LIST ------ + PlaceSprite(396, 665, sprAmGirder, 1,0) + PlaceSprite(619, 665, sprAmGirder, 3,0) + PlaceSprite(696, 635, sprAmGirder, 0,0) + PlaceSprite(319, 637, sprAmGirder, 0,0) + PlaceSprite(268, 604, sprAmGirder, 2,0) + PlaceSprite(746, 603, sprAmGirder, 2,0) + PlaceSprite(325, 495, sprAmGirder, 7,0) + PlaceSprite(689, 493, sprAmGirder, 5,0) + PlaceSprite(504, 422, sprAmGirder, 6,0) + PlaceSprite(595, 422, sprAmGirder, 4,0) + PlaceSprite(412, 422, sprAmGirder, 4,0) + PlaceSprite(320, 696, sprAmGirder, 4,0) + PlaceSprite(249, 786, sprAmGirder, 6,0) + PlaceSprite(249, 948, sprAmGirder, 6,0) + PlaceSprite(191, 785, sprAmGirder, 6,0) + PlaceSprite(191, 946, sprAmGirder, 6,0) + PlaceSprite(191, 1107, sprAmGirder, 6,0) + PlaceSprite(249, 1109, sprAmGirder, 6,0) + PlaceSprite(130, 1251, sprAmGirder, 7,0) + PlaceSprite(306, 1251, sprAmGirder, 5,0) + PlaceSprite(72, 1360, sprAmGirder, 2,0) + PlaceSprite(364, 1360, sprAmGirder, 2,0) + PlaceSprite(132, 1462, sprAmGirder, 5,0) + PlaceSprite(304, 1463, sprAmGirder, 7,0) + PlaceSprite(182, 1616, sprAmGirder, 6,0) + PlaceSprite(255, 1613, sprAmGirder, 6,0) + PlaceSprite(217, 1796, sprAmGirder, 4,0) + PlaceSprite(221, 1381, sprAmGirder, 0,0)-- + PlaceSprite(154, 669, sprAmGirder, 1,0) + PlaceSprite(124, 553, sprAmGirder, 6,0) + PlaceSprite(326, 467, sprAmGirder, 3,0) + PlaceSprite(223, 592, sprAmGirder, 3,0) + + PlaceSprite(638, 791, sprAmGirder, 5,0) + PlaceSprite(752, 907, sprAmGirder, 5,0) + PlaceSprite(866, 1022, sprAmGirder, 5,0) + PlaceSprite(402, 1863, sprAmGirder, 18,2048) + PlaceSprite(442, 1863, sprAmGirder, 22,2048) + PlaceSprite(2067, 1945, sprAmGirder, 15,16384) + PlaceSprite(2005, 1797, sprAmGirder, 14,16384) + PlaceSprite(1943, 1653, sprAmGirder, 15,16384) + PlaceSprite(1999, 1504, sprAmGirder, 16,16384) + PlaceSprite(2143, 1445, sprAmGirder, 13,16384) + PlaceSprite(2288, 1503, sprAmGirder, 14,16384) + PlaceSprite(2432, 1565, sprAmGirder, 13,16384) + PlaceSprite(2593, 1565, sprAmGirder, 13,16384) + PlaceSprite(2752, 1565, sprAmGirder, 13,16384) + PlaceSprite(2206, 1949, sprAmGirder, 15,16384) + PlaceSprite(2262, 1800, sprAmGirder, 16,16384) + PlaceSprite(2407, 1745, sprAmGirder, 13,16384) + PlaceSprite(2569, 1745, sprAmGirder, 13,16384) + PlaceSprite(2715, 1802, sprAmGirder, 14,16384) + PlaceSprite(2898, 1624, sprAmGirder, 14,16384) + PlaceSprite(3014, 1740, sprAmGirder, 14,16384) + PlaceSprite(2830, 1919, sprAmGirder, 14,16384) + PlaceSprite(3131, 1856, sprAmGirder, 14,16384) + PlaceSprite(3191, 1968, sprAmGirder, 11,16384) + PlaceSprite(3264, 2021, sprAmGirder, 13,16384) + PlaceSprite(2840, 2006, sprAmGirder, 12,16384) + PlaceSprite(1505, 395, sprAmGirder, 7,0) + PlaceSprite(1445, 544, sprAmGirder, 6,0) + PlaceSprite(1506, 686, sprAmGirder, 5,0) + PlaceSprite(1650, 339, sprAmGirder, 4,0) + PlaceSprite(1797, 397, sprAmGirder, 5,0) + PlaceSprite(1857, 547, sprAmGirder, 6,0) + PlaceSprite(1797, 688, sprAmGirder, 7,0) + PlaceSprite(1652, 754, sprAmGirder, 4,0) + PlaceSprite(3326, 863, sprAmGirder, 4,0) + PlaceSprite(3474, 921, sprAmGirder, 5,0) + PlaceSprite(3180, 921, sprAmGirder, 7,0) + PlaceSprite(3120, 1071, sprAmGirder, 6,0) + PlaceSprite(3183, 1214, sprAmGirder, 5,0) + PlaceSprite(3536, 1071, sprAmGirder, 6,0) + PlaceSprite(3480, 1214, sprAmGirder, 7,0) + PlaceSprite(3330, 1279, sprAmGirder, 4,0) + PlaceSprite(2502, 556, sprAmGirder, 16,16384) + PlaceSprite(2601, 634, sprAmGirder, 16,16384) + PlaceSprite(2616, 441, sprAmGirder, 16,16384) + PlaceSprite(2716, 519, sprAmGirder, 16,16384) + PlaceSprite(2756, 379, sprAmGirder, 13,16384) + PlaceSprite(2862, 466, sprAmGirder, 13,16384) + PlaceSprite(2918, 379, sprAmGirder, 13,16384) + PlaceSprite(3023, 467, sprAmGirder, 13,16384) + PlaceSprite(3080, 378, sprAmGirder, 13,16384) + PlaceSprite(3172, 527, sprAmGirder, 14,16384) + PlaceSprite(3232, 428, sprAmGirder, 14,16384) + PlaceSprite(3289, 647, sprAmGirder, 14,16384) + PlaceSprite(3350, 545, sprAmGirder, 14,16384) + PlaceSprite(3406, 764, sprAmGirder, 14,16384) + PlaceSprite(3469, 556, sprAmGirder, 16,16384) + PlaceSprite(3616, 503, sprAmGirder, 13,16384) + PlaceSprite(3552, 828, sprAmGirder, 13,16384) + PlaceSprite(3696, 763, sprAmGirder, 16,16384) + PlaceSprite(3708, 575, sprAmGirder, 15,16384) + PlaceSprite(3705, 680, sprAmGirder, 10,16384) + + PlaceSprite(1481, 1133, sprAmGirder, 7,0) + PlaceSprite(1626, 1078, sprAmGirder, 4,0) + PlaceSprite(1772, 1135, sprAmGirder, 5,0) + PlaceSprite(1422, 1280, sprAmGirder, 6,0) + PlaceSprite(1831, 1286, sprAmGirder, 6,0) + PlaceSprite(1773, 1429, sprAmGirder, 7,0) + PlaceSprite(1627, 1492, sprAmGirder, 4,0) + PlaceSprite(1482, 1427, sprAmGirder, 5,0) + PlaceSprite(587, 855, sprAmGirder, 4,0) + PlaceSprite(425, 855, sprAmGirder, 4,0) + PlaceSprite(302, 822, sprAmGirder, 1,0) + + ------ RUBBER BAND LIST ------ + PlaceSprite(505, 708, sprAmRubber, 0, lfBouncy) + PlaceSprite(175, 451, sprAmRubber, 0, lfBouncy) + PlaceSprite(822, 1693, sprAmRubber, 0, lfBouncy) + PlaceSprite(982, 1691, sprAmRubber, 0, lfBouncy) + PlaceSprite(1142, 1688, sprAmRubber, 0, lfBouncy) + PlaceSprite(1302, 1684, sprAmRubber, 0, lfBouncy) + PlaceSprite(1450, 1750, sprAmRubber, 1, lfBouncy) + PlaceSprite(1566, 1860, sprAmRubber, 1, lfBouncy) + PlaceSprite(1680, 1973, sprAmRubber, 1, lfBouncy) + + ------ AMMO CRATE LIST ------ + tempG = SpawnAmmoCrate(324, 613, amFirePunch) + tempG = SpawnAmmoCrate(2361, 1721, amBazooka) + tempG = SpawnAmmoCrate(2430, 1721, amBazooka) + tempG = SpawnAmmoCrate(2510, 1721, amBazooka) + tempG = SpawnAmmoCrate(2581, 1721, amBazooka) + tempG = SpawnAmmoCrate(405, 1839, amSineGun) + tempG = SpawnAmmoCrate(481, 1839, amSineGun) + + ------ UTILITY CRATE LIST ------ + tempG = SpawnUtilityCrate(696, 611, amParachute) + tempG = SpawnUtilityCrate(825, 1664, amJetpack) + tempG = SpawnUtilityCrate(919, 1657, amJetpack) + tempG = SpawnUtilityCrate(1015, 1662, amJetpack) + tempG = SpawnUtilityCrate(1095, 1654, amJetpack) + tempG = SpawnUtilityCrate(1166, 1659, amJetpack) + tempG = SpawnUtilityCrate(1250, 1650, amJetpack) + tempG = SpawnUtilityCrate(1335, 1655, amJetpack) + + ------ MINE LIST ------ + SetTimer(AddGear(221, 1373, gtMine, 0, 0, 0, 0), 1) + SetTimer(AddGear(609, 661, gtMine, 0, 0, 0, 0), 3000) + + ------ STICKY MINE LIST ------ + tempG = AddGear(190, 756, gtSMine, 0, 0, 0, 0) + tempG = AddGear(191, 810, gtSMine, 0, 0, 0, 0) + tempG = AddGear(189, 868, gtSMine, 0, 0, 0, 0) + tempG = AddGear(190, 923, gtSMine, 0, 0, 0, 0) + tempG = AddGear(192, 984, gtSMine, 0, 0, 0, 0) + tempG = AddGear(192, 1045, gtSMine, 0, 0, 0, 0) + tempG = AddGear(189, 1097, gtSMine, 0, 0, 0, 0) + tempG = AddGear(192, 1159, gtSMine, 0, 0, 0, 0) + tempG = AddGear(248, 753, gtSMine, 0, 0, 0, 0) + tempG = AddGear(248, 808, gtSMine, 0, 0, 0, 0) + tempG = AddGear(249, 868, gtSMine, 0, 0, 0, 0) + tempG = AddGear(250, 921, gtSMine, 0, 0, 0, 0) + tempG = AddGear(246, 982, gtSMine, 0, 0, 0, 0) + tempG = AddGear(247, 1041, gtSMine, 0, 0, 0, 0) + tempG = AddGear(249, 1094, gtSMine, 0, 0, 0, 0) + tempG = AddGear(249, 1156, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2571, 665, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2614, 623, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2658, 580, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2704, 533, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2751, 484, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2830, 466, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2912, 465, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2992, 465, gtSMine, 0, 0, 0, 0) + tempG = AddGear(3072, 468, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2465, 592, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2518, 540, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2580, 477, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2635, 425, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2713, 381, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2796, 378, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2892, 379, gtSMine, 0, 0, 0, 0) + tempG = AddGear(2988, 379, gtSMine, 0, 0, 0, 0) + tempG = AddGear(3061, 377, gtSMine, 0, 0, 0, 0) + tempG = AddGear(3136, 377, gtSMine, 0, 0, 0, 0) + tempG = AddGear(627, 770, gtSMine, 0, 0, 0, 0) + tempG = AddGear(661, 804, gtSMine, 0, 0, 0, 0) + tempG = AddGear(705, 850, gtSMine, 0, 0, 0, 0) + tempG = AddGear(754, 899, gtSMine, 0, 0, 0, 0) + tempG = AddGear(805, 950, gtSMine, 0, 0, 0, 0) + tempG = AddGear(850, 996, gtSMine, 0, 0, 0, 0) + tempG = AddGear(902, 1048, gtSMine, 0, 0, 0, 0) + tempG = AddGear(888, 1034, gtSMine, 0, 0, 0, 0) + tempG = AddGear(788, 933, gtSMine, 0, 0, 0, 0) + tempG = AddGear(839, 985, gtSMine, 0, 0, 0, 0) + tempG = AddGear(736, 881, gtSMine, 0, 0, 0, 0) + tempG = AddGear(686, 829, gtSMine, 0, 0, 0, 0) + tempG = AddGear(649, 792, gtSMine, 0, 0, 0, 0) + else @@ -904,7 +1092,6 @@ ------ AMMO CRATE LIST ------ tempG = SpawnAmmoCrate(889, 1126, amBaseballBat) - tempG = SpawnAmmoCrate(1211, 975, amSineGun) tempG = SpawnAmmoCrate(3619, 451, amFirePunch) @@ -1103,32 +1290,6 @@ mapID = params["m"] end -PointsBuffer = '' -- A string to accumulate points in - -function AddPoint(x, y, width, erase) - PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) - if width then - width = bor(width,0x80) - if erase then - width = bor(width,0x40) - end - PointsBuffer = PointsBuffer .. string.char(width) - else - PointsBuffer = PointsBuffer .. string.char(0) - end - if #PointsBuffer > 245 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end -end - -function FlushPoints() - if #PointsBuffer > 0 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end -end - function onPreviewInit() onGameInit() end diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/Multiplayer/Tunnels.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/Tunnels.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Scripts/Multiplayer/Tunnels.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1,26 +1,3 @@ - PointsBuffer = '' -- A string to accumulate points in - function AddPoint(x, y, width, erase) - PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) - if width then - width = bor(width,0x80) - if erase then - width = bor(width,0x40) - end - PointsBuffer = PointsBuffer .. string.char(width) - else - PointsBuffer = PointsBuffer .. string.char(0) - end - if #PointsBuffer > 245 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end - end - function FlushPoints() - if #PointsBuffer > 0 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end - end function onPreviewInit() onGameInit() diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/Multiplayer/WxW.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Scripts/Multiplayer/WxW.lua Sat Jan 03 23:46:26 2015 +0300 @@ -77,8 +77,6 @@ --local margin local wallsLeft = 0 -local highestY = 0 -local surferTimer = 0 local hasSurfed = false local allWallsHit = false @@ -356,25 +354,14 @@ end -function CheckSurfer() - - if GetY(CurrentHedgehog) > highestY then - highestY = GetY(CurrentHedgehog) +function onGearWaterSkip(gear) + if gear == CurrentHedgehog then + hasSurfed = true + AddCaption(loc("Surfer!"),0xffba00ff,capgrpMessage2) end - - if (highestY == (WaterLine-8)) and (hasSurfed == false) then - - surferTimer = surferTimer +1 - if (surferTimer == 40) then - hasSurfed = true - AddCaption(loc("Surfer!"),0xffba00ff,capgrpMessage2) - end - end - end - function WallHit(id, zXMin,zYMin, zWidth, zHeight) if wTouched[id] == false then @@ -588,10 +575,8 @@ allowCrate = true - surferTimer = 0 hasSurfed = false allWallsHit = false - highestY = 0 crateG = nil @@ -650,8 +635,6 @@ --AddCaption(Map) --AddCaption(RightX ..";" .. GetX(CurrentHedgehog)) - CheckSurfer() - gTimer = gTimer + 1 if gTimer == 25 then gTimer = 1 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Scripts/TargetPractice.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Scripts/TargetPractice.lua Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,260 @@ +--[=[ +Target Practice Mission Framework for Hedgewars + +This is a simple library intended to make setting up simple training missions a trivial +task requiring just. The library has been created to reduce redundancy in Lua scripts. + +The training framework generates complete and fully usable training missions by just +one function call. + +The missions generated by this script are all the same: +- The player will get a team with a single hedgehog. +- The team gets a single predefined weapon infinitely times. +- A fixed sequence of targets will spawn at predefined positions. +- When a target has been destroyed, the next target of the target sequence appears +- The mission ends successfully when all targets have been destroyed +- The mission ends unsuccessfully when the time runs out or the hedgehog dies +- When the mission ends, a score is awarded, based on the performance (hit targets, + accuracy and remaining time) of the hedgehog. When not all targets are hit, there + will be no accuracy and time bonuses. + +To use this library, you first have to load it and to call TrainingMission once with +the appropriate parameters. Really, that’s all! +See the comment of TrainingMission for a specification of all parameters. + +Below is a template for your convenience, you just have to fill in the fields and delete +optional arguments you don’t want. +----- snip ----- +HedgewarsScriptLoad("/Scripts/Training.lua") +params = { + missionTitle = , + map = , + theme = , + time = , + ammoType = , + gearType = , + targets = { + { x = , y = }, + { x = , y = }, + -- etc. + }, + + wind = , + solidLand = , + artillery = , + hogHat = , + hogName = , + teamName = , + teamGrave = , + clanColor = , + goalText = , + shootText = +} +TargetPracticeMission(params) +----- snip ----- +]=] + +HedgewarsScriptLoad("/Scripts/Locale.lua") + +local player = nil +local scored = 0 +local shots = 0 +local end_timer = 1000 +local game_lost = false +local time_goal = 0 +local total_targets +local targets + +--[[ +TrainingMission(params) + +This function sets up the *entire* training mission and needs one argument: params. +The argument “params” is a table containing fields which describe the training mission. + mandatory fields: + - missionTitle: the name of the mission + - map: the name map to be used + - theme: the name of the theme (does not need to be a standalone theme) + - time: the time limit in milliseconds + - ammoType: the ammo type of the weapon to be used + - gearType: the gear type of the gear which is fired (used to count shots) + - targets: The coordinates of where the targets will be spawned. + It is a table containing tables containing coordinates of format + { x=value, y=value }. The targets will be spawned in the same + order as specified the coordinate tables appear. Example: + targets = { + { x = 324, y = 43 }, + { x = 123, y = 56 }, + { x = 6, y = 0 }, + } + There must be at least 1 target. + + optional fields: + - wind: the initial wind (-100 to 100) (default: 0 (no wind)) + - solidLand: weather the terrain is indestructible (default: false) + - artillery: if true, the hog can’t move (default: false) + - hogHat: hat of the hedgehog (default: "NoHat") + - hogName: name of the hedgehog (default: "Trainee") + - teamName: name of the hedgehog’s team (default: "Training Team") + - teamGrave: name of the hedgehog’s grave + - clanColor: color of the (only) clan (default: 0xFF0204, which is a red tone) + - goalText: A short string explaining the goal of the mission + (default: "Destroy all targets within the time!") + - shootText: A string which says how many times the player shot, “%d” is replaced + by the number of shots. (default: "You have shot %d times.") +]] +function TargetPracticeMission(params) + if params.hogHat == nil then params.hogHat = "NoHat" end + if params.hogName == nil then params.hogName = loc("Trainee") end + if params.teamName == nil then params.teamName = loc("Training Team") end + if params.goalText == nil then params.goalText = loc("Eliminate all targets before your time runs out.|You have unlimited ammo for this mission.") end + if params.shootText == nil then params.shootText = loc("You have shot %d times.") end + if params.clanColor == nil then params.clanColor = 0xFF0204 end + if params.teamGrave == nil then params.teamGrave= "Statue" end + if params.wind == nil then params.wind = 0 end + + local solid, artillery + if params.solidLand == true then solid = gfSolidLand else solid = 0 end + if params.artillery == true then artillery = gfArtillery else artillery = 0 end + + targets = params.targets + + total_targets = #targets + + _G.onAmmoStoreInit = function() + SetAmmo(params.ammoType, 9, 0, 0, 0) + end + + _G.onGameInit = function() + Seed = 1 + GameFlags = gfDisableWind + gfInfAttack + gfOneClanMode + solid + artillery + TurnTime = params.time + Map = params.map + Theme = params.theme + Goals = params.goalText + CaseFreq = 0 + MinesNum = 0 + Explosives = 0 + + SetWind(params.wind) + + AddTeam(loc(params.teamName), params.clanColor, params.teamGrave, "Island", "Default", "Flowerhog") + + player = AddHog(loc(params.hogName), 0, 1, params.hogHat) + SetGearPosition(player, params.hog_x, params.hog_y) + end + + _G.onGameStart = function() + SendHealthStatsOff() + ShowMission(params.missionTitle, loc("Aiming practice"), params.goalText, -params.ammoType, 5000) + spawnTarget() + end + + _G.onNewTurn = function() + -- TODO: Remove the else branch when 0.9.21 has been released + if SetWeapon ~= nil then + SetWeapon(params.ammoType) + else + ParseCommand("/setweap "..string.char(params.ammoType)) + end + end + + _G.spawnTarget = function() + gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) + + x = targets[scored+1].x + y = targets[scored+1].y + + SetGearPosition(gear, x, y) + end + + _G.onGameTick20 = function() + if TurnTimeLeft < 40 and TurnTimeLeft > 0 and scored < total_targets and game_lost == false then + game_lost = true + AddCaption(loc("Time’s up!"), 0xFFFFFFFF, capgrpGameState) + ShowMission(params.missionTitle, loc("Aiming practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0) + SetHealth(player, 0) + time_goal = 1 + end + + if band(GetState(player), gstDrowning) == gstDrowning and game_lost == false and scored < total_targets then + game_lost = true + time_goal = 1 + AddCaption(loc("You lose!"), 0xFFFFFFFF, capgrpGameState) + ShowMission(params.missionTitle, loc("Aiming practice"), loc("Oh no! You failed! Just try again."), -amSkip, 0) + end + + if scored == total_targets or game_lost then + if end_timer == 0 then + generateStats() + EndGame() + else + TurnTimeLeft = time_goal + end + end_timer = end_timer - 20 + end + end + + _G.onGearAdd = function(gear) + if GetGearType(gear) == params.gearType then + shots = shots + 1 + end + end + + _G.onGearDamage = function(gear, damage) + if GetGearType(gear) == gtTarget then + scored = scored + 1 + if scored < total_targets then + AddCaption(string.format(loc("Targets left: %d"), (total_targets-scored)), 0xFFFFFFFF, capgrpMessage) + spawnTarget() + else + if not game_lost then + AddCaption(loc("You have destroyed all targets!"), 0xFFFFFFFF, capgrpGameState) + ShowMission(params.missionTitle, loc("Aiming practice"), loc("Congratulations! You have destroyed all targets within the time."), 0, 0) + PlaySound(sndVictory, player) + SetState(player, bor(GetState(player), gstWinner)) + time_goal = TurnTimeLeft + end + end + end + + if GetGearType(gear) == gtHedgehog then + if not game_lost then + game_lost = true + AddCaption(loc("You lose!", 0xFFFFFFFF, capgrpGameState)) + ShowMission(params.missionTitle, loc("Aiming practice"), loc("Oh no! You failed! Just try again."), -amSkip, 0) + + SetHealth(player, 0) + time_goal = 1 + end + end + end + + _G.generateStats = function() + local accuracy = (scored/shots)*100 + local end_score_targets = scored * math.ceil(6000/#targets) + local end_score_overall + if not game_lost then + local end_score_time = math.ceil(time_goal/(params.time/6000)) + local end_score_accuracy = math.ceil(accuracy * 60) + end_score_overall = end_score_time + end_score_targets + end_score_accuracy + + SendStat(siGameResult, loc("You have finished the target practice!")) + + SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets (+%d points)."), scored, total_targets, end_score_targets)) + SendStat(siCustomAchievement, string.format(params.shootText, shots)) + SendStat(siCustomAchievement, string.format(loc("Your accuracy was %.1f%% (+%d points)."), accuracy, end_score_accuracy)) + SendStat(siCustomAchievement, string.format(loc("You had %.1fs remaining on the clock (+%d points)."), (time_goal/1000), end_score_time)) + else + SendStat(siGameResult, loc("You lose!")) + + SendStat(siCustomAchievement, string.format(loc("You have destroyed %d of %d targets (+%d points)."), scored, total_targets, end_score_targets)) + SendStat(siCustomAchievement, string.format(params.shootText, shots)) + if(shots > 0) then + SendStat(siCustomAchievement, string.format(loc("Your accuracy was %.1f%%."), accuracy)) + end + end_score_overall = end_score_targets + end + SendStat(siPlayerKills, tostring(end_score_overall), loc(params.teamName)) + SendStat(siPointType, loc("points")) + end +end diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Beach/theme.cfg --- a/share/hedgewars/Data/Themes/Beach/theme.cfg Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/Beach/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -15,4 +15,4 @@ spray = SprayObject29, 3 spray = SprayObject36, 2 spray = SprayObject4, 1 -flakes = 20, 1, 99999999, 0, 10 +flakes = 20, 1, 0, 0, 10 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/CMakeLists.txt --- a/share/hedgewars/Data/Themes/CMakeLists.txt Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/CMakeLists.txt Sat Jan 03 23:46:26 2015 +0300 @@ -21,6 +21,7 @@ Golf Halloween Hell + Hoggywood Island Jungle Nature diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/BlueWater.svg diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/CandyCane.png Binary file share/hedgewars/Data/Themes/Cake/CandyCane.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Cherry.png Binary file share/hedgewars/Data/Themes/Cake/Cherry.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Cherry.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/Cherry.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,311 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Chunk.png Binary file share/hedgewars/Data/Themes/Cake/Chunk.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Chunk.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/Chunk.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,12078 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Clouds.png Binary file share/hedgewars/Data/Themes/Cake/Clouds.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Clouds.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/Clouds.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,280 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/CupCake.png Binary file share/hedgewars/Data/Themes/Cake/CupCake.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Droplet.png diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Droplet.svg diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Flake.png Binary file share/hedgewars/Data/Themes/Cake/Flake.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Flake.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/Flake.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,155 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Gingerbread.png Binary file share/hedgewars/Data/Themes/Cake/Gingerbread.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Gingerbread.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/Gingerbread.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,940 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Girder.png Binary file share/hedgewars/Data/Themes/Cake/Girder.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Girder.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/Girder.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,138 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/IceCream.png Binary file share/hedgewars/Data/Themes/Cake/IceCream.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/IceCream.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/IceCream.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,2110 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/LandBackTex.png Binary file share/hedgewars/Data/Themes/Cake/LandBackTex.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/LandTex.png Binary file share/hedgewars/Data/Themes/Cake/LandTex.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/LandTex.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/LandTex.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,7229 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Lollipop.png Binary file share/hedgewars/Data/Themes/Cake/Lollipop.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Lollipop.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/Lollipop.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,265 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Oreo.png Binary file share/hedgewars/Data/Themes/Cake/Oreo.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Oreo.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/Oreo.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,721 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Oreo2.png Binary file share/hedgewars/Data/Themes/Cake/Oreo2.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/SDDroplet.png Binary file share/hedgewars/Data/Themes/Cake/SDDroplet.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/SDDroplet.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/SDDroplet.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,981 @@ + + + + + + + + image/svg+xml + + + + + Carlos Vives B. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/SDSplash.png Binary file share/hedgewars/Data/Themes/Cake/SDSplash.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/SDSplash.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/SDSplash.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,1004 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/SDWater.png Binary file share/hedgewars/Data/Themes/Cake/SDWater.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/SDWater.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/SDWater.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,595 @@ + + + + + + + + image/svg+xml + + + + + + Carlos Vives B. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Sky.png Binary file share/hedgewars/Data/Themes/Cake/Sky.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Sky.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/Sky.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,888 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Snowball.png Binary file share/hedgewars/Data/Themes/Cake/Snowball.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Snowball.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/Snowball.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,80 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/Splash.png Binary file share/hedgewars/Data/Themes/Cake/Splash.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/amSnowball.png Binary file share/hedgewars/Data/Themes/Cake/amSnowball.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/amSnowball.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/amSnowball.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,96 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/icon.png Binary file share/hedgewars/Data/Themes/Cake/icon.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/icon@2x.png Binary file share/hedgewars/Data/Themes/Cake/icon@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/icon@2x.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/icon@2x.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,3063 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/plant3.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cake/plant3.svg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,496 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cake/theme.cfg --- a/share/hedgewars/Data/Themes/Cake/theme.cfg Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/Cake/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -1,11 +1,19 @@ -sky = 0, 0, 51 +sky = 14, 5, 36 border = 255, 200, 90 water-top = $FF, $DF, $E1 water-bottom = $FF, $DF, $E1 water-opacity = $80 +sd-water-top = 92, 5, 0 +sd-water-bottom = 75, 6, 2 +sd-water-opacity = 125 music = snow.ogg clouds = 9 -object = plant1, 3, 83, 215, 92, 35, 1, 0, 0, 250, 190 -object = plant2, 3, 118, 115, 41, 20, 1, 0, 0, 159, 110 -object = plant3, 3, 0, 115, 70, 40, 1, 8, 0, 60, 100 -flakes = 20, 100, 0, 30, 250 +object = Cherry, 1, 12, 181, 108, 9, 1, 3, 1, 124, 168 +object = Gingerbread, 3, 11, 173, 116, 11, 1, 6, 1, 123, 160 +object = CandyCane, 2, 0, 85, 25, 25, 2, 0, 0, 170, 70, 50, 70, 120, 40 +object = CupCake, 1, 20, 179, 121, 12, 1, 2, 1, 155, 171 +object = IceCream, 2, 0, 257, 45, 12, 1, 8, 1, 150, 236 +object = Lollipop, 2, 222, 120, 43, 15, 1, 0, 0, 220, 111 +spray = Oreo, 2 +spray = Oreo2, 2 +flakes = 55, 40, 99999999, 30, 200 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Castle/theme.cfg --- a/share/hedgewars/Data/Themes/Castle/theme.cfg Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/Castle/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -9,4 +9,4 @@ object = Shield, 3, 0, 165, 163, 2, 1, 0, 0, 163, 140 object = Sword, 3, 240, 22, 17, 43, 1, 8, 21, 227, 80 object = Axe, 3, 25, 195, 90, 65, 1, 40, 5, 195, 175 -flakes = 25, 3, 99999999, 0, 750 +flakes = 25, 3, 0, 0, 750 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Cave/theme.cfg --- a/share/hedgewars/Data/Themes/Cave/theme.cfg Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/Cave/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -13,4 +13,4 @@ spray = CrystalSpray01, 2 spray = CrystalSpray02, 3 spray = CrystalSpray03, 4 -flakes = 8, 2, 99999999, 0, 1700 +flakes = 8, 2, 0, 0, 1700 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Christmas/theme.cfg --- a/share/hedgewars/Data/Themes/Christmas/theme.cfg Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/Christmas/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -13,6 +13,6 @@ object = Snowman, 1, 38, 283, 119, 14, 1, 38, 21, 124, 216 spray = holly, 4 spray = holly2, 4 -flakes = 100, 3, 99999999, 100, 300 +flakes = 100, 3, 0, 100, 300 ice = yes snow = yes diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Fruit/theme.cfg --- a/share/hedgewars/Data/Themes/Fruit/theme.cfg Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/Fruit/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -10,4 +10,4 @@ object = Watermelon, 1, 87, 272, 77, 10, 1, 21, 2, 242, 219 object = Banana1, 1, 152, 191, 37, 24, 1, 2, 1, 163, 174 object = Banana2, 1, 1, 190, 37, 24, 1, 22, 0, 163, 174 -flakes = 20, 3, 999999999, 100, 260 +flakes = 20, 3, 0, 100, 260 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Golf/theme.cfg --- a/share/hedgewars/Data/Themes/Golf/theme.cfg Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/Golf/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -19,5 +19,5 @@ object = Ball, 3, 10, 0, 6, 16, 1, 0, 0, 6, 16 object = Bag, 1, 65, 0, 129, 44, 1, 0, 71, 234, 81 spray = Balldirt, 5 -flakes = 55, 40, 99999999, 30, 200 +flakes = 55, 40, 0, 30, 200 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/Border.png Binary file share/hedgewars/Data/Themes/Hoggywood/Border.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Hoggywood/CMakeLists.txt Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,6 @@ +file(GLOB images *.png) + +install(FILES + theme.cfg + ${images} + DESTINATION ${SHAREPATH}Data/Themes/Hoggywood) diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/Clouds.png Binary file share/hedgewars/Data/Themes/Hoggywood/Clouds.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/Flake.png Binary file share/hedgewars/Data/Themes/Hoggywood/Flake.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/Girder.png Binary file share/hedgewars/Data/Themes/Hoggywood/Girder.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/LandBackTex.png Binary file share/hedgewars/Data/Themes/Hoggywood/LandBackTex.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/LandTex.png Binary file share/hedgewars/Data/Themes/Hoggywood/LandTex.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/SDClouds.png Binary file share/hedgewars/Data/Themes/Hoggywood/SDClouds.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/SignL.png Binary file share/hedgewars/Data/Themes/Hoggywood/SignL.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/SignR.png Binary file share/hedgewars/Data/Themes/Hoggywood/SignR.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/Sky.png Binary file share/hedgewars/Data/Themes/Hoggywood/Sky.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/SkyL.png Binary file share/hedgewars/Data/Themes/Hoggywood/SkyL.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/SkyR.png Binary file share/hedgewars/Data/Themes/Hoggywood/SkyR.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/camera.png Binary file share/hedgewars/Data/Themes/Hoggywood/camera.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/clapper.png Binary file share/hedgewars/Data/Themes/Hoggywood/clapper.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/hogscar.png Binary file share/hedgewars/Data/Themes/Hoggywood/hogscar.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/horizont.png Binary file share/hedgewars/Data/Themes/Hoggywood/horizont.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/horizontL.png Binary file share/hedgewars/Data/Themes/Hoggywood/horizontL.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/icon.png Binary file share/hedgewars/Data/Themes/Hoggywood/icon.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/icon@2x.png Binary file share/hedgewars/Data/Themes/Hoggywood/icon@2x.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/palm.png Binary file share/hedgewars/Data/Themes/Hoggywood/palm.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/reel.png Binary file share/hedgewars/Data/Themes/Hoggywood/reel.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/reel2.png Binary file share/hedgewars/Data/Themes/Hoggywood/reel2.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/star1.png Binary file share/hedgewars/Data/Themes/Hoggywood/star1.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/star2.png Binary file share/hedgewars/Data/Themes/Hoggywood/star2.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/star3.png Binary file share/hedgewars/Data/Themes/Hoggywood/star3.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/star4.png Binary file share/hedgewars/Data/Themes/Hoggywood/star4.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/star5.png Binary file share/hedgewars/Data/Themes/Hoggywood/star5.png has changed diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Hoggywood/theme.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Hoggywood/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,22 @@ +sky = 100, 180, 220 +border = 71, 74, 93 +water-top = $54, $5C, $9D +water-bottom = $34, $3C, $7D +water-opacity = $80 +music = Rock.ogg +sd-music = hell.ogg +clouds = 32 +object = palm, 4, 169, 467, 61, 6, 2, 0, 0, 333, 238, 168, 237, 55, 92 +object = hogscar, 1, 20, 159, 70, 1, 1, 0, 0, 132, 140 +object = camera, 1, 25, 285, 92, 25, 1, 0, 0, 123, 222 +object = clapper, 1, 52, 227, 18, 5, 1, 0, 0, 263, 209 +object = reel, 1, 64, 128, 1, 1, 2, 0, 0, 150, 90, 170, 90, 49, 40 +object = reel2, 1, 40, 0, 20, 5, 1, 0, 45, 140, 175 +object = SignL, 1, 177, 15, 4, 39, 1, 0, 0, 160, 54 +object = SignR, 1, 0, 17, 5, 39, 1, 23, 0, 158, 56 +;spray = star1, 1 +;spary = star2, 1 +;spray = star3, 1 +spray = star4, 1 +spray = star5, 1 +flakes = 100, 3, 99999999, 10, 20 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Nature/theme.cfg --- a/share/hedgewars/Data/Themes/Nature/theme.cfg Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/Nature/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -16,4 +16,4 @@ object = snail, 3, 51, 94, 52, 3, 1, 0, 0, 135, 87 object = mushroom, 3, 14, 77, 24, 2, 1, 0, 0, 76, 73 object = mushroom2, 3, 24, 78, 48, 7, 2, 0, 0, 80, 36, 15, 38, 57, 30 -flakes = 55, 40, 99999999, 30, 200 +flakes = 55, 40, 0, 30, 200 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Snow/theme.cfg --- a/share/hedgewars/Data/Themes/Snow/theme.cfg Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/Snow/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -9,6 +9,6 @@ object = plant2, 3, 0, 85, 25, 25, 2, 0, 0, 170, 70, 50, 70, 120, 40 object = plant3, 3, 26, 0, 48, 1, 1, 25, 15, 50, 60 object = plant4, 3, 45, 4, 1, 45, 1, 20, 45, 20, 60 -flakes = 100, 3, 99999999, 100, 300 +flakes = 100, 3, 0, 100, 300 ice = yes snow = yes diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/Themes/Stage/theme.cfg --- a/share/hedgewars/Data/Themes/Stage/theme.cfg Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/Themes/Stage/theme.cfg Sat Jan 03 23:46:26 2015 +0300 @@ -15,4 +15,4 @@ spray = poster2, 2 spray = poster3, 2 spray = poster4, 2 -flakes = 100, 3, 99999999, 10, 20 +flakes = 100, 3, 0, 10, 20 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/misc/hedgewars-mimeinfo.xml --- a/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml Sat Jan 03 23:46:26 2015 +0300 @@ -7,7 +7,7 @@ --> Hedgewars Demo - Hedgewars Demo + Hedgewars-Wiederholung Demo de Hedgewars Démonstration d'Hedgewars Demo di Hedgewars @@ -29,7 +29,7 @@ Hedgewars Save - Hedgewars gespeichertes Spiel + Hedgewars-Spielstand Partida guardada de Hedgewars Parties enregistrées d'Hedgewars 헤즈와스 저장된 게임 diff -r 20a2d5e6930a -r dc587913987c share/hedgewars/Data/misc/hwengine.desktop.in --- a/share/hedgewars/Data/misc/hwengine.desktop.in Thu Dec 18 00:03:53 2014 +0300 +++ b/share/hedgewars/Data/misc/hwengine.desktop.in Sat Jan 03 23:46:26 2015 +0300 @@ -3,7 +3,7 @@ Version=1.0 Name=Hedgewars Engine GenericName=Hedgewars engine, for playback of saves and demos -GenericName[de]=Hedgewars engine, für die Wiedergabe von gespeicherten Spielen und Demos +GenericName[de]=Hedgewars-Engine, für die Wiedergabe von gespeicherten Spielen und Demos GenericName[es]=Motor del juego Hedgewars, reproduce demos y partidas guardadas GenericName[fr]=Moteur graphique d'Hedgewars, pour revoir les parties enregistrées et de démonstration. GenericName[it]=Motore grafico di Hedgewars, riproduce le demo e riprende le partite salvate diff -r 20a2d5e6930a -r dc587913987c tests/lua/drillrockets_boom.lua --- a/tests/lua/drillrockets_boom.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/tests/lua/drillrockets_boom.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1,29 +1,3 @@ - - -- taken from http://code.google.com/p/hedgewars/wiki/LuaDrawing - PointsBuffer = '' -- A string to accumulate points in - function AddPoint(x, y, width, erase) - PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) - if width then - width = bor(width,0x80) - if erase then - width = bor(width,0x40) - end - PointsBuffer = PointsBuffer .. string.char(width) - else - PointsBuffer = PointsBuffer .. string.char(0) - end - if #PointsBuffer > 245 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end - end - function FlushPoints() - if #PointsBuffer > 0 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end - end - local ta_pointsize = 63 local ta_radius = (ta_pointsize * 10 + 6) / 2 @@ -84,7 +58,7 @@ DamagePercent = 1 -- Draw Map - AddPoint(10,30,0) -- hog spawn platform + -- AddPoint(10,30,0) -- hog spawn platform -- test areas AddTestArea(taa_v1) AddTestArea(taa_v2) diff -r 20a2d5e6930a -r dc587913987c tests/lua/drillrockets_drill.lua --- a/tests/lua/drillrockets_drill.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/tests/lua/drillrockets_drill.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1,29 +1,3 @@ - - -- taken from http://code.google.com/p/hedgewars/wiki/LuaDrawing - PointsBuffer = '' -- A string to accumulate points in - function AddPoint(x, y, width, erase) - PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) - if width then - width = bor(width,0x80) - if erase then - width = bor(width,0x40) - end - PointsBuffer = PointsBuffer .. string.char(width) - else - PointsBuffer = PointsBuffer .. string.char(0) - end - if #PointsBuffer > 245 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end - end - function FlushPoints() - if #PointsBuffer > 0 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end - end - local ta_pointsize = 63 local ta_radius = (ta_pointsize * 10 + 6) / 2 diff -r 20a2d5e6930a -r dc587913987c tests/lua/hellfire_burns.lua --- a/tests/lua/hellfire_burns.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/tests/lua/hellfire_burns.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1,29 +1,3 @@ - - -- taken from http://code.google.com/p/hedgewars/wiki/LuaDrawing - PointsBuffer = '' -- A string to accumulate points in - function AddPoint(x, y, width, erase) - PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) - if width then - width = bor(width,0x80) - if erase then - width = bor(width,0x40) - end - PointsBuffer = PointsBuffer .. string.char(width) - else - PointsBuffer = PointsBuffer .. string.char(0) - end - if #PointsBuffer > 245 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end - end - function FlushPoints() - if #PointsBuffer > 0 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end - end - local ta_pointsize = 63 local ta_radius = (ta_pointsize * 10 + 6) / 2 diff -r 20a2d5e6930a -r dc587913987c tests/lua/twothousandmines.lua --- a/tests/lua/twothousandmines.lua Thu Dec 18 00:03:53 2014 +0300 +++ b/tests/lua/twothousandmines.lua Sat Jan 03 23:46:26 2015 +0300 @@ -1,30 +1,3 @@ --- spawns 2000 mines in a bit to see if engine can deal with it - - -- taken from http://code.google.com/p/hedgewars/wiki/LuaDrawing - PointsBuffer = '' -- A string to accumulate points in - function AddPoint(x, y, width, erase) - PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) - if width then - width = bor(width,0x80) - if erase then - width = bor(width,0x40) - end - PointsBuffer = PointsBuffer .. string.char(width) - else - PointsBuffer = PointsBuffer .. string.char(0) - end - if #PointsBuffer > 245 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end - end - function FlushPoints() - if #PointsBuffer > 0 then - ParseCommand('draw '..PointsBuffer) - PointsBuffer = '' - end - end - local ta_pointsize = 63 local ta_radius = (ta_pointsize * 10 + 6) / 2 diff -r 20a2d5e6930a -r dc587913987c tools/docgen.sh --- a/tools/docgen.sh Thu Dec 18 00:03:53 2014 +0300 +++ b/tools/docgen.sh Sat Jan 03 23:46:26 2015 +0300 @@ -25,10 +25,13 @@ branch=$(hg identify -b) rev=$(hg identify -rdefault -i) -branchurl="${branch}" -revurl="${rev}" +#branchurl="${branch}" +#revurl="${rev}" -export PROJECT_NUMBER="${branchurl} as of ${revurl}" +branchurl="$branch" +revurl="$rev" + +export PROJECT_NUMBER="${branchurl} branch, ${revurl}" export OUTPUT_DIRECTORY fi diff -r 20a2d5e6930a -r dc587913987c tools/pas2c/Pas2C.hs --- a/tools/pas2c/Pas2C.hs Thu Dec 18 00:03:53 2014 +0300 +++ b/tools/pas2c/Pas2C.hs Sat Jan 03 23:46:26 2015 +0300 @@ -909,17 +909,15 @@ iType <- gets lastIdTypeDecl e1 <- expr2C e1' e2 <- expr2C e2' - let inc = if up then "inc" else "dec" - let add = if up then "+ 1" else "- 1" let iEnd = i <> text "__end__" - ph <- phrase2C . appendPhrase (BuiltInFunctionCall [Reference $ SimpleReference i'] (SimpleReference (Identifier inc BTUnknown))) $ wrapPhrase p + ph <- phrase2C $ wrapPhrase p return . braces $ i <+> text "=" <+> e1 <> semi $$ iType <+> iEnd <+> text "=" <+> e2 <> semi $$ text "if" <+> (parens $ i <+> text (if up then "<=" else ">=") <+> iEnd) <+> text "do" <+> ph <+> - text "while" <> parens (i <+> text "!=" <+> iEnd <+> text add) <> semi + text "while" <> parens (i <> text (if up then "++" else "--") <+> text "!=" <+> iEnd) <> semi where appendPhrase p (Phrases ps) = Phrases $ ps ++ [p] appendPhrase _ _ = error "illegal appendPhrase call" diff -r 20a2d5e6930a -r dc587913987c tools/rgit2hg.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/rgit2hg.sh Sat Jan 03 23:46:26 2015 +0300 @@ -0,0 +1,62 @@ +#!/bin/sh + +#HW_HG= + +if [ -z "$1" ]; then + echo 'You have to supply at least one hedgewars git revision as parameter!' >&2 + exit +fi + +if [ -z "$HW_HG" ]; then + HW_HG="$PWD" +fi + +if [ ! -d "$HW_HG/.hg" ]; then + echo 'You have to set HW_HG (inside script or env) to a repo clone OR call this script from inside the repository!' >&2 + exit +fi + +while [ ! -z "$1" ]; do + echo + echo + echo '---------------------------------------------------------------' + echo "$1" + echo '---------------------------------------------------------------' + url="https://github.com/hedgewars/hw/commit/$1" + echo "Checking $url ..." + echo + page=$(wget -q -O- "$url") + author=$(echo "$page" | sed -rn 's/^.*"author-name">(<[^>]*>)*([^ <]*).*/\2/ p') + if [ -z "$author" ]; then + echo 'Couldn'\''t find author! Skipping '"$1"' ...' >&2 + shift + continue + fi + echo 'Found author: '"$author" + date=$(echo "$page" | sed -rn 's/^.*