Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. // Emacs style mode select   -*- C++ -*-
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // $Log:$
  18. //
  19. // DESCRIPTION:
  20. //
  21. //-----------------------------------------------------------------------------
  22.  
  23. static const char
  24. rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
  25.  
  26. #include <stdlib.h>
  27. #include <stdarg.h>
  28. #include <ctype.h>
  29. //#include "SDL.h"
  30. //#include "SDL_timer.h"
  31.  
  32. #include "doomdef.h"
  33. #include "m_misc.h"
  34. #include "i_video.h"
  35. #include "i_sound.h"
  36.  
  37. #include "d_net.h"
  38. #include "g_game.h"
  39.  
  40.  
  41. #include "i_system.h"
  42.  
  43. int     mb_used = 6;
  44.  
  45.  
  46. int I_strncasecmp(char *str1, char *str2, int len)
  47. {
  48.         char c1, c2;
  49.  
  50.         while ( *str1 && *str2 && len-- ) {
  51.                 c1 = *str1++;
  52.                 c2 = *str2++;
  53.                 if ( toupper(c1) != toupper(c2) )
  54.                         return(1);
  55.         }
  56.         return(0);
  57. }
  58.  
  59. void
  60. I_Tactile
  61. ( int   on,
  62.   int   off,
  63.   int   total )
  64. {
  65.   // UNUSED.
  66.   on = off = total = 0;
  67. }
  68.  
  69. ticcmd_t        emptycmd;
  70. ticcmd_t*       I_BaseTiccmd(void)
  71. {
  72.     return &emptycmd;
  73. }
  74.  
  75.  
  76. int  I_GetHeapSize (void)
  77. {
  78.  return mb_used*1024*1024;
  79. }
  80.  
  81. byte* I_ZoneBase (int*  size)
  82. {
  83.  *size = mb_used*1024*1024;
  84.  return (byte *) _aligned_malloc(*size, 128);;
  85. }
  86.  
  87.  
  88. //
  89. // I_GetTime
  90. // returns time in 1/35 second tics
  91. //
  92.  
  93. __declspec(dllimport) unsigned int __stdcall GetTickCount(void);
  94.  
  95. int  I_GetTime (void)
  96. {
  97.  unsigned int tm;
  98. // _asm
  99. // {
  100. //    mov eax, 26
  101. //    mov ebx, 9
  102. //    int 0x40
  103. //    mov [tm], eax
  104. // };
  105.  
  106.  tm=GetTickCount()/10;
  107.  
  108.  
  109.  return (tm*TICRATE)/100;
  110. }
  111.  
  112.  
  113.  
  114. //
  115. // I_Init
  116. //
  117. void I_Init (void)
  118. {
  119.   I_InitGraphics();
  120.   I_InitSound();
  121. }
  122.  
  123. //
  124. // I_Quit
  125. //
  126. void I_Quit (void)
  127. {
  128. //    __libclog_printf("Calling I_Quit from %x\n",__builtin_return_address(0));
  129.     D_QuitNetGame ();
  130.  //   I_ShutdownSound();
  131.  //   I_ShutdownMusic();
  132.     M_SaveDefaults ();
  133.     I_ShutdownGraphics();
  134.     exit(0);
  135. }
  136.  
  137. void I_WaitVBL(int count)
  138. {
  139.  //__menuet__delay100((count*10)/7);
  140. }
  141.  
  142. void I_BeginRead(void)
  143. {
  144. }
  145.  
  146. void I_EndRead(void)
  147. {
  148. }
  149.  
  150. byte*   I_AllocLow(int length)
  151. {
  152.     byte*       mem;
  153.        
  154.     mem = (byte *)malloc (length);
  155.     memset (mem,0,length);
  156.     return mem;
  157. }
  158.  
  159.  
  160. //
  161. // I_Error
  162. //
  163. extern boolean demorecording;
  164.  
  165. void I_Error (char *error, ...)
  166. {
  167.     va_list     argptr;
  168.  
  169.     // Message first.
  170.     va_start (argptr,error);
  171.     printf ("Error: ");
  172.     printf (error,argptr);
  173.     printf (stderr, "\n");
  174.     va_end (argptr);
  175.  
  176.     // Shutdown. Here might be other errors.
  177.     if (demorecording)
  178.         G_CheckDemoStatus();
  179.  
  180.     D_QuitNetGame ();
  181.     I_ShutdownGraphics();
  182.     getch();
  183.     exit(-1);
  184. }
  185.