Doom for the Gigabeat and some code reduction

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12051 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Karl Kurbjun 2007-01-17 18:52:24 +00:00
parent 3b65fc2480
commit b47a43aa28
24 changed files with 247 additions and 277 deletions

View file

@ -2,8 +2,8 @@
# #
# $Id$ # $Id$
# #
# $Log$ # $Log: Makefile,v $
# Revision 1.13 2006/12/13 06:52:09 kkurbjun # Revision 1.13 2006-12-13 06:52:09 kkurbjun
# Free more plugin memory # Free more plugin memory
# #
# Revision 1.12 2006-12-13 05:46:51 kkurbjun # Revision 1.12 2006-12-13 05:46:51 kkurbjun
@ -56,7 +56,7 @@ endif
# The arm code compiles too large for the plugin buffer when set to optimize for speed # The arm code compiles too large for the plugin buffer when set to optimize for speed
#ifeq ($(CC), arm-elf-gcc) #ifeq ($(CC), arm-elf-gcc)
ifneq (,$(strip $(foreach tgt,SANSA_E200 IPOD_NANO IPOD_COLOR IPOD_VIDEO IPOD_MINI IPOD_3G IPOD_4G IRIVER_H10_5GB IRIVER_H10,$(findstring $(tgt),$(TARGET))))) ifneq (,$(strip $(foreach tgt,SANSA_E200 IPOD_NANO IPOD_COLOR IPOD_VIDEO IPOD_MINI IPOD_3G IPOD_4G IRIVER_H10_5GB IRIVER_H10 GIGABEAT_F,$(findstring $(tgt),$(TARGET)))))
CFLAGS += -Os CFLAGS += -Os
ifndef SIMVER ifndef SIMVER
ifeq ($(TARGET), IRIVER_H100) ifeq ($(TARGET), IRIVER_H100)

View file

@ -49,7 +49,7 @@ extern boolean clrespawnparm; // checkparm of -respawn
extern boolean clfastparm; // checkparm of -fast extern boolean clfastparm; // checkparm of -fast
//jff end of external declaration of command line playmode //jff end of external declaration of command line playmode
extern boolean nosfxparm; extern boolean enable_sound;
extern boolean nomusicparm; extern boolean nomusicparm;
extern int ffmap; extern int ffmap;

View file

@ -33,7 +33,9 @@
#include "doomdef.h" #include "doomdef.h"
// Location for any defines turned variables. // Location for any defines turned variables.
#if(LCD_HEIGHT>LCD_WIDTH)
// None. bool rotate_screen=0;
int SCREENWIDTH;
int SCREENHEIGHT;
#endif

View file

@ -33,6 +33,8 @@
#ifndef __DOOMDEF__ #ifndef __DOOMDEF__
#define __DOOMDEF__ #define __DOOMDEF__
#include "rockmacros.h"
// killough 4/25/98: Make gcc extensions mean nothing on other compilers // killough 4/25/98: Make gcc extensions mean nothing on other compilers
#ifndef __GNUC__ #ifndef __GNUC__
#define __attribute__(x) #define __attribute__(x)
@ -88,14 +90,20 @@ typedef enum {
// allows us to avoid the overhead of dynamic allocation // allows us to avoid the overhead of dynamic allocation
// when multiple screen sizes are supported // when multiple screen sizes are supported
#if(LCD_HEIGHT>LCD_WIDTH)
extern bool rotate_screen;
// proff 08/17/98: Changed for high-res // proff 08/17/98: Changed for high-res
#define MAX_SCREENWIDTH 1600 #define MAX_SCREENWIDTH LCD_HEIGHT
#define MAX_SCREENHEIGHT 1200 #define MAX_SCREENHEIGHT LCD_HEIGHT
extern int SCREENWIDTH;
extern int SCREENHEIGHT;
#else
// proff 08/17/98: Changed for high-res
#define MAX_SCREENWIDTH LCD_WIDTH
#define MAX_SCREENHEIGHT LCD_HEIGHT
#define SCREENWIDTH LCD_WIDTH #define SCREENWIDTH LCD_WIDTH
//#define SCREENWIDTH 320
//#define SCREENHEIGHT 200
#define SCREENHEIGHT LCD_HEIGHT #define SCREENHEIGHT LCD_HEIGHT
#endif
// The maximum number of players, multiplayer/networking. // The maximum number of players, multiplayer/networking.
#define MAXPLAYERS 4 #define MAXPLAYERS 4

View file

@ -100,5 +100,5 @@ int doom_weapon_toggles; // killough 10/98
int monkeys IBSS_ATTR, default_monkeys; int monkeys IBSS_ATTR, default_monkeys;
boolean nosfxparm=0; boolean enable_sound=1;
boolean rockblock=1; boolean rockblock=1;

View file

@ -115,7 +115,7 @@ enum {
extern int comp[COMP_TOTAL], default_comp[COMP_TOTAL]; extern int comp[COMP_TOTAL], default_comp[COMP_TOTAL];
extern boolean nosfxparm; extern boolean enable_sound;
extern boolean rockblock; extern boolean rockblock;
// ------------------------------------------- // -------------------------------------------

View file

@ -2773,11 +2773,11 @@ boolean G_CheckDemoStatus (void)
int fd=open(GAMEBASE "timedemo.txt",O_WRONLY | O_CREAT); int fd=open(GAMEBASE "timedemo.txt",O_WRONLY | O_CREAT);
fdprintf (fd,"Timed %d gametics in %d realtics = %d frames per second", fdprintf (fd,"Timed %d gametics in %d realtics = %d frames per second",
(unsigned) gametic, realtics, (unsigned) gametic, realtics,
(unsigned) gametic * (double) TICRATE / realtics); (unsigned) gametic * TICRATE/ realtics);
close(fd); close(fd);
I_Error ("%d gametics in %d realtics", I_Error ("%d gametics in %d realtics",
(unsigned) gametic,realtics, (unsigned) gametic,realtics,
(unsigned) gametic * (double) TICRATE / realtics); (unsigned) gametic * TICRATE / realtics);
return false; return false;
} }

View file

@ -472,7 +472,7 @@ void get_more(unsigned char** start, size_t* size)
void I_SubmitSound(void) void I_SubmitSound(void)
{ {
if (nosfxparm) if (!enable_sound)
return; return;
rb->pcm_play_data(&get_more, NULL, 0); rb->pcm_play_data(&get_more, NULL, 0);

View file

@ -15,8 +15,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// $Log$ // $Log: i_system.c,v $
// Revision 1.9 2006/04/15 22:08:36 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. // Slight code cleanups, fixed sound parameter - now it saves. Old configurations will be reset.
// //
// Revision 1.8 2006-04-14 21:07:55 kkurbjun // Revision 1.8 2006-04-14 21:07:55 kkurbjun
@ -87,7 +87,7 @@ void doomtime(void)
int I_GetTime (void) int I_GetTime (void)
{ {
#if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) && !defined(RB_PROFILE) #if defined(HAVE_LCD_COLOR) && !defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR) && !defined(RB_PROFILE)
return doomtimer; return doomtimer;
#else #else
#if HZ==100 #if HZ==100

View file

@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* $Log$ * $Log: i_video.c,v $
* Revision 1.26 2006/12/13 04:44:17 kkurbjun * Revision 1.26 2006-12-13 04:44:17 kkurbjun
* Dehacked and BEX support for Doom - currently only supports a DEHACKED file in a WAD (not as a standalone file yet). * Dehacked and BEX support for Doom - currently only supports a DEHACKED file in a WAD (not as a standalone file yet).
* *
* Revision 1.25 2006-10-26 13:38:04 barrywardell * Revision 1.25 2006-10-26 13:38:04 barrywardell
@ -128,13 +128,14 @@ static unsigned char *gbuf;
#endif #endif
#if defined(CPU_COLDFIRE) #if defined(CPU_COLDFIRE)
static char fastscreen[(LCD_WIDTH)*LCD_HEIGHT] IBSS_ATTR; static char fastscreen[LCD_WIDTH*LCD_HEIGHT] IBSS_ATTR;
#endif #endif
static fb_data palette[256] IBSS_ATTR; static fb_data palette[256] IBSS_ATTR;
static fb_data *paldata=NULL; static fb_data *paldata=NULL;
// //
// I_ShutdownGraphics (NOT USED) // I_ShutdownGraphics
// //
void I_ShutdownGraphics(void) void I_ShutdownGraphics(void)
{ {
@ -187,6 +188,17 @@ void I_ShutdownGraphics(void)
#define DOOMBUTTON_ESC BUTTON_POWER #define DOOMBUTTON_ESC BUTTON_POWER
#define DOOMBUTTON_ENTER BUTTON_SCROLL_UP #define DOOMBUTTON_ENTER BUTTON_SCROLL_UP
#define DOOMBUTTON_WEAPON BUTTON_SCROLL_DOWN #define DOOMBUTTON_WEAPON BUTTON_SCROLL_DOWN
#elif CONFIG_KEYPAD == GIGABEAT_PAD
#define DOOMBUTTON_UP BUTTON_UP
#define DOOMBUTTON_DOWN BUTTON_DOWN
#define DOOMBUTTON_LEFT BUTTON_LEFT
#define DOOMBUTTON_RIGHT BUTTON_RIGHT
#define DOOMBUTTON_SHOOT BUTTON_A
#define DOOMBUTTON_OPEN BUTTON_MENU
#define DOOMBUTTON_ESC BUTTON_POWER
#define DOOMBUTTON_ENTER BUTTON_SELECT
#define DOOMBUTTON_WEAPON BUTTON_VOL_DOWN
#define DOOMBUTTON_MAP BUTTON_VOL_UP
#else #else
#define DOOMBUTTON_UP BUTTON_UP #define DOOMBUTTON_UP BUTTON_UP
#define DOOMBUTTON_DOWN BUTTON_DOWN #define DOOMBUTTON_DOWN BUTTON_DOWN
@ -282,19 +294,24 @@ inline void getkey()
D_PostEvent(&event); D_PostEvent(&event);
} }
#endif #endif
#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
#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
#ifdef DOOMBUTTON_MAP
if(released & DOOMBUTTON_MAP)
{
event.data1 =KEY_TAB;
D_PostEvent(&event);
}
#endif #endif
} }
if(pressed) if(pressed)
@ -352,6 +369,13 @@ inline void getkey()
event.data1='w'; event.data1='w';
D_PostEvent(&event); D_PostEvent(&event);
} }
#endif
#ifdef DOOMBUTTON_MAP
if(pressed & DOOMBUTTON_MAP)
{
event.data1 =KEY_TAB;
D_PostEvent(&event);
}
#endif #endif
} }
} }
@ -481,7 +505,21 @@ void I_FinishUpdate (void)
int y; int y;
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
#if(LCD_HEIGHT>LCD_WIDTH)
if(rotate_screen)
{
int x;
for (y=0; y<LCD_HEIGHT; y++)
{
for (x=0; x < LCD_WIDTH; x++)
{
paletteIndex = d_screens[0][SCREENWIDTH*(SCREENHEIGHT-1-x) + y];
rb->lcd_framebuffer[y*LCD_WIDTH + x] = palette[paletteIndex];
}
}
}
else
#endif
for (y = 0; y < LCD_HEIGHT *LCD_WIDTH; y++) for (y = 0; y < LCD_HEIGHT *LCD_WIDTH; y++)
{ {
paletteIndex = d_screens[0][y]; paletteIndex = d_screens[0][y];
@ -491,21 +529,21 @@ void I_FinishUpdate (void)
#else /* !HAVE_LCD_COLOR */ #else /* !HAVE_LCD_COLOR */
int x, yd = 0; int x, yd = 0;
for (y = 0; y < LCD_HEIGHT; y++) for (y = 0; y < SCREENHEIGHT; y++)
{ {
for (x = 0; x < LCD_WIDTH; x++) for (x = 0; x < SCREENWIDTH; x++)
{ {
paletteIndex = d_screens[0][y*SCREENWIDTH + x]; paletteIndex = d_screens[0][y*SCREENWIDTH + x];
graybuffer[yd * LCD_WIDTH + x]=palette[paletteIndex]; graybuffer[yd * SCREENWIDTH + x]=palette[paletteIndex];
} }
if (++yd == 8) if (++yd == 8)
{ {
gray_ub_gray_bitmap(graybuffer, 0, y & ~7, LCD_WIDTH, 8); gray_ub_gray_bitmap(graybuffer, 0, y & ~7, SCREENWIDTH, 8);
yd = 0; yd = 0;
} }
} }
if (yd > 0) if (yd > 0)
gray_ub_gray_bitmap(graybuffer, 0, y & ~7, LCD_WIDTH, yd); gray_ub_gray_bitmap(graybuffer, 0, y & ~7, SCREENWIDTH, yd);
#endif /* !HAVE_LCD_COLOR */ #endif /* !HAVE_LCD_COLOR */
#endif #endif
} }
@ -515,7 +553,7 @@ void I_FinishUpdate (void)
// //
void I_ReadScreen (byte* scr) void I_ReadScreen (byte* scr)
{ {
memcpy (scr, d_screens[0], SCREENWIDTH*SCREENHEIGHT); memcpy (scr, d_screens[0], LCD_WIDTH*LCD_HEIGHT);
} }
// //
@ -550,6 +588,6 @@ void I_InitGraphics(void)
d_screens[0] = fastscreen; d_screens[0] = fastscreen;
#else #else
// Don't know if this will fit in other IRAMs // Don't know if this will fit in other IRAMs
d_screens[0] = malloc ((SCREENWIDTH) * SCREENHEIGHT * sizeof(unsigned char)); d_screens[0] = malloc (LCD_WIDTH * LCD_HEIGHT * sizeof(unsigned char));
#endif #endif
} }

