# HG changeset patch # User Xeli # Date 1313437749 -7200 # Node ID 272c82f82ceed8a5f1cd3606067573ebd1038fea # Parent 50650032c251aec277ca68b00e1a3ad16b566c4f# Parent 41ee1c71deb3d63b04e852b994ace4d0e2bfbe21 merge diff -r 50650032c251 -r 272c82f82cee QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Mon Aug 15 21:45:27 2011 +0200 +++ b/QTfrontend/hwform.cpp Mon Aug 15 21:49:09 2011 +0200 @@ -64,13 +64,14 @@ #include "pagedrawmap.h" #include "pagenettype.h" #include "pagegamestats.h" +#include "pageplayrecord.h" +#include "pagedata.h" #include "hwconsts.h" #include "newnetclient.h" #include "gamecfgwidget.h" #include "netserverslist.h" #include "netudpserver.h" #include "chatwidget.h" -#include "pageplayrecord.h" #include "input_ip.h" #include "ammoSchemeModel.h" #include "bgwidget.h" @@ -150,11 +151,13 @@ connect(ui.pageMain->BtnNet, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); pageSwitchMapper->setMapping(ui.pageMain->BtnNet, ID_PAGE_NETTYPE); connect(ui.pageMain->BtnInfo, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); - pageSwitchMapper->setMapping(ui.pageMain->BtnInfo, ID_PAGE_INFO); + pageSwitchMapper->setMapping(ui.pageMain->BtnInfo, ID_PAGE_DATADOWNLOAD); connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed())); connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked())); + connect(ui.pageDataDownload->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); + connect(ui.pageEditTeam->BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave())); connect(ui.pageEditTeam->BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard())); diff -r 50650032c251 -r 272c82f82cee QTfrontend/hwform.h --- a/QTfrontend/hwform.h Mon Aug 15 21:45:27 2011 +0200 +++ b/QTfrontend/hwform.h Mon Aug 15 21:49:09 2011 +0200 @@ -147,7 +147,8 @@ ID_PAGE_ADMIN = 17, ID_PAGE_NETTYPE = 18, ID_PAGE_CAMPAIGN = 19, - ID_PAGE_DRAWMAP = 20 + ID_PAGE_DRAWMAP = 20, + ID_PAGE_DATADOWNLOAD = 21 }; HWGame * game; HWNetServer* pnetserver; diff -r 50650032c251 -r 272c82f82cee QTfrontend/pagedata.cpp --- a/QTfrontend/pagedata.cpp Mon Aug 15 21:45:27 2011 +0200 +++ b/QTfrontend/pagedata.cpp Mon Aug 15 21:49:09 2011 +0200 @@ -18,6 +18,10 @@ #include #include +#include +#include +#include +#include #include "pagedata.h" @@ -31,6 +35,22 @@ BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); web = new QWebView(this); - web->load(QUrl("http://m8y.org/hw/")); + connect(this, SIGNAL(linkClicked(const QUrl&)), this, SLOT(install(const QUrl&))); + web->load(QUrl("http://m8y.org/hw/downloads/")); + web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); pageLayout->addWidget(web, 0, 0, 1, 3); } + +void PageDataDownload::install(const QUrl &url) +{ +qWarning("Download Request"); +QString fileName = QFileInfo(url.toString()).fileName(); + +QNetworkRequest newRequest(url); +newRequest.setAttribute(QNetworkRequest::User, fileName); + +QNetworkAccessManager *manager = new QNetworkAccessManager(this); +QNetworkReply *reply = manager->get(newRequest); +//connect( reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)) ); +//connect( reply, SIGNAL(finished()), this, SLOT(downloadIssueFinished())); +} diff -r 50650032c251 -r 272c82f82cee QTfrontend/pagedata.h --- a/QTfrontend/pagedata.h Mon Aug 15 21:45:27 2011 +0200 +++ b/QTfrontend/pagedata.h Mon Aug 15 21:49:09 2011 +0200 @@ -19,6 +19,7 @@ #ifndef PAGE_DATA_H #define PAGE_DATA_H #include +#include #include "AbstractPage.h" class PageDataDownload : public AbstractPage @@ -30,6 +31,9 @@ QPushButton *BtnBack; QWebView *web; + +private: + void install(const QUrl &url); }; #endif diff -r 50650032c251 -r 272c82f82cee QTfrontend/pageeditteam.cpp diff -r 50650032c251 -r 272c82f82cee QTfrontend/ui_hwform.cpp --- a/QTfrontend/ui_hwform.cpp Mon Aug 15 21:45:27 2011 +0200 +++ b/QTfrontend/ui_hwform.cpp Mon Aug 15 21:49:09 2011 +0200 @@ -44,6 +44,7 @@ #include "pagemain.h" #include "pagegamestats.h" #include "pageplayrecord.h" +#include "pagedata.h" #include "hwconsts.h" void Ui_HWForm::setupUi(HWForm *HWForm) @@ -137,4 +138,7 @@ pageDrawMap = new PageDrawMap(); Pages->addWidget(pageDrawMap); + + pageDataDownload = new PageDataDownload(); + Pages->addWidget(pageDataDownload); } diff -r 50650032c251 -r 272c82f82cee gameServer/HWProtoLobbyState.hs --- a/gameServer/HWProtoLobbyState.hs Mon Aug 15 21:45:27 2011 +0200 +++ b/gameServer/HWProtoLobbyState.hs Mon Aug 15 21:49:09 2011 +0200 @@ -132,9 +132,10 @@ handleCmd_lobby ["FOLLOW", asknick] = do (_, rnc) <- ask ci <- clientByNick asknick + cl <- thisClient let ri = clientRoom rnc $ fromJust ci let clRoom = room rnc ri - if isNothing ci || ri == lobbyId then + if isNothing ci || ri == lobbyId || clientProto cl /= roomProto clRoom then return [] else handleCmd_lobby ["JOIN_ROOM", name clRoom] diff -r 50650032c251 -r 272c82f82cee hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/GSHandlers.inc Mon Aug 15 21:49:09 2011 +0200 @@ -2955,9 +2955,9 @@ if hogs[i] <> CurrentHedgehog^.Gear then begin //d:= Distance(Gear^.X - hogs[i]^.X, Gear^.Y - hogs[i]^.Y); - hogs[i]^.dX:= _0_25 * (Gear^.X - hogs[i]^.X) / _250; + hogs[i]^.dX:= _50 * cGravity * (Gear^.X - hogs[i]^.X) / _25; //if Gear^.X < hogs[i]^.X then hogs[i]^.dX.isNegative:= true; - hogs[i]^.dY:= -_0_25; + hogs[i]^.dY:= -_450 * cGravity; hogs[i]^.Active:= true; end end; @@ -2990,18 +2990,34 @@ end; procedure doStepSeductionWear(Gear: PGear); +var heart: PVisualGear; begin AllInactive := false; inc(Gear^.Timer); if Gear^.Timer > 250 then - begin + begin Gear^.Timer := 0; inc(Gear^.Pos); if Gear^.Pos = 5 then PlaySound(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack) - end; - - if Gear^.Pos = 14 then + end; + + if (Gear^.Pos = 14) and (RealTicks and $3 = 0) then + begin + heart:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); + if heart <> nil then + with heart^ do + begin + dx:= 0.001 * (random(200)); + dy:= 0.001 * (random(200)); + if random(2) = 0 then dx := -dx; + if random(2) = 0 then dy := -dy; + FrameTicks:= random(750) + 1000; + heart^.State:= ord(sprSeduction) + end; + end; + + if Gear^.Pos = 15 then Gear^.doStep := @doStepSeductionWork end; diff -r 50650032c251 -r 272c82f82cee hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/HHHandlers.inc Mon Aug 15 21:49:09 2011 +0200 @@ -582,7 +582,13 @@ i:= 0; while i < Gear^.Health do begin - AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtHealth); + vga:= AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtStraightShot); + if vga <> nil then + with vga^ do + begin + Tint:= $00FF00FF; + State:= ord(sprHealth) + end; inc(i, 5); end; end; diff -r 50650032c251 -r 272c82f82cee hedgewars/LuaPas.pas --- a/hedgewars/LuaPas.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/LuaPas.pas Mon Aug 15 21:49:09 2011 +0200 @@ -416,7 +416,7 @@ procedure lua_setglobal(L : Plua_State; s : PChar); procedure lua_getglobal(L : Plua_State; s : PChar); -function lua_tostring(L : Plua_State; idx : LongInt) : PChar; +function lua_tostring(L : Plua_State; idx : LongInt) : AnsiString; (* @@ -872,9 +872,9 @@ lua_getfield(L, LUA_GLOBALSINDEX, s); end; -function lua_tostring(L : Plua_State; idx : LongInt) : PChar; +function lua_tostring(L : Plua_State; idx : LongInt) : AnsiString; begin - lua_tostring := lua_tolstring(L, idx, nil); + lua_tostring := SysUtils.StrPas(lua_tolstring(L, idx, nil)); end; function lua_open : Plua_State; diff -r 50650032c251 -r 272c82f82cee hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/SDLh.pas Mon Aug 15 21:49:09 2011 +0200 @@ -870,8 +870,10 @@ function SDL_JoystickGetButton(joy: PSDL_Joystick; button: LongInt): Byte; cdecl; external SDLLibName; procedure SDL_JoystickClose(joy: PSDL_Joystick); cdecl; external SDLLibName; +{$IFDEF WIN32} function SDL_putenv(const text: PChar): LongInt; cdecl; external SDLLibName; function SDL_getenv(const text: PChar): PChar; cdecl; external SDLLibName; +{$ENDIF} {* Compatibility between SDL-1.2 and SDL-1.3 *} procedure SDL_WarpMouse(x, y: Word); {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF} diff -r 50650032c251 -r 272c82f82cee hedgewars/VGSHandlers.inc --- a/hedgewars/VGSHandlers.inc Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/VGSHandlers.inc Mon Aug 15 21:49:09 2011 +0200 @@ -250,22 +250,6 @@ end; //////////////////////////////////////////////////////////////////////////////// -procedure doStepHealth(Gear: PVisualGear; Steps: Longword); -begin -Gear^.X:= Gear^.X + Gear^.dX * Steps; -Gear^.Y:= Gear^.Y - Gear^.dY * Steps; - -if Gear^.FrameTicks <= Steps then - DeleteVisualGear(Gear) -else - begin - dec(Gear^.FrameTicks, Steps); - if (Gear^.FrameTicks < 501) and (Gear^.FrameTicks mod 5 = 0) then - Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or (((Gear^.Tint and $000000FF) * Gear^.FrameTicks) div 500) - end -end; - -//////////////////////////////////////////////////////////////////////////////// procedure doStepSteam(Gear: PVisualGear; Steps: Longword); begin Gear^.X:= Gear^.X + (cWindSpeedf * 100 + Gear^.dX) * Steps; @@ -711,4 +695,19 @@ if WindBarWidth = Gear^.Tag then DeleteVisualGear(Gear) end; +//////////////////////////////////////////////////////////////////////////////// +procedure doStepStraightShot(Gear: PVisualGear; Steps: Longword); +begin +Gear^.X:= Gear^.X + Gear^.dX * Steps; +Gear^.Y:= Gear^.Y - Gear^.dY * Steps; +if Gear^.FrameTicks <= Steps then + DeleteVisualGear(Gear) +else + begin + dec(Gear^.FrameTicks, Steps); + if (Gear^.FrameTicks < 501) and (Gear^.FrameTicks mod 5 = 0) then + Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or (((Gear^.Tint and $000000FF) * Gear^.FrameTicks) div 500) + end +end; + diff -r 50650032c251 -r 272c82f82cee hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/hwengine.pas Mon Aug 15 21:49:09 2011 +0200 @@ -207,14 +207,6 @@ end; end; -///////////////////////// -procedure ShowMainWindow; -begin - if cFullScreen then ParseCommand('fullscr 1', true) - else ParseCommand('fullscr 0', true); - SDL_ShowCursor(0) -end; - /////////////// {$IFDEF HWLIBRARY} procedure Game(gameArgs: PPChar); cdecl; export; @@ -251,7 +243,6 @@ cStereoMode:= smNone; {$ENDIF} - cLogfileBase:= 'game'; initEverything(true); WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')'); AddFileLog('Prefix: "' + PathPrefix +'"'); @@ -272,19 +263,15 @@ WriteLnToConsole(msgOK); SDL_EnableUNICODE(1); + SDL_ShowCursor(0); WriteToConsole('Init SDL_ttf... '); SDLTry(TTF_Init() <> -1, true); WriteLnToConsole(msgOK); -{$IFDEF WIN32} - s:= SDL_getenv('SDL_VIDEO_CENTERED'); - SDL_putenv('SDL_VIDEO_CENTERED=1'); - ShowMainWindow(); - SDL_putenv(str2pchar('SDL_VIDEO_CENTERED=' + s)); -{$ELSE} - ShowMainWindow(); -{$ENDIF} + // show main window + if cFullScreen then ParseCommand('fullscr 1', true) + else ParseCommand('fullscr 0', true); ControllerInit(); // has to happen before InitKbdKeyTable to map keys InitKbdKeyTable(); @@ -346,6 +333,9 @@ begin Randomize(); + if complete then cLogfileBase:= 'game' + else cLogfileBase:= 'preview'; + // uConsts does not need initialization as they are all consts uUtils.initModule; uMisc.initModule; @@ -440,7 +430,6 @@ procedure GenLandPreview{$IFDEF HWLIBRARY}(port: LongInt); cdecl; export{$ENDIF}; var Preview: TPreview; begin - cLogfileBase:= 'preview'; initEverything(false); {$IFDEF HWLIBRARY} WriteLnToConsole('Preview connecting on port ' + inttostr(port)); @@ -511,9 +500,7 @@ else if GameType = gmtSyntax then DisplayUsage() else Game(); - if GameType = gmtSyntax then - ExitCode:= 1 - else - ExitCode:= 0; + // return 1 when engine is not called correctly + ExitCode:= LongInt(GameType = gmtSyntax); {$ENDIF} end. diff -r 50650032c251 -r 272c82f82cee hedgewars/uCollisions.pas --- a/hedgewars/uCollisions.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uCollisions.pas Mon Aug 15 21:49:09 2011 +0200 @@ -53,19 +53,20 @@ function calcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): Boolean; implementation -uses uConsts, uLandGraphics, uVariables, uDebug; +uses uConsts, uLandGraphics, uVariables, uDebug, uGears; type TCollisionEntry = record X, Y, Radius: LongInt; cGear: PGear; end; -const MAXRECTSINDEX = 511; +const MAXRECTSINDEX = 1023; var Count: Longword; cinfos: array[0..MAXRECTSINDEX] of TCollisionEntry; ga: TGearArray; procedure AddGearCI(Gear: PGear); +var t: PGear; begin if Gear^.CollisionIndex >= 0 then exit; TryDo(Count <= MAXRECTSINDEX, 'Collision rects array overflow', true); @@ -78,7 +79,15 @@ cGear:= Gear end; Gear^.CollisionIndex:= Count; -inc(Count) +inc(Count); +// mines are the easiest way to overflow collision +if (Count > (MAXRECTSINDEX-20)) then + begin + t:= GearsList; + while (t <> nil) and (t^.Kind <> gtMine) do + t:= t^.NextGear; + if (t <> nil) then DeleteGear(t) + end; end; procedure DeleteCI(Gear: PGear); diff -r 50650032c251 -r 272c82f82cee hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uCommandHandlers.pas Mon Aug 15 21:49:09 2011 +0200 @@ -43,16 +43,17 @@ const prevGState: TGameState = gsConfirm; begin s:= s; // avoid compiler hint - if GameState <> gsConfirm then - begin + if (GameState = gsGame) or (GameState = gsChat) then + begin prevGState:= GameState; GameState:= gsConfirm; SDL_ShowCursor(1) - end else - begin - GameState:= prevGState; - SDL_ShowCursor(ord(isPaused)) - end + end else + if GameState = gsConfirm then + begin + GameState:= prevGState; + SDL_ShowCursor(ord(isPaused)) + end end; procedure chForceQuit(var s: shortstring); diff -r 50650032c251 -r 272c82f82cee hedgewars/uCommands.pas --- a/hedgewars/uCommands.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uCommands.pas Mon Aug 15 21:49:09 2011 +0200 @@ -33,7 +33,7 @@ procedure StopMessages(Message: Longword); implementation -uses Types, uConsts, uVariables, uConsole, uUtils, uDebug, uScript; +uses Types, uConsts, uVariables, uConsole, uUtils, uDebug; type PVariable = ^TVariable; TVariable = record @@ -68,7 +68,7 @@ procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); var ii: LongInt; - s, i, o: shortstring; + s: shortstring; t: PVariable; c: char; begin @@ -85,8 +85,6 @@ if t^.Name = CmdStr then begin if TrustedSource or t^.Trusted then - begin - if (c <> '$') or (s[0] <> #0) then s:= ParseCommandOverride(CmdStr, s); case t^.VType of vtCommand: if c='/' then begin @@ -96,12 +94,8 @@ if s[0]=#0 then begin str(PLongInt(t^.Handler)^, s); - i:= inttostr(PLongInt(t^.Handler)^); - o:= ParseCommandOverride(CmdStr, i); - if i <> o then val(o, PLongInt(t^.Handler)^) - else WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); - end - else val(s, PLongInt(t^.Handler)^); + WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); + end else val(s, PLongInt(t^.Handler)^); vthwFloat: if c='$' then if s[0]=#0 then begin @@ -112,23 +106,13 @@ if s[0]=#0 then begin str(ord(boolean(t^.Handler^)), s); - if boolean(t^.Handler^) then i:= '1' - else i:= '0'; - o:= ParseCommandOverride(CmdStr, i); - if i <> o then - begin - val(o, ii); - boolean(t^.Handler^):= not (ii = 0) - end - else WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); - end - else + WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); + end else begin val(s, ii); boolean(t^.Handler^):= not (ii = 0) end; end; - end; exit end else t:= t^.Next end; diff -r 50650032c251 -r 272c82f82cee hedgewars/uGears.pas --- a/hedgewars/uGears.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uGears.pas Mon Aug 15 21:49:09 2011 +0200 @@ -853,6 +853,12 @@ if cHealthDecrease <> 0 then begin SuddenDeathDmg:= true; + + // flash + ScreenFade:= sfFromWhite; + ScreenFadeValue:= sfMax; + ScreenFadeSpeed:= 1; + ChangeToSDClouds; ChangeToSDFlakes; glClearColor(SDSkyColor.r / 255, SDSkyColor.g / 255, SDSkyColor.b / 255, 0.99); @@ -1083,8 +1089,13 @@ i:= 0; while i < vampDmg do begin - vg:= AddVisualGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), vgtHealth); - if vg <> nil then vg^.Tint:= $FF0000FF; + vg:= AddVisualGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), vgtStraightShot); + if vg <> nil then + with vg^ do + begin + Tint:= $FF0000FF; + State:= ord(sprHealth) + end; inc(i, 5); end; end @@ -1511,19 +1522,20 @@ function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; var t: PGear; + l: Longword; begin r:= r*r; GearsNear := nil; t := GearsList; - while t <> nil do begin - if (t^.Kind = Kind) then begin - if (X - t^.X)*(X - t^.X) + (Y - t^.Y)*(Y-t^.Y) < - int2hwFloat(r) then + while t <> nil do + begin + if (t^.Kind = Kind) + and ((X - t^.X)*(X - t^.X) + (Y - t^.Y)*(Y-t^.Y) < int2hwFloat(r)) then begin - SetLength(GearsNear, Length(GearsNear)+1); - GearsNear[High(GearsNear)] := t; + l:= Length(GearsNear); + SetLength(GearsNear, l + 1); + GearsNear[l] := t; end; - end; t := t^.NextGear; end; end; diff -r 50650032c251 -r 272c82f82cee hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uGearsRender.pas Mon Aug 15 21:49:09 2011 +0200 @@ -603,6 +603,9 @@ amSeduction: begin DrawRotated(sprHandSeduction, hx, hy, sign, aangle); DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA); + //Tint($FF, $0, $0, $AA); + //DrawTexture(ox - 240, oy - 240, SpritesData[sprVampiric].Texture, 10); + //Tint($FF, $FF, $FF, $FF); end; amVampiric: DrawRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle); amRCPlane: begin diff -r 50650032c251 -r 272c82f82cee hedgewars/uRender.pas --- a/hedgewars/uRender.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uRender.pas Mon Aug 15 21:49:09 2011 +0200 @@ -50,8 +50,6 @@ implementation uses uVariables; -var - lastTint: Longword; procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); begin @@ -72,7 +70,7 @@ begin if (SourceTexture^.h = 0) or (SourceTexture^.w = 0) then exit; -// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) +// do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) if (abs(X) > W) and ((abs(X + W / 2) - W / 2) > cScreenWidth / cScaleFactor) then exit; if (abs(Y) > H) and ((abs(Y + H / 2 - (0.5 * cScreenHeight)) - H / 2) > cScreenHeight / cScaleFactor) then @@ -141,7 +139,7 @@ hw, nx, ny: LongInt; VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; begin -// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) +// do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) * cScaleFactor > cScreenWidth) then exit; if (abs(Y) > H) and ((abs(Y + OffsetY - (0.5 * cScreenHeight)) - W / 2) * cScaleFactor > cScreenHeight) then @@ -228,7 +226,7 @@ procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); var VertexBuffer: array [0..3] of TVertex2f; begin -// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) +// do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) if (abs(X) > 2 * hw) and ((abs(X) - hw) > cScreenWidth / cScaleFactor) then exit; if (abs(Y) > 2 * hh) and ((abs(Y - 0.5 * cScreenHeight) - hh) > cScreenHeight / cScaleFactor) then @@ -346,7 +344,7 @@ procedure DrawFillRect(r: TSDL_Rect); var VertexBuffer: array [0..3] of TVertex2f; begin -// don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) +// do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then exit; if (abs(r.y) > r.h) and ((abs(r.y + r.h / 2 - (0.5 * cScreenHeight)) - r.h / 2) * cScaleFactor > cScreenHeight) then @@ -382,18 +380,18 @@ procedure DrawCircle(X, Y, Radius, Width: LongInt); var i: LongInt; - CircleVertex: array [0..359] of TVertex2f; + CircleVertex: array [0..59] of TVertex2f; begin - for i := 0 to 359 do begin - CircleVertex[i].X := X + Radius*cos(i*pi/180); - CircleVertex[i].Y := Y + Radius*sin(i*pi/180); + for i := 0 to 59 do begin + CircleVertex[i].X := X + Radius*cos(i*pi/30); + CircleVertex[i].Y := Y + Radius*sin(i*pi/30); end; glDisable(GL_TEXTURE_2D); glEnable(GL_LINE_SMOOTH); glPushMatrix; glLineWidth(Width); glVertexPointer(2, GL_FLOAT, 0, @CircleVertex[0]); - glDrawArrays(GL_LINE_LOOP, 0, 360); + glDrawArrays(GL_LINE_LOOP, 0, 60); glPopMatrix; glEnable(GL_TEXTURE_2D); glDisable(GL_LINE_SMOOTH); @@ -409,7 +407,7 @@ var l, r, t, b: real; TextureBuffer: array [0..3] of TVertex2f; begin - // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) + // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) if (abs(X) > 32) and ((abs(X) - 16) * cScaleFactor > cScreenWidth) then exit; if (abs(Y) > 32) and ((abs(Y - 0.5 * cScreenHeight) - 16) * cScaleFactor > cScreenHeight) then @@ -453,11 +451,16 @@ procedure Tint(r, g, b, a: Byte); inline; -var nc, tw: Longword; +const + lastTint: Longword = 0; +var + nc, tw: Longword; begin nc:= (a shl 24) or (b shl 16) or (g shl 8) or r; + if nc = lastTint then exit; + if cGrayScale then begin tw:= round(r * RGB_LUMINANCE_RED + g * RGB_LUMINANCE_GREEN + b * RGB_LUMINANCE_BLUE); diff -r 50650032c251 -r 272c82f82cee hedgewars/uScript.pas --- a/hedgewars/uScript.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uScript.pas Mon Aug 15 21:49:09 2011 +0200 @@ -30,6 +30,7 @@ * unnoticed and render the parameter useless!) *) interface + procedure ScriptPrintStack; procedure ScriptClearStack; @@ -45,6 +46,7 @@ function ParseCommandOverride(key, value : shortstring) : shortstring; + procedure initModule; procedure freeModule; diff -r 50650032c251 -r 272c82f82cee hedgewars/uStore.pas --- a/hedgewars/uStore.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uStore.pas Mon Aug 15 21:49:09 2011 +0200 @@ -390,13 +390,13 @@ i, t: LongInt; begin for ii:= Low(TSprite) to High(TSprite) do - begin + begin FreeTexture(SpritesData[ii].Texture); SpritesData[ii].Texture:= nil; if SpritesData[ii].Surface <> nil then SDL_FreeSurface(SpritesData[ii].Surface); SpritesData[ii].Surface:= nil; - end; + end; SDL_FreeSurface(MissionIcons); FreeTexture(ropeIconTex); FreeTexture(HHTexture); @@ -405,14 +405,12 @@ FreeTexture(SyncTexture); // free all ammo name textures for ai:= Low(TAmmoType) to High(TAmmoType) do - begin FreeTexture(Ammoz[ai].NameTex); - end; + // free all count textures for i:= Low(CountTexz) to High(CountTexz) do - begin FreeTexture(CountTexz[i]); - end; + // free all team and hedgehog textures for t:= 0 to Pred(TeamsCount) do begin @@ -465,10 +463,10 @@ tmpsurf:= IMG_Load(Str2PChar(s)); if tmpsurf = nil then - begin + begin OutError(msgFailed, (imageFlags and ifCritical) <> 0); exit(nil) - end; + end; if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then begin @@ -943,7 +941,7 @@ SDL_FreeSurface(ico) end; - // set window caption + // set window title SDL_WM_SetCaption('Hedgewars', nil); if SDLPrimSurface <> nil then @@ -972,8 +970,13 @@ {$ELSE} if not cOnlyStats then begin +{$IFDEF WIN32} + s:= SDL_getenv('SDL_VIDEO_CENTERED'); + SDL_putenv('SDL_VIDEO_CENTERED=1'); +{$ENDIF} SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags); SDLTry(SDLPrimSurface <> nil, true); +{$IFDEF WIN32}SDL_putenv(str2pchar('SDL_VIDEO_CENTERED=' + s));{$ENDIF} end; {$ENDIF} @@ -1006,9 +1009,7 @@ end; // init all count texture pointers for i:= Low(CountTexz) to High(CountTexz) do - begin CountTexz[i] := nil; - end; end; procedure freeModule; diff -r 50650032c251 -r 272c82f82cee hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uTypes.pas Mon Aug 15 21:49:09 2011 +0200 @@ -102,11 +102,11 @@ // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.) TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire, vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble, - vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell, + vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtShell, vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg, vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion, vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, vgtBulletHit, vgtCircle, - vgtSmoothWindBar); + vgtSmoothWindBar, vgtStraightShot); TGearsType = set of TGearType; diff -r 50650032c251 -r 272c82f82cee hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uVariables.pas Mon Aug 15 21:49:09 2011 +0200 @@ -1389,7 +1389,7 @@ NameTex: nil; Probability: 100; NumberInCase: 1; - Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold; + Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold or ammoprop_NoCrosshair; Count: 1; NumPerTurn: 0; Timer: 0; @@ -2505,11 +2505,11 @@ else cMaxCaptions:= 4; - vobSDFrameTicks:= 0; - vobSDFramesCount:= 0; + vobSDFrameTicks:= 99999; + vobSDFramesCount:= 4; vobSDCount:= 30 * cScreenSpace div LAND_WIDTH; - vobSDVelocity:= 0; - vobSDFallSpeed:= 0; + vobSDVelocity:= 15; + vobSDFallSpeed:= 250; LuaGoals:= ''; end; diff -r 50650032c251 -r 272c82f82cee hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Mon Aug 15 21:45:27 2011 +0200 +++ b/hedgewars/uVisualGears.pas Mon Aug 15 21:49:09 2011 +0200 @@ -47,7 +47,7 @@ procedure AddDamageTag(X, Y, Damage, Color: LongWord); implementation -uses uSound, uMobile, uVariables, uTextures, uRender, Math, uRenderUtils; +uses uSound, uMobile, uVariables, uTextures, uRender, Math, uRenderUtils, uStore; const cExplFrameTicks = 110; @@ -90,7 +90,6 @@ @doStepAmmo, @doStepSmoke, @doStepSmoke, - @doStepHealth, @doStepShell, @doStepDust, @doStepSplash, @@ -109,7 +108,8 @@ @doStepLineTrail, @doStepBulletHit, @doStepCircle, - @doStepSmoothWindBar + @doStepSmoothWindBar, + @doStepStraightShot ); function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0; Critical: Boolean = false): PVisualGear; @@ -118,12 +118,9 @@ t: Longword; sp: real; begin -if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then // we are scrolling now - if (Kind <> vgtCloud) and not Critical then - begin - AddVisualGear:= nil; - exit - end; +AddVisualGear:= nil; +if ((GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet))) and // we are scrolling now + ((Kind <> vgtCloud) and not Critical) then exit; if ((cReducedQuality and rqAntiBoom) <> 0) and not Critical and @@ -136,11 +133,7 @@ vgtSmokeTrace, vgtEvilTrace, vgtNote, - vgtSmoothWindBar]) then - begin - AddVisualGear:= nil; - exit - end; + vgtSmoothWindBar]) then exit; inc(VGCounter); New(gear); @@ -242,14 +235,6 @@ Frame:= 7 - random(2); FrameTicks:= cExplFrameTicks * 2; end; - vgtHealth: begin - dx:= 0.001 * random(45); - dy:= 0.001 * (random(20) + 25); - Tint:= $00FF00FF; // default to green - if random(2) = 0 then dx := -dx; - Frame:= 0; - FrameTicks:= random(750) + 1250; - end; vgtDust: begin dx:= 0.005 * (random(15) + 10); dy:= 0.001 * (random(40) + 20); @@ -295,7 +280,8 @@ Frame:= 1 end; vgtHealthTag: begin - gear^.Timer:= 1500; + Frame:= 0; + Timer:= 1500; //gear^.Z:= 2002; end; vgtSmokeTrace, @@ -331,6 +317,15 @@ Angle := 0; end; vgtSmoothWindBar: Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed); + vgtStraightShot: begin + dx:= 0.001 * random(45); + dy:= 0.001 * (random(20) + 25); + State:= ord(sprHealth); + if random(2) = 0 then dx := -dx; + Frame:= 0; + FrameTicks:= random(750) + 1250; + State:= ord(sprSnowDust); + end; end; if State <> 0 then gear^.State:= State; @@ -483,8 +478,19 @@ DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex); end; vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex); - vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex); - vgtHealth: DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0); + vgtHealthTag: if Gear^.Tex <> nil then + begin + if Gear^.Frame = 0 then + DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex) + else + begin + SetScale(cDefaultZoomLevel); + DrawTexture(round(Gear^.X), round(Gear^.Y), Gear^.Tex); + SetScale(zoom) + end + end; +//if Gear^.Tex <> nil then DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex); + vgtStraightShot: DrawRotatedF(TSprite(Gear^.State), round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); end; if (cReducedQuality and rqAntiBoom) = 0 then case Gear^.Kind of diff -r 50650032c251 -r 272c82f82cee project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Mon Aug 15 21:45:27 2011 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Mon Aug 15 21:49:09 2011 +0200 @@ -1802,6 +1802,7 @@ buildSettings = { APPLY_RULES_IN_COPY_FILES = YES; ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CODE_SIGN_ENTITLEMENTS = "Entitlements-Development.plist"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B -Sgix"; diff -r 50650032c251 -r 272c82f82cee share/hedgewars/Data/Graphics/SuddenDeath/SDFlake.png Binary file share/hedgewars/Data/Graphics/SuddenDeath/SDFlake.png has changed diff -r 50650032c251 -r 272c82f82cee share/hedgewars/Data/Scripts/Multiplayer/No_Jumping.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/No_Jumping.lua Mon Aug 15 21:45:27 2011 +0200 +++ b/share/hedgewars/Data/Scripts/Multiplayer/No_Jumping.lua Mon Aug 15 21:49:09 2011 +0200 @@ -4,17 +4,31 @@ loadfile(GetDataPath() .. "Scripts/Locale.lua")() +local specialGear = nil + function onGameInit() Goals = loc("Jumping is disabled") end ---function onGameStart() --- ShowMission(LOC_NOT("NO JUMPING"), LOC_NOT("- Jumping is disabled"), LOC_NOT("Good luck out there!"), 0, 0) ---end - function onNewTurn() SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) end +function onGearAdd(gear) + + if (GetGearType(gear) == gtJetpack) or (GetGearType(gear) == gtRope) or (GetGearType(gear) == gtParachute) then + specialGear = gear + SetInputMask(band(0xFFFFFFFF, bnot(gmHJump))) + end +end +function onGearDelete(gear) + + if (GetGearType(gear) == gtJetpack) or (GetGearType(gear) == gtRope) or (GetGearType(gear) == gtParachute) then + specialGear = nil + SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) + end + +end +