1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Karl Kurbjun 2006-04-15 22:08:36 +00:00
parent 75b6abb114
commit 4e2a74c2b4
7 changed files with 73 additions and 109 deletions

View file

@ -81,11 +81,10 @@ boolean fastparm; // working -fast
boolean singletics = false; // debug flag to cancel adaptiveness boolean singletics = false; // debug flag to cancel adaptiveness
boolean doomexit; bool doomexit;
//jff 1/22/98 parms for disabling music and sound //jff 1/22/98 parms for disabling music and sound
boolean nosfxparm; boolean nomusicparm=0;
boolean nomusicparm;
//jff 4/18/98 //jff 4/18/98
extern boolean inhelpscreens; extern boolean inhelpscreens;
@ -154,7 +153,6 @@ static void D_Wipe(void)
wipestart = nowtime; wipestart = nowtime;
done = wipe_ScreenWipe(0,0,SCREENWIDTH,SCREENHEIGHT,tics); done = wipe_ScreenWipe(0,0,SCREENWIDTH,SCREENHEIGHT,tics);
I_UpdateNoBlit();
M_Drawer(); // menu is drawn even on top of wipes M_Drawer(); // menu is drawn even on top of wipes
I_FinishUpdate(); // page flip or blit buffer I_FinishUpdate(); // page flip or blit buffer
} }
@ -173,10 +171,10 @@ extern int showMessages;
void D_Display (void) void D_Display (void)
{ {
static boolean isborderstate = false; static boolean isborderstate IDATA_ATTR= false;
static boolean borderwillneedredraw = false; static boolean borderwillneedredraw IDATA_ATTR= false;
static boolean inhelpscreensstate = false; static boolean inhelpscreensstate IDATA_ATTR= false;
static gamestate_t oldgamestate = -1; static gamestate_t oldgamestate IDATA_ATTR= -1;
boolean wipe; boolean wipe;
boolean viewactive = false, isborder = false; boolean viewactive = false, isborder = false;
@ -306,9 +304,6 @@ static void D_DoomLoop (void)
while (!doomexit) while (!doomexit)
{ {
// frame syncronous IO operations
//I_StartFrame ();
// process one or more tics // process one or more tics
if (singletics) if (singletics)
{ {
@ -331,8 +326,7 @@ static void D_DoomLoop (void)
// Update display, next frame, with current state. // Update display, next frame, with current state.
D_Display(); D_Display();
// Sound mixing for the buffer is snychronous. // Give the system some time
// I_UpdateSound();
rb->yield(); rb->yield();
} }
} }

View file

@ -16,7 +16,10 @@
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// $Log$ // $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. // Start of profiling support for doom.
// //
// Revision 1.7 2006-04-04 11:16:44 dave // Revision 1.7 2006-04-04 11:16:44 dave
@ -114,7 +117,7 @@ void I_Init (void)
// //
// I_Quit // I_Quit
// //
extern boolean doomexit;
void I_Quit (void) void I_Quit (void)
{ {
I_ShutdownSound(); I_ShutdownSound();

View file

@ -39,16 +39,6 @@ void I_Init (void);
// returns current time in tics. // returns current time in tics.
int I_GetTime (void); 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 by D_DoomLoop,
// called before processing each tic in a frame. // called before processing each tic in a frame.

View file

@ -16,7 +16,10 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* $Log$ * $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 * 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 * Revision 1.12 2006-04-05 06:37:37 kkurbjun
@ -101,20 +104,6 @@ void I_ShutdownGraphics(void)
noprintf=0; noprintf=0;
} }
//
// I_StartFrame (NOT USED)
//
void I_StartFrame (void)
{
}
//
// I_GetEvent (NOT USED)
//
void I_GetEvent(void)
{
}
// //
// I_StartTic // I_StartTic
// //
@ -150,36 +139,37 @@ void I_GetEvent(void)
#define DOOMBUTTON_WEAPON BUTTON_ON #define DOOMBUTTON_WEAPON BUTTON_ON
#endif #endif
int getkey(event_t * event) inline void getkey()
{ {
event_t event;
// Same button handling as rockboy // 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 #ifdef HAS_BUTTON_HOLD
static unsigned int holdbutton=0; static unsigned int holdbutton IDATA_ATTR=0;
static int hswitch=0; static int hswitch IDATA_ATTR=0;
if (rb->button_hold()&~holdbutton) if (rb->button_hold()&~holdbutton)
{ {
if(hswitch==0) if(hswitch==0)
{ {
event->type = ev_keydown; event.type = ev_keydown;
hswitch=1; hswitch=1;
} }
else else
{ {
event->type = ev_keyup; event.type = ev_keyup;
hswitch=0; hswitch=0;
} }
#if CONFIG_KEYPAD == IPOD_4G_PAD #if CONFIG_KEYPAD == IPOD_4G_PAD
/* Bring up the menu */ /* Bring up the menu */
event->data1=KEY_ESCAPE; event.data1=KEY_ESCAPE;
#else #else
/* Enable run */ /* Enable run */
event->data1=KEY_RSHIFT; event.data1=KEY_RSHIFT;
#endif #endif
D_PostEvent(event); D_PostEvent(&event);
} }
holdbutton=rb->button_hold(); holdbutton=rb->button_hold();
#endif #endif
@ -190,128 +180,123 @@ int getkey(event_t * event)
oldbuttonstate = newbuttonstate; oldbuttonstate = newbuttonstate;
if(released) if(released)
{ {
event->type = ev_keyup; event.type = ev_keyup;
if(released & DOOMBUTTON_LEFT) if(released & DOOMBUTTON_LEFT)
{ {
event->data1=KEY_LEFTARROW; event.data1=KEY_LEFTARROW;
D_PostEvent(event); D_PostEvent(&event);
} }
if(released & DOOMBUTTON_RIGHT) if(released & DOOMBUTTON_RIGHT)
{ {
event->data1=KEY_RIGHTARROW; event.data1=KEY_RIGHTARROW;
D_PostEvent(event); D_PostEvent(&event);
} }
#ifdef DOOMBUTTON_DOWN #ifdef DOOMBUTTON_DOWN
if(released & DOOMBUTTON_DOWN) if(released & DOOMBUTTON_DOWN)
{ {
event->data1=KEY_DOWNARROW; event.data1=KEY_DOWNARROW;
D_PostEvent(event); D_PostEvent(&event);
} }
#endif #endif
if(released & DOOMBUTTON_UP) if(released & DOOMBUTTON_UP)
{ {
event->data1=KEY_UPARROW; event.data1=KEY_UPARROW;
D_PostEvent(event); D_PostEvent(&event);
} }
if(released & DOOMBUTTON_SHOOT) if(released & DOOMBUTTON_SHOOT)
{ {
event->data1=KEY_RCTRL; event.data1=KEY_RCTRL;
D_PostEvent(event); D_PostEvent(&event);
} }
if(released & DOOMBUTTON_OPEN) if(released & DOOMBUTTON_OPEN)
{ {
event->data1=' '; event.data1=' ';
D_PostEvent(event); D_PostEvent(&event);
} }
#ifdef DOOMBUTTON_ESC #ifdef DOOMBUTTON_ESC
if(released & DOOMBUTTON_ESC) if(released & DOOMBUTTON_ESC)
{ {
event->data1=KEY_ESCAPE; event.data1=KEY_ESCAPE;
D_PostEvent(event); D_PostEvent(&event);
} }
#endif #endif
#ifdef DOOMBUTTON_ENTER #ifdef DOOMBUTTON_ENTER
if(released & DOOMBUTTON_ENTER) if(released & DOOMBUTTON_ENTER)
{ {
event->data1=KEY_ENTER; event.data1=KEY_ENTER;
D_PostEvent(event); D_PostEvent(&event);
} }
#endif #endif
#ifdef DOOMBUTTON_WEAPON #ifdef DOOMBUTTON_WEAPON
if(released & DOOMBUTTON_WEAPON) if(released & DOOMBUTTON_WEAPON)
{ {
event->data1 ='w'; event.data1 ='w';
D_PostEvent(event); D_PostEvent(&event);
} }
#endif #endif
} }
if(pressed) if(pressed)
{ {
event->type = ev_keydown; event.type = ev_keydown;
if(pressed & DOOMBUTTON_LEFT) if(pressed & DOOMBUTTON_LEFT)
{ {
event->data1=KEY_LEFTARROW; event.data1=KEY_LEFTARROW;
D_PostEvent(event); D_PostEvent(&event);
} }
if(pressed & DOOMBUTTON_RIGHT) if(pressed & DOOMBUTTON_RIGHT)
{ {
event->data1=KEY_RIGHTARROW; event.data1=KEY_RIGHTARROW;
D_PostEvent(event); D_PostEvent(&event);
} }
#ifdef DOOMBUTTON_DOWN #ifdef DOOMBUTTON_DOWN
if(pressed & DOOMBUTTON_DOWN) if(pressed & DOOMBUTTON_DOWN)
{ {
event->data1=KEY_DOWNARROW; event.data1=KEY_DOWNARROW;
D_PostEvent(event); D_PostEvent(&event);
} }
#endif #endif
if(pressed & DOOMBUTTON_UP) if(pressed & DOOMBUTTON_UP)
{ {
event->data1=KEY_UPARROW; event.data1=KEY_UPARROW;
D_PostEvent(event); D_PostEvent(&event);
} }
if(pressed & DOOMBUTTON_SHOOT) if(pressed & DOOMBUTTON_SHOOT)
{ {
event->data1=KEY_RCTRL; event.data1=KEY_RCTRL;
D_PostEvent(event); D_PostEvent(&event);
} }
if(pressed & DOOMBUTTON_OPEN) if(pressed & DOOMBUTTON_OPEN)
{ {
event->data1=' '; event.data1=' ';
D_PostEvent(event); D_PostEvent(&event);
} }
#ifdef DOOMBUTTON_ESC #ifdef DOOMBUTTON_ESC
if(pressed & DOOMBUTTON_ESC) if(pressed & DOOMBUTTON_ESC)
{ {
event->data1=KEY_ESCAPE; event.data1=KEY_ESCAPE;
D_PostEvent(event); D_PostEvent(&event);
} }
#endif #endif
#ifdef DOOMBUTTON_ENTER #ifdef DOOMBUTTON_ENTER
if(pressed & DOOMBUTTON_ENTER) if(pressed & DOOMBUTTON_ENTER)
{ {
event->data1=KEY_ENTER; event.data1=KEY_ENTER;
D_PostEvent(event); D_PostEvent(&event);
} }
#endif #endif
#ifdef DOOMBUTTON_WEAPON #ifdef DOOMBUTTON_WEAPON
if(pressed & DOOMBUTTON_WEAPON) if(pressed & DOOMBUTTON_WEAPON)
{ {
event->data1='w'; event.data1='w';
D_PostEvent(event); D_PostEvent(&event);
} }
#endif #endif
} }
if(pressed || released)
return 1;
else
return 0;
} }
event_t event; inline void I_StartTic (void)
void I_StartTic (void)
{ {
getkey(&event); getkey();
} }
@ -364,13 +349,6 @@ static void I_UploadNewPalette(int pal)
memcpy(palette,paldata+256*pal,256*sizeof(fb_data)); memcpy(palette,paldata+256*pal,256*sizeof(fb_data));
} }
//
// I_UpdateNoBlit
//
void I_UpdateNoBlit (void)
{
}
// //
// I_FinishUpdate // I_FinishUpdate
// //
@ -447,12 +425,6 @@ void I_SetPalette (int pal)
// //
void I_InitGraphics(void) void I_InitGraphics(void)
{ {
static int firsttime=1;
if (!firsttime)
return;
firsttime = 0;
printf("Starting Graphics engine\n"); printf("Starting Graphics engine\n");
noprintf=1; noprintf=1;

View file

@ -291,6 +291,7 @@ default_t defaults[] =
{"pitched_sounds",{&pitched_sounds, NULL},{0, NULL},0,1, // killough 2/21/98 {"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) 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}, // {"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}, {"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}, {"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 {"mus_pause_opt",{&mus_pause_opt, NULL},{2, NULL},0,2, // CPhipps - music pausing

View file

@ -660,6 +660,7 @@ static bool Doptions()
case 0: /* Sound */ case 0: /* Sound */
nosfxparm=!nosfxparm; // Have to invert it before setting nosfxparm=!nosfxparm; // Have to invert it before setting
rb->set_option("Sound", &nosfxparm, INT, onoff, 2, NULL ); rb->set_option("Sound", &nosfxparm, INT, onoff, 2, NULL );
nosfxparm=!nosfxparm;
break; break;
case 1: /* Keys */ case 1: /* Keys */
@ -784,6 +785,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb = api; rb = api;
(void)parameter; (void)parameter;
doomexit=0;
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true); rb->cpu_boost(true);
#endif #endif

View file

@ -26,6 +26,7 @@
extern struct plugin_api* rb; extern struct plugin_api* rb;
extern bool noprintf; extern bool noprintf;
extern bool doomexit;
/* libc functions */ /* libc functions */
int printf(const char *fmt, ...); int printf(const char *fmt, ...);
@ -98,6 +99,6 @@ inline void* memcpy(void* dst, const void* src, size_t size);
structure changes. structure changes.
*/ */
#define DOOM_CONFIG_MAGIC MAKE_FOURCC('D','O','O','M') #define DOOM_CONFIG_MAGIC MAKE_FOURCC('D','O','O','M')
#define DOOM_CONFIG_VERSION 1 #define DOOM_CONFIG_VERSION 2
#endif #endif