You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
3.3KB

  1. /* ---------------------------------------------------------------------------|
  2. *
  3. * Distributed under the CC0 public domain license.
  4. * By Alison G. Watson. Attribution is encouraged, though not required.
  5. * See licenses/cc0.txt for more information.
  6. *
  7. * ---------------------------------------------------------------------------|
  8. *
  9. * Miscellaneous player effects.
  10. *
  11. * ---------------------------------------------------------------------------|
  12. */
  13. #include "common.h"
  14. #include "p_player.h"
  15. #include "p_hudid.h"
  16. /* Extern Functions -------------------------------------------------------- */
  17. void P_Ren_Debug(struct player *p);
  18. void P_Ren_Infrared(struct player *p);
  19. void P_Ren_Magic(struct player *p);
  20. script void P_Ren_Step(struct player *p);
  21. void P_Ren_View(struct player *p);
  22. script void P_Ren_Scope(struct player *p);
  23. /* Static Functions -------------------------------------------------------- */
  24. static void P_Ren_Style(struct player *p) {
  25. if(p->scopetoken) {
  26. SetPropI(0, APROP_RenderStyle, STYLE_Subtract);
  27. SetPropK(0, APROP_Alpha, p->getCVarK(sc_weapons_scopealpha) * p->alpha);
  28. } else {
  29. SetPropI(0, APROP_RenderStyle, STYLE_Translucent);
  30. SetPropK(0, APROP_Alpha, p->getCVarK(sc_weapons_alpha) * p->alpha);
  31. }
  32. }
  33. static void P_Ren_Advice(struct player *p) {
  34. if(CheckFade(fid_advice)) {
  35. SetSize(640, 480);
  36. SetClipW(80, 100, 500, 500, 500);
  37. PrintTextF_str(p->advice, s_smallfnt, CR_YELLOW, 80,1, 100,1, fid_advice);
  38. ClearClip();
  39. }
  40. }
  41. static void P_Ren_LevelUp(struct player *p) {
  42. if(p->old.attr.level && p->old.attr.level < p->attr.level) {
  43. ACS_LocalAmbientSound(ss_player_levelup, 127);
  44. p->logH(1, LanguageC(LANG "LOG_LevelUp%s", p->discrim), ACS_Random(1000, 9000));
  45. }
  46. if(p->attr.lvupstr[0]) {
  47. SetSize(320, 240);
  48. PrintTextChS(p->attr.lvupstr);
  49. PrintText(s_smallfnt, CR_WHITE, 220,1, 75,1);
  50. }
  51. }
  52. /* Extern Functions -------------------------------------------------------- */
  53. void P_Ren_PTickPst(struct player *p) {
  54. P_Ren_Magic(p);
  55. P_Ren_Step(p);
  56. P_Ren_Infrared(p);
  57. P_Ren_View(p);
  58. P_Ren_Scope(p);
  59. P_Ren_Style(p);
  60. P_Ren_Advice(p);
  61. P_Ren_LevelUp(p);
  62. P_Ren_Debug(p);
  63. }
  64. sync void P_TeleportIn(struct player *p) {
  65. p->teleportedout = false;
  66. ACS_AmbientSound(ss_misc_telein, 127);
  67. ACS_SetCameraToTexture(p->tid, s_LITHCAM3, 90);
  68. for(i32 i = 18, j = 18; i >= 1; i--) {
  69. ACS_Delay(1);
  70. k32 w = 1 + (i / 18.0lk / 3.0lk * 50);
  71. k32 h = 1 + (j / 18.0lk / 8.0lk * 10);
  72. SetSize(320, 200);
  73. PrintSprite(sp_Terminal_Teleport, 160,0, 100,0);
  74. SetSize(640 / w, 480 * h);
  75. PrintSprite(s_LITHCAM3, 320/w,0, 240*h,0);
  76. if(i & 3) j--;
  77. }
  78. }
  79. sync void P_TeleportOut(struct player *p) {
  80. ACS_AmbientSound(ss_misc_teleout, 127);
  81. ACS_SetCameraToTexture(p->tid, s_LITHCAM3, 90);
  82. for(i32 i = 1, j = 1; i <= 18; i++) {
  83. ACS_Delay(1);
  84. k32 w = 1 + (i / 18.0lk / 3.0lk * 50);
  85. k32 h = 1 + (j / 18.0lk / 8.0lk * 10);
  86. SetSize(320, 200);
  87. PrintSprite(sp_Terminal_Teleport, 160,0, 100,0);
  88. SetSize(640 / w, 480 * h);
  89. PrintSprite(s_LITHCAM3, 320/w,0, 240*h,0);
  90. if(i & 3) j++;
  91. }
  92. p->teleportedout = true;
  93. }
  94. script void P_TeleportInAsync(struct player *p) {
  95. P_TeleportIn(p);
  96. }
  97. script void P_TeleportOutAsync(struct player *p) {
  98. P_TeleportOut(p);
  99. }
  100. /* EOF */