ref: dbfdc2fba9c9eb2951ff08b8faacacbb8bb96967
parent: d004868546268123d021e56ea406d80354f27faf
parent: 886901351ca693f41e5ff132f9827c1eeeac63e6
author: LTCHIPS <ltchips994@gmail.com>
date: Sat May 19 16:30:27 EDT 2018
Merge branch 'screeneffect'
--- a/rott/Makefile
+++ b/rott/Makefile
@@ -14,7 +14,7 @@
# Regular build flags and rules
-CC ?= gcc
+CC ?= gccs
CFLAGS ?= -g -O2
CFLAGS += -Wall -Wno-unused
--- a/rott/modexlib.c
+++ b/rott/modexlib.c
@@ -36,6 +36,7 @@
#include "rt_view.h"
#include "queue.h"
#include "lumpy.h"
+#include "SDL2/SDL2_rotozoom.h"
//#include <SDL2/SDL_image.h>
@@ -110,11 +111,6 @@
SDL_SetRelativeMouseMode(SDL_TRUE);
- //SDL_WM_GrabInput(SDL_GRAB_ON);
- //SDL_WM_SetCaption ("Rise of the Triad", "ROTT");
- //SDL_ShowCursor (0);
-// sdl_surface = SDL_SetVideoMode (320, 200, 8, flags);
-
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
if (sdl_fullscreen)
flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
@@ -124,7 +120,11 @@
iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT,
flags);
- //SDL_CreateWindowAndRenderer(iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, 0, &window, &renderer);
+ if (window == NULL)
+ {
+ Error ("Could not set video mode\n");
+ exit(1);
+ }
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
@@ -132,24 +132,14 @@
SDL_TEXTUREACCESS_STREAMING, iGLOBAL_SCREENWIDTH,
iGLOBAL_SCREENHEIGHT);
-
- //sdl_surface = SDL_SetVideoMode (iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, 8, flags);
sdl_surface = SDL_CreateRGBSurface(0,iGLOBAL_SCREENWIDTH,iGLOBAL_SCREENHEIGHT,8,0,0,0,0);
+
+
SDL_SetSurfaceRLE(sdl_surface, 1);
SDL_RenderSetLogicalSize(renderer, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT);
- //sdl_draw_obj_queue = malloc(sizeof(Queue));
-
- //queueInit(sdl_draw_obj_queue, sizeof(SDLDrawObj));
-
- //ToggleFullscreen();
- if (window == NULL)
- {
- Error ("Could not set video mode\n");
- }
-
}
/*
@@ -278,7 +268,7 @@
*/
void VL_CopyBufferToAll ( byte *buffer )
{
- STUB_FUNCTION;
+ //STUB_FUNCTION;
}
/*
@@ -416,7 +406,7 @@
void RenderSurface(void)
{
- SDL_Texture *newTex = SDL_CreateTextureFromSurface(renderer, sdl_surface);
+ SDL_Texture * newTex = SDL_CreateTextureFromSurface(renderer, sdl_surface);
if (newTex == NULL)
{
@@ -515,6 +505,7 @@
page3start = sdl_surface->pixels;
StretchScreen = 0;
SDL_RenderSetLogicalSize(renderer, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT);
+ //SDL_RenderSetLogicalSize(renderer, 320, 200);
}
@@ -630,3 +621,46 @@
}
+//extern int tics;
+
+//void CalcTics (void);
+
+//void DrawRotatedScreen(int cx, int cy, byte *destscreen, int angle, int scale, int masked)
+
+void DoScreenRotateScale(int w, int h, SDL_Texture * tex, float angle, float scale)
+{
+
+ SDL_RenderClear(renderer);
+
+ SDL_Rect output;
+
+ output.w = abs((int)((float)w * scale));
+
+ output.h = abs((int)((float)h * scale));
+
+ //if (output.w < MinScreenWidth)
+ //output.w = MinScreenWidth;
+ //if (output.h < MinScreenHeight)
+ //output.h = MinScreenHeight;
+
+ output.x = (iGLOBAL_SCREENWIDTH - output.w)>>1;
+
+ output.y = (iGLOBAL_SCREENHEIGHT - output.h)>>1;
+
+ SDL_RenderCopyEx(renderer, tex, NULL, &output, angle, NULL, SDL_FLIP_NONE);
+
+ SDL_RenderPresent(renderer);
+
+
+}
+
+SDL_Texture * GetMainSurfaceAsTexture(void)
+{
+ return SDL_CreateTextureFromSurface(renderer, sdl_surface);
+}
+
+const SDL_Renderer * GetRenderer(void)
+{
+ return renderer;
+
+}
\ No newline at end of file
--- a/rott/modexlib.h
+++ b/rott/modexlib.h
@@ -139,6 +139,7 @@
void VL_CopyPlanarPage ( byte * src, byte * dest );
void VL_CopyPlanarPageToMemory ( byte * src, byte * dest );
void XFlipPage ( void );
+void DoScreenRotateScale(int w, int h, SDL_Texture * tex, float angle, float scale);
void WaitVBL( void );
void TurnOffTextCursor ( void );
--- a/rott/rt_debug.c
+++ b/rott/rt_debug.c
@@ -1360,6 +1360,8 @@
extern boolean ricochetingRocketsEnabled;
+void RotationFunSDL(void);
+
void CheckCode (int which)
{
int pos = (LastLetter-1)&(MAXLETTERS-1);
@@ -1614,7 +1616,7 @@
case ROTATIONFUN:
ShutdownClientControls();
- RotationFun();
+ RotationFunSDL();
StartupClientControls();
SetupScreen( true );
break;
--- a/rott/rt_draw.c
+++ b/rott/rt_draw.c
@@ -2662,7 +2662,10 @@
========================
*/
+//void RotateScreen(int startAngle, int endAngle, int startScale, int endScale, int time, int option, boolean fadeOut);
+void RotateScreenScaleFloat(float startAngle, float endAngle, float startScale, float endScale, int time, boolean fadeOut, boolean drawPlayScreen);
+
int playerview=0;
void ThreeDRefresh (void)
{
@@ -2770,7 +2773,12 @@
ShutdownClientControls();
bufferofs-=screenofs;
DrawPlayScreen (true);
- RotateBuffer(0,FINEANGLES,FINEANGLES*8,FINEANGLES,(VBLCOUNTER*3)/4);
+ //void RotateScreen(int startAngle, int endAngle, int startScale, int endScale, int time);
+
+ RotateScreenScaleFloat(0, 360, 0.01875, 1.0, (VBLCOUNTER*3)/4, false, true);
+
+ //RotateScreen(0,FINEANGLES,FINEANGLES,FINEANGLES*8,(VBLCOUNTER*3)/4, 0, false);
+ //RotateBuffer(0,FINEANGLES,FINEANGLES*8,FINEANGLES,(VBLCOUNTER*3)/4);
bufferofs+=screenofs;
fizzlein = false;
StartupClientControls();
@@ -2976,9 +2984,9 @@
//RotatedImage=SafeMalloc(131072*8);
- int amountToAlloc = ((iGLOBAL_SCREENWIDTH * iGLOBAL_SCREENHEIGHT)*2) + 3072; //this replaces 131072
+ //int amountToAlloc = ((iGLOBAL_SCREENWIDTH * iGLOBAL_SCREENHEIGHT)*2) + 3072; //this replaces 131072
- RotatedImage = SafeMalloc(amountToAlloc);
+ RotatedImage = SafeMalloc(131072);
/*
if (iGLOBAL_SCREENWIDTH == 320) {
@@ -3008,9 +3016,9 @@
//SetupScreen(false);//used these 2 to test screen size
//VW_UpdateScreen ();
if (masked==0)
- memset(RotatedImage, 0, amountToAlloc);
+ memset(RotatedImage, 0, 131072);
else
- memset(RotatedImage, 0xff, amountToAlloc);
+ memset(RotatedImage, 0xff, 131072);
/*
if (iGLOBAL_SCREENWIDTH == 320) {
memset(RotatedImage,0,131072);
@@ -3145,25 +3153,31 @@
////zxcv
DisableScreenStretch();//bna++
+ anglestep = (endangle-startangle)<<16/time;
+ scalestep = (endscale-startscale)<<6/time;
- anglestep=((endangle-startangle)<<16)/time;
- scalestep=((endscale-startscale)<<6)/time;
+ angle = startangle<<16;
- angle=(startangle<<16);
-
scale=(startscale<<6);
CalcTics();
CalcTics();
+ //SDL_SetRelativeMouseMode(SDL_FALSE);
+
for (i=0; i<time; i+=tics)
{ //zxcv
DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,(angle>>16)&(FINEANGLES-1),scale>>6,0);
+
FlipPage();
scale+=(scalestep*tics);
angle+=(anglestep*tics);
CalcTics();
}
+
+ //FreeSDLSurfaceZoom();
+ //SDL_SetRelativeMouseMode(SDL_TRUE);
+
DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
FlipPage();
DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
@@ -3200,7 +3214,7 @@
//save off fastcounter
savetics=GetFastTics();
-
+
StartupRotateBuffer (0);
ScaleAndRotateBuffer (startangle, endangle, startscale, endscale, time);
@@ -3211,7 +3225,168 @@
SetFastTics(savetics);
}
+const SDL_Renderer * GetRenderer(void);
+void DoScreenRotateScale(int cx, int cy, SDL_Texture * tex, float angle, float scale);
+
+void VL_FadeOutScaledScreen (int start, int end, int red, int green, int blue, int steps, float scale);
+
+
+void RotateScreenScaleFloat(float startAngle, float endAngle, float startScale, float endScale, int time, boolean fadeOut, boolean drawPlayScreen)
+{
+ DisableScreenStretch();
+
+ //STUB_FUNCTION;
+ //printf("ROTATE SCREEN FLOAT FUNC: \n");
+ //printf("startAngle: %f \n", startAngle);
+ //printf("endAngle: %f \n", endAngle);
+ //printf("startScale: %f \n", startScale);
+ //printf("endScale: %f \n", endScale);
+ //printf("time: %d \n", time);
+
+ float angle = startAngle;
+
+ float scalestep = (endScale - startScale)/(time);
+
+ float scale = startScale;
+
+ float anglestep = (endAngle - startAngle)/(time);
+
+ //printf("anglestep: %f \n", anglestep);
+ //printf("scalestep: %f \n", scalestep);
+ //printf("startingScale: %f \n", scale);
+
+ CalcTics();
+ CalcTics();
+
+ int i;
+
+ SDL_Texture * newTex = SDL_CreateTextureFromSurface((SDL_Renderer *) GetRenderer(), sdl_surface);
+
+ float factor;
+
+ for (i=0; i<time; i+=tics)
+ {
+ factor = scale;
+
+ //printf("factor: %f \n", factor);
+
+ DoScreenRotateScale(iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, newTex, angle, factor);
+
+ scale+=(scalestep);
+ //if (angle < endAngle)
+ angle+=(anglestep);
+
+ CalcTics();
+
+ //printf("scaleDRAW: %f \n", scale);
+
+ }
+
+ //printf("factor: %f \n", factor);
+
+ if(fadeOut == true)
+ VL_FadeOutScaledScreen (0, 255, 0,0,0,VBLCOUNTER>>1, endScale);
+
+ //DoScreenRotateScale(iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, newTex, 0, 1.0);
+
+ SDL_DestroyTexture(newTex);
+
+
+ if(drawPlayScreen)
+ DrawPlayScreen(true);//repaint ammo and life stat
+
+}
+
+//A note about option
+//When option is set to
+// 0: factor is set to equal scale value every time. This is good for starting from a small screen to eventually grow to a larger screen.
+// 1: factor is set to equal 1 + scale value. This is good for zooming into the screen.
+// 2: factor is set to equal 1 - scale value. This is good for zooming out from the screen.
+/*
+void RotateScreen(int startAngle, int endAngle, int startScale, int endScale, int time, int option, boolean fadeOut)
+{
+ DisableScreenStretch();
+
+ //STUB_FUNCTION;
+
+ printf("ROTATE SCREEN FUNC: \n");
+ printf("startAngle: %d \n", startAngle);
+ printf("endAngle: %d \n", endAngle);
+ printf("startScale: %d \n", startScale);
+ printf("endScale: %d \n", endScale);
+ printf("time: %d \n", time);
+
+ int angle = startAngle;
+
+ float scalestep = (1.0 - ((float)startScale/(float)endScale))/((float)time);
+
+ float scale = ((float)startScale/(float)endScale);
+
+ if (option == 1)
+ {
+ scale = 1.0;
+ }
+
+ int anglestep = (endAngle - startAngle)/(time*5.49); //added *6 because it was rotating too effing fast
+
+ //printf("anglestep: %d \n", anglestep);
+ printf("scalestep: %f \n", scalestep);
+ printf("startingScale: %f \n", scale);
+
+ CalcTics();
+ CalcTics();
+
+ int i;
+
+ int x;
+
+ int y;
+
+ SDL_Texture * newTex = SDL_CreateTextureFromSurface((SDL_Renderer *) GetRenderer(), sdl_surface);
+
+ float factor;
+
+ for (i=0; i<time; i+=tics)
+ {
+ if (option == 0)
+ factor = scale;
+ if (option == 1)
+ factor = abs(1 + (scale*-1.0));
+ if (option == 2)
+ factor = 1 - scale;
+ else
+ factor = scale;
+
+ //printf("factor: %f \n", factor);
+
+ DoScreenRotateScale(iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, newTex, angle, factor);
+
+ scale+=(scalestep);
+ if (angle < endAngle)
+ angle+=(anglestep);
+
+ CalcTics();
+
+ //printf("scaleDRAW: %f \n", scale);
+
+ }
+
+ //printf("factor: %f \n", factor);
+
+ if(fadeOut == true)
+ VL_FadeOutScaledScreen (0, 255, 0,0,0,VBLCOUNTER>>1, abs(factor));
+
+ //DoScreenRotateScale(iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, newTex, 0, 1.0);
+
+ SDL_DestroyTexture(newTex);
+
+ DrawPlayScreen(true);//repaint ammo and life stat
+
+}
+*/
+
+
//******************************************************************************
//
// DrawRotatedScreen
@@ -3250,10 +3425,15 @@
xst = (((-cx)*s)+((328)<<16))-(cy*c);
xct = (((-cx)*c)+((397)<<16)+(1<<18)-(1<<16))+(cy*s);
}//328 397
- else if ((iGLOBAL_SCREENWIDTH >= 1024 )&&(masked == false)) {
+ else if ((iGLOBAL_SCREENWIDTH == 1024 )&&(masked == false)) {
xst = (((-cx)*s)+((410)<<16))-(cy*c);// 1024/768=1.3333
xct = (((-cx)*c)+((500)<<16)+(1<<18)-(1<<16))+(cy*s);
- }//388 397
+ }//388 397
+ else if ((iGLOBAL_SCREENWIDTH >= 1152) && (masked == false))
+ {
+ xst = (((-cx)*s)+((432)<<16))-(cy*c);
+ xct = (((-cx)*c)+((576)<<16)+(1<<18)-(1<<16))+(cy*s);
+ }
mr_xstep=s;
mr_ystep=c;
@@ -3454,6 +3634,71 @@
#endif
+void RotationFunSDL(void)
+{
+ int angle;
+ float scale;
+ int x,y;
+ word buttons;
+
+ //save off fastcounter
+
+
+ angle=0;
+ //scale=FINEANGLES;
+ scale=1.0;
+
+ //StartupRotateBuffer (0);
+
+ CalcTics();
+ CalcTics();
+
+ SDL_Texture * currScreen = SDL_CreateTextureFromSurface((SDL_Renderer *) GetRenderer(), sdl_surface);
+
+ while (!Keyboard[sc_Escape])
+ {
+ IN_UpdateKeyboard ();
+ //printf("PRE SCALE \n");
+
+ DoScreenRotateScale(iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT,
+ currScreen, angle, scale);
+
+ //printf("POST SCALE \n");
+ //DrawRotatedScreen(iGLOBAL_SCREENWIDTH/2,iGLOBAL_SCREENHEIGHT/2,(byte *)bufferofs,angle,scale,0);
+ //FlipPage();
+ CalcTics();
+ INL_GetMouseDelta(&x, &y);
+ buttons=IN_GetMouseButtons ();
+ angle=(angle-x)&(FINEANGLES-1);
+ if (buttons & (1 << 0))
+ {
+ if (scale>0)
+ {
+ scale-=0.01;
+ //printf("new width: %f \n", (float)iGLOBAL_SCREENWIDTH * scale);
+ //printf("new height: %f \n", (float)iGLOBAL_SCREENHEIGHT * scale);
+ //printf("scale: %f \n", scale);
+
+ }
+ }
+ else if (buttons & (1 << 1))
+ {
+ scale+=0.01;
+ //printf("new width: %f \n", (float)iGLOBAL_SCREENWIDTH * scale);
+ //printf("new height: %f \n", (float)iGLOBAL_SCREENHEIGHT * scale);
+ //printf("scale: %f \n", scale);
+ }
+ }
+ SDL_DestroyTexture(currScreen);
+
+ CalcTics();
+ CalcTics();
+ Keyboard[sc_Escape]=0;
+
+ //ShutdownRotateBuffer ();
+}
+
+
//******************************************************************************
//
// RotationFun
@@ -3480,7 +3725,8 @@
while (!Keyboard[sc_Escape])
{
IN_UpdateKeyboard ();
- DrawRotatedScreen(160,100,(byte *)bufferofs,angle,scale,0);
+
+ DrawRotatedScreen(iGLOBAL_SCREENWIDTH/2,iGLOBAL_SCREENHEIGHT/2,(byte *)bufferofs,angle,scale,0);
FlipPage();
CalcTics();
INL_GetMouseDelta(&x, &y);
@@ -5912,7 +6158,7 @@
*/
while (count--) {
eax = edx >> 16;
- if (eax < (256*(iGLOBAL_SCREENWIDTH/320)) && (ecx >> 16) < (512*((iGLOBAL_SCREENWIDTH/320 + iGLOBAL_SCREENHEIGHT/200)<<1))) {
+ if (eax < (256*4) && (ecx >> 16) < (512*4)) {
eax = (eax << 10) | ((ecx << 6) >> (32-10));
} else {
eax = 0;
--- a/rott/rt_draw.h
+++ b/rott/rt_draw.h
@@ -112,6 +112,7 @@
int CalcHeight (void);
void DoLoadGameSequence( void );
void RotateBuffer (int startangle, int endangle, int startscale, int endscale, int time);
+void RotateScreenScaleFloat(float startAngle, float endAngle, float startScale, float endScale, int time, boolean fadeOut, boolean drawPlayScreen);
void ApogeeTitle (void);
void DopefishTitle (void);
void RotationFun (void);
--- a/rott/rt_game.c
+++ b/rott/rt_game.c
@@ -423,8 +423,8 @@
shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
- DrawTiledRegion( 0, iGLOBAL_SCREENHEIGHT - 16*hudRescaleFactor, iGLOBAL_SCREENWIDTH, 13, 10,10, shape );
- DrawTiledRegion( 0, iGLOBAL_SCREENHEIGHT - 29*hudRescaleFactor, iGLOBAL_SCREENWIDTH, 3, 10,10, shape );
+ DrawTiledRegion( 0, iGLOBAL_SCREENHEIGHT - 16*hudRescaleFactor, iGLOBAL_SCREENWIDTH, 13*hudRescaleFactor, 10,10, shape );
+ //DrawTiledRegion( 0, iGLOBAL_SCREENHEIGHT - 29*hudRescaleFactor, iGLOBAL_SCREENWIDTH, 3*hudRescaleFactor, 10,10, shape );
//apparently the line below was causing segfaults on linux...
@@ -434,12 +434,10 @@
//enqueue(sdl_draw_obj_queue, shape);
- GameMemToScreen( shape, topBarCenterOffsetX, iGLOBAL_SCREENHEIGHT - 16, bufferofsonly ); //using topBarCenterOffsetX since bottbar dims == statbar dims
+ //GameMemToScreen( shape, topBarCenterOffsetX, iGLOBAL_SCREENHEIGHT - 16, bufferofsonly ); //using topBarCenterOffsetX since bottbar dims == statbar dims
}
-
-
- //GameMemToScreen( shape, topBarCenterOffsetX, iGLOBAL_SCREENHEIGHT - 16, bufferofsonly ); //using topBarCenterOffsetX since bottbar dims == statbar dims
+ GameMemToScreen( shape, topBarCenterOffsetX, iGLOBAL_SCREENHEIGHT - 16, bufferofsonly ); //using topBarCenterOffsetX since bottbar dims == statbar dims
//}
@@ -4280,6 +4278,11 @@
#define DEATHROTATE 6
+//void RotateScreen(int startAngle, int endAngle, int startScale, int endScale, int time, int option, boolean fadeOut);
+
+//void RotateScreenScaleFloat(float startAngle, float endAngle, float startScale, float endScale, int time, boolean fadeOut, boolean drawPlayScreen);
+
+
extern boolean dopefish;
void Died (void)
{
@@ -4506,28 +4509,48 @@
int rng;
rng = RandomNumber ("Died",0);
-
+
+ //zooms in on screen
if (pstate->falling==true)
{
- RotateBuffer (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)));
+ //RotateBuffer (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)));
+ //RotateScreen (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)), 1, true);
+ RotateScreenScaleFloat(0, 0, 1.0, 64.0, (VBLCOUNTER*(1+slowrate)), true, false);
+
SD_Play (SD_PLAYERTCDEATHSND+(pstate->player));
pstate->falling=false;
}
-
+ //zooms out w/o spinning
else if (rng < 64)
- RotateBuffer (0, 0, (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(2+slowrate)));
+ {
+ //RotateBuffer (0, 0, (FINEANGLES>>6), (FINEANGLES), (VBLCOUNTER*(2+slowrate)));
+ //RotateScreen (0, 0, (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(2+slowrate)), 2, true);
+ RotateScreenScaleFloat(0, 0, 1.0, 0.01875, (VBLCOUNTER*(2+slowrate)), true, false);
+
+ }
+ //zooms in on screen
else if (rng < 128)
{
- RotateBuffer (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)));
+ //RotateBuffer (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)));
+ //RotateScreen(0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)), 1, true);
+ RotateScreenScaleFloat(0, 0, 1.0, 64.0, (VBLCOUNTER*(1+slowrate)), true, false);
+
}
+ //zooms out with spinning
else if (rng < 192)
- RotateBuffer(0, (FINEANGLES*4), (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(3+slowrate)));
- else
+ {
+ //RotateBuffer(0, (FINEANGLES*4), (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(3+slowrate)));
+ RotateScreenScaleFloat(0, (360.0*3), 1.0, 0.01875, (VBLCOUNTER*(3+slowrate)), true, false);
+ }
+ //fade to red
+ else{
VL_FadeToColor (VBLCOUNTER*2, 100, 0, 0);
+ VL_FadeOut (0, 255, 0,0,0,VBLCOUNTER>>1);
+ }
screenfaded=false;
- VL_FadeOut (0, 255, 0,0,0,VBLCOUNTER>>1);
+
gamestate.episode = 1;
player->flags &= ~FL_DONE;
@@ -4548,18 +4571,36 @@
SD_Play (SD_GAMEOVERSND);
rng=RandomNumber("Died",0);
+
+ //rng = 63;
if (rng<64)
- RotateBuffer(0,(FINEANGLES>>1),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)));
+ {
+ //RotateBuffer(0,(FINEANGLES>>1),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)));
+ //RotateScreen(0,(FINEANGLES>>1),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)), 2, true);
+ RotateScreenScaleFloat(0, 360, 1.0, 0.01875, (VBLCOUNTER*(3+slowrate)), true, false);
+
+ }
else if (rng<128)
+ {
VL_FadeToColor (VBLCOUNTER*3, 255, 255, 255);
+ VL_FadeOut (0, 255, 0,0,0,VBLCOUNTER>>1);
+ }
else if (rng<192)
- RotateBuffer(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)));
+ {
+ //RotateBuffer(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)));
+ //RotateScreen(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)), 2, true);
+ RotateScreenScaleFloat(0, 360*2, 1.0, 0.01875, (VBLCOUNTER*(3+slowrate)), true, false);
+ }
else
- RotateBuffer(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)));
-
+ {
+ //RotateBuffer(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)));
+ //RotateScreen(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)), 2, true);
+ RotateScreenScaleFloat(0, 360*2, 1.0, 0.01875, (VBLCOUNTER*(3+slowrate)), true, false);
+
+ }
screenfaded=false;
- VL_FadeOut (0, 255, 0,0,0,VBLCOUNTER>>1);
+ //VL_FadeOut (0, 255, 0,0,0,VBLCOUNTER>>1);
MU_StartSong(song_gameover);
--- a/rott/rt_main.c
+++ b/rott/rt_main.c
@@ -2084,6 +2084,8 @@
}
ControlPanel( LastScan );
+
+
// set detail level
doublestep = 2 - DetailLevel;
--- a/rott/rt_menu.c
+++ b/rott/rt_menu.c
@@ -1891,7 +1891,6 @@
Keyboard[ sc_F9 ] = 0;
loadsavesound = true;
- CP_LoadGame( 1, 0 );
break;
case sc_F10:
@@ -5610,7 +5609,7 @@
{
case 0:
if (!sdl_fullscreen){
- SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
+ SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
sdl_fullscreen ^= 1;
borderWindow = 0;
borderlessWindow = 0;
--- a/rott/rt_vid.c
+++ b/rott/rt_vid.c
@@ -622,7 +622,70 @@
screenfaded = true;
}
+SDL_Texture * GetMainSurfaceAsTexture();
+//void DoScreenRotateScale(int, int, SDL_Texture * , int, float);
+
+void VL_FadeOutScaledScreen (int start, int end, int red, int green, int blue, int steps, float scale)
+{
+ int i,j,orig,delta;
+ byte *origptr, *newptr;
+
+ if (screenfaded)
+ return;
+
+ WaitVBL ();
+ VL_GetPalette (&palette1[0][0]);
+ memcpy (palette2, palette1, 768);
+
+//
+// fade through intermediate frames
+//
+ for (i = 0; i < steps; i++)
+ {
+
+ origptr = &palette1[start][0];
+ newptr = &palette2[start][0];
+
+ for (j = start; j <= end; j++)
+ {
+ orig = *origptr++;
+ delta = red-orig;
+ *newptr++ = orig + delta * i / steps;
+ orig = *origptr++;
+ delta = green-orig;
+ *newptr++ = orig + delta * i / steps;
+ orig = *origptr++;
+ delta = blue-orig;
+ *newptr++ = orig + delta * i / steps;
+ }
+
+ WaitVBL ();
+ VL_SetPalette (&palette2[0][0]);
+
+ //printf("%d \n", (int)((float)iGLOBAL_SCREENWIDTH*scale));
+ //printf("%d \n", (int)((float)iGLOBAL_SCREENHEIGHT*scale));
+ //printf("%f \n", scale);
+
+ SDL_Texture * tex = GetMainSurfaceAsTexture();
+
+ DoScreenRotateScale(iGLOBAL_SCREENWIDTH,iGLOBAL_SCREENHEIGHT, tex, 0, scale);
+
+ SDL_DestroyTexture(tex);
+ }
+
+//
+// final color
+//
+ VL_FillPalette (red,green,blue);
+
+ screenfaded = true;
+
+
+
+}
+
+
/*
=================
=
@@ -924,7 +987,7 @@
void SetBorderColorInterrupt (int color)
{
- STUB_FUNCTION;
+ //STUB_FUNCTION;
}
--- a/rott/winrott.c
+++ b/rott/winrott.c
@@ -63,6 +63,11 @@
iG_SCREENWIDTH = iGLOBAL_SCREENWIDTH*(96/320);;// default screen width in bytes
dTopYZANGLELIMIT = (44*FINEANGLES/360);;
+
+ //MinScreenWidth = ((float)iGLOBAL_SCREENWIDTH * 0.01875);
+
+ //MinScreenHeight = ((float)iGLOBAL_SCREENHEIGHT * 0.02);
+
}
//----------------------------------------------------------------------