hedgewars/uMisc.pas
changeset 2619 bc2786a00fb8
parent 2607 dbeaba78e676
child 2621 956ff066f3a5
equal deleted inserted replaced
2618:23ee71bd049b 2619:bc2786a00fb8
    44 	GameType      : TGameType = gmtLocal;
    44 	GameType      : TGameType = gmtLocal;
    45 	GameFlags     : Longword = 0;
    45 	GameFlags     : Longword = 0;
    46 	TrainingFlags : Longword = 0;
    46 	TrainingFlags : Longword = 0;
    47 	TurnTimeLeft  : Longword = 0;
    47 	TurnTimeLeft  : Longword = 0;
    48 	cSuddenDTurns : LongInt = 15;
    48 	cSuddenDTurns : LongInt = 15;
    49 	cDamagePercent : LongInt = 100;
    49 	cDamagePercent  : LongInt = 100;
    50 	cTemplateFilter : LongInt = 0;
    50 	cTemplateFilter : LongInt = 0;
    51 
    51 
    52 	cHedgehogTurnTime: Longword = 45000;
    52 	cHedgehogTurnTime: Longword = 45000;
    53 	cMinesTime     : LongInt = 3000;
    53 	cMinesTime       : LongInt = 3000;
    54 	cMaxAIThinkTime  : Longword = 9000;
    54 	cMaxAIThinkTime  : Longword = 9000;
    55 
    55 
    56 	cCloudsNumber    : LongInt = 9;
    56 	cCloudsNumber    : LongInt = 9;
    57 	cScreenWidth     : LongInt = 1024;
    57 	cScreenWidth     : LongInt = 1024;
    58 	cScreenHeight    : LongInt = 768;
    58 	cScreenHeight    : LongInt = 768;
    69 	cGearScrEdgesDist: LongInt = 240;
    69 	cGearScrEdgesDist: LongInt = 240;
    70 	cCursorEdgesDist : LongInt = 100;
    70 	cCursorEdgesDist : LongInt = 100;
    71 	cTeamHealthWidth : LongInt = 128;
    71 	cTeamHealthWidth : LongInt = 128;
    72 	cAltDamage       : boolean = true;
    72 	cAltDamage       : boolean = true;
    73 
    73 
    74 	GameTicks     : LongWord = 0;
    74 	GameTicks      : LongWord = 0;
    75 	TrainingTimeInc: Longword = 10000;
    75 	TrainingTimeInc: Longword = 10000;
    76 	TrainingTimeInD: Longword = 500;
    76 	TrainingTimeInD: Longword = 500;
    77 	TrainingTimeInM: Longword = 5000;
    77 	TrainingTimeInM: Longword = 5000;
    78 	TrainingTimeMax: Longword = 60000;
    78 	TrainingTimeMax: Longword = 60000;
    79 
    79 
    80 	TimeTrialStartTime: Longword = 0;
    80 	TimeTrialStartTime: Longword = 0;
    81 	TimeTrialStopTime: Longword = 0;
    81 	TimeTrialStopTime : Longword = 0;
    82 	
    82 	
    83 	cSkyColor     : Longword = 0;
    83 	cSkyColor     : Longword = 0;
    84 	cWhiteColor   : Longword = $FFFFFFFF;
    84 	cWhiteColor   : Longword = $FFFFFFFF;
    85 	cColorNearBlack       : Longword = $FF000010;
    85 	cColorNearBlack       : Longword = $FF000010;
    86 	cExplosionBorderColor : LongWord = $808080;
    86 	cExplosionBorderColor : LongWord = $808080;
    92 	cReducedQuality : boolean = false;
    92 	cReducedQuality : boolean = false;
    93 	cLocaleFName  : shortstring = 'en.txt';
    93 	cLocaleFName  : shortstring = 'en.txt';
    94 	cSeed         : shortstring = '';
    94 	cSeed         : shortstring = '';
    95 	cInitVolume   : LongInt = 50;
    95 	cInitVolume   : LongInt = 50;
    96 	cVolumeDelta  : LongInt = 0;
    96 	cVolumeDelta  : LongInt = 0;
    97 	cTimerInterval   : Longword = 8;
    97 	cTimerInterval: Longword = 8;
    98 	cHasFocus     : boolean = true;
    98 	cHasFocus     : boolean = true;
    99 	cInactDelay   : Longword = 1250;
    99 	cInactDelay   : Longword = 1250;
   100 
   100 
   101 	bBetweenTurns: boolean = false;
   101 	bBetweenTurns: boolean = false;
   102 	cHealthDecrease: LongWord = 0;
   102 	cHealthDecrease: LongWord = 0;
   128 	RealTicks: Longword = 0;
   128 	RealTicks: Longword = 0;
   129 
   129 
   130 	AttackBar: LongInt = 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
   130 	AttackBar: LongInt = 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
   131 
   131 
   132 type HwColor4f = record
   132 type HwColor4f = record
   133 		r, g, b, a: byte
   133 	r, g, b, a: byte
   134 		end;
   134 	end;
   135 
   135 
   136 var cWaterOpacity: byte = $80;
   136 var cWaterOpacity: byte = $80;
   137 
   137 
   138 var WaterColorArray: array[0..3] of HwColor4f;
   138 var WaterColorArray: array[0..3] of HwColor4f;
   139 
   139 
   162 function NewTexture(width, height: Longword; buf: Pointer): PTexture;
   162 function NewTexture(width, height: Longword; buf: Pointer): PTexture;
   163 function  Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture;
   163 function  Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture;
   164 procedure FreeTexture(tex: PTexture);
   164 procedure FreeTexture(tex: PTexture);
   165 function  toPowerOf2(i: Longword): Longword;
   165 function  toPowerOf2(i: Longword): Longword;
   166 function DecodeBase64(s: shortstring): shortstring;
   166 function DecodeBase64(s: shortstring): shortstring;
       
   167 function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface;
   167 {$IFNDEF IPHONEOS}
   168 {$IFNDEF IPHONEOS}
   168 procedure MakeScreenshot(s: shortstring);
   169 procedure MakeScreenshot(s: shortstring);
   169 {$ENDIF}
   170 {$ENDIF}
   170 
   171 
   171 function modifyDamage(dmg: Longword): Longword;
   172 function modifyDamage(dmg: Longword): Longword;
   541 
   542 
   542 {$IFNDEF IPHONEOS}
   543 {$IFNDEF IPHONEOS}
   543 var i: LongInt;
   544 var i: LongInt;
   544 {$ENDIF}
   545 {$ENDIF}
   545 {$ENDIF}
   546 {$ENDIF}
       
   547 
       
   548 function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface;
       
   549 {* for more information http://www.idevgames.com/forum/showpost.php?p=85864&postcount=7 *}
       
   550 var convertedSurf: PSDL_Surface = nil;
       
   551 begin
       
   552 	if (tmpsurf^.format^.bitsperpixel = 24) or ((tmpsurf^.format^.bitsperpixel = 32) and (tmpsurf^.format^.rshift > tmpsurf^.format^.bshift)) then
       
   553 	begin
       
   554 		convertedSurf:= SDL_ConvertSurface(tmpsurf, @conversionFormat, SDL_SWSURFACE);
       
   555 		SDL_FreeSurface(tmpsurf);
       
   556 		doSurfaceConversion:= convertedSurf
       
   557 	end
       
   558 	else doSurfaceConversion:= tmpsurf;
       
   559 end;
   546 
   560 
   547 initialization
   561 initialization
   548 cDrownSpeed.QWordValue:= 257698038;// 0.06
   562 cDrownSpeed.QWordValue:= 257698038;// 0.06
   549 cMaxWindSpeed.QWordValue:= 2147484;// 0.0005
   563 cMaxWindSpeed.QWordValue:= 2147484;// 0.0005
   550 cWindSpeed.QWordValue:= 429496;// 0.0001
   564 cWindSpeed.QWordValue:= 429496;// 0.0001