Jump to content
  • Advertisement
Sign in to follow this  
ShadowPhoenix

[DirectX - DarkCDG] HELP! Crashes under release!

This topic is 3887 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

http://rapidshare.com/files/88979891/FirstTest.zip.html ^- Direct linky to working debug version. For some reason it works fine for debug version, but crashes horribly for release version... Can someone please help me with it?

// Dark GDK - The Game Creators - www.thegamecreators.com


// include Dark GDK header file
#include "DarkGDK.h"

#define rows 8 // FIRST LEFT COL HAS 8 ITEMS UP AND DOWN  Y
#define blocksInRows 12 // LEFT AND RIGHT X 
#define WIDTH 1280
#define HEIGHT 1024

void makeRow(int blocks,bool*row) // MUST FREE AFTER USE
{
	if(blocks<=0)
		return;
      if(row==NULL)
	return;//OH CRAP	
			
    for(int i=0;i<blocks;i++)
		if(rand()%3==1)
			row=false;
		else 
			row=true;
   int truth=0;

for(int i=0;i<blocks;i++)
truth+=(int)row;

		if(truth==0)
		row[rand()%8]=false;

	

}


void DarkGDK ( void )
{
	

dbSetDisplayMode(WIDTH,HEIGHT,32);
dbSetWindowOff ();
dbRandomize ( dbTimer ( ) );



	dbMakeObjectSphere ( 1, 1 );
	 dbSetShadowShadingOn(1);
	 dbPositionObject(1,0,0,0);
//SPHERE PLAYER
	dbMakeObjectBox(7,1,18,1);
	dbMakeObjectBox(8,1,18,1);
// WALLS
	for(int i=0;i<(rows*blocksInRows);i++)
	//dbMakeObjectBox(20,(float)WIDTH/blocksInRows,(float)HEIGHT/(rows*40),1);
		{
			 
		dbMakeObjectBox(i+20,1.8,.15,1);
		dbPositionObject(i+20,(float)(i%rows)*2.0-7.0,(float)(i/blocksInRows)*2-8.0,0.0);
		dbSetShadowShadingOn(i+20);
		}
// FLOORS
	dbPositionObject(7,-7,-2,.0);
	dbPositionObject(8,7,-2,.0);

	dbColorObject(1,dbRGB(dbRND(255),dbRND(255),dbRND(255)));
	dbPositionObject(1,0,0,0);

dbPositionCamera(0,5,-10); 
dbPitchCameraDown ( 15 ) ;

bool* boxes = (bool*) malloc(sizeof(bool)*rows*blocksInRows);
for(int i=0;i<rows;i++)
makeRow(blocksInRows,boxes+i*blocksInRows);
/*dbOpenToWrite(1,"temp.txt");

for(int i=0;i<rows;i++)
{
	dbWriteFile(1,(int)'\n');
	for(int j=0;j<blocksInRows;j++)
	{dbWriteFile(1,(int)boxes[j+i*blocksInRows]);
		dbWriteFile(1,' ');

	}
}*/

	while ( LoopGDK ( ) )
	{
		dbInk(dbRGB(255,0,0),0);
		dbText( 0, 0, dbStr( dbScreenFPS( ) ) );
		if ( dbEscapeKey ( ) )
			return;
     if(dbLeftKey())
		 if(dbObjectPositionX(1)>-5.5)
		dbMoveObjectLeft(1,.5);
	if(dbRightKey())
		 if(dbObjectPositionX(1)<5.5)
		dbMoveObjectRight(1,.5);

for(int i=0;i<(rows*blocksInRows);i++)
	dbMoveObjectUp(i+20,.03);

//
for(int i=0;i<(rows*blocksInRows);i++)
if(dbObjectPositionY(i)>6.5)
if(rand()%3) // SCREW EVERYONE
dbPositionObject(i,dbObjectPositionX(i),-9.0,0.0);
	
	dbMoveObjectDown(1,.04);

for(int i=0;i<rows*blocksInRows;i++)
if(dbAbs(dbObjectPositionY(i+20)-dbObjectPositionY(1))<1.1)
   if(dbAbs(dbObjectPositionX(i+20)-dbObjectPositionX(1))<(1.1+1.8))
	   dbMoveObjectUp(1,.01);


		dbSync ( );
	}
	

			dbDeleteObject ( 1 );
		
	dbRestoreDisplayMode();


}

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!