i_video_ps3.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #include "Precompiled.h"
  21. #include "globaldata.h"
  22. #include <stdlib.h>
  23. #include <stdarg.h>
  24. #include <sys/types.h>
  25. #include "i_video.h"
  26. #include "i_system.h"
  27. #include "doomstat.h"
  28. #include "v_video.h"
  29. #include "m_argv.h"
  30. #include "d_main.h"
  31. #include "doomdef.h"
  32. //#include <d3d8.h> // SMF
  33. //#include <xgraphics.h> // SMF
  34. void I_ShutdownGraphics(void)
  35. {
  36. // VVTODO: Shutdown Graphics
  37. }
  38. //
  39. // I_StartFrame
  40. //
  41. void I_StartFrame (void)
  42. {
  43. // er?
  44. }
  45. static void I_CombineMouseEvent(const event_t* in, event_t* out)
  46. {
  47. if (fabs((float)in->data1) > fabs((float)out->data1))
  48. out->data1 = in->data1;
  49. if (fabs((float)in->data2) > fabs((float)out->data2))
  50. out->data2 = in->data2;
  51. if (fabs((float)in->data3) > fabs((float)out->data3))
  52. out->data3 = in->data3;
  53. }
  54. void I_GetEvents( controller_t *controller )
  55. {
  56. event_t e_mouse, e_joystick;
  57. int numEvents;
  58. e_mouse.type = ev_mouse;
  59. e_mouse.data1 = e_mouse.data2 = e_mouse.data3 = 0;
  60. e_joystick.type = ev_joystick;
  61. e_joystick.data1 = e_joystick.data2 = e_joystick.data3 = 0;
  62. numEvents = I_PollMouseInputEvents( controller );
  63. if (numEvents)
  64. {
  65. int i;
  66. event_t e;
  67. // right thumb stick
  68. for (i = 0; i < numEvents; ++i)
  69. {
  70. I_ReturnMouseInputEvent(i, &e);
  71. if (e.type == ev_mouse)
  72. I_CombineMouseEvent(&e, &e_mouse);
  73. else if (e.type == ev_joystick)
  74. I_CombineMouseEvent(&e, &e_joystick);
  75. }
  76. }
  77. numEvents = I_PollJoystickInputEvents( controller );
  78. if (numEvents)
  79. {
  80. int i;
  81. event_t e;
  82. for (i = 0; i < numEvents; ++i)
  83. {
  84. I_ReturnJoystickInputEvent(i, &e);
  85. if (e.type == ev_keydown || e.type == ev_keyup) {
  86. D_PostEvent(&e);
  87. } else if (e.type == ev_joystick) {
  88. I_CombineMouseEvent(&e, &e_joystick);
  89. } else if (e.type == ev_mouse) {
  90. I_CombineMouseEvent(&e, &e_mouse);
  91. }
  92. }
  93. }
  94. D_PostEvent(&e_mouse);
  95. D_PostEvent(&e_joystick);
  96. }
  97. //
  98. // I_UpdateNoBlit
  99. //
  100. void I_UpdateNoBlit (void)
  101. {
  102. // what is this?
  103. }
  104. //
  105. // I_FinishUpdate
  106. //
  107. void I_FinishUpdate (void)
  108. {
  109. // DHM - These buffers are not used
  110. }
  111. //
  112. // I_ReadScreen
  113. //
  114. void I_ReadScreen (byte* scr)
  115. {
  116. memcpy(scr, ::g->screens[0], SCREENWIDTH*SCREENHEIGHT);
  117. }
  118. inline unsigned int I_PackColor( unsigned int a, unsigned int r, unsigned int g, unsigned int b ) {
  119. unsigned int color = 0;
  120. color |= (r & 255) << 24;
  121. color |= (g & 255) << 16;
  122. color |= (b & 255) << 8;
  123. color |= (a & 255);
  124. return color;
  125. }
  126. //
  127. // I_SetPalette
  128. //
  129. void I_SetPalette (byte* palette)
  130. {
  131. int i;
  132. // set the X colormap entries
  133. for (i=0 ; i<256 ; i++)
  134. {
  135. int r,b,g;
  136. r = gammatable[::g->usegamma][*palette++];
  137. g = gammatable[::g->usegamma][*palette++];
  138. b = gammatable[::g->usegamma][*palette++];
  139. ::g->XColorMap[i] = I_PackColor(0xff, r, g, b);
  140. }
  141. }
  142. void I_InitGraphics()
  143. {
  144. }