r228 - in trunk: . rott

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat May 24 02:30:00 EDT 2008


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

Modified:
   trunk/README
   trunk/rott/cin_efct.c
   trunk/rott/isr.c
   trunk/rott/modexlib.c
   trunk/rott/modexlib.h
   trunk/rott/rt_cfg.c
   trunk/rott/rt_debug.c
   trunk/rott/rt_draw.c
   trunk/rott/rt_game.c
   trunk/rott/rt_in.c
   trunk/rott/rt_main.c
   trunk/rott/rt_map.c
   trunk/rott/rt_menu.c
   trunk/rott/rt_net.c
   trunk/rott/rt_net.h
   trunk/rott/rt_str.c
   trunk/rott/rt_ted.c
   trunk/rott/rt_vid.c
Log:
Many from and to the incorporated winrott code

Modified: trunk/README
===================================================================
--- trunk/README	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/README	2008-05-24 06:29:59 UTC (rev 228)
@@ -55,8 +55,6 @@
 ------------
 
 - Demos go out of sync.
-- DOS border coloring not implemented.
-- Screen shake from DOS version not implemented.
 - No netplay support.
 
 

Modified: trunk/rott/cin_efct.c
===================================================================
--- trunk/rott/cin_efct.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/cin_efct.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -308,7 +308,9 @@
 
    DrawBlankScreen ( );
 
+#ifdef DOS
    VL_SetVGAPlaneMode ();
+#endif
 
    CinematicSetPalette (curpal);
 
@@ -885,6 +887,7 @@
    int i;
    int plane;
    byte src[200];
+   int width = StretchScreen? 320:iGLOBAL_SCREENWIDTH;
 
    DrawClearBuffer ();
 
@@ -898,9 +901,9 @@
       VGAWRITEMAP(plane);
 
 #ifdef DOS
-      for (i=plane;i<iGLOBAL_SCREENWIDTH;i+=4,buf++)
+      for (i=plane;i<width;i+=4,buf++)
 #else
-      for (i=0;i<iGLOBAL_SCREENWIDTH;i++,buf++)
+      for (i=0;i<width;i++,buf++)
 #endif
          {
          DrawFilmPost(buf,&src[0],200);
@@ -924,6 +927,7 @@
    int i;
    int plane;
    int height;
+   int width = StretchScreen? 320:iGLOBAL_SCREENWIDTH;
 
    pic=(lpic_t *)W_CacheLumpNum(lumpnum,PU_CACHE, Cvt_lpic_t, 1);
 
@@ -942,9 +946,9 @@
       VGAWRITEMAP(plane);
 
 #ifdef DOS
-      for (i=plane;i<iGLOBAL_SCREENWIDTH;i+=4,src+=(pic->height<<2),buf++)
+      for (i=plane;i<width;i+=4,src+=(pic->height<<2),buf++)
 #else
-      for (i=0;i<iGLOBAL_SCREENWIDTH;i++,src+=pic->height,buf++)
+      for (i=0;i<width;i++,src+=pic->height,buf++)
 #endif
          {
          DrawFilmPost(buf,src,height);

Modified: trunk/rott/isr.c
===================================================================
--- trunk/rott/isr.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/isr.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -801,7 +801,7 @@
    delay=(VBLCOUNTER*delay)/10;
    IN_ClearKeysDown();
    time=GetTicCount();
-   while (!LastScan && GetTicCount()<time+delay)
+   while (!LastScan && !IN_GetMouseButtons() && GetTicCount()<time+delay)
       {
       	IN_UpdateKeyboard();
       }

Modified: trunk/rott/modexlib.c
===================================================================
--- trunk/rott/modexlib.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/modexlib.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -38,16 +38,14 @@
 //MED
 #include "memcheck.h"
 #include "rt_util.h"
+#include "rt_net.h" // for GamePaused
 
-void    SchrinkMemPicture();
-void StrechMemPicture ();
-void StrechFlipMemPicture ();
+static void StretchMemPicture ();
 // GLOBAL VARIABLES
 
-boolean StrechScreen=true;//bná++
-extern char *tmpPICbuf;
-char *sdl_surfacePTR;
-extern int iG_aimCross;
+boolean StretchScreen=0;//bná++
+extern boolean iG_aimCross;
+extern boolean sdl_fullscreen;
 extern int iG_X_center;
 extern int iG_Y_center;
 char 	   *iG_buf_center;
@@ -421,7 +419,7 @@
 ====================
 */
 static SDL_Surface *sdl_surface = NULL;
-static SDL_Surface *sdl_backbuf = NULL;
+static SDL_Surface *unstretch_sdl_surface = NULL;
 
 void GraphicsMode ( void )
 {
@@ -441,6 +439,8 @@
     SDL_WM_SetCaption ("Rise of the Triad", "ROTT");
     SDL_ShowCursor (0);
 //    sdl_surface = SDL_SetVideoMode (320, 200, 8, flags);
+    if (sdl_fullscreen)
+        flags = SDL_FULLSCREEN;
     sdl_surface = SDL_SetVideoMode (iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, 8, flags);    
 	if (sdl_surface == NULL)
 	{
@@ -538,6 +538,8 @@
 	bufofsTopLimit =  bufferofs + screensize - iGLOBAL_SCREENWIDTH;
 	bufofsBottomLimit = bufferofs + iGLOBAL_SCREENWIDTH;
 
+    // start stretched
+    EnableScreenStretch();
     XFlipPage ();
 }
 
@@ -686,8 +688,8 @@
 void VH_UpdateScreen (void)
 { 	
 
-	if ((StrechScreen==true)&&(iGLOBAL_SCREENWIDTH > 320)){//bna++
-		StrechMemPicture ();
+	if (StretchScreen){//bna++
+		StretchMemPicture ();
 	}else{
 		DrawCenterAim ();
 	}
@@ -719,8 +721,8 @@
    if (bufferofs > page3start)
       bufferofs = page1start;
 #else
- 	if ((StrechScreen==true)&&(iGLOBAL_SCREENWIDTH > 320)){//bna++
-		StrechMemPicture ();
+ 	if (StretchScreen){//bna++
+		StretchMemPicture ();
 	}else{
 		DrawCenterAim ();
 	}
@@ -732,156 +734,61 @@
 #endif
 
 
+void EnableScreenStretch(void)
+{
+   int i,offset;
+   
+   if (iGLOBAL_SCREENWIDTH <= 320 || StretchScreen) return;
+   
+   if (unstretch_sdl_surface == NULL)
+   {
+      /* should really be just 320x200, but there is code all over the
+         places which crashes then */
+      unstretch_sdl_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
+         iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, 8, 0, 0, 0, 0);
+   }
+	
+   displayofs = unstretch_sdl_surface->pixels +
+	(displayofs - (byte *)sdl_surface->pixels);
+   bufferofs  = unstretch_sdl_surface->pixels;
+   page1start = unstretch_sdl_surface->pixels;
+   page2start = unstretch_sdl_surface->pixels;
+   page3start = unstretch_sdl_surface->pixels;
+   StretchScreen = 1;	
+}
 
+void DisableScreenStretch(void)
+{
+   if (iGLOBAL_SCREENWIDTH <= 320 || !StretchScreen) return;
+	
+   displayofs = sdl_surface->pixels +
+	(displayofs - (byte *)unstretch_sdl_surface->pixels);
+   bufferofs  = sdl_surface->pixels;
+   page1start = sdl_surface->pixels;
+   page2start = sdl_surface->pixels;
+   page3start = sdl_surface->pixels;
+   StretchScreen = 0;
+}
 
 
-
 // bna section -------------------------------------------
-void StrechMemPicture ()
+static void StretchMemPicture ()
 {
-
-		//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:;
-
-
-
-
+  SDL_Rect src;
+  SDL_Rect dest;
+	
+  src.x = 0;
+  src.y = 0;
+  src.w = 320;
+  src.h = 200;
+  
+  dest.x = 0;
+  dest.y = 0;
+  dest.w = iGLOBAL_SCREENWIDTH;
+  dest.h = iGLOBAL_SCREENHEIGHT;
+  SDL_SoftStretch(unstretch_sdl_surface, &src, sdl_surface, &dest);
 }
 
-
-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;
@@ -889,7 +796,7 @@
 void DrawCenterAim ()
 {
 	int x;
-	if (iG_aimCross > 0){
+	if (iG_aimCross && !GamePaused){
 		if (( ingame == true )&&(iGLOBAL_SCREENWIDTH>320)){
 			  if ((iG_playerTilt <0 )||(iG_playerTilt >iGLOBAL_SCREENHEIGHT/2)){
 					iG_playerTilt = -(2048 - iG_playerTilt);
@@ -913,7 +820,7 @@
 				  }
 			  }
 			  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)){
+				  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;
 				  }
 			  }

Modified: trunk/rott/modexlib.h
===================================================================
--- trunk/rott/modexlib.h	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/modexlib.h	2008-05-24 06:29:59 UTC (rev 228)
@@ -108,7 +108,7 @@
 #define PEL_DATA                0x3c9
 #endif
 
-extern  boolean StrechScreen;//bná++
+extern  boolean StretchScreen;//bná++
 
 //extern  int      ylookup[MAXSCREENHEIGHT];      // Table of row offsets
 extern  int      ylookup[600];      // just set to max res

Modified: trunk/rott/rt_cfg.c
===================================================================
--- trunk/rott/rt_cfg.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_cfg.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -91,6 +91,7 @@
 //******************************************************************************
 
 extern int G_weaponscale;
+extern boolean iG_aimCross;
 
 boolean WriteSoundFile   = true;
 
@@ -109,6 +110,7 @@
 boolean usemouselook     = 0;
 int     inverse_mouse    = 1; //set  to -1 to invert mouse
 boolean usejump          = 0;
+boolean sdl_fullscreen   = 1;
 
 boolean joystickenabled  = 0;
 boolean joypadenabled    = 0;
@@ -507,6 +509,9 @@
 	  // Read in UseJump
       ReadBoolean("UseJump",&usejump);
 
+      // Read in CrossHair
+      ReadBoolean("CrossHair",&iG_aimCross);
+
       // Read in JoystickEnabled
       ReadBoolean("JoystickEnabled",&joystickenabled);
 
@@ -516,6 +521,13 @@
       // Read in JoystickPort
 
       ReadInt("JoystickPort",&joystickport);
+      
+      // Read in fullscreen
+      ReadBoolean("FullScreen", &sdl_fullscreen);
+      
+      // Read in resolution
+      ReadInt("ScreenWidth", &iGLOBAL_SCREENWIDTH);
+      ReadInt("ScreenHeight", &iGLOBAL_SCREENHEIGHT);
 
       // Read in ViewSize
 
@@ -1725,6 +1737,12 @@
    SafeWriteString(file,"; 0 - usejump Disabled\n");
    WriteParameter(file,"UseJump          ",usejump);
 
+   // Write out CrossHair
+   SafeWriteString(file,"\n;\n");
+   SafeWriteString(file,"; 1 - CrossHair Enabled\n");
+   SafeWriteString(file,"; 0 - CrossHair Disabled\n");
+   WriteParameter(file,"CrossHair        ", iG_aimCross);
+
    // Write out JoystickEnabled
 
    SafeWriteString(file,"\n;\n");
@@ -1746,6 +1764,19 @@
    SafeWriteString(file,"; 1 - Use Joystick Port 2\n");
    WriteParameter(file,"JoystickPort     ",joystickport);
 
+   // Write out fullscreen
+   SafeWriteString(file,"\n;\n");
+   SafeWriteString(file,"; 0 - Start in windowed mode\n");
+   SafeWriteString(file,"; 1 - Start in fullscreen mode\n");
+   WriteParameter(file,"FullScreen       ",sdl_fullscreen);
+      
+   // Write out resolution
+   SafeWriteString(file,"\n;\n");
+   SafeWriteString(file,"; Screen Resolution, supported resolutions: \n");
+   SafeWriteString(file,"; 320x200, 640x480 and 800x600\n");
+   WriteParameter(file,"ScreenWidth      ",iGLOBAL_SCREENWIDTH);
+   WriteParameter(file,"ScreenHeight     ",iGLOBAL_SCREENHEIGHT);
+
    // Write out ViewSize
 
    SafeWriteString(file,"\n;\n");

Modified: trunk/rott/rt_debug.c
===================================================================
--- trunk/rott/rt_debug.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_debug.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -47,7 +47,7 @@
 #include "w_wad.h"
 
 extern int		iDemoNames;
-extern int iG_aimCross;
+extern boolean iG_aimCross;
 
 
 extern void DisplayMessage   (int num,int position);
@@ -424,7 +424,7 @@
    int level;
 
 
-	StrechScreen=true;//bna++ shut on streech mode
+	EnableScreenStretch();//bna++ shut on streech mode
 
 
    MU_StoreSongPosition();
@@ -445,13 +445,13 @@
 		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
+		DisableScreenStretch();//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
+	EnableScreenStretch();//bna++ shut on streech mode
    while( Keyboard[ sc_Escape ] )
       {
 		IN_UpdateKeyboard();
@@ -475,7 +475,7 @@
       }
    else
       {
-	   StrechScreen=false;//dont strech when we go BACK TO GAME
+	   DisableScreenStretch();//dont strech when we go BACK TO GAME
       SetupScreen(true);
       }
 
@@ -494,7 +494,7 @@
 
    {
 	if (iGLOBAL_SCREENWIDTH > 320) {
-		StrechScreen=true;//bna++ shut on streech mode
+		EnableScreenStretch();//bna++ shut on streech mode
 	}
    StopWind();
    ShutdownClientControls();
@@ -512,7 +512,7 @@
 		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
+		DisableScreenStretch();//dont strech when we go BACK TO GAME
 		DrawPlayScreen(true);//repaint ammo and life stat
 		VW_UpdateScreen ();//update screen
   }
@@ -707,7 +707,7 @@
 
 void RestartNormal (void)
 {
-	StrechScreen=true;//bna
+	EnableScreenStretch();//bna
 	DoNormalThing ();
 
    AddMessage ("Restart to level 1", MSG_CHEAT);
@@ -1037,7 +1037,7 @@
 	IN_ClearKeyboardQueue ();
 
    StartupClientControls();
-   StrechScreen = false;
+   DisableScreenStretch();
 }
 
 
@@ -1082,7 +1082,7 @@
       if ((level > 0) && (level < 9))
 #endif
          {
-			StrechScreen=true;//bna
+			EnableScreenStretch();//bna
 			 gamestate.mapon = level-1;
 			 playstate = ex_demorecord;
          }
@@ -1140,7 +1140,7 @@
 
    StartupClientControls();
 
-   StrechScreen = true;
+   EnableScreenStretch();
 }
 
 /*

Modified: trunk/rott/rt_draw.c
===================================================================
--- trunk/rott/rt_draw.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_draw.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -80,8 +80,6 @@
 =============================================================================
 */
 
-extern char *tmpPICbuf;
-extern char *sdl_surfacePTR;
 int iG_masked;
 
 int whereami=-1;
@@ -3073,7 +3071,7 @@
    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;
+   DisableScreenStretch();
    SHAKETICS = 0xFFFF;
    //bna section end
 }
@@ -3136,7 +3134,7 @@
       //memset(RotatedImage,0xff,131072*8);
 
       if ((masked == false)&&(iGLOBAL_SCREENWIDTH == 800)) {
-		StrechScreen = false;
+		DisableScreenStretch();
 		// SetTextMode (  );
 
 		k=(28*512);//14336;
@@ -3152,7 +3150,7 @@
 			   //k+=512*2;
 		   }
 	  }else if ((masked == false)&&(iGLOBAL_SCREENWIDTH == 640)) {
-		StrechScreen = false;
+		DisableScreenStretch();
 		k=(28*512);//14336;
 		   for (a=0;a<iGLOBAL_SCREENHEIGHT;a++){
 			   for (b=0;b<iGLOBAL_SCREENWIDTH;b++){
@@ -3216,7 +3214,7 @@
 
    time = time;
 ////zxcv
-	StrechScreen=false;//bna++
+	DisableScreenStretch();//bna++
 
 
    anglestep=((endangle-startangle)<<16)/time;
@@ -3250,7 +3248,7 @@
 	   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
+	   DisableScreenStretch();//dont strech when we go BACK TO GAME
 	   DrawPlayScreen(true);//repaint ammo and life stat
   }
 }
@@ -3675,7 +3673,7 @@
 #define MAXSPEED  8
 void UpdateScreenSaver ( void )
 {
-	//StrechScreen = true;
+	//EnableScreenStretch();
    if (ScreenSaver->time!=-1)
       {
       ScreenSaver->time-=tics;
@@ -4367,7 +4365,7 @@
    int i;
 
    byte pal[768];
-	StrechScreen = true;
+	EnableScreenStretch();
 
    viewwidth = 320;//MAXSCREENWIDTH;
    viewheight = 200;//MAXSCREENHEIGHT;
@@ -5532,7 +5530,7 @@
 
 void DoEndCinematic ( void )
 {
-	StrechScreen = true;
+	EnableScreenStretch();
 
    viewwidth = 320;//MAXSCREENWIDTH;
    viewheight = 200;//MAXSCREENHEIGHT;
@@ -5768,7 +5766,7 @@
    byte * bkgnd;
    font_t * oldfont;
    int i;
-	StrechScreen = true;
+	EnableScreenStretch();
    viewwidth = 320;//MAXSCREENWIDTH;
    viewheight = 200;//MAXSCREENHEIGHT;
 

Modified: trunk/rott/rt_game.c
===================================================================
--- trunk/rott/rt_game.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_game.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -95,7 +95,6 @@
                {"Jim",20000,2,1},
                {"Steve",10000,1,1},
             };
-extern char *tmpPICbuf;
 
 //******************************************************************************
 //
@@ -1109,6 +1108,7 @@
       tempbuf=bufferofs;
       bufferofs=page1start;
       VW_DrawPropString (str);
+#ifdef DOS
       px=x;
       py=y;
       bufferofs=page2start;
@@ -1117,6 +1117,7 @@
       py=y;
       bufferofs=page3start;
       VW_DrawPropString (str);
+#endif
       bufferofs=tempbuf;
       }
 }
@@ -3421,11 +3422,11 @@
    EndBonusSkip       = false;
    EndBonusStartY     = 90;
 
-   StrechScreen=true;
+   EnableScreenStretch();
    tmpPic = ( pic_t * )W_CacheLumpName( "mmbk", PU_CACHE, Cvt_pic_t, 1 );
    VWB_DrawPic( 0, 0, tmpPic );
    VW_UpdateScreen();
-   StrechScreen=false;
+   DisableScreenStretch();
 
    IN_StartAck();
    EndBonusVoice = 0;
@@ -3531,9 +3532,9 @@
    picbuf = (byte *)SafeMalloc (64000);
    memcpy(picbuf ,bufferofs ,64000);
 
-   StrechScreen=true;
+   EnableScreenStretch();
    VW_UpdateScreen();//tmpPICbuf is destroyed here
-   StrechScreen=false;
+   DisableScreenStretch();
    //copy it back
 
    memcpy(bufferofs ,picbuf , 64000);
@@ -3758,9 +3759,9 @@
     
 
 	//bna section 
-    StrechScreen=true;//bna++
+    EnableScreenStretch();//bna++
     VW_UpdateScreen();//bna++
-//    StrechScreen=false;//bna++
+//    DisableScreenStretch();//bna++
 	//bna section end
 
 
@@ -4211,7 +4212,7 @@
    int Player;
    char text[80];
 
-   StrechScreen=true;
+   EnableScreenStretch();
 
    IN_ClearKeysDown ();
 

Modified: trunk/rott/rt_in.c
===================================================================
--- trunk/rott/rt_in.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_in.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -104,6 +104,7 @@
 static word sdl_sticks_joybits = 0;
 static int sdl_mouse_grabbed = 0;
 static unsigned int scancodes[SDLK_LAST];
+extern boolean sdl_fullscreen;
 #endif
 
 
@@ -213,7 +214,7 @@
     } /* if */
     else
     {
-        if (sdl_mouse_grabbed)
+        if (sdl_mouse_grabbed || sdl_fullscreen)
         {
           	mouse_relative_x = event->motion.xrel;
        	    mouse_relative_y = event->motion.yrel;
@@ -459,11 +460,14 @@
          (event->key.state == SDL_PRESSED) &&
          (event->key.keysym.mod & KMOD_CTRL) )
     {
+      if (!sdl_fullscreen)
+      {
         sdl_mouse_grabbed = ((sdl_mouse_grabbed) ? 0 : 1);
         if (sdl_mouse_grabbed)
             grab_mode = SDL_GRAB_ON;
         SDL_WM_GrabInput(grab_mode);
-        return(0);
+      }
+      return(0);
     } /* if */
 
     else if ( ( (event->key.keysym.sym == SDLK_RETURN) ||
@@ -471,15 +475,19 @@
               (event->key.state == SDL_PRESSED) &&
               (event->key.keysym.mod & KMOD_ALT) )
     {
-        SDL_Surface *surface = SDL_GetVideoSurface();
-        if (surface != NULL)
-        {
-            Uint32 sdl_flags = surface->flags;
-            attempt_fullscreen_toggle(&surface, &sdl_flags);
-        } /* if */
+        if (SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()))
+            sdl_fullscreen ^= 1;
         return(0);
     } /* if */
 
+    /* HDG: put this above the scancode lookup otherwise it is never reached */
+    if ( (event->key.keysym.sym == SDLK_PAUSE) &&
+         (event->key.state == SDL_PRESSED))
+    {
+        PausePressed = true;
+        return(0);
+    }
+
     k = handle_keypad_enter_hack(event);
     if (!k)
     {
@@ -487,14 +495,14 @@
         if (!k)   /* No DOS equivalent defined. */
             return(0);
     } /* if */
-
-    if (event->key.state == SDL_RELEASED)
+    
+    /* Fix elweirdo SDL capslock/numlock handling, always treat as press */
+    if ( (event->key.keysym.sym != SDLK_CAPSLOCK) &&
+         (event->key.keysym.sym != SDLK_NUMLOCK)  &&
+         (event->key.state == SDL_RELEASED) )
         k += 128;  /* +128 signifies that the key is released in DOS. */
 
-    if (event->key.keysym.sym == SDLK_PAUSE)
-        PausePressed = true;
-
-    else if (event->key.keysym.sym == SDLK_SCROLLOCK)
+    if (event->key.keysym.sym == SDLK_SCROLLOCK)
         PanicPressed = true;
 
     else
@@ -1120,7 +1128,9 @@
     scancodes[SDLK_HOME]            = sc_Home;
     scancodes[SDLK_UP]              = sc_UpArrow;
     scancodes[SDLK_PAGEUP]          = sc_PgUp;
-    scancodes[SDLK_KP_MINUS]        = 0xE04A;
+    // Make this a normal minus, for viewport changing
+    //scancodes[SDLK_KP_MINUS]        = 0xE04A;
+    scancodes[SDLK_KP_MINUS]        = sc_Minus;
     scancodes[SDLK_KP4]             = sc_LeftArrow;
     scancodes[SDLK_KP5]             = 0x4C;
     scancodes[SDLK_KP6]             = sc_RightArrow;

Modified: trunk/rott/rt_main.c
===================================================================
--- trunk/rott/rt_main.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_main.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -164,7 +164,8 @@
 //extern char G_argv[30][80];
 int G_weaponscale;
 extern int iDropDemo;
-extern int iG_aimCross;
+extern boolean iG_aimCross;
+extern boolean sdl_fullscreen;
 
 extern void ComSetTime ( void );
 extern void VH_UpdateScreen (void);
@@ -220,8 +221,6 @@
    gamestate.Product = ROTT_REGISTERED;
 #endif
 
-   SetRottScreenRes (640, 480);
-
    DrawRottTitle ();
    gamestate.randomseed=-1;
 
@@ -248,6 +247,8 @@
       GetMenuInfo ();
       }
 
+   SetRottScreenRes (iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT);
+   
 //   if (modemgame==true)
 //      {
 //      SCREENSHOTS=true;
@@ -571,6 +572,20 @@
       SetTextMode ();
       printf ("Rise of the Triad  (c) 1995 Apogee Software\n\n");
       printf ("COMMAND LINE PARAMETERS\n");
+      printf ("   AIM        - Give Aim Crosshair.\n");
+      printf ("   FULLSCREEN - Start in fullscreen mode\n");
+      printf ("   WINDOW     - Start in windowed mode\n");
+      printf ("   RESOLUTION - Specify the screen resolution to use\n");
+      printf ("              - next param is <widthxheight>, valid resolutions are:\n");
+      printf ("              - 320x200, 640x480 and 800x600\n");
+#if (SHAREWARE==0)
+      printf ("   FILERTL    - used to load Userlevels (RTL files)\n");
+      printf ("              - next parameter is RTL filename\n");
+      printf ("   FILERTC    - used to load Battlelevels (RTC files)\n");
+      printf ("              - next parameter is RTC filename\n");
+      printf ("   FILE       - used to load Extern WAD files\n");
+      printf ("              - next parameter is WAD filename\n");
+#endif
       printf ("   SPACEBALL  - Enable check for Spaceball.\n");
       printf ("   NOJOYS     - Disable check for joystick.\n");
       printf ("   NOMOUSE    - Disable check for mouse.\n");
@@ -593,6 +608,57 @@
       printf ("   MAXTIMELIMIT - Maximimum time to count down from\n");
       printf ("                next paramater is time in seconds\n");
       printf ("   DOPEFISH   - ?\n");
+      printf (" \n");
+      printf ("CONTROLS\n");
+      printf ("         Arrows           - Move\n");
+      printf ("         Ctrl             - Fire\n");
+      printf ("         Comma/Alt+left   - Sidestep Left\n");
+      printf ("         Period/Alt+right - Sidestep Right\n");
+      printf ("         Shift            - Run/Turn faster\n");
+      printf ("         Space            - Use/Open\n");
+      printf ("         1-4              - Choose Weapon\n");
+      printf ("         5-6              - Scale Weapon Up/Down\n");
+      printf ("         Enter            - Swap Weapon\n");
+      printf ("         Backspace        - Turn 180\n");
+      printf ("         Delete           - Drop Weapon\n");
+      printf ("         +/-              - Change Viewsize\n");
+      printf ("         PgUp/PgDn        - Look Up/Down\n");
+      printf ("         Home/End         - Aim Up/Down\n");
+      printf ("         [ ]              - Sound Volumen\n");
+      printf ("         ( )              - Music Volumen\n");
+      printf ("         Tab              - Enter Automapper\n");
+      printf (" \n");
+      printf ("AUTO-MAPPER\n");
+      printf ("         Arrows           - Scroll around\n");
+      printf ("         PgUp             - Zoom Out\n");
+      printf ("         PgDn             - Zoom In\n");
+      printf ("         Tab              - Exit Auto-Mapper\n");
+      printf (" \n");
+      printf ("HOTKEYS\n");
+      printf ("         F1               - Help\n");
+      printf ("         F2               - Save Game\n");
+      printf ("         F3               - Restore Game\n");
+      printf ("         F4               - Controls/Sound/Music\n");
+      printf ("         F5               - Change Detail Level\n");
+      printf ("         F6               - Quick Save\n");
+      printf ("         F7               - Messages On/Off\n");
+      printf ("         F8               - End Game\n");
+      printf ("         F9               - Quick Load\n");
+      printf ("         F10              - Quit\n");
+      printf ("         F11              - Gamma Correction\n");
+      printf (" \n");
+      printf ("COMM-BAT\n");
+      printf ("         F1 - F10         - RemoteRidicule(tm) sounds\n");
+      printf ("         F12              - Live RemoteRidicule\n");
+      printf ("         T                - Type message to all\n");
+      printf ("         Z                - Type directed message\n");
+      printf ("         Tab              - Toggle KillCount display\n");
+      printf (" \n");
+      printf ("SCREENSHOOT\n");
+#ifdef DOS /* makes no sense under Linux as there are no lbm viewers there */
+      printf ("         Alt+V            - Screenshoot in LBM format\n");
+#endif
+      printf ("         Alt+C            - Screenshoot in PCX format\n");
       exit (0);
       }
 
@@ -738,25 +804,49 @@
 void SetupWads( void )
 {
    char  *newargs[99];
-	int argnum = 0;
-#if (SHAREWARE==0)
-   int arg;
-#endif
+   int i, arg, argnum = 0;
    char tempstr[129];
+   char *PStrings[] = {"AIM", "FULLSCREEN", "WINDOW", "RESOLUTION", NULL };
 
-#if (SHAREWARE==0)
-
-
-   // Check for aimcross
-   arg = CheckParm ("aim");
-   if (arg!=0)
+   // These must be checked here so that they can override the cfg file
+   for (i = 1;i < _argc;i++)
    {
-		iG_aimCross = 1;
-   }else{
-		iG_aimCross = 0;
+      arg = US_CheckParm(_argv[i],PStrings);
+      switch(arg)
+      {
+         case 0:
+            iG_aimCross = 1;
+            break;
+         case 1:
+            sdl_fullscreen = 1;
+            break;
+         case 2:
+            sdl_fullscreen = 0;
+            break;
+         case 3:
+            i++;
+            if (i < _argc)
+            {
+               int width, height;
+               if ( (sscanf(_argv[i], "%dx%d", &width, &height) == 2) &&
+                    ( ( (width == 320) && (height == 200) ) ||
+                      ( (width == 640) && (height == 480) ) ||
+                      ( (width == 800) && (height == 600) ) ) )
+               {
+                 iGLOBAL_SCREENWIDTH  = width;
+                 iGLOBAL_SCREENHEIGHT = height;
+               }
+               else
+                  printf("Invalid resolution parameter: %s\n", _argv[i]);
+            }
+            else
+               printf("Missing resolution parameter\n");
+            break;
+      }
    }
 
 
+#if (SHAREWARE==0)
    // Check for rtl files 	
    arg = CheckParm ("filertl");
    if (arg!=0)
@@ -1049,7 +1139,7 @@
 		 
             BATTLE_Shutdown();
             MU_StartSong(song_title);
-			StrechScreen=true;
+			EnableScreenStretch();
             if ((NoWait==false)&&(!modemgame))
                {
                byte dimpal[768];
@@ -1095,9 +1185,7 @@
                      break;
                      }
 
-                  if (iGLOBAL_SCREENWIDTH > 320) { //need fixing, crashes by 320 ,bna
 					DoCreditScreen ();
-				  }
                   if ((!LastScan) && (!IN_GetMouseButtons()))
                      CheckHighScore (0, 0, false);
 #if (SHAREWARE==0)
@@ -1147,7 +1235,7 @@
          case ex_resetgame:
 
   // SetTextMode (  ); //12345678
-			 StrechScreen=true;//bna++ shut on streech mode 
+	    EnableScreenStretch();//bna++ shut on streech mode 
             InitCharacter();
 
             InitializeMessages();
@@ -1232,7 +1320,7 @@
             MenuFixup ();
             playstate=ex_stillplaying;
 
-			StrechScreen=false;//bna++ shut off streech mode
+	    DisableScreenStretch();//bna++ shut off streech mode
 
          break;
 
@@ -1257,7 +1345,7 @@
 //		   SetTextMode (  ); //12345678
             Died ();
             StopWind();
-			 StrechScreen=false;//bna++ shut off streech mode
+			 DisableScreenStretch();//bna++ shut off streech mode
             while (damagecount>0)
                DoBorderShifts();
 
@@ -1438,6 +1526,11 @@
             demoplayback = false;
 
             Z_FreeTags (PU_LEVELSTRUCT, PU_LEVELEND);       // Free current level
+            if (predemo_violence != -1)
+            {
+               gamestate.violence = predemo_violence;
+               predemo_violence = -1;
+            }
             playstate=ex_titles;
          break;
 
@@ -1486,7 +1579,7 @@
 
    {
 
-   StrechScreen=true;//bna++
+   EnableScreenStretch();//bna++
 
    if ( pickquick )
       {
@@ -1831,7 +1924,7 @@
 				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
+				DisableScreenStretch();//dont strech when we go BACK TO GAME
 				DrawPlayScreen(true);//repaint ammo and life stat
 				VW_UpdateScreen ();//update screen
 		  }
@@ -2319,6 +2412,7 @@
       // Shrink screen
       if ( Keyboard[ sc_Minus ] )
          {
+         Keyboard[ sc_Minus ] = false; // HDG debounce
          if ( viewsize > 0 )
             {
             viewsize--;
@@ -2329,6 +2423,7 @@
       // Expand screen
       if ( Keyboard[ sc_Plus ] )
          {
+         Keyboard[ sc_Plus ] = false; // HDG debounce
          if ( viewsize < MAXVIEWSIZES - 1 )
             {
             viewsize++;
@@ -2542,12 +2637,29 @@
             {
             SaveScreen( false );
             }
+#ifdef DOS /* makes no sense under Linux as there are no lbm viewers there */
          else if ( Keyboard[ sc_Alt] && Keyboard[ sc_V ] )
             {
             SaveScreen( true );
             }
+#endif
       #endif
       }
+#ifdef USE_SDL
+      /* SDL doesn't send proper release events for these */
+      if (Keystate[sc_CapsLock])
+      {
+         Keystate[sc_CapsLock]++;
+         if (Keystate[sc_CapsLock] == 3)
+            Keystate[sc_CapsLock] = 0;
+      }
+      if (Keystate[0x45]) /* numlock */ 
+      {
+         Keystate[0x45]++;
+         if (Keystate[0x45] == 3)
+            Keystate[0x45] = 0;
+      }
+#endif
    waminot();
    }
 
@@ -3082,14 +3194,22 @@
 
    if (saveLBM)
    {
-      WriteLBMfile (filename, buffer, 320, 200);
+      WriteLBMfile (filename, buffer, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT);
+#if (DEVELOPMENT == 1)
       while (Keyboard[sc_CapsLock] && Keyboard[sc_C])
+#else
+      while (Keyboard[sc_Alt] && Keyboard[sc_V])
+#endif
            IN_UpdateKeyboard ();
    }
    else
    {
       WritePCX (filename, buffer);
+#if (DEVELOPMENT == 1)
       while (Keyboard[sc_CapsLock] && Keyboard[sc_X])
+#else
+      while (Keyboard[sc_Alt] && Keyboard[sc_C])
+#endif
            IN_UpdateKeyboard ();
    }
 

Modified: trunk/rott/rt_map.c
===================================================================
--- trunk/rott/rt_map.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_map.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -898,7 +898,7 @@
    int quitkey;
    ControlInfo control;
 
-StrechScreen = true;//bna++
+EnableScreenStretch();//bna++
 
    ShutdownClientControls();
 
@@ -1041,7 +1041,7 @@
 	   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
+	   DisableScreenStretch();//dont strech when we go BACK TO GAME
 	   VW_UpdateScreen ();
 	   DrawPlayScreen(true);//repaint ammo and life stat
 

Modified: trunk/rott/rt_menu.c
===================================================================
--- trunk/rott/rt_menu.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_menu.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -38,6 +38,7 @@
 #include <io.h>
 #elif PLATFORM_UNIX
 #include <unistd.h>
+#include <SDL/SDL.h>
 #endif
 
 #include <sys/types.h>
@@ -132,8 +133,6 @@
 
 int quicksaveslot=-1;
 
-extern char *tmpPICbuf;
-
 //******************************************************************************
 //
 // LOCALS
@@ -753,17 +752,18 @@
    "MOUSELOOK",
    "INVERSE MOUSE",
    "CROSS HAIR",
-   "JUMPING"
-
+   "JUMPING",
+   "FULLSCREEN"
    };
-CP_iteminfo ExtOptionsItems = { 20, MENU_Y, 4, 0, 43, ExtOptionsNames, mn_largefont };
+CP_iteminfo ExtOptionsItems = { 20, MENU_Y, 5, 0, 43, ExtOptionsNames, mn_largefont };
 
 CP_itemtype ExtOptionsMenu[] =
 {
    {1, "", 'M', NULL},
    {1, "", 'I', NULL},
    {1, "", 'C', NULL},
-   {1, "", 'J', NULL}
+   {1, "", 'J', NULL},
+   {1, "", 'F', NULL}
 };
    
 //bna added end
@@ -1757,7 +1757,7 @@
    StartGame = false;
  
    SetUpControlPanel();
-   StrechScreen=true;
+   EnableScreenStretch();
    //
    // F-KEYS FROM WITHIN GAME
    //
@@ -1842,7 +1842,7 @@
    // Main menu loop.  "Exit options" or "New game" exits
    //
    StartGame = false;
-   StrechScreen=true;
+   EnableScreenStretch();
 
    while( !StartGame )
       {
@@ -1861,7 +1861,7 @@
                }
 
             StartGame = true;
-			StrechScreen=false;//bna++ shut off streech mode
+			DisableScreenStretch();//bna++ shut off streech mode
             break;
 
          case -1:
@@ -1894,7 +1894,7 @@
 {    
 
    MenuNum = 1;
-		StrechScreen=true;//bna++ shut off streech mode
+		EnableScreenStretch();//bna++ shut off streech mode
    //
    // CHANGE "GAME" AND "DEMO"
    //
@@ -2632,9 +2632,9 @@
 
    do
       {
-	  StrechScreen=true;//bna++
+	  EnableScreenStretch();//bna++
       DrawOrderInfo( page );
-	  StrechScreen=false;//bna++ turn off or screen will be strected every time it passes VW_UpdateScreen
+	  DisableScreenStretch();//bna++ turn off or screen will be strected every time it passes VW_UpdateScreen
       if ( newpage )
          {
          while( Keyboard[ key ] )
@@ -2699,7 +2699,7 @@
 
    Keyboard[ key ] = 0;
    LastScan = 0;
- StrechScreen=true;//bna++
+ EnableScreenStretch();//bna++
    MN_PlayMenuSnd( SD_ESCPRESSEDSND );
    }
 
@@ -3173,7 +3173,7 @@
 
    gamestate.battlemode = battle_StandAloneGame;
    StartGame = true;
-   StrechScreen=false;
+   DisableScreenStretch();
    playstate = ex_resetgame;
 
 
@@ -3201,7 +3201,7 @@
    action = CP_DisplayMsg( ENDGAMESTR, 12 );
 
    StartGame = false;
-   StrechScreen=true;
+   EnableScreenStretch();
    if ( action )
       {
       EndGameStuff ();
@@ -3307,7 +3307,7 @@
       if (LoadTheGame (which, &game) == true)
       {
          MenuFixup ();
-		 StrechScreen=false;
+		 DisableScreenStretch();
          StartGame = true;
 			exit      = 1;
       }
@@ -5036,7 +5036,7 @@
 
 void DoMainMenu (void)
 {
-		StrechScreen=true;//bna++ shut on streech mode
+		EnableScreenStretch();//bna++ shut on streech mode
    SetAlternateMenuBuf();
    ClearMenuBuf();
    DrawMainMenu();
@@ -5351,6 +5351,7 @@
 extern boolean usemouselook;
 extern int iG_aimCross;
 extern boolean usejump;
+extern boolean sdl_fullscreen;
 
 void CP_ExtOptionsMenu (void)
 {
@@ -5374,6 +5375,13 @@
 				 break;
          case 2: iG_aimCross   ^= 1; DrawExtOptionsButtons (); break;
          case 3: usejump       ^= 1; DrawExtOptionsButtons (); break;
+         case 4:
+            if (SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()))
+            {
+               sdl_fullscreen ^= 1;
+               DrawExtOptionsButtons ();
+            }
+            break;
       }
 
 	} while (which >= 0);
@@ -5405,6 +5413,7 @@
             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;
+            case 4: if (sdl_fullscreen== 1) on = 1; break;
          }
 
          if (on)
@@ -5697,7 +5706,7 @@
             if ( status )
                {
                StartGame   = true;
-			      StrechScreen=false;
+			      DisableScreenStretch();
                handlewhich = -2;
                playstate   = ex_resetgame;
                BATTLEMODE  = true;
@@ -7156,7 +7165,7 @@
 
    {
    int i;
-    StrechScreen=true;
+    EnableScreenStretch();
        // SetTextMode (  );
 
 	SetAlternateMenuBuf();
@@ -7209,7 +7218,7 @@
    FlipMenuBuf();
 	RefreshMenuBuf (0);
 
-	 StrechScreen=false;
+	 DisableScreenStretch();
    }
 
 

Modified: trunk/rott/rt_net.c
===================================================================
--- trunk/rott/rt_net.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_net.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -95,6 +95,7 @@
 			*lastdemoptr,
          *demobuffer=NULL;
 boolean  demodone = false;
+int      predemo_violence = -1;
 int oldmomx;
 int oldmomy;
 int oldspdang;
@@ -3080,6 +3081,7 @@
 
    filename[4] = (char)('0' + (byte)demonumber);
    filename[6] = (char)('0' + (byte)gamestate.violence);
+   FixFilePath(filename);
 }
 //****************************************************************************
 //
@@ -3095,8 +3097,19 @@
    if (access (demo, F_OK) == 0)
       return true;
    else
-      return false;
-
+   {
+      /* Saves the users violence level, only do this once, otherwise
+         we might override the saved level with one already modified by us */
+      if (predemo_violence == -1)
+         predemo_violence = gamestate.violence;
+      /* The demos distributed with rott are all for a violence level of 3 */
+      gamestate.violence = 3;
+      GetDemoFilename (demonumber, &demo[0]);
+      if (access (demo, F_OK) == 0)
+         return true;
+      else
+         return false;
+   }
 }
 
 //****************************************************************************

Modified: trunk/rott/rt_net.h
===================================================================
--- trunk/rott/rt_net.h	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_net.h	2008-05-24 06:29:59 UTC (rev 228)
@@ -263,6 +263,7 @@
 					 *lastdemoptr,
                 *demobuffer;
 extern boolean  demodone;
+extern int      predemo_violence;
 
 void     ControlPlayer (void);
 void     ControlRemote (objtype * ob);

Modified: trunk/rott/rt_str.c
===================================================================
--- trunk/rott/rt_str.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_str.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -1455,7 +1455,8 @@
 
 void US_CenterWindow (int w, int h)
 {
-   US_DrawWindow (((MaxX / 8) - w) / 2,((MaxY / 8) - h) / 2, w, h);
+   //HDG US_DrawWindow (((MaxX / 8) - w) / 2,  ((MaxY / 8) - h) / 2, w, h);
+   US_DrawWindow (((iGLOBAL_SCREENWIDTH / 8) - w) / 2,((iGLOBAL_SCREENHEIGHT / 8) - h) / 2, w, h);
 }
 
 
@@ -1521,7 +1522,7 @@
 
    mask = 1 << ( px & 3 );
 
-   if ((iGLOBAL_SCREENWIDTH <= 320)||(StrechScreen == true)){
+   if ((iGLOBAL_SCREENWIDTH <= 320)||(StretchScreen == true)){
 	   while( width-- )
 	   {
 		  VGAMAPMASK( mask );

Modified: trunk/rott/rt_ted.c
===================================================================
--- trunk/rott/rt_ted.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_ted.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -74,8 +74,6 @@
 // GLOBAL VARIABLES
 //========================================
 
-extern char *tmpPICbuf;
-extern int  iXmas;
 extern boolean  UseBaseMarker;
 
 teamtype TEAM[MAXPLAYERS];
@@ -1235,7 +1233,7 @@
 				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++
+			DisableScreenStretch();//bna++
 			VW_UpdateScreen ();//bna++
             lastcache++;
             ticdelay--;
@@ -1251,7 +1249,7 @@
                }
             }
          }
-	  StrechScreen=false;//bna++
+	  DisableScreenStretch();//bna++
 	  VW_UpdateScreen ();//bna++
 	  //I_Delay(200);
       bufferofs=tempbuf;
@@ -1265,7 +1263,7 @@
 		WHratio = WHratio/100;
 ///	iGLOBAL_SCREENWIDTH = 640;
 //	iGLOBAL_SCREENHEIGHT = 480;
-StrechScreen=false;
+DisableScreenStretch();
 
 	// Cache in fonts
 //	shape = W_CacheLumpNum (W_GetNumForName ("newfnt1"), PU_STATIC, Cvt_font_t, 1);
@@ -1285,7 +1283,7 @@
          while (!IN_CheckAck ())
             ;
          }
- //  StrechScreen=true;
+ //  EnableScreenStretch();
 #if (DEVELOPMENT == 1)
       tempbuf=bufferofs;
       bufferofs=displayofs;
@@ -5749,6 +5747,10 @@
 	SNAKELEVEL = 0;
 	whichpath = 0;
 
+	// som of the code / calls below need bufferofs & friends to point
+	// to to the real screen, not the stretch buffer
+	DisableScreenStretch();//bna++ shut off streech mode
+
 	InitializePlayerstates();
 
 	ResetCheatCodes();
@@ -5898,6 +5900,8 @@
 	insetupgame=false;
 
 	tedlevel = false;   // turn it off once we have done any ted stuff
+	
+	EnableScreenStretch();
 }
 
 

Modified: trunk/rott/rt_vid.c
===================================================================
--- trunk/rott/rt_vid.c	2008-05-24 06:29:04 UTC (rev 227)
+++ trunk/rott/rt_vid.c	2008-05-24 06:29:59 UTC (rev 228)
@@ -321,7 +321,8 @@
 
 void VWB_DrawPic (int x, int y, pic_t *pic)
 {
-   if (VW_MarkUpdateBlock (x, y, x+(pic->width<<2)-1, y+(pic->height)-1))
+   if (((iGLOBAL_SCREENWIDTH > 320) && !StretchScreen) ||
+       VW_MarkUpdateBlock (x, y, x+(pic->width<<2)-1, y+(pic->height)-1))
       VL_MemToScreen ((byte *)&pic->data, pic->width, pic->height, x, y);
 }
 
@@ -397,7 +398,8 @@
 
 void VWB_Bar (int x, int y, int width, int height, int color)
 {
-   if (VW_MarkUpdateBlock (x,y,x+width,y+height-1) )
+   if (((iGLOBAL_SCREENWIDTH > 320) && !StretchScreen) ||
+       VW_MarkUpdateBlock (x,y,x+width,y+height-1) )
       VL_Bar (x, y, width, height, color);
 }
 
@@ -1190,7 +1192,7 @@
    }
 
    SafeFree(origbuf);
-   StrechScreen=true;//bna++ shut on streech mode
+   EnableScreenStretch();//bna++ shut on streech mode
    if (flip==true)
       VW_UpdateScreen ();
 




More information about the rott-commits mailing list