r227 - trunk/rott

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat May 24 02:29:04 EDT 2008


Author: jwrdegoede
Date: 2008-05-24 02:29:04 -0400 (Sat, 24 May 2008)
New Revision: 227

Modified:
   trunk/rott/Makefile
   trunk/rott/_rt_floo.h
   trunk/rott/_rt_game.h
   trunk/rott/_rt_menu.h
   trunk/rott/_rt_play.h
   trunk/rott/cin_efct.c
   trunk/rott/cin_main.c
   trunk/rott/develop.h
   trunk/rott/engine.c
   trunk/rott/engine.h
   trunk/rott/lookups.c
   trunk/rott/modexlib.c
   trunk/rott/modexlib.h
   trunk/rott/rt_actor.c
   trunk/rott/rt_build.c
   trunk/rott/rt_cfg.c
   trunk/rott/rt_debug.c
   trunk/rott/rt_def.h
   trunk/rott/rt_door.c
   trunk/rott/rt_draw.c
   trunk/rott/rt_floor.c
   trunk/rott/rt_game.c
   trunk/rott/rt_game.h
   trunk/rott/rt_main.c
   trunk/rott/rt_map.c
   trunk/rott/rt_menu.c
   trunk/rott/rt_msg.c
   trunk/rott/rt_playr.c
   trunk/rott/rt_scale.c
   trunk/rott/rt_stat.c
   trunk/rott/rt_str.c
   trunk/rott/rt_ted.c
   trunk/rott/rt_vid.c
   trunk/rott/rt_vid.h
   trunk/rott/rt_view.c
   trunk/rott/rt_view.h
   trunk/rott/states.h
   trunk/rott/w_wad.c
   trunk/rott/z_zone.c
Log:
Many changes ported over from winrott (not winrottgl but plain winrott) main feature of all these changes: higher resolution (software) rendering support

Modified: trunk/rott/Makefile
===================================================================
--- trunk/rott/Makefile	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/Makefile	2008-05-24 06:29:04 UTC (rev 227)
@@ -105,7 +105,8 @@
 	z_zone.o \
 	byteordr.o \
 	dukemusc.o \
-	audiolib/audiolib.a
+	audiolib/audiolib.a \
+	winrott.o
 	$(CC) $^ $(LDLIBS) -o $@
 
 clean:

Modified: trunk/rott/_rt_floo.h
===================================================================
--- trunk/rott/_rt_floo.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/_rt_floo.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -20,9 +20,9 @@
 #ifndef _rt_floor_private
 #define _rt_floor_private
 
-#define	MAXVIEWHEIGHT MAXSCREENHEIGHT	
+//#define	MAXVIEWHEIGHT MAXSCREENHEIGHT	
 #define MAXSKYSEGS    2048
 #define MAXSKYDATA    8
-#define MINSKYHEIGHT  148
+#define MINSKYHEIGHT  0//148 //bna++ sky change here
 
 #endif

Modified: trunk/rott/_rt_game.h
===================================================================
--- trunk/rott/_rt_game.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/_rt_game.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -65,16 +65,25 @@
 #define LEADER_NAME_Y ( LEADER_Y + 2 )
 #define LEADER_WIDTH  88
 #define LEADER_HEIGHT 16
-
+/* bna++
 #define HEALTH_X  20
 #define HEALTH_Y  185
 
 #define AMMO_X    300
 #define AMMO_Y    184
+*/
+//--------------------
+#define HEALTH_X  20*2
+#define HEALTH_Y  (185*2)+16
 
+#define AMMO_X    300*2
+#define AMMO_Y    (184*2)+16
+//--------------------
+
 #define SCORE_X   4
 #define SCORE_Y   0
 
+/*
 #define KEY1_X    152
 #define KEY2_X    160
 #define KEY3_X    168
@@ -89,7 +98,23 @@
 
 #define MEN_X     216
 #define MEN_Y     0
+*/
+//--------------------
+#define KEY1_X    152
+#define KEY2_X    160
+#define KEY3_X    168
+#define KEY4_X    176
+#define KEY_Y     0
 
+#define POWER_X   (184)
+#define POWER_Y   0
+
+#define ARMOR_X   200
+#define ARMOR_Y   0
+
+#define MEN_X     216
+#define MEN_Y     0
+//--------------------
 #define HOUR_X    7
 #define MIN_X     26
 #define SEC_X     45

Modified: trunk/rott/_rt_menu.h
===================================================================
--- trunk/rott/_rt_menu.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/_rt_menu.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -303,8 +303,11 @@
 void DrawControlMenu (void);
 void CP_ControlMenu (void);
 void DrawOptionsMenu (void);
+void DrawExtOptionsMenu (void);
+void CP_ExtOptionsMenu (void);
 void CP_OptionsMenu (void);
 void DrawOptionsButtons (void);
+void DrawExtOptionsButtons (void);
 void MenuFlipSpeed (void);
 void DrawDetailMenu (void);
 void CP_DetailMenu (void);

Modified: trunk/rott/_rt_play.h
===================================================================
--- trunk/rott/_rt_play.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/_rt_play.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -21,11 +21,20 @@
 #define _rt_playr_private
 
 #include "watcom.h"
+//double dTopYZANGLELIMIT; in winrott.c
+#define TopYZANGLELIMIT  (44*FINEANGLES/360)//bna added
+#define YZANGLELIMIT  (80*FINEANGLES/360)//bna--(30*FINEANGLES/360)
+/*
+//bna++ had to limit this or the sky would fuck up 
+#define TopYZANGLELIMIT  (6*FINEANGLES/360)//bna added
+#define YZANGLELIMIT  (40*FINEANGLES/360)//bna--(30*FINEANGLES/360)
+//partly fixed you can now se up but not down very much see rt_playr.c TopYZANGLELIMIT
+*/
 
