Advertisement
Guest User

P2HUD.uc - Widescreen Fix

a guest
Nov 2nd, 2012
1,511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Postal 2 HUD
  3. ///////////////////////////////////////////////////////////////////////////////
  4. class P2HUD extends FPSHUD;
  5.  
  6.  
  7. ///////////////////////////////////////////////////////////////////////////////
  8. // Vars, structs, consts, enums...
  9. ///////////////////////////////////////////////////////////////////////////////
  10.  
  11. var P2Player OurPlayer;         // player controller that owns this
  12. var P2Pawn   PawnOwner;         // pawn that owns this (may be viewtarget of owner rather than owner)
  13.  
  14. var float AspectRatio;          // ratio for height over width for display
  15. var float Scale;                // Scale for rendering the canvas.
  16.  
  17. var color WhiteColor;           // white for resetting the background
  18. var Color DefaultIconColor;     // Using 255,255,255 seems too bright, make it a little less
  19. var color YellowColor;
  20. var color RedColor;
  21. var color BlueColor;
  22.  
  23. var float HeartPumpSizeX;
  24. var float HeartPumpSizeY;
  25. var Material HeartIcon;
  26. var Material WantedIcon;        // texture for cops wanting the player (cop radio) texture
  27. var Material WantedBar;         // bar to fill in over above texture
  28. var array<Material> SectionBackground;  // Background texture for various sections
  29. var Texture RadarBackground;
  30. var Texture RadarPlayer;
  31. var Texture RadarNPC;
  32. var Texture RadarGlow;
  33. var Texture RadarTarget[2];
  34. var Texture RadarCopHat;
  35. var Texture RadarGun;
  36. var Texture BlackBox;
  37. var Material TopHurtBar;
  38. var Material SideHurtBar;
  39. var Material SkullHurtBar;
  40. var transient array<Material> TargetPrizes;
  41.  
  42. struct HudPos
  43.     {
  44.     var()   float   X;
  45.     var()   float   Y;
  46.     };
  47.  
  48. var array<HudPos> IconPos;
  49. var array<HudPos> InvTextPos;
  50. var array<HudPos> WeapTextPos;
  51. var array<HudPos> WantedTextPos;
  52. var int WeapIndex;
  53. var int InvIndex;
  54. var int HealthIndex;
  55. var int WantedIndex;
  56.  
  57. // Display strings for hints (not the localized strings, just vars)
  58. var string InvHint1;
  59. var string InvHint2;
  60. var string InvHint3;
  61. var float InvHintDeathTime; // Abs game time when hint goes away
  62. var string WeapHint1;
  63. var string WeapHint2;
  64. var string WeapHint3;
  65. var float WeapHintDeathTime;    // Abs game time when hint goes away
  66.  
  67. // Actual localized text for hints
  68. var localized string RadarHint0;
  69. var localized string RadarHint1;
  70. var localized string RadarHint2;
  71. var localized string RadarHint3;
  72. var localized string RadarHint4;
  73. var localized string RadarHint5;
  74. var localized string RadarHint6;
  75. var localized string RadarKillHint0;
  76. var localized string RadarKillHint1;
  77. var localized string RadarKillHint2;
  78. var localized string RadarStatsHint0;
  79. var localized string RadarStatsHint1;
  80. var localized string RadarStatsHint2;
  81. var localized string RadarStatsHint3;
  82. var localized string RadarStatsHint4;
  83. var localized string RadarDeadHint;
  84. var localized string RadarMouseHint;
  85. var localized string RocketHint1;
  86. var localized string RocketHint2;
  87. var localized string RocketHint3;
  88.  
  89. const HUD_INVENTORY     = 0;
  90. const HUD_HEALTH        = 1;
  91. const HUD_AMMO          = 2;
  92.  
  93. var localized string SuicideHintMajor;  // Hint written for commiting suicide
  94. var localized string SuicideHintMinor;
  95. var localized string SuicideHintMajorAlt;
  96.  
  97. var localized string DeadMessage1;      // What to do after you're dead
  98. var localized string DeadMessage2;
  99. var localized string DeadDemoMessage1;
  100. var localized string DeadDemoMessage2;
  101.  
  102. var localized string QuittingMessage;
  103. var float LoadingMessageY;
  104. var localized string EasySavingMessage;
  105. var localized string AutoSavingMessage;
  106. var localized string RestartingMessage;
  107. var localized string ForcedSavingMessage;
  108.  
  109. var String IssuedTo;
  110.  
  111. // Matinee messages
  112. // WARNING: This struct is also used by at least one ScriptedAction so it
  113. // can't contain any Actor references or the ScriptedAction will crash.
  114. struct S_HudMsg
  115.     {
  116.     var() localized string  Msg;
  117.     var() int               FontSize;
  118.     var() bool              bPlain;
  119.     var() float             X;
  120.     var() float             Y;
  121.     var() FontInfo.EJustify JustifyFromX;
  122.     };
  123. var array<S_HudMsg>         HudMsgs;
  124. var float                   HudMsgsEndTime;
  125.  
  126. var Material TopSniperBar;      // Similar to hurt bars, these sniper bars show the direction
  127. var Material SideSniperBar;     // of the sniper looking at you
  128. var float SniperBarTime;    // Cummulative time for sniper bars. All bars will use this if they
  129.                                 // should be shown
  130.  
  131. // This is the 'expected" canvas width.  At this width everything is displayed
  132. // without shrinking or stretching.  At lower or higher resolutions everything
  133. // is shrunk or stretched so the relative size on screen remains the same.
  134. const EXPECTED_START_RES_WIDTH  = 1024;
  135.  
  136. // Positions of the centers of each HUD section
  137. // Jake Notes:
  138. // X Offset needs to be changable for widescreen
  139. // Declared in HUDSetup
  140. var float HUD_WANTED_BAR_OFF_X;//       = -0.0205;
  141. const HUD_WANTED_BAR_OFF_Y      = 0.0305;//Was .0305
  142. const HUD_WANTED_BAR_SCALE_WIDTH= 0.701;
  143. const HUD_RADAR_X               = 0.88;//0.975;
  144. const HUD_RADAR_Y               = 0.78;//0.96;
  145. const HUD_RADAR_Y_OFFSET        = 0.039;
  146.  
  147. const INV_HINT_LIFETIME         = 5.0;
  148. const WEAP_HINT_LIFETIME        = 6.0;
  149. const INFINITE_HINT_TIME        = -1.0;
  150.  
  151. // Numbers for radar
  152. const RADAR_IMAGE_SCALE         = 1.5;
  153. const RADAR_WARMUP_BASE         = 100;
  154. const RADAR_NORMAL_BASE         = 60;
  155. const RADAR_WARMUP_RAND         = 40;
  156. const RADAR_NORMAL_RAND         = 10;
  157. const RADAR_Y_SPEED             = 0.6;
  158. const HUD_START_RADAR_Y         = 1.25;
  159. const BACKGROUND_TARGET_ALPHA   = 100;
  160. const RADAR_TARGET_HINTS        = 0.3;
  161. const RADAR_TARGET_KILL_HINTS   = 0.05;
  162. const RADAR_TARGET_MOUSE_HINT   = 0.9;
  163. const RADAR_TARGET_STATS        = 0.4;
  164. const TARGET_KILL_RADIUS        = 9.0;
  165. const COP_OFFSET_X              = -0.002;
  166. const COP_OFFSET_Y              = -0.01;
  167. const GUN_OFFSET_X              = -0.0055;
  168. const GUN_OFFSET_Y              = 0.0065;
  169. const MP_RADAR_RADIUS           = 88;
  170. const MP_RADAR_SCALE            = 0.016;
  171.  
  172. // Relative positions of section backgrounds
  173. // Jake Notes:
  174. // X Offset needs to be changable for widescreen
  175. // Declared in HUDSetup
  176. var float HUD_BACKGROUND_X_OFFSET;  //= -0.065;
  177. const HUD_BACKGROUND_Y_OFFSET   = -0.061;
  178.  
  179. // Relative positions of section numbers
  180. const HUD_NUMBERS_OFFSET_X          = +0.005;
  181. const HUD_NUMBERS_MAX_AMMO_OFFSET_X = +0.025;
  182. const HUD_NUMBERS_OFFSET_Y          = +0.040;
  183.  
  184. // Relative positions of armor stuff
  185. const HUD_ARMOR_NUMBERS_OFFSET_X    = -0.050;
  186. const HUD_ARMOR_NUMBERS_OFFSET_Y    = +0.050;
  187. const HUD_ARMOR_ICON_OFFSET_X       = -0.050;
  188. const HUD_ARMOR_ICON_OFFSET_Y       = -0.000;
  189. const HUD_ARMOR_ICON_SCALE          = 0.6;
  190.  
  191. // Position of "issued to" text
  192. const HUD_ISSUED_TEXT_X         = 0.98; // right justified
  193. const HUD_ISSUED_TEXT_Y         = 0.93;
  194.  
  195. // Position of suicide hint text
  196. const HUD_SUICIDE_TEXT_X        = 0.5// center justified
  197. const HUD_SUICIDE_TEXT_Y1       = 0.85;
  198. const HUD_SUICIDE_TEXT_Y3       = 0.89;
  199. const HUD_SUICIDE_TEXT_Y2       = 0.93;
  200.  
  201. // Positions for hints and messages for when dead
  202. const HUD_DEAD_TEXT_Y2          = 0.89;
  203. const DEAD_HINT_X               = 0.5;
  204. const DEAD_HINT_Y               = 0.05;
  205. const DEAD_HINT_Y_INC           = 0.035;
  206.  
  207. // Alpha darkness (255 would be black) for background behind hint text
  208. const BACKTEXT_ALPHA            = 180;
  209. // Part of darker message background that extends below bottom of text
  210. const BOTTOM_FADE_BUFFER            = 0.01;
  211.  
  212. // Position of suicide hint text
  213. const HUD_ROCKET_TEXT_X         = 0.5// center justified
  214. const HUD_ROCKET_TEXT_Y1        = 0.05;
  215. const HUD_ROCKET_TEXT_Y2        = 0.08;
  216.  
  217. // Hurt bar values
  218. const HURT_SIDE_X_INC           = 3;
  219. const HURT_SIDE_Y_INC           = 25;
  220. const HURT_TOP_X_INC            = 3;
  221. const HURT_TOP_Y_INC            = 50;
  222. const HURT_BAR_HEALTH_MOD       = 8;
  223. const SKULL_SIZE_RATIO          = 0.2;
  224. const SKULL_ALPHA               = 100;
  225. const DEFAULT_HURT_ALPHA        = 160;
  226.  
  227. const SNIPER_BAR_MAX_TIME       = 0.6// time it takes sniper bars to warm up
  228. const SNIPER_BAR_INCREASE_SIDE  = 20.0;
  229. const SNIPER_BAR_INCREASE_TOP   = 4.0;
  230. const SNIPER_BAR_ALPHA          = 255;
  231. const SNIPER_SIDE_X_INC         = 12;
  232. const SNIPER_SIDE_Y_INC         = 50;
  233. const SNIPER_TOP_X_INC          = 3;
  234. const SNIPER_TOP_Y_INC          = 65;
  235.  
  236.  
  237. const SHOW_DEBUG_LINES          = 0;
  238.  
  239. ///////////////////////////////////////////////////////////////////////////////
  240. // PostBeginPlay
  241. ///////////////////////////////////////////////////////////////////////////////
  242. simulated function PostBeginPlay()
  243.     {
  244.     Super.PostBeginPlay();
  245.  
  246.     OurPlayer = P2Player(Owner);
  247.  
  248.     if (P2GameInfo(Level.Game) != None)
  249.         IssuedTo = P2GameInfo(Level.Game).GetIssuedTo();
  250.     }
  251.  
  252. ///////////////////////////////////////////////////////////////////////////////
  253. // Show or hide various parts of the HUD
  254. ///////////////////////////////////////////////////////////////////////////////
  255. simulated function float GetRadarYOffset()
  256. {
  257.     return (HUD_RADAR_Y + HUD_RADAR_Y_OFFSET);
  258. }
  259. simulated function float GetStartRadarY()
  260. {
  261.     return HUD_START_RADAR_Y;
  262. }
  263.  
  264. ///////////////////////////////////////////////////////////////////////////////
  265. // Tick
  266. ///////////////////////////////////////////////////////////////////////////////
  267. function Tick(float DeltaTime)
  268. {
  269.     local int i;
  270.     local float HeartSizeBase;
  271.     local float FadeTime;
  272.  
  273.     if(OurPlayer == None)
  274.         return;
  275.  
  276.     // Pump the heart
  277.     OurPlayer.HeartTime+=(OurPlayer.HeartBeatSpeed*DeltaTime);
  278.  
  279.     // Do funky things to the heart time, if necessary
  280.     OurPlayer.ModifyHeartTime(DeltaTime);
  281.  
  282.     // calc sizes
  283.     if(OurPlayer.HeartTime > pi)
  284.         OurPlayer.HeartTime-=pi;
  285.  
  286.     HeartSizeBase = (2*OurPlayer.HeartScale);
  287.     HeartPumpSizeX = HeartSizeBase-sin(OurPlayer.HeartTime)*OurPlayer.HeartScale;
  288.     HeartPumpSizeY = (HeartSizeBase-sin(OurPlayer.HeartTime-pi/4)*OurPlayer.HeartScale)/4;
  289.  
  290.     // Handle fading 'hurt bars' around your view
  291.     for(i=0; i<ArrayCount(OurPlayer.HurtBarTime); i++)
  292.     {
  293.         if(OurPlayer.HurtBarTime[i] > 0)
  294.         {
  295.             OurPlayer.HurtBarTime[i] -= DeltaTime;
  296.             if(OurPlayer.HurtBarTime[i] < 0)
  297.                 OurPlayer.HurtBarTime[i]=0;
  298.         }
  299.     }
  300.  
  301.     // Handle sniper bars around our view
  302.     OurPlayer.CalcSniperBars(DeltaTime, SNIPER_BAR_MAX_TIME);
  303.  
  304.     // Handle radar
  305.     if(OurPlayer.RadarState != 0)
  306.     {
  307.         if(OurPlayer.ShowRadarBringingUp())
  308.         {
  309.             if(OurPlayer.RadarBackY > (HUD_RADAR_Y + HUD_RADAR_Y_OFFSET))
  310.             {
  311.                 OurPlayer.RadarBackY -= (RADAR_Y_SPEED*DeltaTime);
  312.                 if(OurPlayer.RadarBackY < (HUD_RADAR_Y + HUD_RADAR_Y_OFFSET))
  313.                     OurPlayer.RadarBackY = (HUD_RADAR_Y + HUD_RADAR_Y_OFFSET);
  314.             }
  315.         }
  316.         else if(OurPlayer.ShowRadarDroppingDown())
  317.         {
  318.             if(OurPlayer.RadarBackY < HUD_START_RADAR_Y)
  319.             {
  320.                 OurPlayer.RadarBackY += (RADAR_Y_SPEED*DeltaTime);
  321.             }
  322.         }
  323.     }
  324. }
  325.  
  326. ///////////////////////////////////////////////////////////////////////////////
  327. // Change the hud splats that are the backing for each category like health, weapons, inventory
  328. ///////////////////////////////////////////////////////////////////////////////
  329. function ChangeHudSplats(array<Material> NewSplats)
  330. {
  331.     local int i;
  332.     for(i=0; i<SectionBackground.Length; i++)
  333.     {
  334.         if(i<NewSplats.Length)
  335.             SectionBackground[i] = NewSplats[i];
  336.     }
  337. }
  338.  
  339. ///////////////////////////////////////////////////////////////////////////////
  340. //
  341. ///////////////////////////////////////////////////////////////////////////////
  342. simulated event PostRender(canvas Canvas)
  343.     {
  344.     // If there's an active screen, check to see if it wants the hud
  345.     // If there's a root window running then never show the hud
  346.     if ((OurPlayer.CurrentScreen == None || OurPlayer.CurrentScreen.ShouldDrawHUD()) && !AreAnyRootWindowsRunning())
  347.         {
  348.         if ( !PlayerOwner.bBehindView )
  349.             {
  350.             // Draw your foot in now
  351.             if ( (PawnOwner != None) && (PawnOwner.MyFoot != None) )
  352.                 PawnOwner.MyFoot.RenderOverlays(Canvas);
  353.             }
  354.  
  355.         // Do rest of weapons and hud
  356.         Super.PostRender(Canvas);
  357.  
  358.         // Give game info a chance to show debug stuff
  359.         if (P2GameInfoSingle(Level.Game) != None)
  360.             P2GameInfoSingle(Level.Game).RenderOverlays(Canvas);
  361.         }
  362.     // Display text saying who this version was issued to
  363.     DrawIssuedToText(Canvas);
  364.     }
  365.  
  366. ///////////////////////////////////////////////////////////////////////////////
  367. // Setup stuff
  368. ///////////////////////////////////////////////////////////////////////////////
  369. simulated function HUDSetup(canvas canvas)
  370. {
  371.     Super.HUDSetup(Canvas);
  372.  
  373.     if (OurPlayer == None)
  374.         PawnOwner = None;
  375.     else if (OurPlayer.ViewTarget == OurPlayer)
  376.         PawnOwner = P2Pawn(OurPlayer.Pawn);
  377.     else if (OurPlayer.ViewTarget.IsA('Pawn') && Pawn(OurPlayer.ViewTarget).Controller != None)
  378.         PawnOwner = P2Pawn(OurPlayer.ViewTarget);
  379.     else if (OurPlayer.Pawn != None)
  380.         PawnOwner = P2Pawn(OurPlayer.Pawn);
  381.     else
  382.         PawnOwner = None;
  383.        
  384.  
  385.     // Setup defaults
  386.     Canvas.Reset();
  387.     Canvas.SpaceX = 0;
  388.     Canvas.bNoSmooth = True;
  389.     Style = ERenderStyle.STY_Translucent;
  390.     Canvas.Style = Style;
  391.     Canvas.DrawColor = WhiteColor;
  392.     //Scale = CanvasWidth / EXPECTED_START_RES_WIDTH;
  393.     AspectRatio = CanvasHeight / CanvasWidth;
  394.     Canvas.Font = MyFont.GetFont(2, false, CanvasWidth );
  395.    
  396.     // Jake Hack: See if the user is running in a widescreen resolution by checking
  397.     // AspectRatio. If it's less than 0.8 it's not 4:3
  398.     // -------------
  399.     // Aspect Ratios (These should probably be constants...)
  400.     // 0.5622... - 1366x728 (Incorrectly rendered as 1360x728)
  401.     // 0.5625 - 1280x720, 1600x900, 1920x1080 (needs more than 205)
  402.     // 0.6 - 1280x728
  403.     // 0.625 - 960x600, 1280x800, 1440x900, 1680x1050, 1920x1200
  404.     // 0.64 - 1600x1024 (needs less than 205)
  405.    
  406.     if(AspectRatio < 0.6)   // Real 16:9
  407.     {
  408.         HUD_WANTED_BAR_OFF_X = -0.0175;
  409.         HUD_BACKGROUND_X_OFFSET = -0.055;
  410.         Scale = CanvasWidth / (EXPECTED_START_RES_WIDTH + 300);
  411.         //Log("AspectRatio < 0.6");
  412.     }  
  413.     else if(AspectRatio < 0.64) // Real 16:10
  414.     {
  415.         HUD_WANTED_BAR_OFF_X = -0.0170;
  416.         HUD_BACKGROUND_X_OFFSET = -0.055;
  417.         Scale = CanvasWidth / (EXPECTED_START_RES_WIDTH + 215);
  418.         //Log("AspectRatio < 0.64");
  419.     }
  420.     else if(AspectRatio < 0.7)  // Weird 16:10
  421.     {
  422.         HUD_WANTED_BAR_OFF_X = -0.0170;
  423.         HUD_BACKGROUND_X_OFFSET = -0.055;
  424.         Scale = CanvasWidth / (EXPECTED_START_RES_WIDTH + 200);
  425.         //Log("AspectRatio < 0.7");
  426.     }  
  427.     else    // 4:3 resolutions
  428.     {
  429.         HUD_WANTED_BAR_OFF_X = -0.0205;
  430.         HUD_BACKGROUND_X_OFFSET = -0.065;
  431.         Scale = CanvasWidth / EXPECTED_START_RES_WIDTH;
  432.         //Log("else");
  433.     }
  434.     //Log(Scale);
  435.     //Log(AspectRatio);
  436. }
  437.  
  438. ///////////////////////////////////////////////////////////////////////////////
  439. // Master HUD render function.
  440. ///////////////////////////////////////////////////////////////////////////////
  441. simulated function DrawHUD( canvas Canvas )
  442.     {
  443.     local Emitter checkem;
  444.  
  445.     HUDSetup(Canvas);
  446.  
  447.     // Draw special hud messages regardless of whether hud is hidden
  448.     DrawHudMsgs(Canvas);
  449.  
  450.     if (!bHideHUD && (Level.LevelAction == LEVACT_None))
  451.         {
  452.         // Draw player death stuff if necessary, return indicates whether we should draw other stuff
  453.         if (DrawPlayerDeath(Canvas))
  454.             {
  455.             // Draw player status, return indicates whether we should draw other stuff
  456.             if (DrawPlayerStatus(Canvas))
  457.                 {
  458.                 // Draw local messages
  459.                 DrawLocalMessages(Canvas);
  460.  
  461.                 // Debug lines
  462.                 if(SHOW_DEBUG_LINES == 1)
  463.                     {
  464.                     ForEach AllActors(class'Emitter', checkem)
  465.                         checkem.RenderOverlays(Canvas);
  466.                     }
  467.                 }
  468.             }
  469.         }
  470.     }
  471.  
  472. ///////////////////////////////////////////////////////////////////////////////
  473. // Draw player death stuff if needed and return a flag indicated whether other
  474. // hud elements should be displayed (true means they should be displayed)
  475. ///////////////////////////////////////////////////////////////////////////////
  476. simulated function bool DrawPlayerDeath(canvas Canvas)
  477.     {
  478.     local bool bDisplayOtherStuff;
  479.    
  480.     if (PawnOwner != None)
  481.         {
  482.         // Indicate that other hud stuff should be displayed
  483.         bDisplayOtherStuff = true;
  484.         }
  485.     else
  486.         {
  487.         // Put up messages if the player is dead
  488.         if(OurPlayer.IsDead()
  489.             && !OurPlayer.bFrozen)
  490.             {
  491.             // Display a message as to how to play again if you're dead. Also
  492.             // give helpful hints here, if you died too quickly
  493.             DrawDeadMessage(canvas);
  494.             }
  495.         }
  496.  
  497.     return bDisplayOtherStuff;
  498.     }
  499.  
  500. ///////////////////////////////////////////////////////////////////////////////
  501. // Draw all the player status stuff and return a flag indicating whether other
  502. // hud elements should be displayed (true means they should be displayed).
  503. //
  504. // ONLY call this if player has already been determined not to be dead!
  505. ///////////////////////////////////////////////////////////////////////////////
  506. simulated function bool DrawPlayerStatus(canvas Canvas, optional bool bCriticalInfoOnly)
  507.     {
  508.     local bool bDisplayOtherStuff;
  509.     local P2GameInfo p2g;
  510.     local int viewstate;
  511.  
  512.     // If we're getting ready to commit suicide, display this helpful hint
  513.     // and don't show any of the other hud stuff
  514.     if(OurPlayer.IsReadyToCommitSuicide())
  515.         DrawSuicideHints(canvas);
  516.     else
  517.         {
  518.         // Make sure there's a pawn
  519.         if(PawnOwner != None
  520.             && (OurPlayer.ViewTarget != OurPlayer.Pawn || !OurPlayer.bBehindView))
  521.             {
  522.             p2g = P2GameInfo(Level.Game);
  523.  
  524.             //if (p2g != None)
  525.             DrawHurtBars(Canvas, Scale);
  526.             DrawSniperBars(Canvas, Scale);
  527.  
  528.             if (!bCriticalInfoOnly)
  529.                 {
  530.                 // If we're focussed on the player, provide his full hud
  531.                 if(OurPlayer.ViewTarget == OurPlayer.Pawn)
  532.                     {
  533.                     viewstate = OurPlayer.HudViewState;
  534.  
  535.                     if (P2GameInfoSingle(Level.Game) != None)
  536.                         DrawPlayerWantedStatus(Canvas, Scale);
  537.                     if(viewstate > 0)
  538.                         DrawHealthAndArmor(Canvas, Scale);
  539.                     if (viewstate > 1)
  540.                         DrawWeapon(Canvas, Scale);
  541.                     if (viewstate > 2)
  542.                         DrawInventory(Canvas, Scale);
  543.                     }
  544.  
  545.                 // Put up helpful hints about viewing a rocket as it travels
  546.                 // if we're watching the rocket
  547.                 if(OurPlayer.IsInState('PlayerWatchRocket'))
  548.                     {
  549.                     DrawRocketHints(canvas);
  550.                     }
  551.                 else// Give the radar chance only if we're not driving a rocket
  552.                     {
  553.                     // Give the radar a chance to draw, it will decide
  554.                     // whether or not to draw the full image
  555.                     if(OurPlayer.ShowRadarAny())
  556.                         DrawRadar(Canvas, Scale);
  557.                     }
  558.                 }
  559.  
  560.             // Indicate that other hud stuff should be displayed
  561.             bDisplayOtherStuff = true;
  562.             }
  563.         }
  564.  
  565.     return bDisplayOtherStuff;
  566.     }
  567.  
  568. ///////////////////////////////////////////////////////////////////////////////
  569. // Draw text indicating who this version was issued to
  570. ///////////////////////////////////////////////////////////////////////////////
  571. simulated function DrawIssuedToText(canvas Canvas)
  572.     {
  573.     if (IssuedTo != "")
  574.         {
  575.         MyFont.DrawTextEx(
  576.             Canvas,
  577.             CanvasWidth,
  578.             HUD_ISSUED_TEXT_X * CanvasWidth,
  579.             HUD_ISSUED_TEXT_Y * CanvasHeight,
  580.             "Issued to "$IssuedTo,
  581.             0, true, EJ_Right);
  582.         }
  583.     }
  584.  
  585. ///////////////////////////////////////////////////////////////////////////////
  586. // If we're about to commit suicide (we've pressed the suicide key, now the dude
  587. // is just waiting there, ready to kill himself) we should display a hint that
  588. // says to press fire in order to continue.
  589. ///////////////////////////////////////////////////////////////////////////////
  590. simulated function DrawSuicideHints(canvas Canvas)
  591. {
  592.     MyFont.DrawTextEx(
  593.         Canvas,
  594.         CanvasWidth,
  595.         HUD_SUICIDE_TEXT_X * CanvasWidth,
  596.         HUD_SUICIDE_TEXT_Y1 * CanvasHeight,
  597.         SuicideHintMajor,
  598.         3, false, EJ_Center);
  599.     if(Level.Game == None
  600.         || !Level.Game.bIsSinglePlayer)
  601.         MyFont.DrawTextEx(
  602.             Canvas,
  603.             CanvasWidth,
  604.             HUD_SUICIDE_TEXT_X * CanvasWidth,
  605.             HUD_SUICIDE_TEXT_Y3 * CanvasHeight,
  606.             SuicideHintMajorAlt,
  607.             3, false, EJ_Center);
  608.     MyFont.DrawTextEx(
  609.         Canvas,
  610.         CanvasWidth,
  611.         HUD_SUICIDE_TEXT_X * CanvasWidth,
  612.         HUD_SUICIDE_TEXT_Y2 * CanvasHeight,
  613.         SuicideHintMinor,
  614.         2, false, EJ_Center);
  615. }
  616.  
  617. ///////////////////////////////////////////////////////////////////////////////
  618. // You died, so tell you how to restart and any hints if you died
  619. // too quickly
  620. ///////////////////////////////////////////////////////////////////////////////
  621. simulated function DrawDeadMessage(canvas Canvas)
  622. {
  623.     local float usey;
  624.     local string str1, str2, str3, str4, str5;
  625.     local int usestrcount, i;
  626.     local array<string> strs;
  627.  
  628.     if(P2GameInfoSingle(Level.Game) != None
  629.         && Level.IsDemoBuild())
  630.     {
  631.         MyFont.DrawTextEx(
  632.             Canvas,
  633.             CanvasWidth,
  634.             HUD_SUICIDE_TEXT_X * CanvasWidth,
  635.             HUD_SUICIDE_TEXT_Y1 * CanvasHeight,
  636.             DeadDemoMessage1,
  637.             2, false, EJ_Center);
  638.         MyFont.DrawTextEx(
  639.             Canvas,
  640.             CanvasWidth,
  641.             HUD_SUICIDE_TEXT_X * CanvasWidth,
  642.             HUD_DEAD_TEXT_Y2 * CanvasHeight,
  643.             DeadDemoMessage2,
  644.             2, false, EJ_Center);
  645.     }
  646.     else
  647.     {
  648.         MyFont.DrawTextEx(
  649.             Canvas,
  650.             CanvasWidth,
  651.             HUD_SUICIDE_TEXT_X * CanvasWidth,
  652.             HUD_SUICIDE_TEXT_Y1 * CanvasHeight,
  653.             DeadMessage1,
  654.             2, false, EJ_Center);
  655.         MyFont.DrawTextEx(
  656.             Canvas,
  657.             CanvasWidth,
  658.             HUD_SUICIDE_TEXT_X * CanvasWidth,
  659.             HUD_DEAD_TEXT_Y2 * CanvasHeight,
  660.             DeadMessage2,
  661.             2, false, EJ_Center);
  662.     }
  663.  
  664.     // Check to give the player a hint about how to not die so quickly next time.
  665.     if(P2GameInfoSingle(Level.Game) != None
  666.         && OurPlayer.GetDeathHints(strs))
  667.     {
  668.         canvas.SetPos(0, 0);
  669.         canvas.Style = ERenderStyle.STY_Alpha;
  670.         canvas.SetDrawColor(255, 255, 255, BACKTEXT_ALPHA);
  671.         canvas.DrawTile(BlackBox, Canvas.SizeX, Canvas.SizeY*(DEAD_HINT_Y +DEAD_HINT_Y_INC*strs.Length + BOTTOM_FADE_BUFFER),
  672.                         0, 0, BlackBox.USize, BlackBox.VSize);
  673.  
  674.         usey = DEAD_HINT_Y;
  675.         // draw hints
  676.         for(i=0;i<strs.Length;i++)
  677.         {
  678.             MyFont.DrawTextEx(Canvas, CanvasWidth, DEAD_HINT_X * CanvasWidth, usey * CanvasHeight,
  679.                                     strs[i], 1, false, EJ_Center);
  680.             usey+= DEAD_HINT_Y_INC;
  681.         }
  682.         /*
  683.         for(i=0;i<usestrcount;i++)
  684.         {
  685.             MyFont.DrawTextEx(Canvas, CanvasWidth, DEAD_HINT_X * CanvasWidth, usey * CanvasHeight,
  686.                                     str2, 1, false, EJ_Center);
  687.             usey+= DEAD_HINT_Y_INC;
  688.         }
  689.         */
  690.             /*
  691.         canvas.SetPos(0, 0);
  692.         canvas.Style = GetPlayer().MyHud.ERenderStyle.STY_Alpha;
  693.         canvas.SetDrawColor(255, 255, 255, BACKTEXT_ALPHA);
  694.         canvas.DrawTile(BlackBox, Canvas.SizeX, Canvas.SizeY*(ReminderMsgY + ReminderYInc*5 + BOTTOM_FADE_BUFFER),
  695.                         0, 0, BlackBox.USize, BlackBox.VSize);
  696.  
  697.         usey = ReminderMsgY;
  698.         MyFont.DrawTextEx(Canvas, CanvasWidth, ReminderMsgX * CanvasWidth, usey * CanvasHeight,
  699.                                 ReminderMessage1, 1, false, EJ_Center);
  700.         usey+= ReminderYInc;
  701.         MyFont.DrawTextEx(Canvas, CanvasWidth, ReminderMsgX * CanvasWidth, usey * CanvasHeight,
  702.                                 ReminderMessage2, 1, false, EJ_Center);
  703.         usey+= ReminderYInc;
  704.         MyFont.DrawTextEx(Canvas, CanvasWidth, ReminderMsgX * CanvasWidth, usey * CanvasHeight,
  705.                                 ReminderMessage3, 1, false, EJ_Center);
  706.         usey+= ReminderYInc;
  707.         MyFont.DrawTextEx(Canvas, CanvasWidth, ReminderMsgX * CanvasWidth, usey * CanvasHeight,
  708.                                 ReminderMessage4, 1, false, EJ_Center);
  709.         usey+= ReminderYInc;
  710.         MyFont.DrawTextEx(Canvas, CanvasWidth, ReminderMsgX * CanvasWidth, usey * CanvasHeight,
  711.                                 ReminderMessage5, 1, false, EJ_Center);
  712.         MyFont.DrawTextEx(
  713.             Canvas,
  714.             CanvasWidth,
  715.             HUD_SUICIDE_TEXT_X * CanvasWidth,
  716.             HUD_SUICIDE_TEXT_Y2 * CanvasHeight,
  717.             SuicideHintMinor,
  718.             2, false, EJ_Center);
  719.             */
  720.     }
  721. }
  722.  
  723. ///////////////////////////////////////////////////////////////////////////////
  724. // The view is currently focussed on a flying rocket. Tell the player
  725. // how to stop viewing it and return to normal play.
  726. ///////////////////////////////////////////////////////////////////////////////
  727. simulated function DrawRocketHints(canvas Canvas)
  728. {
  729.     local string UseHint;
  730.  
  731.     MyFont.DrawTextEx(
  732.         Canvas,
  733.         CanvasWidth,
  734.         HUD_ROCKET_TEXT_X * CanvasWidth,
  735.         HUD_ROCKET_TEXT_Y1 * CanvasHeight,
  736.         RocketHint1,
  737.         2, true, EJ_Center);
  738.     // Only put up the rocket movement hints when you're watching a rocket
  739.     if(P2Projectile(OurPlayer.ViewTarget) != None)
  740.     {
  741.         if(OurPlayer.RocketHasGas())
  742.             UseHint=RocketHint2;
  743.         else
  744.             UseHint=RocketHint3;
  745.  
  746.         MyFont.DrawTextEx(
  747.             Canvas,
  748.             CanvasWidth,
  749.             HUD_ROCKET_TEXT_X * CanvasWidth,
  750.             HUD_ROCKET_TEXT_Y2 * CanvasHeight,
  751.             UseHint,
  752.             2, true, EJ_Center);
  753.     }
  754. }
  755.  
  756. ///////////////////////////////////////////////////////////////////////////////
  757. // Draw cop radio/wanted section
  758. ///////////////////////////////////////////////////////////////////////////////
  759. simulated function DrawPlayerWantedStatus(canvas Canvas, float Scale)
  760. {
  761.     local Texture usetex;
  762.     local float radiopct;
  763.     local float BarH, BarW;
  764.     local String str1, str2;
  765.     local P2Weapon myweap;
  766.    
  767.     Log( "What Expected width are we using FOR WANTED?" );
  768.     Log( EXPECTED_START_RES_WIDTH );
  769.  
  770.     if(P2GameInfoSingle(Level.Game).TheGameState != None)
  771.     {
  772.         // Get a number from 0 to 1.0 for how much the cops want the player
  773.         radiopct = P2GameInfoSingle(Level.Game).TheGameState.CopsWantPlayer();
  774.  
  775.         // Probably not the best place for this, but here it is anyways.
  776.         // *Fixes* Widescreen problem with wanted bar.
  777.        
  778.        
  779.         if(radiopct > 0)
  780.         {
  781.             // Draw background wanted symbol
  782.             Canvas.Style = ERenderStyle.STY_Masked;
  783.             Canvas.DrawColor = DefaultIconColor;
  784.             usetex = Texture(WantedIcon);
  785.             Canvas.SetPos(
  786.                 IconPos[WantedIndex].X*CanvasWidth - Scale*(usetex.USize/2),
  787.                 IconPos[WantedIndex].Y*CanvasHeight - Scale*(usetex.VSize/2));
  788.             Canvas.DrawIcon(usetex, Scale);
  789.  
  790.             // Draw the bar showing how much he's still wanted
  791.             Canvas.Style = ERenderStyle.STY_Masked;
  792.             usetex = Texture(WantedBar);
  793.             BarH = usetex.VSize;
  794.             //BarW = usetex.USize;
  795.             BarW = (radiopct*HUD_WANTED_BAR_SCALE_WIDTH*Texture(WantedIcon).USize);
  796.             Canvas.SetPos(
  797.                 (IconPos[WantedIndex].X + HUD_WANTED_BAR_OFF_X)*CanvasWidth,
  798.                 (IconPos[WantedIndex].Y + HUD_WANTED_BAR_OFF_Y)*CanvasHeight);
  799.             Canvas.DrawTile(usetex,
  800.                 Scale*BarW,
  801.                 Scale*BarH,
  802.                 0, 0, usetex.USize, usetex.VSize);
  803.         }
  804.  
  805.         myweap = P2Weapon(PawnOwner.Weapon);
  806.         // Hints from cops about dropping your weapon
  807.         if(myweap != None
  808.             && myweap.GetCopHints(str1, str2))
  809.         {
  810.             if (str1 != "")
  811.                 MyFont.DrawTextEx(Canvas, CanvasWidth, (IconPos[WantedIndex].X+WantedTextPos[0].X) * CanvasWidth,
  812.                                         (IconPos[WantedIndex].Y+WantedTextPos[0].Y) * CanvasHeight, str1, 0, true, EJ_Right);
  813.             if (str2 != "")
  814.                 MyFont.DrawTextEx(Canvas, CanvasWidth, (IconPos[WantedIndex].X+WantedTextPos[1].X) * CanvasWidth,
  815.                                         (IconPos[WantedIndex].Y+WantedTextPos[1].Y) * CanvasHeight, str2, 0, true, EJ_Right);
  816.         }
  817.     }
  818. }
  819.  
  820. ///////////////////////////////////////////////////////////////////////////////
  821. // Draw health section
  822. ///////////////////////////////////////////////////////////////////////////////
  823. simulated function DrawHealthAndArmor(canvas Canvas, float Scale)
  824.     {
  825.     local Texture usetex;
  826.     local float HeartW, HeartH;
  827.     local int UseHealth, UseArmor, HealthColor;
  828.  
  829.     UseHealth = PawnOwner.GetHealthPercent();
  830.     UseArmor = PawnOwner.GetArmorPercent();
  831.  
  832.     // + 0.010 is what the X needs
  833.    
  834.     // Draw background
  835.     Canvas.Style = ERenderStyle.STY_Masked;
  836.     Canvas.DrawColor = DefaultIconColor;
  837.     Canvas.SetPos(
  838.         (IconPos[HealthIndex].X + (HUD_BACKGROUND_X_OFFSET))*CanvasWidth,
  839.         (IconPos[HealthIndex].Y + HUD_BACKGROUND_Y_OFFSET)*CanvasHeight);
  840.     Canvas.DrawIcon(Texture(SectionBackground[HUD_HEALTH]), Scale);
  841.  
  842.     // Draw the beating heart
  843.     Canvas.Style = ERenderStyle.STY_Masked;
  844.     if(UseHealth > 100)
  845.         HealthColor = 100;
  846.     else
  847.         HealthColor = UseHealth;
  848.     // Make sure the health isn't zero and shouldn't be. If so, make it one.
  849.     if(UseHealth == 0
  850.         && PawnOwner.Health > 0)
  851.         UseHealth = 1;
  852.  
  853.     // Make the heart yellow when you're using the catnip, but it still gets redder
  854.     // the more hurt you are.
  855.     if(OurPlayer.CatnipUseTime > 0)
  856.         Canvas.SetDrawColor(155+HealthColor,55+HealthColor*2,0);
  857.     else    // Make it normal-colored, but the more you get hurt, the redder it gets
  858.         Canvas.SetDrawColor(155+HealthColor,55+HealthColor*2,55+HealthColor*2);
  859.  
  860.     usetex = Texture(HeartIcon);
  861.     HeartW = usetex.USize + (HeartPumpSizeX*usetex.USize - usetex.USize/4);
  862.     HeartH = usetex.VSize + (HeartPumpSizeY*usetex.VSize - usetex.VSize/4);
  863.     Canvas.SetPos(
  864.         IconPos[HealthIndex].X*CanvasWidth - Scale*(HeartW/2),
  865.         IconPos[HealthIndex].Y*CanvasHeight - Scale*(HeartH/2));
  866.     Canvas.DrawTile(usetex,
  867.         Scale*HeartW,
  868.         Scale*HeartH,
  869.         0, 0, usetex.USize, usetex.VSize);
  870.    
  871.     // Draw health in text number form
  872.     MyFont.DrawTextEx(Canvas, CanvasWidth,
  873.         (IconPos[HealthIndex].X + HUD_NUMBERS_OFFSET_X) * CanvasWidth,
  874.         (IconPos[HealthIndex].Y + HUD_NUMBERS_OFFSET_Y) * CanvasHeight,
  875.         ""$UseHealth, 2);
  876.  
  877.     // Draw armor stuff if it's being used
  878.         if(UseArmor > 0)
  879.             {
  880.             // Draw icon
  881.             Canvas.Style = ERenderStyle.STY_Masked;
  882.             Canvas.DrawColor = DefaultIconColor;
  883.             Canvas.SetPos(
  884.                 (IconPos[HealthIndex].X + HUD_ARMOR_ICON_OFFSET_X) * CanvasWidth,
  885.                 (IconPos[HealthIndex].Y + HUD_ARMOR_ICON_OFFSET_Y) * CanvasHeight);
  886.  
  887.             Canvas.DrawIcon(OurPlayer.HudArmorIcon, Scale * HUD_ARMOR_ICON_SCALE);
  888.  
  889.             // Draw numbers
  890.             MyFont.DrawTextEx(Canvas, CanvasWidth,
  891.                 (IconPos[HealthIndex].X + HUD_ARMOR_NUMBERS_OFFSET_X) * CanvasWidth,
  892.                 (IconPos[HealthIndex].Y + HUD_ARMOR_NUMBERS_OFFSET_Y) * CanvasHeight,
  893.                 ""$UseArmor, 1);
  894.             }
  895.     }
  896.  
  897. ///////////////////////////////////////////////////////////////////////////////
  898. // Draw weapon section
  899. ///////////////////////////////////////////////////////////////////////////////
  900. simulated function DrawWeapon(canvas Canvas, float Scale)
  901.     {
  902.     local Texture usetex;
  903.     local P2Weapon myweap;
  904.     local String str1, str2;
  905.  
  906.     //log(self$" draw weapon, "$PawnOwner.Weapon);
  907.     //if(PawnOwner.Weapon != None)
  908.     //  log(self$" ammo "$P2AmmoInv(PawnOwner.Weapon.AmmoType));
  909.     if(PawnOwner.Weapon != None && P2AmmoInv(PawnOwner.Weapon.AmmoType) != None)
  910.         {
  911.         // Draw background
  912.         Canvas.Style = ERenderStyle.STY_Masked;
  913.         Canvas.DrawColor = DefaultIconColor;
  914.         Canvas.SetPos(
  915.             (IconPos[WeapIndex].X + HUD_BACKGROUND_X_OFFSET)*CanvasWidth,
  916.             (IconPos[WeapIndex].Y + HUD_BACKGROUND_Y_OFFSET)*CanvasHeight);
  917.         Canvas.DrawIcon(Texture(SectionBackground[HUD_AMMO]), Scale);
  918.        
  919.         // Draw ammo icon
  920.         Canvas.Style = ERenderStyle.STY_Masked;
  921.         Canvas.DrawColor = DefaultIconColor;
  922.         usetex = Texture(PawnOwner.Weapon.AmmoType.Texture);
  923.         if(usetex != None)
  924.             {
  925.             Canvas.SetPos(
  926.                 IconPos[WeapIndex].X*CanvasWidth - Scale*(usetex.USize/2),
  927.                 IconPos[WeapIndex].Y*CanvasHeight - Scale*(usetex.VSize/2));
  928.             Canvas.DrawIcon(usetex, Scale);
  929.             }
  930.        
  931.         // Draw ammo count in text number form
  932.         if(P2AmmoInv(PawnOwner.Weapon.AmmoType).bShowAmmoOnHud)
  933.             {
  934.             MyFont.DrawTextEx(Canvas, CanvasWidth,
  935.                 (IconPos[WeapIndex].X+HUD_NUMBERS_OFFSET_X)*CanvasWidth,
  936.                 (IconPos[WeapIndex].Y+HUD_NUMBERS_OFFSET_Y)*CanvasHeight,
  937.                 ""$PawnOwner.Weapon.AmmoType.AmmoAmount, 2);
  938.  
  939.             if(P2AmmoInv(PawnOwner.Weapon.AmmoType).bShowMaxAmmoOnHud)
  940.                 {
  941.                 MyFont.DrawTextEx(Canvas, CanvasWidth,
  942.                     (IconPos[WeapIndex].X+HUD_NUMBERS_MAX_AMMO_OFFSET_X)*CanvasWidth,
  943.                     (IconPos[WeapIndex].Y+HUD_NUMBERS_OFFSET_Y)*CanvasHeight,
  944.                     "/"$PawnOwner.Weapon.AmmoType.MaxAmmo, 2);
  945.                 }
  946.             }
  947.  
  948.         // Draw text hints
  949.         myweap = P2Weapon(PawnOwner.Weapon);
  950.         if(myweap != None
  951.             && P2GameInfoSingle(Level.Game) != None
  952.             && P2GameInfo(Level.Game).AllowInventoryHints())
  953.             {
  954.             // Weapon hints (how to use them)
  955.             if(WeapHintDeathTime > Level.TimeSeconds
  956.                 || WeapHintDeathTime == INFINITE_HINT_TIME)
  957.                 {
  958.                 if (WeapHint1 != "")
  959.                     MyFont.DrawTextEx(Canvas, CanvasWidth, (IconPos[WeapIndex].X+WeapTextPos[0].X) * CanvasWidth,
  960.                                             (IconPos[WeapIndex].Y+WeapTextPos[0].Y) * CanvasHeight, WeapHint1, 0, true, EJ_Right);
  961.                 if (WeapHint2 != "")
  962.                     MyFont.DrawTextEx(Canvas, CanvasWidth, (IconPos[WeapIndex].X+WeapTextPos[1].X) * CanvasWidth,
  963.                                             (IconPos[WeapIndex].Y+WeapTextPos[1].Y) * CanvasHeight, WeapHint2, 0, true, EJ_Right);
  964.                 if (WeapHint3 != "")
  965.                     MyFont.DrawTextEx(Canvas, CanvasWidth, (IconPos[WeapIndex].X+WeapTextPos[2].X) * CanvasWidth,
  966.                                             (IconPos[WeapIndex].Y+WeapTextPos[2].Y) * CanvasHeight, WeapHint3, 0, true, EJ_Right);
  967.                 }
  968.             }
  969.         }
  970.     }
  971.  
  972. ///////////////////////////////////////////////////////////////////////////////
  973. // Draw inventory section
  974. ///////////////////////////////////////////////////////////////////////////////
  975. simulated function DrawInventory(canvas Canvas, float Scale)
  976. {
  977.     local Texture usetex;
  978.     local String str;
  979.     local OwnedInv OwnedOne;
  980.     local P2PowerupInv CurrentItem;
  981.     local String str1, str2;
  982.  
  983.     // Draw background
  984.     Canvas.Style = ERenderStyle.STY_Masked;
  985.     Canvas.DrawColor = DefaultIconColor;
  986.     Canvas.SetPos(
  987.         (IconPos[InvIndex].X + HUD_BACKGROUND_X_OFFSET)*CanvasWidth,
  988.         (IconPos[InvIndex].Y + HUD_BACKGROUND_Y_OFFSET)*CanvasHeight);
  989.     Canvas.DrawIcon(Texture(SectionBackground[HUD_INVENTORY]), Scale);
  990.    
  991.     CurrentItem = P2PowerupInv(PawnOwner.SelectedItem);
  992.     if(CurrentItem  != None)
  993.     {
  994.         // Draw inventory icon
  995.         Canvas.Style = ERenderStyle.STY_Masked;
  996.         Canvas.DrawColor = DefaultIconColor;
  997.         usetex = Texture(CurrentItem.Icon);
  998.         Canvas.SetPos(
  999.             IconPos[InvIndex].X*CanvasWidth - Scale*(usetex.USize/2),
  1000.             IconPos[InvIndex].Y*CanvasHeight - Scale*(usetex.VSize/2));
  1001.         Canvas.DrawIcon(usetex, Scale);
  1002.  
  1003.         // Draw inventory count in text form (only if desired and if more than 1)
  1004.         if(CurrentItem.bDisplayAmount && CurrentItem.Amount > 1)
  1005.         {
  1006.             if(!CurrentItem.bDisplayAsFloat)
  1007.                 str = ""$(int(CurrentItem.Amount));
  1008.             else
  1009.                 str = ""$CurrentItem.Amount;
  1010.             MyFont.DrawTextEx(Canvas, CanvasWidth,
  1011.                 (IconPos[InvIndex].X+HUD_NUMBERS_OFFSET_X)*CanvasWidth,
  1012.                 (IconPos[InvIndex].Y+HUD_NUMBERS_OFFSET_Y)*CanvasHeight,
  1013.                 str, 2);
  1014.         }
  1015.  
  1016.         if(P2GameInfoSingle(Level.Game) != None
  1017.             && P2GameInfo(Level.Game).AllowInventoryHints())
  1018.         {
  1019.             // If you're getting mugged, give hints on what to do--override cop hints
  1020.             if(OurPlayer.GetMuggerHints(str1, str2))
  1021.             {
  1022.                 if (str1 != "")
  1023.                     MyFont.DrawTextEx(Canvas, CanvasWidth, (IconPos[InvIndex].X+InvTextPos[0].X)* CanvasWidth,
  1024.                                             (IconPos[InvIndex].Y+InvTextPos[0].Y) * CanvasHeight, str1, 0, true, EJ_Right);
  1025.                 if (str2 != "")
  1026.                     MyFont.DrawTextEx(Canvas, CanvasWidth, (IconPos[InvIndex].X+InvTextPos[1].X) * CanvasWidth,
  1027.                                             (IconPos[InvIndex].Y+InvTextPos[1].Y) * CanvasHeight, str2, 0, true, EJ_Right);
  1028.             }
  1029.             // Draw text hints if we allow them and if the timer for them
  1030.             // is still good (or if we need to draw them forever)
  1031.             else if(InvHintDeathTime > Level.TimeSeconds
  1032.                     || InvHintDeathTime == INFINITE_HINT_TIME)
  1033.                 {
  1034.                 //CurrentItem.GetHints(PawnOwner, InvHint1, str2, str3);
  1035.                 if (InvHint1 != "")
  1036.                     MyFont.DrawTextEx(Canvas, CanvasWidth, (IconPos[InvIndex].X+InvTextPos[0].X)* CanvasWidth,
  1037.                                         (IconPos[InvIndex].Y+InvTextPos[0].Y) * CanvasHeight, InvHint1, 0, true, EJ_Right);
  1038.                 if (InvHint2 != "")
  1039.                     MyFont.DrawTextEx(Canvas, CanvasWidth, (IconPos[InvIndex].X+InvTextPos[1].X) * CanvasWidth,
  1040.                                         (IconPos[InvIndex].Y+InvTextPos[1].Y) * CanvasHeight, InvHint2, 0, true, EJ_Right);
  1041.                 if (InvHint3 != "")
  1042.                     MyFont.DrawTextEx(Canvas, CanvasWidth, (IconPos[InvIndex].X+InvTextPos[2].X) * CanvasWidth,
  1043.                                         (IconPos[InvIndex].Y+InvTextPos[2].Y) * CanvasHeight, InvHint3, 0, true, EJ_Right);
  1044.             }
  1045.         }
  1046.     }
  1047. }
  1048.  
  1049. ///////////////////////////////////////////////////////////////////////////////
  1050. ///////////////////////////////////////////////////////////////////////////////
  1051. simulated function CalcRadarDists(bool bIsMP,
  1052.                                   out vector dir,
  1053.                                   out float dist)
  1054. {
  1055.     dir.z=0;
  1056.     dist = VSize(dir);
  1057.     if(bIsMP)
  1058.         dist = dist*MP_RADAR_SCALE;
  1059.     else
  1060.         dist = dist*OurPlayer.RadarScale;
  1061. }
  1062.  
  1063. ///////////////////////////////////////////////////////////////////////////////
  1064. ///////////////////////////////////////////////////////////////////////////////
  1065. simulated function RadarFindFishLoc(float dist,
  1066.                                        float Scale,
  1067.                                        float pheight,
  1068.                                        bool bIsMP,
  1069.                                         out vector dir,
  1070.                                         out float fishx, out float fishy,
  1071.                                         out float iconsize)
  1072. {
  1073.     local float ang;
  1074.  
  1075.     // Scale heights only if your in MP games
  1076.     if(bIsMP)
  1077.     {
  1078.         if(pheight > 0)
  1079.         {
  1080.             if(pheight > OurPlayer.RadarMaxZ)
  1081.                 iconsize = OurPlayer.RadarMaxZ;
  1082.             else
  1083.                 iconsize = pheight;
  1084.         }
  1085.         else
  1086.         {
  1087.             if(pheight < -OurPlayer.RadarMaxZ)
  1088.                 iconsize = -OurPlayer.RadarMaxZ;
  1089.             else
  1090.                 iconsize = pheight;
  1091.         }
  1092.         iconsize/=2;
  1093.         iconsize = (Scale + Scale*(iconsize/OurPlayer.RadarMaxZ));
  1094.     }
  1095.     else // SP does no scaling like this
  1096.         iconsize = Scale;
  1097.  
  1098.     dir = Normal(dir);
  1099.     if(dir.y != 0)
  1100.         ang = atan(dir.x/dir.y);
  1101.     if(dir.y < 0)
  1102.         ang+=Pi;
  1103.     //log(PawnOwner$" dir "$dir$" angle "$ang$" acos "$acos(1.0/dir.x));
  1104.     ang = (PawnOwner.Rotation.Yaw*0.0000959) + ang;
  1105.     if(ang > 2*Pi)
  1106.         ang-=2*Pi;
  1107.  
  1108.     fishx = dist*Scale*(cos(ang)) - iconsize*(RadarPlayer.USize/2);
  1109.     fishy = -(AspectRatio*dist*Scale*(sin(ang))) - iconsize*(RadarPlayer.VSize/2);
  1110. }
  1111.  
  1112.  
  1113. ///////////////////////////////////////////////////////////////////////////////
  1114. // Draw flags for ctf game
  1115. ///////////////////////////////////////////////////////////////////////////////
  1116. simulated function DrawRadarFlags(canvas Canvas, float radarx, float radary)
  1117. {
  1118. //  STUB
  1119. }
  1120.  
  1121. ///////////////////////////////////////////////////////////////////////////////
  1122. // Draw bags for gb game
  1123. ///////////////////////////////////////////////////////////////////////////////
  1124. simulated function DrawRadarBags(canvas Canvas, float radarx, float radary)
  1125. {
  1126. //  STUB
  1127. }
  1128.  
  1129. ///////////////////////////////////////////////////////////////////////////////
  1130. // Draw radar showing other people around you
  1131. ///////////////////////////////////////////////////////////////////////////////
  1132. simulated function DrawRadar(canvas Canvas, float Scale)
  1133. {
  1134.     local float UseSize, dist, radarx, radary, targetx, targety, RadarTimer;
  1135.     local float pheight, iconsize, glowalpha, sy, fishx, fishy;
  1136.     local P2Pawn radarp;
  1137.     local vector radarf;
  1138.     local int i;
  1139.     local bool bShowMouseHint, bIsMP;
  1140.     local vector dir;
  1141.     local GameReplicationInfo gri;
  1142.     //local Texture usetex;
  1143.  
  1144.     if(OurPlayer.RadarTargetStats())
  1145.     {
  1146.         // Dim the background
  1147.         Canvas.SetPos(0, 0);
  1148.         Canvas.Style = ERenderStyle.STY_Alpha;
  1149.         Canvas.SetDrawColor(255, 255, 255, BACKGROUND_TARGET_ALPHA);
  1150.         Canvas.DrawTile(BlackBox, Canvas.SizeX, Canvas.SizeY, 0, 0, BlackBox.USize, BlackBox.VSize);
  1151.         // Draw stats
  1152.         sy = RADAR_TARGET_STATS;
  1153.         if(OurPlayer.RadarTargetKills > 0)
  1154.             MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarStatsHint1, 2, false, EJ_Center);
  1155.         else
  1156.             MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarStatsHint0, 2, false, EJ_Center);
  1157.         sy+=0.05;
  1158.         MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarStatsHint2$OurPlayer.RadarTargetKills, 2, false, EJ_Center);
  1159.         if(TargetPrizes.Length > 0)
  1160.         {
  1161.             sy=0.7;
  1162.             // List prizes
  1163.             MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarStatsHint3, 2, false, EJ_Center);
  1164.         }
  1165.         // Draw hint to continue on
  1166.         if(OurPlayer.RadarTargetStatsGetInput())
  1167.         {
  1168.             sy=0.9;
  1169.             MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarStatsHint4, 1, false, EJ_Center);
  1170.         }
  1171.         // draw targetter
  1172.         Canvas.DrawColor = RedColor;
  1173.         targetx = 0.5; targety = 0.6;
  1174.         Canvas.SetPos(targetx*CanvasWidth - Scale*(RadarPlayer.USize/2),
  1175.                         targety*CanvasHeight - Scale*(RadarPlayer.VSize/2));
  1176.         Canvas.Style = ERenderStyle.STY_Masked;
  1177.         Canvas.DrawIcon(RadarTarget[OurPlayer.GetRadarTargetFrame()], Scale);
  1178.         // draw prizes
  1179.         targetx = 0.2; targety = 0.8;
  1180.         Canvas.DrawColor = WhiteColor;
  1181.         for(i=0; i<TargetPrizes.Length; i++)
  1182.         {
  1183.             Canvas.SetPos(targetx*CanvasWidth - Scale*(RadarPlayer.USize/2),
  1184.                             targety*CanvasHeight - Scale*(RadarPlayer.VSize/2));
  1185.             Canvas.DrawIcon(Texture(TargetPrizes[i]), Scale);
  1186.             targetx+=0.1;
  1187.         }
  1188.     }
  1189.     else if(OurPlayer.RadarTargetKilling())
  1190.     {
  1191.         sy = RADAR_TARGET_KILL_HINTS;
  1192.         switch(OurPlayer.RadarTargetKillHint())
  1193.         {
  1194.             case 0:
  1195.                 MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarKillHint0, 2, false, EJ_Center);
  1196.                 bShowMouseHint=true;
  1197.                 break;
  1198.             case 1:
  1199.             case 2: // hold on to this hint a little.
  1200.                 MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarKillHint1, 2, false, EJ_Center);
  1201.                 bShowMouseHint=true;
  1202.                 break;
  1203.             case 3:
  1204.                 MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarKillHint2, 2, false, EJ_Center);
  1205.                 bShowMouseHint=true;
  1206.                 break;
  1207.             case 4:
  1208.                 MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarDeadHint, 2, false, EJ_Center);
  1209.                 break;
  1210.         }
  1211.         sy = RADAR_TARGET_MOUSE_HINT;
  1212.         MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarMouseHint, 1, false, EJ_Center);
  1213.         // draw targetter as person dies
  1214.         Canvas.DrawColor = RedColor;
  1215.         Canvas.SetPos(OurPlayer.RadarTargetX*CanvasWidth - Scale*(RadarPlayer.USize/2),
  1216.                         OurPlayer.RadarTargetY*CanvasHeight - Scale*(RadarPlayer.VSize/2));
  1217.         Canvas.Style = ERenderStyle.STY_Masked;
  1218.         Canvas.DrawIcon(RadarTarget[OurPlayer.GetRadarTargetFrame()], Scale);
  1219.     }
  1220.     else
  1221.     {
  1222.         // When in targetting mode
  1223.         if(OurPlayer.RadarTargetReady())
  1224.         {
  1225.             // Dim the background
  1226.             Canvas.SetPos(0, 0);
  1227.             Canvas.Style = ERenderStyle.STY_Alpha;
  1228.             Canvas.SetDrawColor(255, 255, 255, BACKGROUND_TARGET_ALPHA);
  1229.             Canvas.DrawTile(BlackBox, Canvas.SizeX, Canvas.SizeY, 0, 0, BlackBox.USize, BlackBox.VSize);
  1230.             // Put up some hints
  1231.             sy = RADAR_TARGET_HINTS;
  1232.             // Title
  1233.             if(OurPlayer.RadarTargetNotStartedYet())
  1234.                 MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarHint0, 2, false, EJ_Center);
  1235.             else
  1236.                 MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarHint6, 2, false, EJ_Center);
  1237.             sy+=0.05;
  1238.             // If we're still waiting, tell them how to start
  1239.             if(OurPlayer.RadarTargetWaiting())
  1240.                 MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarHint1, 2, false, EJ_Center);
  1241.             sy+=0.1;
  1242.             // Timer
  1243.             RadarTimer = OurPlayer.GetRadarTargetTimer();
  1244.             MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarHint2$RadarTimer, 2, false, EJ_Center);
  1245.             sy+=0.05;
  1246.             // Gameplay hints
  1247.             MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarHint3, 1, false, EJ_Center);
  1248.             sy+=0.05;
  1249.             MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarHint4, 1, false, EJ_Center);
  1250.             sy+=0.05;
  1251.             MyFont.DrawTextEx(Canvas, CanvasWidth, 0.5 * CanvasWidth, sy * CanvasHeight, RadarHint5, 1, false, EJ_Center);
  1252.             targetx = (OurPlayer.RadarTargetX)*CanvasWidth;
  1253.             targety = (OurPlayer.RadarTargetY)*CanvasHeight;
  1254.         }
  1255.  
  1256.         Canvas.Style = ERenderStyle.STY_Normal;
  1257.         Canvas.DrawColor = DefaultIconColor;
  1258.         UseSize = OurPlayer.RadarSize*Scale;
  1259.         // Draw main background image for radar (this part slides into place)
  1260.         Canvas.SetPos(HUD_RADAR_X*CanvasWidth - (UseSize*RADAR_IMAGE_SCALE/2),
  1261.                         OurPlayer.RadarBackY*CanvasHeight - (UseSize*RADAR_IMAGE_SCALE/2));
  1262.         Canvas.DrawTile(RadarBackground,
  1263.                         UseSize*RADAR_IMAGE_SCALE,
  1264.                         UseSize*RADAR_IMAGE_SCALE,
  1265.                         0, 0, RadarBackground.USize, RadarBackground.VSize);
  1266.  
  1267.         if(Level.Game == None
  1268.             || !Level.Game.bIsSinglePlayer)
  1269.             bIsMP=true;
  1270.  
  1271.         // See if you should show anything more than just the background
  1272.         if(!OurPlayer.ShowRadarBackOnly())
  1273.         {
  1274.             // Only draw the icons if the radar is completely On.
  1275.             if(OurPlayer.ShowRadarFull())
  1276.             {      
  1277.                 radarx=HUD_RADAR_X*CanvasWidth;// - UseSize/2 - Scale*(RadarPlayer.USize/8);
  1278.                 radary=HUD_RADAR_Y*CanvasHeight;// - UseSize/2 - Scale*(RadarPlayer.VSize/8);
  1279.                
  1280.                 // Draw all the pawns within radar
  1281.                 for(i = 0; i<OurPlayer.RadarPawns.Length; i++)
  1282.                 {
  1283.                     // convert 3d world coords to around the player in the radar coords
  1284.                     radarp = OurPlayer.RadarPawns[i];
  1285.                     if(radarp != None)
  1286.                     {
  1287.                         dir = radarp.Location - PawnOwner.Location;
  1288.                         pheight = dir.z;
  1289.  
  1290.                         // If you're within the immediate height of the dude, be drawn
  1291.                         // (or if it's MP, always show others)
  1292.                         if(abs(pheight) < OurPlayer.RadarMaxZ
  1293.                             || OurPlayer.RadarInDoors==0
  1294.                             || bIsMP)
  1295.                         {
  1296.                             CalcRadarDists(bIsMP, dir, dist);
  1297.  
  1298.                             // If you're within the appropriate radius from the player, be drawn
  1299.                             if((bIsMP
  1300.                                     && dist < MP_RADAR_RADIUS)
  1301.                                 || dist < OurPlayer.RadarShowRadius)
  1302.                             {
  1303.  
  1304.                                 RadarFindFishLoc(dist, Scale, pheight, bIsMP, dir, fishx, fishy, iconsize);
  1305.                                 Canvas.SetPos(radarx + fishx, radary + fishy);
  1306.  
  1307.                                 // Special colors based on fish attitude
  1308.                                 if(PersonController(radarp.Controller) != None)
  1309.                                 {
  1310.                                     // Violent attackers (or distracted attackers) show up red
  1311.                                     if((PersonController(radarp.Controller).Attacker == PawnOwner
  1312.                                         || PersonController(radarp.Controller).PlayerAttackedMe == PawnOwner)
  1313.                                         && radarp.bHasViolentWeapon)
  1314.                                         Canvas.DrawColor = RedColor;
  1315.                                     // Everyone else--scared of dude, or just interested, show up yellow
  1316.                                     else if(PersonController(radarp.Controller).InterestPawn == PawnOwner)
  1317.                                         Canvas.DrawColor = YellowColor;
  1318.                                     // Neutrals show up white (or people interested in other people)
  1319.                                     else
  1320.                                         Canvas.DrawColor = WhiteColor;
  1321.                                 }
  1322.                                 else // default is a white fish
  1323.                                     Canvas.DrawColor = WhiteColor;
  1324.  
  1325.                                 // Draw the fish
  1326.                                 Canvas.DrawIcon(RadarNPC, iconsize);
  1327.  
  1328.                                 Canvas.Style = ERenderStyle.STY_Alpha;
  1329.                                 Canvas.DrawColor = WhiteColor;
  1330.                                 // Draw in a cop hat, if the player has that plug-in and this is
  1331.                                 // an Authority figure.
  1332.                                 if(radarp.bAuthorityFigure)
  1333.                                 {
  1334.                                     if(OurPlayer.bRadarShowCops)
  1335.                                     {
  1336.                                         Canvas.SetPos(radarx + fishx + COP_OFFSET_X*CanvasWidth,
  1337.                                                     radary + fishy + COP_OFFSET_Y*CanvasHeight);
  1338.                                         Canvas.DrawIcon(RadarCopHat, iconsize);
  1339.                                     }
  1340.                                 }
  1341.                                 // Draw a little gun over the fish, if the player has the
  1342.                                 // plug-in to detect hidden weapons
  1343.                                 // Don't draw cops with guns also
  1344.                                 else if(OurPlayer.bRadarShowGuns
  1345.                                     && radarp.bHasViolentWeapon)
  1346.                                 {
  1347.                                     Canvas.SetPos(radarx + fishx + GUN_OFFSET_X*CanvasWidth,
  1348.                                                 radary + fishy + GUN_OFFSET_Y*CanvasHeight);
  1349.                                     Canvas.DrawIcon(RadarGun, iconsize);
  1350.                                 }
  1351.                                 Canvas.Style = ERenderStyle.STY_Normal;
  1352.  
  1353.                                 if(OurPlayer.RadarTargetIsOn()
  1354.                                     && radarp.Health > 0)
  1355.                                 {
  1356.                                     // Targetting is going, so kill people, when it hits them
  1357.                                     if(abs(targetx - fishx) < (TARGET_KILL_RADIUS/AspectRatio)
  1358.                                         && abs(targety - fishy) < TARGET_KILL_RADIUS)
  1359.                                     {
  1360.                                         OurPlayer.TargetKillsPawn(radarp);
  1361.                                         // If you're killing someone, don't let this go any further
  1362.                                         return;
  1363.                                     }
  1364.                                 }
  1365.                             }
  1366.                         }
  1367.                     }
  1368.                 }
  1369.  
  1370.                 DrawRadarFlags(Canvas, radarx, radary);
  1371.  
  1372.                 DrawRadarBags(Canvas, radarx, radary);
  1373.  
  1374.                 // Draw in targetter
  1375.                 if(OurPlayer.RadarTargetReady())
  1376.                 {
  1377.                     Canvas.DrawColor = RedColor;
  1378.                     targetx = (OurPlayer.RadarTargetX) + HUD_RADAR_X;
  1379.                     targety = (OurPlayer.RadarTargetY) + HUD_RADAR_Y;
  1380.                     Canvas.SetPos(targetx*CanvasWidth - Scale*(RadarPlayer.USize/2),
  1381.                                     targety*CanvasHeight - Scale*(RadarPlayer.VSize/2));
  1382.  
  1383.                     Canvas.Style = ERenderStyle.STY_Masked;
  1384.  
  1385.                     Canvas.DrawIcon(RadarTarget[OurPlayer.GetRadarTargetFrame()], Scale);
  1386.                 }
  1387.                 else
  1388.                 {
  1389.                     // Reset color
  1390.                     Canvas.DrawColor = WhiteColor;
  1391.                     // Draw center (player boat image)
  1392.                     Canvas.SetPos(HUD_RADAR_X*CanvasWidth - Scale*(RadarPlayer.USize/2),// - UseSize/2 - (Texture(HeartIcon).USize*(Scale/8)),
  1393.                                     HUD_RADAR_Y*CanvasHeight - Scale*(RadarPlayer.VSize/2));// - UseSize/2 - (Texture(HeartIcon).VSize*(Scale/8)));
  1394.  
  1395.                     Canvas.Style = ERenderStyle.STY_Normal;//ERenderStyle.STY_Translucent;
  1396.  
  1397.                     Canvas.DrawIcon(RadarPlayer, Scale);
  1398.                 }
  1399.             } // show icons
  1400.  
  1401.             Canvas.Style = ERenderStyle.STY_Translucent;
  1402.             // Make the glow flicker if it's not fully on yet.
  1403.             if(OurPlayer.ShowRadarFlicker())
  1404.                 glowalpha = RADAR_WARMUP_BASE - Rand(RADAR_WARMUP_RAND);
  1405.             else
  1406.                 glowalpha = RADAR_NORMAL_BASE - Rand(RADAR_NORMAL_RAND) + OurPlayer.PulseGlow;
  1407.             Canvas.SetDrawColor(glowalpha, glowalpha, glowalpha);
  1408.             Canvas.SetPos(HUD_RADAR_X*CanvasWidth - (UseSize*RADAR_IMAGE_SCALE/2),
  1409.                             (HUD_RADAR_Y)*CanvasHeight - (UseSize*RADAR_IMAGE_SCALE/2));
  1410.             Canvas.DrawTile(RadarGlow,
  1411.                             UseSize*RADAR_IMAGE_SCALE,
  1412.                             UseSize*RADAR_IMAGE_SCALE,
  1413.                             0, 0, RadarGlow.USize, RadarGlow.VSize);
  1414.         }
  1415.     }
  1416. }
  1417.  
  1418. ///////////////////////////////////////////////////////////////////////////////
  1419. // Draw the hurt bars around the edges to show direction of the attacker.
  1420. ///////////////////////////////////////////////////////////////////////////////
  1421. simulated function DrawHurtBars(canvas Canvas, float Scale)
  1422. {
  1423.     local int i;
  1424.     local float HealthRatio;
  1425.     local float xpos, ypos, useh, usew, fadeamount;
  1426.     local Texture usetex;
  1427.  
  1428.     HealthRatio = (1.0 - PawnOwner.Health/PawnOwner.HealthMax);
  1429.     if(HealthRatio < 0.0)
  1430.         HealthRatio = 0.0;
  1431.     else
  1432.         HealthRatio = HURT_BAR_HEALTH_MOD*HealthRatio;
  1433.     // Handle fading 'hurt bars' around your view
  1434.     for(i=0; i<ArrayCount(OurPlayer.HurtBarTime); i++)
  1435.     {
  1436.         if(OurPlayer.HurtBarTime[i] > 0)
  1437.         {
  1438.             Canvas.Style = ERenderStyle.STY_Translucent;
  1439.            
  1440.             fadeamount = (OurPlayer.HurtBarTime[i])*OurPlayer.HurtBarAlpha;
  1441.  
  1442.             Canvas.SetDrawColor(fadeamount,0,0); // shows bars in red
  1443.             switch(i)
  1444.             {
  1445.                 case 0: // top
  1446.                     usetex = Texture(TopHurtBar);
  1447.  
  1448.                     usew = usetex.USize*HURT_TOP_Y_INC;
  1449.                     useh = usetex.VSize*(HURT_TOP_X_INC + HealthRatio);
  1450.                     xpos = 0.5;
  1451.                     ypos = 0.0;
  1452.                 break;
  1453.                 case 1: // right
  1454.                     usetex = Texture(SideHurtBar);
  1455.  
  1456.                     usew = usetex.USize*(HURT_SIDE_X_INC + HealthRatio);
  1457.                     useh = usetex.VSize*HURT_SIDE_Y_INC;
  1458.                     xpos = 1.0;
  1459.                     ypos = 0.5;
  1460.                 break;
  1461.                 case 2: // down
  1462.                     usetex = Texture(TopHurtBar);
  1463.  
  1464.                     usew = usetex.USize*HURT_TOP_Y_INC;
  1465.                     useh = usetex.VSize*(HURT_TOP_X_INC + HealthRatio);
  1466.                     xpos = 0.5;
  1467.                     ypos = 1.0;
  1468.                 break;
  1469.                 case 3: // left
  1470.                     usetex = Texture(SideHurtBar);
  1471.  
  1472.                     usew = usetex.USize*(HURT_SIDE_X_INC + HealthRatio);
  1473.                     useh = usetex.VSize*HURT_SIDE_Y_INC;
  1474.                     xpos = 0.0;
  1475.                     ypos = 0.5;
  1476.                 break;
  1477.                 case 4: // SKULL
  1478.                     fadeamount = (OurPlayer.HurtBarTime[i])*SKULL_ALPHA;
  1479.                     // less alphaed, but red like hurt bars
  1480.                     Canvas.SetDrawColor(fadeamount/2,0,0);
  1481.                         //fadeamount/2,fadeamount/2);
  1482.                     usetex = Texture(SkullHurtBar);
  1483.  
  1484.                     usew = usetex.USize*(HealthRatio)*SKULL_SIZE_RATIO;
  1485.                     useh = usetex.VSize*(HealthRatio)*SKULL_SIZE_RATIO;
  1486.                     xpos = 0.5;
  1487.                     ypos = 0.5;
  1488.                 break;
  1489.             }
  1490.             Canvas.SetPos(
  1491.                 xpos*CanvasWidth - Scale*(usew/2),
  1492.                 ypos*CanvasHeight - Scale*(useh/2));
  1493.             Canvas.DrawTile(usetex,
  1494.                 Scale*usew,
  1495.                 Scale*useh,
  1496.                 0, 0, usetex.USize, usetex.VSize);
  1497.         }
  1498.     }
  1499. }
  1500.  
  1501. ///////////////////////////////////////////////////////////////////////////////
  1502. // Draw the sniper bars around the edges to show direction of the guy
  1503. // who has you in his sights (with his sniper rifle)
  1504. ///////////////////////////////////////////////////////////////////////////////
  1505. simulated function DrawSniperBars(canvas Canvas, float Scale)
  1506. {
  1507.     local int i;
  1508.     local float xpos, ypos, useh, usew, fadeamount;
  1509.     local Texture usetex;
  1510.  
  1511.     // Figure out the direction of the sniper aiming at me
  1512.     if(!OurPlayer.bSniperBarsClear
  1513.         && PawnOwner != None)
  1514.     {
  1515.         // Handle fading 'sniper bars' around your view
  1516.         for(i=0; i<ArrayCount(OurPlayer.SniperBarTime); i++)
  1517.         {
  1518.             if(OurPlayer.SniperBarTime[i] > 0)
  1519.             {
  1520.                 Canvas.Style = ERenderStyle.STY_Alpha;
  1521.                
  1522.                 fadeamount = ((OurPlayer.SniperBarTime[i]/SNIPER_BAR_MAX_TIME)*SNIPER_BAR_ALPHA);
  1523.                 if(int(fadeamount) > 0)
  1524.                 {
  1525.                     // Alpha the bars in, in order to draw them in black
  1526.                     Canvas.SetDrawColor(255, 255, 255, fadeamount);
  1527.                     switch(i)
  1528.                     {
  1529.                         case 0: // top
  1530.                             usetex = Texture(TopSniperBar);
  1531.  
  1532.                             usew = usetex.USize*SNIPER_TOP_Y_INC;
  1533.                             useh = usetex.VSize*(SNIPER_TOP_X_INC + SNIPER_BAR_INCREASE_TOP);
  1534.                             xpos = 0.5;
  1535.                             ypos = 0.0;
  1536.                         break;
  1537.                         case 1: // right
  1538.                             usetex = Texture(SideSniperBar);
  1539.  
  1540.                             usew = usetex.USize*(SNIPER_SIDE_X_INC + SNIPER_BAR_INCREASE_SIDE);
  1541.                             useh = usetex.VSize*SNIPER_SIDE_Y_INC;
  1542.                             xpos = 1.0;
  1543.                             ypos = 0.5;
  1544.                         break;
  1545.                         case 2: // down
  1546.                             usetex = Texture(TopSniperBar);
  1547.  
  1548.                             usew = usetex.USize*SNIPER_TOP_Y_INC;
  1549.                             useh = usetex.VSize*(SNIPER_TOP_X_INC + SNIPER_BAR_INCREASE_TOP);
  1550.                             xpos = 0.5;
  1551.                             ypos = 1.0;
  1552.                         break;
  1553.                         case 3: // left
  1554.                             usetex = Texture(SideSniperBar);
  1555.  
  1556.                             usew = usetex.USize*(SNIPER_SIDE_X_INC + SNIPER_BAR_INCREASE_SIDE);
  1557.                             useh = usetex.VSize*SNIPER_SIDE_Y_INC;
  1558.                             xpos = 0.0;
  1559.                             ypos = 0.5;
  1560.                         break;
  1561.                     }
  1562.                     Canvas.SetPos(
  1563.                         xpos*CanvasWidth - Scale*(usew/2),
  1564.                         ypos*CanvasHeight - Scale*(useh/2));
  1565.                     Canvas.DrawTile(usetex,
  1566.                         Scale*usew,
  1567.                         Scale*useh,
  1568.                         0, 0, usetex.USize, usetex.VSize);
  1569.                 }
  1570.             }
  1571.         }
  1572.     }
  1573. }
  1574.  
  1575. ///////////////////////////////////////////////////////////////////////////////
  1576. // Draw the Level Action
  1577. // Called by base class.  Return value says whether or not to hide player
  1578. // progress messages, which are displayed in the same area of the screen.
  1579. ///////////////////////////////////////////////////////////////////////////////
  1580. function bool DrawLevelAction( canvas C )
  1581.     {
  1582.     local string BigMessage;
  1583.     local float y;
  1584.  
  1585.     y = 0.5;
  1586.     BigMessage = "";
  1587.  
  1588.     if (Level.LevelAction == LEVACT_None )
  1589.         {
  1590.         // Check if we're paused (note the use of another magical epic number here)
  1591.         if ((Level.Pauser != None) && (Level.TimeSeconds > Level.PauseDelay + 0.2))
  1592.             {
  1593.             // Make sure no screens or root windows are running (somewhat time-consuming
  1594.             // but it's okay because if we get here we know the game is already paused)
  1595.             if ((OurPlayer.CurrentScreen == None) && !AreAnyRootWindowsRunning())
  1596.                 {
  1597.                 // Display paused message
  1598.                 BigMessage = PausedMessage;
  1599.                 }
  1600.             }
  1601.         }
  1602.     else if (Level.LevelAction == LEVACT_Loading)
  1603.         {
  1604. /*  This message was flashing, apparently because it was only drawn on one
  1605.     backbuffer.  We'll have to figure out a better way to get this to show
  1606.     up.  It wasn't working when done in P2Screen, either, apparently because
  1607.     font may not have been valid at that point.
  1608.     if (P2GameInfoSingle(Level.Game) != None &&
  1609.             P2GameInfoSingle(Level.Game).bQuitting)
  1610.             BigMessage = QuittingMessage;
  1611.         else
  1612.             BigMessage = LoadingMessage;
  1613.         y = LoadingMessageY;
  1614. */
  1615.         }
  1616. // Until we're sure these messages won't flicker
  1617. //  else if (Level.LevelAction == LEVACT_Quitting)
  1618. //      BigMessage = QuittingMessage;
  1619.     else if (Level.LevelAction == LEVACT_Saving)
  1620.         BigMessage = SavingMessage;
  1621.     else if (Level.LevelAction == LEVACT_EasySaving)
  1622.         BigMessage = EasySavingMessage;
  1623.     else if (Level.LevelAction == LEVACT_AutoSaving)
  1624.         BigMessage = AutoSavingMessage;
  1625.     else if (Level.LevelAction == LEVACT_ForcedSaving)
  1626.         BigMessage = ForcedSavingMessage;
  1627. // Until we're sure these messages won't flicker
  1628. //  else if (Level.LevelAction == LEVACT_Restarting)
  1629. //      BigMessage = RestartingMessage;
  1630.     else if (Level.LevelAction == LEVACT_Precaching)
  1631.         BigMessage = PrecachingMessage;
  1632.    
  1633.     if (BigMessage != "")
  1634.         {
  1635.         MyFont.DrawTextEx(C, CanvasWidth, CanvasWidth/2, CanvasHeight * y, BigMessage, 3, false, EJ_Center);
  1636.         return true;
  1637.         }
  1638.     return false;
  1639.     }
  1640.  
  1641. ///////////////////////////////////////////////////////////////////////////////
  1642. // Check if root window is running
  1643. ///////////////////////////////////////////////////////////////////////////////
  1644. function bool AreAnyRootWindowsRunning()
  1645.     {
  1646.     local P2RootWindow root;
  1647.  
  1648.     root = P2RootWindow(OurPlayer.Player.InteractionMaster.BaseMenu);
  1649.     if (root != None)
  1650.         return root.IsMenuShowing();
  1651.     return false;
  1652.     }
  1653.  
  1654. ///////////////////////////////////////////////////////////////////////////////
  1655. // Add hud messages
  1656. ///////////////////////////////////////////////////////////////////////////////
  1657. function AddHudMsgs(array<S_HudMsg> msgs, float Lifetime)
  1658.     {
  1659.     local int i;
  1660.  
  1661.     DeleteHudMsgs();
  1662.  
  1663.     // Add new messages
  1664.     for (i = 0; i < msgs.Length; i++)
  1665.         HudMsgs[i] = msgs[i];
  1666.  
  1667.     HudMsgsEndTime = Level.TimeSeconds + Lifetime;
  1668.     }
  1669.  
  1670. ///////////////////////////////////////////////////////////////////////////////
  1671. // Delete hud messages
  1672. ///////////////////////////////////////////////////////////////////////////////
  1673. function DeleteHudMsgs()
  1674.     {
  1675.     if (HudMsgs.Length > 0)
  1676.         HudMsgs.remove(0, HudMsgs.Length);
  1677.     }
  1678.  
  1679. ///////////////////////////////////////////////////////////////////////////////
  1680. // Draw hud messages
  1681. ///////////////////////////////////////////////////////////////////////////////
  1682. function DrawHudMsgs(Canvas Canvas)
  1683.     {
  1684.     local int i;
  1685.  
  1686.     if (HudMsgs.Length > 0)
  1687.         {
  1688.         if (HudMsgsEndTime > Level.TimeSeconds)
  1689.             {
  1690.             for (i = 0; i < HudMsgs.Length; i++)
  1691.                 {
  1692.                 if (HudMsgs[i].Msg != "")
  1693.                     {
  1694.                     MyFont.DrawTextEx(
  1695.                         Canvas,
  1696.                         CanvasWidth,
  1697.                         HudMsgs[i].X * CanvasWidth,
  1698.                         HudMsgs[i].Y * CanvasHeight,
  1699.                         HudMsgs[i].Msg,
  1700.                         HudMsgs[i].FontSize,
  1701.                         HudMsgs[i].bPlain,
  1702.                         HudMsgs[i].JustifyFromX);
  1703.                     }
  1704.                 }
  1705.             }
  1706.         else
  1707.             DeleteHudMsgs();
  1708.         }
  1709.     }
  1710.  
  1711. ///////////////////////////////////////////////////////////////////////////////
  1712. // Each time a new inventory item  comes up, the hints get updatted.
  1713. ///////////////////////////////////////////////////////////////////////////////
  1714. function SetInvHints(string str1, string str2, string str3, byte InfiniteTime)
  1715. {
  1716.     InvHint1 = str1;
  1717.     InvHint2 = str2;
  1718.     InvHint3 = str3;
  1719.     if(InfiniteTime == 0)
  1720.         InvHintDeathTime = Level.TimeSeconds + INV_HINT_LIFETIME;
  1721.     else
  1722.         InvHintDeathTime = INFINITE_HINT_TIME;
  1723. }
  1724.  
  1725. ///////////////////////////////////////////////////////////////////////////////
  1726. // Each time a new weapon item  comes up, the hints get updatted.
  1727. ///////////////////////////////////////////////////////////////////////////////
  1728. function SetWeapHints(string str1, string str2, string str3, byte InfiniteTime)
  1729. {
  1730.     WeapHint1 = str1;
  1731.     WeapHint2 = str2;
  1732.     WeapHint3 = str3;
  1733.     if(InfiniteTime == 0)
  1734.         WeapHintDeathTime = Level.TimeSeconds + WEAP_HINT_LIFETIME;
  1735.     else
  1736.         WeapHintDeathTime = INFINITE_HINT_TIME;
  1737. }
  1738.  
  1739. ///////////////////////////////////////////////////////////////////////////////
  1740. // Default properties
  1741. ///////////////////////////////////////////////////////////////////////////////
  1742.  
  1743. defaultproperties
  1744. {
  1745.      WhiteColor=(B=255,G=255,R=255,A=255)
  1746.      DefaultIconColor=(B=220,G=220,R=220,A=255)
  1747.      YellowColor=(G=255,R=255,A=255)
  1748.      RedColor=(R=255,A=255)
  1749.      BlueColor=(B=255,A=255)
  1750.      HeartIcon=Texture'nathans.Inventory.heartinv'
  1751.      WantedIcon=Texture'HUDPack.Icons.icon_inv_badge'
  1752.      WantedBar=Texture'HUDPack.Icons.icon_inv_badge_slider'
  1753.      SectionBackground(0)=Texture'nathans.Inventory.bloodsplat-1'
  1754.      SectionBackground(1)=Texture'nathans.Inventory.bloodsplat-2'
  1755.      SectionBackground(2)=Texture'nathans.Inventory.bloodsplat-3'
  1756.      RadarBackground=Texture'P2Misc.Fish_Radar.Bass_Sniffer'
  1757.      RadarPlayer=Texture'P2Misc.Fish_Radar.boat'
  1758.      RadarNPC=Texture'P2Misc.Fish_Radar.Fish'
  1759.      RadarGlow=Texture'P2Misc.Fish_Radar.Bass_Sniffer_Lens'
  1760.      RadarTarget(0)=Texture'nathans.Chompy.Chompy1'
  1761.      RadarTarget(1)=Texture'nathans.Chompy.Chompy2'
  1762.      RadarCopHat=Texture'nathans.RadarPlugIns.cophat'
  1763.      RadarGun=Texture'nathans.RadarPlugIns.fishgun'
  1764.      BlackBox=Texture'nathans.Inventory.blackbox64'
  1765.      TopHurtBar=Texture'MPfx.softwhitedotbig'
  1766.      SideHurtBar=Texture'MPfx.softwhitedotbig'
  1767.      SkullHurtBar=Texture'HUDPack.Icons.YourDead'
  1768.      IconPos(0)=(X=0.935000,Y=0.120000)
  1769.      IconPos(1)=(X=0.935000,Y=0.270000)
  1770.      IconPos(2)=(X=0.935000,Y=0.420000)
  1771.      IconPos(3)=(X=0.935000,Y=0.570000)
  1772.      InvTextPos(0)=(X=-0.055000,Y=-0.035000)
  1773.      InvTextPos(1)=(X=-0.055000,Y=-0.010000)
  1774.      InvTextPos(2)=(X=-0.055000,Y=0.015000)
  1775.      WeapTextPos(0)=(X=-0.055000,Y=0.015000)
  1776.      WeapTextPos(1)=(X=-0.055000,Y=0.040000)
  1777.      WeapTextPos(2)=(X=-0.055000,Y=0.065000)
  1778.      WantedTextPos(0)=(X=-0.055000,Y=-0.030000)
  1779.      WantedTextPos(1)=(X=-0.055000)
  1780.      InvIndex=1
  1781.      HealthIndex=2
  1782.      WantedIndex=3
  1783.      RadarHint0="Hey kids! It's Chompy, the Voodoo Fish!"
  1784.      RadarHint1="Press the movement keys to start!"
  1785.      RadarHint2="TimeLeft: "
  1786.      RadarHint3="Steer Chompy towards other fish to gobble them up!"
  1787.      RadarHint4="Don't worry about getting hurt..."
  1788.      RadarHint5="Chompy's mystical energy will protect you!"
  1789.      RadarHint6="Go Chompy, Go!"
  1790.      RadarKillHint0="Okay kids... here comes Chompy!"
  1791.      RadarKillHint1="Oooh! That's gotta hurt..."
  1792.      RadarKillHint2="Just let his dark Voodoo powers do the work..."
  1793.      RadarStatsHint0="Chompy's hungry! Eat more next time."
  1794.      RadarStatsHint1="Way to go Chompy!"
  1795.      RadarStatsHint2="Fish eaten: "
  1796.      RadarStatsHint3="Prizes granted:"
  1797.      RadarStatsHint4="Press the movement keys to return to normal gameplay."
  1798.      RadarDeadHint="Way to go Chompy!"
  1799.      RadarMouseHint="Move the Mouse to watch the show."
  1800.      RocketHint1="Press Jump (Spacebar) to return to the Dude."
  1801.      RocketHint2="Press Movement keys (W,A,S,D) to control the rocket."
  1802.      RocketHint3="Your rocket is out of gas! Enjoy the ride down."
  1803.      SuicideHintMajor="Press Fire to end it all."
  1804.      SuicideHintMinor="Use Mouse Wheel to zoom in and out."
  1805.      SuicideHintMajorAlt="Press Secondary Fire to wuss out."
  1806.      DeadMessage1="Press the 'Restart' key (Spacebar)"
  1807.      DeadMessage2="to load your most recent game."
  1808.      DeadDemoMessage1="Press the Spacebar key"
  1809.      DeadDemoMessage2="return to the Main Menu."
  1810.      QuittingMessage="Quitting Game"
  1811.      LoadingMessageY=0.810000
  1812.      EasySavingMessage="Easy Saving"
  1813.      AutoSavingMessage="Auto Saving"
  1814.      RestartingMessage="Restarting"
  1815.      ForcedSavingMessage="Saving"
  1816.      TopSniperBar=Texture'MPfx.softblackdot'
  1817.      SideSniperBar=Texture'MPfx.softblackdot'
  1818.      CategoryFormats(0)=(XP=0.020000,YP=0.020000)
  1819.      CategoryFormats(1)=(XP=0.020000,YP=0.900000,VAlign=TVA_Bottom,FontSize=1)
  1820.      CategoryFormats(2)=(XP=0.020000,YP=0.950000,VAlign=TVA_Bottom)
  1821.      CategoryFormats(3)=(XP=0.020000,YP=0.850000,VAlign=TVA_Bottom)
  1822.      CategoryFormats(4)=(XP=0.020000,YP=0.800000,VAlign=TVA_Bottom)
  1823. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement