summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2007-01-17 18:52:24 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2007-01-17 18:52:24 +0000
commitb47a43aa2866dbac7cc63b7a0f18d20b3b38883d (patch)
treed8bf3cc0b3c1c296e0cfd5ede1790968c4ce475f /apps
parent3b65fc2480929ade2686bb7ee3413a0f78f7c36a (diff)
downloadrockbox-b47a43aa2866dbac7cc63b7a0f18d20b3b38883d.tar.gz
rockbox-b47a43aa2866dbac7cc63b7a0f18d20b3b38883d.zip
Doom for the Gigabeat and some code reduction
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12051 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/doom/Makefile6
-rw-r--r--apps/plugins/doom/d_main.h2
-rw-r--r--apps/plugins/doom/doomdef.c8
-rw-r--r--apps/plugins/doom/doomdef.h18
-rw-r--r--apps/plugins/doom/doomstat.c2
-rw-r--r--apps/plugins/doom/doomstat.h2
-rw-r--r--apps/plugins/doom/g_game.c4
-rw-r--r--apps/plugins/doom/i_sound.c2
-rw-r--r--apps/plugins/doom/i_system.c6
-rw-r--r--apps/plugins/doom/i_video.c80
-rw-r--r--apps/plugins/doom/m_misc.c6
-rw-r--r--apps/plugins/doom/r_bsp.c2
-rw-r--r--apps/plugins/doom/r_defs.h4
-rw-r--r--apps/plugins/doom/r_main.c2
-rw-r--r--apps/plugins/doom/r_plane.c14
-rw-r--r--apps/plugins/doom/r_segs.c2
-rw-r--r--apps/plugins/doom/r_state.h2
-rw-r--r--apps/plugins/doom/r_things.c10
-rw-r--r--apps/plugins/doom/r_things.h4
-rw-r--r--apps/plugins/doom/rockdoom.c291
-rw-r--r--apps/plugins/doom/rockmacros.h2
-rw-r--r--apps/plugins/doom/s_sound.c30
-rw-r--r--apps/plugins/doom/w_wad.c10
-rw-r--r--apps/plugins/doom/z_zone.c3
24 files changed, 241 insertions, 271 deletions
diff --git a/apps/plugins/doom/Makefile b/apps/plugins/doom/Makefile
index 3565612709..a90a864f36 100644
--- a/apps/plugins/doom/Makefile
+++ b/apps/plugins/doom/Makefile
@@ -2,8 +2,8 @@
#
# $Id$
#
-# $Log$
-# Revision 1.13 2006/12/13 06:52:09 kkurbjun
+# $Log: Makefile,v $
+# Revision 1.13 2006-12-13 06:52:09 kkurbjun
# Free more plugin memory
#
# 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
#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
ifndef SIMVER
ifeq ($(TARGET), IRIVER_H100)
diff --git a/apps/plugins/doom/d_main.h b/apps/plugins/doom/d_main.h
index c7a861e9ac..3700c482bd 100644
--- a/apps/plugins/doom/d_main.h
+++ b/apps/plugins/doom/d_main.h
@@ -49,7 +49,7 @@ extern boolean clrespawnparm; // checkparm of -respawn
extern boolean clfastparm; // checkparm of -fast
//jff end of external declaration of command line playmode
-extern boolean nosfxparm;
+extern boolean enable_sound;
extern boolean nomusicparm;
extern int ffmap;
diff --git a/apps/plugins/doom/doomdef.c b/apps/plugins/doom/doomdef.c
index d4ad61e979..3facfbb299 100644
--- a/apps/plugins/doom/doomdef.c
+++ b/apps/plugins/doom/doomdef.c
@@ -33,7 +33,9 @@
#include "doomdef.h"
// Location for any defines turned variables.
-
-// None.
-
+#if(LCD_HEIGHT>LCD_WIDTH)
+bool rotate_screen=0;
+int SCREENWIDTH;
+int SCREENHEIGHT;
+#endif
diff --git a/apps/plugins/doom/doomdef.h b/apps/plugins/doom/doomdef.h
index be586a511f..a0e8ad50bc 100644
--- a/apps/plugins/doom/doomdef.h
+++ b/apps/plugins/doom/doomdef.h
@@ -33,6 +33,8 @@
#ifndef __DOOMDEF__
#define __DOOMDEF__
+#include "rockmacros.h"
+
// killough 4/25/98: Make gcc extensions mean nothing on other compilers
#ifndef __GNUC__
#define __attribute__(x)
@@ -88,14 +90,20 @@ typedef enum {
// allows us to avoid the overhead of dynamic allocation
// when multiple screen sizes are supported
+#if(LCD_HEIGHT>LCD_WIDTH)
+extern bool rotate_screen;
// proff 08/17/98: Changed for high-res
-#define MAX_SCREENWIDTH 1600
-#define MAX_SCREENHEIGHT 1200
-
+#define MAX_SCREENWIDTH LCD_HEIGHT
+#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 320
-//#define SCREENHEIGHT 200
#define SCREENHEIGHT LCD_HEIGHT
+#endif
// The maximum number of players, multiplayer/networking.
#define MAXPLAYERS 4
diff --git a/apps/plugins/doom/doomstat.c b/apps/plugins/doom/doomstat.c
index 75cc209919..b6dc649d1b 100644
--- a/apps/plugins/doom/doomstat.c
+++ b/apps/plugins/doom/doomstat.c
@@ -100,5 +100,5 @@ int doom_weapon_toggles; // killough 10/98
int monkeys IBSS_ATTR, default_monkeys;
-boolean nosfxparm=0;
+boolean enable_sound=1;
boolean rockblock=1;
diff --git a/apps/plugins/doom/doomstat.h b/apps/plugins/doom/doomstat.h
index 42cd4f5716..5a5a87c3c5 100644
--- a/apps/plugins/doom/doomstat.h
+++ b/apps/plugins/doom/doomstat.h
@@ -115,7 +115,7 @@ enum {
extern int comp[COMP_TOTAL], default_comp[COMP_TOTAL];
-extern boolean nosfxparm;
+extern boolean enable_sound;
extern boolean rockblock;
// -------------------------------------------
diff --git a/apps/plugins/doom/g_game.c b/apps/plugins/doom/g_game.c
index cd6ab45ade..8b5e222082 100644
--- a/apps/plugins/doom/g_game.c
+++ b/apps/plugins/doom/g_game.c
@@ -2773,11 +2773,11 @@ boolean G_CheckDemoStatus (void)
int fd=open(GAMEBASE "timedemo.txt",O_WRONLY | O_CREAT);
fdprintf (fd,"Timed %d gametics in %d realtics = %d frames per second",
(unsigned) gametic, realtics,
- (unsigned) gametic * (double) TICRATE / realtics);
+ (unsigned) gametic * TICRATE/ realtics);
close(fd);
I_Error ("%d gametics in %d realtics",
(unsigned) gametic,realtics,
- (unsigned) gametic * (double) TICRATE / realtics);
+ (unsigned) gametic * TICRATE / realtics);
return false;
}
diff --git a/apps/plugins/doom/i_sound.c b/apps/plugins/doom/i_sound.c
index 0f9e6edd19..34e838287e 100644
--- a/apps/plugins/doom/i_sound.c
+++ b/apps/plugins/doom/i_sound.c
@@ -472,7 +472,7 @@ void get_more(unsigned char** start, size_t* size)
void I_SubmitSound(void)
{
- if (nosfxparm)
+ if (!enable_sound)
return;
rb->pcm_play_data(&get_more, NULL, 0);
diff --git a/apps/plugins/doom/i_system.c b/apps/plugins/doom/i_system.c
index bf1aef63e1..95ea7a8f68 100644
--- a/apps/plugins/doom/i_system.c
+++ b/apps/plugins/doom/i_system.c
@@ -15,8 +15,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// $Log$
-// Revision 1.9 2006/04/15 22:08:36 kkurbjun
+// $Log: i_system.c,v $
+// 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
@@ -87,7 +87,7 @@ void doomtime(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;
#else
#if HZ==100
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index 0ddede09fa..b69b017103 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * $Log$
- * Revision 1.26 2006/12/13 04:44:17 kkurbjun
+ * $Log: i_video.c,v $
+ * 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).
*
* Revision 1.25 2006-10-26 13:38:04 barrywardell
@@ -127,14 +127,15 @@ static unsigned char *gbuf;
#endif
#endif
-#if defined(CPU_COLDFIRE)
-static char fastscreen[(LCD_WIDTH)*LCD_HEIGHT] IBSS_ATTR;
+#if defined(CPU_COLDFIRE)
+static char fastscreen[LCD_WIDTH*LCD_HEIGHT] IBSS_ATTR;
#endif
+
static fb_data palette[256] IBSS_ATTR;
static fb_data *paldata=NULL;
//
-// I_ShutdownGraphics (NOT USED)
+// I_ShutdownGraphics
//
void I_ShutdownGraphics(void)
{
@@ -187,6 +188,17 @@ void I_ShutdownGraphics(void)
#define DOOMBUTTON_ESC BUTTON_POWER
#define DOOMBUTTON_ENTER BUTTON_SCROLL_UP
#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
#define DOOMBUTTON_UP BUTTON_UP
#define DOOMBUTTON_DOWN BUTTON_DOWN
@@ -282,13 +294,11 @@ inline void getkey()
D_PostEvent(&event);
}
#endif
-#ifdef DOOMBUTTON_ENTER
if(released & DOOMBUTTON_ENTER)
{
event.data1=KEY_ENTER;
D_PostEvent(&event);
}
-#endif
#ifdef DOOMBUTTON_WEAPON
if(released & DOOMBUTTON_WEAPON)
{
@@ -296,6 +306,13 @@ inline void getkey()
D_PostEvent(&event);
}
#endif
+#ifdef DOOMBUTTON_MAP
+ if(released & DOOMBUTTON_MAP)
+ {
+ event.data1 =KEY_TAB;
+ D_PostEvent(&event);
+ }
+#endif
}
if(pressed)
{
@@ -353,6 +370,13 @@ inline void getkey()
D_PostEvent(&event);
}
#endif
+#ifdef DOOMBUTTON_MAP
+ if(pressed & DOOMBUTTON_MAP)
+ {
+ event.data1 =KEY_TAB;
+ D_PostEvent(&event);
+ }
+#endif
}
}
@@ -481,31 +505,45 @@ void I_FinishUpdate (void)
int y;
#ifdef HAVE_LCD_COLOR
-
- for (y = 0; y < LCD_HEIGHT*LCD_WIDTH; y++)
- {
- paletteIndex = d_screens[0][y];
- rb->lcd_framebuffer[y] = palette[paletteIndex];
- }
- rb->lcd_update();
+#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++)
+ {
+ paletteIndex = d_screens[0][y];
+ rb->lcd_framebuffer[y] = palette[paletteIndex];
+ }
+ rb->lcd_update();
#else /* !HAVE_LCD_COLOR */
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];
- graybuffer[yd * LCD_WIDTH + x]=palette[paletteIndex];
+ graybuffer[yd * SCREENWIDTH + x]=palette[paletteIndex];
}
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;
}
}
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
}
@@ -515,7 +553,7 @@ void I_FinishUpdate (void)
//
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;
#else
// 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
}
diff --git a/apps/plugins/doom/m_misc.c b/apps/plugins/doom/m_misc.c
index 75cef87f7d..1e4b75d8e1 100644
--- a/apps/plugins/doom/m_misc.c
+++ b/apps/plugins/doom/m_misc.c
@@ -291,7 +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},
+ {"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},
{"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
@@ -307,6 +307,10 @@ default_t defaults[] =
def_int,ss_none, 0, 0},
{"screen_height",{&desired_screenheight, NULL},{200, NULL},200,1200,
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,
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 */
diff --git a/apps/plugins/doom/r_bsp.c b/apps/plugins/doom/r_bsp.c
index e6ce74c029..a06cb96196 100644
--- a/apps/plugins/doom/r_bsp.c
+++ b/apps/plugins/doom/r_bsp.c
@@ -66,7 +66,7 @@ void R_ClearDrawSegs(void)
// 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.
-byte solidcol[SCREENWIDTH] IBSS_ATTR;
+byte solidcol[MAX_SCREENWIDTH] IBSS_ATTR;
// CPhipps -
// R_ClipWallSegment
diff --git a/apps/plugins/doom/r_defs.h b/apps/plugins/doom/r_defs.h
index 0fbaf9a9ac..a70d8a306c 100644
--- a/apps/plugins/doom/r_defs.h
+++ b/apps/plugins/doom/r_defs.h
@@ -434,9 +434,9 @@ typedef struct visplane
fixed_t height;
fixed_t xoffs, yoffs; // killough 2/28/98: Support scrolling flats
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 bottom[SCREENWIDTH];
+ unsigned short bottom[MAX_SCREENWIDTH];
unsigned short pad4;
}
visplane_t;
diff --git a/apps/plugins/doom/r_main.c b/apps/plugins/doom/r_main.c
index 58fe9d0f96..fa24bd9d13 100644
--- a/apps/plugins/doom/r_main.c
+++ b/apps/plugins/doom/r_main.c
@@ -86,7 +86,7 @@ int *viewangletox=0;
// to the lowest viewangle that maps back to x ranges
// 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 4/4/98: support dynamic number of them as well
diff --git a/apps/plugins/doom/r_plane.c b/apps/plugins/doom/r_plane.c
index 1ea1dd9193..2d2afd7cbe 100644
--- a/apps/plugins/doom/r_plane.c
+++ b/apps/plugins/doom/r_plane.c
@@ -73,11 +73,11 @@ short *openings,*lastopening;
// floorclip starts out SCREENHEIGHT
// 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
-static int spanstart[SCREENHEIGHT]; // killough 2/8/98
+static int spanstart[MAX_SCREENHEIGHT]; // killough 2/8/98
//
// texture mapping
@@ -89,13 +89,13 @@ static fixed_t planeheight;
// killough 2/8/98: make variables static
static fixed_t basexscale, baseyscale;
-static fixed_t cachedheight[SCREENHEIGHT];
-static fixed_t cacheddistance[SCREENHEIGHT];
-static fixed_t cachedxstep[SCREENHEIGHT];
-static fixed_t cachedystep[SCREENHEIGHT];
+static fixed_t cachedheight[MAX_SCREENHEIGHT];
+static fixed_t cacheddistance[MAX_SCREENHEIGHT];
+static fixed_t cachedxstep[MAX_SCREENHEIGHT];
+static fixed_t cachedystep[MAX_SCREENHEIGHT];
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
diff --git a/apps/plugins/doom/r_segs.c b/apps/plugins/doom/r_segs.c
index 8d38e4bd5f..f3bd81e921 100644
--- a/apps/plugins/doom/r_segs.c
+++ b/apps/plugins/doom/r_segs.c
@@ -251,7 +251,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2)
// CALLED: CORE LOOPING ROUTINE.
//
-extern byte solidcol[SCREENWIDTH];
+extern byte solidcol[MAX_SCREENWIDTH];
#define HEIGHTBITS 12
#define HEIGHTUNIT (1<<HEIGHTBITS)
static int didsolidcol; /* True if at least one column was marked solid */
diff --git a/apps/plugins/doom/r_state.h b/apps/plugins/doom/r_state.h
index bca66d4b6d..e04a8170f0 100644
--- a/apps/plugins/doom/r_state.h
+++ b/apps/plugins/doom/r_state.h
@@ -109,7 +109,7 @@ extern angle_t viewangle;
extern player_t *viewplayer;
extern angle_t clipangle;
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 angle_t rw_normalangle;
diff --git a/apps/plugins/doom/r_things.c b/apps/plugins/doom/r_things.c
index 461edadce1..6c83a47b27 100644
--- a/apps/plugins/doom/r_things.c
+++ b/apps/plugins/doom/r_things.c
@@ -71,8 +71,8 @@ static lighttable_t** spritelights;
// constant arrays
// used for psprite clipping and initializing clipping
-short negonearray[SCREENWIDTH];
-short screenheightarray[SCREENWIDTH];
+short negonearray[MAX_SCREENWIDTH];
+short screenheightarray[MAX_SCREENWIDTH];
//
@@ -282,7 +282,7 @@ void R_InitSprites(const char * const *namelist)
{
int i;
- for (i=0 ; i<SCREENWIDTH ; i++)
+ for (i=0 ; i<MAX_SCREENWIDTH ; i++)
negonearray[i] = -1;
R_InitSpriteDefs (namelist);
}
@@ -835,8 +835,8 @@ void R_SortVisSprites (void)
void R_DrawSprite (vissprite_t* spr)
{
drawseg_t *ds;
- short clipbot[SCREENWIDTH]; // killough 2/8/98:
- short cliptop[SCREENWIDTH]; // change to MAX_*
+ short clipbot[MAX_SCREENWIDTH]; // killough 2/8/98:
+ short cliptop[MAX_SCREENWIDTH]; // change to MAX_*
int x;
int r1;
int r2;
diff --git a/apps/plugins/doom/r_things.h b/apps/plugins/doom/r_things.h
index c3308744b8..424033a971 100644
--- a/apps/plugins/doom/r_things.h
+++ b/apps/plugins/doom/r_things.h
@@ -38,8 +38,8 @@
/* Constant arrays used for psprite clipping and initializing clipping. */
-extern short negonearray[SCREENWIDTH];
-extern short screenheightarray[SCREENWIDTH];
+extern short negonearray[MAX_SCREENWIDTH];
+extern short screenheightarray[MAX_SCREENWIDTH];
/* Vars for R_DrawMaskedColumn */
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index 00bd22b7ea..6d0e73e3be 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -108,6 +108,7 @@ int printf(const char *fmt, ...)
static int p_xtpt;
char p_buf[50];
bool ok;
+ rb->yield();
va_list ap;
va_start(ap, fmt);
@@ -293,76 +294,29 @@ int Dbuild_base (struct opt_items *names)
D_AddFile (GAMEBASE"rockdoom.wad", source_pwad);
- int i=0;
+ int i=0, j;
/* Doom Shareware */
- if ( !fileexists (wads_builtin[0]) )
- {
- names[i].string=versions_builtin[0];
- names[i].voice_id=0;
- namemap[i]=0;
- i++;
- }
-
/* Doom registered */
- if ( !fileexists (wads_builtin[1]) )
- {
- names[i].string=versions_builtin[1];
- names[i].voice_id=0;
- namemap[i]=1;
- i++;
- }
-
/* Ultimate Doom */
- if ( !fileexists (wads_builtin[2]) )
- {
- names[i].string=versions_builtin[2];
- names[i].voice_id=0;
- namemap[i]=2;
- i++;
- }
-
/* Doom2 */
- if ( !fileexists (wads_builtin[3]) )
- {
- names[i].string=versions_builtin[3];
- names[i].voice_id=0;
- namemap[i]=3;
- i++;
- }
-
/* Doom2f */
- if ( !fileexists (wads_builtin[4]) )
- {
- names[i].string=versions_builtin[4];
- names[i].voice_id=0;
- namemap[i]=4;
- i++;
- }
-
/* Plutonia */
- if ( !fileexists (wads_builtin[5]) )
- {
- names[i].string=versions_builtin[5];
- names[i].voice_id=0;
- namemap[i]=5;
- i++;
- }
-
/* TNT */
- if ( !fileexists (wads_builtin[6]) )
- {
- names[i].string=versions_builtin[6];
- names[i].voice_id=0;
- namemap[i]=6;
- i++;
- }
+ for(j=0;j<7;j++)
+ if ( !fileexists (wads_builtin[j]) )
+ {
+ names[i].string=versions_builtin[j];
+ names[i].voice_id=0;
+ namemap[i]=j;
+ i++;
+ }
// Set argvlist defaults
argvlist.timedemo=0;
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.
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;
}
+static int translatekey(int key) __attribute__ ((noinline));
+
// 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)
{
@@ -431,16 +387,17 @@ int translatekey(int key)
case 4:
return KEY_DOWNARROW;
case 5:
- return KEY_RCTRL;
+ return KEY_ENTER;
case 6:
- return ' ';
+ return KEY_RCTRL;
case 7:
- return KEY_ESCAPE;
+ return ' ';
case 8:
- return 'w';
+ return KEY_ESCAPE;
case 9:
- return KEY_ENTER;
+ return 'w';
case 10:
+ return KEY_TAB;
default:
return 0;
}
@@ -459,17 +416,18 @@ int translatekey(int key)
return 3;
case KEY_DOWNARROW:
return 4;
- case KEY_RCTRL:
+ case KEY_ENTER:
return 5;
- case ' ':
+ case KEY_RCTRL:
return 6;
- case KEY_ESCAPE:
+ case ' ':
return 7;
- case 'w':
+ case KEY_ESCAPE:
return 8;
- case KEY_ENTER:
+ case 'w':
return 9;
- case KEY_F9:
+ case KEY_TAB:
+ return 10;
default:
return 0;
}
@@ -484,18 +442,40 @@ int Oset_keys()
int m, result;
int menuquit=0;
+
static const struct opt_items doomkeys[] = {
{ "Unmapped", NULL },
{ "Key Right", NULL },
{ "Key Left", NULL },
{ "Key Up", 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 Mode", NULL },
{ "Key Off", 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);
static const struct menu_item items[] = {
@@ -513,69 +493,17 @@ int Oset_keys()
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
NULL, NULL, NULL, NULL);
- while(!menuquit)
- {
- result=rb->menu_show(m);
- switch (result)
- {
- 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:
+ while(!menuquit)
+ {
+ result=rb->menu_show(m);
+ if(result<0)
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]);
+ }
}
rb->menu_exit(m);
@@ -596,8 +524,8 @@ static bool Doptions()
int menuquit=0;
static const struct menu_item items[] = {
- { "Sound", NULL },
{ "Set Keys", NULL },
+ { "Sound", NULL },
{ "Timedemo", NULL },
{ "Player Bobbing", NULL },
{ "Weapon Recoil", NULL },
@@ -606,67 +534,43 @@ static bool Doptions()
{ "Always Run", NULL },
{ "Headsup Display", 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),
- NULL, NULL, NULL, NULL);
+ m = rb->menu_init(items, sizeof(items) / sizeof(*items),
+ NULL, NULL, NULL, NULL);
- while(!menuquit)
- {
- result=rb->menu_show(m);
- switch (result)
- {
- 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 */
+ while(!menuquit)
+ {
+ result=rb->menu_show(m);
+ if(result==0)
Oset_keys();
- break;
-
- case 2: /* Timedemo */
- 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:
+ else if (result > 0)
+ rb->set_option(items[result].desc, options[result-1], INT, onoff, 2, NULL );
+ else
menuquit=1;
- break;
- }
- }
+ }
- rb->menu_exit(m);
+ rb->menu_exit(m);
- return (1);
+ return (1);
}
int menuchoice(struct menu_item *menu, int items)
@@ -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
}
+#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 ] );
rb->lcd_setfont(0);
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h
index 901aa5513d..ff179cfc65 100644
--- a/apps/plugins/doom/rockmacros.h
+++ b/apps/plugins/doom/rockmacros.h
@@ -100,6 +100,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 2
+#define DOOM_CONFIG_VERSION 3
#endif
diff --git a/apps/plugins/doom/s_sound.c b/apps/plugins/doom/s_sound.c
index c8ed7b2839..4b863b5872 100644
--- a/apps/plugins/doom/s_sound.c
+++ b/apps/plugins/doom/s_sound.c
@@ -117,7 +117,7 @@ void S_Init(int sfxVolume,int musicVolume )
{
//jff 1/22/98 skip sound init if sound not enabled
numChannels = default_numChannels;
- if (!nosfxparm)
+ if (enable_sound)
{
int i;
@@ -154,7 +154,7 @@ void S_Start(void)
{
int cnum, mnum;
- if (!nosfxparm)
+ if (enable_sound)
{
// kill all playing sounds at start of level
// (trust me - a good idea)
@@ -198,7 +198,7 @@ void S_StartSoundAtVolume(void *origin_p, int sfx_id, int volume)
sfxinfo_t* sfx;
mobj_t* origin = (mobj_t *) origin_p;
- if (nosfxparm)
+ if (!enable_sound)
return;
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;
- if (nosfxparm)
+ if (!enable_sound)
return;
for (cnum=0 ; cnum<numChannels ; cnum++)
@@ -311,7 +311,7 @@ void S_StopSound(void *origin)
//
void S_PauseSound(void)
{
- if (nosfxparm)
+ if (!enable_sound)
return;
if (mus_playing && !mus_paused)
@@ -323,7 +323,7 @@ void S_PauseSound(void)
void S_ResumeSound(void)
{
- if (nosfxparm)
+ if (!enable_sound)
return;
if (mus_playing && mus_paused)
@@ -342,7 +342,7 @@ void S_UpdateSounds(void* listener_p)
mobj_t* listener = (mobj_t*)listener_p;
- if (nosfxparm)
+ if (!enable_sound)
return;
for (cnum=0 ; cnum<numChannels ; cnum++)
@@ -392,7 +392,7 @@ void S_UpdateSounds(void* listener_p)
void S_SetMusicVolume(int volume)
{
- if (nosfxparm)
+ if (!enable_sound)
return;
if (volume < 0 || volume > 15)
@@ -403,7 +403,7 @@ void S_SetMusicVolume(int volume)
void S_SetSfxVolume(int volume)
{
- if (nosfxparm)
+ if (!enable_sound)
return;
if (volume < 0 || volume > 127)
@@ -416,7 +416,7 @@ void S_SetSfxVolume(int volume)
//
void S_StartMusic(int m_id)
{
- if (nosfxparm)
+ if (!enable_sound)
return;
S_ChangeMusic(m_id, false);
}
@@ -425,7 +425,7 @@ void S_ChangeMusic(int musicnum, int looping)
{
musicinfo_t *music;
- if (nosfxparm)
+ if (!enable_sound)
return;
if (musicnum <= mus_None || musicnum >= NUMMUSIC)
@@ -464,7 +464,7 @@ void S_ChangeMusic(int musicnum, int looping)
void S_StopMusic(void)
{
- if (nosfxparm)
+ if (!enable_sound)
return;
if (mus_playing)
@@ -487,7 +487,7 @@ void S_StopChannel(int cnum)
int i;
channel_t* c = &channels[cnum];
- if (nosfxparm)
+ if (!enable_sound)
return;
if (c->sfxinfo)
@@ -521,7 +521,7 @@ int S_AdjustSoundParams(mobj_t *listener, mobj_t *source,
fixed_t adx, ady, approx_dist;
angle_t angle;
- if (nosfxparm)
+ if (!enable_sound)
return 0;
// calculate the distance to sound origin
@@ -576,7 +576,7 @@ static int S_getChannel(void *origin, sfxinfo_t *sfxinfo, int is_pickup)
int cnum;
channel_t* c;
- if (nosfxparm)
+ if (!enable_sound)
return -1;
// Find an open channel
diff --git a/apps/plugins/doom/w_wad.c b/apps/plugins/doom/w_wad.c
index 18da216dcf..1e3406199d 100644
--- a/apps/plugins/doom/w_wad.c
+++ b/apps/plugins/doom/w_wad.c
@@ -485,7 +485,7 @@ void W_Init(void)
int W_LumpLength (int lump)
{
if (lump >= numlumps)
- I_Error ("W_LumpLength: %i >= numlumps",lump);
+ I_Error ("W_LumpLength: %d >= numlumps",lump);
return lumpinfo[lump].size;
}
@@ -501,7 +501,7 @@ void W_ReadLump(int lump, void *dest)
#ifdef RANGECHECK
if (lump >= numlumps)
- I_Error ("W_ReadLump: %i >= numlumps",lump);
+ I_Error ("W_ReadLump: %d >= numlumps",lump);
#endif
#ifndef NO_PREDEFINED_LUMPS
@@ -522,7 +522,7 @@ void W_ReadLump(int lump, void *dest)
lseek(l->handle, l->position, SEEK_SET);
c = read(l->handle, dest, 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
if ((unsigned)lump >= (unsigned)numlumps)
- I_Error ("W_CacheLumpNum: %i >= numlumps",lump);
+ I_Error ("W_CacheLumpNum: %d >= numlumps",lump);
#endif
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;
#ifdef RANGECHECK
if ((unsigned)lump >= (unsigned)numlumps)
- I_Error ("W_CacheLumpNum: %i >= numlumps",lump);
+ I_Error ("W_CacheLumpNum: %d >= numlumps",lump);
#endif
if (!lumpcache[lump]) { /* read the lump in */
diff --git a/apps/plugins/doom/z_zone.c b/apps/plugins/doom/z_zone.c
index 2ae5d73833..552e3218b0 100644
--- a/apps/plugins/doom/z_zone.c
+++ b/apps/plugins/doom/z_zone.c
@@ -115,7 +115,8 @@ static void Z_PrintStats(void) // Print allocation statistics
unsigned long total_memory = free_memory + active_memory +
purgable_memory + inactive_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"
"%-5u\t%6.01f%%\tpurgable\n"