Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.29 KB | None | 0 0
  1.  
  2. version "2.4"
  3.  
  4. class VanillaRocket : Rocket Replaces Rocket
  5. {
  6. PlayerInfo plr ;
  7.  
  8. override void BeginPlay()
  9. {
  10. plr = players[consoleplayer] ;
  11. super.BeginPlay() ;
  12. }
  13.  
  14. States
  15. {
  16. Death:
  17. MISL B 8 Bright A_Explode ;
  18. MISL C 6 Bright ;
  19. MISL D 4 Bright ;
  20. TNT1 A 0
  21. {
  22. if( plr && Cvar.GetCVar( "ve_shortrocket", plr ).GetBool() ) A_StopSound() ;
  23. }
  24. Stop ;
  25. }
  26. }
  27.  
  28. class VanEssHandler : EventHandler
  29. {
  30. private ui transient cvar lowres, detail, resolution, quantize_h, quantize_w, par, lowres_psp, smoothx, smoothy, smoothlog, crycolour ;//, alphabright ;
  31.  
  32. private ui void get_cvars( PlayerInfo plr )
  33. {
  34. lowres = Cvar.GetCVar( "ve_lowres", plr );
  35. detail = Cvar.GetCVar( "ve_detail", plr );
  36. resolution = Cvar.GetCVar( "ve_resolution", plr );
  37. quantize_h = Cvar.GetCVar( "ve_quantize_h", plr );
  38. quantize_w = Cvar.GetCVar( "ve_quantize_w", plr );
  39. par = Cvar.GetCVar( "ve_par", plr );
  40. lowres_psp = Cvar.GetCVar( "ve_lowres_psp", plr );
  41. smoothx = Cvar.GetCVar( "ve_smoothx", plr );
  42. smoothy = Cvar.GetCVar( "ve_smoothy", plr );
  43. smoothlog = Cvar.GetCVar( "ve_smoothlog", plr );
  44. crycolour = Cvar.GetCVar( "ve_crycolour", plr );
  45. //alphabright = Cvar.GetCVar( "ve_alphabright", plr );
  46. }
  47.  
  48. private ui bool should_get_cvars()
  49. {
  50. return( lowres == null );
  51. }
  52.  
  53. override void UiTick()
  54. {
  55. PlayerInfo plr = players[ consoleplayer ];
  56. if( plr )
  57. {
  58. if( should_get_cvars() ) { get_cvars( plr ); }
  59.  
  60. if( lowres.GetBool() )
  61. {
  62. double detail = detail.GetInt() * .5 ;
  63. double height = max( resolution.GetInt(), 48 );
  64. if( quantize_h.GetBool() ) height = screen.getheight() / int( screen.getheight() / height + .5);
  65.  
  66. double width = screen.getwidth() ;
  67. if( detail <= 1 )
  68. {
  69. double stdaspect = 4. / 3 ;
  70. double pxlaspect = 42. / par.GetInt() ;
  71. double stdwidth = screen.getheight() * stdaspect ;
  72. double addwidth = screen.getwidth() / stdwidth ;
  73.  
  74. width = height * stdaspect * addwidth * pxlaspect * detail ;
  75. if( quantize_w.GetBool() ) width = screen.getwidth() / int( screen.getwidth() / width + .5);
  76. }
  77.  
  78. if( lowres_psp.GetBool() )
  79. {
  80. Shader.SetUniform2f( plr, "VanResPSP", "upres", ( width, height ));
  81. Shader.SetUniform2f( plr, "VanResPSP", "dnres", ( 1. / max( width, .25 ), 1. / height ));
  82. Shader.SetUniform2f( plr, "VanResPSP", "smoothing", (smoothx.GetFloat() * .01, smoothy.GetFloat() * .01));
  83. Shader.SetUniform1f( plr, "VanResPSP", "log", smoothlog.GetFloat() * .01 );
  84. Shader.SetEnabled( plr, "VanResPSP", true );
  85. Shader.SetEnabled( plr, "VanRes", false );
  86. }
  87. else
  88. {
  89. Shader.SetUniform2f( plr, "VanRes", "upres", ( width, height ));
  90. Shader.SetUniform2f( plr, "VanRes", "dnres", ( 1. / max( width, .25 ), 1. / height ));
  91. Shader.SetUniform2f( plr, "VanRes", "smoothing", (smoothx.GetFloat() * .01, smoothy.GetFloat() * .01));
  92. Shader.SetUniform1f( plr, "VanRes", "log", smoothlog.GetFloat() * .01 );
  93. Shader.SetEnabled( plr, "VanRes", true );
  94. Shader.SetEnabled( plr, "VanResPSP", false );
  95. }
  96. }
  97. else
  98. {
  99. Shader.SetEnabled( plr, "VanRes", false );
  100. Shader.SetEnabled( plr, "VanResPSP", false );
  101. }
  102.  
  103. int crymode = crycolour.GetInt() ;
  104. if( crymode > 0 )
  105. {
  106. Shader.SetUniform1i( plr, "CRYspace", "crymode", crymode );
  107. Shader.SetEnabled( plr, "CRYspace", true );
  108. }
  109. else Shader.SetEnabled( plr, "CRYspace", false );
  110.  
  111. //if( alphabright.GetBool() ) Shader.SetEnabled( plr, "AlphaBright", true );
  112. //else Shader.SetEnabled( plr, "AlphaBright", false );
  113. }
  114. }
  115. }
  116.  
  117. class StretchHandler : EventHandler
  118. {
  119. override void WorldThingSpawned( WorldEvent e )
  120. {
  121. if( e.Thing.sprite )
  122. {
  123. //if( e.Thing is "PlayerPawn" ) return ;
  124. e.Thing.A_SetInventory( "SpriteScaler", 1 );
  125. }
  126. }
  127.  
  128. private ui transient cvar par_stretch ;
  129.  
  130. private ui void get_cvars( PlayerInfo plr )
  131. {
  132. par_stretch = Cvar.GetCVar( "ve_par_stretch", plr );
  133. }
  134.  
  135. private ui bool should_get_cvars()
  136. {
  137. return( par_stretch == null );
  138. }
  139.  
  140. override void RenderOverlay( RenderEvent e )
  141. {
  142. PlayerInfo p = players[ consoleplayer ] ;
  143. if( p )
  144. {
  145. if( should_get_cvars() ) { get_cvars( p ); }
  146.  
  147. double pitch ;
  148. switch( par_stretch.GetInt() )
  149. {
  150. case 0:
  151. Shader.SetEnabled( p, "SceneStretch", false );
  152. Shader.SetEnabled( p, "BBloomStretch", false );
  153. Shader.SetEnabled( p, "BBloomStretchSolo", false );
  154. break;
  155. case 1:
  156. Shader.SetEnabled( p, "SceneStretch", true );
  157.  
  158. pitch = 1.0 - abs( e.viewPitch ) * 1.0 / 6.0 / 90.0 ;
  159. Shader.SetUniform1f( p, "BBloomStretch", "pitch", pitch );
  160. Shader.SetEnabled( p, "BBloomStretch", true );
  161.  
  162. Shader.SetEnabled( p, "BBloomStretchSolo", false );
  163. break;
  164. case 2:
  165. pitch = 1. - abs( e.viewPitch ) * 13. / 48. / 90.0 ;
  166. Shader.SetUniform1f( p, "BBloomStretchSolo", "pitch", pitch );
  167. Shader.SetEnabled( p, "BBloomStretchSolo", true );
  168.  
  169. Shader.SetEnabled( p, "SceneStretch", false );
  170. Shader.SetEnabled( p, "BBloomStretch", false );
  171. break;
  172. }
  173. }
  174. }
  175. }
  176.  
  177. class SpriteScaler : Inventory
  178. {
  179. PlayerInfo plr ;
  180. bool toggled ;
  181. private transient Cvar stretchCvar ;
  182.  
  183. override void BeginPlay()
  184. {
  185. plr = players[consoleplayer] ;
  186. toggled = false ;
  187. super.BeginPlay();
  188. }
  189. /*
  190. override void OnDestroy()
  191. {
  192. PlayerInfo plr = players[consoleplayer] ;
  193. if( plr && owner )
  194. {
  195. owner.A_SetInventory( "SpriteScaler", 0 );
  196. }
  197. super.OnDestroy() ;
  198. }
  199. */
  200. override void DoEffect()
  201. {
  202. //let pmobj = PlayerPawn( players[consoleplayer].mo );
  203. //if( pmobj == null ) return ;
  204.  
  205. //PlayerInfo plr = players[consoleplayer] ;
  206. if( plr && plr.mo && owner )
  207. {
  208. if( stretchCvar == null ) { stretchCvar = Cvar.GetCVar( "ve_par_stretch", plr ); }
  209.  
  210. if( stretchCvar.GetInt() == 2 )
  211. {
  212. if( !toggled )
  213. {
  214. if( owner.scale.x == owner.default.scale.x )
  215. {
  216. owner.scale.x *= .75 ;
  217. }
  218. toggled = true ;
  219. }
  220. }
  221. else if( toggled )
  222. {
  223. if( owner.scale.x == owner.default.scale.x * .75 )
  224. {
  225. owner.scale.x = owner.default.scale.x ;
  226. }
  227. toggled = false ;
  228. }
  229. }
  230. super.doeffect() ;
  231. }
  232. }
  233.  
  234.  
  235. class LowDingHandler : StaticEventHandler
  236. {
  237. PlayerInfo plr;
  238. int duration;
  239.  
  240. override void PlayerEntered(PlayerEvent e)
  241. {
  242. plr = players[e.playernumber];
  243. if( Cvar.GetCVar("ve_showdisk", plr).GetInt() > 0 ) duration = 140 ;
  244. else duration = 0 ;
  245. }
  246.  
  247. override void NetworkProcess(ConsoleEvent e)
  248. {
  249. if(e.Name == "lower_duration") --duration;
  250. }
  251.  
  252. override void RenderOverlay(RenderEvent e)
  253. {
  254. if(plr && duration > 0)
  255. {
  256. EventHandler.SendNetworkEvent("lower_duration");
  257. if(duration % 16 >= 8)
  258. {
  259. if(gameinfo.gametype==GAME_Doom)
  260. {
  261. string disktype = Cvar.GetCVar("ve_showdisk", plr).GetInt() == 2 ? "STCDROM" : "STDISK";
  262. TextureID Disk = TexMan.CheckForTexture(disktype, TexMan.Type_Any);
  263. Screen.DrawTexture(Disk, false, 304, 184, DTA_320x200, true);
  264. }
  265. else if(gameinfo.gametype==GAME_Strife)
  266. {
  267. TextureID Disk = TexMan.CheckForTexture ("STDISK", TexMan.Type_Any);
  268. Screen.DrawTexture(Disk, false, 306, 184, DTA_320x200, true);
  269. }
  270. }
  271. }
  272. }
  273. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement