Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/master' into savegame-re…
Browse files Browse the repository at this point in the history
…factor

Conflicts:
doomsday/libdeng2/game.pri
  • Loading branch information
danij-deng committed Mar 5, 2014
2 parents 52786ab + be701c9 commit d3951b1
Show file tree
Hide file tree
Showing 162 changed files with 2,390 additions and 1,062 deletions.
4 changes: 2 additions & 2 deletions doomsday/build/build.pro
Expand Up @@ -20,12 +20,12 @@ include(../config.pri)
QMAKE_STRIP = true

# Update the PK3 files.
!deng_nopackres {
!deng_sdk:!deng_nopackres {
runPython2InDir($$PWD/scripts/, packres.py --quiet \"$$OUT_PWD/..\")
}

# Install the launcher.
deng_snowberry {
!deng_sdk:deng_snowberry {
SB_ROOT = ../../snowberry
SB_DIR = $$DENG_BASE_DIR/snowberry

Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/client.pro
Expand Up @@ -815,9 +815,9 @@ data.files = $$OUT_PWD/../doomsday.pk3
mod.files = \
$$DOOMSDAY_SCRIPTS \
$$DENG_MODULES_DIR/Config.de \
$$DENG_MODULES_DIR/gui.de \
$$DENG_MODULES_DIR/Log.de \
$$DENG_MODULES_DIR/recutil.de
$$DENG_MODULES_DIR/recutil.de \
$$DENG_MODULES_DIR/../../libgui/modules/gui.de

# These fonts may be needed during the initial startup busy mode.
startupfonts.files = \
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 31 additions & 5 deletions doomsday/client/include/network/serverlink.h
Expand Up @@ -68,15 +68,39 @@ class ServerLink : public de::shell::AbstractLink

bool isDiscovering() const;

int foundServerCount() const;
enum FoundMaskFlag
{
Direct = 0x1,
LocalNetwork = 0x2,
MasterServer = 0x4,

QList<de::Address> foundServers() const;
Any = Direct | LocalNetwork | MasterServer
};
Q_DECLARE_FLAGS(FoundMask, FoundMaskFlag)

bool isFound(de::Address const &host) const;
/**
* @param mask Defines the sources that are enabled when querying for found servers.
*/
int foundServerCount(FoundMask mask = Any) const;

bool foundServerInfo(de::Address const &host, serverinfo_t *info) const;
/**
* @param mask Defines the sources that are enabled when querying for found servers.
*/
QList<de::Address> foundServers(FoundMask mask = Any) const;

bool foundServerInfo(int index, serverinfo_t *info) const;
bool isFound(de::Address const &host, FoundMask mask = Any) const;

/**
* @param mask Defines the sources that are enabled when querying for found servers.
*/
bool foundServerInfo(de::Address const &host, serverinfo_t *info,
FoundMask mask = Any) const;

/**
* @param mask Defines the sources that are enabled when querying for found servers.
*/
bool foundServerInfo(int index, serverinfo_t *info,
FoundMask mask = Any) const;

signals:
void serversDiscovered();
Expand All @@ -96,4 +120,6 @@ protected slots:
DENG2_PRIVATE(d)
};

Q_DECLARE_OPERATORS_FOR_FLAGS(ServerLink::FoundMask)

#endif // CLIENT_LINK_H
3 changes: 3 additions & 0 deletions doomsday/client/include/ui/dialogs/manualconnectiondialog.h
Expand Up @@ -40,7 +40,10 @@ class ManualConnectionDialog : public de::InputDialog, public de::IPersistent
void operator << (de::PersistentState const &fromState);

public slots:
void queryOrConnect();
void contentChanged();
void validate();
void disconnected();

protected:
void finish(int result);
Expand Down
36 changes: 35 additions & 1 deletion doomsday/client/include/ui/widgets/mpselectionwidget.h
Expand Up @@ -20,6 +20,7 @@
#define DENG_CLIENT_MPSELECTIONWIDGET_H

#include <de/MenuWidget>
#include "network/net_main.h"

/**
* Menu that populates itself with available multiplayer games.
Expand All @@ -31,10 +32,43 @@ class MPSelectionWidget : public de::MenuWidget
Q_OBJECT

public:
MPSelectionWidget();
DENG2_DEFINE_AUDIENCE(Selection, void gameSelected(serverinfo_t const &info))

enum DiscoveryMode {
NoDiscovery,
DiscoverUsingMaster,
DirectDiscoveryOnly
};

/**
* Action for joining a game on a multiplayer server.
*/
class JoinAction : public de::Action
{
public:
JoinAction(serverinfo_t const &sv);
void trigger();

private:
DENG2_PRIVATE(d)
};

public:
MPSelectionWidget(DiscoveryMode discovery = NoDiscovery);

/**
* Enables or disables joining games by pressing the menu items in the widget.
* By default, this is enabled. If disabled, one will only get a notification
* about the selection.
*
* @param enableJoin @c true to allow automatic joining, @c false to disallow.
*/
void setJoinGameWhenSelected(bool enableJoin);

void setColumns(int numberOfColumns);

serverinfo_t const &serverInfo(de::ui::DataPos pos) const;

signals:
void availabilityChanged();
void gameSelected();
Expand Down
51 changes: 4 additions & 47 deletions doomsday/client/modules/appconfig.de
Expand Up @@ -23,13 +23,16 @@
#
# TODO: make sure the server doesn't run this

import gui
import Version
import Updater
import Log

def setDefaults(d)
# Applies the client's defaults.
# - d: Record where to set the values.

gui.setDefaults(d)

# Additional Log defaults.
d.log.filterBySubsystem = False
Expand All @@ -47,52 +50,6 @@ def setDefaults(d)
record d.input
record d.input.mouse
d.input.mouse.syncSensitivity = True

try
import DisplayMode

# The default audio and video subsystems.
d.video = 'opengl'
d.audio = 'fmod'

# Window manager defaults.
record d.window
d.window.fsaa = True # Remove this (should be window-specific).

# Configure the main window.
record d.window.main
d.window.main.showFps = False
d.window.main.center = True
d.window.main.fsaa = True
d.window.main.vsync = True

# The default window parameters depend on the original display mode.
mode = DisplayMode.originalMode()

# By default the fullscreen resolution is the desktop resolution.
d.window.main.fullSize = [mode['width'], mode['height']]

# In windowed mode mode, leave some space on the sides so that
# the first switch to windowed mode does not place the window in an
# inconvenient location. The reduction is done proportionally.
offx = mode['width'] * 0.15
offy = mode['height'] * 0.15
d.window.main.rect = [offx, offy,
mode['width'] - 2*offx,
mode['height'] - 2*offy]
d.window.main.colorDepth = mode['depth']

if Version.OS == 'windows' or Version.OS == 'macx'
d.window.main.fullscreen = True
d.window.main.maximize = False
else
d.window.main.fullscreen = False
d.window.main.maximize = True
end

catch NotFoundError
# DisplayMode isn't available on the server.
end

# Defaults for the automatic updater.
record d.updater
Expand All @@ -114,5 +71,5 @@ def setDefaults(d)
record d.console
d.console.snap = True
d.console.script = False
end


2 changes: 1 addition & 1 deletion doomsday/client/src/alertmask.cpp
Expand Up @@ -67,7 +67,7 @@ void AlertMask::init()
{
foreach(Variable const *var, App::config().names().subrecord("alert").members())
{
var->audienceForChange += d;
var->audienceForChange() += d;
}
d->updateMask();
}
Expand Down
70 changes: 4 additions & 66 deletions doomsday/client/src/clientapp.cpp
Expand Up @@ -91,61 +91,6 @@ static Value *Function_App_GamePlugin(Context &, Function::ArgumentValues const
return new TextValue(name);
}

static Value *Function_App_LoadFont(Context &, Function::ArgumentValues const &args)
{
LOG_AS("ClientApp");
try
{
// Try to load the specific font.
Block data(App::fileSystem().root().locate<File const>(args.at(0)->asText()));
int id;
id = QFontDatabase::addApplicationFontFromData(data);
if(id < 0)
{
LOG_RES_WARNING("Failed to load font:");
}
else
{
LOG_RES_VERBOSE("Loaded font: %s") << args.at(0)->asText();
//qDebug() << args.at(0)->asText();
//qDebug() << "Families:" << QFontDatabase::applicationFontFamilies(id);
}
}
catch(Error const &er)
{
LOG_RES_WARNING("Failed to load font:\n") << er.asText();
}
return 0;
}

static Value *Function_App_AddFontMapping(Context &, Function::ArgumentValues const &args)
{
// arg 0: family name
// arg 1: dictionary with [Text style, Number weight] => Text fontname

// styles: regular, italic
// weight: 0-99 (25=light, 50=normal, 75=bold)

NativeFont::StyleMapping mapping;

DictionaryValue const &dict = args.at(1)->as<DictionaryValue>();
DENG2_FOR_EACH_CONST(DictionaryValue::Elements, i, dict.elements())
{
NativeFont::Spec spec;
ArrayValue const &key = i->first.value->as<ArrayValue>();
if(key.at(0).asText() == "italic")
{
spec.style = NativeFont::Italic;
}
spec.weight = roundi(key.at(1).asNumber());
mapping.insert(spec, i->second->asText());
}

NativeFont::defineMapping(args.at(0)->asText(), mapping);

return 0;
}

static Value *Function_App_Quit(Context &, Function::ArgumentValues const &)
{
Sys_Quit();
Expand Down Expand Up @@ -319,28 +264,21 @@ ClientApp::ClientApp(int &argc, char **argv)
{
novideo = false;

// Override the system locale (affects number/time formatting).
QLocale::setDefault(QLocale("en_US.UTF-8"));

// Use the host system's proxy configuration.
QNetworkProxyFactory::setUseSystemConfiguration(true);

// Metadata.
setOrganizationDomain ("dengine.net");
setOrganizationName ("Deng Team");
setApplicationName ("Doomsday Engine");
setApplicationVersion (DOOMSDAY_VERSION_BASE);
setMetadata("Deng Team", "dengine.net", "Doomsday Engine", DOOMSDAY_VERSION_BASE);
setUnixHomeFolderName(".doomsday");

setTerminateFunc(handleLegacyCoreTerminate);

// We must presently set the current game manually (the collection is global).
setGame(d->games.nullGame());

d->binder.init(scriptSystem().nativeModule("App"))
<< DENG2_FUNC_NOARG (App_GamePlugin, "gamePlugin")
<< DENG2_FUNC (App_AddFontMapping, "addFontMapping", "family" << "mappings")
<< DENG2_FUNC (App_LoadFont, "loadFont", "fileName")
<< DENG2_FUNC_NOARG (App_Quit, "quit");
<< DENG2_FUNC_NOARG (App_GamePlugin, "gamePlugin")
<< DENG2_FUNC_NOARG (App_Quit, "quit");
}

void ClientApp::initialize()
Expand Down
6 changes: 3 additions & 3 deletions doomsday/client/src/dd_main.cpp
Expand Up @@ -1372,7 +1372,7 @@ bool App_ChangeGame(Game &game, bool allowReload)
}

// The current game will be gone very soon.
DENG2_FOR_EACH_OBSERVER(App::GameUnloadAudience, i, App::app().audienceForGameUnload)
DENG2_FOR_EACH_OBSERVER(App::GameUnloadAudience, i, App::app().audienceForGameUnload())
{
i->aboutToUnloadGame(App::game());
}
Expand Down Expand Up @@ -1628,7 +1628,7 @@ bool App_ChangeGame(Game &game, bool allowReload)
#endif

// Game change is complete.
DENG2_FOR_EACH_OBSERVER(App::GameChangeAudience, i, App::app().audienceForGameChange)
DENG2_FOR_EACH_OBSERVER(App::GameChangeAudience, i, App::app().audienceForGameChange())
{
i->currentGameChanged(App::game());
}
Expand Down Expand Up @@ -1742,7 +1742,7 @@ void DD_FinishInitializationAfterWindowReady()
}

/// @todo This notification should be done from the app.
DENG2_FOR_EACH_OBSERVER(App::StartupCompleteAudience, i, App::app().audienceForStartupComplete)
DENG2_FOR_EACH_OBSERVER(App::StartupCompleteAudience, i, App::app().audienceForStartupComplete())
{
i->appStartupCompleted();
}
Expand Down
41 changes: 4 additions & 37 deletions doomsday/client/src/gl/gl_main.cpp
Expand Up @@ -556,43 +556,10 @@ void GL_Restore2DState(int step, viewport_t const *port, viewdata_t const *viewD

Matrix4f GL_GetProjectionMatrix()
{
// We're assuming pixels are squares.
float aspect = viewpw / (float) viewph;

if (vrCfg().mode() == VRConfig::OculusRift)
{
aspect = vrCfg().oculusRift().aspect();
// A little trigonometry to apply aspect ratio to angles
float x = tan(0.5 * de::degreeToRadian(Rend_FieldOfView()));
yfov = de::radianToDegree(2.0 * atan2(x/aspect, 1.0f));
}
else
{
yfov = Rend_FieldOfView() / aspect;
}

float fH = tan(0.5 * de::degreeToRadian(yfov)) * glNearClip;
float fW = fH*aspect;
/*
* Asymmetric frustum shift is computed to realign screen-depth items after view point has shifted.
* Asymmetric frustum shift method is probably superior to competing toe-in stereo 3D method:
* - AFS preserves identical near and far clipping planes in both views
* - AFS shows items at/near infinity better
* - AFS conforms to what stereo 3D photographers call "ortho stereo"
* Asymmetric frustum shift is used for all stereo 3D modes except Oculus Rift mode, which only
* applies the viewpoint shift.
*/
float frustumShift = 0;
if (vrCfg().frustumShift())
{
frustumShift = vrCfg().eyeShift() * glNearClip / vrCfg().screenDistance();
}

return Matrix4f::frustum(-fW - frustumShift, fW - frustumShift,
-fH, fH,
glNearClip, glFarClip) *
Matrix4f::translate(Vector3f(-vrCfg().eyeShift(), 0, 0)) *
Matrix4f::scale(Vector3f(1, 1, -1));
float const fov = Rend_FieldOfView();
Vector2f const size(viewpw, viewph);
yfov = vrCfg().verticalFieldOfView(fov, size);
return vrCfg().projectionMatrix(Rend_FieldOfView(), size, glNearClip, glFarClip);
}

void GL_ProjectionMatrix()
Expand Down

0 comments on commit d3951b1

Please sign in to comment.