View file

@ -291,7 +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}, {"enable_sound",{(void *)&enable_sound, 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
@ -307,6 +307,10 @@ default_t defaults[] =
def_int,ss_none, 0, 0}, def_int,ss_none, 0, 0},
{"screen_height",{&desired_screenheight, NULL},{200, NULL},200,1200, {"screen_height",{&desired_screenheight, NULL},{200, NULL},200,1200,
def_int,ss_none, 0, 0},*/ def_int,ss_none, 0, 0},*/
#if(LCD_HEIGHT>LCD_WIDTH)
{"rotate_screen",{(void *)&rotate_screen, NULL},{0, NULL},0,1,
def_bool,ss_none, 0, 0}, /* kwk - rotate the screen 90 degrees */
#endif
{"fake_contrast",{&fake_contrast, NULL},{1, NULL},0,1, {"fake_contrast",{&fake_contrast, NULL},{1, NULL},0,1,
def_bool,ss_none, 0, 0}, /* cph - allow crappy fake contrast to be disabled */ def_bool,ss_none, 0, 0}, /* cph - allow crappy fake contrast to be disabled */
// {"use_fullscreen",{&use_fullscreen, NULL},{1, NULL},0,1, /* proff 21/05/2000 */ // {"use_fullscreen",{&use_fullscreen, NULL},{1, NULL},0,1, /* proff 21/05/2000 */

View file

@ -66,7 +66,7 @@ void R_ClearDrawSegs(void)
// Instead of clipsegs, let's try using an array with one entry for each column, // Instead of clipsegs, let's try using an array with one entry for each column,
// indicating whether it's blocked by a solid wall yet or not. // indicating whether it's blocked by a solid wall yet or not.
byte solidcol[SCREENWIDTH] IBSS_ATTR; byte solidcol[MAX_SCREENWIDTH] IBSS_ATTR;
// CPhipps - // CPhipps -
// R_ClipWallSegment // R_ClipWallSegment

View file

