Merge branch 'next' into public_next

This commit is contained in:
Monster Iestyn 2017-05-17 16:18:42 +01:00
commit 0cf42d8bb8
4 changed files with 104 additions and 98 deletions

View file

@ -58,26 +58,29 @@ after_build:
- cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt - cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt
- cmd: set /P GITSHORT=<%TMP%/gitshort.txt - cmd: set /P GITSHORT=<%TMP%/gitshort.txt
- set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%GITSHORT%-%CONFIGURATION%.7z - set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%GITSHORT%-%CONFIGURATION%.7z
- set BUILDSARCHIVE=%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%.7z
- cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -xr!.gitignore - cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -xr!.gitignore
- appveyor PushArtifact %BUILD_ARCHIVE% - appveyor PushArtifact %BUILD_ARCHIVE%
- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE%
- appveyor PushArtifact %BUILDSARCHIVE%
test: off test: off
deploy: #deploy:
- provider: FTP # - provider: FTP
protocol: ftps # protocol: ftps
host: # host:
secure: NsLJEPIBvmwCOj8Tg8RoRQ== # secure: NsLJEPIBvmwCOj8Tg8RoRQ==
username: # username:
secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA= # secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA=
password: # password:
secure: Hbn6Uy3lT0YZ88yFJ3aW4w== # secure: Hbn6Uy3lT0YZ88yFJ3aW4w==
folder: appveyor # folder: appveyor
application: # application:
active_mode: false # active_mode: false
on: # on:
branch: master # branch: master
appveyor_repo_tag: true # appveyor_repo_tag: true
on_finish: on_finish:

View file

@ -944,23 +944,24 @@ static void R_InitExtraColormaps(void)
for (cfile = clump = 0; cfile < numwadfiles; cfile++, clump = 0) for (cfile = clump = 0; cfile < numwadfiles; cfile++, clump = 0)
{ {
startnum = W_CheckNumForNamePwad("C_START", cfile, clump); startnum = W_CheckNumForNamePwad("C_START", cfile, clump);
if (startnum == LUMPERROR) if (startnum == INT16_MAX)
continue; continue;
endnum = W_CheckNumForNamePwad("C_END", cfile, clump); endnum = W_CheckNumForNamePwad("C_END", cfile, clump);
if (endnum == LUMPERROR) if (endnum == INT16_MAX)
I_Error("R_InitExtraColormaps: C_START without C_END\n"); I_Error("R_InitExtraColormaps: C_START without C_END\n");
if (WADFILENUM(startnum) != WADFILENUM(endnum)) // This shouldn't be possible when you use the Pwad function, silly
I_Error("R_InitExtraColormaps: C_START and C_END in different wad files!\n"); //if (WADFILENUM(startnum) != WADFILENUM(endnum))
//I_Error("R_InitExtraColormaps: C_START and C_END in different wad files!\n");
if (numcolormaplumps >= maxcolormaplumps) if (numcolormaplumps >= maxcolormaplumps)
maxcolormaplumps *= 2; maxcolormaplumps *= 2;
colormaplumps = Z_Realloc(colormaplumps, colormaplumps = Z_Realloc(colormaplumps,
sizeof (*colormaplumps) * maxcolormaplumps, PU_STATIC, NULL); sizeof (*colormaplumps) * maxcolormaplumps, PU_STATIC, NULL);
colormaplumps[numcolormaplumps].wadfile = WADFILENUM(startnum); colormaplumps[numcolormaplumps].wadfile = cfile;
colormaplumps[numcolormaplumps].firstlump = LUMPNUM(startnum+1); colormaplumps[numcolormaplumps].firstlump = startnum+1;
colormaplumps[numcolormaplumps].numlumps = endnum - (startnum + 1); colormaplumps[numcolormaplumps].numlumps = endnum - (startnum + 1);
numcolormaplumps++; numcolormaplumps++;
} }

View file

