summaryrefslogtreecommitdiff
path: root/apps/plugins/doom
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2006-04-15 22:08:36 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2006-04-15 22:08:36 +0000
commit4e2a74c2b4feb8ce347438f81629a9a051d9a647 (patch)
tree2fc638c1b58c3b48726946dd426b363e20a31f0c /apps/plugins/doom
parent75b6abb11411f5c27f9aa21329164e6ef16f9972 (diff)
downloadrockbox-4e2a74c2b4feb8ce347438f81629a9a051d9a647.zip
rockbox-4e2a74c2b4feb8ce347438f81629a9a051d9a647.tar.gz
rockbox-4e2a74c2b4feb8ce347438f81629a9a051d9a647.tar.bz2
rockbox-4e2a74c2b4feb8ce347438f81629a9a051d9a647.tar.xz
Slight code cleanups, fixed sound parameter - now it saves. Old configurations will be reset.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9682 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/doom')
-rw-r--r--apps/plugins/doom/d_main.c20
-rw-r--r--apps/plugins/doom/i_system.c7
-rw-r--r--apps/plugins/doom/i_system.h10
-rw-r--r--apps/plugins/doom/i_video.c138
-rw-r--r--apps/plugins/doom/m_misc.c1
-rw-r--r--apps/plugins/doom/rockdoom.c3
-rw-r--r--apps/plugins/doom/rockmacros.h3
7 files changed, 73 insertions, 109 deletions
diff --git a/apps/plugins/doom/d_main.c b/apps/plugins/doom/d_main.c
index 8dd9e4e..e7b9876 100644
--- a/apps/plugins/doom/d_main.c
+++ b/apps/plugins/doom/d_main.c
@@ -81,11 +81,10 @@ boolean fastparm; // working -fast
boolean singletics = false; // debug flag to cancel adaptiveness
-boolean doomexit;
+bool doomexit;
//jff 1/22/98 parms for disabling music and sound
-boolean nosfxparm;
-boolean nomusicparm;
+boolean nomusicparm=0;
//jff 4/18/98
extern boolean inhelpscreens;
@@ -154,7 +153,6 @@ static void D_Wipe(void)
wipestart = nowtime;
done = wipe_ScreenWipe(0,0,SCREENWIDTH,SCREENHEIGHT,tics);
- I_UpdateNoBlit();
M_Drawer(); // menu is drawn even on top of wipes
I_FinishUpdate(); // page flip or blit buffer
}
@@ -173,10 +171,10 @@ extern int showMessages;
void D_Display (void)
{
- static boolean isborderstate = false;
- static boolean borderwillneedredraw = false;
- static boolean inhelpscreensstate = false;
- static gamestate_t oldgamestate = -1;
+ static boolean isborderstate IDATA_ATTR= false;
+ static boolean borderwillneedredraw IDATA_ATTR= false;
+ static boolean inhelpscreensstate IDATA_ATTR= false;
+ static gamestate_t oldgamestate IDATA_ATTR= -1;
boolean wipe;
boolean viewactive = false, isborder = false;
@@ -306,9 +304,6 @@ static void D_DoomLoop (void)
while (!doomexit)
{
- // frame syncronous IO operations
- //I_StartFrame ();
-
// process one or more tics
if (singletics)
{
@@ -331,8 +326,7 @@ static void D_DoomLoop (void)
// Update display, next frame, with current state.
D_Display();
- // Sound mixing for the buffer is snychronous.
-// I_UpdateSound();
+ // Give the system some time
rb->yield();
}
}
diff --git a/apps/plugins/doom/i_system.c b/apps/plugins/doom/i_system.c
index 450c213..bf1aef6 100644
--- a/apps/plugins/doom/i_system.c
+++ b/apps/plugins/doom/i_system.c
@@ -16,7 +16,10 @@
// GNU General Public License for more details.
//
// $Log$
-// Revision 1.8 2006/04/14 21:07:55 kkurbjun
+// Revision 1.9 2006/04/15 22:08:36 kkurbjun
+// Slight code cleanups, fixed sound parameter - now it saves. Old configurations will be reset.
+//
+// Revision 1.8 2006-04-14 21:07:55 kkurbjun
// Start of profiling support for doom.
//
// Revision 1.7 2006-04-04 11:16:44 dave
@@ -114,7 +117,7 @@ void I_Init (void)
//
// I_Quit
//
-extern boolean doomexit;
+
void I_Quit (void)
{
I_ShutdownSound();
diff --git a/apps/plugins/doom/i_system.h b/apps/plugins/doom/i_system.h
index e594cb2..35de3ef 100644
--- a/apps/plugins/doom/i_system.h
+++ b/apps/plugins/doom/i_system.h
@@ -41,16 +41,6 @@ int I_GetTime (void);
//
// Called by D_DoomLoop,
-// called before processing any tics in a frame
-// (just after displaying a frame).
-// Time consuming syncronous operations
-// are performed here (joystick reading).
-// Can call D_PostEvent.
-//
-void I_StartFrame (void);
-
-//
-// Called by D_DoomLoop,
// called before processing each tic in a frame.
// Quick syncronous operations are performed here.
// Can call D_PostEvent.
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index 917dace..2b00d8c 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -16,7 +16,10 @@
* GNU General Public License for more details.
*
* $Log$
- * Revision 1.13 2006/04/06 21:31:49 kkurbjun
+ * Revision 1.14 2006/04/15 22:08:36 kkurbjun
+ * Slight code cleanups, fixed sound parameter - now it saves. Old configurations will be reset.
+ *
+ * Revision 1.13 2006-04-06 21:31:49 kkurbjun
* Scaling code fixed by clamping down the width to a max of SCREENWIDTH. Removed some #ifdefs for glprboom
*
* Revision 1.12 2006-04-05 06:37:37 kkurbjun
@@ -102,20 +105,6 @@ void I_ShutdownGraphics(void)
}
//
-// I_StartFrame (NOT USED)
-//
-void I_StartFrame (void)
-{
-}
-
-//
-// I_GetEvent (NOT USED)
-//
-void I_GetEvent(void)
-{
-}
-
-//
// I_StartTic
//
@@ -150,36 +139,37 @@ void I_GetEvent(void)
#define DOOMBUTTON_WEAPON BUTTON_ON
#endif
-int getkey(event_t * event)
+inline void getkey()
{
+ event_t event;
// Same button handling as rockboy
- static unsigned int oldbuttonstate = 0, newbuttonstate=0;
+ static unsigned int oldbuttonstate IDATA_ATTR = 0, newbuttonstate IDATA_ATTR=0 ;
- static int released, pressed;
+ static int released IBSS_ATTR, pressed IBSS_ATTR;
#ifdef HAS_BUTTON_HOLD
- static unsigned int holdbutton=0;
- static int hswitch=0;
+ static unsigned int holdbutton IDATA_ATTR=0;
+ static int hswitch IDATA_ATTR=0;
if (rb->button_hold()&~holdbutton)
{
if(hswitch==0)
{
- event->type = ev_keydown;
+ event.type = ev_keydown;
hswitch=1;
}
else
{
- event->type = ev_keyup;
+ event.type = ev_keyup;
hswitch=0;
}
#if CONFIG_KEYPAD == IPOD_4G_PAD
/* Bring up the menu */
- event->data1=KEY_ESCAPE;
+ event.data1=KEY_ESCAPE;
#else
/* Enable run */
- event->data1=KEY_RSHIFT;
+ event.data1=KEY_RSHIFT;
#endif
- D_PostEvent(event);
+ D_PostEvent(&event);
}
holdbutton=rb->button_hold();
#endif
@@ -190,128 +180,123 @@ int getkey(event_t * event)
oldbuttonstate = newbuttonstate;
if(released)
{
- event->type = ev_keyup;
+ event.type = ev_keyup;
if(released & DOOMBUTTON_LEFT)
{
- event->data1=KEY_LEFTARROW;
- D_PostEvent(event);
+ event.data1=KEY_LEFTARROW;
+ D_PostEvent(&event);
}
if(released & DOOMBUTTON_RIGHT)
{
- event->data1=KEY_RIGHTARROW;
- D_PostEvent(event);
+ event.data1=KEY_RIGHTARROW;
+ D_PostEvent(&event);
}
#ifdef DOOMBUTTON_DOWN
if(released & DOOMBUTTON_DOWN)
{
- event->data1=KEY_DOWNARROW;
- D_PostEvent(event);
+ event.data1=KEY_DOWNARROW;
+ D_PostEvent(&event);
}
#endif
if(released & DOOMBUTTON_UP)
{
- event->data1=KEY_UPARROW;
- D_PostEvent(event);
+ event.data1=KEY_UPARROW;
+ D_PostEvent(&event);
}
if(released & DOOMBUTTON_SHOOT)
{
- event->data1=KEY_RCTRL;
- D_PostEvent(event);
+ event.data1=KEY_RCTRL;
+ D_PostEvent(&event);
}
if(released & DOOMBUTTON_OPEN)
{
- event->data1=' ';
- D_PostEvent(event);
+ event.data1=' ';
+ D_PostEvent(&event);
}
#ifdef DOOMBUTTON_ESC
if(released & DOOMBUTTON_ESC)
{
- event->data1=KEY_ESCAPE;
- D_PostEvent(event);
+ event.data1=KEY_ESCAPE;
+ D_PostEvent(&event);
}
#endif
#ifdef DOOMBUTTON_ENTER
if(released & DOOMBUTTON_ENTER)
{
- event->data1=KEY_ENTER;
- D_PostEvent(event);
+ event.data1=KEY_ENTER;
+ D_PostEvent(&event);
}
#endif
#ifdef DOOMBUTTON_WEAPON
if(released & DOOMBUTTON_WEAPON)
{
- event->data1 ='w';
- D_PostEvent(event);
+ event.data1 ='w';
+ D_PostEvent(&event);
}
#endif
}
if(pressed)
{
- event->type = ev_keydown;
+ event.type = ev_keydown;
if(pressed & DOOMBUTTON_LEFT)
{
- event->data1=KEY_LEFTARROW;
- D_PostEvent(event);
+ event.data1=KEY_LEFTARROW;
+ D_PostEvent(&event);
}
if(pressed & DOOMBUTTON_RIGHT)
{
- event->data1=KEY_RIGHTARROW;
- D_PostEvent(event);
+ event.data1=KEY_RIGHTARROW;
+ D_PostEvent(&event);
}
#ifdef DOOMBUTTON_DOWN
if(pressed & DOOMBUTTON_DOWN)
{
- event->data1=KEY_DOWNARROW;
- D_PostEvent(event);
+ event.data1=KEY_DOWNARROW;
+ D_PostEvent(&event);
}
#endif
if(pressed & DOOMBUTTON_UP)
{
- event->data1=KEY_UPARROW;
- D_PostEvent(event);
+ event.data1=KEY_UPARROW;
+ D_PostEvent(&event);
}
if(pressed & DOOMBUTTON_SHOOT)
{
- event->data1=KEY_RCTRL;
- D_PostEvent(event);
+ event.data1=KEY_RCTRL;
+ D_PostEvent(&event);
}
if(pressed & DOOMBUTTON_OPEN)
{
- event->data1=' ';
- D_PostEvent(event);
+ event.data1=' ';
+ D_PostEvent(&event);
}
#ifdef DOOMBUTTON_ESC
if(pressed & DOOMBUTTON_ESC)
{
- event->data1=KEY_ESCAPE;
- D_PostEvent(event);
+ event.data1=KEY_ESCAPE;
+ D_PostEvent(&event);
}
#endif
#ifdef DOOMBUTTON_ENTER
if(pressed & DOOMBUTTON_ENTER)
{
- event->data1=KEY_ENTER;
- D_PostEvent(event);
+ event.data1=KEY_ENTER;
+ D_PostEvent(&event);
}
#endif
#ifdef DOOMBUTTON_WEAPON
if(pressed & DOOMBUTTON_WEAPON)
{
- event->data1='w';
- D_PostEvent(event);
+ event.data1='w';
+ D_PostEvent(&event);
}
#endif
}
- if(pressed || released)
- return 1;
- else
- return 0;
}
-event_t event;
-void I_StartTic (void)
+inline void I_StartTic (void)
{
- getkey(&event);
+ getkey();
}
@@ -365,13 +350,6 @@ static void I_UploadNewPalette(int pal)
}
//
-// I_UpdateNoBlit
-//
-void I_UpdateNoBlit (void)
-{
-}
-
-//
// I_FinishUpdate
//
@@ -447,12 +425,6 @@ void I_SetPalette (int pal)
//
void I_InitGraphics(void)
{
- static int firsttime=1;
-
- if (!firsttime)
- return;
- firsttime = 0;
-
printf("Starting Graphics engine\n");
noprintf=1;
diff --git a/apps/plugins/doom/m_misc.c b/apps/plugins/doom/m_misc.c
index d3e6098..9334e0f 100644
--- a/apps/plugins/doom/m_misc.c
+++ b/apps/plugins/doom/m_misc.c
@@ -291,6 +291,7 @@ default_t defaults[] =
{"pitched_sounds",{&pitched_sounds, NULL},{0, NULL},0,1, // killough 2/21/98
def_bool,ss_none, 0, 0}, // enables variable pitch in sound effects (from id's original code)
// {"samplerate",{&snd_samplerate, NULL},{22050, NULL},11025,48000, def_int,ss_none, 0, 0},
+ {"nosfxparm",{(void *)&nosfxparm, NULL},{0, NULL},0,1, def_bool,ss_none, 0, 0},
{"sfx_volume",{&snd_SfxVolume, NULL},{8, NULL},0,15, def_int,ss_none, 0, 0},
{"music_volume",{&snd_MusicVolume, NULL},{8, NULL},0,15, def_int,ss_none, 0, 0},
{"mus_pause_opt",{&mus_pause_opt, NULL},{2, NULL},0,2, // CPhipps - music pausing
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index 81466ac..b8529dc 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -660,6 +660,7 @@ static bool Doptions()
case 0: /* Sound */
nosfxparm=!nosfxparm; // Have to invert it before setting
rb->set_option("Sound", &nosfxparm, INT, onoff, 2, NULL );
+ nosfxparm=!nosfxparm;
break;
case 1: /* Keys */
@@ -784,6 +785,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb = api;
(void)parameter;
+ doomexit=0;
+
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true);
#endif
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h
index 047fa24..bda8219 100644
--- a/apps/plugins/doom/rockmacros.h
+++ b/apps/plugins/doom/rockmacros.h
@@ -26,6 +26,7 @@
extern struct plugin_api* rb;
extern bool noprintf;
+extern bool doomexit;
/* libc functions */
int printf(const char *fmt, ...);
@@ -98,6 +99,6 @@ inline void* memcpy(void* dst, const void* src, size_t size);
structure changes.
*/
#define DOOM_CONFIG_MAGIC MAKE_FOURCC('D','O','O','M')
-#define DOOM_CONFIG_VERSION 1
+#define DOOM_CONFIG_VERSION 2
#endif