i_video_xbox.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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 <signal.h>
  26. #include "i_video.h"
  27. #include "i_system.h"
  28. #include "doomstat.h"
  29. #include "v_video.h"
  30. #include "m_argv.h"
  31. #include "d_main.h"
  32. #include "doomdef.h"
  33. //#include <d3d8.h> // SMF
  34. //#include <xgraphics.h> // SMF
  35. void I_ShutdownGraphics(void)
  36. {
  37. // VVTODO: Shutdown Graphics
  38. }
  39. //
  40. // I_StartFrame
  41. //
  42. void I_StartFrame (void)
  43. {
  44. // er?
  45. }
  46. static void I_CombineMouseEvent(const event_t* in, event_t* out)
  47. {
  48. if (fabs((float)in->data1) > fabs((float)out->data1))
  49. out->data1 = in->data1;
  50. if (fabs((float)in->data2) > fabs((float)out->data2))
  51. out->data2 = in->data2;
  52. if (fabs((float)in->data3) > fabs((float)out->data3))
  53. out->data3 = in->data3;
  54. }
  55. void I_GetEvents( controller_t *controller )
  56. {
  57. event_t e_mouse, e_joystick;
  58. int numEvents;
  59. e_mouse.type = ev_mouse;
  60. e_mouse.data1 = e_mouse.data2 = e_mouse.data3 = 0;
  61. e_joystick.type = ev_joystick;
  62. e_joystick.data1 = e_joystick.data2 = e_joystick.data3 = 0;
  63. numEvents = I_PollMouseInputEvents( controller );
  64. if (numEvents)
  65. {
  66. int i;
  67. event_t e;
  68. // right thumb stick
  69. for (i = 0; i < numEvents; ++i)
  70. {
  71. I_ReturnMouseInputEvent(i, &e);
  72. if (e.type == ev_mouse)
  73. I_CombineMouseEvent(&e, &e_mouse);
  74. else if (e.type == ev_joystick)
  75. I_CombineMouseEvent(&e, &e_joystick);
  76. }
  77. }
  78. numEvents = I_PollJoystickInputEvents( controller );
  79. if (numEvents)
  80. {
  81. int i;
  82. event_t e;
  83. for (i = 0; i < numEvents; ++i)
  84. {
  85. I_ReturnJoystickInputEvent(i, &e);
  86. if (e.type == ev_keydown || e.type == ev_keyup) {
  87. D_PostEvent(&e);
  88. } else if (e.type == ev_joystick) {
  89. I_CombineMouseEvent(&e, &e_joystick);
  90. } else if (e.type == ev_mouse) {
  91. I_CombineMouseEvent(&e, &e_mouse);
  92. }
  93. }
  94. }
  95. D_PostEvent(&e_mouse);
  96. D_PostEvent(&e_joystick);
  97. }
  98. //
  99. // I_UpdateNoBlit
  100. //
  101. void I_UpdateNoBlit (void)
  102. {
  103. // what is this?
  104. }
  105. //
  106. // I_FinishUpdate
  107. //
  108. void I_FinishUpdate (void)
  109. {
  110. // DHM - These buffers are not used
  111. }
  112. //
  113. // I_ReadScreen
  114. //
  115. void I_ReadScreen (byte* scr)
  116. {
  117. XMemCpy(scr, ::g->screens[0], SCREENWIDTH*SCREENHEIGHT);
  118. }
  119. //
  120. // I_SetPalette
  121. //
  122. void I_SetPalette (byte* palette)
  123. {
  124. int i;
  125. // set the X colormap entries
  126. for (i=0 ; i<256 ; i++)
  127. {
  128. int r,b,g;
  129. r = gammatable[::g->usegamma][*palette++];
  130. g = gammatable[::g->usegamma][*palette++];
  131. b = gammatable[::g->usegamma][*palette++];
  132. ::g->XColorMap[i] = D3DCOLOR_ARGB(0xff, r, g, b);
  133. }
  134. }
  135. void I_InitGraphics()
  136. {
  137. }