ref: 14a48495640f598386b2182cc5b85c1011496d34
parent: c89c890fc7609504802ec4a45e63dc36e14bde2d
author: LTCHIPS <ltchips994@gmail.com>
date: Sun Apr 8 19:57:55 EDT 2018
corrected some view size change thingys
--- a/rott/lumpy.h
+++ b/rott/lumpy.h
@@ -33,6 +33,15 @@
byte data;
} pic_t;
+typedef struct
+{
+ pic_t * shape;
+ int x;
+ int y;
+ byte * data;
+} SDLDrawObj;
+
+
#define CONVERT_ENDIAN_pic_t(pp) { }
typedef struct
--- a/rott/modexlib.c
+++ b/rott/modexlib.c
@@ -42,7 +42,11 @@
#include "rt_net.h" // for GamePaused
#include "myprint.h"
#include "rt_view.h"
+#include "Queue.h"
+#include "lumpy.h"
+//#include <SDL2/SDL_image.h>
+
static void StretchMemPicture ();
// GLOBAL VARIABLES
@@ -53,6 +57,7 @@
extern int iG_Y_center;
char *iG_buf_center;
+
SDL_Surface *sdl_surface = NULL;
SDL_Window * window = NULL;
@@ -63,6 +68,12 @@
static SDL_Texture *sdl_texture = NULL;
+SDL_Surface *temp = NULL;
+
+Queue *sdl_draw_obj_queue = NULL;
+
+boolean doRescaling = false;
+
int linewidth;
//int ylookup[MAXSCREENHEIGHT];
int ylookup[MAXSCREENHEIGHT];//just set to max res
@@ -439,13 +450,7 @@
{
Error ("Could not initialize SDL\n");
}
-
-#if defined(PLATFORM_WIN32) || defined(PLATFORM_MACOSX)
- // FIXME: remove this. --ryan.
- flags = SDL_FULLSCREEN;
-#endif
-
SDL_SetRelativeMouseMode(SDL_TRUE);
//SDL_WM_GrabInput(SDL_GRAB_ON);
@@ -477,11 +482,20 @@
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");
}
+ //temp = IMG_Load("C:\\Users\\LTCHIPS\\Desktop\\ROTT DEV BUILD\\rott\\HEALTH1C.png");
+
+
+
}
/*
@@ -731,11 +745,77 @@
int hudRescaleFactor = 1;
-boolean doRescaling = false;
+/*
+void DrawObjsInSDLQueue(SDL_Texture * tex)
+{
+ SDL_SetRenderTarget(renderer, tex);
+ //SDL_LockTexture(tex,NULL, sdl_surface->pixels, iGLOBAL_SCREENBWIDE);
+
+ while(sdl_draw_obj_queue->sizeOfQueue != 0)
+ {
+ SDLDrawObj * thing = sdl_draw_obj_queue->head->data;
+
+
+ SDL_Surface * tempSurf = SDL_CreateRGBSurfaceWithFormatFrom( thing->data, (int) thing->shape->width,
+ (int) thing->shape->height, 8, (int)thing->shape->width, sdl_surface->format->format);
+
+ //SDL_LockSurface(tempSurf);
+
+
+ //tempSurf->pixels = (byte *) &thing->data;
+
+ //SDL_UnlockSurface(tempSurf);
+
+ if(tempSurf == NULL)
+ {
+ Error("Failed to make temporary Surface when rendering things in SDL");
+ exit(1);
+ }
+
+ SDL_Texture * tempTex = SDL_CreateTextureFromSurface(renderer, tempSurf);
+
+ if(tempTex == NULL)
+ {
+ Error("Failed to make temporary Texture when rendering things in SDL");
+ exit(1);
+ }
+
+ SDL_Rect newCoords = (SDL_Rect) {(iGLOBAL_SCREENWIDTH - (320* hudRescaleFactor)) >> 1, iGLOBAL_SCREENHEIGHT - 16*hudRescaleFactor, 320*hudRescaleFactor, 16*hudRescaleFactor};
+
+ SDL_RenderCopy(renderer, tempTex, NULL, &newCoords);
+
+ SDL_FreeSurface(tempSurf);
+
+ SDL_DestroyTexture(tempTex);
+
+ dequeue(sdl_draw_obj_queue, thing);
+
+
+ }
+ //SDL_SetRenderTarget(renderer, NULL);
+
+ //SDL_RenderCopy(renderer, tex, NULL, NULL);
+
+
+ //SDL_UnlockTexture(tex);
+
+ SDL_SetRenderTarget(renderer, NULL);
+
+ //SDL_RenderPresent(renderer);
+
+}
+*/
+
+
+
+
void RenderSurface(void)
{
SDL_Texture *newTex = SDL_CreateTextureFromSurface(renderer, sdl_surface);
+
+ //temp = SDL_ConvertSurface(temp, sdl_surface->format, (int)NULL);
+
if (newTex == NULL)
{
Error("CreateTextureFromSurface failed: %s\n", SDL_GetError());
@@ -743,6 +823,7 @@
}
SDL_RenderClear(renderer);
+
SDL_RenderCopy(renderer, newTex, NULL, NULL);
if (!StretchScreen && hudRescaleFactor > 1 && doRescaling)
@@ -753,8 +834,11 @@
if(SHOW_BOTTOM_STATUS_BAR())
RescaleAreaOfTexture(renderer, newTex,(SDL_Rect) {(iGLOBAL_SCREENWIDTH - 320) >> 1, iGLOBAL_SCREENHEIGHT - 16, 320, 16},
(SDL_Rect) {(iGLOBAL_SCREENWIDTH - (320* hudRescaleFactor)) >> 1, iGLOBAL_SCREENHEIGHT - 16*hudRescaleFactor, 320*hudRescaleFactor, 16*hudRescaleFactor}); //Bottom Bar
+
}
+ //SDL_RenderCopy(renderer, newTex, NULL, NULL);
+
SDL_RenderPresent(renderer);
SDL_DestroyTexture(newTex);
@@ -761,8 +845,6 @@
}
-
-
/* C version of rt_vh_a.asm */
void VH_UpdateScreen (void)
@@ -775,6 +857,7 @@
}
RenderSurface();
+
}
@@ -817,7 +900,6 @@
#endif
-
void EnableScreenStretch(void)
{
int i,offset;
@@ -856,6 +938,15 @@
}
+void EnableHudStretch(void)
+{
+ doRescaling = 1;
+}
+
+void DisableHudStretch(void)
+{
+ doRescaling = 0;
+}
// bna section -------------------------------------------
static void StretchMemPicture ()
--- a/rott/rt_draw.c
+++ b/rott/rt_draw.c
@@ -3052,6 +3052,8 @@
VL_CopyDisplayToHidden ();
CalcTics();
+
+ DisableHudStretch();
for (i=0; i<time; i+=tics)
{
CalcTics();
@@ -3075,6 +3077,7 @@
DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );//bna++
DrawPlayScreen(false);
DisableScreenStretch();
+ EnableHudStretch();
SHAKETICS = 0xFFFF;
//bna section end
}
--- a/rott/rt_game.c
+++ b/rott/rt_game.c
@@ -164,6 +164,8 @@
#define BONUSBONUS 100000
+extern Queue * sdl_draw_obj_queue;
+
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();
@@ -409,6 +411,7 @@
}
}
int topBarCenterOffsetX;
+extern int hudRescaleFactor;
//******************************************************************************
//
@@ -431,7 +434,7 @@
{
shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
- DrawTiledRegion( 0, 0, iGLOBAL_SCREENWIDTH, 16, 0,16, shape );
+ DrawTiledRegion( 0, 0, iGLOBAL_SCREENWIDTH, 16*hudRescaleFactor, 0,16, shape );
}
shape = ( pic_t * )W_CacheLumpName( "stat_bar", PU_CACHE, Cvt_pic_t, 1 );
@@ -456,14 +459,18 @@
{
shape = ( pic_t * )W_CacheLumpName( "backtile", PU_CACHE, Cvt_pic_t, 1 );
- DrawTiledRegion( 0, iGLOBAL_SCREENHEIGHT - 16, iGLOBAL_SCREENWIDTH, 16, 34,32, shape );
+ DrawTiledRegion( 0, iGLOBAL_SCREENHEIGHT - 16*hudRescaleFactor, iGLOBAL_SCREENWIDTH, 16*hudRescaleFactor, 34,32, shape );
shape = ( pic_t * ) W_CacheLumpName( "bottbar", PU_CACHE, Cvt_pic_t, 1 );
-
- //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
+ //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
//}
@@ -3461,6 +3468,7 @@
EndBonusSkip = false;
EndBonusStartY = 90;
+
EnableScreenStretch();
tmpPic = ( pic_t * )W_CacheLumpName( "mmbk", PU_CACHE, Cvt_pic_t, 1 );
VWB_DrawPic( 0, 0, tmpPic );
@@ -5229,8 +5237,7 @@
//
//******************************************************************************
-
-extern unsigned int freeSlot;
+extern boolean doRescaling;
boolean LoadTheGame (int num, gamestorage_t * game)
{
--- a/rott/rt_main.c
+++ b/rott/rt_main.c
@@ -1310,6 +1310,7 @@
case ex_resetgame:
// SetTextMode ( ); //12345678
+
EnableScreenStretch();//bna++ shut on streech mode
InitCharacter();
@@ -1401,7 +1402,7 @@
case ex_stillplaying:
InitializeMessages();
-
+ EnableHudStretch();
SHAKETICS = 0xFFFF;
if (modemgame==true)
{
@@ -1420,6 +1421,7 @@
// SetTextMode ( ); //12345678
Died ();
StopWind();
+ DisableHudStretch();
DisableScreenStretch();//bna++ shut off streech mode
while (damagecount>0)
DoBorderShifts();
@@ -1466,7 +1468,6 @@
}
else
{
-
fizzlein = true;
SetupGameLevel ();
UpdateTriads(player,0);
@@ -1474,7 +1475,6 @@
}
}
}
- doRescaling = true;
break;
case ex_warped:
@@ -1657,7 +1657,6 @@
{
EnableScreenStretch();//bna++
-
if ( pickquick )
{
SetupMenuBuf();
@@ -2005,7 +2004,6 @@
UpdateClientControls ();
- doRescaling = false;
while (oldpolltime<oldtime)
{
CheckUnPause();
@@ -2022,7 +2020,7 @@
DrawTiledRegion( 0, 16, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 32, 0, 16, shape );
DisableScreenStretch();//dont strech when we go BACK TO GAME
DrawPlayScreen(true);//repaint ammo and life stat
- doRescaling = true;
+ EnableHudStretch();
VW_UpdateScreen ();//update screen
}
StartupClientControls();
--- a/rott/rt_menu.c
+++ b/rott/rt_menu.c
@@ -5487,8 +5487,8 @@
extern int hudRescaleFactor;
void DoAdjustHudScale (void)
-{
- SliderMenu (&hudRescaleFactor, 200, 0, 44, 81, 194, 1, "block2", NULL,
+{
+ SliderMenu (&hudRescaleFactor, 10, 0, 44, 81, 194, 1, "block2", NULL,
"Adjust Hud Scaling", "Small", "Large" );
DrawVisualsMenu ();
}
--- a/rott/rt_view.c
+++ b/rott/rt_view.c
@@ -747,7 +747,7 @@
{
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++
+ DrawTiledRegion( 0, 16*hudRescaleFactor, iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT - 16*hudRescaleFactor, 0, 16, shape );//bna++
}
if ( viewsize == 0 )