Advertisement
Guest User

Untitled

a guest
Sep 29th, 2010
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.39 KB | None | 0 0
  1. /*
  2.  
  3. // Edge relative placement values for rect->h_align and rect->v_align
  4. #define HORIZONTAL_ALIGN_SUBLEFT 0 // left edge of a 4:3 screen (safe area not included)
  5. #define HORIZONTAL_ALIGN_LEFT 1 // left viewable (safe area) edge
  6. #define HORIZONTAL_ALIGN_CENTER 2 // center of the screen (reticle)
  7. #define HORIZONTAL_ALIGN_RIGHT 3 // right viewable (safe area) edge
  8. #define HORIZONTAL_ALIGN_FULLSCREEN 4 // disregards safe area
  9. #define HORIZONTAL_ALIGN_NOSCALE 5 // uses exact parameters - neither adjusts for safe area nor scales for screen size
  10. #define HORIZONTAL_ALIGN_TO640 6 // scales a real-screen resolution x down into the 0 - 640 range
  11. #define HORIZONTAL_ALIGN_CENTER_SAFEAREA 7 // center of the safearea
  12. #define HORIZONTAL_ALIGN_MAX HORIZONTAL_ALIGN_CENTER_SAFEAREA
  13. #define HORIZONTAL_ALIGN_DEFAULT HORIZONTAL_ALIGN_SUBLEFT
  14.  
  15. #define VERTICAL_ALIGN_SUBTOP 0 // top edge of the 4:3 screen (safe area not included)
  16. #define VERTICAL_ALIGN_TOP 1 // top viewable (safe area) edge
  17. #define VERTICAL_ALIGN_CENTER 2 // center of the screen (reticle)
  18. #define VERTICAL_ALIGN_BOTTOM 3 // bottom viewable (safe area) edge
  19. #define VERTICAL_ALIGN_FULLSCREEN 4 // disregards safe area
  20. #define VERTICAL_ALIGN_NOSCALE 5 // uses exact parameters - neither adjusts for safe area nor scales for screen size
  21. #define VERTICAL_ALIGN_TO480 6 // scales a real-screen resolution y down into the 0 - 480 range
  22. #define VERTICAL_ALIGN_CENTER_SAFEAREA 7 // center of the save area
  23. #define VERTICAL_ALIGN_MAX VERTICAL_ALIGN_CENTER_SAFEAREA
  24. #define VERTICAL_ALIGN_DEFAULT VERTICAL_ALIGN_SUBTOP
  25.  
  26. static const char *g_he_font[] =
  27. {
  28. "default", // HE_FONT_DEFAULT
  29. "bigfixed", // HE_FONT_BIGFIXED
  30. "smallfixed", // HE_FONT_SMALLFIXED
  31. "objective", // HE_FONT_OBJECTIVE
  32. };
  33.  
  34.  
  35. // These values correspond to the defines in q_shared.h
  36. static const char *g_he_alignx[] =
  37. {
  38. "left", // HE_ALIGN_LEFT
  39. "center", // HE_ALIGN_CENTER
  40. "right", // HE_ALIGN_RIGHT
  41. };
  42.  
  43.  
  44. static const char *g_he_aligny[] =
  45. {
  46. "top", // HE_ALIGN_TOP
  47. "middle", // HE_ALIGN_MIDDLE
  48. "bottom", // HE_ALIGN_BOTTOM
  49. };
  50.  
  51.  
  52. // These values correspond to the defines in menudefinition.h
  53. static const char *g_he_horzalign[] =
  54. {
  55. "subleft", // HORIZONTAL_ALIGN_SUBLEFT
  56. "left", // HORIZONTAL_ALIGN_LEFT
  57. "center", // HORIZONTAL_ALIGN_CENTER
  58. "right", // HORIZONTAL_ALIGN_RIGHT
  59. "fullscreen", // HORIZONTAL_ALIGN_FULLSCREEN
  60. "noscale", // HORIZONTAL_ALIGN_NOSCALE
  61. "alignto640", // HORIZONTAL_ALIGN_TO640
  62. "center_safearea", // HORIZONTAL_ALIGN_CENTER_SAFEAREA
  63. };
  64. cassert( ARRAY_COUNT( g_he_horzalign ) == HORIZONTAL_ALIGN_MAX + 1 );
  65.  
  66.  
  67. static const char *g_he_vertalign[] =
  68. {
  69. "subtop", // VERTICAL_ALIGN_SUBTOP
  70. "top", // VERTICAL_ALIGN_TOP
  71. "middle", // VERTICAL_ALIGN_CENTER
  72. "bottom", // VERTICAL_ALIGN_BOTTOM
  73. "fullscreen", // VERTICAL_ALIGN_FULLSCREEN
  74. "noscale", // VERTICAL_ALIGN_NOSCALE
  75. "alignto480", // VERTICAL_ALIGN_TO480
  76. "center_safearea", // VERTICAL_ALIGN_CENTER_SAFEAREA
  77. };
  78. cassert( ARRAY_COUNT( g_he_vertalign ) == VERTICAL_ALIGN_MAX + 1 );
  79. */
  80.  
  81. init()
  82. {
  83. precacheShader( "progress_bar_bg" );
  84. precacheShader( "progress_bar_fg" );
  85. precacheShader( "progress_bar_fill" );
  86.  
  87. level.uiParent = spawnstruct();
  88. level.uiParent.horzAlign = "left";
  89. level.uiParent.vertAlign = "top";
  90. level.uiParent.alignX = "left";
  91. level.uiParent.alignY = "top";
  92. level.uiParent.x = 0;
  93. level.uiParent.y = 0;
  94. level.uiParent.width = 0;
  95. level.uiParent.height = 0;
  96. level.uiParent.children = [];
  97.  
  98. level.fontHeight = 12;
  99.  
  100. level.hud["allies"] = spawnstruct();
  101. level.hud["axis"] = spawnstruct();
  102.  
  103. // we can, of course, separate out the following constants for splitscreen.
  104. // primary progress bars are for things like capturing flags or planting bombs - big, important things that happen as you play a gametype
  105. level.primaryProgressBarY = -61; // from center
  106. level.primaryProgressBarX = 0;
  107. level.primaryProgressBarHeight = 9; //28; // this is the height and width of the whole progress bar, including the outline. the part that actually moves is 2 pixels smaller.
  108. level.primaryProgressBarWidth = 120;
  109. level.primaryProgressBarTextY = -75;
  110. level.primaryProgressBarTextX = 0;
  111. level.primaryProgressBarFontSize = .6; // 1.4 before font change from "objective"
  112.  
  113. level.teamProgressBarY = 32; // 205;
  114. level.teamProgressBarHeight = 14;
  115. level.teamProgressBarWidth = 192;
  116. level.teamProgressBarTextY = 8; // 155;
  117. level.teamProgressBarFontSize = 1.65;
  118.  
  119. if ( level.splitscreen )
  120. {
  121. level.lowerTextYAlign = "BOTTOM";
  122. level.lowerTextY = -76;
  123. level.lowerTextFontSize = 1.14;
  124. }
  125. else
  126. {
  127. level.lowerTextYAlign = "CENTER";
  128. level.lowerTextY = 70;
  129. level.lowerTextFontSize = 1.6;
  130. }
  131. }
  132.  
  133.  
  134. fontPulseInit( maxFontScale )
  135. {
  136. self.baseFontScale = self.fontScale;
  137. if ( isDefined( maxFontScale ) )
  138. self.maxFontScale = min( maxFontScale, 6.3 );
  139. else
  140. self.maxFontScale = min( self.fontScale * 2, 6.3 );
  141. self.inFrames = 2;
  142. self.outFrames = 4;
  143. }
  144.  
  145.  
  146. fontPulse(player)
  147. {
  148. self notify ( "fontPulse" );
  149. self endon ( "fontPulse" );
  150. self endon( "death" );
  151.  
  152. player endon("disconnect");
  153. player endon("joined_team");
  154. player endon("joined_spectators");
  155.  
  156. self ChangeFontScaleOverTime( self.inFrames * 0.05 );
  157. self.fontScale = self.maxFontScale;
  158. wait self.inFrames * 0.05;
  159.  
  160. self ChangeFontScaleOverTime( self.outFrames * 0.05 );
  161. self.fontScale = self.baseFontScale;
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement