Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gmoromisato committed Jan 6, 2015
1 parent 6076b72 commit 076bfef
Show file tree
Hide file tree
Showing 303 changed files with 193,805 additions and 24 deletions.
182 changes: 158 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,166 @@
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# =========================
# Operating System Files
# =========================

# OSX
# =========================

# Don't include Hexarc source

TSUI/CHexarcService.cpp

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/

# Roslyn cache directories
*.ide/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

#NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# Installshield output folder
[Ee]xpress/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

# Windows Azure Build Output
csx/
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
bower_components/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon
Icon


# Thumbnails
._*
Expand Down
145 changes: 145 additions & 0 deletions Include/CloudInterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// CloudInterface.h
//
// Classes and methods for accessing Transcendence cloud services
// Copyright (c) 2010 by George Moromisato. All Rights Reserved.

#pragma once

#ifndef INCL_INTERNETS
#include "Internets.h"
#endif

#ifndef INCL_CRYPTO
#include "Crypto.h"
#endif

#ifndef INCL_JSONUTIL
#include "JSONUtil.h"
#endif

struct SUserInfo
{
CString sUsername;
CString sService;
};

class ICIService
{
public:
enum Capabilities
{
autoLoginUser = 0x00000001, // Implies that we have cached username and credentials
cachedUser = 0x00000002, // We know the username, but may not have credentials
canGetUserProfile = 0x00000004, // Implies that we are signed in (we have an authToken)
loginUser = 0x00000008, // We have the ability to sign in (always TRUE for Hexarc)
registerUser = 0x00000010, // We have the ability to register (always TRUE for Hexarc)
canPostGameRecord = 0x00000020, // We can post a game record
userProfile = 0x00000040, // We can show user records (TRUE even if not signed in)
modExchange = 0x00000080, // We can show mod exchange (TRUE even if not signed in)
canLoadUserCollection = 0x00000100, // We can retrieve the user's collection
canDownloadExtension = 0x00000200, // We can download an extension from the multiverse
canPostCrashReport = 0x00000400, // We can post a crash report
canLoadNews = 0x00000800, // We can load news from the multiverse
};

ICIService (CHumanInterface &HI) : m_HI(HI), m_bEnabled(false), m_bModified(false) { }
virtual ~ICIService (void) { }

inline bool IsEnabled (void) { return m_bEnabled; }
inline bool IsModified (void) { return m_bModified; }
inline void SetEnabled (bool bValue = true) { m_bEnabled = bValue; }

virtual ALERROR ChangePassword (ITaskProcessor *pProcessor, const CString &sUsername, const CString &sOldPassword, const CString &sNewPassword, CString *retsResult = NULL) { return NOERROR; }
virtual CString GetTag (void) = 0;
virtual CString GetUsername (void) { return NULL_STR; }
virtual bool HasCapability (DWORD dwCapability) { return false; }
virtual ALERROR Housekeeping (ITaskProcessor *pProcessor) { return NOERROR; }
virtual ALERROR InitFromXML (CXMLElement *pDesc, bool *retbModified) { *retbModified = false; return NOERROR; }
virtual ALERROR InitPrivateData (void) { return NOERROR; }
virtual ALERROR LoadNews (ITaskProcessor *pProcessor, CMultiverseModel &Multiverse, const SFileVersionInfo &AppVersion, const CString &sCacheFilespec, CString *retsResult = NULL) { return NOERROR; }
virtual ALERROR LoadUserCollection (ITaskProcessor *pProcessor, CMultiverseModel &Multiverse, CString *retsResult = NULL) { return NOERROR; }
virtual ALERROR PostCrashReport (ITaskProcessor *pProcessor, const CString &sCrash, CString *retsResult = NULL) { return NOERROR; }
virtual ALERROR PostGameRecord (ITaskProcessor *pProcessor, const CGameRecord &Record, const CGameStats &Stats, CString *retsResult = NULL) { return NOERROR; }
virtual ALERROR ProcessDownloads (ITaskProcessor *pProcessor, CString *retsResult = NULL) { return NOERROR; }
virtual ALERROR ReadProfile (ITaskProcessor *pProcessor, CUserProfile *retProfile, CString *retsResult = NULL) { return NOERROR; }
virtual ALERROR RegisterUser (ITaskProcessor *pProcessor, const CString &sUsername, const CString &sPassword, const CString &sEmail, bool bAutoSignIn, CString *retsResult = NULL) { return NOERROR; }
virtual ALERROR RequestExtensionDownload (const CString &sFilePath, const CString &sFilespec, const CIntegerIP &FileDigest) { return NOERROR; }
virtual ALERROR SignInUser (ITaskProcessor *pProcessor, const CString &sUsername, const CString &sPassword, bool bAutoSignIn, CString *retsResult = NULL) { return NOERROR; }
virtual ALERROR SignOutUser (ITaskProcessor *pProcessor, CString *retsError = NULL) { return NOERROR; }
virtual ALERROR WriteAsXML (IWriteStream *pOutput) { return NOERROR; }
virtual ALERROR WritePrivateData (void) { return NOERROR; }

static ALERROR DownloadFile (const CString &sURL, IMediaType **retpBody, IHTTPClientSessionEvents *pEvents = NULL, CString *retsResult = NULL);
static ALERROR DownloadFile (const CString &sURL, const CString &sDestFilespec, IHTTPClientSessionEvents *pEvents = NULL, CString *retsResult = NULL);

protected:
void SendServiceError (const CString &sStatus);
void SendServiceStatus (const CString &sStatus);
inline void SetModified (bool bValue = true) { m_bModified = bValue; }

CHumanInterface &m_HI;
bool m_bEnabled;
bool m_bModified;
};

