summaryrefslogtreecommitdiff
path: root/apps/plugins/doom/i_system.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/doom/i_system.c')
-rw-r--r--apps/plugins/doom/i_system.c134
1 files changed, 134 insertions, 0 deletions
diff --git a/apps/plugins/doom/i_system.c b/apps/plugins/doom/i_system.c
new file mode 100644
index 0000000000..1e564054f8
--- /dev/null
+++ b/apps/plugins/doom/i_system.c
@@ -0,0 +1,134 @@
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// Revision 1.1 2006/03/28 15:44:01 dave
20// Patch #2969 - Doom! Currently only working on the H300.
21//
22//
23// DESCRIPTION:
24//
25//-----------------------------------------------------------------------------
26
27#include "doomdef.h"
28#include "m_misc.h"
29#include "i_video.h"
30#include "i_sound.h"
31
32#include "d_net.h"
33#include "g_game.h"
34#include "z_zone.h"
35
36#ifdef __GNUG__
37#pragma implementation "i_system.h"
38#endif
39#include "i_system.h"
40
41#include "rockmacros.h"
42
43//
44// I_GetTime
45// returns time in 1/35th second tics
46//
47#if (CONFIG_CPU != PP5020)
48volatile unsigned int doomtimer=0;
49
50void doomtime(void)
51{
52 doomtimer++;
53}
54#endif
55
56int I_GetTime (void)
57{
58#ifdef SIMULATOR
59#if HZ==100
60 return ((7*(*rb->current_tick))/20);
61#else
62 #error FIX - I assumed HZ was 100
63#endif
64#else
65#if (CONFIG_CPU == PP5020)
66 return (USEC_TIMER * 7)/200000;
67#else
68 return doomtimer;
69#endif
70#endif
71}
72
73//
74// I_Init
75//
76
77// I was looking into this and comparing the speed versus Prboom
78// Turns out they are running the game much slower then I thought the game was
79// played. This explains why run was unusable other then through straight stretches
80// The game is much slower now (in terms of game speed).
81void I_Init (void)
82{
83#if (CONFIG_CPU != PP5020) && !defined(SIMULATOR)
84 rb->timer_register(1, NULL, CPU_FREQ/TICRATE, 1, doomtime);
85#endif
86 I_InitSound();
87}
88
89//
90// I_Quit
91//
92extern boolean doomexit;
93void I_Quit (void)
94{
95 I_ShutdownSound();
96 I_ShutdownMusic();
97 I_ShutdownGraphics();
98#if (CONFIG_CPU != PP5020) && !defined(SIMULATOR)
99 rb->timer_unregister();
100#endif
101 doomexit=1;
102}
103
104void I_WaitVBL(int count)
105{
106 rb->sleep(count);
107}
108
109//
110// I_Error
111//
112extern boolean demorecording;
113
114void I_Error (char *error, ...)
115{
116 char p_buf[50];
117 va_list ap;
118
119 va_start(ap, error);
120 vsnprintf(p_buf,sizeof(p_buf), error, ap);
121 va_end(ap);
122
123 printf("%s",p_buf);
124
125 // Shutdown. Here might be other errors.
126 if (demorecording)
127 G_CheckDemoStatus();
128/*
129 I_ShutdownGraphics();
130*/
131
132 I_Quit();
133 rb->sleep(HZ*2);
134}