Problem with Q3 map tutorial

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
insolence
Posts: 21
Joined: Mon Aug 30, 2004 1:15 am

Problem with Q3 map tutorial

Post by insolence »

I can't seem to get it to load all the textures and such right, it cannot find some (I loaded all the pak0-pak8 files I had)

I don't think there's anything wrong with my code (although I don't like how Dev-C++ decided to format things for me -.-)

EDIT: I should also mention it is just a gray box, but SOME things are loaded, I cannot see them

(I googled the map and came up with this one)

Code: Select all

// HelloUniverse.cpp
// Include the Irrlicht header
#include "irrlicht.h"

// Irrlicht Namespaces
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

int main()
{
    IrrlichtDevice *device =
               createDevice(video::EDT_OPENGL,
               core::dimension2d<s32>(640, 480), 16);
               
    video::IVideoDriver* driver = device->getVideoDriver();
    scene::ISceneManager* smgr = device->getSceneManager();

    device->getFileSystem()->addZipFileArchive(
                "20kdm3beta.pk3");      
                
    scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm3beta.bsp");
    scene::ISceneNode* node = 0;

    if (mesh)
        node = smgr->addOctTreeSceneNode(mesh->getMesh(0));
    
    if (node)
        node->setPosition(core::vector3df(-1300,-144,-1249));
    
    device->getCursorControl()->setVisible(false);


    int lastFPS = -1;

    while(device->run())
    {
        driver->beginScene(true, true, video::SColor(0,100,100,100));
        smgr->drawAll();
        driver->endScene();

        int fps = driver->getFPS();

        if (lastFPS != fps)
        {
            wchar_t tmp[1024];
            swprintf(tmp, 1024, 
                 L"Quake 3 Map Example - Irrlicht Engine (fps:%d) Triangles:%d", 
            fps, driver->getPrimitiveCountDrawn());

            device->setWindowCaption(tmp);
            lastFPS = fps;
        }
     }


      device->drop();
  return 0;
}
Also, in the swprintf function... what does %d do?

I've seen it before in a couple open source programs I skimmed through, never really understood it (If you don't mind explaining ;))
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

There are always textures missing in Q3-maps. Mostly because they are in included in the pak0 or pak1 or ...-files coming with Quake3.

%d = %i represents an integer value. What will be displayed (the value) is placed after the string, in the same order. (http://nscp.upenn.edu/aix4.3html/libs/b ... printf.htm -> quick search on google for more about this subject)
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
insolence
Posts: 21
Joined: Mon Aug 30, 2004 1:15 am

Post by insolence »

But then why isn't anything showing up?

I'll research that, thanks :)
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Code: Select all

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui; 
are not needed because you already use those namespaces in your code (core:: ...).

And isn't it <irrlicht.h> and not "irrlicht.h" for the include line :) ?

The reason why you see nothing: you didn't add a camera yet. Check out the Q3 tutorial for how to do this: http://irrlicht.sourceforge.net/tut002.html
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
insolence
Posts: 21
Joined: Mon Aug 30, 2004 1:15 am

Post by insolence »

I think it doesn't matter what you use when including, but it works now, thanks :)

I just had to move the mouse around a bit and it found it, but the camera angle is weird, and when i move around it's like fish eye view.
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

insolence wrote:I think it doesn't matter what you use when including, but it works now, thanks :)

I just had to move the mouse around a bit and it found it, but the camera angle is weird, and when i move around it's like fish eye view.
camera->setFOV(1.57f);

or the full, bit more precise:

camera->setFOV(3.1415f/2.0);

should solve this problem :).
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
Post Reply