@ -434,9 +434,9 @@ typedef struct visplane
fixed_t height; fixed_t height;
fixed_t xoffs, yoffs; // killough 2/28/98: Support scrolling flats fixed_t xoffs, yoffs; // killough 2/28/98: Support scrolling flats
unsigned short pad1; // leave pads for [minx-1]/[maxx+1] unsigned short pad1; // leave pads for [minx-1]/[maxx+1]
unsigned short top[SCREENWIDTH]; unsigned short top[MAX_SCREENWIDTH];
unsigned short pad2, pad3; // killough 2/8/98, 4/25/98 unsigned short pad2, pad3; // killough 2/8/98, 4/25/98
unsigned short bottom[SCREENWIDTH]; unsigned short bottom[MAX_SCREENWIDTH];
unsigned short pad4; unsigned short pad4;
} }
visplane_t; visplane_t;

View file

@ -86,7 +86,7 @@ int *viewangletox=0;
// to the lowest viewangle that maps back to x ranges // to the lowest viewangle that maps back to x ranges
// from clipangle to -clipangle. // from clipangle to -clipangle.
angle_t xtoviewangle[SCREENWIDTH+1]; // killough 2/8/98 angle_t xtoviewangle[MAX_SCREENWIDTH+1]; // killough 2/8/98
// killough 3/20/98: Support dynamic colormaps, e.g. deep water // killough 3/20/98: Support dynamic colormaps, e.g. deep water
// killough 4/4/98: support dynamic number of them as well // killough 4/4/98: support dynamic number of them as well

View file

@ -73,11 +73,11 @@ short *openings,*lastopening;
// floorclip starts out SCREENHEIGHT // floorclip starts out SCREENHEIGHT
// ceilingclip starts out -1 // ceilingclip starts out -1
short floorclip[SCREENWIDTH], ceilingclip[SCREENWIDTH]; short floorclip[MAX_SCREENWIDTH], ceilingclip[MAX_SCREENWIDTH];
// spanstart holds the start of a plane span; initialized to 0 at start // spanstart holds the start of a plane span; initialized to 0 at start
static int spanstart[SCREENHEIGHT]; // killough 2/8/98 static int spanstart[MAX_SCREENHEIGHT]; // killough 2/8/98
// //
// texture mapping // texture mapping
@ -89,13 +89,13 @@ static fixed_t planeheight;
// killough 2/8/98: make variables static // killough 2/8/98: make variables static
static fixed_t basexscale, baseyscale; static fixed_t basexscale, baseyscale;
static fixed_t cachedheight[SCREENHEIGHT]; static fixed_t cachedheight[MAX_SCREENHEIGHT];
static fixed_t cacheddistance[SCREENHEIGHT]; static fixed_t cacheddistance[MAX_SCREENHEIGHT];
static fixed_t cachedxstep[SCREENHEIGHT]; static fixed_t cachedxstep[MAX_SCREENHEIGHT];
static fixed_t cachedystep[SCREENHEIGHT]; static fixed_t cachedystep[MAX_SCREENHEIGHT];
static fixed_t xoffs, yoffs; // killough 2/28/98: flat offsets static fixed_t xoffs, yoffs; // killough 2/28/98: flat offsets
fixed_t yslope[SCREENHEIGHT], distscale[SCREENWIDTH]; fixed_t yslope[MAX_SCREENHEIGHT], distscale[MAX_SCREENWIDTH];
// //
// R_InitPlanes // R_InitPlanes

View file

@ -251,7 +251,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2)
// CALLED: CORE LOOPING ROUTINE. // CALLED: CORE LOOPING ROUTINE.
// //
extern byte solidcol[SCREENWIDTH]; extern byte solidcol[MAX_SCREENWIDTH];
#define HEIGHTBITS 12 #define HEIGHTBITS 12
#define HEIGHTUNIT (1<<HEIGHTBITS) #define HEIGHTUNIT (1<<HEIGHTBITS)
static int didsolidcol; /* True if at least one column was marked solid */ static int didsolidcol; /* True if at least one column was marked solid */

View file

@ -109,7 +109,7 @@ extern angle_t viewangle;
extern player_t *viewplayer; extern player_t *viewplayer;
extern angle_t clipangle; extern angle_t clipangle;
extern int *viewangletox; extern int *viewangletox;
extern angle_t xtoviewangle[SCREENWIDTH+1]; // killough 2/8/98 extern angle_t xtoviewangle[MAX_SCREENWIDTH+1]; // killough 2/8/98
extern fixed_t rw_distance; extern fixed_t rw_distance;
extern angle_t rw_normalangle; extern angle_t rw_normalangle;

View file

