hedgewars/uVariables.pas
branchwebgl
changeset 8018 091293bc974f
parent 7977 4987f6f83cdf
parent 8016 c1223ef70934
child 8026 4a4f21070479
equal deleted inserted replaced
8008:2ed42786aca7 8018:091293bc974f
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uVariables;
    21 unit uVariables;
    22 interface
    22 interface
    23 
    23 
    24 uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile;
    24 uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile, uUtils;
    25 
    25 
    26 var
    26 var
    27 /////// init flags ///////
    27 /////// init flags ///////
    28     cMinScreenWidth    : LongInt;
    28     cMinScreenWidth    : LongInt;
    29     cMinScreenHeight   : LongInt;
    29     cMinScreenHeight   : LongInt;
   106 
   106 
   107     cTagsMask        : byte;
   107     cTagsMask        : byte;
   108     zoom             : GLfloat;
   108     zoom             : GLfloat;
   109     ZoomValue        : GLfloat;
   109     ZoomValue        : GLfloat;
   110 
   110 
   111     cWaterLine       : Word;
   111     cWaterLine       : LongInt;
   112     cGearScrEdgesDist: LongInt;
   112     cGearScrEdgesDist: LongInt;
   113     isAudioMuted     : boolean;
   113     isAudioMuted     : boolean;
   114 
   114 
   115     // originally typed consts
   115     // originally typed consts
   116     ExplosionBorderColor: LongWord;
   116     ExplosionBorderColor: LongWord;
   120 
   120 
   121     // originally from uConsts
   121     // originally from uConsts
   122     Pathz: array[TPathType] of shortstring;
   122     Pathz: array[TPathType] of shortstring;
   123     UserPathz: array[TPathType] of shortstring;
   123     UserPathz: array[TPathType] of shortstring;
   124     CountTexz: array[0..Pred(AMMO_INFINITE)] of PTexture;
   124     CountTexz: array[0..Pred(AMMO_INFINITE)] of PTexture;
   125     LAND_WIDTH       : Word;
   125     LAND_WIDTH       : LongInt;
   126     LAND_HEIGHT      : Word;
   126     LAND_HEIGHT      : LongInt;
   127     LAND_WIDTH_MASK  : LongWord;
   127     LAND_WIDTH_MASK  : LongWord;
   128     LAND_HEIGHT_MASK : LongWord;
   128     LAND_HEIGHT_MASK : LongWord;
   129 
   129 
   130     cLeftScreenBorder     : LongInt;
   130     cLeftScreenBorder     : LongInt;
   131     cRightScreenBorder    : LongInt;
   131     cRightScreenBorder    : LongInt;
   162     WeaponTooltipTex: PTexture;
   162     WeaponTooltipTex: PTexture;
   163     AmmoMenuTex     : PTexture;
   163     AmmoMenuTex     : PTexture;
   164     AmmoMenuInvalidated: boolean;
   164     AmmoMenuInvalidated: boolean;
   165     AmmoRect		: TSDL_Rect;
   165     AmmoRect		: TSDL_Rect;
   166     HHTexture       : PTexture;
   166     HHTexture       : PTexture;
       
   167     cMaxZoomLevel   : real;
       
   168     cMinZoomLevel   : real;
       
   169     cZoomDelta      : real;
       
   170     cMinMaxZoomLevelDelta : real;
   167 
   171 
   168 
   172 
   169     flagMakeCapture : boolean;
   173     flagMakeCapture : boolean;
   170 
   174 
   171     InitStepsFlags  : Longword;
   175     InitStepsFlags  : Longword;
   190     WorldDy: LongInt;
   194     WorldDy: LongInt;
   191 
   195 
   192     hiTicks: Word;
   196     hiTicks: Word;
   193 
   197 
   194     LuaGoals        : shortstring;
   198     LuaGoals        : shortstring;
   195     hiddenHedgehogs : array [0..cMaxHHs] of PHedgehog;
       
   196     hiddenHedgehogsNumber : longint;
       
   197 
   199 
   198     LuaTemplateNumber : LongWord;
   200     LuaTemplateNumber : LongWord;
   199 
   201 
   200     VoiceList : array[0..7] of TVoice =  (
   202     VoiceList : array[0..7] of TVoice =  (
   201                     ( snd: sndNone; voicepack: nil),
   203                     ( snd: sndNone; voicepack: nil),
   714             (FileName:                'Jump2.ogg'; Path: ptVoices),// sndJump2
   716             (FileName:                'Jump2.ogg'; Path: ptVoices),// sndJump2
   715             (FileName:                'Jump3.ogg'; Path: ptVoices),// sndJump3
   717             (FileName:                'Jump3.ogg'; Path: ptVoices),// sndJump3
   716             (FileName:               'Yessir.ogg'; Path: ptVoices),// sndYesSir
   718             (FileName:               'Yessir.ogg'; Path: ptVoices),// sndYesSir
   717             (FileName:                'Laugh.ogg'; Path: ptVoices),// sndLaugh
   719             (FileName:                'Laugh.ogg'; Path: ptVoices),// sndLaugh
   718             (FileName:            'Illgetyou.ogg'; Path: ptVoices),// sndIllGetYou
   720             (FileName:            'Illgetyou.ogg'; Path: ptVoices),// sndIllGetYou
       
   721             (FileName:          'JustYouWait.ogg'; Path: ptVoices),// sndJustYouWait
   719             (FileName:             'Incoming.ogg'; Path: ptVoices),// sndIncoming
   722             (FileName:             'Incoming.ogg'; Path: ptVoices),// sndIncoming
   720             (FileName:               'Missed.ogg'; Path: ptVoices),// sndMissed
   723             (FileName:               'Missed.ogg'; Path: ptVoices),// sndMissed
   721             (FileName:               'Stupid.ogg'; Path: ptVoices),// sndStupid
   724             (FileName:               'Stupid.ogg'; Path: ptVoices),// sndStupid
   722             (FileName:           'Firstblood.ogg'; Path: ptVoices),// sndFirstBlood
   725             (FileName:           'Firstblood.ogg'; Path: ptVoices),// sndFirstBlood
   723             (FileName:               'Boring.ogg'; Path: ptVoices),// sndBoring
   726             (FileName:               'Boring.ogg'; Path: ptVoices),// sndBoring
  2507     vobFrameTicks, vobFramesCount, vobCount: Longword;
  2510     vobFrameTicks, vobFramesCount, vobCount: Longword;
  2508     vobVelocity, vobFallSpeed: LongInt;
  2511     vobVelocity, vobFallSpeed: LongInt;
  2509     vobSDFrameTicks, vobSDFramesCount, vobSDCount: Longword;
  2512     vobSDFrameTicks, vobSDFramesCount, vobSDCount: Longword;
  2510     vobSDVelocity, vobSDFallSpeed: LongInt;
  2513     vobSDVelocity, vobSDFallSpeed: LongInt;
  2511 
  2514 
  2512     hideAmmoMenu: boolean;
       
  2513 
       
  2514     ControllerNumControllers: Integer;
  2515     ControllerNumControllers: Integer;
  2515     ControllerEnabled: Integer;
  2516     ControllerEnabled: Integer;
  2516     ControllerNumAxes: array[0..5] of Integer;
  2517     ControllerNumAxes: array[0..5] of Integer;
  2517     //ControllerNumBalls: array[0..5] of Integer;
  2518     //ControllerNumBalls: array[0..5] of Integer;
  2518     ControllerNumHats: array[0..5] of Integer;
  2519     ControllerNumHats: array[0..5] of Integer;
  2553     cLocaleFName    := 'en.txt';
  2554     cLocaleFName    := 'en.txt';
  2554     cFullScreen     := false;
  2555     cFullScreen     := false;
  2555 
  2556 
  2556     UserPathPrefix  := '';
  2557     UserPathPrefix  := '';
  2557     ipcPort         := 0;
  2558     ipcPort         := 0;
       
  2559     recordFileName  := '';
  2558     UserNick        := '';
  2560     UserNick        := '';
  2559     cStereoMode     := smNone;
  2561     cStereoMode     := smNone;
  2560     GrayScale       := false;
  2562     GrayScale       := false;
  2561     PathPrefix      := './';
  2563     PathPrefix      := './';
  2562     GameType        := gmtLocal;
  2564     GameType        := gmtLocal;
  2571     cAudioCodec        := '';
  2573     cAudioCodec        := '';
  2572 {$ENDIF}
  2574 {$ENDIF}
  2573 end;
  2575 end;
  2574 
  2576 
  2575 procedure initModule;
  2577 procedure initModule;
       
  2578 var s: ShortString;
  2576 begin
  2579 begin
  2577 
  2580     cLocale:= cLocaleFName;
  2578     if (Length(cLocaleFName) > 6) then
  2581     SplitByChar(cLocale, s, '.');
  2579         cLocale := Copy(cLocaleFName,1,5)
       
  2580     else
       
  2581         cLocale := Copy(cLocaleFName,1,2);
       
  2582 
  2582 
  2583     cFlattenFlakes      := false;
  2583     cFlattenFlakes      := false;
  2584     cFlattenClouds      := false;
  2584     cFlattenClouds      := false;
  2585     cOnlyStats          := False;
  2585     cOnlyStats          := False;
  2586     lastVisualGearByUID := nil;
  2586     lastVisualGearByUID := nil;
  2587     lastGearByUID       := nil;
  2587     lastGearByUID       := nil;
  2588     recordFileName      := '';
       
  2589     cReadyDelay         := 5000;
  2588     cReadyDelay         := 5000;
  2590     Pathz               := cPathz;
  2589     Pathz               := cPathz;
  2591 
  2590 
  2592         {*  REFERENCE
  2591         {*  REFERENCE
  2593       4096 -> $FFFFF000
  2592       4096 -> $FFFFF000
  2631     cWindSpeedf             := 0.0;
  2630     cWindSpeedf             := 0.0;
  2632     cGravity                := cMaxWindSpeed * 2;
  2631     cGravity                := cMaxWindSpeed * 2;
  2633     cGravityf               := 0.00025 * 2;
  2632     cGravityf               := 0.00025 * 2;
  2634     cDamageModifier         := _1;
  2633     cDamageModifier         := _1;
  2635     TargetPoint             := cTargetPointRef;
  2634     TargetPoint             := cTargetPointRef;
       
  2635 
       
  2636 {$IFDEF MOBILE}
       
  2637     cMaxZoomLevel:= 0.5;
       
  2638     cMinZoomLevel:= 3.5;
       
  2639     cZoomDelta:= 0.20;
       
  2640 {$ELSE}
       
  2641     cMaxZoomLevel:= 1.0;
       
  2642     cMinZoomLevel:= 3.0;
       
  2643     cZoomDelta:= 0.25;
       
  2644 {$ENDIF}
       
  2645 
       
  2646     cMinMaxZoomLevelDelta:= cMaxZoomLevel - cMinZoomLevel;
  2636 
  2647 
  2637     // int, longint longword and byte
  2648     // int, longint longword and byte
  2638     CursorMovementX     := 0;
  2649     CursorMovementX     := 0;
  2639     CursorMovementY     := 0;
  2650     CursorMovementY     := 0;
  2640     GameTicks           := 0;
  2651     GameTicks           := 0;
  2731 
  2742 
  2732     LuaGoals:= '';
  2743     LuaGoals:= '';
  2733     cMapName:= '';
  2744     cMapName:= '';
  2734 
  2745 
  2735     LuaTemplateNumber:= 0;
  2746     LuaTemplateNumber:= 0;
  2736     hiddenHedgehogsNumber:=0;
       
  2737 end;
  2747 end;
  2738 
  2748 
  2739 procedure freeModule;
  2749 procedure freeModule;
  2740 begin
  2750 begin
  2741 end;
  2751 end;