# HG changeset patch # User Xeli # Date 1322304451 -3600 # Node ID 356fbb672f84a8255a377d2bcf8fd164d90a0e4d # Parent bf8bfc6ceca06e55078500adbf9bfa8ad0bdd0fa# Parent 93eefff23bcd8d7b7c243c803d95155e6c4d3554 merge diff -r bf8bfc6ceca0 -r 356fbb672f84 QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Sat Nov 26 11:40:54 2011 +0100 +++ b/QTfrontend/hwform.cpp Sat Nov 26 11:47:31 2011 +0100 @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include "hwform.h" #include "game.h" @@ -544,32 +546,101 @@ void HWForm::GoToPage(int id) { + bool stopAnim = false; + int lastid = ui.Pages->currentIndex(); PagesStack.push(ui.Pages->currentIndex()); + OnPageShown(id, lastid); ui.Pages->setCurrentIndex(id); + + if (id == ID_PAGE_DRAWMAP) + stopAnim = true; + + if (frontendEffects && !stopAnim) + { + /**Start animation :**/ + + QGraphicsOpacityEffect *effectNew = new QGraphicsOpacityEffect(ui.Pages->widget(id)); + ui.Pages->widget(id)->setGraphicsEffect(effectNew); + + QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(lastid)); + ui.Pages->widget(lastid)->setGraphicsEffect(effectLast); + + //New page animation + animationNewSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos"); + animationNewSlide->setDuration(500); + animationNewSlide->setStartValue(QPoint(width()/2, 0)); + animationNewSlide->setEndValue(QPoint(0, 0)); + animationNewSlide->setEasingCurve(QEasingCurve::OutCubic); + animationNewSlide->start(); + + animationNewOpacity = new QPropertyAnimation(effectNew, "opacity"); + animationNewOpacity->setDuration(500); + animationNewOpacity->setStartValue(0.01); + animationNewOpacity->setEndValue(1); + animationNewOpacity->setEasingCurve(QEasingCurve::OutCubic); + animationNewOpacity->start(); + + //Last page animation + ui.Pages->widget(lastid)->setHidden(false); + + animationOldSlide = new QPropertyAnimation(ui.Pages->widget(lastid), "pos"); + animationOldSlide->setDuration(500); + animationOldSlide->setStartValue(QPoint(0, 0)); + animationOldSlide->setEndValue(QPoint(-width()/2, 0)); + animationOldSlide->setEasingCurve(QEasingCurve::OutCubic); + animationOldSlide->start(); + + animationOldOpacity = new QPropertyAnimation(effectLast, "opacity"); + animationOldOpacity->setDuration(500); + animationOldOpacity->setStartValue(1); + animationOldOpacity->setEndValue(0.01); + animationOldOpacity->setEasingCurve(QEasingCurve::OutCubic); + animationOldOpacity->start(); + + connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide())); + } } void HWForm::GoBack() { + bool stopAnim = false; int curid = ui.Pages->currentIndex(); if (curid == ID_PAGE_MAIN) + { + stopAnim = true; exit(); + } int id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop(); ui.Pages->setCurrentIndex(id); OnPageShown(id, curid); if (id == ID_PAGE_CONNECTING) + { + stopAnim = true; GoBack(); + } if (id == ID_PAGE_NETSERVER) + { + stopAnim = true; GoBack(); + } if ((!hwnet) && (id == ID_PAGE_ROOMSLIST)) + { + stopAnim = true; GoBack(); + } + if (curid == ID_PAGE_DRAWMAP) + stopAnim = true; if ((!hwnet) || (!hwnet->isInRoom())) if (id == ID_PAGE_NETGAME || id == ID_PAGE_NETGAME) + { + stopAnim = true; GoBack(); + } if (curid == ID_PAGE_ROOMSLIST || curid == ID_PAGE_CONNECTING) NetDisconnect(); if (curid == ID_PAGE_NETGAME && hwnet && hwnet->isInRoom()) hwnet->partRoom(); @@ -578,6 +649,55 @@ if (curid == ID_PAGE_SCHEME) ammoSchemeModel->Save(); + + /**Start animation :**/ + + if (curid != 0 && frontendEffects && !stopAnim) + { + + QGraphicsOpacityEffect *effectNew = new QGraphicsOpacityEffect(ui.Pages->widget(id)); + effectNew->setOpacity(1); + ui.Pages->widget(id)->setGraphicsEffect(effectNew); + + QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(curid)); + ui.Pages->widget(curid)->setGraphicsEffect(effectLast); + + //Last page animation + animationOldSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos"); + animationOldSlide->setDuration(500); + animationOldSlide->setStartValue(QPoint(-width()/2, 0)); + animationOldSlide->setEndValue(QPoint(0, 0)); + animationOldSlide->setEasingCurve(QEasingCurve::OutCubic); + animationOldSlide->start(); + + animationOldOpacity = new QPropertyAnimation(effectLast, "opacity"); + animationOldOpacity->setDuration(500); + animationOldOpacity->setStartValue(1); + animationOldOpacity->setEndValue(0.01); + animationOldOpacity->setEasingCurve(QEasingCurve::OutCubic); + animationOldOpacity->start(); + + //New page animation + ui.Pages->widget(curid)->setHidden(false); + + animationNewSlide = new QPropertyAnimation(ui.Pages->widget(curid), "pos"); + animationNewSlide->setDuration(500); + animationNewSlide->setStartValue(QPoint(0, 0)); + animationNewSlide->setEndValue(QPoint(width()/2, 0)); + animationNewSlide->setEasingCurve(QEasingCurve::OutCubic); + animationNewSlide->start(); + + animationNewOpacity = new QPropertyAnimation(effectNew, "opacity"); + animationNewOpacity->setDuration(500); + animationNewOpacity->setStartValue(0.01); + animationNewOpacity->setEndValue(1); + animationNewOpacity->setEasingCurve(QEasingCurve::OutCubic); + animationNewOpacity->start(); + + connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide())); + } + + } void HWForm::OpenSnapshotFolder() diff -r bf8bfc6ceca0 -r 356fbb672f84 QTfrontend/hwform.h --- a/QTfrontend/hwform.h Sat Nov 26 11:40:54 2011 +0100 +++ b/QTfrontend/hwform.h Sat Nov 26 11:47:31 2011 +0100 @@ -23,6 +23,7 @@ #include #include #include +#include #include "netserver.h" #include "game.h" @@ -170,6 +171,11 @@ QSignalMapper * pageSwitchMapper; QByteArray m_lastDemo; + QPropertyAnimation *animationNewSlide; + QPropertyAnimation *animationOldSlide; + QPropertyAnimation *animationNewOpacity; + QPropertyAnimation *animationOldOpacity; + #ifdef __APPLE__ InstallController * panel; #endif diff -r bf8bfc6ceca0 -r 356fbb672f84 QTfrontend/ui/widget/SquareLabel.cpp --- a/QTfrontend/ui/widget/SquareLabel.cpp Sat Nov 26 11:40:54 2011 +0100 +++ b/QTfrontend/ui/widget/SquareLabel.cpp Sat Nov 26 11:47:31 2011 +0100 @@ -24,7 +24,7 @@ SquareLabel::SquareLabel(QWidget * parent) : QWidget(parent) { - if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true); + //if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true); } void SquareLabel::paintEvent(QPaintEvent * event) diff -r bf8bfc6ceca0 -r 356fbb672f84 QTfrontend/ui/widget/itemNum.cpp --- a/QTfrontend/ui/widget/itemNum.cpp Sat Nov 26 11:40:54 2011 +0100 +++ b/QTfrontend/ui/widget/itemNum.cpp Sat Nov 26 11:47:31 2011 +0100 @@ -27,7 +27,7 @@ numItems(min+2 >= max ? min : min+2) { enabled = true; - if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true); + //if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true); } ItemNum::~ItemNum() diff -r bf8bfc6ceca0 -r 356fbb672f84 hedgewars/ArgParsers.inc --- a/hedgewars/ArgParsers.inc Sat Nov 26 11:40:54 2011 +0100 +++ b/hedgewars/ArgParsers.inc Sat Nov 26 11:47:31 2011 +0100 @@ -159,7 +159,7 @@ recordFileName:= ParamStr(3); paramIndex:= 4; wrongParameter:= false; - while (paramIndex <= ParamCount) and not wrongParameter do + while (paramIndex <= ParamCount) and (not wrongParameter) do begin if ParamStr(paramIndex) = '--set-video' then //--set-video [screen width] [screen height] [color dept] diff -r bf8bfc6ceca0 -r 356fbb672f84 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Sat Nov 26 11:40:54 2011 +0100 +++ b/hedgewars/uScript.pas Sat Nov 26 11:47:31 2011 +0100 @@ -2104,6 +2104,10 @@ ParseCommandOverride:= value end; +procedure ScriptOnScreenResize; +begin +end; + procedure initModule; begin end; diff -r bf8bfc6ceca0 -r 356fbb672f84 hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Sat Nov 26 11:40:54 2011 +0100 +++ b/hedgewars/uTypes.pas Sat Nov 26 11:47:31 2011 +0100 @@ -256,7 +256,7 @@ PortalCounter: LongWord; // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion. LastDamage: PHedgehog; end; - TPGearArray = Array of PGear; + TPGearArray = array of PGear; PVisualGear = ^TVisualGear; TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword); @@ -324,7 +324,7 @@ THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo; THedgehog = record - Name: string[MAXNAMELEN]; + Name: string[192]; Gear: PGear; GearHidden: PGear; SpeechGear: PVisualGear; @@ -345,12 +345,12 @@ King: boolean; // Flag for a bunch of hedgehog attributes Unplaced: boolean; // Flag for hog placing mode Timer: Longword; - Effects: Array[THogEffect] of boolean; + Effects: array[THogEffect] of boolean; end; TTeam = record Clan: PClan; - TeamName: string[MAXNAMELEN]; + TeamName: string[192]; ExtDriven: boolean; Binds: TBinds; Hedgehogs: array[0..cMaxHHIndex] of THedgehog; diff -r bf8bfc6ceca0 -r 356fbb672f84 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Sat Nov 26 11:40:54 2011 +0100 +++ b/hedgewars/uVariables.pas Sat Nov 26 11:47:31 2011 +0100 @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA *) -{$INCLUDE options.inc} +{$INCLUDE "options.inc"} unit uVariables; interface @@ -264,7 +264,7 @@ ); SpritesData: array[TSprite] of record - FileName: String[16]; + FileName: string[16]; Path, AltPath: TPathType; Texture: PTexture; Surface: PSDL_Surface; @@ -635,7 +635,7 @@ Sprite: TSprite; FramesCount: Longword; Interval: Longword; - cmd: String[20]; + cmd: string[20]; Voice: TSound; VoiceDelay: LongWord; end = ( @@ -649,7 +649,7 @@ ); Soundz: array[TSound] of record - FileName: String[25]; + FileName: string[25]; Path : TPathType; end = ( (FileName: ''; Path: ptNone ),// sndNone diff -r bf8bfc6ceca0 -r 356fbb672f84 tools/PascalParser.hs --- a/tools/PascalParser.hs Sat Nov 26 11:40:54 2011 +0100 +++ b/tools/PascalParser.hs Sat Nov 26 11:47:31 2011 +0100 @@ -204,16 +204,19 @@ optional $ (try $ string "packed") >> comments string "array" comments - r <- optionMaybe $ do + r <- option [] $ do char '[' - r <- rangeDecl + r <- commaSep pas rangeDecl char ']' comments return r string "of" comments t <- typeDecl - return $ ArrayDecl r t + if null r then + return $ ArrayDecl Nothing t + else + return $ foldr (\a b -> ArrayDecl (Just a) b) (ArrayDecl (Just $ head r) t) (tail r) recordDecl = do try $ do optional $ (try $ string "packed") >> comments