-#define YZANGLELIMIT  (30*FINEANGLES/360)
-#define YZTILTSPEED   20
-#define SNAPBACKSPEED 10
-#define YZHORIZONSPEED 4
+
+#define YZTILTSPEED   20*4//*2 = bna added
+#define SNAPBACKSPEED 10*15//*2 = bna added
+#define YZHORIZONSPEED 4*5//*2 = bna added
 #define HORIZONYZOFFSET (FINEANGLES/4)
 #define SetPlayerHorizon(ps,hlevel)    \
     {                                  \

Modified: trunk/rott/cin_efct.c
===================================================================
--- trunk/rott/cin_efct.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/cin_efct.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -253,8 +253,8 @@
       bottomscreen = topscreen + (cin_invscale*length);
       cin_yl = (topscreen+FRACTIONUNIT-1)>>FRACTIONBITS;
       cin_yh = (bottomscreen-FRACTIONUNIT)>>FRACTIONBITS;
-      if (cin_yh >= MAXSCREENHEIGHT)
-         cin_yh = MAXSCREENHEIGHT-1;
+      if (cin_yh >= iGLOBAL_SCREENHEIGHT)
+         cin_yh = iGLOBAL_SCREENHEIGHT-1;
       if (cin_yl < 0)
          cin_yl = 0;
       if (cin_yl <= cin_yh)
@@ -354,10 +354,10 @@
    pic=(lpic_t *)W_CacheLumpName(back->name,PU_CACHE, Cvt_lpic_t, 1);
 
    height = pic->height;
-   if (height+back->yoffset>MAXSCREENHEIGHT)
-      height=MAXSCREENHEIGHT-back->yoffset;
+   if (height+back->yoffset>iGLOBAL_SCREENHEIGHT)
+      height=iGLOBAL_SCREENHEIGHT-back->yoffset;
 
-   if (height!=MAXSCREENHEIGHT)
+   if (height!=iGLOBAL_SCREENHEIGHT)
       DrawClearBuffer ();
 
    plane = 0;
@@ -372,9 +372,9 @@
       VGAWRITEMAP(plane);
 
 #ifdef DOS
-      for (i=plane;i<MAXSCREENWIDTH;i+=4,offset+=4,buf++)
+      for (i=plane;i<iGLOBAL_SCREENWIDTH;i+=4,offset+=4,buf++)
 #else
-      for (i=0;i<MAXSCREENWIDTH;i++,offset++,buf++)
+      for (i=0;i<iGLOBAL_SCREENWIDTH;i++,offset++,buf++)
 #endif
          {
          if (offset>=back->backdropwidth)
@@ -406,10 +406,10 @@
    int height;
 
    height = back->height;
-   if (height+back->yoffset>MAXSCREENHEIGHT)
-      height=MAXSCREENHEIGHT-back->yoffset;
+   if (height+back->yoffset>iGLOBAL_SCREENHEIGHT)
+      height=iGLOBAL_SCREENHEIGHT-back->yoffset;
 
-   if (height!=MAXSCREENHEIGHT)
+   if (height!=iGLOBAL_SCREENHEIGHT)
       DrawClearBuffer ();
 
    plane = 0;
@@ -424,9 +424,9 @@
       VGAWRITEMAP(plane);
 
 #ifdef DOS
-      for (i=plane;i<MAXSCREENWIDTH;i+=4,offset+=4,buf++)
+      for (i=plane;i<iGLOBAL_SCREENWIDTH;i+=4,offset+=4,buf++)
 #else
-      for (i=0;i<MAXSCREENWIDTH;i++,offset++,buf++)
+      for (i=0;i<iGLOBAL_SCREENWIDTH;i++,offset++,buf++)
 #endif
          {
          if (offset>=back->backdropwidth)
@@ -467,7 +467,7 @@
    toppost=-p->topoffset+back->yoffset;
 
    plane = 0;
-   
+
 #ifdef DOS
    for (plane=0;plane<4;plane++)
 #endif
@@ -478,9 +478,9 @@
       VGAWRITEMAP(plane);
 
 #ifdef DOS
-      for (i=plane;i<MAXSCREENWIDTH;i+=4,offset+=4,buf++)
+      for (i=plane;i<iGLOBAL_SCREENWIDTH;i+=4,offset+=4,buf++)
 #else
-      for (i=0;i<MAXSCREENWIDTH;i++,offset++,buf++)
+      for (i=0;i<iGLOBAL_SCREENWIDTH;i++,offset++,buf++)
 #endif
          {
          if (offset>=back->backdropwidth)
@@ -552,7 +552,7 @@
 // calculate edges of the shape
 //
    x1 = (xcent+(tx*cin_invscale))>>FRACTIONBITS;
-   if (x1 >= MAXSCREENWIDTH)
+   if (x1 >= iGLOBAL_SCREENWIDTH)
       return;               // off the right side
    tx+=p->width;
    x2 = ((xcent+(tx*cin_invscale)) >>FRACTIONBITS) - 1 ;
@@ -568,7 +568,7 @@
       }
    else
       frac=0;
-   x2 = x2 >= MAXSCREENWIDTH ? (MAXSCREENWIDTH-1) : x2;
+   x2 = x2 >= iGLOBAL_SCREENWIDTH ? (iGLOBAL_SCREENWIDTH-1) : x2;
 
    cin_texturemid = (((p->origsize>>1)+p->topoffset)<<FRACTIONBITS)+(FRACTIONUNIT>>1);
    cin_sprtopoffset = (cin_ycenter<<16) - FixedMul(cin_texturemid,cin_invscale);
@@ -687,9 +687,9 @@
 {
 #ifdef DOS
   VGAMAPMASK(15);
-  memset((byte *)bufferofs,0,SCREENBWIDE*MAXSCREENHEIGHT);
+  memset((byte *)bufferofs,0,iGLOBAL_SCREENBWIDE*iGLOBAL_SCREENHEIGHT);
 #else
-  memset((byte *)bufferofs,0,MAXSCREENWIDTH*MAXSCREENHEIGHT);
+  memset((byte *)bufferofs,0,iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT);
 #endif
 }
 
@@ -898,9 +898,9 @@
       VGAWRITEMAP(plane);
 
 #ifdef DOS
-      for (i=plane;i<MAXSCREENWIDTH;i+=4,buf++)
+      for (i=plane;i<iGLOBAL_SCREENWIDTH;i+=4,buf++)
 #else
-      for (i=0;i<MAXSCREENWIDTH;i++,buf++)
+      for (i=0;i<iGLOBAL_SCREENWIDTH;i++,buf++)
 #endif
          {
          DrawFilmPost(buf,&src[0],200);
@@ -942,9 +942,9 @@
       VGAWRITEMAP(plane);
 
 #ifdef DOS
-      for (i=plane;i<MAXSCREENWIDTH;i+=4,src+=(pic->height<<2),buf++)
+      for (i=plane;i<iGLOBAL_SCREENWIDTH;i+=4,src+=(pic->height<<2),buf++)
 #else
-      for (i=0;i<MAXSCREENWIDTH;i++,src+=pic->height,buf++)
+      for (i=0;i<iGLOBAL_SCREENWIDTH;i++,src+=pic->height,buf++)
 #endif
          {
          DrawFilmPost(buf,src,height);

Modified: trunk/rott/cin_main.c
===================================================================
--- trunk/rott/cin_main.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/cin_main.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -267,7 +267,7 @@
 
 	while (count--) {
 		*dest = cin_source[(frac>>SFRACBITS)];
-		dest += MAXSCREENWIDTH;
+		dest += iGLOBAL_SCREENWIDTH;
 		frac += fracstep;
 	}
 }

Modified: trunk/rott/develop.h
===================================================================
--- trunk/rott/develop.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/develop.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -39,6 +39,7 @@
 #define DELUXE   0
 #define LOWCOST  0
 
+#define BNACRASHPREVENT  1 //bna added 
 // Make sure only one of the following are on at one time
 #define SHAREWARE   1
 #define SUPERROTT   0

Modified: trunk/rott/engine.c
===================================================================
--- trunk/rott/engine.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/engine.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -38,8 +38,9 @@
 
 =============================================================================
 */
-
-wallcast_t posts[321];
+//wallcast_t posts[642];//bna++
+wallcast_t posts[800+2];//bna++
+//wallcast_t posts[321];
 int lasttilex;
 int lasttiley;
 /*

Modified: trunk/rott/engine.h
===================================================================
--- trunk/rott/engine.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/engine.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -19,6 +19,8 @@
 */
 #ifndef _engine_public
 #define _engine_public
+
+#include "modexlib.h"
 //***************************************************************************
 //
 // ENGINE.C
@@ -36,9 +38,10 @@
   int      posttype;
   int      alttile;
 } wallcast_t;
+extern wallcast_t posts[800+2];//bna++ JUST MAKE IT MAX RES
+//extern wallcast_t posts[642];//bna++
+//extern wallcast_t posts[321];
 
-extern wallcast_t posts[321];
-
 extern int lasttilex;
 extern int lasttiley;
 

Modified: trunk/rott/lookups.c
===================================================================
--- trunk/rott/lookups.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/lookups.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -118,7 +118,8 @@
     for (i=0;i<PANGLES;i++)
        {
        // start 1/2 pixel over, so viewangle bisects two middle pixels
-       tang = ((((double)i*160.0)+80.0)/(FPFOCALWIDTH*(double)PANGLES));
+       //tang = ((((double)i*160.0)+80.0)/(FPFOCALWIDTH*(double)PANGLES));
+       tang = ((((double)i*160.0)+80.0)/(dGLOBAL_FPFOCALWIDTH*(double)PANGLES));
        angle = atan(tang);
        intang = ((long)(angle*radtoint));
        pangle[i] = intang;

Modified: trunk/rott/modexlib.c
===================================================================
--- trunk/rott/modexlib.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/modexlib.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -39,12 +39,22 @@
 #include "memcheck.h"
 #include "rt_util.h"
 
-
+void    SchrinkMemPicture();
+void StrechMemPicture ();
+void StrechFlipMemPicture ();
 // GLOBAL VARIABLES
 
-
+boolean StrechScreen=true;//bná++
+extern char *tmpPICbuf;
+char *sdl_surfacePTR;
+extern int iG_aimCross;
+extern int iG_X_center;
+extern int iG_Y_center;
+char 	   *iG_buf_center;
+  
 int    linewidth;
-int    ylookup[MAXSCREENHEIGHT];
+//int    ylookup[MAXSCREENHEIGHT];
+int    ylookup[600];//just set to max res
 byte  *page1start;
 byte  *page2start;
 byte  *page3start;
@@ -52,7 +62,11 @@
 byte  *bufferofs;
 byte  *displayofs;
 boolean graphicsmode=false;
+char        *bufofsTopLimit;
+char        *bufofsBottomLimit;
 
+void DrawCenterAim ();
+
 #ifdef DOS
 
 /*
@@ -171,7 +185,7 @@
 
    offset = 0;
 
-   for (i=0;i<MAXSCANLINES;i++)
+   for (i=0;i<iGLOBAL_SCREENHEIGHT;i++)
       {
       ylookup[i]=offset;
       offset += linewidth;
@@ -191,7 +205,7 @@
     GraphicsMode();
     VL_DePlaneVGA ();
     VL_SetLineWidth (48);
-    screensize=208*SCREENBWIDE;
+    screensize=208*iGLOBAL_SCREENBWIDE*2;//bna++ *2
     page1start=0xa0200;
     page2start=0xa0200+screensize;
     page3start=0xa0200+(2u*screensize);
@@ -426,12 +440,12 @@
 
     SDL_WM_SetCaption ("Rise of the Triad", "ROTT");
     SDL_ShowCursor (0);
-    sdl_surface = SDL_SetVideoMode (320, 200, 8, flags);
-    
+//    sdl_surface = SDL_SetVideoMode (320, 200, 8, flags);
+    sdl_surface = SDL_SetVideoMode (iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, 8, flags);    
 	if (sdl_surface == NULL)
 	{
 		Error ("Could not set video mode\n");
-	}
+	} 
 }
 
 /*
@@ -494,23 +508,36 @@
 //
 // set up lookup tables
 //
-   linewidth = 320;
+//bna--   linewidth = 320;
+   linewidth = iGLOBAL_SCREENWIDTH;
 
    offset = 0;
 
-   for (i=0;i<MAXSCANLINES;i++)
+   for (i=0;i<iGLOBAL_SCREENHEIGHT;i++)
       {
       ylookup[i]=offset;
       offset += linewidth;
       }
 
-    screensize=MAXSCREENHEIGHT*MAXSCREENWIDTH;
+//    screensize=MAXSCREENHEIGHT*MAXSCREENWIDTH;
+    screensize=iGLOBAL_SCREENHEIGHT*iGLOBAL_SCREENWIDTH;
 
+
+
     page1start=sdl_surface->pixels;
     page2start=sdl_surface->pixels;
     page3start=sdl_surface->pixels;
     displayofs = page1start;
     bufferofs = page2start;
+
+	iG_X_center = iGLOBAL_SCREENWIDTH / 2;
+	iG_Y_center = (iGLOBAL_SCREENHEIGHT / 2)+10 ;//+10 = move aim down a bit
+
+	iG_buf_center = bufferofs + (screensize/2);//(iG_Y_center*iGLOBAL_SCREENWIDTH);//+iG_X_center;
+
+	bufofsTopLimit =  bufferofs + screensize - iGLOBAL_SCREENWIDTH;
+	bufofsBottomLimit = bufferofs + iGLOBAL_SCREENWIDTH;
+
     XFlipPage ();
 }
 
@@ -637,7 +664,7 @@
   VGAMAPMASK(15);
   memset((byte *)(0xa000<<4),color,0x10000);
 #else
-  memset (sdl_surface->pixels, color, MAXSCREENWIDTH*MAXSCREENHEIGHT);
+  memset (sdl_surface->pixels, color, iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT);
 #endif
 }
 
@@ -657,10 +684,17 @@
 /* C version of rt_vh_a.asm */
 
 void VH_UpdateScreen (void)
-{
+{ 	
+
+	if ((StrechScreen==true)&&(iGLOBAL_SCREENWIDTH > 320)){//bna++
+		StrechMemPicture ();
+	}else{
+		DrawCenterAim ();
+	}
 	SDL_UpdateRect (SDL_GetVideoSurface (), 0, 0, 0, 0);
 }
 
+
 /*
 =================
 =
@@ -685,8 +719,213 @@
    if (bufferofs > page3start)
       bufferofs = page1start;
 #else
+ 	if ((StrechScreen==true)&&(iGLOBAL_SCREENWIDTH > 320)){//bna++
+		StrechMemPicture ();
+	}else{
+		DrawCenterAim ();
+	}
    SDL_UpdateRect (sdl_surface, 0, 0, 0, 0);
+ 
 #endif
 }
 
 #endif
+
+
+
+
+
+
+// bna section -------------------------------------------
+void StrechMemPicture ()
+{
+
+		//strech mem //	   SetTextMode (  );
+   		byte *source,*target,*tmp,*tmp2;
+		int x,y,x1,y1;
+		int cnt,NbOfLines;
+		float Yratio,Xratio,old;
+
+		//strech pixels in X direction
+		source = ( byte * )( sdl_surface->pixels);//store screen in tmp pic mem
+		sdl_surfacePTR = source;
+		memcpy( tmpPICbuf, source, (200*iGLOBAL_SCREENWIDTH) );
+
+		source = tmpPICbuf;
+		target = ( byte * )( sdl_surface->pixels);//screen buffer
+
+	    Xratio = iGLOBAL_SCREENWIDTH * 10/ 320;
+		Xratio = (Xratio/10);
+		cnt = (int)Xratio; 
+		Xratio = (Xratio - cnt)/2; 
+		old = 0;
+
+		for (y=0;y<200;y++){
+			tmp = source;
+			tmp2 = target;
+			//write pixel x and x-1 in line 1
+			for (x=0;x<320;x++){
+				for (x1=0;x1<cnt;x1++){
+					//copy one pixel ----------------------
+					*(target++) = *(source) ;
+					old += Xratio;
+					//-----------------------------------
+					if (old > 1) {
+						//copy extra pixel
+						*(target++) = *(source) ;				
+						old -= 1;
+					}
+				}
+				source++;
+			}
+			source = tmp + iGLOBAL_SCREENWIDTH;
+			target = tmp2 + iGLOBAL_SCREENWIDTH;
+		}
+
+		//strech lines in Y direction
+		source = ( byte * )( sdl_surface->pixels);//store screen in tmp pic mem
+		memcpy( tmpPICbuf, source, (200*iGLOBAL_SCREENWIDTH) );
+
+		source = tmpPICbuf;
+		target = ( byte * )( sdl_surface->pixels);//screen buffer
+
+		Yratio = iGLOBAL_SCREENHEIGHT * 10/ 200;//we shall strech 200 lines to 480/600
+		Yratio = (Yratio/10);
+		cnt = (int)Yratio; //2
+		Yratio = (Yratio - cnt)/2; //.2
+		NbOfLines=0;//make sure we dont exeed iGLOBAL_SCREENHEIGHT or we get a crash
+		old = 0;
+
+		for (y=0;y<200;y++){
+			for (y1=0;y1<cnt;y1++){
+				//copy one line ----------------------
+				memcpy(target, source,iGLOBAL_SCREENWIDTH);
+				if (NbOfLines++ >= iGLOBAL_SCREENHEIGHT-1){goto stopx;}
+				target += (iGLOBAL_SCREENWIDTH);
+				old += Yratio;
+				//-----------------------------------
+				if (old > 1) {
+					//copy extra line
+					memcpy(target, source,iGLOBAL_SCREENWIDTH);				
+					if (NbOfLines++ >= iGLOBAL_SCREENHEIGHT-1){goto stopx;}
+					target += (iGLOBAL_SCREENWIDTH);
+					old -= 1;
+				}
+			}
+			source += iGLOBAL_SCREENWIDTH;
+		}
+stopx:;
+
+
+
+
+}
+
+
+void SchrinkMemPicture( byte * source)
+{ 
+	//schrink mem picure and plce it in tmpPICbuf
+   	byte *target,*tmp,*tmp2;
+	int x,y;
+	int cnt,NbOfLines;
+	float Yratio,Xratio,old;
+
+	target = tmpPICbuf;
+
+    Xratio = iGLOBAL_SCREENWIDTH * 10/ 320;
+	Xratio = (Xratio/10);
+	cnt = (int)Xratio; //2
+	Xratio = (Xratio - cnt)/2; //.2
+	old = 0;	
+
+	// delte redunted pixels
+	for (y=0;y<iGLOBAL_SCREENHEIGHT;y++){
+		tmp = source;
+		tmp2 = target;
+		for (x=0;x<iGLOBAL_SCREENWIDTH;x++){
+			//copy 1 pixel
+			*(target++) = *(source) ;
+			source += cnt;
+			old += Xratio;
+			if (old >= 1) {
+				source++;
+				old -= 1;
+			}
+		}
+		source = tmp + iGLOBAL_SCREENWIDTH;
+		target = tmp2 + iGLOBAL_SCREENWIDTH;
+	}
+	//delete every redunted lines
+	source = tmpPICbuf;//+(1* iGLOBAL_SCREENWIDTH);
+	target = tmpPICbuf;
+
+	Yratio = iGLOBAL_SCREENHEIGHT * 10 / 200;//we shall schrink 480/600 lines to 200  
+	Yratio = (Yratio/10);
+	cnt = (int)Yratio; //2
+	Yratio = (Yratio - cnt); //.2
+	NbOfLines=0;//make sure we dont exeed iGLOBAL_SCREENHEIGHT or we get a crash
+	old = 0;
+//SetTextMode (  );
+	for (y=0;y<200;y++){
+		//if (source > (tmpPICbuf+(iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT))){goto stopy;}
+		memcpy(target, source, iGLOBAL_SCREENWIDTH);	
+		source += (cnt * iGLOBAL_SCREENWIDTH);
+		old += Yratio;
+		if (old > 1) {
+			//delte extra line
+			source += iGLOBAL_SCREENWIDTH;
+			old -= 1;
+		}
+		target += iGLOBAL_SCREENWIDTH;
+	}
+
+//stopy:;	
+}
+
+// bna function added start
+extern	boolean ingame;
+int		iG_playerTilt;
+
+void DrawCenterAim ()
+{
+	int x;
+	if (iG_aimCross > 0){
+		if (( ingame == true )&&(iGLOBAL_SCREENWIDTH>320)){
+			  if ((iG_playerTilt <0 )||(iG_playerTilt >iGLOBAL_SCREENHEIGHT/2)){
+					iG_playerTilt = -(2048 - iG_playerTilt);
+			  }
+			  if (iGLOBAL_SCREENWIDTH == 640){ x = iG_playerTilt;iG_playerTilt=x/2; }
+			  iG_buf_center = bufferofs + ((iG_Y_center-iG_playerTilt)*iGLOBAL_SCREENWIDTH);//+iG_X_center;
+
+			  for (x=iG_X_center-10;x<=iG_X_center-4;x++){
+				  if ((iG_buf_center+x < bufofsTopLimit)&&(iG_buf_center+x > bufofsBottomLimit)){
+					 *(iG_buf_center+x) = 75;
+				  }
+			  }
+			  for (x=iG_X_center+4;x<=iG_X_center+10;x++){
+				  if ((iG_buf_center+x < bufofsTopLimit)&&(iG_buf_center+x > bufofsBottomLimit)){
+					 *(iG_buf_center+x) = 75;
+				  }
+			  }
+			  for (x=10;x>=4;x--){
+				  if (((iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) < bufofsTopLimit)&&((iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) > bufofsBottomLimit)){
+					 *(iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) = 75;
+				  }
+			  }
+			  for (x=4;x<=10;x++){
+				  if (((iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) < bufofsTopLimit)&&((iG_buf_center-(x*iGLOBAL_SCREENWIDTH)+iG_X_center) > bufofsBottomLimit)){
+					 *(iG_buf_center+(x*iGLOBAL_SCREENWIDTH)+iG_X_center) = 75;
+				  }
+			  }
+		}
+	}
+}
+// bna function added end
+
+
+
+
+// bna section -------------------------------------------
+
+
+

Modified: trunk/rott/modexlib.h
===================================================================
--- trunk/rott/modexlib.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/modexlib.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -26,14 +26,19 @@
 #ifndef _modexlib_public
 #define _modexlib_public
 
+#include "WinRott.h"
 #include "rt_def.h"
+/*
+int iGLOBAL_SCREENWIDTH;//bna val 800
+int iGLOBAL_SCREENHEIGHT;//bna val 600
 
-#define MAXSCREENHEIGHT         200
-#define MAXSCREENWIDTH          320
-#define SCREENBWIDE             96
-#define MAXVIEWWIDTH            320
-#define SCREENWIDTH             96              // default screen width in bytes
 
+#define MAXSCREENHEIGHT    600//     200*2
+#define MAXSCREENWIDTH     800//     320*2
+#define SCREENBWIDE        800*(96/320)//     96*2
+#define MAXVIEWWIDTH       800//     320*2
+#define SCREENWIDTH        800*(96/320)//     96*2              // default screen width in bytes
+*/
 //***************************************************************************
 //
 //    Video (ModeX) Constants
@@ -103,7 +108,10 @@
 #define PEL_DATA                0x3c9
 #endif
 
-extern  int      ylookup[MAXSCREENHEIGHT];      // Table of row offsets
+extern  boolean StrechScreen;//bná++
+
+//extern  int      ylookup[MAXSCREENHEIGHT];      // Table of row offsets
+extern  int      ylookup[600];      // just set to max res
 extern  int      linewidth;
 extern  byte    *page1start;
 extern  byte    *page2start;

Modified: trunk/rott/rt_actor.c
===================================================================
--- trunk/rott/rt_actor.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_actor.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -1066,7 +1066,9 @@
 //  for(i=0;i<tics;i++)
 //	{
 
-
+#if (BNACRASHPREVENT == 1)//
+		if (ob->state == 0){return;}
+#endif
     ApplyGravity(ob);
 	 M_CheckDoor(ob);
 	 M_CheckBossSounds(ob);
@@ -1185,10 +1187,17 @@
        )
       )
       ob->state = &s_altexplosion1;
-   else
+   else{
+#if (BNACRASHPREVENT == 1)//crashed here when oscuro and larves were all killed
+		if (ob == 0){return;}
+#endif
       ob->state = newstate;
+   }
+   SetVisiblePosition(ob,ob->x,ob->y);
+#if (BNACRASHPREVENT == 1)
+		if (ob->state == 0){return;}
+#endif
 
-   SetVisiblePosition(ob,ob->x,ob->y);
 	ob->ticcount = (ob->state->tictime>>1);
 	ob->shapenum = ob->state->shapenum + ob->shapeoffset;
 
@@ -10907,6 +10916,11 @@
    doorobj_t*tdoor;
 
    ob = (objtype*)object;
+
+#if (BNACRASHPREVENT == 1)//
+		if (ob == 0){return;}
+#endif
+
    ob->flags |= FL_ACTIVE;
    if (ob->obclass == bladeobj)
       {

Modified: trunk/rott/rt_build.c
===================================================================
--- trunk/rott/rt_build.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_build.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -575,7 +575,8 @@
 
    for (i=0;i<=time;i+=tics)
       {
-      PositionMenuBuf (0,NORMALVIEW,false);
+      //PositionMenuBuf (0,NORMALVIEW,false);
+      PositionMenuBuf (0,NORMALVIEW,true);//bna++ in not true bg in menu is no redrawn
       }
 }
 

Modified: trunk/rott/rt_cfg.c
===================================================================
--- trunk/rott/rt_cfg.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_cfg.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -90,6 +90,8 @@
 //
 //******************************************************************************
 
+extern int G_weaponscale;
+
 boolean WriteSoundFile   = true;
 
 int     FXMode           = 0;
@@ -104,6 +106,10 @@
    };
 
 boolean mouseenabled     = 1;
+boolean usemouselook     = 0;
+int     inverse_mouse    = 1; //set  to -1 to invert mouse
+boolean usejump          = 0;
+
 boolean joystickenabled  = 0;
 boolean joypadenabled    = 0;
 int     joystickport     = 0;
@@ -491,15 +497,20 @@
    if (version == ROTTVERSION)
    {
       // Read in MouseEnabled
-
       ReadBoolean("MouseEnabled",&mouseenabled);
 
+      // Read in UseMouseLook
+      ReadBoolean("UseMouseLook",&usemouselook);
+
+      ReadInt("InverseMouse",&inverse_mouse);
+
+	  // Read in UseJump
+      ReadBoolean("UseJump",&usejump);
+
       // Read in JoystickEnabled
-
       ReadBoolean("JoystickEnabled",&joystickenabled);
 
       // Read in JoypadEnabled
-
       ReadBoolean("JoypadEnabled",&joypadenabled);
 
       // Read in JoystickPort
@@ -510,6 +521,19 @@
 
       ReadInt("ViewSize",&viewsize);
 
+      // Read in Weaponscale
+
+      ReadInt("Weaponscale",&G_weaponscale);//bna added
+	   if ((G_weaponscale <150)||(G_weaponscale>600)){
+		   if (iGLOBAL_SCREENWIDTH == 320){
+				G_weaponscale=168;
+		   }else if (iGLOBAL_SCREENWIDTH == 640){
+				G_weaponscale=299;		
+		   }else if (iGLOBAL_SCREENWIDTH == 800) {
+				G_weaponscale=376;
+		   }	   
+	   }
+
       // Read in MouseAdjustment
 
       ReadInt("MouseAdjustment",&mouseadjustment);
@@ -1683,6 +1707,24 @@
    SafeWriteString(file,"; 0 - Mouse Disabled\n");
    WriteParameter(file,"MouseEnabled     ",mouseenabled);
 
+   // Write out UseMouseLook
+   SafeWriteString(file,"\n;\n");
+   SafeWriteString(file,"; 1 - UseMouseLook Enabled\n");
+   SafeWriteString(file,"; 0 - UseMouseLook Disabled\n");
+   WriteParameter(file,"UseMouseLook     ",usemouselook);
+
+   // Write out InverseMouse
+   SafeWriteString(file,"\n;\n");
+   SafeWriteString(file,"; 1 - Normal Mouse Enabled\n");
+   SafeWriteString(file,"; -1 - Inverse Mouse Enabled\n");
+   WriteParameter(file,"InverseMouse     ",inverse_mouse);
+
+   // Write out UseJump
+   SafeWriteString(file,"\n;\n");
+   SafeWriteString(file,"; 1 - usejump Enabled\n");
+   SafeWriteString(file,"; 0 - usejump Disabled\n");
+   WriteParameter(file,"UseJump          ",usejump);
+
    // Write out JoystickEnabled
 
    SafeWriteString(file,"\n;\n");
@@ -1711,6 +1753,25 @@
    SafeWriteString(file,"; (smallest) 0 - 10 (largest)\n");
    WriteParameter(file,"ViewSize         ",viewsize);
 
+   // Write out WEAPONSCALE  bna added
+
+   SafeWriteString(file,"\n;\n");
+   SafeWriteString(file,"; Size of Weaponscale.\n");
+   SafeWriteString(file,"; (smallest) 150 - 600 (largest)\n");
+   G_weaponscale = (weaponscale * 168 )/65536;
+
+   if ((G_weaponscale <150)||(G_weaponscale>600)){
+	   if (iGLOBAL_SCREENWIDTH == 320){
+			G_weaponscale=168;
+	   }else if (iGLOBAL_SCREENWIDTH == 640){
+			G_weaponscale=299;		
+	   }else if (iGLOBAL_SCREENWIDTH == 800) {
+			G_weaponscale=376;
+	   }	   
+   }
+   WriteParameter(file,"Weaponscale         ",G_weaponscale);
+
+
    // Write out MouseAdjustment
 
    SafeWriteString(file,"\n;\n");

Modified: trunk/rott/rt_debug.c
===================================================================
--- trunk/rott/rt_debug.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_debug.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -44,8 +44,15 @@
 #include <ctype.h>
 //MED
 #include "memcheck.h"
+#include "w_wad.h"
 
+extern int		iDemoNames;
+extern int iG_aimCross;
 
+
+extern void DisplayMessage   (int num,int position);
+
+
 typedef struct {
    char code[15];
    byte length;
@@ -127,6 +134,8 @@
    WEAPONFIREWALLALT,         // give firewall
 	WEAPONGOD,                 // give godhand
 	WEAPONGODALT,              // give godhand
+	AIMCROSS,                 // bna++
+	AIMCROSSALT,              // give bna++
 
 #if (SHAREWARE == 0)
 
@@ -156,7 +165,7 @@
    MAXCODES
 };
 
-CodeStruct Codes[MAXCODES + 4] =
+CodeStruct Codes[MAXCODES + 6] =
 {
 	{"KCITSPID",    8},        // enable cheats
 	{"CCE\\",       4},        // enable cheats
@@ -214,11 +223,11 @@
 	{"PFO\\",       4},        // all keys, armor, 100% health, MP40, heatseek
 	{"EM68",        4},        // kill player
 	{"EID\\",       4},        // kill player
-	{"NEER",        4},        // re-enter level
+	{"REEN",        4},        // re-enter level
 	{"LER\\",       4},        // re-enter level
    {"OOWNHOJ",     7},        // give double pistol
 	{"2WG\\",       4},        // give double pistol
-	{"MEGULP",      6},        // give mp40
+	{"EMGULP",      6},        // give mp40
 	{"3WG\\",       4},        // give mp40
 	{"ALLINAV",     7},        // give bazooka
 	{"4WG\\",       4},        // give bazooka
@@ -232,7 +241,11 @@
 	{"8WG\\",       4},        // give firewall
 	{"AYEES",       5},        // give god hand
    {"9WG\\",       4},        // give god hand
+	{"MIA",       3},        // give aim bna++
+   {"MIA\\",       4},        // give aim bna++
 
+
+
 #if (SHAREWARE == 0)
 
    {"TILPS",       5},        // give split missile
@@ -370,7 +383,7 @@
 =
 ================
 */
-
+#include "byteordr.h"//bna++
 void DoWarp (void)
 {
 /*
@@ -410,6 +423,10 @@
 
    int level;
 
+
+	StrechScreen=true;//bna++ shut on streech mode
+
+
    MU_StoreSongPosition();
    MU_StartSong( song_secretmenu);
    StopWind();
@@ -423,6 +440,18 @@
    CleanUpControlPanel();
    ShutdownMenuBuf();
 
+   	//bna++ section
+  if (( playstate == ex_stillplaying )&&(iGLOBAL_SCREENWIDTH > 320)){
+		pic_t *shape;
+		shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
+		DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );
+		StrechScreen=false;//dont strech when we go BACK TO GAME
+		DrawPlayScreen(true);//repaint ammo and life stat
+		VW_UpdateScreen ();//update screen
+  }
+   //bna section end
+
+	StrechScreen=true;//bna++ shut on streech mode
    while( Keyboard[ sc_Escape ] )
       {
 		IN_UpdateKeyboard();
@@ -446,6 +475,7 @@
       }
    else
       {
+	   StrechScreen=false;//dont strech when we go BACK TO GAME
       SetupScreen(true);
       }
 
@@ -460,12 +490,12 @@
 ================
 */
 
-void DoJukeBox
-   (
-   void
-   )
+void DoJukeBox  (void)
 
    {
+	if (iGLOBAL_SCREENWIDTH > 320) {
+		StrechScreen=true;//bna++ shut on streech mode
+	}
    StopWind();
    ShutdownClientControls();
 
@@ -477,6 +507,17 @@
    CleanUpControlPanel();
    ShutdownMenuBuf();
 
+   	//bna++ section
+  if (( playstate == ex_stillplaying )&&(iGLOBAL_SCREENWIDTH > 320)){
+		pic_t *shape;
+		shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
+		DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );
+		StrechScreen=false;//dont strech when we go BACK TO GAME
+		DrawPlayScreen(true);//repaint ammo and life stat
+		VW_UpdateScreen ();//update screen
+  }
+   //bna section end
+
    SetupScreen(true);
 
    while( Keyboard[ sc_Escape ] )
@@ -666,6 +707,7 @@
 
 void RestartNormal (void)
 {
+	StrechScreen=true;//bna
 	DoNormalThing ();
 
    AddMessage ("Restart to level 1", MSG_CHEAT);
@@ -995,6 +1037,7 @@
 	IN_ClearKeyboardQueue ();
 
    StartupClientControls();
+   StrechScreen = false;
 }
 
 
@@ -1039,8 +1082,9 @@
       if ((level > 0) && (level < 9))
 #endif
          {
-         gamestate.mapon = level-1;
-         playstate = ex_demorecord;
+			StrechScreen=true;//bna
+			 gamestate.mapon = level-1;
+			 playstate = ex_demorecord;
          }
       }
 
@@ -1095,6 +1139,8 @@
    IN_ClearKeyboardQueue ();
 
    StartupClientControls();
+
+   StrechScreen = true;
 }
 
 /*
@@ -1443,6 +1489,19 @@
             FloorandCeiling (true);
          break;
 
+
+         case AIMCROSS:
+         case AIMCROSSALT:
+            if (iG_aimCross == 0) {
+			    iG_aimCross = 1;
+				AddMessage("Crosshair on",MSG_GAME);
+			}else{
+				iG_aimCross = 0;
+				AddMessage("Crosshair off",MSG_GAME);
+			}
+         break;
+
+
          case BULLETARMOR:
          case BULLETARMORALT:
             GiveBulletProofArmor ();

Modified: trunk/rott/rt_def.h
===================================================================
--- trunk/rott/rt_def.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_def.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -154,13 +154,17 @@
 //
 //***************************************************************************
 #define VIEWGLOBAL              0x10000         // globals visable flush to wall
-#define VIEWWIDTH               320             // size of view window
-#define VIEWHEIGHT              200
-#define MAXSCANLINES            200             // size of ylookup table
+/*
+#define VIEWWIDTH               MAXSCREENWIDTH//320*2             // size of view window
+#define VIEWHEIGHT              MAXSCREENHEIGHT//200*2
+#define MAXSCANLINES            MAXSCREENHEIGHT//200*2             // size of ylookup table
+*/
 #define CHARWIDTH               2
 #define TILEWIDTH               4
 #define STATUSLINES             16
 
+
+
 //***************************************************************************
 //
 //    Engine Constants

Modified: trunk/rott/rt_door.c
===================================================================
--- trunk/rott/rt_door.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_door.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -745,8 +745,13 @@
             break;
             }
          }
+#if (BNACRASHPREVENT == 1)
+	  //SetTextMode (  ); qwert
+	  //	CRASH IN SHAREWARE 'ride em cowboy' BNA FIX
+      // DONT ALLOW BAD touchplate ( == 0 ) see rt_playr.c
+	  if (touchplate[i] == 0) {continue;}
+#endif
 
-
       if (!TRIGGER[i])
          continue;
 

Modified: trunk/rott/rt_draw.c
===================================================================
--- trunk/rott/rt_draw.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_draw.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -66,6 +66,12 @@
 //MED
 #include "memcheck.h"
 
+
+extern void VH_UpdateScreen (void);
+
+
+
+//int testval;
 /*
 =============================================================================
 
@@ -74,6 +80,10 @@
 =============================================================================
 */
 
+extern char *tmpPICbuf;
+extern char *sdl_surfacePTR;
+int iG_masked;
+
 int whereami=-1;
 
 byte * shadingtable;
@@ -154,6 +164,8 @@
 static int      netlump;
 static int      gmasklump;
 
+int      G_gmasklump;
+
 static const int weaponshape[NUMWEAPGRAPHICS] =
      {
 #if (SHAREWARE == 0)
@@ -274,6 +286,7 @@
    netlump=W_GetNumForName("net1");
 #endif
    gmasklump=W_GetNumForName("p_gmask");
+   G_gmasklump = gmasklump;
 
    preindex=0;
    pretics[0]=0x10000;
@@ -2928,29 +2941,30 @@
    OUTP (CRTC_INDEX, CRTC_STARTLOW);
    OUTP (CRTC_DATA, (displayofs&0x000000FF));
 //   _enable();
+   SHAKETICS = 0xFFFF;
    }
 
 //******************************************************************************
 //
 // DrawScaledScreen
-//
+// draw sreen after reentering fro restore game
 //******************************************************************************
 
 void DrawScaledScreen(int x, int y, int step, byte * src)
 {
     int     xfrac;
     int     yfrac;
-    int     plane;
+//    int     plane;
     int     i,j;
     byte    * p;
     byte    * buf;
     int     xsize;
     int     ysize;
 
-    xsize=(320<<16)/step;
-    if (xsize>320) xsize=320;
-    ysize=(200<<16)/step;
-    if (ysize>200) ysize=200;
+    xsize=(iGLOBAL_SCREENWIDTH<<16)/step;
+    if (xsize>iGLOBAL_SCREENWIDTH) xsize=iGLOBAL_SCREENWIDTH;
+    ysize=(iGLOBAL_SCREENHEIGHT<<16)/step;
+    if (ysize>iGLOBAL_SCREENHEIGHT) ysize=iGLOBAL_SCREENHEIGHT;
 
 #ifdef DOS
     for (plane=x;plane<x+4;plane++)
@@ -2962,7 +2976,7 @@
 #endif
        for (j=y;j<y+ysize;j++)
           {
-          p=src+(320*(yfrac>>16));
+          p=src+(iGLOBAL_SCREENWIDTH*(yfrac>>16));
 #ifdef DOS
           buf=(byte *)bufferofs+ylookup[j]+(plane>>2);
 #else
@@ -3010,7 +3024,12 @@
    int time;
    int i;
    byte * destscreen;
+   pic_t *shape;//bna++
+   
+   
 
+   
+   
    fizzlein=false;
    x=(18+SaveGamePicX)<<16;
    y=(30+SaveGamePicY)<<16;
@@ -3020,10 +3039,11 @@
    dy=(-y)/time;
    ds=-((s-0x1000000)/time);
 
-   destscreen=SafeMalloc(64000);
+   destscreen=SafeMalloc(64000*8);//bna fixme
 
    SetupScreen(false);
    ThreeDRefresh();
+
    FlipPage();
    FlipPage();
 
@@ -3042,12 +3062,20 @@
       if (y<0) y=0;
       s+=(ds*tics);
       }
+
    DrawScaledScreen(0,0,0x10000,destscreen);
    FlipPage();
    VL_CopyDisplayToHidden ();
    SafeFree(destscreen);
    CalcTics();
    CalcTics();
+   	//bna++ section
+   shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
+   DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );//bna++
+   DrawPlayScreen(false);
+   StrechScreen = false;
+   SHAKETICS = 0xFFFF;
+   //bna section end
 }
 
 //******************************************************************************
