Init
1285
DependentExtensions/IrrlichtDemo/CDemo.cpp
Normal file
183
DependentExtensions/IrrlichtDemo/CDemo.h
Normal file
@ -0,0 +1,183 @@
|
||||
// This is a Demo of the Irrlicht Engine (c) 2006 by N.Gebhardt.
|
||||
// This file is not documented.
|
||||
|
||||
/*
|
||||
* This file was taken from RakNet 4.082.
|
||||
* Please see licenses/RakNet license.txt for the underlying license and related copyright.
|
||||
*
|
||||
* Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
|
||||
*
|
||||
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
|
||||
* license found in the license.txt file in the root directory of this source tree.
|
||||
* Alternatively you are permitted to license the modifications under the zlib/libpng license.
|
||||
*/
|
||||
|
||||
#ifndef __C_DEMO_H_INCLUDED__
|
||||
#define __C_DEMO_H_INCLUDED__
|
||||
|
||||
#define USE_IRRKLANG
|
||||
//#define USE_SDL_MIXER
|
||||
|
||||
// For windows 1.6 must be used for this demo unless you recompile the dlls and replace them,
|
||||
// however it is untested on windows with later versions
|
||||
// Include path in windows project by defaults assumes C:\irrlicht-1.6
|
||||
// 1.6 or higher may be used in linux
|
||||
// Get Irrlicht from http://irrlicht.sourceforge.net/ , it's a great engine
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100) // unreferenced formal parameter
|
||||
#pragma warning(disable:4127) // conditional expression is constant
|
||||
#pragma warning(disable:4244) // type-conversion with possible loss of data
|
||||
#pragma warning(disable:4458) // declaration of 'identifier' hides class member
|
||||
#endif
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#define IRRLICHT_MEDIA_PATH "IrrlichtMedia/"
|
||||
|
||||
#ifdef _WIN32__
|
||||
#include "slikenet/WindowsIncludes.h" // Prevent 'fd_set' : 'struct' type redefinition
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
using namespace irr;
|
||||
|
||||
// audio support
|
||||
|
||||
// Included in RakNet download with permission by Nikolaus Gebhardt
|
||||
#ifdef USE_IRRKLANG
|
||||
#if defined(_WIN32__) || defined(WIN32) || defined(_WIN32)
|
||||
#include <irrKlang-1.1.3/irrKlang.h>
|
||||
#else
|
||||
#include "irrKlang.h"
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_WINDOWS_
|
||||
#pragma comment (lib, "irrKlang-1.1.3/irrKlang.lib")
|
||||
#endif
|
||||
#endif
|
||||
#ifdef USE_SDL_MIXER
|
||||
# include <SDL/SDL.h>
|
||||
# include <SDL/SDL_mixer.h>
|
||||
#endif
|
||||
|
||||
const int CAMERA_COUNT = 7;
|
||||
const float CAMERA_HEIGHT=50.0f;
|
||||
const float SHOT_SPEED=.6f;
|
||||
const float BALL_DIAMETER=25.0f;
|
||||
|
||||
// SLikeNet
|
||||
#include "slikenetstuff.h"
|
||||
#include "slikenet/DS_Multilist.h"
|
||||
#include "slikenet/string.h"
|
||||
#include "slikenet/time.h"
|
||||
|
||||
class CDemo : public IEventReceiver
|
||||
{
|
||||
public:
|
||||
|
||||
CDemo(bool fullscreen, bool music, bool shadows, bool additive, bool vsync, bool aa, video::E_DRIVER_TYPE driver, core::stringw &_playerName);
|
||||
|
||||
~CDemo();
|
||||
|
||||
void run();
|
||||
|
||||
virtual bool OnEvent(const SEvent& event);
|
||||
IrrlichtDevice * GetDevice(void) const {return device;}
|
||||
scene::ISceneManager* GetSceneManager(void) const {return device->getSceneManager();}
|
||||
|
||||
|
||||
// RakNet: Control what animation is playing by what key is pressed on the remote system
|
||||
bool IsKeyDown(EKEY_CODE keyCode) const;
|
||||
bool IsMovementKeyDown(void) const;
|
||||
// RakNet: Decouple the origin of the shot from the camera, so the network code can use this same graphical effect
|
||||
SLNet::TimeMS shootFromOrigin(core::vector3df camPosition, core::vector3df camAt);
|
||||
const core::aabbox3df& GetSyndeyBoundingBox(void) const;
|
||||
void PlayDeathSound(core::vector3df position);
|
||||
void EnableInput(bool enabled);
|
||||
|
||||
private:
|
||||
|
||||
void createLoadingScreen();
|
||||
void loadSceneData();
|
||||
void switchToNextScene();
|
||||
void shoot();
|
||||
void createParticleImpacts();
|
||||
|
||||
bool fullscreen;
|
||||
bool music;
|
||||
bool shadows;
|
||||
bool additive;
|
||||
bool vsync;
|
||||
bool aa;
|
||||
video::E_DRIVER_TYPE driverType;
|
||||
core::stringw playerName;
|
||||
IrrlichtDevice *device;
|
||||
|
||||
#ifdef USE_IRRKLANG
|
||||
void startIrrKlang();
|
||||
irrklang::ISoundEngine* irrKlang;
|
||||
irrklang::ISoundSource* ballSound;
|
||||
irrklang::ISoundSource* deathSound;
|
||||
irrklang::ISoundSource* impactSound;
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDL_MIXER
|
||||
void startSound();
|
||||
void playSound(Mix_Chunk *);
|
||||
void pollSound();
|
||||
Mix_Music *stream;
|
||||
Mix_Chunk *ballSound;
|
||||
Mix_Chunk *impactSound;
|
||||
#endif
|
||||
|
||||
struct SParticleImpact
|
||||
{
|
||||
u32 when;
|
||||
core::vector3df pos;
|
||||
core::vector3df outVector;
|
||||
};
|
||||
|
||||
int currentScene;
|
||||
video::SColor backColor;
|
||||
|
||||
gui::IGUIStaticText* statusText;
|
||||
gui::IGUIInOutFader* inOutFader;
|
||||
|
||||
scene::IQ3LevelMesh* quakeLevelMesh;
|
||||
scene::ISceneNode* quakeLevelNode;
|
||||
scene::ISceneNode* skyboxNode;
|
||||
scene::IAnimatedMeshSceneNode* model1;
|
||||
scene::IAnimatedMeshSceneNode* model2;
|
||||
scene::IParticleSystemSceneNode* campFire;
|
||||
|
||||
scene::IMetaTriangleSelector* metaSelector;
|
||||
scene::ITriangleSelector* mapSelector;
|
||||
|
||||
s32 sceneStartTime;
|
||||
s32 timeForThisScene;
|
||||
|
||||
core::array<SParticleImpact> Impacts;
|
||||
|
||||
// Per-tick game update for RakNet
|
||||
void UpdateRakNet(void);
|
||||
// Holds output messages
|
||||
DataStructures::Multilist<ML_QUEUE, SLNet::RakString> outputMessages;
|
||||
SLNet::TimeMS whenOutputMessageStarted;
|
||||
void PushMessage(SLNet::RakString rs);
|
||||
const char *GetCurrentMessage(void);
|
||||
// We use this array to store the current state of each key
|
||||
bool KeyIsDown[KEY_KEY_CODES_COUNT];
|
||||
// Bounding box of syndney.md2, extended by BALL_DIAMETER/2 for collision against shots
|
||||
core::aabbox3df syndeyBoundingBox;
|
||||
void CalculateSyndeyBoundingBox(void);
|
||||
|
||||
bool isConnectedToNATPunchthroughServer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
454
DependentExtensions/IrrlichtDemo/CMainMenu.cpp
Normal file
@ -0,0 +1,454 @@
|
||||
// This is a Demo of the Irrlicht Engine (c) 2005-2008 by N.Gebhardt.
|
||||
// This file is not documented.
|
||||
|
||||
/*
|
||||
* This file was taken from RakNet 4.082.
|
||||
* Please see licenses/RakNet license.txt for the underlying license and related copyright.
|
||||
*
|
||||
* Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschr<68>nkt)
|
||||
*
|
||||
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
|
||||
* license found in the license.txt file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "CMainMenu.h"
|
||||
|
||||
|
||||
//! we want the lights follow the model when it's moving
|
||||
class CSceneNodeAnimatorFollowBoundingBox : public irr::scene::ISceneNodeAnimator
|
||||
{
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
CSceneNodeAnimatorFollowBoundingBox(irr::scene::ISceneNode* tofollow,
|
||||
const core::vector3df &offset, u32 frequency, s32 phase)
|
||||
: Offset(offset), ToFollow(tofollow), Frequency(frequency), Phase(phase)
|
||||
{
|
||||
if (ToFollow)
|
||||
ToFollow->grab();
|
||||
}
|
||||
|
||||
//! destructor
|
||||
virtual ~CSceneNodeAnimatorFollowBoundingBox()
|
||||
{
|
||||
if (ToFollow)
|
||||
ToFollow->drop();
|
||||
}
|
||||
|
||||
//! animates a scene node
|
||||
virtual void animateNode(irr::scene::ISceneNode* node, u32 timeMs)
|
||||
{
|
||||
if (0 == node || node->getType() != irr::scene::ESNT_LIGHT)
|
||||
return;
|
||||
|
||||
irr::scene::ILightSceneNode* l = (irr::scene::ILightSceneNode*) node;
|
||||
|
||||
if (ToFollow)
|
||||
{
|
||||
core::vector3df now = l->getPosition();
|
||||
now += ToFollow->getBoundingBox().getCenter();
|
||||
now += Offset;
|
||||
l->setPosition(now);
|
||||
}
|
||||
|
||||
irr::video::SColorHSL color;
|
||||
irr::video::SColorf rgb(0);
|
||||
color.Hue = ( (timeMs + Phase) % Frequency ) * ( 2.f * irr::core::PI / Frequency );
|
||||
color.Saturation = 1.f;
|
||||
color.Luminance = 0.5f;
|
||||
color.toRGB(rgb);
|
||||
|
||||
video::SLight light = l->getLightData();
|
||||
light.DiffuseColor = rgb;
|
||||
l->setLightData(light);
|
||||
}
|
||||
|
||||
virtual scene::ISceneNodeAnimator* createClone(scene::ISceneNode* node, scene::ISceneManager* newManager=0)
|
||||
{
|
||||
// unused parameter
|
||||
(void)node;
|
||||
(void)newManager;
|
||||
|
||||
return 0;
|
||||
}
|
||||
private:
|
||||
|
||||
core::vector3df Offset;
|
||||
irr::scene::ISceneNode* ToFollow;
|
||||
s32 Frequency;
|
||||
s32 Phase;
|
||||
};
|
||||
|
||||
|
||||
CMainMenu::CMainMenu()
|
||||
: startButton(0), MenuDevice(0), selected(2), start(false),
|
||||
shadows(false), additive(false), transparent(true), vsync(false), aa(false),
|
||||
#ifdef _DEBUG
|
||||
fullscreen(false), music(false)
|
||||
#else
|
||||
fullscreen(true), music(true)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows,
|
||||
bool& outAdditive, bool& outVSync, bool& outAA,
|
||||
video::E_DRIVER_TYPE& outDriver, core::stringw &playerName)
|
||||
{
|
||||
//video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9;
|
||||
//video::E_DRIVER_TYPE driverType = video::EDT_OPENGL;
|
||||
video::E_DRIVER_TYPE driverType = video::EDT_BURNINGSVIDEO;
|
||||
//video::E_DRIVER_TYPE driverType = video::EDT_SOFTWARE;
|
||||
|
||||
MenuDevice = createDevice(driverType,
|
||||
core::dimension2d<u32>(512, 384), 16, false, false, false, this);
|
||||
|
||||
if (MenuDevice->getFileSystem()->existFile("irrlicht.dat"))
|
||||
MenuDevice->getFileSystem()->addFileArchive("irrlicht.dat", true, true, io::EFAT_ZIP);
|
||||
else
|
||||
MenuDevice->getFileSystem()->addFileArchive("../../media/irrlicht.dat", true, true, io::EFAT_ZIP);
|
||||
|
||||
video::IVideoDriver* driver = MenuDevice->getVideoDriver();
|
||||
scene::ISceneManager* smgr = MenuDevice->getSceneManager();
|
||||
gui::IGUIEnvironment* guienv = MenuDevice->getGUIEnvironment();
|
||||
|
||||
core::stringw str = "Irrlicht Engine Demo v";
|
||||
str += MenuDevice->getVersion();
|
||||
MenuDevice->setWindowCaption(str.c_str());
|
||||
|
||||
// set new Skin
|
||||
gui::IGUISkin* newskin = guienv->createSkin(gui::EGST_BURNING_SKIN);
|
||||
guienv->setSkin(newskin);
|
||||
newskin->drop();
|
||||
|
||||
// load font
|
||||
gui::IGUIFont* font = guienv->getFont("../../media/fonthaettenschweiler.bmp");
|
||||
if (font)
|
||||
guienv->getSkin()->setFont(font);
|
||||
|
||||
// add images
|
||||
|
||||
const s32 leftX = 260;
|
||||
|
||||
// add tab control
|
||||
gui::IGUITabControl* tabctrl = guienv->addTabControl(core::rect<int>(leftX,10,512-10,384-10),
|
||||
0, true, true);
|
||||
gui::IGUITab* optTab = tabctrl->addTab(L"Demo");
|
||||
gui::IGUITab* aboutTab = tabctrl->addTab(L"About");
|
||||
|
||||
// add list box
|
||||
|
||||
gui::IGUIListBox* box = guienv->addListBox(core::rect<int>(10,10,220,120), optTab, 1);
|
||||
box->addItem(L"OpenGL 1.5");
|
||||
box->addItem(L"Direct3D 8.1");
|
||||
box->addItem(L"Direct3D 9.0c");
|
||||
box->addItem(L"Burning's Video 0.39");
|
||||
box->addItem(L"Irrlicht Software Renderer 1.0");
|
||||
box->setSelected(selected);
|
||||
|
||||
// add button
|
||||
|
||||
startButton = guienv->addButton(core::rect<int>(30,295,200,324), optTab, 2, L"Start Demo");
|
||||
|
||||
// add checkbox
|
||||
|
||||
const s32 d = 50;
|
||||
|
||||
guienv->addCheckBox(fullscreen, core::rect<int>(20,85+d,130,110+d),
|
||||
optTab, 3, L"Fullscreen");
|
||||
guienv->addCheckBox(music, core::rect<int>(135,85+d,245,110+d),
|
||||
optTab, 4, L"Music & Sfx");
|
||||
guienv->addCheckBox(shadows, core::rect<int>(20,110+d,135,135+d),
|
||||
optTab, 5, L"Realtime shadows");
|
||||
guienv->addCheckBox(additive, core::rect<int>(20,135+d,230,160+d),
|
||||
optTab, 6, L"Old HW compatible blending");
|
||||
guienv->addCheckBox(vsync, core::rect<int>(20,160+d,230,185+d),
|
||||
optTab, 7, L"Vertical synchronisation");
|
||||
guienv->addCheckBox(aa, core::rect<int>(135,110+d,245,135+d),
|
||||
optTab, 8, L"Antialiasing");
|
||||
|
||||
// RakNet: Add edit box
|
||||
nameEditBox=guienv->addEditBox(L"Your name here", core::rect<int>(20,185+d,230,210+d), true, optTab, 9);
|
||||
|
||||
|
||||
// add about text
|
||||
|
||||
wchar_t* text2 = L"This is the tech demo of the Irrlicht engine. To start, "\
|
||||
L"select a video driver which works best with your hardware and press 'Start Demo'.\n"\
|
||||
L"What you currently see is displayed using the Burning Software Renderer (Thomas Alten).\n"\
|
||||
L"The Irrlicht Engine was written by me, Nikolaus Gebhardt. The models, "\
|
||||
L"maps and textures were placed at my disposal by B.Collins, M.Cook and J.Marton. The music was created by "\
|
||||
L"M.Rohde and is played back by irrKlang.\n"\
|
||||
L"For more informations, please visit the homepage of the Irrlicht engine:\nhttp://irrlicht.sourceforge.net\n"\
|
||||
L"\n*** MULTIPLAYER UPDATE ***\n"\
|
||||
L"Peer to peer multiplayer added in two days using RakNet.\n"\
|
||||
L"For a description of the networking design, see included readme.txt .\n";
|
||||
|
||||
guienv->addStaticText(text2, core::rect<int>(10, 10, 230, 320),
|
||||
true, true, aboutTab);
|
||||
|
||||
// add md2 model
|
||||
|
||||
scene::IAnimatedMesh* mesh = smgr->getMesh("../../media/faerie.md2");
|
||||
scene::IAnimatedMeshSceneNode* modelNode = smgr->addAnimatedMeshSceneNode(mesh);
|
||||
if (modelNode)
|
||||
{
|
||||
modelNode->setPosition( core::vector3df(0.f, 0.f, -5.f) );
|
||||
modelNode->setMaterialTexture(0, driver->getTexture("../../media/faerie2.bmp"));
|
||||
modelNode->setMaterialFlag(video::EMF_LIGHTING, true);
|
||||
modelNode->getMaterial(0).Shininess = 28.f;
|
||||
modelNode->getMaterial(0).NormalizeNormals = true;
|
||||
modelNode->setMD2Animation(scene::EMAT_STAND);
|
||||
}
|
||||
|
||||
// set ambient light (no sun light in the catacombs)
|
||||
smgr->setAmbientLight( video::SColorf(0.f, 0.f, 0.f) );
|
||||
|
||||
scene::ISceneNodeAnimator* anim;
|
||||
scene::ISceneNode* bill;
|
||||
|
||||
// add light 1 (sunset orange)
|
||||
scene::ILightSceneNode* light1 =
|
||||
smgr->addLightSceneNode(0, core::vector3df(10.f,10.f,0),
|
||||
video::SColorf(0.86f, 0.38f, 0.05f), 200.0f);
|
||||
|
||||
// add fly circle animator to light 1
|
||||
anim = smgr->createFlyCircleAnimator(core::vector3df(0,0,0),30.0f, -0.004f, core::vector3df(0.41f, 0.4f, 0.0f));
|
||||
light1->addAnimator(anim);
|
||||
anim->drop();
|
||||
|
||||
// let the lights follow the model...
|
||||
anim = new CSceneNodeAnimatorFollowBoundingBox(modelNode, core::vector3df(0,16,0), 4000, 0);
|
||||
//light1->addAnimator(anim);
|
||||
anim->drop();
|
||||
|
||||
// attach billboard to the light
|
||||
bill = smgr->addBillboardSceneNode(light1, core::dimension2d<f32>(10, 10));
|
||||
bill->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
|
||||
bill->setMaterialTexture(0, driver->getTexture("../../media/particlered.bmp"));
|
||||
|
||||
#if 1
|
||||
// add light 2 (nearly red)
|
||||
scene::ILightSceneNode* light2 =
|
||||
smgr->addLightSceneNode(0, core::vector3df(0,1,0),
|
||||
video::SColorf(0.9f, 1.0f, 0.f, 0.0f), 200.0f);
|
||||
|
||||
// add fly circle animator to light 1
|
||||
anim = smgr->createFlyCircleAnimator(core::vector3df(0,0,0),30.0f, 0.004f, core::vector3df(0.41f, 0.4f, 0.0f));
|
||||
light2->addAnimator(anim);
|
||||
anim->drop();
|
||||
|
||||
// let the lights follow the model...
|
||||
anim = new CSceneNodeAnimatorFollowBoundingBox( modelNode, core::vector3df(0,-8,0), 2000, 0 );
|
||||
//light2->addAnimator(anim);
|
||||
anim->drop();
|
||||
|
||||
|
||||
// attach billboard to the light
|
||||
bill = smgr->addBillboardSceneNode(light2, core::dimension2d<f32>(10, 10));
|
||||
bill->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
|
||||
bill->setMaterialTexture(0, driver->getTexture("../../media/particlered.bmp"));
|
||||
|
||||
// add light 3 (nearly blue)
|
||||
scene::ILightSceneNode* light3 =
|
||||
smgr->addLightSceneNode(0, core::vector3df(0,-1,0),
|
||||
video::SColorf(0.f, 0.0f, 0.9f, 0.0f), 40.0f);
|
||||
|
||||
// add fly circle animator to light 2
|
||||
anim = smgr->createFlyCircleAnimator(core::vector3df(0,0,0),40.0f, 0.004f, core::vector3df(-0.41f, -0.4f, 0.0f));
|
||||
light3->addAnimator(anim);
|
||||
anim->drop();
|
||||
|
||||
// let the lights follow the model...
|
||||
anim = new CSceneNodeAnimatorFollowBoundingBox(modelNode, core::vector3df(0,8,0), 8000, 0);
|
||||
//light3->addAnimator(anim);
|
||||
anim->drop();
|
||||
|
||||
// attach billboard to the light
|
||||
bill = smgr->addBillboardSceneNode(light3, core::dimension2d<f32>(10, 10));
|
||||
if (bill)
|
||||
{
|
||||
bill->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
|
||||
bill->setMaterialTexture(0, driver->getTexture("../../media/portal1.bmp"));
|
||||
}
|
||||
#endif
|
||||
|
||||
// create a fixed camera
|
||||
smgr->addCameraSceneNode(0, core::vector3df(45,0,0), core::vector3df(0,0,10));
|
||||
|
||||
// irrlicht logo and background
|
||||
// add irrlicht logo
|
||||
bool oldMipMapState = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
|
||||
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
|
||||
|
||||
guienv->addImage(driver->getTexture("../../media/irrlichtlogo2.png"),
|
||||
core::position2d<s32>(5,5));
|
||||
|
||||
video::ITexture* irrlichtBack = driver->getTexture("../../media/demoback.jpg");
|
||||
|
||||
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState);
|
||||
|
||||
// query original skin color
|
||||
getOriginalSkinColor();
|
||||
|
||||
// set transparency
|
||||
setTransparency();
|
||||
|
||||
// draw all
|
||||
|
||||
while(MenuDevice->run())
|
||||
{
|
||||
if (MenuDevice->isWindowActive())
|
||||
{
|
||||
driver->beginScene(false, true, video::SColor(0,0,0,0));
|
||||
|
||||
if (irrlichtBack)
|
||||
driver->draw2DImage(irrlichtBack,
|
||||
core::position2d<int>(0,0));
|
||||
|
||||
smgr->drawAll();
|
||||
guienv->drawAll();
|
||||
driver->endScene();
|
||||
}
|
||||
}
|
||||
|
||||
playerName=nameEditBox->getText();
|
||||
MenuDevice->drop();
|
||||
|
||||
outFullscreen = fullscreen;
|
||||
outMusic = music;
|
||||
outShadows = shadows;
|
||||
outAdditive = additive;
|
||||
outVSync = vsync;
|
||||
outAA = aa;
|
||||
|
||||
switch(selected)
|
||||
{
|
||||
case 0: outDriver = video::EDT_OPENGL; break;
|
||||
case 1: outDriver = video::EDT_DIRECT3D8; break;
|
||||
case 2: outDriver = video::EDT_DIRECT3D9; break;
|
||||
case 3: outDriver = video::EDT_BURNINGSVIDEO; break;
|
||||
case 4: outDriver = video::EDT_SOFTWARE; break;
|
||||
}
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
bool CMainMenu::OnEvent(const SEvent& event)
|
||||
{
|
||||
if (event.EventType == EET_KEY_INPUT_EVENT &&
|
||||
event.KeyInput.Key == KEY_F9 &&
|
||||
event.KeyInput.PressedDown == false)
|
||||
{
|
||||
video::IImage* image = MenuDevice->getVideoDriver()->createScreenShot();
|
||||
if (image)
|
||||
{
|
||||
MenuDevice->getVideoDriver()->writeImageToFile(image, "screenshot_main.jpg");
|
||||
image->drop();
|
||||
}
|
||||
}
|
||||
else
|
||||
if (event.EventType == irr::EET_MOUSE_INPUT_EVENT &&
|
||||
event.MouseInput.Event == EMIE_RMOUSE_LEFT_UP )
|
||||
{
|
||||
core::rect<s32> r(event.MouseInput.X, event.MouseInput.Y, 0, 0);
|
||||
gui::IGUIContextMenu* menu = MenuDevice->getGUIEnvironment()->addContextMenu(r, 0, 45);
|
||||
menu->addItem(L"transparent menus", 666, transparent == false);
|
||||
menu->addItem(L"solid menus", 666, transparent == true);
|
||||
menu->addSeparator();
|
||||
menu->addItem(L"Cancel");
|
||||
}
|
||||
else
|
||||
if (event.EventType == EET_GUI_EVENT)
|
||||
{
|
||||
s32 id = event.GUIEvent.Caller->getID();
|
||||
switch(id)
|
||||
{
|
||||
case 45: // context menu
|
||||
if (event.GUIEvent.EventType == gui::EGET_MENU_ITEM_SELECTED)
|
||||
{
|
||||
s32 s = ((gui::IGUIContextMenu*)event.GUIEvent.Caller)->getSelectedItem();
|
||||
if (s == 0 || s == 1)
|
||||
{
|
||||
transparent = !transparent;
|
||||
setTransparency();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (event.GUIEvent.EventType == gui::EGET_LISTBOX_CHANGED ||
|
||||
event.GUIEvent.EventType == gui::EGET_LISTBOX_SELECTED_AGAIN)
|
||||
{
|
||||
selected = ((gui::IGUIListBox*)event.GUIEvent.Caller)->getSelected();
|
||||
//startButton->setEnabled(selected != 4);
|
||||
startButton->setEnabled(true);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED )
|
||||
{
|
||||
MenuDevice->closeDevice();
|
||||
start = true;
|
||||
}
|
||||
case 3:
|
||||
if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED )
|
||||
fullscreen = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
|
||||
break;
|
||||
case 4:
|
||||
if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED )
|
||||
music = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
|
||||
break;
|
||||
case 5:
|
||||
if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED )
|
||||
shadows = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
|
||||
break;
|
||||
case 6:
|
||||
if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED )
|
||||
additive = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
|
||||
break;
|
||||
case 7:
|
||||
if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED )
|
||||
vsync = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
|
||||
break;
|
||||
case 8:
|
||||
if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED )
|
||||
aa = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void CMainMenu::getOriginalSkinColor()
|
||||
{
|
||||
irr::gui::IGUISkin * skin = MenuDevice->getGUIEnvironment()->getSkin();
|
||||
for (s32 i=0; i<gui::EGDC_COUNT ; ++i)
|
||||
{
|
||||
SkinColor[i] = skin->getColor( (gui::EGUI_DEFAULT_COLOR)i );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CMainMenu::setTransparency()
|
||||
{
|
||||
irr::gui::IGUISkin * skin = MenuDevice->getGUIEnvironment()->getSkin();
|
||||
|
||||
for (u32 i=0; i<gui::EGDC_COUNT ; ++i)
|
||||
{
|
||||
video::SColor col = SkinColor[i];
|
||||
|
||||
if (false == transparent)
|
||||
col.setAlpha(255);
|
||||
|
||||
skin->setColor((gui::EGUI_DEFAULT_COLOR)i, col);
|
||||
}
|
||||
}
|
||||
|
||||
79
DependentExtensions/IrrlichtDemo/CMainMenu.h
Normal file
@ -0,0 +1,79 @@
|
||||
// This is a Demo of the Irrlicht Engine (c) 2005 by N.Gebhardt.
|
||||
// This file is not documentated.
|
||||
|
||||
/*
|
||||
* This file was taken from RakNet 4.082.
|
||||
*
|
||||
* Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
|
||||
*
|
||||
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
|
||||
* license found in the license.txt file in the root directory of this source tree.
|
||||
* Alternatively you are permitted to license the modifications under the zlib/libpng license.
|
||||
*/
|
||||
|
||||
#ifndef __C_MAIN_MENU_H_INCLUDED__
|
||||
#define __C_MAIN_MENU_H_INCLUDED__
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100) // unreferenced formal parameter
|
||||
#pragma warning(disable:4127) // conditional expression is constant
|
||||
#pragma warning(disable:4244) // type-conversion with possible loss of data
|
||||
#pragma warning(disable:4458) // declaration of 'identifier' hides class member
|
||||
#endif
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32__
|
||||
#include "slikenet/WindowsIncludes.h" // Prevent 'fd_set' : 'struct' type redefinition
|
||||
#endif
|
||||
#include "IGUIEditBox.h"
|
||||
|
||||
using namespace irr;
|
||||
|
||||
class CMainMenu : public IEventReceiver
|
||||
{
|
||||
public:
|
||||
|
||||
CMainMenu();
|
||||
|
||||
bool run(bool& outFullscreen, bool& outMusic, bool& outShadows,
|
||||
bool& outAdditive, bool &outVSync, bool& outAA,
|
||||
video::E_DRIVER_TYPE& outDriver,
|
||||
core::stringw &playerName);
|
||||
|
||||
virtual bool OnEvent(const SEvent& event);
|
||||
|
||||
private:
|
||||
|
||||
void setTransparency();
|
||||
|
||||
gui::IGUIButton* startButton;
|
||||
IrrlichtDevice *MenuDevice;
|
||||
s32 selected;
|
||||
bool start;
|
||||
bool fullscreen;
|
||||
bool music;
|
||||
bool shadows;
|
||||
bool additive;
|
||||
bool transparent;
|
||||
bool vsync;
|
||||
bool aa;
|
||||
|
||||
scene::IAnimatedMesh* quakeLevel;
|
||||
scene::ISceneNode* lightMapNode;
|
||||
scene::ISceneNode* dynamicNode;
|
||||
|
||||
video::SColor SkinColor [ gui::EGDC_COUNT ];
|
||||
void getOriginalSkinColor();
|
||||
|
||||
// RakNet: Store the edit box pointer so we can get the text later
|
||||
irr::gui::IGUIEditBox* nameEditBox;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
40
DependentExtensions/IrrlichtDemo/CMakeLists.txt
Normal file
@ -0,0 +1,40 @@
|
||||
#
|
||||
# This file was taken from RakNet 4.082.
|
||||
# Please see licenses/RakNet license.txt for the underlying license and related copyright.
|
||||
#
|
||||
#
|
||||
# Modified work: Copyright (c) 2017-2019, SLikeSoft UG (haftungsbeschränkt)
|
||||
#
|
||||
# This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
|
||||
# license found in the license.txt file in the root directory of this source tree.
|
||||
#
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
GETCURRENTFOLDER()
|
||||
FINDIRRLICHT()
|
||||
IF(WIN32 AND NOT UNIX)
|
||||
project(${current_folder})
|
||||
FILE(GLOB ALL_CPP_SRCS *.cpp "${SLikeNet_SOURCE_DIR}/Samples/PHPDirectoryServer2/PHPDirectoryServer2.cpp")
|
||||
FILE(GLOB ALL_HEADER_SRCS *.h "${SLikeNet_SOURCE_DIR}/Samples/PHPDirectoryServer2/PHPDirectoryServer2.h")
|
||||
FIXCOMPILEOPTIONS()
|
||||
include_directories(${SLIKENET_HEADER_FILES} ./ ${IRRLICHT_INCLUDE_DIR})
|
||||
add_executable(${current_folder} WIN32 ${ALL_CPP_SRCS} ${ALL_HEADER_SRCS})
|
||||
target_link_libraries(${current_folder} ${SLIKENET_COMMON_LIBS})
|
||||
set_target_properties(${current_folder} PROPERTIES PROJECT_GROUP "Samples/3D Demos")
|
||||
ELSE(WIN32 AND NOT UNIX)
|
||||
project(${current_folder})
|
||||
FINDIRRKLANG()
|
||||
FILE(GLOB ALL_CPP_SRCS *.cpp "${SLikeNet_SOURCE_DIR}/Samples/PHPDirectoryServer2/PHPDirectoryServer2.cpp")
|
||||
FILE(GLOB ALL_HEADER_SRCS *.h "${SLikeNet_SOURCE_DIR}/Samples/PHPDirectoryServer2/PHPDirectoryServer2.h")
|
||||
FIXCOMPILEOPTIONS()
|
||||
include_directories(${SLIKENET_HEADER_FILES} ./ ${IRRLICHT_INCLUDE_DIR} ${IRRKLANG_INCLUDE_DIR})
|
||||
add_executable(${current_folder} WIN32 ${ALL_CPP_SRCS} ${ALL_HEADER_SRCS})
|
||||
target_link_libraries(${current_folder} ${SLIKENET_COMMON_LIBS} ${IRRLICHT_LIBRARIES} ${IRRKLANG_LIBRARIES})
|
||||
ENDIF(WIN32 AND NOT UNIX)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
DependentExtensions/IrrlichtDemo/Irrlicht.exp
Normal file
BIN
DependentExtensions/IrrlichtDemo/Irrlicht.lib
Normal file
326
DependentExtensions/IrrlichtDemo/IrrlichtDemo.vcxproj
Normal file
@ -0,0 +1,326 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug - Unicode|Win32">
|
||||
<Configuration>Debug - Unicode</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release - Unicode|Win32">
|
||||
<Configuration>Release - Unicode</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Retail - Unicode|Win32">
|
||||
<Configuration>Retail - Unicode</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Retail|Win32">
|
||||
<Configuration>Retail</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>IrrlichtDemo</ProjectName>
|
||||
<ProjectGuid>{DEDB9D76-00E6-4230-8612-0B5AC0F3D5E8}</ProjectGuid>
|
||||
<RootNamespace>IrrlichtDemo</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'">$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'">$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'">$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'">$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>./;./../../Source/include;C:\irrlicht-1.8\include;./../../DependentExtensions/miniupnpc-1.5;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;IPHlpApi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy C:\irrlicht-1.8\bin\Win32-VisualStudio\Irrlicht.dll .\</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>./;./../../Source/include;C:\irrlicht-1.8\include;./../../DependentExtensions/miniupnpc-1.5;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;IPHlpApi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy C:\irrlicht-1.8\bin\Win32-VisualStudio\Irrlicht.dll .\</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>./;./../../Source/include;C:\irrlicht-1.8\include;./../../DependentExtensions/miniupnpc-1.5;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;IPHlpApi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy C:\irrlicht-1.8\bin\Win32-VisualStudio\Irrlicht.dll .\</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>./;./../../Source/include;C:\irrlicht-1.8\include;./../../DependentExtensions/miniupnpc-1.5;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;_RETAIL;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;IPHlpApi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy C:\irrlicht-1.8\bin\Win32-VisualStudio\Irrlicht.dll .\</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>./;./../../Source/include;C:\irrlicht-1.8\include;./../../DependentExtensions/miniupnpc-1.5;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;IPHlpApi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy C:\irrlicht-1.8\bin\Win32-VisualStudio\Irrlicht.dll .\</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>./;./../../Source/include;C:\irrlicht-1.8\include;./../../DependentExtensions/miniupnpc-1.5;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;_RETAIL;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;IPHlpApi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy C:\irrlicht-1.8\bin\Win32-VisualStudio\Irrlicht.dll .\</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\miniupnpc-1.5\connecthostport.c" />
|
||||
<ClCompile Include="..\miniupnpc-1.5\igd_desc_parse.c" />
|
||||
<ClCompile Include="..\miniupnpc-1.5\minisoap.c" />
|
||||
<ClCompile Include="..\miniupnpc-1.5\miniupnpc.c">
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4100;4389;4456;4706</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'">4100;4389;4456;4706</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'">4100;4389;4456;4706</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'">4100;4389;4456;4706</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4100;4389;4456;4706</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'">4100;4389;4456;4706</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\miniwget.c">
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4100</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'">4100</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'">4100</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'">4100</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4100</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'">4100</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\minixml.c" />
|
||||
<ClCompile Include="..\miniupnpc-1.5\upnpcommands.c">
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4245</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug - Unicode|Win32'">4245</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release - Unicode|Win32'">4245</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Retail|Win32'">4245</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4245</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Retail - Unicode|Win32'">4245</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\upnperrors.c" />
|
||||
<ClCompile Include="..\miniupnpc-1.5\upnpreplyparse.c" />
|
||||
<ClCompile Include="CDemo.cpp" />
|
||||
<ClCompile Include="CMainMenu.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="slikenetstuff.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\miniupnpc-1.5\connecthostport.h" />
|
||||
<ClInclude Include="..\miniupnpc-1.5\igd_desc_parse.h" />
|
||||
<ClInclude Include="..\miniupnpc-1.5\minisoap.h" />
|
||||
<ClInclude Include="..\miniupnpc-1.5\miniupnpc.h" />
|
||||
<ClInclude Include="..\miniupnpc-1.5\miniwget.h" />
|
||||
<ClInclude Include="..\miniupnpc-1.5\minixml.h" />
|
||||
<ClInclude Include="..\miniupnpc-1.5\upnpcommands.h" />
|
||||
<ClInclude Include="..\miniupnpc-1.5\upnperrors.h" />
|
||||
<ClInclude Include="..\miniupnpc-1.5\upnpreplyparse.h" />
|
||||
<ClInclude Include="CDemo.h" />
|
||||
<ClInclude Include="CMainMenu.h" />
|
||||
<ClInclude Include="slikenetstuff.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Lib\LibStatic\LibStatic.vcxproj">
|
||||
<Project>{6533bdae-0f0c-45e4-8fe7-add0f37fe063}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="miniupnpc-1.5">
|
||||
<UniqueIdentifier>{3104a32d-ac4c-4587-9569-369d9223dbd2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\miniupnpc-1.5\connecthostport.c">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\igd_desc_parse.c">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\minisoap.c">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\miniupnpc.c">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\miniwget.c">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\minixml.c">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\upnpcommands.c">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\upnperrors.c">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\miniupnpc-1.5\upnpreplyparse.c">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CDemo.cpp" />
|
||||
<ClCompile Include="CMainMenu.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="slikenetstuff.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\miniupnpc-1.5\connecthostport.h">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\miniupnpc-1.5\igd_desc_parse.h">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\miniupnpc-1.5\minisoap.h">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\miniupnpc-1.5\miniupnpc.h">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\miniupnpc-1.5\miniwget.h">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\miniupnpc-1.5\minixml.h">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\miniupnpc-1.5\upnpcommands.h">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\miniupnpc-1.5\upnperrors.h">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\miniupnpc-1.5\upnpreplyparse.h">
|
||||
<Filter>miniupnpc-1.5</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CDemo.h" />
|
||||
<ClInclude Include="CMainMenu.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="slikenetstuff.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/IrrlichtTheme.ogg
Normal file
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/ball.wav
Normal file
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/fireball.bmp
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 192 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/impact.wav
Normal file
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/irrlicht.dat
Normal file
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/irrlicht2_bk.jpg
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/irrlicht2_dn.jpg
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/irrlicht2_ft.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/irrlicht2_lf.jpg
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/irrlicht2_rt.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/irrlicht2_up.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/irrlichtlogo2.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/map-20kdm2.pk3
Normal file
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/particlewhite.bmp
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/portal1.bmp
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/portal2.bmp
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/portal3.bmp
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/portal4.bmp
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/portal5.bmp
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/portal6.bmp
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/portal7.bmp
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/smoke.bmp
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/sydney.bmp
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
DependentExtensions/IrrlichtDemo/IrrlichtMedia/sydney.md2
Normal file
4
DependentExtensions/IrrlichtDemo/demo.layout
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_layout_file>
|
||||
<ActiveTarget name="" />
|
||||
</CodeBlocks_layout_file>
|
||||
BIN
DependentExtensions/IrrlichtDemo/icon.ico
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
74
DependentExtensions/IrrlichtDemo/main.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
// This is a Demo of the Irrlicht Engine (c) 2005-2008 by N.Gebhardt.
|
||||
// This file is not documented.
|
||||
|
||||
/*
|
||||
* This file was taken from RakNet 4.082.
|
||||
* Please see licenses/RakNet license.txt for the underlying license and related copyright.
|
||||
*
|
||||
* Modified work: Copyright (c) 2017-2018, SLikeSoft UG (haftungsbeschränkt)
|
||||
*
|
||||
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
|
||||
* license found in the license.txt file in the root directory of this source tree.
|
||||
* Alternatively you are permitted to license the modifications under the zlib/libpng license.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100) // unreferenced formal parameter
|
||||
#pragma warning(disable:4127) // conditional expression is constant
|
||||
#pragma warning(disable:4244) // type-conversion with possible loss of data
|
||||
#pragma warning(disable:4458) // declaration of 'identifier' hides class member
|
||||
#endif
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32__
|
||||
#include "slikenet/WindowsIncludes.h" // Prevent 'fd_set' : 'struct' type redefinition
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "CMainMenu.h"
|
||||
#include "CDemo.h"
|
||||
|
||||
using namespace irr;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, INT )
|
||||
#else
|
||||
int main(int, char*[])
|
||||
#endif
|
||||
{
|
||||
bool fullscreen = false;
|
||||
bool music = true;
|
||||
bool shadows = false;
|
||||
bool additive = false;
|
||||
bool vsync = false;
|
||||
bool aa = false;
|
||||
core::stringw playerName;
|
||||
|
||||
#ifndef _IRR_WINDOWS_
|
||||
video::E_DRIVER_TYPE driverType = video::EDT_OPENGL;
|
||||
#else
|
||||
video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9;
|
||||
#endif
|
||||
|
||||
CMainMenu menu;
|
||||
|
||||
//#ifndef _DEBUG
|
||||
if (menu.run(fullscreen, music, shadows, additive, vsync, aa, driverType, playerName))
|
||||
//#endif
|
||||
{
|
||||
CDemo demo(fullscreen, music, shadows, additive, vsync, aa, driverType, playerName);
|
||||
demo.run();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
16
DependentExtensions/IrrlichtDemo/resource.h
Normal file
@ -0,0 +1,16 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by resscript.rc
|
||||
//
|
||||
#define IDI_ICON1 101
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
72
DependentExtensions/IrrlichtDemo/resscript.rc
Normal file
@ -0,0 +1,72 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Deutsch (<28>sterreich) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEA)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON1 ICON DISCARDABLE "icon.ico"
|
||||
#endif // Deutsch (<28>sterreich) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
528
DependentExtensions/IrrlichtDemo/slikenetstuff.cpp
Normal file
@ -0,0 +1,528 @@
|
||||
/*
|
||||
* Original work: Copyright (c) 2014, Oculus VR, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* RakNet License.txt file in the licenses directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
|
||||
*
|
||||
*
|
||||
* Modified work: Copyright (c) 2016-2020, SLikeSoft UG (haftungsbeschränkt)
|
||||
*
|
||||
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
|
||||
* license found in the license.txt file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "slikenetstuff.h"
|
||||
|
||||
#include "slikenet/NetworkIDManager.h"
|
||||
#include "CDemo.h"
|
||||
#include "slikenet/time.h"
|
||||
#include "slikenet/GetTime.h"
|
||||
#include "slikenet/SocketLayer.h"
|
||||
#include "slikenet/linux_adapter.h"
|
||||
#include "slikenet/osx_adapter.h"
|
||||
|
||||
using namespace SLNet;
|
||||
|
||||
RakPeerInterface *rakPeer;
|
||||
NetworkIDManager *networkIDManager;
|
||||
ReplicaManager3Irrlicht *irrlichtReplicaManager3;
|
||||
NatPunchthroughClient *natPunchthroughClient;
|
||||
CloudClient *cloudClient;
|
||||
SLNet::FullyConnectedMesh2 *fullyConnectedMesh2;
|
||||
PlayerReplica *playerReplica;
|
||||
|
||||
/*
|
||||
class DebugBoxSceneNode : public scene::ISceneNode
|
||||
{
|
||||
public:
|
||||
DebugBoxSceneNode(scene::ISceneNode* parent,
|
||||
scene::ISceneManager* mgr,
|
||||
s32 id = -1);
|
||||
virtual const core::aabbox3d<f32>& getBoundingBox() const;
|
||||
virtual void OnRegisterSceneNode();
|
||||
virtual void render();
|
||||
|
||||
CDemo *demo;
|
||||
};
|
||||
DebugBoxSceneNode::DebugBoxSceneNode(
|
||||
scene::ISceneNode* parent,
|
||||
scene::ISceneManager* mgr,
|
||||
s32 id)
|
||||
: scene::ISceneNode(parent, mgr, id)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("DebugBoxSceneNode");
|
||||
#endif
|
||||
setAutomaticCulling(scene::EAC_OFF);
|
||||
}
|
||||
const core::aabbox3d<f32>& DebugBoxSceneNode::getBoundingBox() const
|
||||
{
|
||||
return demo->GetSyndeyBoundingBox();
|
||||
}
|
||||
void DebugBoxSceneNode::OnRegisterSceneNode()
|
||||
{
|
||||
if (IsVisible)
|
||||
demo->GetSceneManager()->registerNodeForRendering(this, scene::ESNRP_SOLID);
|
||||
}
|
||||
void DebugBoxSceneNode::render()
|
||||
{
|
||||
if (DebugDataVisible)
|
||||
{
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
|
||||
video::SMaterial m;
|
||||
m.Lighting = false;
|
||||
demo->GetDevice()->getVideoDriver()->setMaterial(m);
|
||||
demo->GetDevice()->getVideoDriver()->draw3DBox(demo->GetSyndeyBoundingBox());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
DataStructures::List<PlayerReplica*> PlayerReplica::playerList;
|
||||
|
||||
// Take this many milliseconds to move the visible position to the real position
|
||||
static const float INTERP_TIME_MS=100.0f;
|
||||
|
||||
void InstantiateRakNetClasses(void)
|
||||
{
|
||||
static const int MAX_PLAYERS=32;
|
||||
static const unsigned short TCP_PORT=0;
|
||||
static const SLNet::TimeMS UDP_SLEEP_TIMER=30;
|
||||
|
||||
// Basis of all UDP communications
|
||||
rakPeer= SLNet::RakPeerInterface::GetInstance();
|
||||
// Using fixed port so we can use AdvertiseSystem and connect on the LAN if the server is not available.
|
||||
SLNet::SocketDescriptor sd(1234,0);
|
||||
sd.socketFamily=AF_INET; // Only IPV4 supports broadcast on 255.255.255.255
|
||||
while (IRNS2_Berkley::IsPortInUse(sd.port, sd.hostAddress, sd.socketFamily, SOCK_DGRAM)==true)
|
||||
sd.port++;
|
||||
// +1 is for the connection to the NAT punchthrough server
|
||||
SLNET_VERIFY(rakPeer->Startup(MAX_PLAYERS+1,&sd,1) == SLNet::RAKNET_STARTED);
|
||||
rakPeer->SetMaximumIncomingConnections(MAX_PLAYERS);
|
||||
// Fast disconnect for easier testing of host migration
|
||||
rakPeer->SetTimeoutTime(5000,UNASSIGNED_SYSTEM_ADDRESS);
|
||||
// ReplicaManager3 replies on NetworkIDManager. It assigns numbers to objects so they can be looked up over the network
|
||||
// It's a class in case you wanted to have multiple worlds, then you could have multiple instances of NetworkIDManager
|
||||
networkIDManager=new NetworkIDManager;
|
||||
// Automatically sends around new / deleted / changed game objects
|
||||
irrlichtReplicaManager3=new ReplicaManager3Irrlicht;
|
||||
irrlichtReplicaManager3->SetNetworkIDManager(networkIDManager);
|
||||
rakPeer->AttachPlugin(irrlichtReplicaManager3);
|
||||
// Automatically destroy connections, but don't create them so we have more control over when a system is considered ready to play
|
||||
irrlichtReplicaManager3->SetAutoManageConnections(false,true);
|
||||
// Create and register the network object that represents the player
|
||||
playerReplica = new PlayerReplica;
|
||||
irrlichtReplicaManager3->Reference(playerReplica);
|
||||
// Lets you connect through routers
|
||||
natPunchthroughClient=new NatPunchthroughClient;
|
||||
rakPeer->AttachPlugin(natPunchthroughClient);
|
||||
// Uploads game instance, basically client half of a directory server
|
||||
// Server code is in NATCompleteServer sample
|
||||
cloudClient=new CloudClient;
|
||||
rakPeer->AttachPlugin(cloudClient);
|
||||
fullyConnectedMesh2=new FullyConnectedMesh2;
|
||||
fullyConnectedMesh2->SetAutoparticipateConnections(false);
|
||||
fullyConnectedMesh2->SetConnectOnNewRemoteConnection(false, "");
|
||||
rakPeer->AttachPlugin(fullyConnectedMesh2);
|
||||
// Connect to the NAT punchthrough server
|
||||
SLNET_VERIFY(rakPeer->Connect(DEFAULT_NAT_PUNCHTHROUGH_FACILITATOR_IP, DEFAULT_NAT_PUNCHTHROUGH_FACILITATOR_PORT,0,0) == CONNECTION_ATTEMPT_STARTED);
|
||||
|
||||
// Advertise ourselves on the lAN if the NAT punchthrough server is not available
|
||||
//for (int i=0; i < 8; i++)
|
||||
// rakPeer->AdvertiseSystem("255.255.255.255", 1234+i, 0,0,0);
|
||||
}
|
||||
void DeinitializeRakNetClasses(void)
|
||||
{
|
||||
// Shutdown so the server knows we stopped
|
||||
rakPeer->Shutdown(100,0);
|
||||
SLNet::RakPeerInterface::DestroyInstance(rakPeer);
|
||||
delete networkIDManager;
|
||||
delete irrlichtReplicaManager3;
|
||||
delete natPunchthroughClient;
|
||||
delete cloudClient;
|
||||
delete fullyConnectedMesh2;
|
||||
// ReplicaManager3 deletes all referenced objects, including this one
|
||||
//playerReplica->PreDestruction(0);
|
||||
//delete playerReplica;
|
||||
}
|
||||
BaseIrrlichtReplica::BaseIrrlichtReplica()
|
||||
{
|
||||
}
|
||||
BaseIrrlichtReplica::~BaseIrrlichtReplica()
|
||||
{
|
||||
|
||||
}
|
||||
void BaseIrrlichtReplica::SerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
|
||||
{
|
||||
// unused parameters
|
||||
(void)destinationConnection;
|
||||
|
||||
constructionBitstream->Write(position);
|
||||
}
|
||||
bool BaseIrrlichtReplica::DeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
|
||||
{
|
||||
// unused parameters
|
||||
(void)sourceConnection;
|
||||
|
||||
constructionBitstream->Read(position);
|
||||
return true;
|
||||
}
|
||||
RM3SerializationResult BaseIrrlichtReplica::Serialize(SLNet::SerializeParameters *serializeParameters)
|
||||
{
|
||||
// unused parameters
|
||||
(void)serializeParameters;
|
||||
|
||||
return RM3SR_BROADCAST_IDENTICALLY;
|
||||
}
|
||||
void BaseIrrlichtReplica::Deserialize(SLNet::DeserializeParameters *deserializeParameters)
|
||||
{
|
||||
// unused parameters
|
||||
(void)deserializeParameters;
|
||||
}
|
||||
void BaseIrrlichtReplica::Update(SLNet::TimeMS curTime)
|
||||
{
|
||||
// unused parameters
|
||||
(void)curTime;
|
||||
}
|
||||
PlayerReplica::PlayerReplica()
|
||||
{
|
||||
model=0;
|
||||
rotationDeltaPerMS=0.0f;
|
||||
isMoving=false;
|
||||
deathTimeout=0;
|
||||
lastUpdate= SLNet::GetTimeMS();
|
||||
playerList.Push(this,_FILE_AND_LINE_);
|
||||
}
|
||||
PlayerReplica::~PlayerReplica()
|
||||
{
|
||||
unsigned int index = playerList.GetIndexOf(this);
|
||||
if (index != (unsigned int) -1)
|
||||
playerList.RemoveAtIndexFast(index);
|
||||
}
|
||||
void PlayerReplica::WriteAllocationID(SLNet::Connection_RM3 *destinationConnection, SLNet::BitStream *allocationIdBitstream) const
|
||||
{
|
||||
// unused parameters
|
||||
(void)destinationConnection;
|
||||
|
||||
allocationIdBitstream->Write(SLNet::RakString("PlayerReplica"));
|
||||
}
|
||||
void PlayerReplica::SerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
|
||||
{
|
||||
BaseIrrlichtReplica::SerializeConstruction(constructionBitstream, destinationConnection);
|
||||
constructionBitstream->Write(rotationAroundYAxis);
|
||||
constructionBitstream->Write(playerName);
|
||||
constructionBitstream->Write(IsDead());
|
||||
}
|
||||
bool PlayerReplica::DeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
|
||||
{
|
||||
if (!BaseIrrlichtReplica::DeserializeConstruction(constructionBitstream, sourceConnection))
|
||||
return false;
|
||||
constructionBitstream->Read(rotationAroundYAxis);
|
||||
constructionBitstream->Read(playerName);
|
||||
constructionBitstream->Read(isDead);
|
||||
return true;
|
||||
}
|
||||
void PlayerReplica::PostDeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
|
||||
{
|
||||
// unused parameters
|
||||
(void)constructionBitstream;
|
||||
(void)destinationConnection;
|
||||
|
||||
// Object was remotely created and all data loaded. Now we can make the object visible
|
||||
scene::IAnimatedMesh* mesh = 0;
|
||||
scene::ISceneManager *sm = demo->GetSceneManager();
|
||||
mesh = sm->getMesh(IRRLICHT_MEDIA_PATH "sydney.md2");
|
||||
model = sm->addAnimatedMeshSceneNode(mesh, 0);
|
||||
|
||||
// DebugBoxSceneNode * debugBox = new DebugBoxSceneNode(model,sm);
|
||||
// debugBox->demo=demo;
|
||||
// debugBox->setDebugDataVisible(true);
|
||||
|
||||
model->setPosition(position);
|
||||
model->setRotation(core::vector3df(0, rotationAroundYAxis, 0));
|
||||
model->setScale(core::vector3df(2,2,2));
|
||||
model->setMD2Animation(scene::EMAT_STAND);
|
||||
curAnim=scene::EMAT_STAND;
|
||||
model->setMaterialTexture(0, demo->GetDevice()->getVideoDriver()->getTexture(IRRLICHT_MEDIA_PATH "sydney.bmp"));
|
||||
model->setMaterialFlag(video::EMF_LIGHTING, true);
|
||||
model->addShadowVolumeSceneNode();
|
||||
model->setAutomaticCulling ( scene::EAC_BOX );
|
||||
model->setVisible(true);
|
||||
model->setAnimationEndCallback(this);
|
||||
wchar_t playerNameWChar[1024];
|
||||
mbstowcs_s(nullptr, playerNameWChar, playerName.C_String(), 1023);
|
||||
scene::IBillboardSceneNode *bb = sm->addBillboardTextSceneNode(0, playerNameWChar, model);
|
||||
bb->setSize(core::dimension2df(40,20));
|
||||
bb->setPosition(core::vector3df(0,model->getBoundingBox().MaxEdge.Y+bb->getBoundingBox().MaxEdge.Y-bb->getBoundingBox().MinEdge.Y+5.0f,0));
|
||||
bb->setColor(video::SColor(255,255,128,128), video::SColor(255,255,128,128));
|
||||
}
|
||||
void PlayerReplica::PreDestruction(SLNet::Connection_RM3 *sourceConnection)
|
||||
{
|
||||
// unused parameters
|
||||
(void)sourceConnection;
|
||||
|
||||
if (model)
|
||||
model->remove();
|
||||
}
|
||||
RM3SerializationResult PlayerReplica::Serialize(SLNet::SerializeParameters *serializeParameters)
|
||||
{
|
||||
BaseIrrlichtReplica::Serialize(serializeParameters);
|
||||
serializeParameters->outputBitstream[0].Write(position);
|
||||
serializeParameters->outputBitstream[0].Write(rotationAroundYAxis);
|
||||
serializeParameters->outputBitstream[0].Write(isMoving);
|
||||
serializeParameters->outputBitstream[0].Write(IsDead());
|
||||
return RM3SR_BROADCAST_IDENTICALLY;
|
||||
}
|
||||
void PlayerReplica::Deserialize(SLNet::DeserializeParameters *deserializeParameters)
|
||||
{
|
||||
BaseIrrlichtReplica::Deserialize(deserializeParameters);
|
||||
deserializeParameters->serializationBitstream[0].Read(position);
|
||||
deserializeParameters->serializationBitstream[0].Read(rotationAroundYAxis);
|
||||
deserializeParameters->serializationBitstream[0].Read(isMoving);
|
||||
bool wasDead=isDead;
|
||||
deserializeParameters->serializationBitstream[0].Read(isDead);
|
||||
if (isDead==true && wasDead==false)
|
||||
{
|
||||
demo->PlayDeathSound(position);
|
||||
}
|
||||
|
||||
core::vector3df positionOffset;
|
||||
positionOffset=position-model->getPosition();
|
||||
positionDeltaPerMS = positionOffset / INTERP_TIME_MS;
|
||||
float rotationOffset;
|
||||
rotationOffset=GetRotationDifference(rotationAroundYAxis,model->getRotation().Y);
|
||||
rotationDeltaPerMS = rotationOffset / INTERP_TIME_MS;
|
||||
interpEndTime = SLNet::GetTimeMS() + (SLNet::TimeMS) INTERP_TIME_MS;
|
||||
}
|
||||
void PlayerReplica::Update(SLNet::TimeMS curTime)
|
||||
{
|
||||
// Is a locally created object?
|
||||
if (creatingSystemGUID==rakPeer->GetGuidFromSystemAddress(SLNet::UNASSIGNED_SYSTEM_ADDRESS))
|
||||
{
|
||||
// Local player has no mesh to interpolate
|
||||
// Input our camera position as our player position
|
||||
playerReplica->position=demo->GetSceneManager()->getActiveCamera()->getPosition()-irr::core::vector3df(0,CAMERA_HEIGHT,0);
|
||||
playerReplica->rotationAroundYAxis=demo->GetSceneManager()->getActiveCamera()->getRotation().Y-90.0f;
|
||||
isMoving=demo->IsMovementKeyDown();
|
||||
|
||||
// Ack, makes the screen messed up and the mouse move off the window
|
||||
// Find another way to keep the dead player from moving
|
||||
// demo->EnableInput(IsDead()==false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Update interpolation
|
||||
SLNet::TimeMS elapsed = curTime-lastUpdate;
|
||||
if (elapsed<=1)
|
||||
return;
|
||||
if (elapsed>100)
|
||||
elapsed=100;
|
||||
|
||||
lastUpdate=curTime;
|
||||
irr::core::vector3df curPositionDelta = position-model->getPosition();
|
||||
irr::core::vector3df interpThisTick = positionDeltaPerMS*(float) elapsed;
|
||||
if (curTime < interpEndTime && interpThisTick.getLengthSQ() < curPositionDelta.getLengthSQ())
|
||||
{
|
||||
model->setPosition(model->getPosition()+positionDeltaPerMS*(float) elapsed);
|
||||
}
|
||||
else
|
||||
{
|
||||
model->setPosition(position);
|
||||
}
|
||||
|
||||
float curRotationDelta = GetRotationDifference(rotationAroundYAxis,model->getRotation().Y);
|
||||
float interpThisTickRotation = rotationDeltaPerMS*(float)elapsed;
|
||||
if (curTime < interpEndTime && fabs(interpThisTickRotation) < fabs(curRotationDelta))
|
||||
{
|
||||
model->setRotation(model->getRotation()+core::vector3df(0,interpThisTickRotation,0));
|
||||
}
|
||||
else
|
||||
{
|
||||
model->setRotation(core::vector3df(0,rotationAroundYAxis,0));
|
||||
}
|
||||
|
||||
if (isDead)
|
||||
{
|
||||
UpdateAnimation(scene::EMAT_DEATH_FALLBACK);
|
||||
model->setLoopMode(false);
|
||||
}
|
||||
else if (curAnim!=scene::EMAT_ATTACK)
|
||||
{
|
||||
if (isMoving)
|
||||
{
|
||||
UpdateAnimation(scene::EMAT_RUN);
|
||||
model->setLoopMode(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateAnimation(scene::EMAT_STAND);
|
||||
model->setLoopMode(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
void PlayerReplica::UpdateAnimation(irr::scene::EMD2_ANIMATION_TYPE anim)
|
||||
{
|
||||
if (anim!=curAnim)
|
||||
model->setMD2Animation(anim);
|
||||
curAnim=anim;
|
||||
}
|
||||
float PlayerReplica::GetRotationDifference(float r1, float r2)
|
||||
{
|
||||
float diff = r1-r2;
|
||||
while (diff>180.0f)
|
||||
diff-=360.0f;
|
||||
while (diff<-180.0f)
|
||||
diff+=360.0f;
|
||||
return diff;
|
||||
}
|
||||
void PlayerReplica::OnAnimationEnd(scene::IAnimatedMeshSceneNode* node)
|
||||
{
|
||||
// unused parameters
|
||||
(void)node;
|
||||
|
||||
if (curAnim==scene::EMAT_ATTACK)
|
||||
{
|
||||
if (isMoving)
|
||||
{
|
||||
UpdateAnimation(scene::EMAT_RUN);
|
||||
model->setLoopMode(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateAnimation(scene::EMAT_STAND);
|
||||
model->setLoopMode(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
void PlayerReplica::PlayAttackAnimation(void)
|
||||
{
|
||||
if (isDead==false)
|
||||
{
|
||||
UpdateAnimation(scene::EMAT_ATTACK);
|
||||
model->setLoopMode(false);
|
||||
}
|
||||
}
|
||||
bool PlayerReplica::IsDead(void) const
|
||||
{
|
||||
return deathTimeout > SLNet::GetTimeMS();
|
||||
}
|
||||
BallReplica::BallReplica()
|
||||
{
|
||||
creationTime= SLNet::GetTimeMS();
|
||||
}
|
||||
BallReplica::~BallReplica()
|
||||
{
|
||||
}
|
||||
void BallReplica::WriteAllocationID(SLNet::Connection_RM3 *destinationConnection, SLNet::BitStream *allocationIdBitstream) const
|
||||
{
|
||||
// unused parameters
|
||||
(void)destinationConnection;
|
||||
|
||||
allocationIdBitstream->Write(SLNet::RakString("BallReplica"));
|
||||
}
|
||||
void BallReplica::SerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
|
||||
{
|
||||
BaseIrrlichtReplica::SerializeConstruction(constructionBitstream, destinationConnection);
|
||||
constructionBitstream->Write(shotDirection);
|
||||
}
|
||||
bool BallReplica::DeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection)
|
||||
{
|
||||
if (!BaseIrrlichtReplica::DeserializeConstruction(constructionBitstream, sourceConnection))
|
||||
return false;
|
||||
constructionBitstream->Read(shotDirection);
|
||||
return true;
|
||||
}
|
||||
void BallReplica::PostDeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection)
|
||||
{
|
||||
// unused parameters
|
||||
(void)constructionBitstream;
|
||||
(void)destinationConnection;
|
||||
|
||||
// Shot visible effect and BallReplica classes are not linked, but they update the same way, such that
|
||||
// they are in the same spot all the time
|
||||
demo->shootFromOrigin(position, shotDirection);
|
||||
|
||||
// Find the owner of this ball, and make them play the attack animation
|
||||
unsigned int idx;
|
||||
for (idx=0; idx < PlayerReplica::playerList.Size(); idx++)
|
||||
{
|
||||
if (PlayerReplica::playerList[idx]->creatingSystemGUID==creatingSystemGUID)
|
||||
{
|
||||
PlayerReplica::playerList[idx]->PlayAttackAnimation();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void BallReplica::PreDestruction(SLNet::Connection_RM3 *sourceConnection)
|
||||
{
|
||||
// unused parameters
|
||||
(void)sourceConnection;
|
||||
|
||||
// The system that shot this ball destroyed it, or disconnected
|
||||
// Technically we should clear out the node visible effect too, but it's not important for now
|
||||
}
|
||||
RM3SerializationResult BallReplica::Serialize(SLNet::SerializeParameters *serializeParameters)
|
||||
{
|
||||
BaseIrrlichtReplica::Serialize(serializeParameters);
|
||||
return RM3SR_BROADCAST_IDENTICALLY;
|
||||
}
|
||||
void BallReplica::Deserialize(SLNet::DeserializeParameters *deserializeParameters)
|
||||
{
|
||||
BaseIrrlichtReplica::Deserialize(deserializeParameters);
|
||||
}
|
||||
void BallReplica::Update(SLNet::TimeMS curTime)
|
||||
{
|
||||
// Is a locally created object?
|
||||
if (creatingSystemGUID==rakPeer->GetGuidFromSystemAddress(SLNet::UNASSIGNED_SYSTEM_ADDRESS))
|
||||
{
|
||||
// Destroy if shot expired
|
||||
if (curTime > shotLifetime)
|
||||
{
|
||||
// Destroy on network
|
||||
BroadcastDestruction();
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Keep at the same position as the visible effect
|
||||
// Deterministic, so no need to actually transmit position
|
||||
// The variable position is the origin that the ball was created at. For the player, it is their actual position
|
||||
SLNet::TimeMS elapsedTime;
|
||||
// Due to ping variances and timestamp miscalculations, it's possible with very low pings to get a slightly negative time, so we have to check
|
||||
if (curTime>=creationTime)
|
||||
elapsedTime = curTime - creationTime;
|
||||
else
|
||||
elapsedTime=0;
|
||||
irr::core::vector3df updatedPosition = position + shotDirection * (float) elapsedTime * SHOT_SPEED;
|
||||
|
||||
// See if the bullet hit us
|
||||
if (creatingSystemGUID!=rakPeer->GetGuidFromSystemAddress(SLNet::UNASSIGNED_SYSTEM_ADDRESS))
|
||||
{
|
||||
if (playerReplica->IsDead()==false)
|
||||
{
|
||||
//float playerHalfHeight=demo->GetSyndeyBoundingBox().getExtent().Y/2;
|
||||
irr::core::vector3df positionRelativeToCharacter = updatedPosition-playerReplica->position;//+core::vector3df(0,playerHalfHeight,0);
|
||||
if (demo->GetSyndeyBoundingBox().isPointInside(positionRelativeToCharacter))
|
||||
//if ((playerReplica->position+core::vector3df(0,playerHalfHeight,0)-updatedPosition).getLengthSQ() < BALL_DIAMETER*BALL_DIAMETER/4.0f)
|
||||
{
|
||||
// We're dead for 3 seconds
|
||||
playerReplica->deathTimeout=curTime+3000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SLNet::Replica3 *Connection_RM3Irrlicht::AllocReplica(SLNet::BitStream *allocationId, ReplicaManager3 *replicaManager3)
|
||||
{
|
||||
// unused parameters
|
||||
(void)replicaManager3;
|
||||
|
||||
SLNet::RakString typeName; allocationId->Read(typeName);
|
||||
if (typeName=="PlayerReplica") {BaseIrrlichtReplica *r = new PlayerReplica; r->demo=demo; return r;}
|
||||
if (typeName=="BallReplica") {BaseIrrlichtReplica *r = new BallReplica; r->demo=demo; return r;}
|
||||
return 0;
|
||||
}
|
||||
231
DependentExtensions/IrrlichtDemo/slikenetstuff.h
Normal file
@ -0,0 +1,231 @@
|
||||
/*
|
||||
* Original work: Copyright (c) 2014, Oculus VR, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* RakNet License.txt file in the licenses directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the RakNet Patents.txt file in the same directory.
|
||||
*
|
||||
*
|
||||
* Modified work: Copyright (c) 2017-2019, SLikeSoft UG (haftungsbeschränkt)
|
||||
*
|
||||
* This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
|
||||
* license found in the license.txt file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// Most of SLikeNet stuff was tried to be put here, but some of it had to go to CDemo.h too
|
||||
|
||||
#ifndef __RAKNET_ADDITIONS_FOR_IRRLICHT_DEMO_H
|
||||
#define __RAKNET_ADDITIONS_FOR_IRRLICHT_DEMO_H
|
||||
|
||||
#include "slikenet/peerinterface.h"
|
||||
#include "slikenet/ReplicaManager3.h"
|
||||
#include "slikenet/NatPunchthroughClient.h"
|
||||
#include "slikenet/CloudClient.h"
|
||||
#include "slikenet/FullyConnectedMesh2.h"
|
||||
#include "slikenet/UDPProxyClient.h"
|
||||
#include "slikenet/TCPInterface.h"
|
||||
#include "slikenet/HTTPConnection.h"
|
||||
#include "../../Samples/PHPDirectoryServer2/PHPDirectoryServer2.h"
|
||||
#include "vector3d.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100) // unreferenced formal parameter
|
||||
#pragma warning(disable:4127) // conditional expression is constant
|
||||
#pragma warning(disable:4244) // type-conversion with possible loss of data
|
||||
#pragma warning(disable:4458) // declaration of 'identifier' hides class member
|
||||
#endif
|
||||
|
||||
#include "IAnimatedMeshSceneNode.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include "slikenet/MessageIdentifiers.h"
|
||||
|
||||
|
||||
class ReplicaManager3Irrlicht;
|
||||
class CDemo;
|
||||
class PlayerReplica;
|
||||
|
||||
// All externs defined in the corresponding CPP file
|
||||
// Most of these classes has a manual entry, all of them have a demo
|
||||
extern SLNet::RakPeerInterface *rakPeer; // Basic communication
|
||||
extern SLNet::NetworkIDManager *networkIDManager; // Unique IDs per network object
|
||||
extern ReplicaManager3Irrlicht *irrlichtReplicaManager3; // Autoreplicate network objects
|
||||
extern SLNet::NatPunchthroughClient *natPunchthroughClient; // Connect peer to peer through routers
|
||||
extern SLNet::CloudClient *cloudClient; // Used to upload game instance to the cloud
|
||||
extern SLNet::FullyConnectedMesh2 *fullyConnectedMesh2; // Used to find out who is the session host
|
||||
extern PlayerReplica *playerReplica; // Network object that represents the player
|
||||
|
||||
// A NAT punchthrough and proxy server Jenkins Software is hosting for free, should usually be online
|
||||
#define DEFAULT_NAT_PUNCHTHROUGH_FACILITATOR_PORT 61111
|
||||
#define DEFAULT_NAT_PUNCHTHROUGH_FACILITATOR_IP "natpunch.slikesoft.com"
|
||||
|
||||
void InstantiateRakNetClasses(void);
|
||||
void DeinitializeRakNetClasses(void);
|
||||
|
||||
// Base RakNet custom classes for Replica Manager 3, setup peer to peer networking
|
||||
class BaseIrrlichtReplica : public SLNet::Replica3
|
||||
{
|
||||
public:
|
||||
BaseIrrlichtReplica();
|
||||
virtual ~BaseIrrlichtReplica();
|
||||
virtual SLNet::RM3ConstructionState QueryConstruction(SLNet::Connection_RM3 *destinationConnection, SLNet::ReplicaManager3 *replicaManager3)
|
||||
{
|
||||
// unused parameters
|
||||
(void)replicaManager3;
|
||||
|
||||
return QueryConstruction_PeerToPeer(destinationConnection);
|
||||
}
|
||||
virtual bool QueryRemoteConstruction(SLNet::Connection_RM3 *sourceConnection)
|
||||
{
|
||||
return QueryRemoteConstruction_PeerToPeer(sourceConnection);
|
||||
}
|
||||
virtual void DeallocReplica(SLNet::Connection_RM3 *sourceConnection)
|
||||
{
|
||||
// unused parameters
|
||||
(void)sourceConnection;
|
||||
|
||||
delete this;
|
||||
}
|
||||
virtual SLNet::RM3QuerySerializationResult QuerySerialization(SLNet::Connection_RM3 *destinationConnection)
|
||||
{
|
||||
return QuerySerialization_PeerToPeer(destinationConnection);
|
||||
}
|
||||
virtual void SerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection);
|
||||
virtual bool DeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection);
|
||||
virtual SLNet::RM3SerializationResult Serialize(SLNet::SerializeParameters *serializeParameters);
|
||||
virtual void Deserialize(SLNet::DeserializeParameters *deserializeParameters);
|
||||
virtual void SerializeDestruction(SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *destinationConnection)
|
||||
{
|
||||
// unused parameters
|
||||
(void)destructionBitstream;
|
||||
(void)destinationConnection;
|
||||
}
|
||||
virtual bool DeserializeDestruction(SLNet::BitStream *destructionBitstream, SLNet::Connection_RM3 *sourceConnection)
|
||||
{
|
||||
// unused parameters
|
||||
(void)destructionBitstream;
|
||||
(void)sourceConnection;
|
||||
|
||||
return true;
|
||||
}
|
||||
virtual SLNet::RM3ActionOnPopConnection QueryActionOnPopConnection(SLNet::Connection_RM3 *droppedConnection) const
|
||||
{
|
||||
return QueryActionOnPopConnection_PeerToPeer(droppedConnection);
|
||||
}
|
||||
|
||||
/// This function is not derived from Replica3, it's specific to this app
|
||||
/// Called from CDemo::UpdateRakNet
|
||||
virtual void Update(SLNet::TimeMS curTime);
|
||||
|
||||
// Set when the object is constructed
|
||||
CDemo *demo;
|
||||
|
||||
// real is written on the owner peer, read on the remote peer
|
||||
irr::core::vector3df position;
|
||||
SLNet::TimeMS creationTime;
|
||||
};
|
||||
// Game classes automatically updated by ReplicaManager3
|
||||
class PlayerReplica : public BaseIrrlichtReplica, irr::scene::IAnimationEndCallBack
|
||||
{
|
||||
public:
|
||||
PlayerReplica();
|
||||
virtual ~PlayerReplica();
|
||||
// Every function below, before Update overriding a function in Replica3
|
||||
virtual void WriteAllocationID(SLNet::Connection_RM3 *destinationConnection, SLNet::BitStream *allocationIdBitstream) const;
|
||||
virtual void SerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection);
|
||||
virtual bool DeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection);
|
||||
virtual SLNet::RM3SerializationResult Serialize(SLNet::SerializeParameters *serializeParameters);
|
||||
virtual void Deserialize(SLNet::DeserializeParameters *deserializeParameters);
|
||||
virtual void PostDeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection);
|
||||
virtual void PreDestruction(SLNet::Connection_RM3 *sourceConnection);
|
||||
|
||||
virtual void Update(SLNet::TimeMS curTime);
|
||||
void UpdateAnimation(irr::scene::EMD2_ANIMATION_TYPE anim);
|
||||
float GetRotationDifference(float r1, float r2);
|
||||
virtual void OnAnimationEnd(irr::scene::IAnimatedMeshSceneNode* node);
|
||||
void PlayAttackAnimation(void);
|
||||
|
||||
// playerName is only sent in SerializeConstruction, since it doesn't change
|
||||
SLNet::RakString playerName;
|
||||
|
||||
// Networked rotation
|
||||
float rotationAroundYAxis;
|
||||
// Interpolation variables, not networked
|
||||
irr::core::vector3df positionDeltaPerMS;
|
||||
float rotationDeltaPerMS;
|
||||
SLNet::TimeMS interpEndTime, lastUpdate;
|
||||
|
||||
// Updated based on the keypresses, to control remote animation
|
||||
bool isMoving;
|
||||
|
||||
// Only instantiated for remote systems, you never see yourself
|
||||
irr::scene::IAnimatedMeshSceneNode* model;
|
||||
irr::scene::EMD2_ANIMATION_TYPE curAnim;
|
||||
|
||||
// deathTimeout is set from the local player
|
||||
SLNet::TimeMS deathTimeout;
|
||||
bool IsDead(void) const;
|
||||
// isDead is set from network packets for remote players
|
||||
bool isDead;
|
||||
|
||||
// List of all players, including our own
|
||||
static DataStructures::List<PlayerReplica*> playerList;
|
||||
};
|
||||
class BallReplica : public BaseIrrlichtReplica
|
||||
{
|
||||
public:
|
||||
BallReplica();
|
||||
virtual ~BallReplica();
|
||||
// Every function except update is overriding a function in Replica3
|
||||
virtual void WriteAllocationID(SLNet::Connection_RM3 *destinationConnection, SLNet::BitStream *allocationIdBitstream) const;
|
||||
virtual void SerializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection);
|
||||
virtual bool DeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *sourceConnection);
|
||||
virtual SLNet::RM3SerializationResult Serialize(SLNet::SerializeParameters *serializeParameters);
|
||||
virtual void Deserialize(SLNet::DeserializeParameters *deserializeParameters);
|
||||
virtual void PostDeserializeConstruction(SLNet::BitStream *constructionBitstream, SLNet::Connection_RM3 *destinationConnection);
|
||||
virtual void PreDestruction(SLNet::Connection_RM3 *sourceConnection);
|
||||
|
||||
virtual void Update(SLNet::TimeMS curTime);
|
||||
|
||||
// shotDirection is networked
|
||||
irr::core::vector3df shotDirection;
|
||||
|
||||
// shotlifetime is calculated, not networked
|
||||
SLNet::TimeMS shotLifetime;
|
||||
};
|
||||
class Connection_RM3Irrlicht : public SLNet::Connection_RM3 {
|
||||
public:
|
||||
Connection_RM3Irrlicht(const SLNet::SystemAddress &_systemAddress, SLNet::RakNetGUID _guid, CDemo *_demo) : SLNet::Connection_RM3(_systemAddress, _guid)
|
||||
{
|
||||
demo=_demo;
|
||||
}
|
||||
virtual ~Connection_RM3Irrlicht()
|
||||
{
|
||||
}
|
||||
|
||||
virtual SLNet::Replica3 *AllocReplica(SLNet::BitStream *allocationId, SLNet::ReplicaManager3 *replicaManager3);
|
||||
protected:
|
||||
CDemo *demo;
|
||||
};
|
||||
|
||||
class ReplicaManager3Irrlicht : public SLNet::ReplicaManager3
|
||||
{
|
||||
public:
|
||||
virtual SLNet::Connection_RM3* AllocConnection(const SLNet::SystemAddress &systemAddress, SLNet::RakNetGUID rakNetGUID) const
|
||||
{
|
||||
return new Connection_RM3Irrlicht(systemAddress,rakNetGUID,demo);
|
||||
}
|
||||
virtual void DeallocConnection(SLNet::Connection_RM3 *connection) const
|
||||
{
|
||||
delete connection;
|
||||
}
|
||||
CDemo *demo;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||