class ICIServiceFactory
{
public:
virtual ICIService *Create (CHumanInterface &HI) { return NULL; }
};

class CCloudService
{
public:
CCloudService (void) : m_pHI(NULL)
{ }

~CCloudService (void);

void CleanUp (void);
CString GetDefaultUsername (void);
CString GetUsername (void);
bool HasCapability (DWORD dwCapability);
ALERROR InitFromXML (CHumanInterface &HI, CXMLElement *pDesc, bool *retbModified);
ALERROR InitPrivateData (void);
bool IsEmpty (void) { return (m_Services.GetCount() == 0); }
bool IsModified (void);
ALERROR WriteAsXML (IWriteStream *pOutput);
ALERROR WritePrivateData (void);

ALERROR ChangePassword (ITaskProcessor *pProcessor, const CString &sUsername, const CString &sOldPassword, const CString &sNewPassword, CString *retsResult = NULL);
ALERROR DownloadUpgrade (ITaskProcessor *pProcessor, const CString &sUpgradeURL, CString *retsResult = NULL);
ALERROR Housekeeping (ITaskProcessor *pProcessor);
ALERROR LoadNews (ITaskProcessor *pProcessor, CMultiverseModel &Multiverse, const SFileVersionInfo &AppVersion, const CString &sCacheFilespec, CString *retsResult = NULL);
ALERROR LoadUserCollection (ITaskProcessor *pProcessor, CMultiverseModel &Multiverse, CString *retsResult = NULL);
ALERROR PostCrashReport (ITaskProcessor *pProcessor, const CString &sCrash, CString *retsResult = NULL);
ALERROR PostGameRecord (ITaskProcessor *pProcessor, const CGameRecord &Record, const CGameStats &Stats, CString *retsResult = NULL);
ALERROR ProcessDownloads (ITaskProcessor *pProcessor, CString *retsResult = NULL);
ALERROR ReadProfile (ITaskProcessor *pProcessor, CUserProfile *retProfile, CString *retsResult = NULL);
ALERROR RegisterUser (ITaskProcessor *pProcessor, const CString &sUsername, const CString &sPassword, const CString &sEmail, bool bAutoSignIn, CString *retsResult = NULL);
ALERROR RequestExtensionDownload (const CString &sFilePath, const CString &sFilespec, const CIntegerIP &FileDigest);
ALERROR SignInUser (ITaskProcessor *pProcessor, const CString &sUsername, const CString &sPassword, bool bAutoSignIn, CString *retsResult = NULL);
ALERROR SignOutUser (ITaskProcessor *pProcessor, CString *retsError = NULL);

private:
void SendServiceError (const CString &sStatus);
void SendServiceStatus (const CString &sStatus);

CHumanInterface *m_pHI;
TArray<ICIService *> m_Services;
};

// Default Services -----------------------------------------------------------

class CHexarcServiceFactory : public ICIServiceFactory
{
public:
virtual ICIService *Create (CHumanInterface &HI);
};

class CXelerusServiceFactory : public ICIServiceFactory
{
public:
virtual ICIService *Create (CHumanInterface &HI);
};

37 changes: 37 additions & 0 deletions Include/Geometry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Geometry.h
//
// Transcendence Space Engine geometry

#ifndef INCL_TSE_GEOMETRY
#define INCL_TSE_GEOMETRY

class ViewportTransform
{
public:
ViewportTransform (void) : m_xScale(1.0), m_yScale(1.0), m_xCenterTrans(0), m_yCenterTrans(0) { }
ViewportTransform (const CVector &vCenter, Metric xScale, Metric yScale, int xCenter, int yCenter);
ViewportTransform (const CVector &vCenter, Metric rScale, int xCenter, int yCenter);
void Offset (int x, int y);
void Transform (const CVector &vP, int *retx, int *rety) const;

private:
Metric m_xScale;
Metric m_yScale;
int m_xCenterTrans;
int m_yCenterTrans;
};

// Utilities

Metric CalcDistanceToPath (const CVector &Pos,
const CVector &Path1,
const CVector &Path2,
CVector *retvNearestPoint = NULL,
CVector *retvAway = NULL);
Metric CalcInterceptTime (const CVector &vTarget, const CVector &vTargetVel, Metric rMissileSpeed, Metric *retrRange = NULL);
bool IntersectLine (const CVector &vStart1, const CVector &vEnd1, const CVector &vStart2, const CVector &vEnd2, CVector *retvIntersection = NULL, Metric *retIntersectFraction = NULL);
bool IntersectRect (const CVector &vUR1, const CVector &vLL1,
const CVector &vUR2, const CVector &vLL2);
bool IntersectRect (const CVector &vUR, const CVector &vLL, const CVector &vPoint);

#endif
Loading

0 comments on commit 076bfef

Please sign in to comment.