@@ -3059,33 +3087,93 @@
 boolean RotateBufferStarted = false;
 void StartupRotateBuffer ( int masked)
 {
-   int i,a,b;
+	int k;////zxcv
+   int a,b;
 
+//   int Xres = 320;//org
+//   int Yres = 200;//org
+   int   Xres =   iGLOBAL_SCREENWIDTH;//bna val 800
+   int   Yres = iGLOBAL_SCREENHEIGHT;//bna val 600
+
+
+   iG_masked = masked;
+
    if (RotateBufferStarted == true)
       return;
 
    RotateBufferStarted = true;
 
-   RotatedImage=SafeMalloc(131072);
-   if (masked==0)
-      memset(RotatedImage,0,131072);
-   else
-      memset(RotatedImage,0xff,131072);
-#ifdef DOS
-   for (i=0;i<4;i++)
-#endif
-      {
-      VGAREADMAP(i);
-      for (a=0;a<200;a++)
-#ifdef DOS
-         for (b=0;b<80;b++)
-            *(RotatedImage+99+i+((a+28)<<9)+(b<<2))=*((byte *)bufferofs+(a*linewidth)+b);
-#else
-         for (b=0;b<320;b++)
-            *(RotatedImage+99+((a+28)<<9)+b)=*((byte *)bufferofs+(a*linewidth)+b);
-#endif
-      }
+   //   RotatedImage=SafeMalloc(131072);org
+   //RotatedImage=SafeMalloc(131072*8);
+   if (iGLOBAL_SCREENWIDTH == 320) {
+		RotatedImage=SafeMalloc(131072);
+   }else if (iGLOBAL_SCREENWIDTH == 640) { 
+		RotatedImage=SafeMalloc(131072*4);
+   }else if (iGLOBAL_SCREENWIDTH == 800) { 
+		RotatedImage=SafeMalloc(131072*8);
+   }
+//SetupScreen(false);//used these 2 to test screen size
+//VW_UpdateScreen ();
+   if (masked==0) {
+	   if (iGLOBAL_SCREENWIDTH == 320) {
+		  memset(RotatedImage,0,131072);
+	   }else if (iGLOBAL_SCREENWIDTH == 640) { 
+		  memset(RotatedImage,0,131072*4);
+	   }else if (iGLOBAL_SCREENWIDTH == 800) { 
+		  //memset(RotatedImage,0,131072);//org
+		  memset(RotatedImage,0,131072*8);
+	   }
+   } else {
+	   if (iGLOBAL_SCREENWIDTH == 320) {
+		  memset(RotatedImage,0xff,131072);
+	   }else if (iGLOBAL_SCREENWIDTH == 640) { 
+		  memset(RotatedImage,0xff,131072*4);
+	   }else if (iGLOBAL_SCREENWIDTH == 800) { 
+		  memset(RotatedImage,0xff,131072*8);
+	   }
+   }
+      //memset(RotatedImage,0xff,131072);//org
+      //memset(RotatedImage,0xff,131072*8);
+
+      if ((masked == false)&&(iGLOBAL_SCREENWIDTH == 800)) {
+		StrechScreen = false;
+		// SetTextMode (  );
+
+		k=(28*512);//14336;
+		//k=((0+28)<<10);//28672
+		   for (a=0;a<iGLOBAL_SCREENHEIGHT;a++){
+			   for (b=0;b<iGLOBAL_SCREENWIDTH;b++){
+					//*(RotatedImage+99+((a+28)<<9)+b)   =   *((byte *)bufferofs+(a*linewidth)+b);
+					// 99 is some offset value
+					k = ((a+28)<<10);
+					*(RotatedImage+(k)+b)   =   *((byte *)bufferofs+(a*linewidth)+b);
+					//*(RotatedImage+b)   =   *((byte *)bufferofs+(a*linewidth)+b);
+			   }
+			   //k+=512*2;
+		   }
+	  }else if ((masked == false)&&(iGLOBAL_SCREENWIDTH == 640)) {
+		StrechScreen = false;
+		k=(28*512);//14336;
+		   for (a=0;a<iGLOBAL_SCREENHEIGHT;a++){
+			   for (b=0;b<iGLOBAL_SCREENWIDTH;b++){
+					k = ((a+28)<<10);
+					*(RotatedImage+(k)+b)   =   *((byte *)bufferofs+(a*linewidth)+b);
+			   }
+		   }
+
+	  }else if ((masked == true)||(iGLOBAL_SCREENWIDTH == 320)) {
+		  for (a=0;a<200;a++){
+			 for (b=0;b<320;b++)
+				*(RotatedImage+99+((a+28)<<9)+b)=*((byte *)bufferofs+(a*linewidth)+b);
+		  }
+	  }
+
 }
+/* copier liner af 1024 bredde
+a=0=14436 a=1=14848 a=2=15360 a=3=15872  -> 512 i difference
+*(RotatedImage+(512)+0) = bufferofs+(0*800)+0);
+*(RotatedImage+(512)+100) = bufferofs+(100*800)+0);
+*/
 
 //******************************************************************************
 //
@@ -3116,31 +3204,60 @@
    int scale;
    int i;
 
+
+//bna section
+//   int Xh = 160;//org
+//   int Yh = 100;//org
+
+   int Xh = iGLOBAL_SCREENWIDTH/2;
+   int Yh = iGLOBAL_SCREENHEIGHT/2;
+ //  Xh = 259;
+ //  Yh = 109;
+
+   time = time;
+////zxcv
+	StrechScreen=false;//bna++
+
+
    anglestep=((endangle-startangle)<<16)/time;
    scalestep=((endscale-startscale)<<6)/time;
 
    angle=(startangle<<16);
+     
    scale=(startscale<<6);
 
    CalcTics();
    CalcTics();
    for (i=0;i<time;i+=tics)
-      {
-      DrawRotatedScreen(160,100, (byte *)bufferofs,(angle>>16)&(FINEANGLES-1),scale>>6,0);
+      {//zxcv
+      DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,(angle>>16)&(FINEANGLES-1),scale>>6,0);
       FlipPage();
       scale+=(scalestep*tics);
       angle+=(anglestep*tics);
       CalcTics();
       }
-   DrawRotatedScreen(160,100, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
+
+   DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
    FlipPage();
-   DrawRotatedScreen(160,100, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
+   DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
    FlipPage();
-   DrawRotatedScreen(160,100, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
+   DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
    CalcTics();
    CalcTics();
+   //I_Delay (240);//bna++
+   	//bna++ section
+  if ( playstate == ex_stillplaying )	  {//bna++
+	   pic_t *shape;
+	   shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
+	   DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );//bna++
+	   StrechScreen=false;//dont strech when we go BACK TO GAME
+	   DrawPlayScreen(true);//repaint ammo and life stat
+  }
 }
+   //bna section end
 
+
+
 //******************************************************************************
 //
 // RotateBuffer
@@ -3173,60 +3290,70 @@
 //******************************************************************************
 
 void DrawRotatedScreen(int cx, int cy, byte *destscreen, int angle, int scale, int masked)
-{
+{//ZXCV
    int     c, s;
    int     xst, xct;
    int     y;
-   int     plane;
+
    byte    * screen;
+   //int Xres = 320;//old value
+   //int Yres = 200;//old val
 
+   int Xr = iGLOBAL_SCREENWIDTH;//640;
+   int Yr = (iGLOBAL_SCREENHEIGHT);//400; //bna aaaa fix
+
+//	   SetTextMode (  );
    c = FixedMulShift(scale,costable[angle],11);
    s = FixedMulShift(scale,sintable[angle],11);
-   xst = (((-cx)*s)+(128<<16))-(cy*c);
-   xct = (((-cx)*c)+(256<<16)+(1<<18)-(1<<16))+(cy*s);
-#ifdef DOS
-   mr_xstep=s<<2;
-   mr_ystep=c<<2;
-#else
+
+//   c = c/2; //these values are to rotate degres or?
+//   s = s/2;
+//   xst & xct= start center values ;
+   if ((iGLOBAL_SCREENWIDTH == 320 )||(masked == true)) {
+	   xst = (((-cx)*s)+(128<<16))-(cy*c);
+	   xct = (((-cx)*c)+(256<<16)+(1<<18)-(1<<16))+(cy*s);
+   }
+   else if ((iGLOBAL_SCREENWIDTH == 640 )&&(masked == false)) {
+	   xst = (((-cx)*s)+((268)<<16))-(cy*c);
+	   xct = (((-cx)*c)+((317)<<16)+(1<<18)-(1<<16))+(cy*s);
+   }//y=268;x=317
+   else if ((iGLOBAL_SCREENWIDTH == 800 )&&(masked == false)) {
+	   xst = (((-cx)*s)+((328)<<16))-(cy*c);
+	   xct = (((-cx)*c)+((397)<<16)+(1<<18)-(1<<16))+(cy*s);
+   }//328 397
+
    mr_xstep=s;
    mr_ystep=c;
-#endif
-   screen=destscreen;
 
+  
+   if ((iGLOBAL_SCREENWIDTH == 800)&&(masked==0)) {
+        screen=destscreen+iGLOBAL_SCREENWIDTH;//bna aaaa fix
+   }else{
+		screen=destscreen;
+   }
+
    if (masked==0)
       {
-#ifdef DOS
-      for (plane=0;plane<4;plane++,xst+=s,xct+=c)
-#endif
-         {
+		 // paint hole 800x600 screen
+		 { 
          mr_yfrac=xct;
          mr_xfrac=xst;
          VGAWRITEMAP(plane);
-         for (y=0; y<200; y++,mr_xfrac+=c,mr_yfrac-=s)
-#ifdef DOS
-            DrawRotRow(((320-plane)>>2)+1,screen+ylookup[y]+(plane>>2),RotatedImage);
-#else
-            DrawRotRow(320,screen+ylookup[y],RotatedImage);
-#endif
+         for (y=0; y<Yr; y++,mr_xfrac+=c,mr_yfrac-=s)
+            DrawRotRow(Xr,screen+ylookup[y],RotatedImage);
          }
       }
    else
       {
-#ifdef DOS
-      for (plane=0;plane<4;plane++,xst+=s,xct+=c)
-#endif
          {
          mr_yfrac=xct;
          mr_xfrac=xst;
          VGAWRITEMAP(plane);
-         for (y=0; y<200; y++,mr_xfrac+=c,mr_yfrac-=s)
-#ifdef DOS
-            DrawMaskedRotRow(((320-plane)>>2)+1,screen+ylookup[y]+(plane>>2),RotatedImage);
-#else
-            DrawMaskedRotRow(320,screen+ylookup[y],RotatedImage);
-#endif
+         for (y=0; y<Yr; y++,mr_xfrac+=c,mr_yfrac-=s)
+            DrawMaskedRotRow(Xr,screen+ylookup[y],RotatedImage);
          }
       }
+
 }
 
 
@@ -3346,8 +3473,14 @@
          goto apogeeexit;
       }
 
+ //  I_Delay(65); //bna added
 apogeeexit:
+
+   VL_ClearBuffer (bufferofs, 0); //bna added
+   MenuFadeOut(); //bna added
+   VH_UpdateScreen (); //bna added
    ShutdownRotateBuffer ();
+
 }
 
 #if (SHAREWARE==0)
@@ -3498,6 +3631,16 @@
    ScreenSaver=(screensaver_t *)SafeMalloc(sizeof(screensaver_t));
    ScreenSaver->phase=0;
    ScreenSaver->pausetime=PAUSETIME;
+   if (iGLOBAL_SCREENWIDTH == 320){
+		ScreenSaver->pausex=120;
+		ScreenSaver->pausey=84;
+   }else if (iGLOBAL_SCREENWIDTH == 640){
+		ScreenSaver->pausex=240;
+		ScreenSaver->pausey=201;
+   }else if (iGLOBAL_SCREENWIDTH == 800){
+		ScreenSaver->pausex=300;
+		ScreenSaver->pausey=252;
+   }
    ScreenSaver->pausex=120;
    ScreenSaver->pausey=84;
    SetupScreenSaverPhase();
@@ -3517,6 +3660,9 @@
 
    ShutdownRotateBuffer ();
    SafeFree(ScreenSaver);
+   	//bna section 
+   StartupClientControls();
+		   
 }
 
 //******************************************************************************
@@ -3529,6 +3675,7 @@
 #define MAXSPEED  8
 void UpdateScreenSaver ( void )
 {
+	//StrechScreen = true;
    if (ScreenSaver->time!=-1)
       {
       ScreenSaver->time-=tics;
@@ -3548,9 +3695,9 @@
       ScreenSaver->dx=abs(ScreenSaver->dx);
       ScreenSaver->dy+=(RandomNumber("Rotate",0)>>6)-2;
       }
-   else if (ScreenSaver->x>320-SPINSIZE)
+   else if (ScreenSaver->x>iGLOBAL_SCREENWIDTH-SPINSIZE)
       {
-      ScreenSaver->x=320-SPINSIZE;
+      ScreenSaver->x=iGLOBAL_SCREENWIDTH-SPINSIZE;
       ScreenSaver->dx=-(abs(ScreenSaver->dx));
       ScreenSaver->dy+=(RandomNumber("Rotate",0)>>6)-2;
       }
@@ -3560,9 +3707,9 @@
       ScreenSaver->dy=abs(ScreenSaver->dy);
       ScreenSaver->dx+=(RandomNumber("Rotate",0)>>6)-2;
       }
-   else if (ScreenSaver->y>200-SPINSIZE)
+   else if (ScreenSaver->y>iGLOBAL_SCREENHEIGHT-SPINSIZE)
       {
-      ScreenSaver->y=200-SPINSIZE;
+      ScreenSaver->y=iGLOBAL_SCREENHEIGHT-SPINSIZE;
       ScreenSaver->dy=-(abs(ScreenSaver->dy));
       ScreenSaver->dx+=(RandomNumber("Rotate",0)>>6)-2;
       }
@@ -3577,11 +3724,19 @@
 
    ScreenSaver->pausetime-=tics;
    if (ScreenSaver->pausetime<=0)
-      {
+   {
       ScreenSaver->pausetime=PAUSETIME;
-      ScreenSaver->pausex=RandomNumber ("pausex",0)%240;
-      ScreenSaver->pausey=RandomNumber ("pausey",0)%168;
-      }
+	  if (iGLOBAL_SCREENWIDTH == 320){
+		  ScreenSaver->pausex=RandomNumber ("pausex",0)%240;
+		  ScreenSaver->pausey=RandomNumber ("pausey",0)%168;
+      }else if (iGLOBAL_SCREENWIDTH == 640){
+		  ScreenSaver->pausex=RandomNumber ("pausex",0)%480;
+		  ScreenSaver->pausey=RandomNumber ("pausey",0)%403;
+	  }else if (iGLOBAL_SCREENWIDTH == 800){
+		  ScreenSaver->pausex=RandomNumber ("pausex",0)%600;
+		  ScreenSaver->pausey=RandomNumber ("pausey",0)%504;
+	  }
+   }
    DrawPauseXY (ScreenSaver->pausex, ScreenSaver->pausey);
 
    FlipPage();
@@ -3958,10 +4113,10 @@
 
 void DrawBackground ( byte * bkgnd )
 {
-   int plane;
+//   int plane;
    int size;
 
-   size=linewidth*200;
+   size=linewidth*400;
 
 #ifdef DOS
    for (plane=0;plane<4;plane++)
@@ -3982,10 +4137,10 @@
 
 void PrepareBackground ( byte * bkgnd )
 {
-   int plane;
+//   int plane;
    int size;
 
-   size=linewidth*200;
+   size=linewidth*400;
 
 #ifdef DOS
    for (plane=0;plane<4;plane++)
@@ -4212,11 +4367,11 @@
    int i;
 
    byte pal[768];
+	StrechScreen = true;
 
+   viewwidth = 320;//MAXSCREENWIDTH;
+   viewheight = 200;//MAXSCREENHEIGHT;
 
-   viewwidth = MAXSCREENWIDTH;
-   viewheight = MAXSCREENHEIGHT;
-
    MU_StartSong(song_youwin);
 
    bkgnd=SafeMalloc(800*linewidth);
@@ -5377,8 +5532,10 @@
 
 void DoEndCinematic ( void )
 {
-   viewwidth = MAXSCREENWIDTH;
-   viewheight = MAXSCREENHEIGHT;
+	StrechScreen = true;
+
+   viewwidth = 320;//MAXSCREENWIDTH;
+   viewheight = 200;//MAXSCREENHEIGHT;
    MU_FadeOut ( 1000 );
    MU_StopSong ();
 
@@ -5611,13 +5768,16 @@
    byte * bkgnd;
    font_t * oldfont;
    int i;
+	StrechScreen = true;
+   viewwidth = 320;//MAXSCREENWIDTH;
+   viewheight = 200;//MAXSCREENHEIGHT;
 
-   viewwidth = MAXSCREENWIDTH;
-   viewheight = MAXSCREENHEIGHT;
+   bkgnd=SafeMalloc(800*linewidth);
 
-   bkgnd=SafeMalloc(800*linewidth);
    trilogo=W_GetNumForName("trilogo");
    VL_DrawPostPic (trilogo);
+//  SetTextMode (  );
+
    PrepareBackground ( bkgnd );
 
    oldfont=CurrentFont;
@@ -5711,7 +5871,7 @@
 
    FlipPage();
    MenuFadeIn();
-   I_Delay (280);
+   I_Delay (100);//240
 
    VL_FadeOut (0, 255, 0, 0, 0, 20);
 }
@@ -5743,23 +5903,86 @@
 void DrawRotRow(int count, byte * dest, byte * src)
 {
 	unsigned eax, ecx, edx;
+//	unsigned a, b, c,d;
+	 byte * srctmp;
+	 byte * desttmp;
 
 	ecx = mr_yfrac;
 	edx = mr_xfrac;
 
-	while (count--) {
-		eax = edx >> 16;
-		if (eax < 256 && (ecx >> 16) < 512) {
-			eax = (eax << 9) | ((ecx << 7) >> (32-9));
+	if ((iGLOBAL_SCREENWIDTH == 320)||(iG_masked==true))  
+	{
+		while (count--) {
+			eax = edx >> 16;
+			if (eax < 256 && (ecx >> 16) < 512) {
+				eax = (eax << 9) | ((ecx << 7) >> (32-9));
+			} else {
+				eax = 0;
+			}
+			
+			*dest++ = src[eax];
+			
+			edx += mr_xstep;
+			ecx += mr_ystep;
+		}
+	}else if (iGLOBAL_SCREENWIDTH == 640) {
+		while (count--) {
+			eax = edx >> 16;
+			if (eax < (256*2.0) && (ecx >> 16) < (512*1.8)) {
+				eax = (eax << 10) | ((ecx << 6) >> (32-10));
+			} else {
+				eax = 0;
+			}
+			
+			*dest++ = src[eax];
+			
+			edx += mr_xstep;
+			ecx += mr_ystep;
+		}
+	}else if (iGLOBAL_SCREENWIDTH == 800) {
+
+
+
+	srctmp = src;
+	desttmp = dest;
+
+	desttmp -= (iGLOBAL_SCREENWIDTH*1);
+
+	ecx = mr_yfrac;
+	edx = mr_xfrac;
+	//count = 800
+//zxcv
+	while (count--) { 
+		eax = edx >> 16;//edx=4146069504 eax=63264  edx/eax = 65536->0x10000
+		 
+		//a=(eax << 9); //=eax*512
+		//a=(eax << 7); //=eax*128
+		//a=512|128; = 640;
+		//SetTextMode (  );
+		//a=(ecx >> 16);//ecx=4102225920 a=62595   ecx/65536 = 62595
+
+		//         Y-dir                    x-dir
+		if (eax < (256*2.5) && (ecx >> 16) < (512*2)) {
+			//eax = (eax << 9) | ((ecx << 7) >> (32-9));
+			eax = (eax << 10) | ((ecx << 6) >> (32-10));
+	/*		eax = (eax * 512*2) ;
+								//(23)
+			eax += 	 ((ecx ) >> (32-9));//ecx=196608
+			*/
 		} else {
 			eax = 0;
+
+			
 		}
+ 		//desttmp -= centeroffset;	
+		*desttmp++ = srctmp[eax];
+		//*desttmp++ = srctmp[eax];
 		
-		*dest++ = src[eax];
-		
 		edx += mr_xstep;
 		ecx += mr_ystep;
 	}
+
+	}
 }
 
 void DrawMaskedRotRow(int count, byte * dest, byte * src)
@@ -5788,15 +6011,58 @@
 
 void DrawSkyPost (byte * buf, byte * src, int height)
 {
-	while (height--) {
-		*buf = shadingtable[*src];
+// bna fix for missing sky by high res eg 800x600
+// when sky is >400 (max skyheight) then reverse mouintain to missing spot
+// there should be 200 line of mouintain (400+200) = 600 height lines
+// not the best solution but what it works
+
+	if (iGLOBAL_SCREENWIDTH > 320){
+	// bna section start
+		//int n = 0;
+		int orgh = 0;//height;
+		if (height > 400){orgh=height;}
+
+		while (height--) {
+			if ((orgh > 0)&&( height<(orgh-400))){
+				src-=2;
+				*buf = shadingtable[*src];
+			}else{
+
+				*buf = shadingtable[*src];
+			}
+			buf += linewidth;
+			src++;
+		}
+	// bna section end
+	}
+	else {
+	// org code
+		while (height--) {
+			*buf = shadingtable[*src];
+			
+			buf += linewidth;
+			src++;
+		}
+	//	
+	}
+  
+	/*
+	int lw = linewidth * 2;
+	int h  = height;
+
+	while (h--) {
+		*(buf) = shadingtable[*src];
+		buf += lw;
+		*(buf) = shadingtable[*src];
+		buf += lw;
 		
-		buf += linewidth;
+		//buf += lw;
 		src++;
-	}
+		
+	}*/
 }
 
-#define CEILINGCOLOR 24
+#define CEILINGCOLOR 24 //default color when no sky or floor
 #define FLOORCOLOR 32
 
 void RefreshClear (void)
@@ -5812,7 +6078,7 @@
 	start = min(centery, viewheight);
 	
 	if (start > 0) {
-		VL_Bar(0, 0, MAXSCREENWIDTH, start, CEILINGCOLOR);
+		VL_Bar(0, 0, iGLOBAL_SCREENHEIGHT, start, CEILINGCOLOR);
 	} else {
 		start = 0;
 	}
@@ -5821,7 +6087,7 @@
 	
 	start = min(viewheight-start, viewheight);
 	if (start > 0) {
-		VL_Bar(0, base, MAXSCREENWIDTH, start, FLOORCOLOR);
+		VL_Bar(0, base, iGLOBAL_SCREENHEIGHT, start, FLOORCOLOR);
 	}
 }
 

Modified: trunk/rott/rt_floor.c
===================================================================
--- trunk/rott/rt_floor.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_floor.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -75,21 +75,25 @@
 
 static byte     *floor;
 static byte     *ceiling;
-static int xstarts[MAXVIEWHEIGHT];
+//static int xstarts[MAXVIEWHEIGHT];
+static int xstarts[600];//set to max hight res
 static byte * skysegs[MAXSKYSEGS];
 static byte * skydata[MAXSKYDATA];
 static int      horizonheight;
 static int      centerskypost;
 static int      oldsky=-1;
 
+
+//bna fixit skyerror by 800x600 clouds not big enough
+
 void DrawSky( void )
 {
 
    byte * src;
    int dest;
-   int plane;
+//   int plane;
    int height;
-   int height2;
+//   int height2;
    int ang;
    int angle;
    int ofs;
@@ -106,11 +110,11 @@
       {
       ofs=centerskypost;
       }
-   else if (((centerskypost-ofs)+viewheight)>399)
+   else if (((centerskypost-ofs)+viewheight)>1799)
       {
-      ofs=-(399-(centerskypost+viewheight));
+      ofs=-(1799-(centerskypost+viewheight));
       }
-
+//ofs=centerskypost;
 #ifdef DOS
    if (doublestep>0)
       {
@@ -200,9 +204,9 @@
       {
       ofs=centerskypost;
       }
-   else if (((centerskypost-ofs)+viewheight)>399)
+   else if (((centerskypost-ofs)+viewheight)>599)
       {
-      ofs=-(399-(centerskypost+viewheight));
+      ofs=-(599-(centerskypost+viewheight));
       }
 
    bufferofs+=screenofs;
@@ -269,16 +273,23 @@
    byte * ptr;
    int c;
 
-   temp=SafeMalloc(256*400);
+   temp=SafeMalloc(256*800);
 
    ptr=temp;
 
    for (c=0;c<256;c++)
       {
+
       memcpy(ptr,skydata[1]+(c*200),200);
       ptr+=200;
+ 
       memcpy(ptr,skydata[0]+(c*200),200);
       ptr+=200;
+
+      //memcpy(ptr,skydata[1]+(c*200),200);
+      //ptr+=200;
+      //memcpy(ptr,skydata[0]+(c*200),200);
+      //ptr+=200;
       }
    skydata[0]=temp;
 }
@@ -425,7 +436,7 @@
 	else
 	 ceilingnum = MAPSPOT(1,0,0)-197;
 
-	floornum = MAPSPOT(0,0,0)-179;
+	floornum = MAPSPOT(0,0,0)-(179);
 
    floornum = GetFloorCeilingLump ( floornum );
    //ceilingnum = GetFloorCeilingLump ( ceilingnum );

Modified: trunk/rott/rt_game.c
===================================================================
--- trunk/rott/rt_game.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_game.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -82,7 +82,8 @@
                      SD_PLAYERLNSND, SD_PLAYERIPFSND};
 
 
-int SHAKETICS   = 0xFFFF;
+unsigned short SHAKETICS = 0xFFFF;//bna++
+//int SHAKETICS   = 0xFFFF;
 int damagecount = 0;
 HighScore   Scores[MaxScores] =
 				{
@@ -94,8 +95,8 @@
                {"Jim",20000,2,1},
                {"Steve",10000,1,1},
             };
+extern char *tmpPICbuf;
 
-
 //******************************************************************************
 //
 // LOCALS
@@ -161,8 +162,13 @@
 #define NUMBONUSES   11
 #define BONUSBONUS   100000
 
+
+extern void VL_MemToScreenClipped (byte *source, int width, int height, int x, int y);
 void DrawPPic (int xpos, int ypos, int width, int height, byte *src, int num, boolean up, boolean bufferofsonly);
-
+extern void    MoveScreenUpLeft();
+extern void    MoveScreenUpRight();
+extern void    MoveScreenDownLeft();
+extern void    MoveScreenDownRight();
 //******************************************************************************
 //
 // V_ReDrawBkgnd ()
@@ -415,19 +421,50 @@
 // DrawPlayScreen ()
 //
 //******************************************************************************
-void DrawPlayScreen
-   (
-   boolean bufferofsonly
-   )
+void DrawPlayScreen (boolean bufferofsonly)
 
    {
    pic_t *shape;
    int    shapenum;
+   int ShowKillsYoffset = 0;//bna++
 
+//return; 
+
    if ( SHOW_TOP_STATUS_BAR() )
       {
-      shape = W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 );
-      GameMemToScreen( shape, 0, 0, bufferofsonly );
+	   if (iGLOBAL_SCREENWIDTH == 640) {
+		   //use this as dummy pic to fill out missing bar
+		  shape = ( pic_t * ) W_CacheLumpName( "bottbar", PU_CACHE, Cvt_pic_t, 1 );
+		  //GameMemToScreen( shape, 0, 0, bufferofsonly );
+		  GameMemToScreen( shape, 320, 0, bufferofsonly );
+		  // delete hart in middle of topbar
+		  DrawPPic( 323,1, 8 >> 2, 16,
+				 ( byte * )&erase->data, 2, true, bufferofsonly );
+		  // delete bullet in end of topbar
+		  DrawPPic( 620,1, 8 >> 2, 16,
+				 ( byte * )&erase->data, 2, true, bufferofsonly );
+		  shape = ( pic_t * )W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 );
+		  GameMemToScreen( shape, 0, 0, bufferofsonly );
+	   }else if (iGLOBAL_SCREENWIDTH == 800) {
+		   //use this as dummy pic to fill out missing bar
+		  shape = ( pic_t * ) W_CacheLumpName( "bottbar", PU_CACHE, Cvt_pic_t, 1 );
+		  GameMemToScreen( shape, 0, 0, bufferofsonly );
+		  GameMemToScreen( shape, 260, 0, bufferofsonly );
+		  GameMemToScreen( shape, 800-320, 0, bufferofsonly );
+		  // delete hart in middle of topbar
+		  DrawPPic( 480+3,1, 8 >> 2, 16,
+				 ( byte * )&erase->data, 2, true, bufferofsonly );
+		  // delete bullet in end of topbar
+		  DrawPPic( 780,1, 8 >> 2, 16,
+				 ( byte * )&erase->data, 2, true, bufferofsonly );
+		  shape = ( pic_t * )W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 );
+		  GameMemToScreen( shape, 0, 0, bufferofsonly );
+	   }else if (iGLOBAL_SCREENWIDTH == 320) {
+		  
+		  //SetTextMode (  );
+		  shape = ( pic_t * )W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 );
+		  GameMemToScreen( shape, 0, 0, bufferofsonly );
+	   }
       }
 
    if ( BATTLEMODE )
@@ -441,43 +478,93 @@
 
       if ( SHOW_KILLS() )
          {
-         GameMemToScreen( shape, 0, 160, bufferofsonly );
+		  ShowKillsYoffset = KILLS_HEIGHT;
+		  //shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
+		  //DrawTiledRegion( 0, 584, iGLOBAL_SCREENWIDTH, 32-16, 0, 16, shape );//bna++
+	   
+
+	//	     health_y = iGLOBAL_HEALTH_Y;
+ //  if ( SHOW_KILLS() )
+   //   {
+     // health_y -= KILLS_HEIGHT;
+          //GameMemToScreen( shape, 0, (iGLOBAL_SCREENHEIGHT-40)+16, bufferofsonly );
+
+         //GameMemToScreen( shape, 0, 160, bufferofsonly );bna++
          }
-      else
+      //else 
          {
-         GameMemToScreen( shape, 0, 184, bufferofsonly );
+
+			if (iGLOBAL_SCREENWIDTH == 640) {
+				  //bna fix - not to good? but no one has 286 any more
+				  //statusbar dosent cover hole screen, because its a lump picture width max 320
+				  //first write dummy shape and next over it
+				 GameMemToScreen( shape, 320, (224*2)+16-ShowKillsYoffset, bufferofsonly );
+				 //copy next shape to mem
+				 GameMemToScreen( shape, 0, (224*2)+16-ShowKillsYoffset, bufferofsonly );
+				 // delete bullet in middle of shape picture
+				 DrawPPic( 310, (224*2)+17-ShowKillsYoffset, 8 >> 2, 16,
+					 ( byte * )&erase->data, 2, true, bufferofsonly );
+				 // delete hart in middle of shape picture
+				 DrawPPic( 324, (224*2)+17-ShowKillsYoffset, 8 >> 2, 16,
+					 ( byte * )&erase->data, 2, true, bufferofsonly );
+
+			}else if (iGLOBAL_SCREENWIDTH == 800) {
+				 GameMemToScreen( shape, 800-320, 584-ShowKillsYoffset, bufferofsonly );
+				 //copy next shape to mem
+				 GameMemToScreen( shape, 300, 584-ShowKillsYoffset, bufferofsonly );
+				 //copy next shape to mem
+				 GameMemToScreen( shape, 0, 584-ShowKillsYoffset, bufferofsonly );
+				 // delete 2 bullets in middle of shape picture
+				 DrawPPic( 305, 584+1-ShowKillsYoffset, 8 >> 2, 16,
+					 ( byte * )&erase->data, 2, true, bufferofsonly );
+				 // delete hart in middle of shape picture
+				 DrawPPic( 610, 584+1-ShowKillsYoffset, 8 >> 2, 16,
+					 ( byte * )&erase->data, 2, true, bufferofsonly );
+
+			}else{
+				 GameMemToScreen( shape, 0, 184, bufferofsonly );
+			}
          }
 
       DrawBarAmmo( bufferofsonly );
       DrawBarHealth( bufferofsonly );
 
       if ( demoplayback )
-         {
-         shape = ( pic_t * )W_CacheLumpName( "demo", PU_CACHE, Cvt_pic_t, 1 );
-         DrawPPic( 148, 185, shape->width, shape->height,
-            ( byte * )&shape->data, 1, true, bufferofsonly );
-         }
-      }
+      {
+			 shape = ( pic_t * )W_CacheLumpName( "demo", PU_CACHE, Cvt_pic_t, 1 );
+			 if (iGLOBAL_SCREENWIDTH == 640) {
+				 //DrawPPic( 148, 185, shape->width, shape->height,
+				 //   ( byte * )&shape->data, 1, true, bufferofsonly );bna
+				 DrawPPic( 148*2, 465, shape->width, shape->height,
+					( byte * )&shape->data, 1, true, bufferofsonly );
+			 }else if (iGLOBAL_SCREENWIDTH == 800) {
+				 DrawPPic( 380, 585, shape->width, shape->height,
+					( byte * )&shape->data, 1, true, bufferofsonly );
+			 }else{
+					DrawPPic( 148, 185, shape->width, shape->height,
+					( byte * )&shape->data, 1, true, bufferofsonly );		
+			 }
+	  }
+    }
 
    if ( !SHOW_TOP_STATUS_BAR() )
       {
       return;
       }
 
