hi all ! It's my small source.
#include "DarkGDK.h"
int scr_width=800, scr_height=600, scr_depth=32 ;
int ter_id=1, ter_st=1, ter_max=10;
int sum_id=11, sum_st=11, sum_max=900;
int roc_id=901, roc_st=901, roc_max=1000;
int obj_id=1001, obj_st=1001, obj_max=2000;
int sum_speed=5, roc_speed=5;
float speed=0,xurdasguur=0.2,maxspeed=20.0;
float fCameraAngleX = 0.0f;
float fCameraAngleY = 0.0f;
char *crash="morgoldoogui bna .";
bool gear=0;
struct SUM{
float sum_speed;
int onoson;
int scale;
}sum[1000];
struct ROC{
float roc_speed;
int onoson;
int scale;
}roc[1000];
struct OBJ{
int onogdson;
float chichirgee;
}obj[1000];
struct PLAYER{
int id;
int onoson;
int scale;
float speed;
float xurdasguur;
}player[1000];
int shrinkCards ()
{
for (int n=101; n<104; n++){
dbScaleSprite (n,13);
dbSetSpritePriority (n,0);
}
return 0;
}
int zoomCards ()
{
for (int n=101; n<104; n++){
if (dbSpriteHit (999, n)) dbScaleSprite (n,75);
dbSetSpritePriority (n,5);
}
return 0;
}
float sens(){
return 0.5;
}
void player_dead( int i){
float ob1_x, ob1_y, ob1_z;
if(i==1){
crash="crash";
}
player[i].speed=0;
player[i].xurdasguur=0;
ob1_x=dbObjectPositionX(player[i].id);
ob1_y=dbObjectPositionY(player[i].id);
ob1_z=dbObjectPositionZ(player[i].id);
dbHideObject(player[i].id);
dbDeleteObject(player[i].id);
/*
dbLoadObject("object/delberelt.x",player[i].id);
dbPositionObject(player[i].id,ob1_x, ob1_y, ob1_z);
dbScaleObject(player[i].id,20,20,20);
dbTextureObject(player[i].id,4);
dbPlayObject(player[i].id);
*/
}
void object_hit_sum(int i, int j){
sum[j].sum_speed=0;
sum[j].onoson=1;
dbSetObjectAmbient (j,1);
obj[i].onogdson=1;
obj[i].chichirgee=0;
}
void DarkGDK ( void )
{
dbRandomize ( dbTimer ( ) );
//
dbSetShadowShadingOn(1);
FULL_PTR_XLAT_TABLES(hWnd);
dbSetDisplayMode(scr_width, scr_height, scr_depth);
dbSetWindowTitle("my litle game");
dbSetWindowOff();
dbAlwaysActiveOn();
dbSetCursor(10,10);
dbPrint("Loading ... ");
dbSync();
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetNormalizationOn();
SetCurrentDirectory ( "media" );
dbBackdropColor(dbRGB(200 ,200 ,200));
dbLoadMusic("sound/ACTION - Raise The Shadows.mp3",1);
dbPlayMusic(1);
dbSetMusicVolume(1,5);
dbLoadImage("image/texture.jpg",1);
dbLoadImage("image/detail.jpg",2);
dbLoadImage("image/JetBlank.dds",3);
dbLoadImage("image/onio.png",5);
dbSetupTerrain ();
dbMakeObjectTerrain(ter_id);
dbSetTerrainHeightMap (ter_id, "image/map.bmp" );
dbSetTerrainScale (ter_id, 5.0f, 0.3f, 5.0f);
dbSetTerrainLight (ter_id, 1.0f, -0.50f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f);
dbSetTerrainTexture (ter_id,1,2);
dbBuildTerrain( ter_id );
dbSetObjectFog(ter_id,1);
player[1].id=obj_id;
dbLoadObject ( "object/H-Jet Fighter 2-Move.x", player[1].id );
dbRotateObject(player[1].id,0,0,0);
dbScaleObject(player[1].id, 50, 50, 50 );
dbSetObjectLight( player[1].id, 1 );
dbSetObjectCollisionOn(player[1].id);
dbTextureObject(player[1].id,3);
dbPositionObject(player[1].id,300,(dbGetTerrainGroundHeight(1,300,300)+50),300);
player[1].speed=speed;
player[1].xurdasguur=xurdasguur;
obj_id=obj_id+1;
for ( int i = 2; i <= 20; i++ ){
player[i].id=obj_id;
dbLoadObject ( "object/H-Jet Fighter 2-Move.x", player[i].id );
dbRotateObject(player[i].id,0,0,0);
dbScaleObject(player[i].id, 50, 50, 50 );
int x,z;
x=dbRND(500)+100;
z=dbRND(500)+100;
dbPositionObject(player[i].id,x,(dbGetTerrainGroundHeight(1,x,z)+50),z);
dbSetObjectLight( player[i].id, 1 );
obj_id++;
}
dbPositionCamera(300,(dbGetTerrainGroundHeight(1,300,300)+50),290);
//dbSetObjectSpecularPower(player[1].id,100);
/*
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
dbGetObjectCameraLook();
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
while ( LoopGDK ( ) )
{
dbHideMouse();
dbAutoCamOff();
dbSprite(1,scr_width/2, scr_height/2,5);
shrinkCards();
zoomCards();
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.3f *sens());
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.3f *sens());
//fCameraAngleX=dbCurveAngle(0.0,fCameraAngleX,speed);
//fCameraAngleY=dbCurveAngle(0.0,fCameraAngleY,speed);
dbText ( 0,0, crash );
dbText ( 0,20, dbStr(sum_id-100) );
dbText ( 0,40, "x : " ); dbText ( 30,40, dbStr(dbObjectPositionX(player[1].id)) );
dbText ( 0,60, "y : " ); dbText ( 30,60, dbStr(dbObjectPositionY(player[1].id)) );
dbText ( 0,80, "z : " ); dbText ( 30,80, dbStr(dbObjectPositionZ(player[1].id)) );
dbText ( 0,100, "speed :" ); dbText ( 60,100, dbStr(player[1].speed) );
dbText ( 0,120, "obj :" ); dbText ( 60,120, dbStr(obj_id-1000));
if ( dbUpKey ( ) ){
//dbRotateCamera( dbObjectAngleX ( 1 )+sens(), dbObjectAngleY(1), dbObjectAngleZ ( 1 ) );
//dbRotateObject ( 1, dbObjectAngleX ( 1 )+sens(), dbObjectAngleY ( 1 ), dbObjectAngleZ ( 1 ) );
if(player[1].speed<=maxspeed){
player[1].speed+=player[1].xurdasguur;
}
else{
player[1].speed =maxspeed;
}
//dbPitchObjectDown(1,5);
}
if ( dbDownKey ( ) ){
if((player[1].speed-player[1].xurdasguur)>=0){
player[1].speed-=player[1].xurdasguur;
}
else{
player[1].speed=0;
}
}
if ( dbRightKey ( ) ){
dbSetMusicVolume(1,dbMusicVolume(1)-1);
//dbRotateCamera( dbObjectAngleX ( 1 ), dbObjectAngleY(1), dbObjectAngleZ ( 1 )+sens() );
//dbRotateObject ( 1, dbObjectAngleX ( 1 ), dbObjectAngleY ( 1 ), dbObjectAngleZ ( 1 )+sens() );
//dbTurnCameraRight(sens());
//dbTurnObjectRight(1,sens());
}
if ( dbLeftKey ( ) ){
dbSetMusicVolume(1,dbMusicVolume(1)+1);
//dbRotateCamera( dbObjectAngleX ( 1 ), dbObjectAngleY(1), dbObjectAngleZ ( 1 ) -sens());
//dbRotateObject ( 1, dbObjectAngleX ( 1 ), dbObjectAngleY ( 1 ), dbObjectAngleZ ( 1 )-sens() );
//dbTurnCameraLeft(sens());
//dbTurnObjectLeft (1,sens());
//dbZRotateObject(1,sens());
}
if ( dbMouseClick ( ) ){
if(dbTimer ( )%10==0)
{
dbMakeObjectSphere(sum_id,0.5);
dbPositionObject ( sum_id, dbObjectPositionX(player[1].id), dbObjectPositionY(player[1].id), dbObjectPositionZ(player[1].id));
dbScaleObject(sum_id,100,100,400);
dbColorObject ( sum_id, dbRgb ( 255 , 100 , 0 ) );
dbSetObjectSpecular(sum_id,dbRgb(255,255,0));
dbXRotateObject(sum_id,fCameraAngleX );
dbYRotateObject(sum_id,fCameraAngleY );
sum[sum_id].sum_speed=sum_speed;
sum[sum_id].onoson=0;
sum[sum_id].scale=0;
if( (sum_id+1)==(sum_max/2) ){
for ( int i = sum_id+1; i <=sum_max; i++ ){
dbDeleteObject ( i );
}
}
else if(sum_id+1>=sum_max){
for ( int i = sum_st; i <=sum_max/2; i++ ){
dbDeleteObject ( i );
}
sum_id=sum_st;
}
sum_id++;
}
}
if ( dbSpaceKey ( ) ){
if(dbTimer ( )%10==0)
{
dbMakeObjectSphere(roc_id,0.5);
dbPositionObject ( roc_id, dbObjectPositionX(player[1].id), dbObjectPositionY(player[1].id), dbObjectPositionZ(player[1].id));
dbScaleObject(roc_id,10,10,40);
dbColorObject ( roc_id, dbRgb ( 255 , 100 , 0 ) );
dbSetObjectSpecular(roc_id,dbRgb(255,255,0));
dbXRotateObject(roc_id,fCameraAngleX );
dbYRotateObject(roc_id,fCameraAngleY );
roc[roc_id].roc_speed=roc_speed;
roc[roc_id].onoson=0;
roc[roc_id].scale=0;
if( (roc_id+1)==(roc_max/2) ){
for ( int i = roc_id+1; i <=roc_max; i++ ){
dbDeleteObject ( i );
}
}
else if(roc_id+1>=roc_max){
for ( int i = roc_st; i <=roc_max/2; i++ ){
dbDeleteObject ( i );
}
roc_id=roc_st;
}
roc_id++;
}
}
for ( int j = obj_st; j <= obj_id; j++ ){
for ( int i = obj_st+1; i <= obj_id; i++ ){
if(i!=j){
if(dbObjectCollision(j,i)==1){
player_dead(i);
player_dead(j);
}
}
}
}
for ( int i = 1; i <= obj_id-obj_st; i++ ){
if(dbGetTerrainGroundHeight(1,dbObjectPositionX(player[i].id),dbObjectPositionZ(player[i].id))>dbObjectPositionY(player[i].id)){
player_dead(i);
}
}
for ( int j = sum_st; j <= sum_id; j++ ){
for ( int i = obj_st+1; i <= obj_id; i++ ){
if(dbObjectCollision(i,j)==1){
player_dead(i);
object_hit_sum(i,j);
}
}
}
for ( int j = sum_st; j <= sum_id; j++ ){
if(dbGetTerrainGroundHeight(1,dbObjectPositionX(j),dbObjectPositionZ(j))>dbObjectPositionY(j)){
sum[j].sum_speed=0;
sum[j].onoson=1;
}
}
for ( int i = sum_st; i <=sum_id; i++ ){
if(sum[i].onoson==1){
dbScaleObject(i,sum[i].scale,sum[i].scale,sum[i].scale);
sum[i].scale+=10;
dbPlayObject(i);
dbGhostObjectOn(i,0);
dbSetObjectAmbient(i,0);
if(sum[i].scale>10000){
sum[i].scale=0;
dbDeleteObject(i);
}
}
}
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
dbXRotateObject(player[1].id,fCameraAngleX );
dbYRotateObject(player[1].id,fCameraAngleY );
dbMoveCamera( player[1].speed );
dbMoveObject( player[1].id,player[1].speed );
for ( int i = sum_st; i <= sum_id; i++ ){
dbMoveObject(i,sum[i].sum_speed);
dbMoveObject(i,roc[i].roc_speed);
}
dbSync ( );
}
for ( int i = ter_st; i <=ter_id; i++ ){
dbDeleteObject ( i );
}
for ( int i = sum_st; i <=sum_id; i++ ){
dbDeleteObject ( i );
}
for ( int i = roc_st; i <=roc_id; i++ ){
dbDeleteObject ( i );
}
for ( int i = obj_st; i <=obj_id; i++ ){
dbDeleteObject ( i );
}
return;
}
usuhuu_oxi@yahoo.cm