ref: 6504274b40c5543755558a9013cdf4dc4815d579
parent: 489346a26021cce3fa2d3ea9bd62ba9d20b54f74
author: LTCHIPS <ltchips994@gmail.com>
date: Thu May 10 13:23:22 EDT 2018
made special fadeout function that does fade out on a smaller screen
--- a/rott/modexlib.c
+++ b/rott/modexlib.c
@@ -61,8 +61,6 @@
SDL_Surface *sdl_surface = NULL;
-static SDL_Surface * sdl_zoomed_surface = NULL;
-
SDL_Window * window = NULL;
static SDL_Renderer * renderer = NULL;
@@ -1043,27 +1041,14 @@
void DoScreenRotateScale(int w, int h, SDL_Texture * tex, int angle, float scale)
{
- //printf("SCALE \n");
-/*
- printf("center x: %d \n", w);
- printf("center y: %d \n", h);
- printf("angle: %d \n", angle);
- printf("scale: %f \n", scale);
-*/
SDL_RenderClear(renderer);
SDL_Rect output;
+ output.w = (int)((float)w * scale);
- output.w = w;
-
- output.h = h;
-
-/*
- printf("width: %d \n", output.w);
- printf("height: %d \n", output.h);
-*/
+ output.h = (int)((float)h * scale);
output.x = (iGLOBAL_SCREENWIDTH - output.w)>>1;
--- 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, int, SDL_Texture * , int, float);
void WaitVBL( void );
void TurnOffTextCursor ( void );
--- a/rott/rt_draw.c
+++ b/rott/rt_draw.c
@@ -2729,7 +2729,7 @@
========================
*/
-void RotateScreen(int startAngle, int endAngle, int startScale, int endScale, int time, int option);
+void RotateScreen(int startAngle, int endAngle, int startScale, int endScale, int time, int option, boolean fadeOut);
int playerview=0;
void ThreeDRefresh (void)
{
@@ -2838,7 +2838,7 @@
bufferofs-=screenofs;
DrawPlayScreen (true);
//void RotateScreen(int startAngle, int endAngle, int startScale, int endScale, int time);
- RotateScreen(0,FINEANGLES,FINEANGLES,FINEANGLES*8,(VBLCOUNTER*3)/4, 0);
+ RotateScreen(0,FINEANGLES,FINEANGLES,FINEANGLES*8,(VBLCOUNTER*3)/4, 0, false);
//RotateBuffer(0,FINEANGLES,FINEANGLES*8,FINEANGLES,(VBLCOUNTER*3)/4);
bufferofs+=screenofs;
fizzlein = false;
@@ -3113,9 +3113,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) {
@@ -3145,9 +3145,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);
@@ -3282,20 +3282,10 @@
////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>>16;
-
- //scale = startscale;
scale=(startscale<<6);
@@ -3318,9 +3308,9 @@
SDL_SetRelativeMouseMode(SDL_TRUE);
DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
- //FlipPage();
+ FlipPage();
DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
- //FlipPage();
+ FlipPage();
DrawRotatedScreen(Xh,Yh, (byte *)bufferofs,endangle&(FINEANGLES-1),endscale,0);
CalcTics();
CalcTics();
@@ -3354,8 +3344,6 @@
savetics=GetFastTics();
-
-
StartupRotateBuffer (0);
ScaleAndRotateBuffer (startangle, endangle, startscale, endscale, time);
@@ -3368,27 +3356,27 @@
const SDL_Renderer * GetRenderer(void);
-void DoScreenRotateZoom(int startAngle, int endAngle, int startScale, int endScale, int time);
-
void DoScreenRotateScale(int cx, int cy, SDL_Texture * tex, int angle, float scale);
+void VL_FadeOutScaledScreen (int start, int end, int red, int green, int blue, int steps, float scale);
+
//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)
+void RotateScreen(int startAngle, int endAngle, int startScale, int endScale, int time, int option, boolean fadeOut)
{
DisableScreenStretch();
//STUB_FUNCTION;
- 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);
+ //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;
@@ -3404,9 +3392,9 @@
int anglestep = (endAngle - startAngle)/(time*6); //added *6 because it was rotating too effing fast
- printf("anglestep: %d \n", anglestep);
- printf("scalestep: %f \n", scalestep);
- printf("startingScale: %f \n", scale);
+ //printf("anglestep: %d \n", anglestep);
+ //printf("scalestep: %f \n", scalestep);
+ //printf("startingScale: %f \n", scale);
CalcTics();
CalcTics();
@@ -3434,7 +3422,7 @@
- printf("factor: %f \n", factor);
+ //printf("factor: %f \n", factor);
x = abs((int)((float) iGLOBAL_SCREENWIDTH * factor));
@@ -3450,6 +3438,9 @@
}
+ if(fadeOut == true)
+ VL_FadeOutScaledScreen (0, 255, 0,0,0,VBLCOUNTER>>1, abs(scale));
+
//DoScreenRotateScale(iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, newTex, 0, 1.0);
SDL_DestroyTexture(newTex);
@@ -3734,8 +3725,8 @@
IN_UpdateKeyboard ();
//printf("PRE SCALE \n");
- DoScreenRotateScale((int) ((float)iGLOBAL_SCREENWIDTH*scale), (int)((float)iGLOBAL_SCREENHEIGHT*scale),
- currScreen, (int) angle, scale);
+ DoScreenRotateScale(iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT,
+ currScreen, angle, scale);
//printf("POST SCALE \n");
//DrawRotatedScreen(iGLOBAL_SCREENWIDTH/2,iGLOBAL_SCREENHEIGHT/2,(byte *)bufferofs,angle,scale,0);
--- a/rott/rt_game.c
+++ b/rott/rt_game.c
@@ -4445,7 +4445,7 @@
#define DEATHROTATE 6
-void RotateScreen(int startAngle, int endAngle, int startScale, int endScale, int time, int option);
+void RotateScreen(int startAngle, int endAngle, int startScale, int endScale, int time, int option, boolean fadeOut);
extern boolean dopefish;
void Died (void)
@@ -4681,7 +4681,7 @@
{
printf("doing death 0 rotate \n");
//RotateBuffer (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)));
- RotateScreen (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)), 1);
+ RotateScreen (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)), 1, true);
SD_Play (SD_PLAYERTCDEATHSND+(pstate->player));
pstate->falling=false;
}
@@ -4690,7 +4690,7 @@
{
printf("doing death 1 rotate \n");
//RotateBuffer (0, 0, (FINEANGLES>>6), (FINEANGLES), (VBLCOUNTER*(2+slowrate)));
- RotateScreen (0, 0, (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(2+slowrate)), 2);
+ RotateScreen (0, 0, (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(2+slowrate)), 2, true);
}
//zooms in on screen
@@ -4698,7 +4698,7 @@
{
printf("doing death 2 rotate \n");
//RotateBuffer (0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)));
- RotateScreen(0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)), 1);
+ RotateScreen(0, 0, (FINEANGLES), (FINEANGLES>>6), (VBLCOUNTER*(1+slowrate)), 1, true);
}
//zooms out with spinning
@@ -4706,15 +4706,17 @@
{
printf("doing death 3 rotate \n");
//RotateBuffer(0, (FINEANGLES*4), (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(3+slowrate)));
- RotateScreen(0, (FINEANGLES*4), (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(3+slowrate)), 2);
+ RotateScreen(0, (FINEANGLES*4), (FINEANGLES), (FINEANGLES*64), (VBLCOUNTER*(3+slowrate)), 2, true);
}
//fade to red
- else
+ 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;
@@ -4739,28 +4741,29 @@
{
printf("GAME OVER SEQUENCE 1 \n");
//RotateBuffer(0,(FINEANGLES>>1),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)));
- RotateScreen(0,(FINEANGLES>>1),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)), 2);
+ RotateScreen(0,(FINEANGLES>>1),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)), 2, true);
}
else if (rng<128)
{
printf("GAME OVER SEQUENCE 2 \n");
VL_FadeToColor (VBLCOUNTER*3, 255, 255, 255);
+ VL_FadeOut (0, 255, 0,0,0,VBLCOUNTER>>1);
}
else if (rng<192)
{
printf("GAME OVER SEQUENCE 3 \n");
//RotateBuffer(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)));
- RotateScreen(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)), 2);
+ RotateScreen(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)), 2, true);
}
else
{
printf("GAME OVER SEQUENCE 4 \n");
//RotateBuffer(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)));
- RotateScreen(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)), 2);
+ RotateScreen(0,(FINEANGLES*2),(FINEANGLES),(FINEANGLES*64),(VBLCOUNTER*(3+slowrate)), 2, true);
}
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_vid.c
+++ b/rott/rt_vid.c
@@ -905,6 +905,10 @@
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;
@@ -940,7 +944,11 @@
WaitVBL ();
VL_SetPalette (&palette2[0][0]);
- DoScreenRotateScale(iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, (SDL_Texture *) GetMainSurfaceAsTexture(), 0, scale);
+
+ printf("%d \n", (int)((float)iGLOBAL_SCREENWIDTH*scale));
+ printf("%d \n", (int)((float)iGLOBAL_SCREENHEIGHT*scale));
+
+ DoScreenRotateScale(iGLOBAL_SCREENWIDTH,iGLOBAL_SCREENHEIGHT, (SDL_Texture *) GetMainSurfaceAsTexture(), 0, scale);
}
//
--- a/rott/rt_view.c
+++ b/rott/rt_view.c
@@ -667,7 +667,7 @@
centerx = viewwidth >> 1;
centery = viewheight >> 1;
centeryfrac = (centery << 16);
- yzangleconverter = ( 0xaf85 * viewheight ) / 200;
+ yzangleconverter = ( 0xaf85 * viewheight ) / 300;
// Center the view horizontally
screenx = ( iGLOBAL_SCREENWIDTH - viewwidth ) >> 1;