ok, theres a lot, ill post some that i think could be causing a problem
Main Menu
//menu class
class CSetting;
class CMenu
{
private:
//variables
int Mode,iMode;
int Settings;
char* Heading;
//for moving the menu
bool ChangeMenu;
bool MenuChanged;
bool GoneBack;
bool MenuClear;
int MovingX,MovingY;
char* HelpString[32];
int MoveAccross;
//functions
public:
//functions
//Set up
void SystemSetUp(bool Advance);
//media
void MediaLoad ();
void MediaUnLoad();
//update
void SystemUpDate();
void MainDraw(int iiMode);
void MainInPut(int iiMode);
void MenuCameraMove();
void MainMenuChangeBox();
void MenuLoadHelpMenu(int Screen);
//draw system
void SubDrawChange();
void SubDrawSettings(bool A);
void SubDrawLobby(bool A);
void SubDrawHostJoin(bool A);
void SubDrawHostSetup(bool A);
void SubDrawProfile(bool A);
void SubDrawHelp(bool A);
CInBox CIB;
CApp CAP;
CSetting CSS;
};
void CMenu::SystemSetUp(bool Advance)
{
//set varibles
Mode=0;
//setup the box for menu
for(int i=0;i<=4;i++)
{CIB.BoxPointAdd(i+1,6,384+(i*64),200,384+(i*64)+32);}
CIB.BoxPointAdd(6,256,96,1014,128);//heading box
CIB.BoxPointAdd(7,256,148,1014,756);//main box
Heading="-1";
ChangeMenu=false;
MenuChanged=true;
GoneBack=true;
MovingX=768;
MovingY=0;
MenuClear=false;
iMode=0;
MoveAccross=42;
}
void CMenu::MediaLoad ()
{
//set up menu settings
dbLoadImage("Media\\MenuDisplayBack.tga",1);
dbLoadImage("Media\\MenuTitalDisplay.png",2);
}
void CMenu::MediaUnLoad()
{
//delete images
}
void CMenu::SystemUpDate()
{
MainDraw(Mode);
MainInPut(0);
MainMenuChangeBox();
}
void CMenu::MainInPut(int iiMode)
{
//check for input
//multiplayer
if (inputState.KeyPressed(VK_LBUTTON))
{
if (CIB.BoxPointInMouse(1)==true)
{iMode=2;Heading="Silent Fury - Multiplayer";ChangeMenu=true;}
//settings
else if (CIB.BoxPointInMouse(2)==true)
{iMode=1;Heading="Silent Fury - Game Settings";ChangeMenu=true;}
//profile
else if (CIB.BoxPointInMouse(3)==true)
{iMode=5;Heading="Silent Fury - Player Profile";ChangeMenu=true;}
//help
else if (CIB.BoxPointInMouse(4)==true)
{iMode=4;Heading="Silent Fury - Help Manual";ChangeMenu=true;}
//exit
else if (CIB.BoxPointInMouse(5)==true)
{Mode=-1;Heading="Silent Fury - Exit Game?";
DarkGDKExitApplication=true;MediaUnLoad();}
else if (CIB.BoxPointInMouse(7)==true)
{}
else
{ChangeMenu=true;iMode=0;}
if (Mode==0 && iMode>0){Mode=iMode;MoveAccross=42;}
}
}
void CMenu::MainDraw(int iiMode)
{
//paste main background
//Menu Boxz
for(int i=1;i<=5;i++)
{CIB.BoxPointDraw(i,3);}
/////////////////////////////
//switch case for menu Box //
/////////////////////////////
CIB.BoxMoveMode(true);
CIB.BoxMoveSetPos(MovingX,0);
switch(iiMode) {
//settings
case 1:SubDrawSettings(true);break;
//lobby
case 2:SubDrawLobby(true);break;
//hosting
case 3: SubDrawHostSetup(true);break;
//help file
case 4: SubDrawHelp(true); break;
//profile
case 5: SubDrawProfile(true);break; }
CIB.BoxMoveMode(false);
//////////////
//draw text///
//////////////
StartText();//draw the text
AAText(1,15,384+6,ALIGN_LEFT,"Multiplayer");//1
AAText(1,15,384+64+6,ALIGN_LEFT,"Settings");
AAText(1,15,384+128+6,ALIGN_LEFT,"Profile");
AAText(1,15,384+192+6,ALIGN_LEFT,"Help");
AAText(1,15,384+256+6,ALIGN_LEFT,"Exit");//5
//draw the heading
SetTextMove(true);
SetTextMovePos(MovingX,0);
if (Heading!="-1"){
AAText(1,266,100,ALIGN_LEFT,Heading);}
//end of menu draw
switch(iiMode) {
//settings
case 1:SubDrawSettings(false);break;
//lobby
case 2:SubDrawLobby(false);break;
//hosting
case 3: SubDrawHostSetup(false);break;
//help file
case 4: SubDrawHelp(false); break;
//profile
case 5: SubDrawProfile(false);break; }
EndText();
SetTextMove(false);
////////////////////////
//end of menu drawing //
///////////////////////
}
void CMenu::SubDrawChange()
{
//changing the subdrawing
switch(Mode)
{
//settings
case 1:
for(int i=1;i<=6;i++) //resolution, anti texture fileter, anti alsinging, sound, brightness and gamma
{CIB.BoxPointAdd(i+8+1 , 600 , (i*100)+100 , 1000 , (i*100)+150 ); }
//buttons
CIB.BoxPointAdd(20 ,270 ,700,270+181,748);//cancel button
CIB.BoxPointAdd(21,270+183,700,270+363,748);//defualt
CIB.BoxPointAdd(22,270+365,700,270+545,748);//apply
CIB.BoxPointAdd(23,270+547,700,270+727,748);//Supported
break;
//lobby
case 2:
CIB.BoxPointAdd(8 ,270 ,170,1000 ,690);//search box
CIB.BoxPointAdd(9 ,270 ,700,270+181,748);//refresh
CIB.BoxPointAdd(10,270+183,700,270+363,748);//filter
CIB.BoxPointAdd(11,270+365,700,270+545,748);//join
CIB.BoxPointAdd(12,270+547,700,270+727,748);//host
break;
//hosting
case 3:
break;
//help
case 4:
break;
//profile
//this is box settings places
CIB.BoxPointAdd(10,280,128,480,169); //name entry box
//charcter box
CIB.BoxPointAdd(11,590,150,990,700); //Main Box
CIB.BoxPointAdd(12,768,200,900,690);//Main Character Box
CIB.BoxPointAdd(13,270+365,700,270+545,748);//Head
CIB.BoxPointAdd(14,270+547,700,270+727,748);//Body
case 5:
CIB.BoxPointAdd(8,270,170,270+363,170+32); //user input box
break;
}
}
/*Sub draw main menu*/
void CMenu::SubDrawSettings(bool A)
{
if (A)
{
//main two boxs
CIB.BoxPointDraw(6,3);
CIB.BoxPointDraw(7,3);
//draw text
for(int i=1;i<=6;i++)
{CIB.BoxPointDraw(i+8,1);}
for(int i=0;i<4;i++)
{CIB.BoxPointDraw(i+20,1);}
}
else
{
AAText(2,285,160,ALIGN_LEFT,"Screen Resolution");
AAText(2,285,260,ALIGN_LEFT,"Sound Control");
AAText(2,285,360,ALIGN_LEFT,"Anti-Aliasing");
AAText(2,285,460,ALIGN_LEFT,"Antisotrapic Filter");
AAText(2,285,560,ALIGN_LEFT,"Full Screen Mode");
//draw enabled text
for(int i=1;i<=5;i++)
{
//status if enabled
AAText(1,270,(i*100)+110,ALIGN_LEFT,"Status");
if(CSS.SettingEnable(i))
{AAText(1,400,(i*100)+110,ALIGN_LEFT,"Enabled");}
else
{AAText(1,400,(i*100)+110,ALIGN_LEFT,"Disabled");}
}
//buttons text
AAText(1,270+91 , 712 ,ALIGN_CENTER, "Cancel" );
AAText(1,270+182+90 , 712 ,ALIGN_CENTER, "Default" );
AAText(1,270+384+90-20 , 712 ,ALIGN_CENTER, "Apply" );
AAText(1,270+547+90 , 712 ,ALIGN_CENTER, "Supported" );
CSS.SettingDrawAll(0);
}
}
void CMenu::SubDrawLobby(bool A)
{
if (A)
{
//main two boxs
CIB.BoxPointDraw(6,3);
CIB.BoxPointDraw(7,3);
//lobby search box
CIB.BoxPointDraw(8,1);
CIB.BoxPointDraw(9,1);
CIB.BoxPointDraw(10,1);
CIB.BoxPointDraw(11,1);
CIB.BoxPointDraw(12,1);
}
else
{
//buttons text
AAText(1,270+91 , 712 ,ALIGN_CENTER, "Refresh" );
AAText(1,270+182+90 , 712 ,ALIGN_CENTER, "Filter" );
AAText(1,270+384+90-20 , 712 ,ALIGN_CENTER, "Join Game");
AAText(1,270+547+90 , 712 ,ALIGN_CENTER, "Host" );
//info top bar.
AAText(1,270,150,ALIGN_LEFT,"Id"); //server num
AAText(1,320,150,ALIGN_LEFT,"Hosting Name");
AAText(1,580,150,ALIGN_LEFT,"Game Mode");
AAText(1,765,150,ALIGN_LEFT,"Ping");
AAText(1,870,150,ALIGN_LEFT,"Players");
}
}
void CMenu::SubDrawHostJoin(bool A)
{
if (A)
{
//main two boxs
CIB.BoxPointDraw(6,3);
CIB.BoxPointDraw(7,3);
}
}
void CMenu::SubDrawHostSetup(bool A)
{
if (A)
{
//main two boxs
CIB.BoxPointDraw(6,3);
CIB.BoxPointDraw(7,3);
}
}
void CMenu::SubDrawProfile(bool A)
{
if (A)
{
//main two boxs
CIB.BoxPointDraw(6,3);
CIB.BoxPointDraw(7,3);
//other boxxs
CIB.BoxPointDraw(10,1);
CIB.BoxPointDraw(11,1);
CIB.BoxPointDraw(12,1);
}
else
{
//Player name
}
}
void CMenu::SubDrawHelp(bool A)
{
if (A)
{
//main two boxs
CIB.BoxPointDraw(6,3);
CIB.BoxPointDraw(7,3);
}
else
{
//For Loop the Text
//for(int i=1;i<=32;i++)
//{AAText(1,522,160+(i*14),ALIGN_LEFT,HelpString[i]);}
}
}
void CMenu::MainMenuChangeBox()
{
int D=0;
//if changing menu
if (ChangeMenu==true)
{
//menu changed not true
MenuChanged=false;
if (iMode == 0 && Mode == 0)
{GoneBack=true;MovingX=768;Heading="-1";}
//has if gone back
if (GoneBack==false)
{
//if reached the end
if (MovingX>=768)
{
GoneBack=true;
Mode=iMode;
SubDrawChange();
}
else
{
MovingX+=MoveAccross;
MoveAccross++;
}
//else continue
}
else
{
if (MovingX<=0)
{GoneBack=false;
MenuChanged=true;
ChangeMenu=false;
MovingX=0;
Mode=iMode;
iMode=0;
SubDrawChange();
MoveAccross=0;
}
else
{
MovingX-=MoveAccross;
MoveAccross--;
} } }
}
void CMenu::MenuLoadHelpMenu(int Screen)
{
///////////////////
// Load help screen
////////////////////
// Variables
int LinesLoaded = 0;
//Open TextFile
}
// End
///////////////////////////////
Enviroment (Cpp)
#include "DarkGDK.h"
#include <iostream>
#include <fstream>
#include <string>
#include "MenuEnviroment.h"
using namespace std;
//class acces
void CMenuEnv::SetUp()
{
//varibales
ObjIdCount = 200;
TerrainObjId = 1;
SkyBoxId = 2;
App3DTital = 3;
MapLoaded = false;
SkyBoxLoaded = false;
TextId = 150;
}
void CMenuEnv::LoadEnviro(char* MapName)
{
//Load Media
bool A=false;
int TexLoad = 0;
//Load the sky box (check if exist)
SkyBoxId = 2;
if (!dbObjectExist(SkyBoxId))
{
dbLoadObject("Models\\sky01.x",SkyBoxId);
dbScaleObject(SkyBoxId,32000,32000,32000);
dbPositionObject(SkyBoxId,0,0,0);
dbSetObjectLight ( SkyBoxId, true );
dbSetObjectAmbient ( SkyBoxId , true );
}
//load Terrain
TerrainObjId=1;
if (!dbObjectExist(TerrainObjId))
{
if (dbFileExist("Maps\\MenuUI\\MenuUI_Detail.tga")){dbLoadImage("Maps\\MenuUI\\MenuUI_Detail.tga",5);}
if(dbFileExist("Maps\\MenuUI\\MenuUI_TexOverLay.bmp")){dbLoadImage("Maps\\MenuUI\\MenuUI_TexOverLay.bmp",6);}
dbSetupTerrain();
dbMakeObjectTerrain (TerrainObjId);
dbSetTerrainHeightmap (TerrainObjId, "Maps\\MenuUI\\MenuUI.bmp");
dbSetTerrainScale (TerrainObjId, 32,1,32);
dbSetTerrainSplit (TerrainObjId, 16);
dbSetTerrainTiling (TerrainObjId, 1);
dbSetTerrainLight (TerrainObjId, 1, -0.25, 0, 1, 1, 0.78, 0.5);
dbSetTerrainTexture (TerrainObjId, 6, 5);
dbBuildTerrain (TerrainObjId );
dbSetObjectNormals (TerrainObjId );
dbPositionObject (TerrainObjId, -1024, 0, -1024);
}
}
void CMenuEnv::LoadMenuTital()
{
/////////////////////////////
// Loading the menu tital ///
char* FileName = "Models\\Header3d.x";
if (dbFileExist(FileName)){
if (!dbObjectExist(App3DTital))
{
dbLoadObject ( FileName , App3DTital );
dbPositionObject ( App3DTital, 0, 256, 0);
dbScaleObject ( App3DTital,1000,1000,1000);
dbSetObjectLight ( App3DTital , true );
dbSetObjectAmbient ( App3DTital , true );
}}
}
void CMenuEnv::UnLoadEnviro()
{
///////////////////
//unloading the map
if (dbObjectExist(TerrainObjId)){dbDeleteObject(TerrainObjId);}
if (dbObjectExist(App3DTital)){dbDeleteObject(App3DTital);}
if (dbObjectExist(SkyBoxId)){dbDeleteObject(SkyBoxId);}
//Unload Object List
}
void CMenuEnv::UpDateEnviro()
{
////////////////////////////////
// Check for Object PlaceMents//
////////////////////////////////
}
void CMenuEnv::LoadObjectList()
{
//load map objects
///////////////////
//int variables
char* FilePath="Maps\\MenuUI\\MapObjList.MpList";
//check file exists
if (dbFileExist(FilePath))
{
//variables
ifstream MyFile (FilePath);
//can open
if (MyFile.is_open())
{
//read object amount
int Amount;
string MyStr;
getline(MyFile,MyStr);
//for loop
Amount = atoi(MyStr.c_str());
for ( int i = 1; i<=Amount ; i++ )
{
//read the line
getline ( MyFile , MyStr );
}
//end of for
////////////
}
}
}
void CMenuEnv::UnLoadObject()
{
}
Enviroment (H)
class CMenuEnv
{
//private
int ObjIdCount;
int TerrainObjId;
int SkyBoxId;
int App3DTital;
bool titalLoaded;
bool MapLoaded;
bool SkyBoxLoaded;
int TextId;
//int WeaponsIdStart;
//int WeaponsIdEnd;
//int ObjectsIdStart;
//int ObjectsIdEnd;
public: //public varibales'
void SetUp();
void LoadEnviro(char* MapName);
void UnLoadEnviro();
void LoadMenuTital();
void UpDateEnviro();
void LoadObjectList();
void UnLoadObject();
void LoadObjectsFromList();
void UnLoadObjectFromList();
};
In Box System
class CInBox
{
private:
int BoxPointX[64][2];
int BoxPointY[64][2];
bool BoxMove;
int Xmove;
int Ymove;
public:
void SystemSetUp();
void BoxPointAdd(int id,int x1,int y1,int x2,int y2);
void BoxPointDraw(int id,int Mode);
void BoxPointDelete(int id);
bool BoxPointInMouse(int Id);
void BoxMoveMode(bool On);
void BoxMoveSetPos(int x,int y);
void SystemExit();
};
void CInBox::SystemSetUp()
{
//set up the box points
for(int i=1;i<=64;i++)
{
BoxPointX[i][1]=-1;
BoxPointX[i][2]=-1;
BoxPointY[i][1]=-1;
BoxPointY[i][2]=-1;
}
//move variables
BoxMove=false;
Xmove=0;
Ymove=0;
}
void CInBox::BoxPointAdd(int id,int x1,int y1,int x2,int y2)
{
BoxPointX[id][1]=x1;
BoxPointY[id][1]=y1;
BoxPointX[id][2]=x2;
BoxPointY[id][2]=y2;
}
bool CInBox::BoxPointInMouse(int Id)
{
//check if its with in x1 and x2
int Check = 0;
//checking
if (dbMouseX()>BoxPointX[Id][1]){Check++;}
if (dbMouseX()<BoxPointX[Id][2]){Check++;}
if (dbMouseY()>BoxPointY[Id][1]){Check++;}
if (dbMouseY()<BoxPointY[Id][2]){Check++;}
if (Check>=4){return true;}else{return false;}
}
void CInBox::BoxPointDraw(int id,int Mode)
{
//switch case on mode
switch(Mode)
{
//outline
case 1:
if (BoxMove==true)
{dbBoxOutLine(BoxPointX[id][1]+Xmove,BoxPointY[id][1]+Ymove,BoxPointX[id][2]+Xmove,BoxPointY[id][2]+Ymove);}
else
{dbBoxOutLine(BoxPointX[id][1],BoxPointY[id][1],BoxPointX[id][2],BoxPointY[id][2]);}
break;
//un outlined
case 2:
dbTextColor(0,0,0);
if (BoxMove==true)
{dbBox(BoxPointX[id][1]+Xmove,BoxPointY[id][1]+Ymove,BoxPointX[id][2]+Xmove,BoxPointY[id][2]+Ymove);}
else
{dbBox(BoxPointX[id][1],BoxPointY[id][1],BoxPointX[id][2],BoxPointY[id][2]);}
dbTextColor(255,255,255);
break;
//box + outline
case 3:
dbTextColor(0,0,0);
if (BoxMove==true)
{dbBox(BoxPointX[id][1]+Xmove,BoxPointY[id][1]+Ymove,BoxPointX[id][2]+Xmove,BoxPointY[id][2]+Ymove);}
else
{dbBox(BoxPointX[id][1],BoxPointY[id][1],BoxPointX[id][2],BoxPointY[id][2]);}
dbTextColor(255,255,255);
if (BoxMove==true)
{dbBoxOutLine(BoxPointX[id][1]+Xmove,BoxPointY[id][1]+Ymove,BoxPointX[id][2]+Xmove,BoxPointY[id][2]+Ymove);}
else
{dbBoxOutLine(BoxPointX[id][1],BoxPointY[id][1],BoxPointX[id][2],BoxPointY[id][2]);}
break;
}
}
void CInBox::BoxPointDelete(int id)
{
//reset the points
BoxPointX[id][1]=-1;
BoxPointY[id][1]=-1;
BoxPointX[id][2]=-1;
BoxPointY[id][2]=-1;
}
void CInBox::SystemExit()
{
}
void CInBox::BoxMoveMode(bool On)
{
BoxMove=On;
}
void CInBox::BoxMoveSetPos(int x,int y)
{
Xmove=x;
Ymove=y;
}
InBox(cpp)
#include "DarkGDK.h"
#include "DarkSDK.h"
#include "CameraClass.h"
void CCamera::SetUp()
{
//set up camera
dbPositionCamera(1,0,0,0);
CurrentCamId = 1;
Mode = 1;
ShakeEffect = 0;
ShakeEffect2 = 0;
GunRecoil = 0;
ImpactEffectA = 0;ImpactEffectB = 0;
CameraMovingSpeed = 0;
}
void CCamera::CameraUpDate()
{
//camera update
if (Mode==1)
{CameraMenuUpDate();}
if (Mode==2)
{CameraGameUpDate();}
}
void CCamera::CameraMenuUpDate()
{
//main menu control
//in game camera control
dbYRotateCamera ( 1 , dbCameraAngleY( 1 ) - 90 );
dbMoveCamera ( 1 , 3 );
dbYRotateCamera ( 1 , dbCameraAngleY( 1 ) + 90 );
dbPointCamera(1,0,0,0);
dbPositionCamera(1,dbCameraPositionX(1),384,dbCameraPositionZ(1));
}
void CCamera::CameraGameUpDate()
{
}
void CCamera::CameraModeChange(int iMode)
{
switch(iMode)
{
case 1:
dbPositionCamera(1,512,384,0);
dbColorBackdrop ( 1 , dbRGB ( 2 , 2 , 2 ) );
dbPointCamera( 1 , 0 , 0 , 0 );
dbSetCameraFOV ( 1 , 80);
break;
case 2:
dbPositionCamera(1,0,0,0);
break;
}
}
void CCamera::EndCamera()
{
}
InBox (H)
class CCamera
{
//private
int CurrentCamId;
int Mode;
int ShakeEffect;
int ShakeEffect2;
int GunRecoil;
int ImpactEffectA,ImpactEffectB;
int CameraMovingSpeed;
public:
void SetUp();
void CameraUpDate();
void CameraMenuUpDate();
void CameraGameUpDate();
void CameraModeChange(int iMode);
void EndCamera();
};
Problem Solution That Never Fails: "Build A Bridge And Get Over It"