@ -71,8 +71,8 @@ static lighttable_t** spritelights;
// constant arrays // constant arrays
// used for psprite clipping and initializing clipping // used for psprite clipping and initializing clipping
short negonearray[SCREENWIDTH]; short negonearray[MAX_SCREENWIDTH];
short screenheightarray[SCREENWIDTH]; short screenheightarray[MAX_SCREENWIDTH];
// //
@ -282,7 +282,7 @@ void R_InitSprites(const char * const *namelist)
{ {
int i; int i;
for (i=0 ; i<SCREENWIDTH ; i++) for (i=0 ; i<MAX_SCREENWIDTH ; i++)
negonearray[i] = -1; negonearray[i] = -1;
R_InitSpriteDefs (namelist); R_InitSpriteDefs (namelist);
} }
@ -835,8 +835,8 @@ void R_SortVisSprites (void)
void R_DrawSprite (vissprite_t* spr) void R_DrawSprite (vissprite_t* spr)
{ {
drawseg_t *ds; drawseg_t *ds;
short clipbot[SCREENWIDTH]; // killough 2/8/98: short clipbot[MAX_SCREENWIDTH]; // killough 2/8/98:
short cliptop[SCREENWIDTH]; // change to MAX_* short cliptop[MAX_SCREENWIDTH]; // change to MAX_*
int x; int x;
int r1; int r1;
int r2; int r2;

View file

@ -38,8 +38,8 @@
/* Constant arrays used for psprite clipping and initializing clipping. */ /* Constant arrays used for psprite clipping and initializing clipping. */
extern short negonearray[SCREENWIDTH]; extern short negonearray[MAX_SCREENWIDTH];
extern short screenheightarray[SCREENWIDTH]; extern short screenheightarray[MAX_SCREENWIDTH];
/* Vars for R_DrawMaskedColumn */ /* Vars for R_DrawMaskedColumn */

View file

@ -108,6 +108,7 @@ int printf(const char *fmt, ...)
static int p_xtpt; static int p_xtpt;
char p_buf[50]; char p_buf[50];
bool ok; bool ok;
rb->yield();
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
@ -293,67 +294,20 @@ int Dbuild_base (struct opt_items *names)
D_AddFile (GAMEBASE"rockdoom.wad", source_pwad); D_AddFile (GAMEBASE"rockdoom.wad", source_pwad);
int i=0; int i=0, j;
/* Doom Shareware */ /* Doom Shareware */
if ( !fileexists (wads_builtin[0]) )
{
names[i].string=versions_builtin[0];
names[i].voice_id=0;
namemap[i]=0;
i++;
}
/* Doom registered */ /* Doom registered */
if ( !fileexists (wads_builtin[1]) )
{
names[i].string=versions_builtin[1];
names[i].voice_id=0;
namemap[i]=1;
i++;
}
/* Ultimate Doom */ /* Ultimate Doom */
if ( !fileexists (wads_builtin[2]) )
{
names[i].string=versions_builtin[2];
names[i].voice_id=0;
namemap[i]=2;
i++;
}
/* Doom2 */ /* Doom2 */
if ( !fileexists (wads_builtin[3]) )
{
names[i].string=versions_builtin[3];
names[i].voice_id=0;
namemap[i]=3;
i++;
}
/* Doom2f */ /* Doom2f */
if ( !fileexists (wads_builtin[4]) )
{
names[i].string=versions_builtin[4];
names[i].voice_id=0;
namemap[i]=4;
i++;
}
/* Plutonia */ /* Plutonia */
if ( !fileexists (wads_builtin[5]) )
{
names[i].string=versions_builtin[5];
names[i].voice_id=0;
namemap[i]=5;
i++;
}
/* TNT */ /* TNT */
if ( !fileexists (wads_builtin[6]) ) for(j=0;j<7;j++)
if ( !fileexists (wads_builtin[j]) )
{ {
names[i].string=versions_builtin[6]; names[i].string=versions_builtin[j];
names[i].voice_id=0; names[i].voice_id=0;
namemap[i]=6; namemap[i]=j;
i++; i++;
} }
// Set argvlist defaults // Set argvlist defaults
@ -362,7 +316,7 @@ int Dbuild_base (struct opt_items *names)
return i; return i;
} }
// This is a general function that takes in an menu_item structure and makes a list // This is a general function that takes in a menu_item structure and makes a list
// of files within it based on matching the string stringmatch to the files. // of files within it based on matching the string stringmatch to the files.
int Dbuild_filelistm(struct menu_item **names, char *firstentry, char *directory, char *stringmatch) int Dbuild_filelistm(struct menu_item **names, char *firstentry, char *directory, char *stringmatch)
{ {
@ -413,8 +367,10 @@ int Dbuild_filelistm(struct menu_item **names, char *firstentry, char *directory
return i; return i;
} }
static int translatekey(int key) __attribute__ ((noinline));
// This key configuration code is not the cleanest or the most efficient, but it works // This key configuration code is not the cleanest or the most efficient, but it works
int translatekey(int key) static int translatekey(int key)
{ {
if (key<31) if (key<31)
{ {
@ -431,16 +387,17 @@ int translatekey(int key)
case 4: case 4:
return KEY_DOWNARROW; return KEY_DOWNARROW;
case 5: case 5:
return KEY_RCTRL;
case 6:
return ' ';
case 7:
return KEY_ESCAPE;
case 8:
return 'w';
case 9:
return KEY_ENTER; return KEY_ENTER;
case 6:
return KEY_RCTRL;
case 7:
return ' ';
case 8:
return KEY_ESCAPE;
case 9:
return 'w';
case 10: case 10:
return KEY_TAB;
default: default:
return 0; return 0;
} }
@ -459,17 +416,18 @@ int translatekey(int key)
return 3; return 3;
case KEY_DOWNARROW: case KEY_DOWNARROW:
return 4; return 4;
case KEY_RCTRL:
return 5;
case ' ':
return 6;
case KEY_ESCAPE:
return 7;
case 'w':
return 8;
case KEY_ENTER: case KEY_ENTER:
return 5;
case KEY_RCTRL:
return 6;
case ' ':
return 7;
case KEY_ESCAPE:
return 8;
case 'w':
return 9; return 9;
case KEY_F9: case KEY_TAB:
return 10;
default: default:
return 0; return 0;
} }
@ -484,18 +442,40 @@ int Oset_keys()
int m, result; int m, result;
int menuquit=0; int menuquit=0;
static const struct opt_items doomkeys[] = { static const struct opt_items doomkeys[] = {
{ "Unmapped", NULL }, { "Unmapped", NULL },
{ "Key Right", NULL }, { "Key Right", NULL },
{ "Key Left", NULL }, { "Key Left", NULL },
{ "Key Up", NULL }, { "Key Up", NULL },
{ "Key Down", NULL }, { "Key Down", NULL },
{ "Key Select", NULL },
#if defined(TOSHIBA_GIGABEAT_F)
{ "Key A", NULL },
{ "Key Menu", NULL },
{ "Key Power", NULL },
{ "Key Volume Down", NULL },
{ "Key Volume Up", NULL },
#else
{ "Key Record", NULL }, { "Key Record", NULL },
{ "Key Mode", NULL }, { "Key Mode", NULL },
{ "Key Off", NULL }, { "Key Off", NULL },
{ "Key On", NULL }, { "Key On", NULL },
{ "Key Select", NULL }, #endif
}; };
int *keys[]={
&key_right,
&key_left,
&key_up,
&key_down,
&key_fire,
&key_use,
&key_strafe,
&key_weapon,
&key_map
};
int numdoomkeys=sizeof(doomkeys) / sizeof(*doomkeys); int numdoomkeys=sizeof(doomkeys) / sizeof(*doomkeys);
static const struct menu_item items[] = { static const struct menu_item items[] = {
@ -516,65 +496,13 @@ int Oset_keys()
while(!menuquit) while(!menuquit)
{ {
result=rb->menu_show(m); result=rb->menu_show(m);
switch (result) if(result<0)
{
case 0:
key_right=translatekey(key_right);
rb->set_option(items[0].desc, &key_right, INT, doomkeys, numdoomkeys, NULL );
key_right=translatekey(key_right);
break;
case 1:
key_left=translatekey(key_left);
rb->set_option(items[1].desc, &key_left, INT, doomkeys, numdoomkeys, NULL );
key_left=translatekey(key_left);
break;
case 2:
key_up=translatekey(key_up);
rb->set_option(items[2].desc, &key_up, INT, doomkeys, numdoomkeys, NULL );
key_up=translatekey(key_up);
break;
case 3:
key_down=translatekey(key_down);
rb->set_option(items[3].desc, &key_down, INT, doomkeys, numdoomkeys, NULL );
key_down=translatekey(key_down);
break;
case 4:
key_fire=translatekey(key_fire);
rb->set_option(items[4].desc, &key_fire, INT, doomkeys, numdoomkeys, NULL );
key_fire=translatekey(key_fire);
break;
case 5:
key_use=translatekey(key_use);
rb->set_option(items[5].desc, &key_use, INT, doomkeys, numdoomkeys, NULL );
key_use=translatekey(key_use);
break;
case 6:
key_strafe=translatekey(key_strafe);
rb->set_option(items[6].desc, &key_strafe, INT, doomkeys, numdoomkeys, NULL );
key_strafe=translatekey(key_strafe);
break;
case 7:
key_weapon=translatekey(key_weapon);
rb->set_option(items[7].desc, &key_weapon, INT, doomkeys, numdoomkeys, NULL );
key_weapon=translatekey(key_weapon);
break;
case 8:
key_map=translatekey(key_map);
rb->set_option(items[8].desc, &key_map, INT, doomkeys, numdoomkeys, NULL );
key_map=translatekey(key_map);
break;
default:
menuquit=1; menuquit=1;
break; else
{
*keys[result]=translatekey(*keys[result]);
rb->set_option(items[result].desc, keys[result], INT, doomkeys, numdoomkeys, NULL );
*keys[result]=translatekey(*keys[result]);
} }
} }
@ -596,8 +524,8 @@ static bool Doptions()
int menuquit=0; int menuquit=0;
static const struct menu_item items[] = { static const struct menu_item items[] = {
{ "Sound", NULL },
{ "Set Keys", NULL }, { "Set Keys", NULL },
{ "Sound", NULL },
{ "Timedemo", NULL }, { "Timedemo", NULL },
{ "Player Bobbing", NULL }, { "Player Bobbing", NULL },
{ "Weapon Recoil", NULL }, { "Weapon Recoil", NULL },
@ -606,6 +534,24 @@ static bool Doptions()
{ "Always Run", NULL }, { "Always Run", NULL },
{ "Headsup Display", NULL }, { "Headsup Display", NULL },
{ "Statusbar Always Red", NULL }, { "Statusbar Always Red", NULL },
#if(LCD_HEIGHT>LCD_WIDTH)
{ "Rotate Screen 90 deg", NULL },
#endif
};
void *options[]={
&enable_sound,
&argvlist.timedemo,
&default_player_bobbing,
&default_weapon_recoil,
&default_translucency,
&fake_contrast,
&autorun,
&hud_displayed,
&sts_always_red,
#if(LCD_HEIGHT>LCD_WIDTH)
&rotate_screen,
#endif
}; };
m = rb->menu_init(items, sizeof(items) / sizeof(*items), m = rb->menu_init(items, sizeof(items) / sizeof(*items),
@ -614,54 +560,12 @@ static bool Doptions()
while(!menuquit) while(!menuquit)
{ {
result=rb->menu_show(m); result=rb->menu_show(m);
switch (result) if(result==0)
{
case 0: /* Sound */
nosfxparm=!nosfxparm; // Have to invert it before setting
rb->set_option(items[0].desc, &nosfxparm, INT, onoff, 2, NULL );
nosfxparm=!nosfxparm;
break;
case 1: /* Keys */
Oset_keys(); Oset_keys();
break; else if (result > 0)
rb->set_option(items[result].desc, options[result-1], INT, onoff, 2, NULL );
case 2: /* Timedemo */ else
rb->set_option(items[2].desc, &argvlist.timedemo, INT, onoff, 2, NULL );
break;
case 3: /* Player Bobbing */
rb->set_option(items[3].desc, &default_player_bobbing, INT, onoff, 2, NULL );
break;
case 4: /* Weapon Recoil */
rb->set_option(items[4].desc, &default_weapon_recoil, INT, onoff, 2, NULL );
break;
case 5: /* Translucency */
rb->set_option(items[5].desc, &default_translucency, INT, onoff, 2, NULL );
break;
case 6: /* Fake Contrast */
rb->set_option(items[6].desc, &fake_contrast, INT, onoff, 2, NULL );
break;
case 7: /* Always Run */
rb->set_option(items[7].desc, &autorun, INT, onoff, 2, NULL );
break;
case 8: /* Headsup Display */
rb->set_option(items[8].desc, &hud_displayed, INT, onoff, 2, NULL );
break;
case 9: /* Statusbar always red */
rb->set_option(items[9].desc, &sts_always_red, INT, onoff, 2, NULL );
break;
default:
menuquit=1; menuquit=1;
break;
}
} }
rb->menu_exit(m); rb->menu_exit(m);
@ -807,6 +711,19 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
else if( result == -2 ) return PLUGIN_ERROR; // Missing base wads else if( result == -2 ) return PLUGIN_ERROR; // Missing base wads
} }
#if(LCD_HEIGHT>LCD_WIDTH)
if(rotate_screen)
{
SCREENHEIGHT=LCD_WIDTH;
SCREENWIDTH=LCD_HEIGHT;
}
else
{
SCREENHEIGHT=LCD_HEIGHT;
SCREENWIDTH=LCD_WIDTH;
}
#endif
Dhandle_ver( namemap[ result ] ); Dhandle_ver( namemap[ result ] );
rb->lcd_setfont(0); rb->lcd_setfont(0);

View file

@ -100,6 +100,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 2 #define DOOM_CONFIG_VERSION 3
#endif #endif

View file

@ -117,7 +117,7 @@ void S_Init(int sfxVolume,int musicVolume )
{ {
//jff 1/22/98 skip sound init if sound not enabled //jff 1/22/98 skip sound init if sound not enabled
numChannels = default_numChannels; numChannels = default_numChannels;
if (!nosfxparm) if (enable_sound)
{ {
int i; int i;
@ -154,7 +154,7 @@ void S_Start(void)
{ {
int cnum, mnum; int cnum, mnum;
if (!nosfxparm) if (enable_sound)
{ {
// kill all playing sounds at start of level // kill all playing sounds at start of level
// (trust me - a good idea) // (trust me - a good idea)
@ -198,7 +198,7 @@ void S_StartSoundAtVolume(void *origin_p, int sfx_id, int volume)
sfxinfo_t* sfx; sfxinfo_t* sfx;
mobj_t* origin = (mobj_t *) origin_p; mobj_t* origin = (mobj_t *) origin_p;
if (nosfxparm) if (!enable_sound)
return; return;
is_pickup = sfx_id & PICKUP_SOUND || sfx_id == sfx_oof || (compatibility_level >= prboom_2_compatibility && sfx_id == sfx_noway); // killough 4/25/98 is_pickup = sfx_id & PICKUP_SOUND || sfx_id == sfx_oof || (compatibility_level >= prboom_2_compatibility && sfx_id == sfx_noway); // killough 4/25/98
@ -295,7 +295,7 @@ void S_StopSound(void *origin)
{ {
int cnum; int cnum;
if (nosfxparm) if (!enable_sound)
return; return;
for (cnum=0 ; cnum<numChannels ; cnum++) for (cnum=0 ; cnum<numChannels ; cnum++)
@ -311,7 +311,7 @@ void S_StopSound(void *origin)
// //
void S_PauseSound(void) void S_PauseSound(void)
{ {
if (nosfxparm) if (!enable_sound)
return; return;
if (mus_playing && !mus_paused) if (mus_playing && !mus_paused)
@ -323,7 +323,7 @@ void S_PauseSound(void)
void S_ResumeSound(void) void S_ResumeSound(void)
{ {
if (nosfxparm) if (!enable_sound)
return; return;
if (mus_playing && mus_paused) if (mus_playing && mus_paused)
@ -342,7 +342,7 @@ void S_UpdateSounds(void* listener_p)
mobj_t* listener = (mobj_t*)listener_p; mobj_t* listener = (mobj_t*)listener_p;
if (nosfxparm) if (!enable_sound)
return; return;
for (cnum=0 ; cnum<numChannels ; cnum++) for (cnum=0 ; cnum<numChannels ; cnum++)
@ -392,7 +392,7 @@ void S_UpdateSounds(void* listener_p)
void S_SetMusicVolume(int volume) void S_SetMusicVolume(int volume)
{ {
if (nosfxparm) if (!enable_sound)
return; return;
if (volume < 0 || volume > 15) if (volume < 0 || volume > 15)
@ -403,7 +403,7 @@ void S_SetMusicVolume(int volume)
void S_SetSfxVolume(int volume) void S_SetSfxVolume(int volume)
{ {
if (nosfxparm) if (!enable_sound)
return; return;
if (volume < 0 || volume > 127) if (volume < 0 || volume > 127)
@ -416,7 +416,7 @@ void S_SetSfxVolume(int volume)
// //
void S_StartMusic(int m_id) void S_StartMusic(int m_id)
{ {
if (nosfxparm) if (!enable_sound)
return; return;
S_ChangeMusic(m_id, false); S_ChangeMusic(m_id, false);
} }
@ -425,7 +425,7 @@ void S_ChangeMusic(int musicnum, int looping)
{ {
musicinfo_t *music; musicinfo_t *music;
if (nosfxparm) if (!enable_sound)
return; return;
if (musicnum <= mus_None || musicnum >= NUMMUSIC) if (musicnum <= mus_None || musicnum >= NUMMUSIC)
@ -464,7 +464,7 @@ void S_ChangeMusic(int musicnum, int looping)
void S_StopMusic(void) void S_StopMusic(void)
{ {
if (nosfxparm) if (!enable_sound)
return; return;
if (mus_playing) if (mus_playing)
@ -487,7 +487,7 @@ void S_StopChannel(int cnum)
int i; int i;
channel_t* c = &channels[cnum]; channel_t* c = &channels[cnum];
if (nosfxparm) if (!enable_sound)
return; return;
if (c->sfxinfo) if (c->sfxinfo)
@ -521,7 +521,7 @@ int S_AdjustSoundParams(mobj_t *listener, mobj_t *source,
fixed_t adx, ady, approx_dist; fixed_t adx, ady, approx_dist;
angle_t angle; angle_t angle;
if (nosfxparm) if (!enable_sound)
return 0; return 0;
// calculate the distance to sound origin // calculate the distance to sound origin
@ -576,7 +576,7 @@ static int S_getChannel(void *origin, sfxinfo_t *sfxinfo, int is_pickup)
int cnum; int cnum;
channel_t* c; channel_t* c;
if (nosfxparm) if (!enable_sound)
return -1; return -1;
// Find an open channel // Find an open channel

View file

@ -485,7 +485,7 @@ void W_Init(void)
int W_LumpLength (int lump) int W_LumpLength (int lump)
{ {
if (lump >= numlumps) if (lump >= numlumps)
I_Error ("W_LumpLength: %i >= numlumps",lump); I_Error ("W_LumpLength: %d >= numlumps",lump);
return lumpinfo[lump].size; return lumpinfo[lump].size;
} }
@ -501,7 +501,7 @@ void W_ReadLump(int lump, void *dest)
#ifdef RANGECHECK #ifdef RANGECHECK
if (lump >= numlumps) if (lump >= numlumps)
I_Error ("W_ReadLump: %i >= numlumps",lump); I_Error ("W_ReadLump: %d >= numlumps",lump);
#endif #endif
#ifndef NO_PREDEFINED_LUMPS #ifndef NO_PREDEFINED_LUMPS
@ -522,7 +522,7 @@ void W_ReadLump(int lump, void *dest)
lseek(l->handle, l->position, SEEK_SET); lseek(l->handle, l->position, SEEK_SET);
c = read(l->handle, dest, l->size); c = read(l->handle, dest, l->size);
if (c < l->size) if (c < l->size)
I_Error("W_ReadLump: only read %i of %i on lump %i", c, l->size, lump); I_Error("W_ReadLump: only read %d of %d on lump %d", c, l->size, lump);
} }
} }
@ -538,7 +538,7 @@ void * (W_CacheLumpNum)(int lump, unsigned short locks)
{ {
#ifdef RANGECHECK #ifdef RANGECHECK
if ((unsigned)lump >= (unsigned)numlumps) if ((unsigned)lump >= (unsigned)numlumps)
I_Error ("W_CacheLumpNum: %i >= numlumps",lump); I_Error ("W_CacheLumpNum: %d >= numlumps",lump);
#endif #endif
if (!lumpcache[lump]) // read the lump in if (!lumpcache[lump]) // read the lump in
@ -578,7 +578,7 @@ void * W_CacheLumpNumPadded(int lump, size_t len, unsigned char pad)
const int locks = 1; const int locks = 1;
#ifdef RANGECHECK #ifdef RANGECHECK
if ((unsigned)lump >= (unsigned)numlumps) if ((unsigned)lump >= (unsigned)numlumps)
I_Error ("W_CacheLumpNum: %i >= numlumps",lump); I_Error ("W_CacheLumpNum: %d >= numlumps",lump);
#endif #endif
if (!lumpcache[lump]) { /* read the lump in */ if (!lumpcache[lump]) { /* read the lump in */

View file

@ -115,7 +115,8 @@ static void Z_PrintStats(void) // Print allocation statistics
unsigned long total_memory = free_memory + active_memory + unsigned long total_memory = free_memory + active_memory +
purgable_memory + inactive_memory + purgable_memory + inactive_memory +
virtual_memory; virtual_memory;
double s = 100.0 / total_memory; // double s = 100.0 / total_memory;
int s = 100/total_memory;
doom_printf("%-5u\t%6.01f%%\tstatic\n" doom_printf("%-5u\t%6.01f%%\tstatic\n"
"%-5u\t%6.01f%%\tpurgable\n" "%-5u\t%6.01f%%\tpurgable\n"