Subversion Repositories Kolibri OS

Rev

Rev 298 | 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. #include "kolibri.h"
  43.  
  44. int     mb_used = 6;
  45.  
  46.  
  47. int I_strncasecmp(char *str1, char *str2, int len)
  48. {
  49.         char c1, c2;
  50.  
  51.         while ( *str1 && *str2 && len-- ) {
  52.                 c1 = *str1++;
  53.                 c2 = *str2++;
  54.                 if ( toupper(c1) != toupper(c2) )
  55.                         return(1);
  56.         }
  57.         return(0);
  58. }
  59.  
  60. void
  61. I_Tactile
  62. ( int   on,
  63.   int   off,
  64.   int   total )
  65. {
  66.   // UNUSED.
  67.   on = off = total = 0;
  68. }
  69.  
  70. ticcmd_t        emptycmd;
  71. ticcmd_t*       I_BaseTiccmd(void)
  72. {
  73.     return &emptycmd;
  74. }
  75.  
  76.  
  77. int  I_GetHeapSize (void)
  78. {
  79.  return mb_used*1024*1024;
  80. }
  81.  
  82. byte* I_ZoneBase (int*  size)
  83. {
  84.  *size = mb_used*1024*1024;
  85.  return (byte *) UserAlloc(*size);
  86. }
  87.  
  88.  
  89. //
  90. // I_GetTime
  91. // returns time in 1/35 second tics
  92. //
  93.  
  94. __declspec(dllimport) unsigned int __stdcall GetTickCount(void);
  95.  
  96. int  I_GetTime (void)
  97. {
  98.  unsigned int tm;
  99. // _asm
  100. // {
  101. //    mov eax, 26
  102. //    mov ebx, 9
  103. //    int 0x40
  104. //    mov [tm], eax
  105. // };
  106.  
  107.  tm=GetTickCount()/10;
  108.  
  109.  
  110.  return (tm*TICRATE)/100;
  111. }
  112.  
  113.  
  114.  
  115. //
  116. // I_Init
  117. //
  118. void I_Init (void)
  119. {
  120.   I_InitGraphics();
  121.   I_InitSound();
  122. }
  123.  
  124. //
  125. // I_Quit
  126. //
  127. void I_Quit (void)
  128. {
  129. //    __libclog_printf("Calling I_Quit from %x\n",__builtin_return_address(0));
  130.     D_QuitNetGame ();
  131.  //   I_ShutdownSound();
  132.  //   I_ShutdownMusic();
  133.     M_SaveDefaults ();
  134.     I_ShutdownGraphics();
  135.     exit(0);
  136. }
  137.  
  138. void I_WaitVBL(int count)
  139. {
  140.  //__menuet__delay100((count*10)/7);
  141. }
  142.  
  143. void I_BeginRead(void)
  144. {
  145. }
  146.  
  147. void I_EndRead(void)
  148. {
  149. }
  150.  
  151. byte*   I_AllocLow(int length)
  152. {
  153.     byte*       mem;
  154.        
  155.     mem = (byte *)malloc (length);
  156.     memset (mem,0,length);
  157.     return mem;
  158. }
  159.  
  160.  
  161. //
  162. // I_Error
  163. //
  164. extern boolean demorecording;
  165.  
  166. void I_Error (char *error, ...)
  167. {
  168.     va_list     argptr;
  169.  
  170.     // Message first.
  171.     va_start (argptr,error);
  172.     printf ("Error: ");
  173.     printf (argptr);
  174.     printf ("\n");
  175.     va_end (argptr);
  176.  
  177.     // Shutdown. Here might be other errors.
  178.     if (demorecording)
  179.         G_CheckDemoStatus();
  180.  
  181.     D_QuitNetGame ();
  182.     I_ShutdownGraphics();
  183. //    getch();
  184.     exit(-1);
  185. }
  186.