-
+//draws small player picture and name in topbar
    oldsec = -1;
 
    DrawTime( bufferofsonly );
 
    if ( !BATTLEMODE )
-      {
+   {
       int character;
       int width;
       int height;
 
       character = locplayerstate->player;
-      GameMemToScreen( men[ character ], MEN_X, MEN_Y,
-         bufferofsonly );
+      GameMemToScreen( men[ character ], MEN_X, MEN_Y,bufferofsonly );
 
       CurrentFont = tinyfont;
 
@@ -605,6 +692,7 @@
    int  playernum;
    int  playerimage;
    int  temp;
+   int  iKILLS_Y;
    pic_t *pic;
 
    CurrentFont = tinyfont;
@@ -757,12 +845,23 @@
       }
 
    // Only draw the rest of the rifraff when the kill count is selected
+   
    if ( !SHOW_KILLS() )
       {
       return;
       }
+//	 SetTextMode (  );
+   // Draw all the other losers
+	//#define KILLS_Y      176
+    iKILLS_Y = iGLOBAL_SCREENHEIGHT - 24;
+	//draw blank status  pic->width = 8;pic->height = 24
+    pic = blankfragpic;
+    for (temp = iGLOBAL_SCREENWIDTH-pic->width-24;temp > pic->width; temp -= pic->width){	
+		  DrawPPic( temp, iKILLS_Y, pic->width, pic->height,
+			 (byte *)&pic->data, 1, true, bufferofsonly );
 
-   // Draw all the other losers
+	}
+
 	xpos = KILLS_X;
    for( rank = 0; rank < BATTLE_NumberOfTeams; rank++ )
       {
@@ -790,7 +889,7 @@
             pic = frag100pic[ PLAYERSTATE[ playerimage ].player ];
             }
          }
-      DrawPPic( xpos, KILLS_Y, pic->width, pic->height,
+      DrawPPic( xpos, iKILLS_Y, pic->width, pic->height,
          (byte *)&pic->data, 1, true, bufferofsonly );
 
       // Draw number of points
@@ -808,13 +907,13 @@
             {
             width = 3;
             }
-         DrawNumber( xpos + KILLS_OFFSET + 16 - ( 8 * width ), KILLS_Y, width, 4, bufferofsonly);
+         DrawNumber( xpos + KILLS_OFFSET + 16 - ( 8 * width ), iKILLS_Y, width, 4, bufferofsonly);
          }
       else
          {
-         pic = W_CacheLumpName( "minus", PU_CACHE, Cvt_pic_t, 1 );
-         StatusDrawColoredPic( ( xpos + KILLS_OFFSET ), KILLS_Y, pic, bufferofsonly, playeruniformcolor );
-         StatusDrawColoredPic( ( xpos + KILLS_OFFSET + 8 ), KILLS_Y, pic, bufferofsonly, playeruniformcolor );
+         pic =  ( pic_t * )W_CacheLumpName( "minus", PU_CACHE, Cvt_pic_t, 1 );
+         StatusDrawColoredPic( ( xpos + KILLS_OFFSET ), iKILLS_Y, pic, bufferofsonly, playeruniformcolor );
+         StatusDrawColoredPic( ( xpos + KILLS_OFFSET + 8 ), iKILLS_Y, pic, bufferofsonly, playeruniformcolor );
          }
 
       // Get codename
@@ -835,7 +934,7 @@
       // Advance to next position
 		xpos += KILLS_WIDTH;
 
-      if ( xpos >= 320 )
+      if ( xpos >= iGLOBAL_SCREENWIDTH )
          {
          break;
          }
@@ -843,13 +942,13 @@
 
    for( rank = BATTLE_NumberOfTeams; rank <= MAXKILLBOXES; rank++ )
       {
-      if ( xpos >= 320 )
+      if ( xpos >= iGLOBAL_SCREENWIDTH )
          {
          break;
          }
 
       pic = blankfragpic;
-      DrawPPic( xpos, KILLS_Y, pic->width, pic->height,
+      DrawPPic( xpos, iKILLS_Y, pic->width, pic->height,
          (byte *)&pic->data, 1, true, bufferofsonly );
 
       // Advance to next position
@@ -888,11 +987,11 @@
    friend = ( pic_t * )W_CacheLumpName( "t_friend", PU_CACHE, Cvt_pic_t, 1 );
    enemy  = ( pic_t * )W_CacheLumpName( "t_enemy", PU_CACHE, Cvt_pic_t, 1 );
 
-   // Draw all the losers
+   // Draw all the losers 
    CurrentFont = tinyfont;
 
-	xpos = ( 320 - min( numplayers, MAXKILLBOXES ) * KILLS_WIDTH ) / 2;
-
+	xpos = (iGLOBAL_SCREENWIDTH  - min( numplayers, MAXKILLBOXES ) * KILLS_WIDTH ) / 2;
+//SetTextMode (  );//PLAYERSTATE
    for( team = 0; team < BATTLE_NumberOfTeams; team++ )
       {
       for( player = 0; player < numplayers; player++ )
@@ -952,12 +1051,12 @@
                xpos += KILLS_WIDTH;
                }
             }
-         if ( xpos >= 320 )
+         if ( xpos >= iGLOBAL_SCREENWIDTH )
             {
             break;
             }
          }
-      if ( xpos >= 320 )
+      if ( xpos >= iGLOBAL_SCREENWIDTH )
          {
          break;
          }
@@ -1922,7 +2021,7 @@
       return;
       }
 
-   health_y = HEALTH_Y;
+   health_y = iGLOBAL_HEALTH_Y;
    if ( SHOW_KILLS() )
       {
       health_y -= KILLS_HEIGHT;
@@ -1935,7 +2034,7 @@
 
    if ( playstate == ex_died )
       {
-      DrawPPic( HEALTH_X, health_y, 8 >> 2, 16, ( byte * )&erase->data,
+      DrawPPic( iGLOBAL_HEALTH_X, health_y, 8 >> 2, 16, ( byte * )&erase->data,
          10, true, bufferofsonly );
 
       return;
@@ -1953,26 +2052,26 @@
 
    if ( oldpercenthealth < 4 )
       {
-      DrawPPic( HEALTH_X, health_y, 8 >> 2, 16,
+      DrawPPic( iGLOBAL_HEALTH_X, health_y, 8 >> 2, 16,
          ( byte * )&health[ 0 ]->data, oldpercenthealth,
          true, bufferofsonly );
       }
    else if ( oldpercenthealth < 5 )
       {
-      DrawPPic( HEALTH_X, health_y, 8 >> 2, 16,
+      DrawPPic( iGLOBAL_HEALTH_X, health_y, 8 >> 2, 16,
          (byte *)&health[ 1 ]->data, oldpercenthealth,
          true, bufferofsonly );
       }
    else
       {
-      DrawPPic( HEALTH_X, health_y, 8 >> 2, 16,
+      DrawPPic( iGLOBAL_HEALTH_X, health_y, 8 >> 2, 16,
          ( byte * )&health[ 2 ]->data, oldpercenthealth,
          true, bufferofsonly );
       }
 
    if ( oldpercenthealth < 10 )
       {
-      DrawPPic( HEALTH_X + ( 8 * oldpercenthealth ), health_y,
+      DrawPPic( iGLOBAL_HEALTH_X + ( 8 * oldpercenthealth ), health_y,
          8 >> 2, 16, ( byte * )&erase->data, 10 - oldpercenthealth,
          true, bufferofsonly );
       }
@@ -1998,13 +2097,13 @@
       return;
       }
 
-   ammo_y = AMMO_Y;
+   ammo_y = iGLOBAL_AMMO_Y;
    if ( SHOW_KILLS() )
       {
       ammo_y -= KILLS_HEIGHT;
       }
 
-   DrawPPic ( AMMO_X, ammo_y + 1, 8 >> 2, 16, ( byte * )&erase->data,
+   DrawPPic ( iGLOBAL_AMMO_X, ammo_y + 1, 8 >> 2, 16, ( byte * )&erase->data,
       10, false, bufferofsonly );
 
    if ( !ARMED( player->dirchoosetime ) )
@@ -2016,25 +2115,25 @@
        ( gamestate.BattleOptions.Ammo == bo_infinite_shots )
       )
       {
-      DrawPPic( AMMO_X - 16, ammo_y, 24 >> 2, 16,
+      DrawPPic( iGLOBAL_AMMO_X - 16, ammo_y, 24 >> 2, 16,
          ( byte * )&ammo[ 0 ]->data, 1, true, bufferofsonly);
 
-      DrawPPic( AMMO_X - 32, ammo_y + 1, 8 >> 2, 16,
+      DrawPPic( iGLOBAL_AMMO_X - 32, ammo_y + 1, 8 >> 2, 16,
          ( byte * )&erase->data, 2, true, bufferofsonly );
       }
 #if (SHAREWARE == 0)
    else if ( locplayerstate->new_weapon == wp_dog )
       {
-      DrawPPic( AMMO_X - 16, ammo_y, 24 >> 2, 16,
+      DrawPPic( iGLOBAL_AMMO_X - 16, ammo_y, 24 >> 2, 16,
          ( byte * )&ammo[12]->data, 1, true, bufferofsonly );
 
-      DrawPPic( AMMO_X - 32, ammo_y + 1, 8 >> 2, 16,
+      DrawPPic( iGLOBAL_AMMO_X - 32, ammo_y + 1, 8 >> 2, 16,
          ( byte * )&erase->data, 2, true, bufferofsonly );
       }
 #endif
    else
       {
-      DrawPPic( AMMO_X, ammo_y + 1, 8 >> 2, 16,
+      DrawPPic( iGLOBAL_AMMO_X, ammo_y + 1, 8 >> 2, 16,
          ( byte * )&ammo[ locplayerstate->new_weapon]->data,
          locplayerstate->ammo, false, bufferofsonly );
       }
@@ -2154,8 +2253,8 @@
 //      DrawTiledRegion( 0, 160, 320, 24, shape );
 //      }
 
-   health_y = HEALTH_Y;
-   ammo_y   = AMMO_Y;
+   health_y = iGLOBAL_HEALTH_Y;
+   ammo_y   = iGLOBAL_AMMO_Y;
 
    if ( SHOW_KILLS() )
       {
@@ -2180,17 +2279,17 @@
 
    if ( oldpercenthealth < 4 )
       {
-      SingleDrawPPic( HEALTH_X - 16, health_y, 8 >> 2, 16,
+      SingleDrawPPic( iGLOBAL_HEALTH_X - 16, health_y, 8 >> 2, 16,
          ( byte * )&health[ 3 ]->data, oldpercenthealth, true);
       }
    else if ( oldpercenthealth < 5 )
       {
-      SingleDrawPPic( HEALTH_X - 16, health_y, 8 >> 2, 16,
+      SingleDrawPPic( iGLOBAL_HEALTH_X - 16, health_y, 8 >> 2, 16,
          ( byte * )&health[ 4 ]->data, oldpercenthealth, true );
       }
    else
       {
-      SingleDrawPPic( HEALTH_X - 16, health_y, 8 >> 2, 16,
+      SingleDrawPPic( iGLOBAL_HEALTH_X - 16, health_y, 8 >> 2, 16,
          ( byte * )&health[ 5 ]->data, oldpercenthealth, true );
       }
 
@@ -2202,19 +2301,19 @@
          )
 
         {
-         SingleDrawPPic( AMMO_X - 16, ammo_y, 24 >> 2, 16,
+         SingleDrawPPic( iGLOBAL_AMMO_X - 16, ammo_y, 24 >> 2, 16,
             ( byte * )&ammo[13]->data, 1, true );
          }
 #if (SHAREWARE == 0)
       else if ( locplayerstate->new_weapon == wp_dog )
          {
-         SingleDrawPPic( AMMO_X - 16, ammo_y + 1, 24 >> 2, 16,
+         SingleDrawPPic( iGLOBAL_AMMO_X - 16, ammo_y + 1, 24 >> 2, 16,
             ( byte * )&ammo[25]->data, 1, true );
          }
 #endif
       else
          {
-         SingleDrawPPic( AMMO_X, ammo_y + 1, 8 >> 2, 16,
+         SingleDrawPPic( iGLOBAL_AMMO_X, ammo_y + 1, 8 >> 2, 16,
             ( byte * )&ammo[13 + locplayerstate->new_weapon]->data,
             locplayerstate->ammo, false );
          }
@@ -2231,18 +2330,27 @@
 void DrawPauseXY (int x, int y)
 {
    pic_t *p;
+   byte *buftmp;
 
+   buftmp = bufferofs;
+
    if (GamePaused == true)
    {
       p = (pic_t *) W_CacheLumpNum (W_GetNumForName ("paused"), PU_CACHE, Cvt_pic_t, 1);
-      VWB_DrawPic (x, y, p);
+	  VL_MemToScreen ((byte *)&p->data, p->width, p->height,x, y);
+	  //VWB_DrawPic (x, y, p);
+	  bufferofs = buftmp;
       DrawEpisodeLevel (x,y);
+	  //VL_MemToScreen ((byte *)&p->data, p->width, p->height,x, y);
+
    }
    else
    {
       p = (pic_t *) W_CacheLumpNum (W_GetNumForName ("wait"), PU_CACHE, Cvt_pic_t, 1);
-      VWB_DrawPic (x, y, p);
+	  VL_MemToScreen ((byte *)&p->data, p->width, p->height,x, y);
+      //VWB_DrawPic (x, y, p);
    }
+   bufferofs = buftmp;
 }
 
 //****************************************************************************
@@ -2260,14 +2368,93 @@
 
    if (GamePaused == true)
    {
+	  bufferofs = bufftemp;
       p = (pic_t *) W_CacheLumpNum (W_GetNumForName ("paused"), PU_CACHE, Cvt_pic_t, 1);
-      DrawPauseXY( (320-(p->width<<2) ) >>1, (200-p->height)>>1);
+      DrawPauseXY( (iGLOBAL_SCREENWIDTH-(p->width<<2) ) >>1, (iGLOBAL_SCREENHEIGHT-p->height)>>1);//bna++
+      //DrawPauseXY( (320-(p->width<<2) ) >>1, (200-p->height)>>1);
+/*
+	  //buf = (byte *) SafeMalloc (64000);
+	  w = p->width;
+	  h = p->height;
+	  x = (iGLOBAL_SCREENWIDTH-((p->width)<<2) ) >>1;
+	  y = (iGLOBAL_SCREENHEIGHT-(p->height))>>1;
+
+	  x1 = (iGLOBAL_SCREENWIDTH-((p->width*2)<<2) ) >>1;
+	  y1 = (iGLOBAL_SCREENHEIGHT-(p->height*2))>>1;
+
+	  source = bufferofs + (iGLOBAL_SCREENWIDTH*y)+x;
+	  target = bufferofs + (iGLOBAL_SCREENWIDTH*y1)+x1;
+	  
+	 // memcpy(tmpPICbuf,bufftemp,iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT);
+
+	  bufferofs = bufftemp;//(byte *)tmpPICbuf;//buf;//write picture in tmpbuf
+	  VL_MemToScreen ((byte *)&p->data, p->width, p->height,x, y);
+	  bufferofs = bufftemp;
+	  DrawEpisodeLevel (x,y);
+
+	  
+	  //VL_MemStrechedToScreen ((byte *)&p->data, p->width, p->height,(iGLOBAL_SCREENWIDTH-((p->width*2)<<2) ) >>1, (iGLOBAL_SCREENHEIGHT-(p->height*2))>>1);
+      //DrawEpisodeLevel (x,y);
+	  
+	  //VL_MemToScreen ((byte *)&p->data, p->width, p->height,0, 0);
+	  //bufferofs = bufftemp;//move ptr back
+	  //write it back to bufferofs while streching
+
+	  //buf = bufftemp;
+	  //b = tmpPICbuf ;
+
+	  source = bufferofs + (iGLOBAL_SCREENWIDTH*y)+x+(w*4);
+	  target = bufferofs + (iGLOBAL_SCREENWIDTH*y1)+x+(2*w*4);
+
+	  //first strech lines in x direction
+	  for (y=0;y<h;y++){
+        c=target;t2=source;
+		for (x=0;x<w*4;x++){
+			*target-- = *source;
+			*target-- = *source--;
+		}
+		target=c;source=t2;
+		target += iGLOBAL_SCREENWIDTH;
+		source += iGLOBAL_SCREENWIDTH;
+	  }
+	  //strech then lines in y direction
+	  source -= ((iGLOBAL_SCREENWIDTH*(y/2))+(w*4));//bufferofs + (iGLOBAL_SCREENWIDTH*y)+x+(iGLOBAL_SCREENWIDTH*(y));
+	  target = (source+(iGLOBAL_SCREENWIDTH*(y))+1);//bufferofs + (iGLOBAL_SCREENWIDTH*y)+x+(iGLOBAL_SCREENWIDTH*(y1));
+
+	  for (y=0;y<h;y++){
+		memcpy(target,source,(w*4*2));
+		memcpy(target+iGLOBAL_SCREENWIDTH,source,(w*4*2));
+
+		target -= iGLOBAL_SCREENWIDTH*2;
+		source -= iGLOBAL_SCREENWIDTH;
+	  }
+
+/ *
+	  for (y=0;y<h;y++){
+        c=target;t2=source;
+		for (x=0;x<w*4;x++){
+			*target = *source;
+			*(target+++iGLOBAL_SCREENWIDTH) = *source;
+			*target = *source;
+			*(target+++iGLOBAL_SCREENWIDTH) = *source;
+			source++;
+		}
+		target=c;source=t2;
+		target += iGLOBAL_SCREENWIDTH*2;
+		source += iGLOBAL_SCREENWIDTH;
+	  }
+*/
+
+//	  memcpy( bufftemp,tmpPICbuf,iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT);
+
    }
    else
    {
       p = (pic_t *) W_CacheLumpNum (W_GetNumForName ("wait"), PU_CACHE, Cvt_pic_t, 1);
-      DrawPauseXY( (320-(p->width<<2) ) >>1, (200-p->height)>>1);
+      DrawPauseXY( (iGLOBAL_SCREENWIDTH-(p->width<<2) ) >>1, (iGLOBAL_SCREENHEIGHT-p->height)>>1);//bna++
+      //DrawPauseXY( (320-(p->width<<2) ) >>1, (200-p->height)>>1);
    }
+//   VH_UpdateScreen () ;
 
    bufferofs = bufftemp;
 }
@@ -2546,14 +2733,16 @@
    {
       ltoa (gamestate.episode, str, 10);
 
-      Drawpic (x+29, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data);
+      //bna-- Drawpic (x+29, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data);
+	  VL_MemToScreenClipped ((byte *)&timenums[str[0]-'0']->data,  8>>2, 16, x+29, y+16);
 
       if ((gamestate.mapon == 6) || (gamestate.mapon == 14) ||
           (gamestate.mapon == 22) || (gamestate.mapon == 32) ||
           (gamestate.mapon == 33))
       {
          p = (pic_t *) W_CacheLumpName ("tnumb", PU_CACHE, Cvt_pic_t, 1);
-         Drawpic (x+40, y+16, 8>>2, 16, (byte *)&p->data);
+         //Drawpic (x+40, y+16, 8>>2, 16, (byte *)&p->data);
+		 VL_MemToScreenClipped ((byte *)&p->data, 8>>2, 16, x+40, y+16);
 
          if (gamestate.mapon == 6)
             level = 1;
@@ -2575,28 +2764,34 @@
       level = abs(level);
       ltoa (level, str, 10);
 
-      if (level < 10)
-         Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data);
-      else
-      {
-         Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data);
-         Drawpic (x+57, y+16, 8>>2, 16, (byte *)&timenums[str[1]-'0']->data);
+      if (level < 10){
+         //Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data);
+	     VL_MemToScreenClipped ((byte *)&timenums[str[0]-'0']->data, 8>>2, 16, x+49, y+16);
+      }else{
+         //Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data);
+		 VL_MemToScreenClipped ((byte *)&timenums[str[0]-'0']->data, 8>>2, 16, x+49, y+16);
+         //Drawpic (x+57, y+16, 8>>2, 16, (byte *)&timenums[str[1]-'0']->data);
+		 VL_MemToScreenClipped ((byte *)&timenums[str[1]-'0']->data, 8>>2, 16, x+57, y+16);
+
       }
    }
    else
    {
       p = (pic_t *) W_CacheLumpName ("battp", PU_CACHE, Cvt_pic_t, 1);
-      Drawpic (x+16, y+15, 32>>2, 16, (byte *)&p->data);
+      //Drawpic (x+16, y+15, 32>>2, 16, (byte *)&p->data);
+	  VL_MemToScreenClipped ((byte *)&p->data, 32>>2, 16, x+16, y+15);
 
       level = abs(gamestate.mapon + 1);
       ltoa (level, str, 10);
 
-      if (level < 10)
-         Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data);
-      else
-      {
-         Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data);
-         Drawpic (x+57, y+16, 8>>2, 16, (byte *)&timenums[str[1]-'0']->data);
+      if (level < 10){
+         //Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data);
+	     VL_MemToScreenClipped ((byte *)&timenums[str[0]-'0']->data, 8>>2, 16, x+49, y+16);
+      }else {
+         //Drawpic (x+49, y+16, 8>>2, 16, (byte *)&timenums[str[0]-'0']->data);
+		 VL_MemToScreenClipped ((byte *)&timenums[str[0]-'0']->data, 8>>2, 16, x+49, y+16);
+         //Drawpic (x+57, y+16, 8>>2, 16, (byte *)&timenums[str[1]-'0']->data);
+		 VL_MemToScreenClipped ((byte *)&timenums[str[1]-'0']->data, 8>>2, 16, x+57, y+16);
       }
    }
 }
@@ -2679,10 +2874,11 @@
 void ScreenShake (void)
 {
    static int which = 0;
-
+//	   SetTextMode (  );
    if (SHAKETICS != 0xFFFF)
    {
       SHAKETICS -= tics;
+	  if (SHAKETICS >= 0xFF00){SHAKETICS = 0xFFFF;}//bna safety val check
 
       which = (RandomNumber ("ScreenShake",0) & 3);
 
@@ -2690,20 +2886,29 @@
       {
          case 0:
             displayofs += 1;
+			MoveScreenUpLeft();//SetTextMode (  );
+			DrawPlayScreen(true);//repaint ammo and life stat
          break;
 
          case 1:
             displayofs -= 1;
+			MoveScreenUpRight();
+			DrawPlayScreen(true);//repaint ammo and life stat
          break;
 
          case 2:
-            displayofs += 3*SCREENBWIDE;
+            displayofs += 3*iGLOBAL_SCREENBWIDE;
+			MoveScreenDownLeft();
+			DrawPlayScreen(true);//repaint ammo and life stat
          break;
 
          case 3:
-            displayofs -= 3*SCREENBWIDE;
+            displayofs -= 3*iGLOBAL_SCREENBWIDE;
+			MoveScreenDownRight();
+			DrawPlayScreen(true);//repaint ammo and life stat
          break;
       }
+
    }
 }
 
@@ -3156,7 +3361,7 @@
 
       case 2 :
          VL_FillPalette(255,255,255);
-         VW_UpdateScreen();
+         //bna--VW_UpdateScreen();
          VL_FadeIn(0,255,origpal,10);
          EndBonusVoice = SD_Play( SD_LIGHTNINGSND );
          break;
@@ -3164,7 +3369,7 @@
 
    EndBonusStartY += 10;
 
-   VW_UpdateScreen();
+   //bna--VW_UpdateScreen();
    while( SD_SoundActive( EndBonusVoice ) && !EndBonusSkip )
       {
       if ( IN_CheckAck() )
@@ -3208,13 +3413,24 @@
    int plantratio;
    int cnt;
 
+   pic_t *tmpPic;
+//   byte *picbuf;
+
    EndBonusNumBonuses = 0;
    EndBonusFirst      = true;
    EndBonusSkip       = false;
    EndBonusStartY     = 90;
 
+   StrechScreen=true;
+   tmpPic = ( pic_t * )W_CacheLumpName( "mmbk", PU_CACHE, Cvt_pic_t, 1 );
+   VWB_DrawPic( 0, 0, tmpPic );
+   VW_UpdateScreen();
+   StrechScreen=false;
+
    IN_StartAck();
    EndBonusVoice = 0;
+
+
    if ( playstate != ex_bossdied )
       {
       EndBonusVoice = SD_Play( SD_LEVELDONESND );
@@ -3309,16 +3525,36 @@
       }
 
    DrawEOLHeader( playstate );
+/*
+	//bna section  store picture  because its written on again
+   // store screen first
+   picbuf = (byte *)SafeMalloc (64000);
+   memcpy(picbuf ,bufferofs ,64000);
 
+   StrechScreen=true;
+   VW_UpdateScreen();//tmpPICbuf is destroyed here
+   StrechScreen=false;
+   //copy it back
+
+   memcpy(bufferofs ,picbuf , 64000);
+	//bna section end
+*/
+   
+EndBonusSkip = true;
+
    while( SD_SoundActive( EndBonusVoice ) && !EndBonusSkip )
       {
-      VW_UpdateScreen();
+
+      //bna--VW_UpdateScreen();
+
       if ( IN_CheckAck() )
          {
          EndBonusSkip = true;
          }
       }
-
+ //  tmpPic = ( pic_t * )W_CacheLumpName( "mmbk", PU_CACHE, Cvt_pic_t, 1 );
+ //  VWB_DrawPic( 0, 0, tmpPic );
+    
    if ( GetNextMap(player->tilex,player->tiley) == -1)
       {
    	if ( gamestate.dipballs == 3 )
@@ -3506,16 +3742,28 @@
          EndBonusFirst = true;
          EndBonusStartY = 110;
          DrawEndBonus( "You have done well.", NULL, 3 );
+		 
 #if (SHAREWARE==1)
          EndBonusVoice = SD_Play( SD_RICOCHET3SND );
 #else
          EndBonusVoice = SD_Play( SD_PERCENT100SND );
 #endif
+		 
          EndBonusSkip = false;
          DrawEndBonus( "This level is toast.", NULL, 3 );
+
          }
       }
+    	  
+    
 
+	//bna section 
+    StrechScreen=true;//bna++
+    VW_UpdateScreen();//bna++
+//    StrechScreen=false;//bna++
+	//bna section end
+
+
    IN_StartAck();
    while( !IN_CheckAck() )
       {
@@ -3586,8 +3834,21 @@
          VWB_DrawPic (   8, 24, Name );
          VWB_DrawPic ( 136, 24, TimesPersonKilledYou );
          break;
-      }
-
+//bna added
+      case 4 :
+		 VWB_DrawPic ( 198+48, 8, Blank );
+         VWB_DrawPic (   8,  8, TopBar );
+         DrawIntensityString( 12, 11, "FINAL SCORE", 20 );
+         VWB_DrawPic (   8, 24, TopBar );//used to blank
+         VWB_DrawPic (   8, 24, Name );
+         VWB_DrawPic ( 136, 24, KillCount);
+         VWB_DrawPic ( 198, 24, TimesPersonKilledYou);
+		 VWB_DrawPic ( 198+48, 24, Blank );
+         VWB_DrawPic ( 272, 24, Score );
+         break;
+//bna added end
+   }            
+                 
    DrawTimeXY( TALLYTIME_X, TALLYTIME_Y, gamestate.TimeCount / VBLCOUNTER,
       true );
    }
@@ -3950,6 +4211,8 @@
    int Player;
    char text[80];
 
+   StrechScreen=true;
+
    IN_ClearKeysDown ();
 
    Player = localplayer;
@@ -4141,8 +4404,8 @@
    int   slowrate;
    playertype *pstate;
    objtype * killerobj=(objtype *)player->target;
+player->yzangle=0;
 
-
    if (killerobj == NULL)
       killerobj = player;
 
@@ -4462,12 +4725,14 @@
       py = 152;
       if (whichstr)
       {
-         VW_DrawPropString ("ƒ");
+//         VW_DrawPropString ("ƒ");
+         VW_DrawPropString (".");
          whichstr = 0;
 		}
       else
       {
-         VW_DrawPropString ("„");
+//         VW_DrawPropString ("„");
+         VW_DrawPropString (".");
          whichstr = 1;
       }
       bufferofs = temp;

Modified: trunk/rott/rt_game.h
===================================================================
--- trunk/rott/rt_game.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_game.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -74,7 +74,8 @@
 
 extern int PlayerSnds[5];
 
-extern int SHAKETICS;
+//extern int SHAKETICS;
+extern unsigned short SHAKETICS;//bna++
 extern int damagecount;
 
 extern HighScore   Scores[MaxScores];

Modified: trunk/rott/rt_main.c
===================================================================
--- trunk/rott/rt_main.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_main.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -153,12 +153,26 @@
 void PlayTurboGame( void );
 void Init_Tables (void);
 void CheckRemoteRidicule ( int scancode );
+void SetRottScreenRes (int Width, int Height);
 
 #ifndef DOS
 extern void crash_print (int);
 extern int setup_homedir (void);
 #endif
 
+//extern int G_argc;
+//extern char G_argv[30][80];
+int G_weaponscale;
+extern int iDropDemo;
+extern int iG_aimCross;
+
+extern void ComSetTime ( void );
+extern void VH_UpdateScreen (void);
+extern void RottConsole ( void );
+extern void	ReadDelay(long delay);
+extern void RecordDemoQuery ( void );
+
+
 int main (int argc, char *argv[])
 {
     char *macwd;
@@ -206,6 +220,8 @@
    gamestate.Product = ROTT_REGISTERED;
 #endif
 
+   SetRottScreenRes (640, 480);
+
    DrawRottTitle ();
    gamestate.randomseed=-1;
 
@@ -730,8 +746,91 @@
 
 #if (SHAREWARE==0)
 
+
+   // Check for aimcross
+   arg = CheckParm ("aim");
+   if (arg!=0)
+   {
+		iG_aimCross = 1;
+   }else{
+		iG_aimCross = 0;
+   }
+
+
+   // Check for rtl files 	
+   arg = CheckParm ("filertl");
+   if (arg!=0)
+   {
+	   FILE *f;char buf[32];
+	   if (_argv[arg+1] != 0) { //are there a filename included
+		   strcpy (tempstr,_argv[arg+1]);//copy it to tempstr
+		   if (strlen (tempstr) < MAX_PATH) {
+			   if (access (tempstr, 0) != 0) { //try open
+				  	strcat (tempstr,".rtc");//non exists, try add .rtc
+					if (access (tempstr, 0) != 0) { //try open again
+						//stil no useful filename
+						strcat (tempstr," not found, skipping RTL file ");
+						printf(tempstr);
+						goto NoRTL;
+					}
+			   }
+			   if((f = fopen( tempstr, "r" )) == NULL ){ //try opnong file
+					strcat (tempstr," not could not be opened, skipping RTL file ");
+					printf(tempstr);
+					goto NoRTL;
+			   }else{
+					fread(buf,3,3,f);//is the 3 first letters RTL (RTC)
+				    if (((strstr(buf,"RTL") != 0)||strstr(buf,"RTC") != 0)) {
+						strcpy (GameLevels.file,tempstr);
+						GameLevels.avail++;
+						strcpy (buf,"Adding ");
+						strcat (buf,tempstr);
+						printf(buf);
+					}
+					fclose(f);
+			   }
+		   }
+	   }else{printf("Missing RTL filename");}
+   }
+NoRTL:;
+   // Check for rtc files
+   arg = CheckParm ("filertc");
+   if (arg!=0)
+   {
+	   FILE *f;char buf[32];
+	   if (_argv[arg+1] != 0) { //are there a filename included
+		   strcpy (tempstr,_argv[arg+1]);//copy it to tempstr
+		   if (strlen (tempstr) < MAX_PATH) {
+			   if (access (tempstr, 0) != 0) { //try open
+				  	strcat (tempstr,".rtc");//non exists, try add .rtc
+					if (access (tempstr, 0) != 0) { //try open again
+						//stil no useful filename
+						strcat (tempstr," not found, skipping RTC file ");
+						printf(tempstr);
+						goto NoRTL;
+					}
+			   }
+			   if((f = fopen( tempstr, "r" )) == NULL ){ //try opening file
+					strcat (tempstr," not could not be opened, skipping RTC file ");
+					printf(tempstr);
+					goto NoRTL;
+			   }else{
+					fread(buf,3,3,f);//is the 3 first letters RTL (RTC)
+				    if (((strstr(buf,"RTL") != 0)||strstr(buf,"RTC") != 0)) {
+						strcpy (BattleLevels.file,tempstr);
+						BattleLevels.avail++;
+						strcpy (buf,"Adding ");
+						strcat (buf,tempstr);
+						printf(buf);
+					}
+					fclose(f);
+			   }
+		   }
+	   }else{printf("Missing RTC filename");}
+   }
+NoRTC:;
+
    // Check for User wads
-
    arg = CheckParm ("file");
    if (arg!=0)
       {
@@ -836,7 +935,7 @@
 	blockstart = &blockstarts[0];
 	for (y=0;y<UPDATEHIGH;y++)
 		for (x=0;x<UPDATEWIDE;x++)
-			*blockstart++ = SCREENWIDTH*16*y+x*TILEWIDTH;
+			*blockstart++ = iG_SCREENWIDTH*16*y+x*TILEWIDTH;
 
 	for (i = 0; i < 0x300; i++)
 		*(origpal+(unsigned int)i) = (*(origpal+(unsigned int)i))>>2;
@@ -940,14 +1039,17 @@
          CalcTics();
          CalcTics();
 
+
          playstate = ex_titles;
          }
 
 		switch (playstate)
 		   {
          case ex_titles:
+		 
             BATTLE_Shutdown();
             MU_StartSong(song_title);
+			StrechScreen=true;
             if ((NoWait==false)&&(!modemgame))
                {
                byte dimpal[768];
@@ -993,7 +1095,9 @@
                      break;
                      }
 
-                  DoCreditScreen ();
+                  if (iGLOBAL_SCREENWIDTH > 320) { //need fixing, crashes by 320 ,bna
+					DoCreditScreen ();
+				  }
                   if ((!LastScan) && (!IN_GetMouseButtons()))
                      CheckHighScore (0, 0, false);
 #if (SHAREWARE==0)
@@ -1036,10 +1140,14 @@
                NoWait = false;
                SwitchPalette(origpal,35);
                CP_MainMenu();
+
                }
          break;
 
          case ex_resetgame:
+
+  // SetTextMode (  ); //12345678
+			 StrechScreen=true;//bna++ shut on streech mode 
             InitCharacter();
 
             InitializeMessages();
@@ -1123,6 +1231,9 @@
 
             MenuFixup ();
             playstate=ex_stillplaying;
+
+			StrechScreen=false;//bna++ shut off streech mode
+
          break;
 
          case ex_stillplaying:
@@ -1143,10 +1254,10 @@
 
          case ex_died:
             loadit = done = false;
-
+//		   SetTextMode (  ); //12345678
             Died ();
             StopWind();
-
+			 StrechScreen=false;//bna++ shut off streech mode
             while (damagecount>0)
                DoBorderShifts();
 
@@ -1371,12 +1482,12 @@
    waminot();
    }
 
-boolean CheckForQuickLoad
-   (
-   void
-   )
+boolean CheckForQuickLoad  (void )
 
    {
+
+   StrechScreen=true;//bna++
+
    if ( pickquick )
       {
       SetupMenuBuf();
@@ -1715,6 +1826,17 @@
       oldpolltime++;
       if (GamePaused==false)
          {
+   			//bna++ section
+		  if (( playstate == ex_stillplaying )&&(iGLOBAL_SCREENWIDTH > 320)){
+				pic_t *shape;
+				shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
+				DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );
+				StrechScreen=false;//dont strech when we go BACK TO GAME
+				DrawPlayScreen(true);//repaint ammo and life stat
+				VW_UpdateScreen ();//update screen
+		  }
+		  StartupClientControls();
+		   //bna section end
          break;
          }
 		}
@@ -2707,7 +2829,7 @@
    int     handle;
    int     i;
 
-   lbm = lbmptr = (byte *) SafeMalloc (65000);
+   lbm = lbmptr = (byte *) SafeMalloc ((iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT)+4000);
 
 //
 // start FORM
@@ -2916,7 +3038,8 @@
       ThreeDRefresh ();
    doublestep = 2 - DetailLevel;
 
-   buffer = (byte *) SafeMalloc (65000);
+   //buffer = (byte *) SafeMalloc (65000);
+   buffer = (byte *) SafeMalloc ((iGLOBAL_SCREENHEIGHT*iGLOBAL_SCREENWIDTH)+4000);
 
 #if (BETA == 1)
    if (SCREENSHOTS == false)
@@ -2949,10 +3072,13 @@
    }
 #endif
 
-   VL_CopyPlanarPageToMemory(screen,buffer);
 
+
    GetFileName (saveLBM);
    GetPathFromEnvironment( filename, ApogeePath, savename );
+   //   
+	memcpy(buffer,screen , iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT);//bna	
+   //bna--VL_CopyPlanarPageToMemory(screen,buffer);
 
    if (saveLBM)
    {
@@ -3003,15 +3129,15 @@
 
    pcxHDR.bitsperpixel  = 8;           //bpp;
    pcxHDR.xmin          = pcxHDR.ymin = 0;
-   pcxHDR.xmax          = 319;         //bitmap->box.w - 1;
-   pcxHDR.ymax          = 199;         //bitmap->box.h - 1;
-   pcxHDR.hres          = 320;         //N_COLUMNS;
-   pcxHDR.vres          = 200;         //N_LINES;
+   pcxHDR.xmax          = iGLOBAL_SCREENWIDTH - 1;
+   pcxHDR.ymax          = iGLOBAL_SCREENHEIGHT - 1;
+   pcxHDR.hres          = iGLOBAL_SCREENWIDTH;         //N_COLUMNS;
+   pcxHDR.vres          = iGLOBAL_SCREENHEIGHT;         //N_LINES;
 
   // bytesperline doesn't take into account multiple planes.
   // Output in same format as bitmap (planar vs packed).
   //
-   pcxHDR.bytesperline  = 320;         //bitmap->width;
+   pcxHDR.bytesperline  = iGLOBAL_SCREENWIDTH;         //bitmap->width;
 
    pcxHDR.nplanes       = 1;           //bitmap->planes;
    pcxHDR.reserved      = 0;
@@ -3032,15 +3158,15 @@
 
    SafeWrite (pcxhandle, &buffer1, GAP_SIZE);
 
-   tempbuffer = (byte *) SafeMalloc (65000);
+   tempbuffer = (byte *) SafeMalloc ((iGLOBAL_SCREENHEIGHT*iGLOBAL_SCREENWIDTH)+4000);
    bptr = tempbuffer;
    totalbytes = 0;
 
   //
   // Write to a bit-packed file.
   //
-	for (y = 0;  y < 200;  ++y) 		// for each line in band
-		if (PutBytes (((unsigned char *) (source+(y*320))),
+	for (y = 0;  y < iGLOBAL_SCREENHEIGHT;  ++y) 		// for each line in band
+		if (PutBytes (((unsigned char *) (source+(y*iGLOBAL_SCREENWIDTH))),
 						  pcxHDR.bytesperline))
          Error ("Error writing PCX bit-packed line!\n");
 

Modified: trunk/rott/rt_map.c
===================================================================
--- trunk/rott/rt_map.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_map.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -644,9 +644,9 @@
 #endif
 
 #ifdef DOS
-      for (mapy=0;mapy<mapheight;mapy++,buf+=SCREENBWIDE)
+      for (mapy=0;mapy<mapheight;mapy++,buf+=iGLOBAL_SCREENBWIDE)
 #else
-      for (mapy=0;mapy<mapheight;mapy++,buf+=MAXSCREENWIDTH)
+      for (mapy=0;mapy<mapheight;mapy++,buf+=iGLOBAL_SCREENWIDTH)
 #endif
          {
          if ((mapx==player->tilex ) && (mapy==player->tiley))
@@ -898,6 +898,7 @@
    int quitkey;
    ControlInfo control;
 
+StrechScreen = true;//bna++
 
    ShutdownClientControls();
 
@@ -1035,6 +1036,16 @@
      else if (y<-(yscale<<15))
         y=-(yscale<<15);
      }
+
+  if ( playstate == ex_stillplaying )	  {//bna++
+	   pic_t *shape;
+	   shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
+	   DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );//bna++
+	   StrechScreen=false;//dont strech when we go BACK TO GAME
+	   VW_UpdateScreen ();
+	   DrawPlayScreen(true);//repaint ammo and life stat
+
+  }
    while (Keyboard[quitkey])
       IN_UpdateKeyboard ();
 

Modified: trunk/rott/rt_menu.c
===================================================================
--- trunk/rott/rt_menu.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_menu.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -132,6 +132,8 @@
 
 int quicksaveslot=-1;
 
+extern char *tmpPICbuf;
+
 //******************************************************************************
 //
 // LOCALS
@@ -715,18 +717,22 @@
    {
    "CONTROLS",
    "USER OPTIONS",
+   "EXT USER OPTIONS",//bna added
    "MUSIC VOLUME",
    "SOUND FX VOLUME"
+
    };
+CP_iteminfo ControlMItems = {32, 48-8, 5, 0, 32, ControlMMenuNames, mn_largefont };//bna added
+//CP_iteminfo ControlMItems = {32, 48, 4, 0, 32, ControlMMenuNames, mn_largefont };
 
-CP_iteminfo ControlMItems = {32, 48, 4, 0, 32, ControlMMenuNames, mn_largefont };
-
 CP_itemtype ControlMMenu[] =
 {
    {2, "cntl\0",     'C', (menuptr)CP_Control},
    {1, "uopt\0",     'U', (menuptr)CP_OptionsMenu},
+   {1, "euopt\0", 'E', (menuptr)CP_ExtOptionsMenu},//bna added
    {1, "muvolumn\0", 'M', (menuptr)MusicVolume},
    {1, "fxvolumn\0", 'S', (menuptr)FXVolume}
+
 };
 
 CP_MenuNames OptionsNames[] =
@@ -741,7 +747,27 @@
    "VIOLENCE LEVEL",
    "SCREEN SIZE"
    };
+//bna added
+CP_MenuNames ExtOptionsNames[] =
+   {
+   "MOUSELOOK",
+   "INVERSE MOUSE",
+   "CROSS HAIR",
+   "JUMPING"
 
+   };
+CP_iteminfo ExtOptionsItems = { 20, MENU_Y, 4, 0, 43, ExtOptionsNames, mn_largefont };
+
+CP_itemtype ExtOptionsMenu[] =
+{
+   {1, "", 'M', NULL},
+   {1, "", 'I', NULL},
+   {1, "", 'C', NULL},
+   {1, "", 'J', NULL}
+};
+   
+//bna added end
+
 CP_iteminfo OptionsItems = { 20, MENU_Y, 9, 0, 43, OptionsNames, mn_largefont };
 
 CP_itemtype OptionsMenu[] =
@@ -1479,11 +1505,26 @@
    byte * b;
    byte * s;
 
+//   int Xres = 320;//org
+//   int Yres = 200;//org
+   int Xres = 640;
+   int Yres = 400;
+
+   //dont work in 800x600 until we get a better screen schrinker
+  //  int Xres = iGLOBAL_SCREENWIDTH;//640;
+ //  int Yres = iGLOBAL_SCREENHEIGHT;//400;
+
+  Xres = 640;
+   Yres = 400;
+
+
+
    // Save the current game screen
 
-   savedscreen = SafeMalloc (16000);
+   //bna--savedscreen = SafeMalloc (16000);
+   savedscreen = SafeMalloc (16000*8);
 
-   // Copy the current screen to this buffer
+   // Copy the current save game screen (½ size) to this buffer
 
    if (RefreshPause==false)
       {
@@ -1493,21 +1534,35 @@
       FlipPage();
       GamePaused=true;
       }
+
+
    s=savedscreen;
-   for (i=0;i<320;i+=2)
-      {
-#ifdef DOS
-      VGAREADMAP(i&3);
-      b=(byte *)bufferofs+(i>>2);
-      for (j=0;j<100;j++,s++,b+=SCREENBWIDE<<1)
-         *s=*b;
-#else
-      b=(byte *)bufferofs+i;
-      for (j=0;j<100;j++,s++,b+=(MAXSCREENWIDTH<<1))
-         *s=*b;
-#endif
-      }
 
+
+    
+	  if (iGLOBAL_SCREENWIDTH == 320) { 
+		  for (i=0;i<Xres;i+=2)	{	  
+			  b=(byte *)bufferofs+i;
+			  for (j=0;j<100;j++,s++,b+=(iGLOBAL_SCREENWIDTH<<1))
+				 *s=*b;
+		  }
+	  }	  
+	  if (iGLOBAL_SCREENWIDTH >= 640) { 
+		  for (i=0;i<Xres;i+=4)	{		  
+			  b=(byte *)bufferofs+i;//schrink screen to 1/2 size
+			  for (j=0;j<(Yres/4);j++,s++,b+=(iGLOBAL_SCREENWIDTH<<1)*2)
+				 *s=*b;
+			  }
+	  }/*
+      if (iGLOBAL_SCREENWIDTH == 800) { 	 
+		  for (i=0;i<Xres;i+=8)		{	  
+			  b=(byte *)bufferofs+i;//schrink screen to 1/3 size
+			  for (j=0;j<(Yres/8);j++,s++,b+=(iGLOBAL_SCREENWIDTH<<1)*3)
+				 *s=*b;
+		  }
+
+      }*/
+
    ScanForSavedGames ();
 
 
@@ -1700,8 +1755,9 @@
 
    numdone = 0;
    StartGame = false;
-
+ 
    SetUpControlPanel();
+   StrechScreen=true;
    //
    // F-KEYS FROM WITHIN GAME
    //
@@ -1786,6 +1842,8 @@
    // Main menu loop.  "Exit options" or "New game" exits
    //
    StartGame = false;
+   StrechScreen=true;
+
    while( !StartGame )
       {
       StartGame = false;
@@ -1803,6 +1861,7 @@
                }
 
             StartGame = true;
+			StrechScreen=false;//bna++ shut off streech mode
             break;
 
          case -1:
@@ -1832,10 +1891,10 @@
 //******************************************************************************
 
 void DrawMainMenu(void)
-{
+{    
 
    MenuNum = 1;
-
+		StrechScreen=true;//bna++ shut off streech mode
    //
    // CHANGE "GAME" AND "DEMO"
    //
@@ -2565,14 +2624,17 @@
    int key;
    boolean newpage;
 
+
+
    maxpage = W_GetNumForName( "ORDRSTOP" ) - W_GetNumForName( "ORDRSTRT" ) - 2;
    newpage = false;
    page = 1;
 
    do
       {
+	  StrechScreen=true;//bna++
       DrawOrderInfo( page );
-
+	  StrechScreen=false;//bna++ turn off or screen will be strected every time it passes VW_UpdateScreen
       if ( newpage )
          {
          while( Keyboard[ key ] )
@@ -2637,7 +2699,7 @@
 
    Keyboard[ key ] = 0;
    LastScan = 0;
-
+ StrechScreen=true;//bna++
    MN_PlayMenuSnd( SD_ESCPRESSEDSND );
    }
 
@@ -3111,7 +3173,10 @@
 
    gamestate.battlemode = battle_StandAloneGame;
    StartGame = true;
+   StrechScreen=false;
    playstate = ex_resetgame;
+
+
    }
 
 //******************************************************************************
@@ -3136,6 +3201,7 @@
    action = CP_DisplayMsg( ENDGAMESTR, 12 );
 
    StartGame = false;
+   StrechScreen=true;
    if ( action )
       {
       EndGameStuff ();
@@ -3241,6 +3307,7 @@
       if (LoadTheGame (which, &game) == true)
       {
          MenuFixup ();
+		 StrechScreen=false;
          StartGame = true;
 			exit      = 1;
       }
@@ -3386,11 +3453,11 @@
 #ifdef DOS
       VGAREADMAP(i&3);
       b=(byte *)bufferofs+(i>>2);
-      for (j=0;j<100;j++,s++,b+=SCREENBWIDE<<1)
+      for (j=0;j<100;j++,s++,b+=iGLOBAL_SCREENBWIDE<<1)
          *s=*b;
 #else
       b=(byte *)bufferofs+i;
-      for (j=0;j<100;j++,s++,b+=(MAXSCREENWIDTH<<1))
+      for (j=0;j<100;j++,s++,b+=(iGLOBAL_SCREENWIDTH<<1))
          *s=*b;
 #endif
       }
@@ -4969,6 +5036,7 @@
 
 void DoMainMenu (void)
 {
+		StrechScreen=true;//bna++ shut on streech mode
    SetAlternateMenuBuf();
    ClearMenuBuf();
    DrawMainMenu();
@@ -5258,7 +5326,94 @@
    DisplayInfo (0);
    FlipMenuBuf();
 }
+//****************************************************************************
+//
+// DrawExtOptionsMenu ()  () bna added
+//
+//****************************************************************************
 
+void DrawExtOptionsMenu (void)
+{
+   MenuNum = 1;
+
+   SetAlternateMenuBuf();
+   ClearMenuBuf();
+   SetMenuTitle ("Extended User Options");
+
+   MN_GetCursorLocation( &ExtOptionsItems, &ExtOptionsMenu[ 0 ] );
+   DrawMenu (&ExtOptionsItems, &ExtOptionsMenu[0]);
+   DrawExtOptionsButtons ();
+   DisplayInfo (0);
+
+   FlipMenuBuf();
+}
+extern long inverse_mouse;
+extern boolean usemouselook;
+extern int iG_aimCross;
+extern boolean usejump;
+
+void CP_ExtOptionsMenu (void)
+{
+   int which;
+
+   DrawExtOptionsMenu();
+
+   do
+   {
+      which = HandleMenu (&ExtOptionsItems, &ExtOptionsMenu[0], NULL);
+
+      switch (which)
+      {
+         case 0: usemouselook  ^= 1; DrawExtOptionsButtons (); break;
+         case 1: if (inverse_mouse == 1){
+					inverse_mouse = -1;
+				 }else{
+					inverse_mouse = 1;
+				 }
+				 DrawExtOptionsButtons (); 
+				 break;
+         case 2: iG_aimCross   ^= 1; DrawExtOptionsButtons (); break;
+         case 3: usejump       ^= 1; DrawExtOptionsButtons (); break;
+      }
+
+	} while (which >= 0);
+
+   DrawControlMenu();
+}
+void DrawExtOptionsButtons (void)
+{
+   int i,
+       on;
+   int button_on;
+   int button_off;
+
+   button_on  = W_GetNumForName ("snd_on");
+   button_off = W_GetNumForName ("snd_off");
+
+   for (i = 0; i < ExtOptionsItems.amount; i++)
+      if (ExtOptionsMenu[i].active != CP_Active3)
+      {
+         //
+         // DRAW SELECTED/NOT SELECTED GRAPHIC BUTTONS
+         //
+
+         on = 0;
+
+         switch (i)
+         {
+            case 0: if (usemouselook  == 1) on = 1; break;
+            case 1: if (inverse_mouse == -1)on = 1; break;
+            case 2: if (iG_aimCross   == 1) on = 1; break;
+            case 3: if (usejump       == 1) on = 1; break;
+         }
+
+         if (on)
+            DrawMenuBufItem (20+22, ExtOptionsItems.y+i*14-1, button_on);
+         else
+            DrawMenuBufItem (20+22, ExtOptionsItems.y+i*14-1, button_off);
+		}
+}
+
 //****************************************************************************
 //
 // CP_OptionsMenu ()
@@ -5542,6 +5697,7 @@
             if ( status )
                {
                StartGame   = true;
+			      StrechScreen=false;
                handlewhich = -2;
                playstate   = ex_resetgame;
                BATTLEMODE  = true;
@@ -6996,13 +7152,12 @@
 
 #endif
 
-void CP_ModemGameMessage
-   (
-   int player
-   )
+void CP_ModemGameMessage (int player  )
 
    {
    int i;
+    StrechScreen=true;
+       // SetTextMode (  );
 
 	SetAlternateMenuBuf();
    ClearMenuBuf();
@@ -7053,6 +7208,8 @@
 
    FlipMenuBuf();
 	RefreshMenuBuf (0);
+
+	 StrechScreen=false;
    }
 
 

Modified: trunk/rott/rt_msg.c
===================================================================
--- trunk/rott/rt_msg.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_msg.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -335,7 +335,13 @@
    int length;
    boolean found;
 
+   if (iGLOBAL_SCREENWIDTH >= 640){
+		CurrentFont = newfont1;//smallfont;
+   }else{
+		CurrentFont = smallfont;
+   }
 
+
    length = StringLength( text );
 
    Messages[ num ].active = 1;
@@ -460,16 +466,16 @@
 ====================
 */
 
-void DisplayMessage
-   (
-   int num,
-   int position
-   )
-
+void DisplayMessage   (int num,int position)
    {
    PrintX = 1;
-   PrintY = 2 + ( position * 9 );
+   if (iGLOBAL_SCREENWIDTH > 320){
+		PrintY = 2 + ( position * (9*2) );
+   }else{
+		PrintY = 2 + ( position * (9*1) );
+   }
 
+
    if ( SHOW_TOP_STATUS_BAR() )
       {
       PrintY += 16;
@@ -509,7 +515,14 @@
       case MSG_MODEM:
          fontcolor = egacolor[ LIGHTBLUE ];
          DrawIString( PrintX, PrintY, "Message>", Messages[ num ].flags );
-         PrintX += 8 * 8;
+		 if ( iGLOBAL_SCREENWIDTH == 320) {
+			PrintX += 8 * 8;
+		 }else if ( iGLOBAL_SCREENWIDTH == 640) {
+			PrintX += 8 * 8*2;
+		 }else if ( iGLOBAL_SCREENWIDTH == 800) {
+			PrintX += 8 * 8*2;
+		 }
+
          fontcolor = egacolor[ LIGHTGRAY ];
          break;
 
@@ -572,8 +585,14 @@
             EraseMessage[ i ]--;
             if ( viewsize < 15 )
                {
-               shape = W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
-               DrawTiledRegion( 0, y, 320, 9, 0, y, shape );
+               shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );//w=32 h=8
+			   	   //SetTextMode (  );
+               //DrawTiledRegion( 0, y, 320, 9, 0, y, shape );KILLS_HEIGHT bna--
+				DrawTiledRegion( 0, y, iGLOBAL_SCREENWIDTH, 9, 0, y, shape );
+				DrawTiledRegion( 0, y+8, iGLOBAL_SCREENWIDTH, 9, 0, y, shape );
+				DrawTiledRegion( 0, y+16, iGLOBAL_SCREENWIDTH, 9, 0, y, shape );
+
+               //DrawTiledRegion( 0, y, iGLOBAL_SCREENWIDTH, 212, 0, y, shape );
                }
             if ( viewsize == 0 )
                {

Modified: trunk/rott/rt_playr.c
===================================================================
--- trunk/rott/rt_playr.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_playr.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -71,6 +71,9 @@
 #include "rt_str.h"
 #endif
 
+extern boolean usejump;
+
+
 specials CurrentSpecialsTimes =
       {
       60*VBLCOUNTER, // god
@@ -251,6 +254,7 @@
 void     PlayerMissileAttack(objtype* );
 void     Cmd_Use(objtype*);
 //void     ComError (char *error, ...);
+int      FinddTopYZANGLELIMITvalue(objtype *ob);
 
 statetype s_free = {false,0,0,T_Free,0,&s_free};
 statetype s_inelevator = {false,0,420,T_Player,0,&s_player};
@@ -1546,6 +1550,12 @@
 ===============
 */
 
+boolean AreJumping = false;//bna added
+int		oldzval;
+int donttilt=0;
+
+
+
 void Cmd_Use (objtype*ob)
 {
    int             checkx,checky,doorn,
@@ -1634,6 +1644,27 @@
    if (doorn == (elevatorstart + 6))
       return;
 
+   //bna ++ jumpmode
+   //SetTextMode (  );
+   if (!BATTLEMODE){//dont use jump in battle, spoils sync
+   if (usejump == true){
+   if (pstate->buttonheld[bt_use]){
+   if ((AreJumping == false)&&(ob->z > 0)&&(doorn==0)){
+	    oldzval = ob->z;
+		ob->z -= 15;
+		ob->momentumz += GRAVITY;
+		AreJumping = true;
+		donttilt=10;
+		return;
+   } 
+		AreJumping = false;
+		return;
+   }
+   }
+   }
+   //bna 
+
+
    if (pstate->buttonheld[bt_use])
       return;
 
@@ -1799,8 +1830,28 @@
 
          }
       }
-   else if ((tempwall) && (tempwall->which == WALL) && (ob==player))
+   else if ((tempwall) && (tempwall->which == WALL) && (ob==player)){
       PlayNoWaySound();
+   	  //bna ++ jumpmode
+   //SetTextMode (  );
+   if (!BATTLEMODE){//dint use jump in battle, spoils sync
+   if (usejump == true){
+   if (pstate->buttonheld[bt_use]){
+   if ((AreJumping == false)&&(ob->z > 0)&&(doorn==0)){
+	    oldzval = ob->z;
+		ob->z -= 15;
+		ob->momentumz += GRAVITY;
+		AreJumping = true;
+		donttilt=10;
+		return;
+   } 
+		AreJumping = false;
+		return;
+   }
+   }
+   }
+	  //bna 
+	  }
 //      else
 //         SD_PlaySoundRTP (SD_NOWAYSND,ob->x,ob->y);
 //   pstate->buttonheld[bt_use] = true;
@@ -1843,7 +1894,7 @@
 // PollMouseButtons
 //
 //******************************************************************************
-
+extern boolean usemouselook;
 void PollMouseButtons (void)
    {
    int i;
@@ -1859,12 +1910,22 @@
       press = buttons & mask;
 
       if ( press )
-         {
+         {//SetTextMode (  );
 //         if ( ( buttonmouse[ i ] != bt_nobutton ) &&
 //            ( DoubleClickCount[ i ] != 2 ) )
          if ( buttonmouse[ i ] != bt_nobutton )
             {
             buttonpoll[ buttonmouse[ i ] ] = true;
+			//bna added
+			if ((i == 1)&&(usemouselook == true)){
+			//if rightclick set horizon to 512 (normall)
+				playertype * pstate;
+				pstate=&PLAYERSTATE[consoleplayer];
+				pstate->horizon = 512;
+				// SetNormalHorizon(PLAYER[0]);
+			}
+			//bna added
+
             }
          }
 
@@ -2116,7 +2177,7 @@
 //#define MOUSE_RY_SHIFT 12
 //#define MOUSE_TZ_SHIFT 3
 #define MOUSE_TZ_SENSITIVITY_SCALE 65535
-#define MOUSE_RY_SENSITIVITY_SCALE 18725
+#define MOUSE_RY_SENSITIVITY_SCALE 18725*2
 //#define MOUSE_RY_INPUT_SCALE 6000
 #define MOUSE_TZ_INPUT_SCALE 20
 int mouse_ry_input_scale = 5000;
@@ -2125,17 +2186,36 @@
     {
     0,1,2,3,4,5,6,8,11,13,15,18,12,13,14
     };
-
 //#define MOUSE_RY_SCALE 65535
-
 //#define MOUSE_TZ_SCALE 65535
 #define MAXMOUSETURN 7000000
 
+/* use SDL mouse */
+#define USESDLMOUSE 1
+
+
+extern int inverse_mouse;
+ double Y_MouseSpeed=70;
+
 void PollMouseMove (void)
 {
    int  mousexmove, mouseymove;
+   double Ys;
+//SetTextMode();
 
+   Ys=(Y_MouseSpeed/100);
+//
+
+// const long inverse_mouse  = 1; //set  to -1 to invert mouse
+// inverse_mouse def moved to RT_CFG.C
+
+#ifdef USESDLMOUSE
    INL_GetMouseDelta(&mousexmove, &mouseymove);
+#else
+   PollMouse();//Uses DirectInput mouse in DInput.cpp
+   mousexmove=MX;
+   mouseymove=MY;
+#endif
 
    if (abs(mousexmove)>abs(mouseymove))
       mouseymove/=2;
@@ -2146,31 +2226,60 @@
 
 
    if ((abs (mouseymove)) >= threshold)
-      {
+      {//
       MY =  MOUSE_TZ_INPUT_SCALE*mouseymove;
+	  MY *= inverse_mouse;
+	  if (usemouselook == true){
+		  if (MY > 0){
+				playertype * pstate;
+				pstate=&PLAYERSTATE[consoleplayer];
+				//if (pstate->horizon > 512){
+					pstate->horizon -= Ys * (2*sensitivity_scalar[mouseadjustment]);
+				//}
+		  }
+		  else if (MY < 0){
+		  		playertype * pstate;
+				pstate=&PLAYERSTATE[consoleplayer];
+				//SetTextMode (  );
+				pstate->horizon += Ys * (2*sensitivity_scalar[mouseadjustment]);
+				//buttonpoll[ bt_horizonup ] = true;
+		  }
+		  MY = 0;
+	  }else{
+		 // MY += FixedMul(MY,mouseadjustment*MOUSE_TZ_SENSITIVITY_SCALE);
+		  if (abs(mouseymove)>200)
+			 {
+			 buttonpoll[bt_run]=true;
+			 // buttonpoll[ bt_lookup ] = true;
+			 }
+		  }
+	  }
 
-     // MY += FixedMul(MY,mouseadjustment*MOUSE_TZ_SENSITIVITY_SCALE);
-      if (abs(mouseymove)>200)
-         {
-         buttonpoll[bt_run]=true;
-         }
-      }
 
+
+		 
+
    if ((abs (mousexmove)) >= threshold)
-      {
+   {
       //MX = -MOUSE_RY_INPUT_SCALE*mousexmove;
       MX = -mouse_ry_input_scale*mousexmove;
       MX += FixedMul(MX,sensitivity_scalar[mouseadjustment]*MOUSE_RY_SENSITIVITY_SCALE);
    //   if (abs(MX) > MAXMOUSETURN)
      //   MX = MAXMOUSETURN*SGN(MX);
-      if (abs(mouseymove)>10)
-         {
-         buttonpoll[bt_run]=true;
-         }
-      }
-
+	  if (usemouselook == true){
+		  if (abs(mouseymove)>10)
+		  {
+			 buttonpoll[bt_run]=true;
+			  //buttonpoll[ bt_lookdown ] = true;
+		  }
+	  }
+   }
 //   if (MY > 0)
 //      MX -= (MX/2);
+
+//   MX=0;
+//   MY=0;
+
 }
 
 
@@ -2853,9 +2962,26 @@
          AddPauseStateCommand(COM_PAUSE);
          }
       }
-	if (Keyboard[sc_Insert] && Keyboard[sc_X])
-      AddExitCommand();
+   if (Keyboard[sc_Insert] && Keyboard[sc_X]){
+	      AddExitCommand();
+   }
+//bna section
+   if (Keyboard[sc_5]){
+	//	 SetTextMode (  );
+      weaponscale +=  1000;
+	  //testval++;
+   }
+   if (Keyboard[sc_6]){
+	//	 SetTextMode (  );
+      weaponscale -=  1000;
+	  	//  testval--;
+   }
+//bna section end 
 
+
+
+
+
    for (i = (NUMTXBUTTONS-1); i >= 0; i--)
       {
       buttonbits <<= 1;
@@ -3761,15 +3887,23 @@
 
    index = touchindices[ob->tilex][ob->tiley];
 	if (index && (abs(ob->z - nominalheight) < 5))
-	 {if (!TRIGGER[index-1])
-		{if (touchplate[index-1]->complete)
-			SD_PlaySoundRTP(SD_BADTOUCHSND,ob->x,ob->y);
-		 else
-         {
-         SD_PlaySoundRTP(SD_TOUCHPLATESND,ob->x,ob->y);
-         if (ob == player)
-            AddMessage("Touchplate triggered.",MSG_GAME);         }
-		}
+	 {if (!TRIGGER[index-1]){
+#if (BNACRASHPREVENT == 1)
+		if (touchplate[index-1] != 0) { //	CRASH IN SHAREWARE 'ride em cowboy' BNA FIX
+			 //SetTextMode (  ); qwert  // DONT ALLOW BAD touchplate ( == 0 ) see rt_door.c
+#endif
+			 if (touchplate[index-1]->complete)
+				SD_PlaySoundRTP(SD_BADTOUCHSND,ob->x,ob->y);
+			 else {
+				SD_PlaySoundRTP(SD_TOUCHPLATESND,ob->x,ob->y);
+				if (ob == player)
+					AddMessage("Touchplate triggered.",MSG_GAME);  
+			 }
+#if (BNACRASHPREVENT == 1)
+		}else{SD_PlaySoundRTP(SD_BADTOUCHSND,ob->x,ob->y);} 
+		//	CRASH IN SHAREWARE 'ride em cowboy' BNA FIX
+#endif
+	}
 	  TRIGGER[index-1] = 1;
 	 }
 
@@ -4022,13 +4156,20 @@
 =
 ===================
 */
-
+extern int iG_playerTilt;
+extern double dTopYZANGLELIMIT;
 void PlayerTiltHead (objtype * ob)
 {
 	playertype * pstate;
    int dyz=0;
    int yzangle;
 
+//bna++   jumpmode
+  if ((donttilt > 0)){
+	  donttilt--;
+	  return;
+  }
+
 	M_LINKSTATE(ob,pstate);
 
    yzangle=ob->yzangle+HORIZONYZOFFSET;
@@ -4158,22 +4299,139 @@
       if ((abs(yzangle-pstate->horizon))<SNAPBACKSPEED)
          yzangle=pstate->horizon;
       }
+//SetTextMode();
+
+	if (yzangle != 512){
+		FinddTopYZANGLELIMITvalue(ob);
+	}
+
+
    yzangle+=dyz;
    if (yzangle-HORIZONYZOFFSET>YZANGLELIMIT)
        yzangle=HORIZONYZOFFSET+YZANGLELIMIT;
-   else if (yzangle-HORIZONYZOFFSET<-YZANGLELIMIT)
-       yzangle=HORIZONYZOFFSET-YZANGLELIMIT;
-
+/*   else if (yzangle-HORIZONYZOFFSET<-TopYZANGLELIMIT)//bnafix
+       yzangle=HORIZONYZOFFSET-TopYZANGLELIMIT;//bnafix
+dTopYZANGLELIMIT*/
+   else if (yzangle-HORIZONYZOFFSET<-dTopYZANGLELIMIT)//bnafix
+       yzangle=HORIZONYZOFFSET-dTopYZANGLELIMIT;//bnafix
    ob->yzangle=yzangle-HORIZONYZOFFSET;
    Fix(ob->yzangle);
+
+   iG_playerTilt = ob->yzangle;
+
 }
 
+//----------------------------------------------------------------------
+// bna added function
+// if a player is to close to wall, looking down max
+//,this func limit the dTopYZANGLELIMIT value when
+// facing a wall 
+#define SMALLANGLE 90
+//there is small angles where didnt work
+//so we check for them to = 90/2048 = aprox, 15 degrees
+int FinddTopYZANGLELIMITvalue(objtype *ob)
+{/*
+
+
+checkx = ob->tilex + 1;
+checky = ob->tiley + 1;
+if (actorat[checkx][checky]){
+	return 0;
+}
+return 1;
+
+checkx = ob->tilex ;
+checky = ob->tiley;
+
+// find which direction the player is facing
+//and check if it is a wall
+
+*/
+
+   //use lowest down angle		   	   	
+	dTopYZANGLELIMIT = (26*FINEANGLES/360);
+   
+	if (ob->angle < 256 || ob->angle > 1792) {
+	   if ((tilemap[ob->tilex + 1][ob->tiley])!=0){
+
+			return 0;
+	   }
+       //ob->dir = east;
+   }else if (ob->angle < 768) {
+	   if ((tilemap[ob->tilex][ob->tiley-1])!=0){
+			return 0;
+	   }
+   }else if (ob->angle < 1280) {
+	   if ((tilemap[ob->tilex-1][ob->tiley])!=0){
+			return 0;
+	   }
+   }else{
+	   if ((tilemap[ob->tilex][ob->tiley+1])!=0){
+			return 0;
+	   }
+   }
+
+
+   //use middle down angle
+   dTopYZANGLELIMIT = (42*FINEANGLES/360);
+
+   if ((ob->angle > 768-SMALLANGLE)&&(ob->angle <= 768)) { 
+   	   if ((tilemap[ob->tilex -1][ob->tiley])!=0){//ob->tiley-1
+			return 0;
+	   }
+   }
+   if ((ob->angle < 1280+SMALLANGLE)&&(ob->angle >= 1280)) { 
+   	   if ((tilemap[ob->tilex - 1][ob->tiley])!=0){//ob->tiley+1
+			return 0;
+	   }
+   } 
+   if ((ob->angle > 256)&&(ob->angle <= 256+SMALLANGLE)) { 
+   	   if ((tilemap[ob->tilex + 1][ob->tiley])!=0){//ob->tiley-1
+			return 0;
+	   }
+   }   
+   if ((ob->angle < 1792)&&(ob->angle >= 1792-SMALLANGLE)) { 
+   	   if ((tilemap[ob->tilex + 1][ob->tiley])!=0){//ob->tiley+1
+			return 0;
+	   }
+   } 
+   if ((ob->angle < 1280)&&(ob->angle >= 1280-SMALLANGLE)) { 
+   	   if ((tilemap[ob->tilex ][ob->tiley+1])!=0){//ob->tilex-1
+			return 0;
+	   }
+   } 
+   if ((ob->angle > 1792)&&(ob->angle <= 1792+SMALLANGLE)) { 
+   	   if ((tilemap[ob->tilex ][ob->tiley+1])!=0){//ob->tiley+1
+			return 0;
+	   }
+   } 
+   if ((ob->angle > 768)&&(ob->angle <= 768+SMALLANGLE)) { 
+   	   if ((tilemap[ob->tilex][ob->tiley-1])!=0){//ob->tiley-1
+			return 0;
+	   }
+   }
+   if ((ob->angle < 256)&&(ob->angle >= 256-SMALLANGLE)) { 
+   	   if ((tilemap[ob->tilex][ob->tiley-1])!=0){//ob->tiley-1
+			return 0;
+	   }
+   }
+
+   //use max down angle
+   dTopYZANGLELIMIT = (90*FINEANGLES/360);
+   return 1;
+}
+// bna added function end
+//----------------------------------------------------------------------
+
+
+
+
 /*
 ===================
 =
 = UpdatePlayers
 =
-===================
+=================== QWERTYU
 */
 void UpdatePlayers ( void )
 {
@@ -4182,6 +4440,11 @@
 
 	for (obj = FIRSTACTOR; obj->obclass==playerobj; obj = obj->next)
 		 {
+
+//ErrorDontQuit("obj->next = ",obj->next);
+#if (BNACRASHPREVENT == 1)//crashed here when oscuro and larves were all killed
+		if (obj->next == 0){return;}
+#endif
        obj->speed=FindDistance(obj->momentumx, obj->momentumy);
 //       M_LINKSTATE(obj,pstate);
 //       pstate->steptime-=obj->speed;

Modified: trunk/rott/rt_scale.c
===================================================================
--- trunk/rott/rt_scale.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_scale.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -1107,18 +1107,26 @@
 =
 =================
 */
+extern int G_gmasklump;
 void DrawScreenSizedSprite (int lump)
 {
-   byte *shape;
+	//draws gasmask among other things zxcv
+   byte *shape,*src;
    int      frac;
    patch_t *p;
    int      x1,x2;
    int      tx;
-   int      plane;
+//   int      plane;
    byte * b;
    int    startfrac;
 
+   int  offset;
+   int  length;
+   int  topscreen;
+   int  bottomscreen;
+   byte  *cnt,*Ycnt;
 
+  // SetTextMode (  );
    whereami=39;
    shadingtable=colormap+(1<<12);
    shape=W_CacheLumpNum(lump,PU_CACHE, Cvt_patch_t, 1);
@@ -1126,6 +1134,7 @@
    dc_invscale=(viewwidth<<16)/p->origsize;
    tx=-p->leftoffset;
    centeryclipped=viewheight>>1;
+   //centeryclipped=(viewheight>>1)+43;
 //
 // calculate edges of the shape
 //
@@ -1149,27 +1158,43 @@
 
    startfrac=0;
 
-#ifdef DOS
-   for (plane=0;plane<4;plane++,startfrac+=dc_iscale)
-#endif
-
       {
       frac=startfrac;
-
-#ifdef DOS
-      b=(byte *)bufferofs+(plane>>2);
-      VGAWRITEMAP(plane&3);
-#else
       b=(byte *)bufferofs;
-#endif
 
-#ifdef DOS
-      for (x1=plane;x1<=x2;x1+=4, frac += (dc_iscale<<2),b++)
-#else
+	  /////////////  BNA PATCH //////////////////////////////////////////////////////////
+	     //gmasklump=W_GetNumForName("p_gmask"); //=783
+	     //perhaps I should have painted the mask in a seperate buffer
+	     //and streched it and copyet it back, but that would demand
+	     //a new buffer (size=800x600) and slowed the game down so ?
+
+		 // if its the gasmask, paint black patches at hires
+		 if ((lump == G_gmasklump)&&(iGLOBAL_SCREENWIDTH>320)) { 
+			src = ((p->collumnofs[frac>>SFRACBITS])+shape);
+			offset=*(src++);
+			length=*(src++);
+			topscreen = sprtopoffset + (dc_invscale*offset);
+			bottomscreen = topscreen + (dc_invscale*length);
+			dc_yl = (topscreen+SFRACUNIT-1)>>SFRACBITS;//=41  viewheight=584
+			dc_yh = ((bottomscreen-1)>>SFRACBITS);//=540      viewwidth =800
+			//paint upper black patch in gasmask
+			for (cnt=b;cnt<b+viewwidth;cnt++){
+				for (Ycnt=cnt;Ycnt<cnt+(dc_yl*iGLOBAL_SCREENWIDTH);Ycnt+=iGLOBAL_SCREENWIDTH){
+				 *Ycnt = 36;
+				}
+			}
+			//paint lower black patch in gasmask
+			for (cnt=b+(dc_yh*iGLOBAL_SCREENWIDTH);cnt<b+(dc_yh*iGLOBAL_SCREENWIDTH)+viewwidth;cnt++){
+				for (Ycnt=cnt;Ycnt<b+(viewheight*iGLOBAL_SCREENWIDTH);Ycnt+=iGLOBAL_SCREENWIDTH){
+				 *Ycnt = 36;
+				}
+			}
+		 }
+      ///////////////////////////////////////////////////////////////////////////////////
       for (x1=0;x1<=x2;x1++, frac += dc_iscale,b++)
-#endif
+
          {
-         ScaleClippedPost(((p->collumnofs[frac>>SFRACBITS])+shape),b);
+             ScaleClippedPost(((p->collumnofs[frac>>SFRACBITS])+shape),b);
          }
       }
 }
@@ -1298,9 +1323,9 @@
    shape = W_CacheLumpNum (shapenum, PU_CACHE, Cvt_patch_t, 1);
    p = (patch_t *)shape;
 
-   if (((x-p->leftoffset)<0) || ((x-p->leftoffset+p->width)>320))
+   if (((x-p->leftoffset)<0) || ((x-p->leftoffset+p->width)>iGLOBAL_SCREENWIDTH))
       Error ("DrawNormalSprite: x is out of range x=%ld\n",x-p->leftoffset+p->width);
-   if (((y-p->topoffset)<0) || ((y-p->topoffset+p->height)>200))
+   if (((y-p->topoffset)<0) || ((y-p->topoffset+p->height)>iGLOBAL_SCREENHEIGHT))
       Error ("DrawNormalSprite: y is out of range y=%ld\n",y-p->topoffset+p->height);
 
    startx=x-p->leftoffset;
@@ -1344,8 +1369,9 @@
 	frac = dc_texturemid + (dc_yl-centery)*fracstep;
 
 	while (count--) {
+		//*dest = test++;
 		*dest = shadingtable[dc_source[(frac>>SFRACBITS)]];
-		dest += MAXSCREENWIDTH;
+		dest += iGLOBAL_SCREENWIDTH;
 		frac += fracstep;
 	}
 }
@@ -1363,7 +1389,7 @@
 	while (count--)
 	{
 		*dest = shadingtable[*dest];
-		dest += MAXSCREENWIDTH;
+		dest += iGLOBAL_SCREENWIDTH;
 	}
 }
 
@@ -1385,30 +1411,33 @@
 	fracstep <<= 10;
 
 	while (count--) {
+		//*dest = 6;
 		*dest = shadingtable[dc_source[(((unsigned)frac)>>26)]];
-		dest += MAXSCREENWIDTH;
+		dest += iGLOBAL_SCREENWIDTH;
 		frac += fracstep;
 	}
 }
 
 void R_DrawClippedColumn (byte * buf)
 {
-	// This is *NOT* 100% correct - DDOI
+	// This is *NOT* 100% correct - DDOI zxcv
 	int count;
 	int frac, fracstep;
 	byte *dest;
+//		byte *b;int y;
 
 	count = dc_yh - dc_yl + 1;
 	if (count < 0) return;
 
-	dest = buf + ylookup[dc_yl];
+   dest = buf + ylookup[dc_yl];
 
+
 	fracstep = dc_iscale;
 	frac = dc_texturemid + (dc_yl-centeryclipped)*fracstep;
 
 	while (count--) {
 		*dest = shadingtable[dc_source[(((unsigned)frac)>>SFRACBITS)]];
-		dest += MAXSCREENWIDTH;
+		dest += iGLOBAL_SCREENWIDTH;
 		frac += fracstep;
 	}
 }
@@ -1427,7 +1456,7 @@
 	while (count--)
 	{
 		*dest = (byte)color;
-		dest += MAXSCREENWIDTH;
+		dest += iGLOBAL_SCREENWIDTH;
 	}
 }
 

Modified: trunk/rott/rt_stat.c
===================================================================
--- trunk/rott/rt_stat.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_stat.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -1113,8 +1113,8 @@
 */
 
 
+int BaseMarkerZ;//bna++			
 
-
 void SpawnStatic (int tilex, int tiley, int mtype, int zoffset)
 {statobj_t * temp;
  boolean onetimer;
@@ -1345,6 +1345,10 @@
 		 }
 
 //=====================================================================//
+	//bna added
+	// BaseMarkerZ used to adjust height in s_basemarker1
+	// in SpawnNewObj(i,j,&s_basemarker1,inertobj); 
+	BaseMarkerZ=temp->z;//bna++	BaseMarkerZ = spawnz;
 
      PreCacheStaticFrames(temp);
 

Modified: trunk/rott/rt_str.c
===================================================================
--- trunk/rott/rt_str.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_str.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -100,14 +100,14 @@
       source = ((byte *)CurrentFont)+CurrentFont->charofs[ch];
       while (width--)
          {
-         if ((x>=0) && (x<MAXSCREENWIDTH))
+         if ((x>=0) && (x<iGLOBAL_SCREENWIDTH))
             {
             y=oy;
             VGAWRITEMAP(x&3);
             height = ht;
             while (height--)
                {
-               if ((y>=0) && (y<MAXSCREENHEIGHT))
+               if ((y>=0) && (y<iGLOBAL_SCREENHEIGHT))
                   {
                   if (*source>0)
 #ifdef DOS
@@ -1494,28 +1494,25 @@
 //
 //******************************************************************************
 
-void DrawIntensityChar
-   (
-   char ch
-   )
+void DrawIntensityChar  ( char ch )
+   {
 
-   {
    byte  pix;
-   int   width;
-   int   height;
+   int   px1,py1;
+   int   width,w1;
+   int   height,h1;
    int   ht;
-   byte  *source;
+   byte  *source,*src1;
    byte  *dest;
-   byte  *origdest;
+   byte  *origdest,*orgdst1;
    int   mask;
 
+   px1 = px;py1 = py;
+
    ht = IFont->height;
 
-#ifdef DOS
-   origdest = ( byte * )( bufferofs + ylookup[ py ] + ( px >> 2 ) );
-#else
    origdest = ( byte * )( bufferofs + ylookup[ py ] + px );
-#endif
+
    dest = origdest;
 
    ch -= 31;
@@ -1524,39 +1521,64 @@
 
    mask = 1 << ( px & 3 );
 
-   while( width-- )
-      {
-      VGAMAPMASK( mask );
+   if ((iGLOBAL_SCREENWIDTH <= 320)||(StrechScreen == true)){
+	   while( width-- )
+	   {
+		  VGAMAPMASK( mask );
 
-      height = ht;
-      while( height-- )
-         {
-         pix = *source;
-         if ( pix != 0xFE )
-            {
-            *dest = GetIntensityColor( pix );
-            }
+		  height = ht;
+		  while( height-- )
+			 {
+			 pix = *source;
+			 if ( pix != 0xFE )
+				{
+				*dest = GetIntensityColor( pix );
+				}
 
-         source++;
-         dest += linewidth;
-         }
+			 source++;
+			 dest += linewidth;
+			 }
 
-      px++;
-#ifdef DOS
-      mask <<= 1;
-      if ( mask == 16 )
-         {
-         mask = 1;
-         origdest++;
-         }
-#else
-      origdest++;
-#endif
-      dest = origdest;
-      }
-   }
+		  px++;
+		  origdest++;
+		  dest = origdest;
+	   }
+	}else{//strech letter in x any direction
+	   w1 = width;
+	   h1 = ht;
+	   orgdst1 = origdest;
+	   src1 = source;
+	   while( width-- )
+	   {
+		  VGAMAPMASK( mask );
 
+		  height = ht;
+		  while( height-- )
+			 {
+			 pix = *source;
+			 if ( pix != 0xFE )
+				{
+				*dest = GetIntensityColor( pix );
+				*(dest+iGLOBAL_SCREENWIDTH) = GetIntensityColor( pix );
 
+				*(dest+1) = GetIntensityColor( pix );
+				*(dest+1+iGLOBAL_SCREENWIDTH) = GetIntensityColor( pix );
+				}
+
+			 source++;
+			 dest += linewidth*2;
+			 }
+
+		  px++;px++;
+		  origdest++;origdest++;
+		  dest = origdest;
+	   }
+
+	}
+
+}
+
+
 //******************************************************************************
 //
 // GetColor ()
@@ -1614,14 +1636,33 @@
                temp = *string++;
                temp = toupper (temp);
 
-               // Force fontcolor to a specific color
+               // Force fontcolor to a specific color egacolor[ RED ];
                if (temp == 'N')
                {
                   temp         = *string++;
                   fontcolor    = GetColor (temp);
                   oldfontcolor = fontcolor;
                }
-
+			   //bna added
+               else if (temp == 'X')
+               {
+				  temp         = *string;
+                  fontcolor    = egacolor[ RED ];
+                  oldfontcolor = fontcolor;
+               }
+               else if (temp == 'Y')
+               {
+				   temp         = *string;
+                  fontcolor    = egacolor[ YELLOW ];
+                  oldfontcolor = fontcolor;
+               }
+               else if (temp == 'Z')
+               {
+				   temp         = *string;
+                  fontcolor    = egacolor[ GREEN ];
+                  oldfontcolor = fontcolor;
+               }
+			   //bna added end
                // Restore fontcolor to a previous color
                else if (temp == 'O')
                {

Modified: trunk/rott/rt_ted.c
===================================================================
--- trunk/rott/rt_ted.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_ted.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -74,8 +74,10 @@
 // GLOBAL VARIABLES
 //========================================
 
+extern char *tmpPICbuf;
+extern int  iXmas;
+extern boolean  UseBaseMarker;
 
-
 teamtype TEAM[MAXPLAYERS];
 int numareatiles[NUMAREAS+1];
 int shapestart,shapestop;
@@ -1141,6 +1143,23 @@
    int ticdelay;
    byte *tempbuf;
 
+   double Gs;
+   Gs = (iGLOBAL_SCREENWIDTH*100/320);
+   Gs = Gs / 100;
+
+//SetTextMode (  );
+
+/*
+#define  PRECACHEBARX 28
+#define  PRECACHEBARY 178
+
+#define  PRECACHELED1X 9
+#define  PRECACHELED1Y 8
+
+#define  PRECACHELED2X 9
+#define  PRECACHELED2Y 12
+*/
+
 #if defined(PLATFORM_MACOSX) || defined(__sparc__)
 #warning "Precaching is disabled. Fix."
 // Precaching confuses the byteswapping code, since we have
@@ -1177,18 +1196,47 @@
          newheap=Z_UsedHeap();
 			currentmem=(newheap*MAXLEDS)/maxheapsize;
          while (lastmem<=currentmem)
-            {
-            DrawNormalSprite (PRECACHEBARX+PRECACHELED1X+(lastmem<<2),
+            {//SetTextMode (  );
+   			if ( iGLOBAL_SCREENWIDTH == 320) {
+				DrawNormalSprite (PRECACHEBARX+PRECACHELED1X+(lastmem<<2),
                               PRECACHEBARY+PRECACHELED1Y,
-                              W_GetNumForName ("led1"));
+                              W_GetNumForName ("led1"));//led1 progressbar
+			}else if ( iGLOBAL_SCREENWIDTH == 640) {
+				DrawNormalSprite (72+(Gs*(lastmem<<2)),446,W_GetNumForName ("led1"));//led1 progressbar
+				DrawNormalSprite (72+(Gs*(lastmem<<2)),446+3,W_GetNumForName ("led1"));//led1 progressbar
+				DrawNormalSprite (72+3+(Gs*(lastmem<<2)),446,W_GetNumForName ("led1"));//led1 progressbar
+				DrawNormalSprite (72+3+(Gs*(lastmem<<2)),446+3,W_GetNumForName ("led1"));//led1 progressbar
+			}else if ( iGLOBAL_SCREENWIDTH == 800) {
+				DrawNormalSprite (91+(Gs*(lastmem<<2)),559,W_GetNumForName ("led1"));//led1 progressbar
+				DrawNormalSprite (91+(Gs*(lastmem<<2)),559+3,W_GetNumForName ("led1"));//led1 progressbar
+				DrawNormalSprite (91+3+(Gs*(lastmem<<2)),559,W_GetNumForName ("led1"));//led1 progressbar
+				DrawNormalSprite (91+3+(Gs*(lastmem<<2)),559+3,W_GetNumForName ("led1"));//led1 progressbar
+			}
+
             lastmem++;
             }
          currentcache=(i*MAXLEDS)/(cacheindex+1);
          while (lastcache<=currentcache)
             {
-            DrawNormalSprite (PRECACHEBARX+PRECACHELED2X+(lastcache<<2),
+
+   			if ( iGLOBAL_SCREENWIDTH == 320) {
+				DrawNormalSprite (PRECACHEBARX+PRECACHELED2X+(lastcache<<2),
                               PRECACHEBARY+PRECACHELED2Y,
-                              W_GetNumForName ("led2"));
+                              W_GetNumForName ("led2"));//led2 progressbar
+			}else if ( iGLOBAL_SCREENWIDTH == 640) {
+				DrawNormalSprite (72+(Gs*(lastcache<<2)),458,W_GetNumForName ("led2"));//led2 progressbar
+				DrawNormalSprite (72+(Gs*(lastcache<<2)),458+3,W_GetNumForName ("led2"));//led2 progressbar
+				DrawNormalSprite (72+3+(Gs*(lastcache<<2)),458,W_GetNumForName ("led2"));//led2 progressbar
+				DrawNormalSprite (72+3+(Gs*(lastcache<<2)),458+3,W_GetNumForName ("led2"));//led2 progressbar
+			
+			}else if ( iGLOBAL_SCREENWIDTH == 800) {
+				DrawNormalSprite (91+(Gs*(lastcache<<2)),573,W_GetNumForName ("led2"));//led2 progressbar
+				DrawNormalSprite (91+(Gs*(lastcache<<2)),573+3,W_GetNumForName ("led2"));//led2 progressbar
+				DrawNormalSprite (91+3+(Gs*(lastcache<<2)),573,W_GetNumForName ("led2"));//led2 progressbar
+				DrawNormalSprite (91+3+(Gs*(lastcache<<2)),573+3,W_GetNumForName ("led2"));//led2 progressbar
+			}
+			StrechScreen=false;//bna++
+			VW_UpdateScreen ();//bna++
             lastcache++;
             ticdelay--;
             if (ticdelay==0)
@@ -1203,28 +1251,41 @@
                }
             }
          }
+	  StrechScreen=false;//bna++
+	  VW_UpdateScreen ();//bna++
+	  //I_Delay(200);
       bufferofs=tempbuf;
       ShutdownPreCache ();
 
       if ( BATTLEMODE )
          {
          int width,height;
-         char buf[30];
+         char buf[30];//byte * shape;
+		double WHratio = 16200/200;
+		WHratio = WHratio/100;
+///	iGLOBAL_SCREENWIDTH = 640;
+//	iGLOBAL_SCREENHEIGHT = 480;
+StrechScreen=false;
 
-         CurrentFont = smallfont;
+	// Cache in fonts
+//	shape = W_CacheLumpNum (W_GetNumForName ("newfnt1"), PU_STATIC, Cvt_font_t, 1);
+//	bigfont = (font_t *)shape;
+         CurrentFont = newfont1;//smallfont;
+
          strcpy( buf, "Press Any Key" );
          US_MeasureStr (&width, &height, &buf[ 0 ] );
-         PrintX = (320-width) / 2;
-         PrintY = 162;
-         VWB_TBar (PrintX-2, PrintY-2, width+4, height+4);
+         PrintX = (iGLOBAL_SCREENWIDTH-(width)) / 2;
+         PrintY = WHratio*iGLOBAL_SCREENHEIGHT;//162;
+         //VWB_TBar (PrintX-2, PrintY-2, width+4, height+4);
          US_BufPrint (&buf[0]);
+
          VW_UpdateScreen();
 
          IN_StartAck();
          while (!IN_CheckAck ())
             ;
          }
-
+ //  StrechScreen=true;
 #if (DEVELOPMENT == 1)
       tempbuf=bufferofs;
       bufferofs=displayofs;

Modified: trunk/rott/rt_vid.c
===================================================================
--- trunk/rott/rt_vid.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_vid.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -123,13 +123,68 @@
 			destline = (byte *)(bufferofs+ylookup[y+j]+x);
 
 			for (i = 0; i < width; i++) {
-				*(destline + i*4 + plane) = *ptr++;
+//				if (ptr < bufferofs + toplimit) { //bnafix zxcvb
+					*(destline + i*4 + plane) = *ptr++;
+//				}
 			}			
 		}
 	}
 #endif
 }
+// bna function start
+void VL_MemToScreenClipped (byte *source, int width, int height, int x, int y);
+void VL_MemToScreenClipped (byte *source, int width, int height, int x, int y)
+{
+	byte *ptr, *destline;
+	int plane, i, j;//,toplimit;
+	ptr = source;
+	for (plane = 0; plane < 4; plane++) {
+		for (j = 0; j < height; j++) {
+			destline = (byte *)(bufferofs+ylookup[y+j]+x);
+			for (i = 0; i < width; i++) {
+				if (*ptr != 255){
+					*(destline + i*4 + plane) = *ptr++;
+				}else{ptr++;}
+			}			
+		}
+	}
+}
 
+//copy picture to mem (bufferofs) in doublesize
+void VL_MemStrechedToScreen (byte *source, int width, int height, int x, int y)
+{
+	byte *ptr, *destline,*tmp,*o;
+	int plane, i, j;
+	
+	tmp = bufferofs;
+	ptr = source;
+	
+	for (plane = 0; plane < 4; plane++) {
+		for (j = 0; j < height; j++) {
+			destline = (byte *)(bufferofs+(iGLOBAL_SCREENWIDTH*j)+ylookup[y+j]+x);
+			o = ptr;
+			for (i = 0; i < width; i+=1) {
+				*(destline + i*4 + plane) = *ptr;
+				destline++;
+				*(destline + i*4 + plane) = *ptr++;
+			}
+			ptr = o;
+
+			destline = (byte *)(bufferofs+iGLOBAL_SCREENWIDTH+(iGLOBAL_SCREENWIDTH*j)+ylookup[y+j]+x);
+			for (i = 0; i < width; i+=1) {
+				*(destline + i*4 + plane) = *ptr;
+				destline++;
+				*(destline + i*4 + plane) = *ptr++;
+
+			}	
+
+		}
+	}
+	bufferofs = tmp;
+}
+// bna function end
+
+
 //*************************************************************************
 //
 // DrawTiledRegion () - Fills the specified region with a tiled image
@@ -229,9 +284,9 @@
             }
 
 #ifdef DOS
-         origdest  += SCREENBWIDE;
+         origdest  += iGLOBAL_SCREENBWIDE;
 #else 
-         origdest += MAXSCREENWIDTH;
+         origdest += iGLOBAL_SCREENWIDTH;
 #endif
 
          sourceoff += sourcewidth;
@@ -1050,22 +1105,20 @@
    byte *source = (byte *)&lbminfo->data;
    byte *buf;
    int  ht = lbminfo->height;
-#ifdef DOS
-   int  planes;
-   byte writemask;
-#endif
+
    int  x = 0;
    int  y;
    byte *origbuf;
    byte pal[768];
 
-#ifdef DOS
-   writemask   = 1 << (x&3);
-#endif
+
    orig = screen;
 
-   buf = (byte *) SafeMalloc (64000);
-
+   if (iGLOBAL_SCREENWIDTH <= 320){
+		buf = (byte *) SafeMalloc (64000);
+   }else{
+		buf = (byte *) SafeMalloc (iGLOBAL_SCREENWIDTH*iGLOBAL_SCREENHEIGHT);
+   }
    origbuf = buf;
 
    VL_ClearBuffer (displayofs, 0);
@@ -1104,48 +1157,40 @@
 		   count += rept;
 
    	} while (count < lbminfo->width);
+	  if (iGLOBAL_SCREENWIDTH > 320){
+		 buf += (iGLOBAL_SCREENWIDTH-320); //eg 800 - 320)
+	  }
    }
+	   //SetTextMode (  ); //12345678
 
-#ifdef DOS
-   for (planes = 0; planes < 4; planes++)
-#endif
    {
       int cnt;
 
       cnt = 0;
-      screen = orig;
+      screen = orig; 
       buf = origbuf;
       VGAMAPMASK (writemask);
 
-#ifdef DOS
-      for (y = 0; y < (lbminfo->height*lbminfo->width)>>2; y++)
-#else
-      for (y = 0; y < (lbminfo->height*lbminfo->width); y++)
-#endif
-      {
-#ifdef DOS
-         *screen++ = *(buf+(y*4)+planes);
-#else
-         *screen++ = *(buf+y);
-#endif
-#ifdef DOS
-         cnt++;
+	  //bna section start
+	  if (iGLOBAL_SCREENWIDTH <= 320){
+		  for (y = 0; y < (lbminfo->height*lbminfo->width); y++)
 
-         if (cnt == 80)
-         {
-            screen += 16;
-            cnt = 0;
-         }
-#endif
-      }
+		  {
+			 *screen++ = *(buf+y);
+		  }
+	  }else{
+		  for (y = 0; y < (lbminfo->height); y++){
+			  for (x = 0; x < iGLOBAL_SCREENWIDTH; x++){
+				 *screen++ = *(buf++);
+			  }
+		  }
+	  }
+	  // bna section end
 
-#ifdef DOS
-      writemask <<= 1;
-#endif
    }
 
    SafeFree(origbuf);
-
+   StrechScreen=true;//bna++ shut on streech mode
    if (flip==true)
       VW_UpdateScreen ();
 
@@ -1161,6 +1206,40 @@
 
 void SetBorderColor (int color)
 {
+   // bna section start
+
+   byte  *cnt,*Ycnt,*b;
+
+   b=(byte *)bufferofs;
+
+   // color 56 could be used
+
+   //paint top red line
+   for (cnt=b;cnt<b+viewwidth;cnt++){
+	for (Ycnt=cnt;Ycnt<cnt+(5*iGLOBAL_SCREENWIDTH);Ycnt+=iGLOBAL_SCREENWIDTH){
+			*Ycnt = color;
+		}
+   }
+   //paint left red line
+   for (cnt=b;cnt<b+5;cnt++){
+	for (Ycnt=cnt;Ycnt<cnt+(viewheight*iGLOBAL_SCREENWIDTH);Ycnt+=iGLOBAL_SCREENWIDTH){
+			*Ycnt = color;
+		}
+   }
+   //paint right red line
+   for (cnt=b+(viewwidth-5);cnt<b+viewwidth;cnt++){
+	for (Ycnt=cnt;Ycnt<cnt+(viewheight*iGLOBAL_SCREENWIDTH);Ycnt+=iGLOBAL_SCREENWIDTH){
+			*Ycnt = color;
+		}
+   }
+   //paint lower red line
+   for (cnt=b+((viewheight-5)*iGLOBAL_SCREENWIDTH);cnt<b+((viewheight-5)*iGLOBAL_SCREENWIDTH)+viewwidth;cnt++){
+		for (Ycnt=cnt;Ycnt<b+(viewheight*iGLOBAL_SCREENWIDTH);Ycnt+=iGLOBAL_SCREENWIDTH){
+			 *Ycnt = color;
+		}
+   }
+   // bna section end
+
 #ifdef DOS
    inp  (STATUS_REGISTER_1);
    outp (ATR_INDEX,0x31);

Modified: trunk/rott/rt_vid.h
===================================================================
--- trunk/rott/rt_vid.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_vid.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -61,7 +61,7 @@
 // PROTOTYPES
 //
 //***************************************************************************
-
+void VL_MemStrechedToScreen (byte *source, int width, int height, int x, int y);
 void VL_MemToScreen (byte *source, int width, int height, int x, int y);
 void DrawTiledRegion( int x, int y, int width, int height, int offx, int offy, pic_t *tile );
 void VWB_DrawPic (int x, int y, pic_t *pic);

Modified: trunk/rott/rt_view.c
===================================================================
--- trunk/rott/rt_view.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_view.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -59,6 +59,9 @@
 
 =============================================================================
 */
+extern int G_weaponscale;
+
+
 int    StatusBar = 0;
 int    lightninglevel=0;
 boolean  lightning=false;
@@ -83,10 +86,11 @@
 byte * redmap;
 byte * greenmap;
 byte * playermaps[MAXPLAYERCOLORS];
-short  pixelangle[MAXVIEWWIDTH];
+//short  pixelangle[MAXVIEWWIDTH];
+short  pixelangle[800];
 byte   gammatable[GAMMAENTRIES];
 int    gammaindex;
-int    focalwidth=FOCALWIDTH;
+int    focalwidth=160;
 int    yzangleconverter;
 byte   uniformcolors[MAXPLAYERCOLORS]={
                                        25,
@@ -166,7 +170,7 @@
 */
 void ResetFocalWidth ( void )
 {
-   focalwidth=FOCALWIDTH;
+   focalwidth=iGLOBAL_FOCALWIDTH;//FOCALWIDTH;
    SetViewDelta();
 }
 
@@ -179,7 +183,7 @@
 */
 void ChangeFocalWidth ( int amount )
 {
-   focalwidth=FOCALWIDTH+amount;
+   focalwidth=iGLOBAL_FOCALWIDTH+amount;//FOCALWIDTH+amount;
    SetViewDelta();
 }
 
@@ -194,13 +198,19 @@
 
 void SetViewDelta ( void )
 {
-
+//iGLOBAL_SCREENHEIGHT
+//iGLOBAL_SCREENWIDTH
 //
 // calculate scale value for vertical height calculations
 // and sprite x calculations
 //
-   scale = (centerx*focalwidth)/160;
-
+	if ( iGLOBAL_SCREENWIDTH == 320) {
+		scale = (centerx*focalwidth)/(160);
+	}else if ( iGLOBAL_SCREENWIDTH == 640) {
+		scale = (centerx*focalwidth)/(160);
+	}else if ( iGLOBAL_SCREENWIDTH == 800) {
+		scale = (centerx*focalwidth)/(160);
+	}
 //
 // divide heightnumerator by a posts distance to get the posts height for
 // the heightbuffer.  The pixel height is height>>HEIGHTFRACTION
@@ -285,14 +295,57 @@
    int screenx;
    int screeny;
    int topy;
+   /*
+  if (size>=10){
 
-   if ((size<0) || (size>=MAXVIEWSIZES))
-      Error("Illegal screen size = %ld\n",size);
+	   SetTextMode (  );
+	   screenx=screenx;
+	   return;
+   }
+*/
 
+	if ( iGLOBAL_SCREENWIDTH == 640) {
+		height = 0;//we use height as dummy cnt
+		viewsizes[height++]= 380; viewsizes[height++]= 336;
+        viewsizes[height++]= 428; viewsizes[height++]= 352;
+        viewsizes[height++]= 460; viewsizes[height++]= 368;
+        viewsizes[height++]= 492; viewsizes[height++]= 384;
+        viewsizes[height++]= 524; viewsizes[height++]= 400;
+        viewsizes[height++]= 556; viewsizes[height++]= 416;
+        viewsizes[height++]= 588; viewsizes[height++]= 432;
+        viewsizes[height++]= 640; viewsizes[height++]= 448;
+        viewsizes[height++]= 640; viewsizes[height++]= 464;
+        viewsizes[height++]= 640; viewsizes[height++]= 480;
+        viewsizes[height++]= 640; viewsizes[height++]= 480;
+	}else if ( iGLOBAL_SCREENWIDTH == 800) {
+		height = 0;
+		viewsizes[height++]= 556; viewsizes[height++]= 488;
+        viewsizes[height++]= 588; viewsizes[height++]= 504;
+        viewsizes[height++]= 620; viewsizes[height++]= 520;
+        viewsizes[height++]= 652; viewsizes[height++]= 536;
+        viewsizes[height++]= 684; viewsizes[height++]= 552;
+        viewsizes[height++]= 716; viewsizes[height++]= 568;
+        viewsizes[height++]= 748; viewsizes[height++]= 584;
+        viewsizes[height++]= 800; viewsizes[height++]= 600;
+        viewsizes[height++]= 800; viewsizes[height++]= 600;
+        viewsizes[height++]= 800; viewsizes[height++]= 600;
+        viewsizes[height++]= 800; viewsizes[height++]= 600;
+	}
+
+
+	if ((size<0) || (size>=MAXVIEWSIZES)){//bna added
+        printf("Illegal screen size = %d\n",size);
+		size = 8;//set default value
+		viewsize = 8;
+	}
+
+   //if ((size<0) || (size>=MAXVIEWSIZES))
+   //   Error("Illegal screen size = %ld\n",size);
+
    viewwidth  = viewsizes[ size << 1 ];         // must be divisable by 16
    viewheight = viewsizes[ ( size << 1 ) + 1 ]; // must be even
 
-   maxheight = 200;
+   maxheight = iGLOBAL_SCREENHEIGHT;
    topy      = 0;
 
    // Only keep the kills flag
@@ -314,33 +367,48 @@
       topy      += 16;
       }
 
+//   if ( size == 7 ){maxheight -= 16;}//bna++
+//   if ( size <= 6 ){topy -= 8;}//bna++
+
    if ( size < 8 )
       {
       // Turn on health and ammo bar
       StatusBar |= BOTTOM_STATUS_BAR;
+
       maxheight -= 16;
+
       }
    else if ( size < 10 )
       {
       // Turn on transparent health and ammo bar
       StatusBar |= STATUS_PLAYER_STATS;
       }
-
+   //   SetTextMode (  );
+   //   viewheight=viewheight;
    height = viewheight;
    if ( height > 168 )
-      {
-      // Prevent weapon from being scaled too big
-      height = 168;
-      }
+   {
+        // Prevent weapon from being scaled too big
+	    height = 168;
+	  	if ( iGLOBAL_SCREENWIDTH == 640) {
+			height = 260;
+		}else if ( iGLOBAL_SCREENWIDTH == 800) {
+			height = 360;
+		}
+   }
 
-   weaponscale = ( height << 16 ) / 168;
+   if ((G_weaponscale > 150)&&(G_weaponscale <600)){height = G_weaponscale;}
+   if ( iGLOBAL_SCREENWIDTH == 320) {G_weaponscale=G_weaponscale/2;}
+   weaponscale = ( height << 16 ) / 168;//( height << 16 ) = 170 * 65536
+
+  
    centerx     = viewwidth >> 1;
    centery     = viewheight >> 1;
    centeryfrac = (centery << 16);
-   yzangleconverter = ( 0xaf85 * viewheight ) / 200;
+   yzangleconverter = ( 0xaf85 * viewheight ) / iGLOBAL_SCREENHEIGHT;
 
    // Center the view horizontally
-   screenx = ( 320 - viewwidth ) >> 1;
+   screenx = ( iGLOBAL_SCREENWIDTH - viewwidth ) >> 1;
 
    if ( viewheight >= maxheight )
       {
@@ -370,7 +438,9 @@
 // Already being called in ResetFocalWidth
 //   SetViewDelta();
 
-   CalcProjection();
+
+     CalcProjection();
+
    }
 
 
@@ -410,10 +480,12 @@
    pic_t *shape;
 
    SetViewSize(viewsize);
+
    if ( viewsize < 7 )
       {
-      shape = W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
-      DrawTiledRegion( 0, 16, 320, 200 - 32, 0, 16, shape );
+      shape =  ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
+      //DrawTiledRegion( 0, 16, 320, 200 - 32, 0, 16, shape );
+      DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );//bna++
       }
 
    if ( viewsize == 0 )

Modified: trunk/rott/rt_view.h
===================================================================
--- trunk/rott/rt_view.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/rt_view.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -30,8 +30,9 @@
 #define HEIGHTFRACTION 6
 #define MAXVIEWSIZES   11
 
-#define FOCALWIDTH 160
-#define FPFOCALWIDTH 160.0
+//#define FOCALWIDTH 160//160
+//#define FPFOCALWIDTH 160.0//160.0
+ 
 
 #define NUMGAMMALEVELS 8
 #define GAMMAENTRIES (64*8)
@@ -74,7 +75,8 @@
    } playercolors;
 
 extern byte * playermaps[MAXPLAYERCOLORS];
-extern short  pixelangle[MAXVIEWWIDTH];
+//extern short  pixelangle[MAXVIEWWIDTH];
+extern short  pixelangle[800];
 extern byte   gammatable[GAMMAENTRIES];
 extern int    gammaindex;
 extern byte   uniformcolors[MAXPLAYERCOLORS];

Modified: trunk/rott/states.h
===================================================================
--- trunk/rott/states.h	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/states.h	2008-05-24 06:29:04 UTC (rev 227)
@@ -23,9 +23,9 @@
 #include "develop.h"
 
 #if (SHAREWARE == 0)
-#define MAXSTATES 1300
+#define MAXSTATES 1300+17+8+32+32
 #else
-#define MAXSTATES 660
+#define MAXSTATES 660+17+8+32+32
 #endif
 
 #define SF_CLOSE   0x01

Modified: trunk/rott/w_wad.c
===================================================================
--- trunk/rott/w_wad.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/w_wad.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -84,14 +84,26 @@
         wadinfo_t               header;
         lumpinfo_t              *lump_p;
         unsigned                i;
-        int                             handle, length;
-        int                             startlump;
+        int                     handle, length;
+        int                     startlump;
         filelump_t              *fileinfo, singleinfo;
 
         char filename[MAX_PATH];
+        char buf[MAX_PATH+100];//bna++
+
         strncpy(filename, _filename, sizeof (filename));
         filename[sizeof (filename) - 1] = '\0';
         FixFilePath(filename);
+
+		//bna section start
+		if (access (filename, 0) != 0) {
+			strcpy (buf,"Error, Could not find User file '");
+			strcat (buf,filename);
+			strcat (buf,"', ignoring file");
+			printf(buf);
+		}
+		//bna section end
+
 //
 // read the entire file in
 //      FIXME: shared opens

Modified: trunk/rott/z_zone.c
===================================================================
--- trunk/rott/z_zone.c	2008-05-24 06:26:20 UTC (rev 226)
+++ trunk/rott/z_zone.c	2008-05-24 06:29:04 UTC (rev 227)
@@ -287,14 +287,9 @@
 // scan through the block list looking for the first free block
 // of sufficient size, throwing out any purgable blocks along the way
 //
-        size += sizeof(memblock_t);     // account for size of block header
+//        size += sizeof(memblock_t);     // account for size of block header
+        size = (size + sizeof(memblock_t) + 3)&~3;     // account for size of block header
 
-#if defined(__sparc__)
-        /* ensure word alignment */
-        if (size % 4) {
-           size = size + (4 - size % 4);
-        }
-#endif
 
 //
 // if there is a free block behind the rover, back up over them
@@ -392,7 +387,8 @@
 // scan through the block list looking for the first free block
 // of sufficient size, throwing out any purgable blocks along the way
 //
-        size += sizeof(memblock_t);     // account for size of block header
+//        size += sizeof(memblock_t);     // account for size of block header
+        size = (size + sizeof(memblock_t) + 3)&~3;     // account for size of block header
 
 
 //




More information about the rott-commits mailing list