# HG changeset patch # User koda # Date 1280765609 -7200 # Node ID c7849b74748df2544376923e53698c5d1406e591 # Parent 64e059b6f9c589995832eb5517f1bfd9037abb3e clean and reorder arguments passed to engine diff -r 64e059b6f9c5 -r c7849b74748d QTfrontend/game.cpp --- a/QTfrontend/game.cpp Mon Aug 02 15:23:16 2010 +0200 +++ b/QTfrontend/game.cpp Mon Aug 02 18:13:29 2010 +0200 @@ -277,17 +277,16 @@ arguments << QString("%1").arg(ipc_port); arguments << (config->vid_Fullscreen() ? "1" : "0"); arguments << (config->isSoundEnabled() ? "1" : "0"); - arguments << "0"; //(config->isSoundHardware() ? "1" : "0"); - arguments << "0"; //(config->isWeaponTooltip() ? "1" : "0"); - arguments << tr("en.txt"); + arguments << (config->isMusicEnabled() ? "1" : "0"); arguments << QString::number(config->volume()); // sound volume arguments << QString::number(config->timerInterval()); arguments << datadir->absolutePath(); arguments << (config->isShowFPSEnabled() ? "1" : "0"); arguments << (config->isAltDamageEnabled() ? "1" : "0"); arguments << config->netNick().toUtf8().toBase64(); - arguments << (config->isMusicEnabled() ? "1" : "0"); arguments << QString::number(config->translateQuality()); + arguments << tr("en.txt"); + return arguments; } diff -r 64e059b6f9c5 -r c7849b74748d hedgewars/ArgParsers.inc --- a/hedgewars/ArgParsers.inc Mon Aug 02 15:23:16 2010 +0200 +++ b/hedgewars/ArgParsers.inc Mon Aug 02 18:13:29 2010 +0200 @@ -11,22 +11,19 @@ begin val(ParamStr(2), cScreenWidth); val(ParamStr(3), cScreenHeight); - cBitsStr:= ParamStr(4); - val(cBitsStr, cBits); + val(ParamStr(4), cBits); val(ParamStr(5), ipcPort); cFullScreen:= ParamStr(6) = '1'; isSoundEnabled:= ParamStr(7) = '1'; - //cVSyncInUse:= ParamStr(8) = '1'; //merged with rqFlags - //cWeaponTooltips:= ParamStr(9) = '1'; //merged with rqFlags - cLocaleFName:= ParamStr(10); - val(ParamStr(11), cInitVolume); - val(ParamStr(12), cTimerInterval); - PathPrefix:= ParamStr(13); - cShowFPS:= ParamStr(14) = '1'; - cAltDamage:= ParamStr(15) = '1'; - UserNick:= DecodeBase64(ParamStr(16)); - isMusicEnabled:= ParamStr(17) = '1'; - val(ParamStr(18), cReducedQuality); + isMusicEnabled:= ParamStr(8) = '1'; + val(ParamStr(9), cInitVolume); + val(ParamStr(10), cTimerInterval); + PathPrefix:= ParamStr(11); + cShowFPS:= ParamStr(12) = '1'; + cAltDamage:= ParamStr(13) = '1'; + UserNick:= DecodeBase64(ParamStr(14)); + val(ParamStr(15), cReducedQuality); + cLocaleFName:= ParamStr(16); end; @@ -42,8 +39,7 @@ begin val(screenWidthParam, screenWidthAsInt); val(screenHeightParam, screenHeightAsInt); - cBitsStr:= bitsParam; - val(cBitsStr, bitsStrAsInt); + val(bitsParam, bitsStrAsInt); setVideo(screenWidthAsInt,screenHeightAsInt,bitsStrAsInt); end; diff -r 64e059b6f9c5 -r c7849b74748d hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Mon Aug 02 15:23:16 2010 +0200 +++ b/hedgewars/hwengine.pas Mon Aug 02 18:13:29 2010 +0200 @@ -315,7 +315,7 @@ begin Randomize(); - uConsts.initModule; + // uConsts does not need initialization as they are all consts uMisc.initModule; uConsole.initModule; // MUST happen after uMisc @@ -386,7 +386,6 @@ uConsole.freeModule; uMisc.freeModule; // uMisc closes the debug log. - uConsts.freeModule; //stub end; ///////////////////////// @@ -446,7 +445,7 @@ if (ParamCount = 3) then internalSetGameTypeLandPreviewFromParameters() else - if (ParamCount = 18) then + if (ParamCount = cDefaultParamNum) then internalStartGameWithParameters() else playReplayFileWithParameters(); diff -r 64e059b6f9c5 -r c7849b74748d hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Mon Aug 02 15:23:16 2010 +0200 +++ b/hedgewars/uConsts.pas Mon Aug 02 18:13:29 2010 +0200 @@ -183,7 +183,9 @@ THogEffect = (heInvulnerable, hePoisoned); TScreenFade = (sfNone, sfInit, sfToBlack, sfFromBlack, sfToWhite, sfFromWhite); -const sfMax = 1000; +const + sfMax = 1000; + cDefaultParamNum = 16; // message constants errmsgCreateSurface = 'Error creating SDL surface'; @@ -452,16 +454,6 @@ 'Graphics/Flags' // ptFlags ); -var PathPrefix: shortstring = './'; - Pathz: array[TPathType] of shortstring; - CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture; - LAND_WIDTH :longint; - LAND_HEIGHT :longint; - LAND_WIDTH_MASK :longWord; - LAND_HEIGHT_MASK :longWord; - cMaxCaptions : LongInt; - -const cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13); cTagsMasksNoHealth: array[0..15] of byte = (3, 2, 11, 1, 0, 0, 0, 0, 0, 10, 0, 9, 0, 0, 0, 0); @@ -2183,47 +2175,6 @@ alpha : 255 ); -procedure initModule; -procedure freeModule; - implementation -uses uMisc; - -procedure initModule; -begin - Pathz:= cPathz; - {* REFERENCE - 4096 -> $FFFFF000 - 2048 -> $FFFFF800 - 1024 -> $FFFFFC00 - 512 -> $FFFFFE00 *} - if (cReducedQuality and rqLowRes) <> 0 then - begin - LAND_WIDTH:= 2048; - LAND_HEIGHT:= 1024; - LAND_WIDTH_MASK:= $FFFFF800; - LAND_HEIGHT_MASK:= $FFFFFC00; - end - else - begin - LAND_WIDTH:= 4096; - LAND_HEIGHT:= 2048; - LAND_WIDTH_MASK:= $FFFFF000; - LAND_HEIGHT_MASK:= $FFFFF800 - end; - -{$IFDEF IPHONEOS} - if isPhone() then - cMaxCaptions:= 3 - else -{$ENDIF} - cMaxCaptions:= 4; - -end; - -procedure freeModule; -begin - PathPrefix := './'; -end; end. diff -r 64e059b6f9c5 -r c7849b74748d hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Mon Aug 02 15:23:16 2010 +0200 +++ b/hedgewars/uMisc.pas Mon Aug 02 18:13:29 2010 +0200 @@ -71,11 +71,19 @@ TimeTrialStartTime: Longword; TimeTrialStopTime : Longword; + // originally from uConsts + Pathz: array[TPathType] of shortstring; + CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture; + LAND_WIDTH :longint; + LAND_HEIGHT :longint; + LAND_WIDTH_MASK :longWord; + LAND_HEIGHT_MASK :longWord; + cMaxCaptions : LongInt; + // init flags cScreenWidth : LongInt = 1024; cScreenHeight : LongInt = 768; cBits : LongInt = 32; - cBitsStr : string[2] = '32'; //ipcPort is in uIO cFullScreen : boolean = false; isSoundEnabled : boolean = true; @@ -83,7 +91,7 @@ cLocaleFName : shortstring = 'en.txt'; cInitVolume : LongInt = 50; cTimerInterval : LongInt = 8; - //pathPrefix is in uConsts + PathPrefix: shortstring = './'; cShowFPS : boolean = false; cAltDamage : boolean = true; cReducedQuality : LongInt = rqNone; @@ -672,6 +680,27 @@ procedure initModule; {$IFDEF DEBUGFILE}{$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}{$ENDIF} begin + Pathz:= cPathz; + {* REFERENCE + 4096 -> $FFFFF000 + 2048 -> $FFFFF800 + 1024 -> $FFFFFC00 + 512 -> $FFFFFE00 *} + if (cReducedQuality and rqLowRes) <> 0 then + begin + LAND_WIDTH:= 2048; + LAND_HEIGHT:= 1024; + LAND_WIDTH_MASK:= $FFFFF800; + LAND_HEIGHT_MASK:= $FFFFFC00; + end + else + begin + LAND_WIDTH:= 4096; + LAND_HEIGHT:= 2048; + LAND_WIDTH_MASK:= $FFFFF000; + LAND_HEIGHT_MASK:= $FFFFF800 + end; + cDrownSpeed.QWordValue := 257698038; // 0.06 cDrownSpeedf := 0.06; cMaxWindSpeed.QWordValue:= 1073742; // 0.00025 @@ -747,6 +776,13 @@ ScreenFade := sfNone; +{$IFDEF IPHONEOS} + if isPhone() then + cMaxCaptions:= 3 + else +{$ENDIF} + cMaxCaptions:= 4; + {$IFDEF SDL13} SDLwindow := nil; {$ENDIF} @@ -757,7 +793,7 @@ Rewrite(f); {$ELSE} if (ParamStr(1) <> '') and (ParamStr(2) <> '') then - if (ParamCount <> 3) and (ParamCount <> 18) then + if (ParamCount <> 3) and (ParamCount <> cDefaultParamNum) then begin for i:= 0 to 7 do begin @@ -796,11 +832,10 @@ close(f); {$ENDIF} - // re-init flags so they'll always contain safe values + // re-init flags so they will always contain safe values cScreenWidth := 1024; cScreenHeight := 768; cBits := 32; - cBitsStr := '32'; //ipcPort is in uIO cFullScreen := false; isSoundEnabled := true; @@ -808,7 +843,7 @@ cLocaleFName := 'en.txt'; cInitVolume := 50; cTimerInterval := 8; - //pathPrefix is in uConsts + PathPrefix := './'; cShowFPS := false; cAltDamage := true; cReducedQuality := rqNone;