@ -590,51 +590,44 @@ static BOOL I_ReadyConsole(HANDLE ci)
static boolean entering_con_command = false; static boolean entering_con_command = false;
void I_GetConsoleEvents(void) static void Impl_HandleKeyboardConsoleEvent(KEY_EVENT_RECORD evt, HANDLE co)
{ {
event_t ev = {0,0,0,0}; event_t event;
HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO CSBI; CONSOLE_SCREEN_BUFFER_INFO CSBI;
INPUT_RECORD input;
DWORD t; DWORD t;
while (I_ReadyConsole(ci) && ReadConsoleInput(ci, &input, 1, &t) && t) memset(&event,0x00,sizeof (event));
if (evt.bKeyDown)
{ {
memset(&ev,0x00,sizeof (ev)); event.type = ev_console;
switch (input.EventType)
{
case KEY_EVENT:
if (input.Event.KeyEvent.bKeyDown)
{
ev.type = ev_console;
entering_con_command = true; entering_con_command = true;
switch (input.Event.KeyEvent.wVirtualKeyCode) switch (evt.wVirtualKeyCode)
{ {
case VK_ESCAPE: case VK_ESCAPE:
case VK_TAB: case VK_TAB:
ev.data1 = KEY_NULL; event.data1 = KEY_NULL;
break; break;
case VK_SHIFT: case VK_SHIFT:
ev.data1 = KEY_LSHIFT; event.data1 = KEY_LSHIFT;
break; break;
case VK_RETURN: case VK_RETURN:
entering_con_command = false; entering_con_command = false;
// Fall through. // Fall through.
default: default:
ev.data1 = MapVirtualKey(input.Event.KeyEvent.wVirtualKeyCode,2); // convert in to char event.data1 = MapVirtualKey(evt.wVirtualKeyCode,2); // convert in to char
} }
if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t)) if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t))
{ {
if (ev.data1 && ev.data1 != KEY_LSHIFT && ev.data1 != KEY_RSHIFT) if (event.data1 && event.data1 != KEY_LSHIFT && event.data1 != KEY_RSHIFT)
{ {
#ifdef _UNICODE #ifdef _UNICODE
WriteConsole(co, &input.Event.KeyEvent.uChar.UnicodeChar, 1, &t, NULL); WriteConsole(co, &evt.uChar.UnicodeChar, 1, &t, NULL);
#else #else
WriteConsole(co, &input.Event.KeyEvent.uChar.AsciiChar, 1 , &t, NULL); WriteConsole(co, &evt.uChar.AsciiChar, 1 , &t, NULL);
#endif #endif
} }
if (input.Event.KeyEvent.wVirtualKeyCode == VK_BACK if (evt.wVirtualKeyCode == VK_BACK
&& GetConsoleScreenBufferInfo(co,&CSBI)) && GetConsoleScreenBufferInfo(co,&CSBI))
{ {
WriteConsoleOutputCharacterA(co, " ",1, CSBI.dwCursorPosition, &t); WriteConsoleOutputCharacterA(co, " ",1, CSBI.dwCursorPosition, &t);
@ -643,17 +636,32 @@ void I_GetConsoleEvents(void)
} }
else else
{ {
ev.type = ev_keyup; event.type = ev_keyup;
switch (input.Event.KeyEvent.wVirtualKeyCode) switch (evt.wVirtualKeyCode)
{ {
case VK_SHIFT: case VK_SHIFT:
ev.data1 = KEY_LSHIFT; event.data1 = KEY_LSHIFT;
break; break;
default: default:
break; break;
} }
} }
if (ev.data1) D_PostEvent(&ev); if (event.data1) D_PostEvent(&event);
}
void I_GetConsoleEvents(void)
{
HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
INPUT_RECORD input;
DWORD t;
while (I_ReadyConsole(ci) && ReadConsoleInput(ci, &input, 1, &t) && t)
{
switch (input.EventType)
{
case KEY_EVENT:
Impl_HandleKeyboardConsoleEvent(input.Event.KeyEvent, co);
break; break;
case MOUSE_EVENT: case MOUSE_EVENT:
case WINDOW_BUFFER_SIZE_EVENT: case WINDOW_BUFFER_SIZE_EVENT:

View file

@ -181,15 +181,13 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
wasfullscreen = SDL_TRUE; wasfullscreen = SDL_TRUE;
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
} }
else if (wasfullscreen) else // windowed mode
{
if (wasfullscreen)
{ {
wasfullscreen = SDL_FALSE; wasfullscreen = SDL_FALSE;
SDL_SetWindowFullscreen(window, 0); SDL_SetWindowFullscreen(window, 0);
SDL_SetWindowSize(window, width, height);
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED_DISPLAY(1), SDL_WINDOWPOS_CENTERED_DISPLAY(1));
} }
else
{
// Reposition window only in windowed mode // Reposition window only in windowed mode
SDL_SetWindowSize(window, width, height); SDL_SetWindowSize(window, width, height);
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED_DISPLAY(1), SDL_WINDOWPOS_CENTERED_DISPLAY(1)); SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED_DISPLAY(1), SDL_WINDOWPOS_CENTERED_DISPLAY(1));
@ -899,7 +897,7 @@ static inline boolean I_SkipFrame(void)
{ {
static boolean skip = false; static boolean skip = false;
if (render_soft != rendermode) if (rendermode != render_soft)
return false; return false;
skip = !skip; skip = !skip;
@ -931,7 +929,7 @@ void I_FinishUpdate(void)
if (cv_ticrate.value) if (cv_ticrate.value)
SCR_DisplayTicRate(); SCR_DisplayTicRate();
if (render_soft == rendermode && screens[0]) if (rendermode == render_soft && screens[0])
{ {
SDL_Rect rect; SDL_Rect rect;
@ -958,7 +956,7 @@ void I_FinishUpdate(void)
} }
#ifdef HWRENDER #ifdef HWRENDER
else else if (rendermode == render_opengl)
{ {
OglSdlFinishUpdate(cv_vidwait.value); OglSdlFinishUpdate(cv_vidwait.value);
} }
@ -1188,9 +1186,9 @@ INT32 VID_SetMode(INT32 modeNum)
} }
Impl_SetWindowName("SRB2 "VERSIONSTRING); Impl_SetWindowName("SRB2 "VERSIONSTRING);
SDLSetMode(windowedModes[modeNum][0], windowedModes[modeNum][1], USE_FULLSCREEN); SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
if (render_soft == rendermode) if (rendermode == render_soft)
{ {
if (bufSurface) if (bufSurface)
{ {
@ -1209,30 +1207,20 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
int flags = 0; int flags = 0;
if (rendermode == render_none) // dedicated if (rendermode == render_none) // dedicated
{
return SDL_TRUE; // Monster Iestyn -- not sure if it really matters what we return here tbh return SDL_TRUE; // Monster Iestyn -- not sure if it really matters what we return here tbh
}
if (window != NULL) if (window != NULL)
{
return SDL_FALSE; return SDL_FALSE;
}
if (fullscreen) if (fullscreen)
{
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
if (borderlesswindow) if (borderlesswindow)
{
flags |= SDL_WINDOW_BORDERLESS; flags |= SDL_WINDOW_BORDERLESS;
}
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode == render_opengl) if (rendermode == render_opengl)
{
flags |= SDL_WINDOW_OPENGL; flags |= SDL_WINDOW_OPENGL;
}
#endif #endif
// Create a window // Create a window
@ -1261,7 +1249,13 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
#endif #endif
if (rendermode == render_soft) if (rendermode == render_soft)
{ {
renderer = SDL_CreateRenderer(window, -1, (usesdl2soft ? SDL_RENDERER_SOFTWARE : 0) | (cv_vidwait.value && !usesdl2soft ? SDL_RENDERER_PRESENTVSYNC : 0)); flags = 0; // Use this to set SDL_RENDERER_* flags now
if (usesdl2soft)
flags |= SDL_RENDERER_SOFTWARE;
else if (cv_vidwait.value)
flags |= SDL_RENDERER_PRESENTVSYNC;
renderer = SDL_CreateRenderer(window, -1, flags);
if (renderer == NULL) if (renderer == NULL)
{ {
CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError()); CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError());
@ -1483,7 +1477,7 @@ void I_ShutdownGraphics(void)
rendermode = render_none; rendermode = render_none;
if (icoSurface) SDL_FreeSurface(icoSurface); if (icoSurface) SDL_FreeSurface(icoSurface);
icoSurface = NULL; icoSurface = NULL;
if (render_soft == oldrendermode) if (oldrendermode == render_soft)
{ {
if (vidSurface) SDL_FreeSurface(vidSurface); if (vidSurface) SDL_FreeSurface(vidSurface);
vidSurface = NULL; vidSurface = NULL;