Very Odd Co-ord System

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Anteater

Very Odd Co-ord System

Post by Anteater »

I couldn't help but notice that Irrlicht uses a very strange coordinate system.
Because I have to half guess/half base remotely off of other stuff the placing of scene nodes, I was just wondering why Irr has such a strange usage of coordinates. Unless this is just a bug in my game (I make really stupid mistakes sometimes; so it probably is :oops: ) The camera position reads as things like "148687974,143925597,3053785" when DeleD would have it as "540,432,768." (That's just to get the idea, it isn't an actual example.) I even noticed that even at the start of the game when everything is 0,0,0, when the camera is moved just a tiny bit the x goes from 0 to some huge number. What's up with that?
Armen138
Posts: 298
Joined: Mon Feb 23, 2004 3:38 am

Post by Armen138 »

you are doing something very wrong... how about giving an actual example? and some code to go with it?
if you're looking for me, start looking on irc, i'm probably there.
Anteater

Post by Anteater »

The code: (to get the position of the camera, just stick "printf("%d",camera1->getPosition().X[or]Y[or]Z)",Then again, maybe using printf causes the prob I'm having. Darn! I hate being a NooB :cry: . Being a pro take time though...)

Code: Select all

//Eric the Anteater and the Elixer of Life (C) 2005 Decapitation Games.
#include <irrlicht.h>
#include <windows.h>
#include <math.h>
#include <mmsystem.h>
#include <stdio.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int resxset = 1024;
int resyset = 768;
int bitdepthset = 32;
int waitshoot = 0;
int ammo = 30;
int globalswitch = 0;
int lvlstrt = 0;
int timetoplay = 0;
int armpos = 0;
int waterlevel = 0;
int level1trigger = 0;
int cnt = 0;
int shoot = 0;
int fovint = 1;
int istime = 0;
int level = 0;
int endtimer = 0;
int energy = 0;
int fls = 0;
int timerelative = 0;
int timeseconds = 0;
bool dead = false;
bool drowned = false;
bool wonlevel = false;
bool playedgomus = false;
f32 deffov = 0;
IrrlichtDevice *deviceIrr = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(resxset, resyset), bitdepthset, true, true, true, 0);
IGUIEnvironment* guienv = deviceIrr->getGUIEnvironment();
IVideoDriver* driver = deviceIrr->getVideoDriver();
ISceneManager* smgr = deviceIrr->getSceneManager();
int main()
{
//some global/useful stuff is pre-loaded, such as the camera or gore
scene::ICameraSceneNode* camera1 =
smgr->addCameraSceneNodeFPS();
camera1->setFarValue(3500);
deffov = camera1->getFOV();
IAnimatedMesh* bodygore1 = smgr->getMesh("media/gore1.x");
IMetaTriangleSelector* worldselector = smgr->createMetaTriangleSelector();
//stuff is loaded
scene::IAnimatedMesh* level1mesh = smgr->getMesh("media/level1.x");
scene::ISceneNode* level1node = 0;
scene::ITriangleSelector* triselector1 = 0;
if (level1mesh)
{
level1node = smgr->addOctTreeSceneNode(level1mesh->getMesh(0));
level1node->setMaterialFlag(EMF_LIGHTING, true);
triselector1 = smgr->createOctTreeTriangleSelector(level1mesh->getMesh(0),level1node, 0);
level1node->setTriangleSelector(triselector1);
level1node->setVisible(true);
}
worldselector->addTriangleSelector(triselector1);
//level2
scene::IAnimatedMesh* level2mesh = smgr->getMesh("media/level2.x");
scene::ISceneNode* level2node = 0;
scene::ITriangleSelector* triselector2 = 0;
if (level2mesh)
{
level2node = smgr->addOctTreeSceneNode(level2mesh->getMesh(0));
level2node->setMaterialFlag(EMF_LIGHTING, true);
triselector2 = smgr->createOctTreeTriangleSelector(level2mesh->getMesh(0),level2node, 0);
level2node->setTriangleSelector(triselector2);
level2node->setPosition(vector3df(7675,-410,1150));
level2node->setVisible(true);
}
worldselector->addTriangleSelector(triselector2);
//on to better things...
scene::IAnimatedMesh* water1mesh = smgr->getMesh("media/water1.x");
scene::IAnimatedMesh* gallore1mesh = smgr->getMesh("media/good1.x");
scene::ISceneNode* gallore1node = 0;
scene::ITriangleSelector* triselector3 = 0;
if (gallore1mesh)
{
gallore1node = smgr->addOctTreeSceneNode(gallore1mesh->getMesh(0));
gallore1node->setMaterialFlag(EMF_LIGHTING, true);
triselector3 = smgr->createOctTreeTriangleSelector(gallore1mesh->getMesh(0),gallore1node, 0);
gallore1node->setTriangleSelector(triselector3);
gallore1node->setPosition(vector3df(7675,-385,1150));
}
worldselector->addTriangleSelector(triselector3);
scene::IAnimatedMesh* gun1mesh = smgr->getMesh("media/gun1.x");
scene::IAnimatedMeshSceneNode* gun1node = 0;
if (gun1mesh)
{
gun1node = smgr->addAnimatedMeshSceneNode(gun1mesh);
gun1node->setMaterialFlag(EMF_LIGHTING, true);
}
scene::IAnimatedMesh* obj1mesh = smgr->getMesh("media/obj1.x");
scene::IAnimatedMeshSceneNode* obj1node = 0;
if (obj1mesh)
{
obj1node = smgr->addAnimatedMeshSceneNode(obj1mesh);
obj1node->setMaterialFlag(EMF_LIGHTING, false);
obj1node->setVisible(true);
obj1node->setPosition(vector3df(92,-92,992));
}
scene::IAnimatedMesh* hand1mesh = smgr->getMesh("media/hand1.x");
scene::ISceneNode* hand1node = 0;
if (hand1mesh)
{
hand1node = smgr->addOctTreeSceneNode(hand1mesh->getMesh(0));
hand1node->setMaterialFlag(EMF_LIGHTING, true);
}
scene::IAnimatedMesh* bad1mesh = smgr->getMesh("media/bad1.x");
scene::ISceneNode* bad11node = 0;
scene::ISceneNode* bad12node = 0;
scene::ISceneNode* bad13node = 0;
scene::ISceneNode* bad14node = 0;
if (bad1mesh)
{
bad11node = smgr->addOctTreeSceneNode(bad1mesh);
bad11node->setPosition(vector3df(1370,0,2000));
bad11node->setMaterialFlag(EMF_LIGHTING, true);
bad12node = smgr->addOctTreeSceneNode(bad1mesh);
bad12node->setPosition(vector3df(1354,0,6000));
bad12node->setMaterialFlag(EMF_LIGHTING, true);
bad13node = smgr->addOctTreeSceneNode(bad1mesh);
bad13node->setPosition(vector3df(1370,0,-1000));
bad13node->setMaterialFlag(EMF_LIGHTING, true);
bad14node = smgr->addOctTreeSceneNode(bad1mesh);
bad14node->setPosition(vector3df(7500,-200,1150));
bad14node->setMaterialFlag(EMF_LIGHTING, true);
}
gun1node->addChild(hand1node);
IGUIFont* font11 = deviceIrr->getGUIEnvironment()->getFont("media/font1.bmp");
IGUIFont* font12 = deviceIrr->getGUIEnvironment()->getFont("media/font2.bmp");
gun1node->setVisible(false);
smgr->setActiveCamera(0);
ISceneNode* water1node = smgr->addWaterSurfaceSceneNode(water1mesh->getMesh(0),3.5f,600.0f,50.0f,NULL,501,vector3df(0,waterlevel,600));
water1node->setVisible(false);
water1node->setMaterialType(EMT_REFLECTION_2_LAYER);
//textures that are not part of 3d .x fromat files are loaded
video:: ITexture* mylogo1 = driver->getTexture("media/jpeg1.JPG");
//some textures are bmp/jpg based on: if they are flat rgb colors (bmp), very important (bmp), simple textures (jpg), used to show end-of-level stuff (jpg)
video:: ITexture* drownedlogo1 = driver->getTexture("media/drowned.jpg");
video:: ITexture* diedlogo1 = driver->getTexture("media/died.jpg");
video:: ITexture* splash1 = driver->getTexture("media/splash.jpg");
//i own the copyright, and i'm showing it :)
printf("My undisclosed game title (C) 2005 Decapitation Games\n");
mciSendString("play media/mid1.mid",NULL,0,NULL);
deviceIrr->setWindowCaption(L"Game Title");
//ahhh, yes, the event receiver
class EventRGUI1 : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
switch (event.GUIEvent.EventType)
{
case EGET_BUTTON_CLICKED:
if (id == 105)
{
if (globalswitch == 0)
{
FILE* savefile = fopen("../title3.esf","r+");
fclose(savefile);
}
}
if (id == 104)
{
if (globalswitch == 0)
{
mciSendString("stop media/mid1.mid",NULL,0,NULL);
IGUIWindow *window1 = guienv->addWindow(rect<s32>(cnt+0,cnt+0,cnt+400,cnt+400),false,L"HELP");
guienv->addStaticText(L"W/A/S/D = MOVE\nMOUSE 1 = SHOOT\nMOUSE 2/MOUSE 3 = TIME CONTROL\nR = RELOAD",rect<s32>(20,25,300,300),1,1,window1);
}
}
if (id == 103)
{
if (globalswitch == 0)
{
IGUIWindow *window1 = guienv->addWindow(rect<s32>(cnt+0,cnt+0,cnt+400,cnt+400),false,L"ABOUT");
guienv->addStaticText(L"title\n\nThis software is based in part on the work of the Independent JPEG Group.\n\nProgrammer........name\nGame Engine.......Nikolaus Gebhardt\nSpecial Thanks....Guest\nSpecial Thanks....Fraza\nSpecial Thanks....Sarin\nSpecial Thanks....The Delgine Team\nSpecial Thanks....MikeR\nSpecial Thanks....Jox",rect<s32>(20,25,300,300),1,1,window1);
}
}
//the buttons have to go away now...
if (id == 102)
{
if (globalswitch == 0)
{
IGUIElement* root1 = guienv->getRootGUIElement();
IGUIElement* btd1 = root1->getElementFromId(102,true);
btd1->remove();
IGUIElement* root2 = guienv->getRootGUIElement();
IGUIElement* btd2 = root1->getElementFromId(101,true);
btd2->remove();
IGUIElement* root3 = guienv->getRootGUIElement();
IGUIElement* btd3 = root3->getElementFromId(103,true);
btd3->remove();
IGUIElement* root4 = guienv->getRootGUIElement();
IGUIElement* btd4 = root4->getElementFromId(104,true);
btd4->remove();
IGUIElement* root5 = guienv->getRootGUIElement();
IGUIElement* btd5 = root5->getElementFromId(105,true);
btd5->remove();
mciSendString("stop media/mid1.mid",NULL,0,NULL);
timetoplay = 0;
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
globalswitch = 1;
}
}
//turn off the game? please don't! oh, well
if (id == 101)
{
if (globalswitch == 0)
{
deviceIrr->closeDevice();
return true;
}
}
break;
}
}
if (globalswitch > 0)
{
if (event.EventType == EET_MOUSE_INPUT_EVENT)
{
if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
{
if (ammo > 0)
{
if (waitshoot > 0)
{
if (dead == false && drowned == false && wonlevel == false)
{
shoot = 1;
mciSendString("play media/gun1snd.wav",NULL,0,NULL);
ammo = ammo - 1;
waitshoot = -20;
}
}
}
}
if (event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN && energy > 0 && dead == false)
{
istime = 1;
mciSendString("play media/scream1snd.wav",NULL,0,NULL);
}
if (event.MouseInput.Event == EMIE_MMOUSE_PRESSED_DOWN && dead == false && istime == 1)
{
istime = 0;
mciSendString("stop media/scream1snd.wav",NULL,0,NULL);
mciSendString("play media/relax1snd.wav",NULL,0,NULL);
}
}
}
if (event.EventType == EET_KEY_INPUT_EVENT)
{
if (globalswitch > 0)
{
if (event.KeyInput.Key == KEY_KEY_R)
{
ammo = 0;
}
}
if (event.KeyInput.Key == KEY_ESCAPE)
{
deviceIrr->closeDevice();
return true;
}
if (event.KeyInput.Key == KEY_SPACE)
{
mciSendString("play media/taunt1snd.wav",NULL,0,NULL);
}
}
return false;
}
};
EventRGUI1 receiver1;
deviceIrr->setEventReceiver(&receiver1);
ISceneNode* targeted = 0;
//as long as the darn thing is running...
while(deviceIrr->run())
{
driver->beginScene(true, true, SColor(0,0,0,0));
//when the first level starts
if (globalswitch == 1)
{
if (lvlstrt == 0)
{
deviceIrr->getCursorControl()->setVisible(false);
IParticleSystemSceneNode* fire1 = smgr->addParticleSystemSceneNode(false,NULL,401,vector3df(2,175,-65),vector3df(0,0,0),vector3df(0.1,0.1,0.1));
fire1->setParticleSize(dimension2d<f32>(1,1));
fire1->setMaterialFlag(EMF_LIGHTING, false);
fire1->setMaterialTexture (0,driver->getTexture("media/part/part1.bmp"));
fire1->setMaterialType (video::EMT_TRANSPARENT_ADD_COLOR);
scene::IParticleEmitter* efire1 = fire1->createPointEmitter(core::vector3df(0,-0.2,0),5,18,video::SColor(0,255,255,255),video::SColor(0,255,0,0),200,400,22);
fire1->setEmitter(efire1);
efire1->drop();
waterlevel = -135;
smgr->addLightSceneNode(NULL,core::vector3df(0,170,0),video::SColor(1,255,255,255),2056,301);
smgr->addLightSceneNode(NULL,core::vector3df(2500,-448,-572),video::SColor(1,255,255,255),2056,302);
smgr->addLightSceneNode(NULL,core::vector3df(8000,50,1150),video::SColor(1,255,255,255),2056,303);
smgr->setActiveCamera(camera1);
camera1->addChild(gun1node);
scene::ISceneNodeAnimator* camanim = smgr->createCollisionResponseAnimator(
worldselector, camera1, core::vector3df(45,60,45),
core::vector3df(0,-10,0),core::vector3df(0,60,0));
camera1->addAnimator(camanim);
gun1node->setVisible(true);
water1node->setVisible(true);
water1node->setScale(vector3df(2,1,2));
ISceneNodeAnimator* obj1anim = smgr->createRotationAnimator(vector3df(0.5,0.5,0.5));
obj1node->addAnimator(obj1anim);
energy = 3600;
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
ISceneNode* skybox1 = smgr->addSkyBoxSceneNode(driver->getTexture("media/skybox2.bmp"),driver->getTexture("media/skybox3.bmp"),driver->getTexture("media/skybox1.bmp"),driver->getTexture("media/skybox1.bmp"),driver->getTexture("media/skybox1.bmp"),driver->getTexture("media/skybox1.bmp"));
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
lvlstrt = 1;
}
}
if (globalswitch > 0)
{
timetoplay = timetoplay + 1;
waitshoot = waitshoot + 1;
water1node->setPosition(vector3df(0,waterlevel,1000));
if (deviceIrr->getCursorControl()->getPosition().X < 512){gun1node->setRotation(vector3df(gun1node->getRotation().X,gun1node->getRotation().Y,gun1node->getRotation().Z+0.15f));}
if (deviceIrr->getCursorControl()->getPosition().X > 512){gun1node->setRotation(vector3df(gun1node->getRotation().X,gun1node->getRotation().Y,gun1node->getRotation().Z-0.15f));}
if (gun1node->getRotation().Z < -5){gun1node->setRotation(vector3df(gun1node->getRotation().X,gun1node->getRotation().Y,-5));}
if (gun1node->getRotation().Z > 5){gun1node->setRotation(vector3df(gun1node->getRotation().X,gun1node->getRotation().Y,5));}
if (armpos < 0){armpos = armpos + 1;}
if (istime == 1){camera1->setFOV(fovint*0.005);level1node->setMaterialType(EMT_REFLECTION_2_LAYER);level2node->setMaterialType(EMT_REFLECTION_2_LAYER);fovint = fovint + 1;energy = energy - 1;}
if (istime == 0){camera1->setFOV(deffov);level1node->setMaterialType(EMT_SOLID);level2node->setMaterialType(EMT_SOLID);fovint = 0;}
if (energy == 0){istime = 0;}
if (camera1->getPosition().Y<waterlevel-10){drowned = true;}
if (level1trigger == 1){waterlevel = waterlevel - 1;}
//story progress
if (fabs(camera1->getPosition().X - bad11node->getPosition().X) < 100 && fabs(camera1->getPosition().Y - bad11node->getPosition().Y) < 100 && fabs(camera1->getPosition().Z - bad11node->getPosition().Z) < 100){dead = true;}
if (fabs(camera1->getPosition().X - bad12node->getPosition().X) < 100 && fabs(camera1->getPosition().Y - bad12node->getPosition().Y) < 100 && fabs(camera1->getPosition().Z - bad12node->getPosition().Z) < 100){dead = true;}
if (fabs(camera1->getPosition().X - bad13node->getPosition().X) < 100 && fabs(camera1->getPosition().Y - bad13node->getPosition().Y) < 100 && fabs(camera1->getPosition().Z - bad13node->getPosition().Z) < 100){dead = true;}
if (fabs(camera1->getPosition().X - bad14node->getPosition().X) < 100 && fabs(camera1->getPosition().Y - bad14node->getPosition().Y) < 100 && fabs(camera1->getPosition().Z - bad14node->getPosition().Z) < 100){dead = true;}
bad11node->removeAnimators();
bad12node->removeAnimators();
bad13node->removeAnimators();
bad14node->removeAnimators();
if (istime == 0)
{
if (fabs(camera1->getPosition().X - bad11node->getPosition().X) < 3000 && fabs(camera1->getPosition().Y - bad11node->getPosition().Y) < 3000 && fabs(camera1->getPosition().Z - bad11node->getPosition().Z) < 3000)
{
ISceneNodeAnimator* bad11attack = smgr->createFlyStraightAnimator(bad11node->getPosition(),camera1->getPosition(), 250, false);
bad11node->addAnimator(bad11attack);
bad11node->setRotation(bad11node->getRotation()+vector3df(rand()%6,rand()%3,rand()%2));
}
if (fabs(camera1->getPosition().X - bad12node->getPosition().X) < 3000 && fabs(camera1->getPosition().Y - bad12node->getPosition().Y) < 3000 && fabs(camera1->getPosition().Z - bad12node->getPosition().Z) < 3000)
{
ISceneNodeAnimator* bad12attack = smgr->createFlyStraightAnimator(bad12node->getPosition(),camera1->getPosition(), 150, false);
bad12node->addAnimator(bad12attack);
bad12node->setRotation(bad12node->getRotation()+vector3df(rand()%8,rand()%5,rand()%7));
}
if (fabs(camera1->getPosition().X - bad13node->getPosition().X) < 3000 && fabs(camera1->getPosition().Y - bad13node->getPosition().Y) < 3000 && fabs(camera1->getPosition().Z - bad13node->getPosition().Z) < 3000)
{
ISceneNodeAnimator* bad13attack = smgr->createFlyStraightAnimator(bad13node->getPosition(),camera1->getPosition(), 350, false);
bad13node->addAnimator(bad13attack);
bad13node->setRotation(bad13node->getRotation()+vector3df(rand()%2,rand()%4,rand()%6));
}
if (fabs(camera1->getPosition().X - bad14node->getPosition().X) < 3000 && fabs(camera1->getPosition().Y - bad14node->getPosition().Y) < 3000 && fabs(camera1->getPosition().Z - bad14node->getPosition().Z) < 3000)
{
ISceneNodeAnimator* bad14attack = smgr->createFlyStraightAnimator(bad14node->getPosition(),camera1->getPosition(), 2000, false);
bad14node->addAnimator(bad14attack);
bad14node->setRotation(bad14node->getRotation()+vector3df(rand()%1,rand()%2,rand()%3));
}
}
//baddie11animator
scene::ISceneNodeAnimator* bad11anim = smgr->createCollisionResponseAnimator(
worldselector, bad11node, core::vector3df(60,60,60),
vector3df(0,0,0),core::vector3df(0,0,0));
bad11node->addAnimator(bad11anim);
//baddie12animator
scene::ISceneNodeAnimator* bad12anim = smgr->createCollisionResponseAnimator(
worldselector, bad12node, core::vector3df(60,60,60),
vector3df(0,0,0),core::vector3df(0,0,0));
bad12node->addAnimator(bad12anim);
//baddie13animator
scene::ISceneNodeAnimator* bad13anim = smgr->createCollisionResponseAnimator(
worldselector, bad13node, core::vector3df(60,60,60),
vector3df(0,0,0),core::vector3df(0,0,0));
bad13node->addAnimator(bad13anim);
//baddie14animator
scene::ISceneNodeAnimator* bad14anim = smgr->createCollisionResponseAnimator(
worldselector, bad14node, core::vector3df(60,60,60),
vector3df(0,0,0),core::vector3df(0,0,0));
bad14node->addAnimator(bad14anim);
//camera1line for test of level has been hit
vector3df campos = camera1->getPosition();
vector3df camtar = (camera1->getTarget() - campos);
line3d<f32> lwb11(campos, bad11node->getPosition());
line3d<f32> lwb12(campos, bad12node->getPosition());
line3d<f32> lwb13(campos, bad13node->getPosition());
line3d<f32> lwb14(campos, bad14node->getPosition());
line3d<f32> lwob1(campos, obj1node->getPosition());
triangle3df nexttri;
//who is eric about to shoot?
targeted = smgr->getSceneCollisionManager()->getSceneNodeFromCameraBB(camera1);
//is baddie11 hit?
if (targeted && targeted == bad11node && !smgr->getSceneCollisionManager()->getCollisionPoint(lwb11,worldselector,camtar,nexttri))
{
if (shoot == 1)
{
//this is for every baddie, but only the first is commented. first, blood goes everywhere
IParticleSystemSceneNode* dead11 = smgr->addParticleSystemSceneNode(false,NULL,402,bad11node->getPosition(),vector3df(0,0,0),vector3df(0.6f,0.6f,0.6f));
dead11->setParticleSize(dimension2d<f32>(6,6));
dead11->setMaterialFlag(EMF_LIGHTING, false);
dead11->setMaterialTexture (0,driver->getTexture("media/part/part2.bmp"));
dead11->setMaterialType (video::EMT_TRANSPARENT_ADD_COLOR);
scene::IParticleEmitter* edead11 = dead11->createBoxEmitter(core::aabbox3d<f32>(10.0f,-10.0f,20.0f,-20.0f,30.0f,-30.0f),core::vector3df(-0.2,-0.2,-0.2),2000,3000,video::SColor(0,255,255,255),video::SColor(0,255,255,255),375,750,360);
dead11->setEmitter(edead11);
edead11->drop();
ISceneNodeAnimator* partanim11 = smgr->createDeleteAnimator(1000);
dead11->addAnimator(partanim11);
//then, gore loses the election --errr-- goes everywhere
IParticleSystemSceneNode* gore11 = smgr->addParticleSystemSceneNode(false,NULL,403,bad11node->getPosition(),vector3df(0,0,0),vector3df(0.6f,0.6f,0.6f));
gore11->setParticleSize(dimension2d<f32>(8,8));
gore11->setMaterialFlag(EMF_LIGHTING, false);
gore11->setMaterialTexture (0,driver->getTexture("media/part/part3.bmp"));
gore11->setMaterialType (video::EMT_TRANSPARENT_ADD_COLOR);
scene::IParticleEmitter* egore11 = gore11->createBoxEmitter(core::aabbox3d<f32>(10.0f,-10.0f,20.0f,-20.0f,30.0f,-30.0f),core::vector3df(-0.2,-0.2,-0.2),5000,6000,video::SColor(0,255,255,255),video::SColor(0,0,0,255),250,500,360);
gore11->setEmitter(egore11);
egore11->drop();
ISceneNodeAnimator* goreanim11 = smgr->createDeleteAnimator(1000);
gore11->addAnimator(goreanim11);
ISceneNode* bodygore11 = smgr->addOctTreeSceneNode(bodygore1);
bodygore11->setPosition(bad11node->getPosition());
ISceneNodeAnimator* goremove11 = smgr->createFlyStraightAnimator(bad11node->getPosition(),bad11node->getPosition()+vector3df(0,400,0),1000);
bodygore11->addAnimator(goremove11);
bodygore11->addAnimator(goreanim11);
//then he stops, and goes to the "hell zone," that is, -999999999 on x, y, and z. the hell zone is used for blowing up anything.
mciSendString("play media/demondiesnd.wav",NULL,0,NULL);
mciSendString("play media/demonhitsnd.wav",NULL,0,NULL);
bad11node->removeAnimators();
bad11node->setPosition(vector3df(-999999999,-999999999,-999999999));
bad11node->setVisible(false);
}
}
//is baddie12?
if (targeted && targeted == bad12node && !smgr->getSceneCollisionManager()->getCollisionPoint(lwb12,worldselector,camtar,nexttri))
{
if (shoot == 1)
{
IParticleSystemSceneNode* dead12 = smgr->addParticleSystemSceneNode(false,NULL,404,bad12node->getPosition(),vector3df(0,0,0),vector3df(0.6f,0.6f,0.6f));
dead12->setParticleSize(dimension2d<f32>(7,7));
dead12->setMaterialFlag(EMF_LIGHTING, false);
dead12->setMaterialTexture (0,driver->getTexture("media/part/part2.bmp"));
dead12->setMaterialType (video::EMT_TRANSPARENT_ADD_COLOR);
scene::IParticleEmitter* edead12 = dead12->createBoxEmitter(core::aabbox3d<f32>(10.0f,-10.0f,20.0f,-20.0f,30.0f,-30.0f),core::vector3df(-0.2,-0.2,-0.2),2000,3000,video::SColor(0,255,255,255),video::SColor(0,255,0,0),375,750,360);
dead12->setEmitter(edead12);
edead12->drop();
ISceneNodeAnimator* partanim12 = smgr->createDeleteAnimator(900);
dead12->addAnimator(partanim12);
IParticleSystemSceneNode* gore12 = smgr->addParticleSystemSceneNode(false,NULL,405,bad12node->getPosition(),vector3df(0,0,0),vector3df(0.6f,0.6f,0.6f));
gore12->setParticleSize(dimension2d<f32>(10,10));
gore12->setMaterialFlag(EMF_LIGHTING, false);
gore12->setMaterialTexture (0,driver->getTexture("media/part/part3.bmp"));
gore12->setMaterialType (video::EMT_TRANSPARENT_ADD_COLOR);
scene::IParticleEmitter* egore12 = gore12->createBoxEmitter(core::aabbox3d<f32>(10.0f,-10.0f,20.0f,-20.0f,30.0f,-30.0f),core::vector3df(-0.2,-0.2,-0.2),5000,6000,video::SColor(0,255,255,255),video::SColor(0,0,0,255),250,500,360);
gore12->setEmitter(egore12);
egore12->drop();
ISceneNodeAnimator* goreanim12 = smgr->createDeleteAnimator(1000);
gore12->addAnimator(goreanim12);
ISceneNode* bodygore12 = smgr->addOctTreeSceneNode(bodygore1);
bodygore12->setPosition(bad12node->getPosition());
ISceneNodeAnimator* goremove12 = smgr->createFlyStraightAnimator(bad12node->getPosition(),bad12node->getPosition()+vector3df(0,400,0),1000);
bodygore12->addAnimator(goremove12);
bodygore12->addAnimator(goreanim12);
mciSendString("play media/demondiesnd.wav",NULL,0,NULL);
mciSendString("play media/demonhitsnd.wav",NULL,0,NULL);
bad12node->removeAnimators();
bad12node->setPosition(vector3df(-999999999,-999999999,-999999999));
bad12node->setVisible(false);
}
}
//is baddie13?
if (targeted && targeted == bad13node && !smgr->getSceneCollisionManager()->getCollisionPoint(lwb13,worldselector,camtar,nexttri))
{
if (shoot == 1)
{
IParticleSystemSceneNode* dead13 = smgr->addParticleSystemSceneNode(false,NULL,406,bad13node->getPosition(),vector3df(0,0,0),vector3df(0.6f,0.6f,0.6f));
dead13->setParticleSize(dimension2d<f32>(7,7));
dead13->setMaterialFlag(EMF_LIGHTING, false);
dead13->setMaterialTexture (0,driver->getTexture("media/part/part2.bmp"));
dead13->setMaterialType (video::EMT_TRANSPARENT_ADD_COLOR);
scene::IParticleEmitter* edead13 = dead13->createBoxEmitter(core::aabbox3d<f32>(10.0f,-10.0f,20.0f,-20.0f,30.0f,-30.0f),core::vector3df(-0.2,-0.2,-0.2),2000,3000,video::SColor(0,255,255,255),video::SColor(0,255,0,0),375,750,360);
dead13->setEmitter(edead13);
edead13->drop();
ISceneNodeAnimator* partanim13 = smgr->createDeleteAnimator(900);
dead13->addAnimator(partanim13);
IParticleSystemSceneNode* gore13 = smgr->addParticleSystemSceneNode(false,NULL,407,bad13node->getPosition(),vector3df(0,0,0),vector3df(0.6f,0.6f,0.6f));
gore13->setParticleSize(dimension2d<f32>(10,10));
gore13->setMaterialFlag(EMF_LIGHTING, false);
gore13->setMaterialTexture (0,driver->getTexture("media/part/part3.bmp"));
gore13->setMaterialType (video::EMT_TRANSPARENT_ADD_COLOR);
scene::IParticleEmitter* egore13 = gore13->createBoxEmitter(core::aabbox3d<f32>(10.0f,-10.0f,20.0f,-20.0f,30.0f,-30.0f),core::vector3df(-0.2,-0.2,-0.2),5000,6000,video::SColor(0,255,255,255),video::SColor(0,0,0,255),250,500,360);
gore13->setEmitter(egore13);
egore13->drop();
ISceneNodeAnimator* goreanim13 = smgr->createDeleteAnimator(1000);
gore13->addAnimator(goreanim13);
ISceneNode* bodygore13 = smgr->addOctTreeSceneNode(bodygore1);
bodygore13->setPosition(bad13node->getPosition());
ISceneNodeAnimator* goremove13 = smgr->createFlyStraightAnimator(bad13node->getPosition(),bad13node->getPosition()+vector3df(0,400,0),1000);
bodygore13->addAnimator(goremove13);
bodygore13->addAnimator(goreanim13);
mciSendString("play media/demondiesnd.wav",NULL,0,NULL);
mciSendString("play media/demonhitsnd.wav",NULL,0,NULL);
bad13node->removeAnimators();
bad13node->setPosition(vector3df(-999999999,-999999999,-999999999));
bad13node->setVisible(false);
}
}
if (targeted && targeted == bad14node && !smgr->getSceneCollisionManager()->getCollisionPoint(lwb14,worldselector,camtar,nexttri))
{
if (shoot == 1)
{
IParticleSystemSceneNode* dead14 = smgr->addParticleSystemSceneNode(false,NULL,408,bad14node->getPosition(),vector3df(0,0,0),vector3df(0.6f,0.6f,0.6f));
dead14->setParticleSize(dimension2d<f32>(6,6));
dead14->setMaterialFlag(EMF_LIGHTING, false);
dead14->setMaterialTexture (0,driver->getTexture("media/part/part2.bmp"));
dead14->setMaterialType (video::EMT_TRANSPARENT_ADD_COLOR);
scene::IParticleEmitter* edead14 = dead14->createBoxEmitter(core::aabbox3d<f32>(10.0f,-10.0f,20.0f,-20.0f,30.0f,-30.0f),core::vector3df(-0.2,-0.2,-0.2),2000,3000,video::SColor(0,255,255,255),video::SColor(0,255,255,255),375,750,360);
dead14->setEmitter(edead14);
edead14->drop();
ISceneNodeAnimator* partanim14 = smgr->createDeleteAnimator(1000);
dead14->addAnimator(partanim14);
IParticleSystemSceneNode* gore14 = smgr->addParticleSystemSceneNode(false,NULL,409,bad14node->getPosition(),vector3df(0,0,0),vector3df(0.6f,0.6f,0.6f));
gore14->setParticleSize(dimension2d<f32>(8,8));
gore14->setMaterialFlag(EMF_LIGHTING, false);
gore14->setMaterialTexture (0,driver->getTexture("media/part/part3.bmp"));
gore14->setMaterialType (video::EMT_TRANSPARENT_ADD_COLOR);
scene::IParticleEmitter* egore14 = gore14->createBoxEmitter(core::aabbox3d<f32>(10.0f,-10.0f,20.0f,-20.0f,30.0f,-30.0f),core::vector3df(-0.2,-0.2,-0.2),5000,6000,video::SColor(0,255,255,255),video::SColor(0,0,0,255),250,500,360);
gore14->setEmitter(egore14);
egore14->drop();
ISceneNodeAnimator* goreanim14 = smgr->createDeleteAnimator(1000);
gore14->addAnimator(goreanim14);
ISceneNode* bodygore14 = smgr->addOctTreeSceneNode(bodygore1);
bodygore14->setPosition(bad14node->getPosition());
ISceneNodeAnimator* goremove14 = smgr->createFlyStraightAnimator(bad14node->getPosition(),bad14node->getPosition()+vector3df(0,400,0),1000);
bodygore14->addAnimator(goremove14);
bodygore14->addAnimator(goreanim14);
//then he stops, and goes to the "hell zone," that is, -999999999 on x, y, and z. the hell zone is used for blowing up anything.
mciSendString("play media/demondiesnd.wav",NULL,0,NULL);
mciSendString("play media/demonhitsnd.wav",NULL,0,NULL);
bad14node->removeAnimators();
bad14node->setPosition(vector3df(-999999999,-999999999,-999999999));
bad14node->setVisible(false);
}
}
//is the objective?
if (targeted && targeted == obj1node && !smgr->getSceneCollisionManager()->getCollisionPoint(lwob1,worldselector,camtar,nexttri))
{
if (shoot == 1)
{
level1trigger = 1;
obj1node->setVisible (false);
mciSendString("play media/hitobjsnd.wav",NULL,0,NULL);
}
}
}
//gun-related
if (dead == false && drowned == false && wonlevel == false)
{
hand1node->setPosition(vector3df(0,armpos,0));
if (waitshoot < 0 && waitshoot > - 20)
{
gun1node->setRotation(vector3df(waitshoot*0.3,0,0));
}
if (waitshoot < -20)
{
gun1node->setRotation(vector3df((waitshoot-(waitshoot+20))*0.3,0,0));
}
if (ammo == 0)
{
ammo = 30;  
waitshoot = -160;
mciSendString ("play media/reload1snd.wav", NULL, 0, NULL);
armpos = -80;
}
}
//music
if (timetoplay == 1)
{
mciSendString("play media/mid2.mid",NULL,0,NULL);
}
if (globalswitch == 0)
{
driver->draw2DImage(ericlogo1, core::position2d<s32>(0,0),
core::rect<s32>(0, 0, 1024, 768), 0,
video::SColor(1, 255, 255, 255), true);
}
smgr->drawAll();
guienv->drawAll();
//other stuff
if (globalswitch == 0)
{
if (fls == 0)
{//buttons are used
guienv->addButton (rect<s32>(5,150,105,250),0,104,L"HELP");
guienv->addButton (rect<s32>(150,5,250,105),0,101,L"QUIT");
guienv->addButton (rect<s32>(5,5,105,105),0,102,L"START");
guienv->addButton (rect<s32>(150,150,250,250),0,103,L"ABOUT");
guienv->addButton (rect<s32>(920,664,1020,764),0,105,L"LOAD");
fls = 1;
}
font12->draw(L"Developed by Decapitation Games",rect<s32>(320,0,1024,768),SColor(0,255,0,0));
}
if (globalswitch == 1)
{
stringw hud = L"Ammo in clip: ";
hud+= ammo;
hud+= "     T.F. energy: ";
hud+= energy;
font12->draw(hud.c_str(),rect<s32>(0,0,1024,768),SColor(0,0,255,0));
//drawing stuff
if (dead == true)
{
//we need sad music! come on, preople
if (playedgomus == false)
{
mciSendString("stop media/mid2.mid",NULL,0,NULL);
mciSendString("play media/mid0.mid",NULL,0,NULL);
playedgomus = true;
}
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
driver->draw2DImage(diedlogo1, core::position2d<s32>(0,0),
core::rect<s32>(0, 0, 1024, 768), 0,
video::SColor(1, 255, 255, 255), true);
font11->draw(L"Eric was killed. Press <ESC>.",rect<s32>(320,240,1024,768),SColor(0,255,0,0));
camera1->removeAnimators();
//for complex reasons, the cam is sent to a location that is half holy zone, half hell zone
camera1->setPosition(vector3df(-999999999,999999999,999999999));
smgr->setActiveCamera(0);
}
if (drowned == true)
{
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
driver->draw2DImage(drownedlogo1, core::position2d<s32>(0,0),
core::rect<s32>(0, 0, 1024, 768), 0,
video::SColor(1, 255, 255, 255), true);
font11->draw(L"Eric drowned. Press <ESC>.",rect<s32>(320,240,1024,768),SColor(0,255,0,0));
camera1->removeAnimators();
camera1->setPosition(vector3df(-999999999,-999999999,-999999999));
smgr->setActiveCamera(0);
}
}
//shot should blow up
shoot = 0;
driver->endScene();
}
deviceIrr->drop();
return 0;
}

ondrew
Posts: 20
Joined: Fri Oct 03, 2003 2:24 pm
Location: Czech Republic

Post by ondrew »

printf("%f",camera1->getPosition().X)

the position is defined as core::vector3df = vector of three floats (f32), so you must them pass as floats to printf
Post Reply