From 053d51b61b08b8b02049f61094d30d5c83f43016 Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Sun, 23 Dec 2001 21:59:38 +0000 Subject: [PATCH] Fixed stupid fullscreen changing. --- src/avp/win95/frontend/avp_userprofile.h | 1 + src/avp/win95/progress_bar.h | 1 + src/main.c | 57 ++++++++++++------------ 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/avp/win95/frontend/avp_userprofile.h b/src/avp/win95/frontend/avp_userprofile.h index 46de91b..7b194ba 100644 --- a/src/avp/win95/frontend/avp_userprofile.h +++ b/src/avp/win95/frontend/avp_userprofile.h @@ -161,6 +161,7 @@ extern AVP_USER_PROFILE *GetNextUserProfile(void); extern int SaveUserProfile(AVP_USER_PROFILE *profilePtr); extern void DeleteUserProfile(int number); +extern void FixCheatModesInUserProfile(AVP_USER_PROFILE *profilePtr); extern void GetSettingsFromUserProfile(void); extern void SaveSettingsToUserProfile(AVP_USER_PROFILE *profilePtr); diff --git a/src/avp/win95/progress_bar.h b/src/avp/win95/progress_bar.h index d17d01d..aaa004c 100644 --- a/src/avp/win95/progress_bar.h +++ b/src/avp/win95/progress_bar.h @@ -18,6 +18,7 @@ extern "C" void Start_Progress_Bar(); void Set_Progress_Bar_Position(int pos); +void Game_Has_Loaded(void); #ifdef __cplusplus }; diff --git a/src/main.c b/src/main.c index e4e2fa4..d58ed70 100644 --- a/src/main.c +++ b/src/main.c @@ -36,6 +36,9 @@ #include "player.h" #include "mempool.h" #include "avpview.h" +#include "consbind.hpp" +#include "progress_bar.h" +#include "scrshot.hpp" #include "version.h" char LevelName[] = {"predbit6\0QuiteALongNameActually"}; /* the real way to load levels */ @@ -61,7 +64,9 @@ SDL_Surface *surface; static int WantFullscreen = 1; int WantSound = 1; static int WantCDRom = 1; +#if 0 static int WantJoystick = 1; +#endif #if GL_EXT_secondary_color PFNGLSECONDARYCOLORPOINTEREXTPROC pglSecondaryColorPointerEXT; @@ -366,25 +371,25 @@ int InitSDL() int SetSoftVideoMode(int Width, int Height, int Depth) { SDL_GrabMode isgrab; - int isfull; + int flags; ScanDrawMode = ScanDrawD3DHardwareRGB; GotMouse = 1; + flags = SDL_SWSURFACE|SDL_DOUBLEBUF; if (surface != NULL) { - isfull = (surface->flags & SDL_FULLSCREEN); + if (surface->flags & SDL_FULLSCREEN) + flags |= SDL_FULLSCREEN; isgrab = SDL_WM_GrabInput(SDL_GRAB_QUERY); SDL_FreeSurface(surface); } else { if (WantFullscreen) - isfull = 1; - else - isfull = 0; + flags |= SDL_FULLSCREEN; isgrab = SDL_GRAB_OFF; } - if ((surface = SDL_SetVideoMode(Width, Height, Depth, SDL_SWSURFACE|SDL_DOUBLEBUF)) == NULL) { + if ((surface = SDL_SetVideoMode(Width, Height, Depth, flags)) == NULL) { fprintf(stderr, "(Software) SDL SetVideoMode failed: %s\n", SDL_GetError()); SDL_Quit(); exit(EXIT_FAILURE); @@ -396,16 +401,13 @@ int SetSoftVideoMode(int Width, int Height, int Depth) SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); SDL_EnableUNICODE(1); /* toggle it to ON */ - if (isfull && !(surface->flags & SDL_FULLSCREEN)) { - SDL_WM_ToggleFullScreen(surface); - if (surface->flags & SDL_FULLSCREEN) - SDL_ShowCursor(0); - } - - if (isgrab == SDL_GRAB_ON) { + if (isgrab == SDL_GRAB_ON) SDL_WM_GrabInput(SDL_GRAB_ON); - } - + + if ((surface->flags & SDL_FULLSCREEN) || + (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON)) + SDL_ShowCursor(0); + ScreenDescriptorBlock.SDB_Width = Width; ScreenDescriptorBlock.SDB_Height = Height; ScreenDescriptorBlock.SDB_CentreX = Width/2; @@ -423,22 +425,22 @@ int SetSoftVideoMode(int Width, int Height, int Depth) int SetOGLVideoMode(int Width, int Height) { SDL_GrabMode isgrab; - int isfull; + int flags; char *ext; ScanDrawMode = ScanDrawD3DHardwareRGB; GotMouse = 1; + flags = SDL_OPENGL; if (surface != NULL) { - isfull = (surface->flags & SDL_FULLSCREEN) ? 1 : 0; + if (surface->flags & SDL_FULLSCREEN) + flags |= SDL_FULLSCREEN; isgrab = SDL_WM_GrabInput(SDL_GRAB_QUERY); SDL_FreeSurface(surface); } else { if (WantFullscreen) - isfull = 1; - else - isfull = 0; + flags |= SDL_FULLSCREEN; isgrab = SDL_GRAB_OFF; } @@ -448,7 +450,7 @@ int SetOGLVideoMode(int Width, int Height) SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - if ((surface = SDL_SetVideoMode(Width, Height, 0, SDL_OPENGL)) == NULL) { + if ((surface = SDL_SetVideoMode(Width, Height, 0, flags)) == NULL) { fprintf(stderr, "(OpenGL) SDL SetVideoMode failed: %s\n", SDL_GetError()); SDL_Quit(); exit(EXIT_FAILURE); @@ -460,15 +462,12 @@ int SetOGLVideoMode(int Width, int Height) SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); SDL_EnableUNICODE(1); /* toggle it to ON */ - if (isfull && !(surface->flags & SDL_FULLSCREEN)) { - SDL_WM_ToggleFullScreen(surface); - if (surface->flags & SDL_FULLSCREEN) - SDL_ShowCursor(0); - } - - if (isgrab == SDL_GRAB_ON) { + if (isgrab == SDL_GRAB_ON) SDL_WM_GrabInput(SDL_GRAB_ON); - } + + if ((surface->flags & SDL_FULLSCREEN) || + (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON)) + SDL_ShowCursor(0); glViewport(0, 0, Width, Height);