mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
Merge branch 'master' of https://github.com/coelckers/gzdoom
This commit is contained in:
commit
430ed532ef
8 changed files with 17 additions and 127 deletions
|
@ -507,7 +507,6 @@ set( PLAT_SDL_SOURCES
|
||||||
posix/sdl/i_joystick.cpp
|
posix/sdl/i_joystick.cpp
|
||||||
posix/sdl/i_main.cpp
|
posix/sdl/i_main.cpp
|
||||||
posix/sdl/i_system.cpp
|
posix/sdl/i_system.cpp
|
||||||
posix/sdl/i_timer.cpp
|
|
||||||
posix/sdl/sdlvideo.cpp
|
posix/sdl/sdlvideo.cpp
|
||||||
posix/sdl/sdlglvideo.cpp
|
posix/sdl/sdlglvideo.cpp
|
||||||
posix/sdl/st_start.cpp )
|
posix/sdl/st_start.cpp )
|
||||||
|
@ -525,7 +524,6 @@ set( PLAT_COCOA_SOURCES
|
||||||
posix/cocoa/i_main.mm
|
posix/cocoa/i_main.mm
|
||||||
posix/cocoa/i_main_except.cpp
|
posix/cocoa/i_main_except.cpp
|
||||||
posix/cocoa/i_system.mm
|
posix/cocoa/i_system.mm
|
||||||
posix/cocoa/i_timer.cpp
|
|
||||||
posix/cocoa/i_video.mm
|
posix/cocoa/i_video.mm
|
||||||
posix/cocoa/st_console.mm
|
posix/cocoa/st_console.mm
|
||||||
posix/cocoa/st_start.mm )
|
posix/cocoa/st_start.mm )
|
||||||
|
|
|
@ -130,11 +130,22 @@ int I_WaitForTic(int prevtic)
|
||||||
int time;
|
int time;
|
||||||
while ((time = I_GetTime()) <= prevtic)
|
while ((time = I_GetTime()) <= prevtic)
|
||||||
{
|
{
|
||||||
|
// Windows-specific note:
|
||||||
// The minimum amount of time a thread can sleep is controlled by timeBeginPeriod.
|
// The minimum amount of time a thread can sleep is controlled by timeBeginPeriod.
|
||||||
// We set this to 1 ms in DoMain.
|
// We set this to 1 ms in DoMain.
|
||||||
uint64_t sleepTime = NSToMS(FirstFrameStartTime + TicToNS(prevtic + 1) - I_nsTime());
|
|
||||||
if (sleepTime > 2)
|
const uint64_t next = FirstFrameStartTime + TicToNS(prevtic + 1);
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime - 2));
|
const uint64_t now = I_nsTime();
|
||||||
|
|
||||||
|
if (next > now)
|
||||||
|
{
|
||||||
|
const uint64_t sleepTime = NSToMS(next - now);
|
||||||
|
|
||||||
|
if (sleepTime > 2)
|
||||||
|
{
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime - 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
I_SetFrameTime();
|
I_SetFrameTime();
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,6 +209,7 @@ void PolyRenderer::SetupPerspectiveMatrix()
|
||||||
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(Viewpoint.FieldOfView.Radians() / 2) / fovratio)).Degrees);
|
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(Viewpoint.FieldOfView.Radians() / 2) / fovratio)).Degrees);
|
||||||
|
|
||||||
WorldToView =
|
WorldToView =
|
||||||
|
TriMatrix::rotate((float)Viewpoint.Angles.Roll.Radians(), 0.0f, 0.0f, 1.0f) *
|
||||||
TriMatrix::rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
|
TriMatrix::rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
|
||||||
TriMatrix::rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *
|
TriMatrix::rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *
|
||||||
TriMatrix::scale(1.0f, level.info->pixelstretch, 1.0f) *
|
TriMatrix::scale(1.0f, level.info->pixelstretch, 1.0f) *
|
||||||
|
|
|
@ -59,6 +59,7 @@ void PolyDrawSectorPortal::Render(int portalDepth)
|
||||||
float fovratio = (viewwindow.WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
|
float fovratio = (viewwindow.WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
|
||||||
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(viewpoint.FieldOfView.Radians() / 2) / fovratio)).Degrees);
|
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(viewpoint.FieldOfView.Radians() / 2) / fovratio)).Degrees);
|
||||||
TriMatrix worldToView =
|
TriMatrix worldToView =
|
||||||
|
TriMatrix::rotate((float)viewpoint.Angles.Roll.Radians(), 0.0f, 0.0f, 1.0f) *
|
||||||
TriMatrix::rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
|
TriMatrix::rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
|
||||||
TriMatrix::rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *
|
TriMatrix::rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *
|
||||||
TriMatrix::scale(1.0f, level.info->pixelstretch, 1.0f) *
|
TriMatrix::scale(1.0f, level.info->pixelstretch, 1.0f) *
|
||||||
|
@ -169,6 +170,7 @@ void PolyDrawLinePortal::Render(int portalDepth)
|
||||||
float fovratio = (viewwindow.WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
|
float fovratio = (viewwindow.WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
|
||||||
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(viewpoint.FieldOfView.Radians() / 2) / fovratio)).Degrees);
|
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(viewpoint.FieldOfView.Radians() / 2) / fovratio)).Degrees);
|
||||||
TriMatrix worldToView =
|
TriMatrix worldToView =
|
||||||
|
TriMatrix::rotate((float)viewpoint.Angles.Roll.Radians(), 0.0f, 0.0f, 1.0f) *
|
||||||
TriMatrix::rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
|
TriMatrix::rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
|
||||||
TriMatrix::rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *
|
TriMatrix::rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *
|
||||||
TriMatrix::scale(1.0f, level.info->pixelstretch, 1.0f) *
|
TriMatrix::scale(1.0f, level.info->pixelstretch, 1.0f) *
|
||||||
|
|
|
@ -84,9 +84,6 @@ void SetLanguageIDs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void I_InitTimer();
|
|
||||||
void I_ShutdownTimer();
|
|
||||||
|
|
||||||
double PerfToSec, PerfToMillisec;
|
double PerfToSec, PerfToMillisec;
|
||||||
|
|
||||||
static void CalculateCPUSpeed()
|
static void CalculateCPUSpeed()
|
||||||
|
@ -114,7 +111,6 @@ void I_Init(void)
|
||||||
|
|
||||||
atterm(I_ShutdownSound);
|
atterm(I_ShutdownSound);
|
||||||
I_InitSound();
|
I_InitSound();
|
||||||
I_InitTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int has_exited;
|
static int has_exited;
|
||||||
|
@ -129,8 +125,6 @@ void I_Quit()
|
||||||
}
|
}
|
||||||
|
|
||||||
C_DeinitConsole();
|
C_DeinitConsole();
|
||||||
|
|
||||||
I_ShutdownTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
/*
|
|
||||||
** i_timer.cpp
|
|
||||||
**
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
** Copyright 2012-2015 Alexey Lysiuk
|
|
||||||
** All rights reserved.
|
|
||||||
**
|
|
||||||
** Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions
|
|
||||||
** are met:
|
|
||||||
**
|
|
||||||
** 1. Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in the
|
|
||||||
** documentation and/or other materials provided with the distribution.
|
|
||||||
** 3. The name of the author may not be used to endorse or promote products
|
|
||||||
** derived from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <sys/sysctl.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
#include "doomdef.h"
|
|
||||||
#include "i_system.h"
|
|
||||||
#include "templates.h"
|
|
||||||
|
|
||||||
// To do: this file is obviously not needed anymore. It needs to be removed.
|
|
||||||
|
|
||||||
void I_InitTimer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_ShutdownTimer()
|
|
||||||
{
|
|
||||||
}
|
|
|
@ -119,9 +119,6 @@ void SetLanguageIDs ()
|
||||||
LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang;
|
LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_InitTimer ();
|
|
||||||
void I_ShutdownTimer ();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// I_Init
|
// I_Init
|
||||||
//
|
//
|
||||||
|
@ -132,7 +129,6 @@ void I_Init (void)
|
||||||
|
|
||||||
atterm (I_ShutdownSound);
|
atterm (I_ShutdownSound);
|
||||||
I_InitSound ();
|
I_InitSound ();
|
||||||
I_InitTimer ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -148,8 +144,6 @@ void I_Quit (void)
|
||||||
G_CheckDemoStatus();
|
G_CheckDemoStatus();
|
||||||
|
|
||||||
C_DeinitConsole();
|
C_DeinitConsole();
|
||||||
|
|
||||||
I_ShutdownTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
/*
|
|
||||||
** i_timer.cpp
|
|
||||||
**
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
** Copyright 2005-2016 Randy Heit
|
|
||||||
** All rights reserved.
|
|
||||||
**
|
|
||||||
** Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions
|
|
||||||
** are met:
|
|
||||||
**
|
|
||||||
** 1. Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in the
|
|
||||||
** documentation and/or other materials provided with the distribution.
|
|
||||||
** 3. The name of the author may not be used to endorse or promote products
|
|
||||||
** derived from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Moved from sdl/i_system.cpp
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
#include "m_fixed.h"
|
|
||||||
#include "hardware.h"
|
|
||||||
#include "i_system.h"
|
|
||||||
#include "templates.h"
|
|
||||||
|
|
||||||
void I_InitTimer ()
|
|
||||||
{
|
|
||||||
if(SDL_InitSubSystem(SDL_INIT_TIMER) < 0)
|
|
||||||
I_FatalError("Could not initialize SDL timers:\n%s\n", SDL_GetError());
|
|
||||||
|
|
||||||
// Maybe this file isn't needed at all anymore.
|
|
||||||
// Someone with Linux should test if the timer subsystem is used elsewhere..
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_ShutdownTimer ()
|
|
||||||
{
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_TIMER);
|
|
||||||
}
|
|
Loading…
Reference in a new issue