Hi all,
I am having terrain issues with my game.
To begin with here is my code...
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple 3D project that uses Dark GDK
// it can be used as a starting point in making your own 3D games
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
#include "DarkAI.h"
#pragma comment (lib, "DarkAI.lib")
#include "DarkLights.h"
#pragma comment (lib, "DarkLights.lib")
// the main entry point for the application is this function
void DarkGDK ( void )
{
AIStart();
dbSyncOn();
dbSyncRate( 60 );
dbSetDisplayMode(1280, 800, 32);
dbSetCameraRange(1.0f, 30000.0f);
bool highSpeed;
highSpeed = 0;
dbLoadImage( "texture.jpg", 1 );
dbLoadImage( "detail.jpg", 2 );
dbLoadObject( "H-Jet Fighter-Move.x", 1 );
AIAddPlayer(1,1);
dbPositionObject( 1, 0, 0, 0 );
dbRotateObject( 1, 0, 0, 0 );
dbLoopObject( 1, 1, 1 );
dbSetObjectSpeed( 1, 2 );
dbSetupTerrain();
dbMakeObjectTerrain(1);
dbSetTerrainHeightMap( 1, "map.bmp" );
dbSetTerrainScale( 1, 3.0f, 0.6f, 3.0f );
dbSetTerrainLight( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
dbSetTerrainTexture( 1, 1, 2 );
dbBuildTerrain(1);
dbLoadObject( "skybox2.x", 2 );
dbSetObjectLight( 2, 0 );
dbScaleObject( 2, 30000, 30000, 30000 );
while ( LoopGDK ( ) )
{
dbSetCameraToFollow(dbObjectPositionX(1), dbObjectPositionY(1), dbObjectPositionZ(1), dbObjectAngleY(1), -30, 15, 30, 1);
dbSetCameraToObjectOrientation(1);
dbPointCamera(dbObjectPositionX(1), dbObjectPositionY(1), dbObjectPositionZ(1));
dbPrint("Object Z Angle:");
dbSetCursor(0,0);
dbPrint(dbObjectAngleZ(1));
dbSetCursor(50,0);
dbPrint("Object Y Angle:");
dbSetCursor(0,20);
dbPrint(dbObjectAngleY(1));
dbSetCursor(50,20);
dbPrint("Object X Angle:");
dbSetCursor(0,40);
dbPrint(dbObjectAngleX(1));
dbSetCursor(50,40);
if(dbShiftKey()==1)
{
if(dbKeyState(44)==1)
{
dbRollObjectRight(1,1);
}
} else if(dbKeyState(44)==1)
{
dbRollObjectRight(1,3);
}
if(dbShiftKey()==1)
{
if(dbKeyState(45)==1)
{
dbRollObjectLeft(1,1);
}
} else if(dbKeyState(45)==1)
{
dbRollObjectLeft(1,3);
}
if(dbShiftKey()==1)
{
if(dbLeftKey()==1)
{
dbRollObjectRight(1,1);
dbTurnObjectLeft(1,2);
}
} else if(dbLeftKey()==1)
{
dbRollObjectRight(1,3);
dbTurnObjectLeft(1,5);
}
if(dbShiftKey()==1)
{
if(dbRightKey()==1)
{
dbRollObjectLeft(1,1);
dbTurnObjectRight(1,2);
}
} else if(dbRightKey()==1)
{
dbRollObjectLeft(1,3);
dbTurnObjectRight(1,5);
}
if(dbShiftKey()==1)
{
if(dbDownKey()==1)
{
dbPitchObjectDown(1,1);
}
} else if(dbDownKey()==1)
{
dbPitchObjectDown(1,3);
}
if(dbShiftKey()==1)
{
if(dbUpKey()==1)
{
dbPitchObjectUp(1,1);
}
} else if(dbUpKey()==1)
{
dbPitchObjectUp(1,3);
}
if(dbKeyState(46)==1)
{
if(highSpeed==0)
{
highSpeed = 1;
} else
{
highSpeed = 0;
}
}
if(dbSpaceKey()==1)
{
if(highSpeed==0)
{
dbMoveObject(1,-1);
dbPlayObject(1);
} else
{
dbMoveObject(1,-3);
}
}
dbSync ( );
}
return;
}
When I run this I get this error:
LNK2005: "Void(_cdecl* g_DeleteObject)(int)" (?g_DeleteObject@@3P6AXH@ZA) already defined in terrain.lib(Basic.obj)
and also
fatal error LNK1169: one or more multiply defined symbols found
When I comment out the terrain specific code, (code below), the game runs. However the skybox I have coded just comes up with a white background.
dbSetupTerrain();
dbMakeObjectTerrain(1);
dbSetTerrainHeightMap( 1, "map.bmp" );
dbSetTerrainScale( 1, 3.0f, 0.6f, 3.0f );
dbSetTerrainLight( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
dbSetTerrainTexture( 1, 1, 2 );
dbBuildTerrain(1);
Can anyone help me at all?