Jump to content

  • Log In with Google      Sign In   
  • Create Account


crysisbigfan

Member Since 02 Mar 2013
Offline Last Active Mar 19 2013 01:30 PM
-----

Topics I've Started

Programming Role Playing Games with Directx second edition SOURCE AND SAMPLES NEEDED

02 March 2013 - 04:09 AM

Hi !

Does anyone have Programming Role Playing Games with DirectX, Second Edition(2004) SOURCE CODE and samples for DX9. I already have SOURCE CODE from first edition(2002) for Directx8. Any help would be really appriciated.

 


Directx8 error LNK2019: unresolved external symbol PLEASE HELP!

02 March 2013 - 03:41 AM

Hi !

Im making RPG game (Diablo) for my graduation project.
I am working on Jim Adams Programing RPG with Directx 8 book. Any program i compile I get a bunch of different errors. Yes i know Directx 8 is old but i don't have time and knowledge to make something like Diablo. I already tried all the methods found on internet(stackoverflow, this site...). Linked aditional dependencies and so on ... I have sample code from the book and even entire RPG. I don't like the idea moving to Directx9. Yes I have that book too just not the sorce. If anyone has source and samples(for second edition) would you send it to me please ?

Sorry for bad english I type too fast and make mistakes often.

 

 

 

#include "Core_Global.h"
#include "Frustum.h"
#include "ACT1.h"
#include "Core_System.h"
#include "Core_Graphics.h"
#include "Core_Input.h"
#include "Core_Sound.h"
#include "Core_Network.h"
#pragma comment(lib, "User32.lib")
#pragma comment(lib, "gdi32.lib")
#pragma comment(lib,"d3d8.lib")
#pragma comment(lib,"d3dx8.lib")
#pragma comment(lib, "winmm.lib")
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include <Windows.h>
#include <iostream>
#include <stdio.h>
#include "d3d8.h"
#include "d3dx8.h"
#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "d3dx9d.lib")
#pragma comment(lib, "d3d9.lib")
 

 

 

 

 

winmm.lib;
wsock32.lib;
dxguid.lib;
d3dx9d.lib;
d3dx.lib;
d3d8.lib;
d3dx8.lib;
dsound.lib;
dinput8.lib;
dplayx.lib;
d3dx8d.lib;
d3dx8dt.lib;
%(AdditionalDependencies)
 

 

CODE: MAIN FUNCTION

 

#include "Core_Global.h"
#include "Frustum.h"
#include "ACT1.h"
#include "Core_System.h"
#include "Core_Graphics.h"
#include "Core_Input.h"
#include "Core_Sound.h"
#include "Core_Network.h"
#pragma comment(lib, "User32.lib")
#pragma comment(lib, "gdi32.lib")
#pragma comment(lib,"d3d8.lib")
#pragma comment(lib,"d3dx8.lib")
#pragma comment(lib, "winmm.lib")
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include <Windows.h>
#include <iostream>
#include <stdio.h>
#include "d3d8.h"
#include "d3dx8.h"
#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "d3dx9d.lib")
#pragma comment(lib, "d3d9.lib")
using namespace std;

class cApp : public cApplication
{
  private:
    cGraphics       m_Graphics;
    cCamera         m_Camera;
    cLight          m_Light;

    cSound          m_Sound;
    cSoundData      m_SndData;
    cSoundChannel   m_SndChannel[3];


    cInput          m_Input;
    cInputDevice    m_Keyboard;
    cInputDevice    m_Mouse;

    cMesh           m_Mesh;
    cNodeTreeMesh   m_NodeTreeMesh;

    float           m_XPos, m_YPos, m_ZPos;

  public:
    cApp();

    BOOL Init();
    BOOL Shutdown();
    BOOL Frame();
};

cApp::cApp()
{
  m_Width  = 640;
  m_Height = 480;
  m_Style  = WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU;
  strcpy(m_Class, "NodeTreeClass");
  strcpy(m_Caption, "NodeTree Demo by Jim Adams");
}

