Annotation of doom/i_syorig, revision 1.1.1.1

1.1       root        1: // Emacs style mode select   -*- C++ -*- 
                      2: //-----------------------------------------------------------------------------
                      3: //
                      4: // $Id:$
                      5: //
                      6: // Copyright (C) 1993-1996 by id Software, Inc.
                      7: //
                      8: // This program is free software; you can redistribute it and/or
                      9: // modify it under the terms of the GNU General Public License
                     10: // as published by the Free Software Foundation; either version 2
                     11: // of the License, or (at your option) any later version.
                     12: //
                     13: // This program is distributed in the hope that it will be useful,
                     14: // but WITHOUT ANY WARRANTY; without even the implied warranty of
                     15: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     16: // GNU General Public License for more details.
                     17: //
                     18: // $Log:$
                     19: //
                     20: // DESCRIPTION:
                     21: //
                     22: //-----------------------------------------------------------------------------
                     23: 
                     24: static const char
                     25: rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";
                     26: 
                     27: 
                     28: #include <stdlib.h>
                     29: #include <stdio.h>
                     30: #include <string.h>
                     31: 
                     32: #include <stdarg.h>
                     33: #include <sys/time.h>
                     34: #include <unistd.h>
                     35: 
                     36: #include "doomdef.h"
                     37: #include "m_misc.h"
                     38: #include "i_video.h"
                     39: #include "i_sound.h"
                     40: 
                     41: #include "d_net.h"
                     42: #include "g_game.h"
                     43: 
                     44: #ifdef __GNUG__
                     45: #pragma implementation "i_system.h"
                     46: #endif
                     47: #include "i_system.h"
                     48: 
                     49: 
                     50: 
                     51: 
                     52: int    mb_used = 6;
                     53: 
                     54: 
                     55: void
                     56: I_Tactile
                     57: ( int  on,
                     58:   int  off,
                     59:   int  total )
                     60: {
                     61:   // UNUSED.
                     62:   on = off = total = 0;
                     63: }
                     64: 
                     65: ticcmd_t       emptycmd;
                     66: ticcmd_t*      I_BaseTiccmd(void)
                     67: {
                     68:     return &emptycmd;
                     69: }
                     70: 
                     71: 
                     72: int  I_GetHeapSize (void)
                     73: {
                     74:     return mb_used*1024*1024;
                     75: }
                     76: 
                     77: byte* I_ZoneBase (int* size)
                     78: {
                     79:     *size = mb_used*1024*1024;
                     80:     return (byte *) malloc (*size);
                     81: }
                     82: 
                     83: 
                     84: 
                     85: //
                     86: // I_GetTime
                     87: // returns time in 1/70th second tics
                     88: //
                     89: int  I_GetTime (void)
                     90: {
                     91:     struct timeval     tp;
                     92:     struct timezone    tzp;
                     93:     int                        newtics;
                     94:     static int         basetime=0;
                     95:   
                     96:     gettimeofday(&tp, &tzp);
                     97:     if (!basetime)
                     98:        basetime = tp.tv_sec;
                     99:     newtics = (tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000;
                    100:     return newtics;
                    101: }
                    102: 
                    103: 
                    104: 
                    105: //
                    106: // I_Init
                    107: //
                    108: void I_Init (void)
                    109: {
                    110:     I_InitSound();
                    111:     //  I_InitGraphics();
                    112: }
                    113: 
                    114: //
                    115: // I_Quit
                    116: //
                    117: void I_Quit (void)
                    118: {
                    119:     D_QuitNetGame ();
                    120:     I_ShutdownSound();
                    121:     I_ShutdownMusic();
                    122:     M_SaveDefaults ();
                    123:     I_ShutdownGraphics();
                    124:     exit(0);
                    125: }
                    126: 
                    127: void I_WaitVBL(int count)
                    128: {
                    129: #ifdef SGI
                    130:     sginap(1);                                           
                    131: #else
                    132: #ifdef SUN
                    133:     sleep(0);
                    134: #else
                    135:     usleep (count * (1000000/70) );                                
                    136: #endif
                    137: #endif
                    138: }
                    139: 
                    140: void I_BeginRead(void)
                    141: {
                    142: }
                    143: 
                    144: void I_EndRead(void)
                    145: {
                    146: }
                    147: 
                    148: byte*  I_AllocLow(int length)
                    149: {
                    150:     byte*      mem;
                    151:         
                    152:     mem = (byte *)malloc (length);
                    153:     memset (mem,0,length);
                    154:     return mem;
                    155: }
                    156: 
                    157: 
                    158: //
                    159: // I_Error
                    160: //
                    161: extern boolean demorecording;
                    162: 
                    163: void I_Error (char *error, ...)
                    164: {
                    165:     va_list    argptr;
                    166: 
                    167:     // Message first.
                    168:     va_start (argptr,error);
                    169:     fprintf (stderr, "Error: ");
                    170:     vfprintf (stderr,error,argptr);
                    171:     fprintf (stderr, "\n");
                    172:     va_end (argptr);
                    173: 
                    174:     fflush( stderr );
                    175: 
                    176:     // Shutdown. Here might be other errors.
                    177:     if (demorecording)
                    178:        G_CheckDemoStatus();
                    179: 
                    180:     D_QuitNetGame ();
                    181:     I_ShutdownGraphics();
                    182:     
                    183:     exit(-1);
                    184: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.