BOOL cApp::Init()
{
  short i;

  // Initialize the graphics device and set display mode
  m_Graphics.Init();
  m_Graphics.SetMode(GethWnd(), TRUE, TRUE);
  m_Graphics.SetPerspective(D3DX_PI/4, 1.3333f, 1.0f, 20000.0f);
  ShowMouse(TRUE);

  // Enable lighting and setup light
  m_Graphics.EnableLighting(TRUE);
  m_Graphics.SetAmbientLight(48,48,48);
  m_Graphics.EnableLight(0, TRUE);
  m_Light.SetAttenuation0(0.5f);
  m_Light.SetRange(1000.0f);

  // Initialize input and input devices
  m_Input.Init(GethWnd(), GethInst());
  m_Keyboard.Create(&m_Input, KEYBOARD);
  m_Mouse.Create(&m_Input, MOUSE, TRUE);  

  // Load the mesh and create an NodeTree mesh from it
  m_Mesh.Load(&m_Graphics, "..\\Data\\Level.x", "..\\Data\\");
  m_NodeTreeMesh.Create(&m_Graphics, &m_Mesh, QUADTREE);

  // Position view at origin
  m_XPos = m_YPos = m_ZPos = 0.0f;

 

  // Initialize the sound system to play with
  m_Sound.Init(GethWnd());
  m_SndData.LoadWAV("..\\Data\\Cricket.wav");
  for(i=0;i<3;i++)
    m_SndChannel[i].Create(&m_Sound, &m_SndData);

  return TRUE;
}

BOOL cApp::Shutdown()
{
  // Free sounds
  for(short i=0;i<3;i++)
    m_SndChannel[i].Free();
  m_SndData.Free();
  m_Sound.Shutdown();

  // Free meshes
  m_NodeTreeMesh.Free();
  m_Mesh.Free();

  // Shutdown input
  m_Mouse.Free();
  m_Keyboard.Free();
  m_Input.Shutdown();

  // Shutdown graphics
  m_Graphics.Shutdown();

  return TRUE;
}

BOOL cApp::Frame()
{
  static DWORD  Timer = timeGetTime();
  unsigned long Elapsed;
  float         XMove, ZMove, Height, Diff, Dist;
  D3DXVECTOR2   vecDir;
  cFrustum      Frustum;
  cLight        Light;

  // Play a random cricket sound
  for(short i=0;i<3;i++) {
    if(m_SndChannel[i].IsPlaying() == FALSE && rand() % 256 < 16)
      m_SndChannel[i].Play(&m_SndData, 10);
  }

  // Reacquire input
  m_Mouse.Acquire(TRUE);

  // Calculate elapsed time (plus speed boost)
  Elapsed = (timeGetTime() - Timer);
  Timer = timeGetTime();

  // Get input
  m_Keyboard.Read();
  m_Mouse.Read();

  // Process input and update everything.
  // ESC quits program
  if(m_Keyboard.GetKeyState(KEY_ESC) == TRUE)
    return FALSE;

  // Process movement
  XMove = ZMove = 0.0f;

  if(m_Keyboard.GetKeyState(KEY_UP) == TRUE) {
    XMove = (float)sin(m_Camera.GetYRotation()) * Elapsed;
    ZMove = (float)cos(m_Camera.GetYRotation()) * Elapsed;
  }
  if(m_Keyboard.GetKeyState(KEY_DOWN) == TRUE) {
    XMove = -(float)sin(m_Camera.GetYRotation()) * Elapsed;
    ZMove = -(float)cos(m_Camera.GetYRotation()) * Elapsed;
  }
  if(m_Keyboard.GetKeyState(KEY_LEFT) == TRUE) {
    XMove = (float)sin(m_Camera.GetYRotation() - 1.57f) * Elapsed;
    ZMove = (float)cos(m_Camera.GetYRotation() - 1.57f) * Elapsed;
  }
  if(m_Keyboard.GetKeyState(KEY_RIGHT) == TRUE) {
    XMove = (float)sin(m_Camera.GetYRotation() + 1.57f) * Elapsed;
    ZMove = (float)cos(m_Camera.GetYRotation() + 1.57f) * Elapsed;
  }

  // Check for height changes (can step up to 64 units)
  Height = m_NodeTreeMesh.GetHeightBelow(m_XPos, m_YPos + 64.0f, m_ZPos);
  if(m_YPos > Height) {
    // Dropping
    if((m_YPos -= (float)Elapsed) < Height)
      m_YPos = Height;
    else
      XMove = ZMove = 0.0f;
  } else {
    // Climbing
    m_YPos = Height;
  }

  // Check for movement collisions -
  // can't walk past anything blocking path
  if(m_NodeTreeMesh.CheckIntersect(m_XPos,         m_YPos + 64.0f, m_ZPos,
                                 m_XPos + XMove, m_YPos + 64.0f, m_ZPos + ZMove,
                                 &Dist) == TRUE) {
    // Adjust coordinates to be exactly 2.5 units away from target
    Diff = Dist - 2.5f;
    D3DXVec2Normalize(&vecDir, &D3DXVECTOR2(XMove, ZMove));
    vecDir *= Diff;
    XMove = vecDir.x;
    ZMove = vecDir.y;
  }

  // Update view coordinates
  m_XPos += XMove;
  m_ZPos += ZMove;

  // Position camera
  m_Camera.Move(m_XPos + XMove, m_YPos + 50.0f, m_ZPos + ZMove);
  m_Camera.RotateRel((float)m_Mouse.GetYDelta() / 200.0f,
                     (float)m_Mouse.GetXDelta() / 200.0f,
                     0.0f);

  // Position light
  m_Light.Move(m_XPos, m_YPos+60.0f, m_ZPos);
  m_Graphics.SetLight(0, &m_Light);

  // Set camera and calculate frustum
  m_Graphics.SetCamera(&m_Camera);
  Frustum.Construct(&m_Graphics);

  // Render everything
  m_Graphics.ClearZBuffer(1.0f);
  if(m_Graphics.BeginScene() == TRUE) {
    m_Graphics.EnableZBuffer(FALSE);
    m_Graphics.EnableLighting(FALSE);

    m_Graphics.EnableZBuffer(TRUE);
    m_Graphics.EnableLighting(TRUE);
    m_NodeTreeMesh.Render(&Frustum);
    m_Graphics.EndScene();
  }
  m_Graphics.Display();

  return TRUE;
}

int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow)
{
  cApp App;
  return App.Run();
}
 

 

AND ACT1.CPP

 

/*-------------------------------------------------------------------
------------------===========================-------------------------------
   IIIIIIII    IIIII     IIII      III       III   IIIII    II      IIIII
     III  III   III     III III     III     III   III III   II     III III
     III    II  III    III   III     III   III   III  III   II    III  III
     III    II  III   IIIIIIIIIII     III III    III  III   II    III  III
   IIIIIIII    IIIII III       III     IIII       IIIIII    IIIIII IIIIII
=================||||||||||||||||||||||||||||===============================



#include "Core_Global.h"
#include "Frustum.h"
#include "ACT1.h"


#pragma comment(lib, "User32.lib")
#pragma comment(lib, "gdi32.lib")
#pragma comment(lib,"d3d8.lib")
#pragma comment(lib,"d3dx8.lib")
#pragma comment(lib, "winmm.lib")

#include <dinput.h>
#include <Windows.h>
#include <iostream>
#include <stdio.h>
#include "d3d8.h"
#include "d3dx8.h"
    #pragma comment(lib, "d3dx9.lib")
    #pragma comment(lib, "d3dx9d.lib")
    #pragma comment(lib, "d3d9.lib")
using namespace std;

cNodeTreeMesh::cNodeTreeMesh()
{
    m_TreeType = OCTREE;
    m_Graphics = NULL;
    m_ParentNode = NULL;
    m_NumPolygons = 0;
    m_PolygonList = NULL;
    m_NumGroups = 0;
    m_Groups = NULL;
    m_Time = 0;
}

cNodeTreeMesh::~cNodeTreeMesh()
{
    Free();
}

BOOL cNodeTreeMesh::Create(cGraphics *Graphics, cMesh *Mesh, int TreeType, float MaxSize, long MaxPolygons)
{
    ID3DXMesh *LoadMesh;
    unsigned short *IndexPtr;
    DWORD *Attributes;
    unsigned long i;
    float MaxX, MaxY, MaxZ;

    Free();


    if((m_Graphics = Graphics ) == NULL)
        return FALSE;
    if(Mesh == NULL)
        return FALSE;
    if(!Mesh->GetParentMesh()->m_NumMaterials)
        return FALSE;

   
    m_Mesh = Mesh->GetParentMesh();
    LoadMesh = m_Mesh->m_Mesh;
    m_VertexFVF = LoadMesh->GetFVF();
    m_VertexSize = D3DXGetFVFVertexSize(m_VertexFVF);
    m_NumPolygons = LoadMesh->GetNumFaces();
    m_MaxPolygons = MaxPolygons;


    m_PolygonList = new sPolygon[m_NumPolygons]();
    m_NumGroups = m_Mesh->m_NumMaterials;
    m_Groups = new sGroup[m_NumGroups]();

   
    LoadMesh->LockIndexBuffer(D3DLOCK_READONLY, (BYTE**)&IndexPtr);
    LoadMesh->LockAttributeBuffer(D3DLOCK_READONLY, &Attributes);

  
    for(i = 0; i  <m_NumPolygons; i++)
    {
        m_PolygonList[i].Vertex[0] = *IndexPtr++;
        m_PolygonList[i].Vertex[1] = *IndexPtr++;
        m_PolygonList[i].Vertex[2] = *IndexPtr++;

        m_PolygonList[i].Group = Attributes[i];
        m_Groups[Attributes[i]].NumPolygons++;
    }

    LoadMesh->UnlockIndexBuffer();
    LoadMesh->UnlockAttributeBuffer();

    for(i = 0; i < m_NumGroups; i++)
    {
        if(m_Groups[i].NumPolygons != 0)
            m_Groups[i].VertexBuffer.Create(m_Graphics, m_Groups[i].NumPolygons * 3, m_VertexFVF, m_VertexSize);
    }


    MaxX = (float)max(fabs(Mesh->GetParentMesh()->m_Min.x), fabs(Mesh->GetParentMesh()->m_Max.x));
    MaxY = (float)max(fabs(Mesh->GetParentMesh()->m_Min.y), fabs(Mesh->GetParentMesh()->m_Max.y));
    MaxZ = (float)max(fabs(Mesh->GetParentMesh()->m_Min.z), fabs(Mesh->GetParentMesh()->m_Max.z));
    m_Size = max(MaxX, max(MaxY, MaxZ)) * 2.0f;
    m_MaxSize = MaxSize;


    m_ParentNode = new sNode();

    LoadMesh->LockVertexBuffer(D3DLOCK_READONLY, (BYTE**)&m_VertexPtr);
    SortNode(m_ParentNode, 0.0f, 0.0f, 0.0f, m_Size);
    LoadMesh->UnlockVertexBuffer();

    return TRUE;
}



BOOL cNodeTreeMesh::Free()
{
    delete m_ParentNode;
    m_ParentNode = NULL;

    m_Graphics = NULL;
    m_NumPolygons = 0;
    delete [] m_PolygonList;
    m_PolygonList = NULL;

    m_NumGroups = 0;
    delete [] m_Groups;
    m_Groups = NULL;
    
    return TRUE;
}

void cNodeTreeMesh::SortNode(sNode *Node, float XPos, float YPos, float ZPos, float Size)
{
    unsigned long i, Num;
    float XOff, YOff, ZOff;

    if(Node == NULL || m_PolygonList == NULL)
        return;


    Node->XPos = XPos;
    Node->YPos = (m_TreeType == QUADTREE)?0.0f:YPos;
    Node->ZPos = ZPos;
    Node->Size = Size;

    //ali so plyigoni v nodu
    if(!(Num = CountPolygons(XPos, YPos, ZPos, Size)))
        return;

    if(Size > m_MaxSize && Num > m_MaxPolygons)
    {
        for(i=0; i<(unsigned long)((m_TreeType == QUADTREE)?4:8);i++)
        {
            XOff = ((( i % 2 ) < 1) ? -1.0f : 1.0f ) * (Size * 4.0f);
            YOff = ((( i % 4 ) < 1) ? -1.0f : 1.0f ) * (Size * 4.0f);
            ZOff = ((( i % 8 ) < 1) ? -1.0f : 1.0f ) * (Size * 4.0f);

       
            if(CountPolygons(XPos+XOff, YPos+YOff, ZPos+ZOff, Size/2.0f))
            {
                Node->Nodes[i] = new sNode();

                SortNode(Node->Nodes[i], XPos+XOff, YPos+YOff, ZPos+ZOff, Size/2.0f);
            }
        }
        return;
    }

    
    Node->NumPolygons = Num;
    Node->PolygonList = new sPolygon*[Num];

   
    Num = 0;
    for ( i=0; i<m_NumPolygons; i++)
    {
        if(IsPolygonContained(&m_PolygonList[i], XPos, YPos, ZPos, Size) == TRUE)
    
    Node->PolygonList[Num++] = &m_PolygonList[i];
    }
}

BOOL cNodeTreeMesh::IsPolygonContained(sPolygon *Polygon, float XPos, float YPos, float ZPos, float Size)
{
    float XMin, XMax, YMin, YMax, ZMin, ZMax;
    sVertex *Vertex[3];

    Vertex[0] =(sVertex*)&m_VertexPtr[m_VertexSize * Polygon->Vertex[0]];
    Vertex[1] =(sVertex*)&m_VertexPtr[m_VertexSize * Polygon->Vertex[1]];
    Vertex[2] =(sVertex*)&m_VertexPtr[m_VertexSize * Polygon->Vertex[2]];


  XMin = min(Vertex[0]->x, min(Vertex[1]->x, Vertex[2]->x));
  XMax = max(Vertex[0]->x, max(Vertex[1]->x, Vertex[2]->x));
  if(XMax < (XPos - Size / 2.0f))
  return FALSE;
  if(XMin > (XPos + Size / 2.0f))
  return FALSE;


  if(m_TreeType == OCTREE) {
    YMin = min(Vertex[0]->y, min(Vertex[1]->y, Vertex[2]->y));
    YMax = max(Vertex[0]->y, max(Vertex[1]->y, Vertex[2]->y));
    if(YMax < (YPos - Size / 2.0f))
    return FALSE;
    if(YMin > (YPos + Size / 2.0f))
    return FALSE;
  }


  ZMin = min(Vertex[0]->z, min(Vertex[1]->z, Vertex[2]->z));
  ZMax = max(Vertex[0]->z, max(Vertex[1]->z, Vertex[2]->z));
  if(ZMax < (ZPos - Size / 2.0f))
  return FALSE;
  if(ZMin > (ZPos + Size / 2.0f))
  return FALSE;

  return TRUE;
}

unsigned long cNodeTreeMesh::CountPolygons(float XPos, float YPos, float ZPos, float Size)
{
    unsigned long i, Num;

  if(!m_NumPolygons)
    return 0;


  Num = 0;
  for( i=0; i<m_NumPolygons; i++ ) {
    if(IsPolygonContained(&m_PolygonList[i],XPos,YPos,ZPos,Size) == TRUE)
     Num++;
  }

  return Num;
}

BOOL cNodeTreeMesh::Render(cFrustum *Frustum, float ZDistance)
{
  D3DXMATRIX Matrix;  
  cFrustum ViewFrustum;  

  
  if(m_Graphics == NULL || m_ParentNode == NULL || !m_NumPolygons)
    return FALSE;


  if((m_Frustum = Frustum) == NULL) {
    ViewFrustum.Construct(m_Graphics, ZDistance);
    m_Frustum = &ViewFrustum;
  }

  D3DXMatrixIdentity(&Matrix);
  m_Graphics->GetDeviceCOM()->SetTransform(D3DTS_WORLD, &Matrix);


  for(unsigned long i=0; i<m_NumGroups; i++) {
    m_Groups[i].VertexBuffer.Lock(0,0);
    m_Groups[i].VertexPtr = (char*)m_Groups[i].VertexBuffer.GetPtr();
    m_Groups[i].NumPolygonsToDraw = 0;
  }
  m_Mesh->m_Mesh->LockVertexBuffer(D3DLOCK_READONLY, (BYTE**)&m_VertexPtr);

  // shrani trenutni čas  v render
  m_Time = timeGetTime();

  // Dodaj polygone v vertex buffer
  AddNode(m_ParentNode);
 
  // odkleni vertex bufferje in izriši
  m_Mesh->m_Mesh->UnlockVertexBuffer();
  for(unsigned long i=0; i<m_NumGroups; i++) {
    m_Groups[i].VertexBuffer.Unlock();

    if(m_Groups[i].NumPolygonsToDraw) {
      m_Graphics->GetDeviceCOM()->SetMaterial(&m_Mesh->m_Materials[i]);
      m_Graphics->GetDeviceCOM()->SetTexture(0, m_Mesh->m_Textures[i]);
      
      m_Groups[i].VertexBuffer.Render(0, m_Groups[i].NumPolygonsToDraw, D3DPT_TRIANGLELIST);
    }
  }

  return TRUE;
}

void cNodeTreeMesh::AddNode(sNode *Node)
{
  unsigned long i, Group;
  short         Num;

  if(m_TreeType == QUADTREE) {
    if(m_Frustum->CheckRectangle(
           Node->XPos,        0.0f,          Node->ZPos,
           Node->Size / 2.0f, m_Size / 2.0f, Node->Size / 2.0f) == FALSE)
      return;
  } else {
    if(m_Frustum->CheckRectangle(
           Node->XPos,        Node->YPos,        Node->ZPos,
           Node->Size / 2.0f, Node->Size / 2.0f, Node->Size / 2.0f) == FALSE)
      return;
  }

 
  Num = 0;
  for(i=0;i<(unsigned long)((m_TreeType==QUADTREE)?4:8);i++) {
    if(Node->Nodes[i] != NULL) {
      Num++;
      AddNode(Node->Nodes[i]);
    }
  }


  if(Num)
    return;

 
  if(Node->NumPolygons != 0) {
    for(i=0;i<Node->NumPolygons;i++) {

    
      if(Node->PolygonList[i]->Time != m_Time && (Group = Node->PolygonList[i]->Group) < m_NumGroups) {


   
        if(m_Mesh->m_Materials[Node->PolygonList[i]->Group].Diffuse.a != 0.0f) {
          
         
          memcpy(m_Groups[Group].VertexPtr, &m_VertexPtr[m_VertexSize * Node->PolygonList[i]->Vertex[0]], m_VertexSize);
          m_Groups[Group].VertexPtr += m_VertexSize;
          memcpy(m_Groups[Group].VertexPtr, &m_VertexPtr[m_VertexSize * Node->PolygonList[i]->Vertex[1]], m_VertexSize);
          m_Groups[Group].VertexPtr += m_VertexSize;
          memcpy(m_Groups[Group].VertexPtr, &m_VertexPtr[m_VertexSize * Node->PolygonList[i]->Vertex[2]], m_VertexSize);
          m_Groups[Group].VertexPtr += m_VertexSize;

          m_Groups[Group].NumPolygonsToDraw++;
        }

        Node->PolygonList[i]->Time = m_Time;
      }
    }
  }
}

float cNodeTreeMesh::GetClosestHeight(float XPos, float YPos, float ZPos)
{
  float YAbove, YBelow;

  YAbove = GetHeightAbove(XPos, YPos, ZPos);
  YBelow = GetHeightBelow(XPos, YPos, ZPos);
  if(fabs(YAbove-YPos) < fabs(YBelow-YPos))
    return YAbove;
  return YBelow;
}

float cNodeTreeMesh::GetHeightBelow(float XPos, float YPos, float ZPos)
{
  BOOL  Hit;
  float u, v, Dist;
  DWORD FaceIndex;

  D3DXIntersect(m_Mesh->m_Mesh,
&D3DXVECTOR3(XPos,YPos,ZPos), &D3DXVECTOR3(0.0f, -1.0f, 0.0f),&Hit, &FaceIndex, &u, &v, &Dist, NULL, NULL);
  if(Hit == TRUE)
    return YPos-Dist;
  return YPos;
}

float cNodeTreeMesh::GetHeightAbove(float XPos, float YPos, float ZPos)
{
  BOOL  Hit;
  float u, v, Dist;
  DWORD FaceIndex;

  D3DXIntersect(m_Mesh->m_Mesh,
                &D3DXVECTOR3(XPos,YPos,ZPos),
                &D3DXVECTOR3(0.0f, 1.0f, 0.0f),
                &Hit, &FaceIndex, &u, &v, &Dist , NULL, NULL);
  if(Hit == TRUE)
    return YPos+Dist;
  return YPos;
}

BOOL cNodeTreeMesh::CheckIntersect(float XStart, float YStart, float ZStart,
                                   float XEnd,   float YEnd,   float ZEnd,
                                   float *Length)
{
  BOOL  Hit;
  float u, v, Dist;
  float XDiff, YDiff, ZDiff, Size;
  DWORD FaceIndex;
  D3DXVECTOR3 vecDir;

  XDiff = XEnd - XStart;
  YDiff = YEnd - YStart;
  ZDiff = ZEnd - ZStart;

  D3DXVec3Normalize(&vecDir, &D3DXVECTOR3(XDiff, YDiff, ZDiff));
  D3DXIntersect(m_Mesh->m_Mesh, &D3DXVECTOR3(XStart,YStart,ZStart), &vecDir,&Hit, &FaceIndex, &u, &v, &Dist, NULL, NULL);

  if(Hit == TRUE) {
    Size = (float)sqrt(XDiff*XDiff+YDiff*YDiff+ZDiff*ZDiff);
    if(Dist > Size)
      Hit = FALSE;
    else {
      if(Length != NULL)
        *Length = Dist;
    }
  }

  return Hit;
}

 

ERRORS


 

Build started 2.3.2013 10:17:39.
1>InitializeBuildStatus:
1>  Touching "Debug\Diavolo.unsuccessfulbuild".
1>ClCompile:
1>  WinMain.cpp
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>LIBCMTD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Create(class cGraphics *,unsigned long,unsigned long,long)" (?Create@cVertexBuffer@@QAEHPAVcGraphics@@KKJ@Z) referenced in function "public: int __thiscall cNodeTreeMesh::Create(class cGraphics *,class cMesh *,int,float,long)" (?Create@cNodeTreeMesh@@QAEHPAVcGraphics@@PAVcMesh@@HMJ@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: struct sMesh * __thiscall cMesh::GetParentMesh(void)" (?GetParentMesh@cMesh@@QAEPAUsMesh@@XZ) referenced in function "public: int __thiscall cNodeTreeMesh::Create(class cGraphics *,class cMesh *,int,float,long)" (?Create@cNodeTreeMesh@@QAEHPAVcGraphics@@PAVcMesh@@HMJ@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: __thiscall cVertexBuffer::cVertexBuffer(void)" (??0cVertexBuffer@@QAE@XZ) referenced in function "public: __thiscall cNodeTreeMesh::sGroup::sGroup(void)" (??0sGroup@cNodeTreeMesh@@QAE@XZ)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: __thiscall cVertexBuffer::~cVertexBuffer(void)" (??1cVertexBuffer@@QAE@XZ) referenced in function "public: __thiscall cNodeTreeMesh::sGroup::~sGroup(void)" (??1sGroup@cNodeTreeMesh@@QAE@XZ)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Free(void)" (?Free@cVertexBuffer@@QAEHXZ) referenced in function "public: __thiscall cNodeTreeMesh::sGroup::~sGroup(void)" (??1sGroup@cNodeTreeMesh@@QAE@XZ)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Render(unsigned long,unsigned long,unsigned long)" (?Render@cVertexBuffer@@QAEHKKK@Z) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Unlock(void)" (?Unlock@cVertexBuffer@@QAEHXZ) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: void * __thiscall cVertexBuffer::GetPtr(void)" (?GetPtr@cVertexBuffer@@QAEPAXXZ) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Lock(unsigned long,unsigned long)" (?Lock@cVertexBuffer@@QAEHKK@Z) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: struct IDirect3DDevice8 * __thiscall cGraphics::GetDeviceCOM(void)" (?GetDeviceCOM@cGraphics@@QAEPAUIDirect3DDevice8@@XZ) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>Frustum.obj : error LNK2001: unresolved external symbol "public: struct IDirect3DDevice8 * __thiscall cGraphics::GetDeviceCOM(void)" (?GetDeviceCOM@cGraphics@@QAEPAUIDirect3DDevice8@@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cMesh::~cMesh(void)" (??1cMesh@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cInputDevice::~cInputDevice(void)" (??1cInputDevice@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cInput::~cInput(void)" (??1cInput@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSoundData::~cSoundData(void)" (??1cSoundData@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSound::~cSound(void)" (??1cSound@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cGraphics::~cGraphics(void)" (??1cGraphics@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cMesh::cMesh(void)" (??0cMesh@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cInputDevice::cInputDevice(void)" (??0cInputDevice@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cInput::cInput(void)" (??0cInput@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSoundChannel::cSoundChannel(void)" (??0cSoundChannel@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSoundChannel::~cSoundChannel(void)" (??1cSoundChannel@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSoundData::cSoundData(void)" (??0cSoundData@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSound::cSound(void)" (??0cSound@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cLight::cLight(void)" (??0cLight@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cCamera::cCamera(void)" (??0cCamera@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cGraphics::cGraphics(void)" (??0cGraphics@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cApplication::cApplication(void)" (??0cApplication@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundChannel::Create(class cSound *,class cSoundData *)" (?Create@cSoundChannel@@QAEHPAVcSound@@PAVcSoundData@@@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundData::LoadWAV(char *,struct _iobuf *)" (?LoadWAV@cSoundData@@QAEHPADPAU_iobuf@@@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSound::Init(struct HWND__ *,long,short,short,long)" (?Init@cSound@@QAEHPAUHWND__@@JFFJ@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cMesh::Load(class cGraphics *,char *,char *)" (?Load@cMesh@@QAEHPAVcGraphics@@PAD1@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInputDevice::Create(class cInput *,short,int)" (?Create@cInputDevice@@QAEHPAVcInput@@FH@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInput::Init(struct HWND__ *,struct HINSTANCE__ *)" (?Init@cInput@@QAEHPAUHWND__@@PAUHINSTANCE__@@@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: struct HINSTANCE__ * __thiscall cApplication::GethInst(void)" (?GethInst@cApplication@@QAEPAUHINSTANCE__@@XZ) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cLight::SetRange(float)" (?SetRange@cLight@@QAEHM@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cLight::SetAttenuation0(float)" (?SetAttenuation0@cLight@@QAEHM@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::EnableLight(long,int)" (?EnableLight@cGraphics@@QAEHJH@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::SetAmbientLight(char,char,char)" (?SetAmbientLight@cGraphics@@QAEHDDD@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::EnableLighting(int)" (?EnableLighting@cGraphics@@QAEHH@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cApplication::ShowMouse(int)" (?ShowMouse@cApplication@@QAEHH@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::SetPerspective(float,float,float,float)" (?SetPerspective@cGraphics@@QAEHMMMM@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::SetMode(struct HWND__ *,int,int,long,long,char)" (?SetMode@cGraphics@@QAEHPAUHWND__@@HHJJD@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: struct HWND__ * __thiscall cApplication::GethWnd(void)" (?GethWnd@cApplication@@QAEPAUHWND__@@XZ) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::Init(void)" (?Init@cGraphics@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::Shutdown(void)" (?Shutdown@cGraphics@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInput::Shutdown(void)" (?Shutdown@cInput@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInputDevice::Free(void)" (?Free@cInputDevice@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cMesh::Free(void)" (?Free@cMesh@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSound::Shutdown(void)" (?Shutdown@cSound@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundData::Free(void)" (?Free@cSoundData@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundChannel::Free(void)" (?Free@cSoundChannel@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::Display(void)" (?Display@cGraphics@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::EndScene(void)" (?EndScene@cGraphics@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::EnableZBuffer(int)" (?EnableZBuffer@cGraphics@@QAEHH@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::BeginScene(void)" (?BeginScene@cGraphics@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::ClearZBuffer(float)" (?ClearZBuffer@cGraphics@@QAEHM@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::SetCamera(class cCamera *)" (?SetCamera@cGraphics@@QAEHPAVcCamera@@@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::SetLight(long,class cLight *)" (?SetLight@cGraphics@@QAEHJPAVcLight@@@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cLight::Move(float,float,float)" (?Move@cLight@@QAEHMMM@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cCamera::RotateRel(float,float,float)" (?RotateRel@cCamera@@QAEHMMM@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: long __thiscall cInputDevice::GetYDelta(void)" (?GetYDelta@cInputDevice@@QAEJXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: long __thiscall cInputDevice::GetXDelta(void)" (?GetXDelta@cInputDevice@@QAEJXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cCamera::Move(float,float,float)" (?Move@cCamera@@QAEHMMM@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: float __thiscall cCamera::GetYRotation(void)" (?GetYRotation@cCamera@@QAEMXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInputDevice::GetKeyState(char)" (?GetKeyState@cInputDevice@@QAEHD@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInputDevice::Read(void)" (?Read@cInputDevice@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInputDevice::Acquire(int)" (?Acquire@cInputDevice@@QAEHH@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundChannel::Play(class cSoundData *,long,long)" (?Play@cSoundChannel@@QAEHPAVcSoundData@@JJ@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundChannel::IsPlaying(void)" (?IsPlaying@cSoundChannel@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cApplication::Run(void)" (?Run@cApplication@@QAEHXZ) referenced in function _WinMain@16
1>.\Debug\Diavolo.exe : fatal error LNK1120: 71 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.91
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



 

 

Oh, and please ignore the comments they are in other language.

Any help would be really appriciated



 


PARTNERS