Jump to content
  • Advertisement

LagunaCloud

Member
  • Content Count

    39
  • Joined

  • Last visited

Community Reputation

122 Neutral

About LagunaCloud

  • Rank
    Member
  1. LagunaCloud

    Re: Flight Sim rotational problem

    In my first version of the game I did rotate it about the world axis, but in this version I'm rotating the ship itself, also I've picked up a book called "Mathematics for 3D Game Programming & Computer Graphics." and it does have stuff on Quaternions and arbitrary rotations and stuff so I was going to redo my rotation code to include this new stuff and I'll post to let you guys know how it goes.
  2. LagunaCloud

    Re: Flight Sim rotational problem

    That's one of my big problems, I can't figure out how to do that successfully. How would you set it up where I rotate its axis and not the points? [Edited by - LagunaCloud on January 7, 2006 3:57:09 PM]
  3. I'm writing a flight sim space shooter game and I'm having a problem with the rotations. I need to rotate twice, once for the z axis, and once for the x axis. My problem is that when I rotate on one axis, then on the other, it goofs up at different angles. Now I figure I have to rotate once, reset the points then rotate again, and somehow combine the two points for the correct direction but it's not working... this->Rotate->RotateXAxis(&this->Ship->GetModelVertices(),ATOR(this->ShipAngle->X)); this->Rotate->RotateZAxis(&this->Ship->GetModelVertices(),ATOR(this->ShipAngle->Z)); void cls_ROTATION::RotateXAxis(VERTICES* Pos,float Radians) { float Sum=0.0f; float Answer[3]; float RotXMatrix[3][3]={1.0f, 0.0f, 0.0f, 0.0f,((float)cos(Radians)),((float)-sin(Radians)), 0.0f,((float)sin(Radians)),((float)cos(Radians))}; for(int i = 0; i < 3; i++) { Sum += Pos->X * RotXMatrix[0]; Sum += Pos->Y * RotXMatrix[1]; Sum += Pos->Z * RotXMatrix[2]; Answer = Sum; Sum = 0.0f; } Pos->X = Answer[0]; Pos->Y = Answer[1]; Pos->Z = Answer[2]; } void cls_ROTATION::RotateZAxis(VERTICES* Pos,float Radians) { float Sum=0.0f; float Answer[3]; float RotZMatrix[3][3]={ (float) cos(Radians),(float)-sin(Radians),0.0f, (float) sin(Radians),(float) cos(Radians),0.0f, 0.0f, 0.0f, 1.0f}; for(int i = 0; i < 3; i++) { Sum += Pos->X * RotZMatrix[0]; Sum += Pos->Y * RotZMatrix[1]; Sum += Pos->Z * RotZMatrix[2]; Answer = Sum; Sum = 0.0f; } Pos->X = Answer[0]; Pos->Y = Answer[1]; Pos->Z = Answer[2]; }
  4. LagunaCloud

    Text Based RPG Videos

    I agree, I didn't watch them all but I have to applaud the effort, maybe I'll send some of the people I'm trying to teach to this forum.
  5. Funny how one seemingly insignificant pointer will completely kill everything... My pointer for my appname and class name was just switched to a non pointer and everything is running now...wierd
  6. I'm having problems with the new version of c++ I have. I write a program that crashes on me all the time... then I move it back over to 6.0, and it runs fine! What's the deal! I'd think that it would work the same since it's still c++, but I have no books that tell me what's different about it.
  7. LagunaCloud

    Re: Init Direct3d error

    Perhaps... I don't know where it would be doing that, but in all my initialization I use the directX 8 calls.
  8. I've got a strange error, when I was using visual studio 6.0 I had no problems when I got visual studio.net, my computer was crashing when I tried to run my program without debugging, then when I went into debug mode, it ran fine, so I placed a bunch of messageboxes all over the place telling me what succeeds and doesn't and my init direct 3d is failing, why? BOOL cls_GFX::InitD3D(void) { if((id3d8 = Direct3DCreate8(D3D_SDK_VERSION)) == NULL) {//if could not create the direct3D8 interface then return FALSE; //Return false } return TRUE; }
  9. LagunaCloud

    Re: Batch Building

    Do you mean like bad pointers and such? Cause I'm using alot of pointers which are thrown around. I does compile, but when I run it, it gives me an error.
  10. I'm having some problems using the batch build release, I'm not entirely sure how it works and such, but my program will run perfectly if I use the debug exe, but when I switch to the release, it doesn't work... I have no idea why it doesn't, any help would be nice, thanx in advance.
  11. Hey I'm having problems when I try to enumerate sound devices, If I use the first one enumerated, it works, but if I put on any other, it returns with a DSERR_NODRIVER. I have no idea why it does that, any thoughts?
  12. LagunaCloud

    Problems with Direct Input

    I tried both and it didn't make a difference, but what I did notice is that my keyboard and mouse were not polling and acquiring right away, so I took it out of my init joysticks function, and it worked. So Woo Hoo!
  13. LagunaCloud

    Problems with Direct Input

    The order in which I re-initialize is as follows: DeleteWindow(); ResetDevice(); CreateDevice(); if(FullScreen) { InitFullscreen(); } else { InitWindowedMode(); } LoadFiles(); SetupInput(); SetupKeyboard(); SetupJoysticks(); Now that's not exactly how my code looks it just a summary of my code: It finds the Joysticks when I first startup the program, but when I switch to a new windowed mode, it no longer is able to find em. When I switch to a Fullscreen mode it finds them. It doesn't make any sense to me.
  14. LagunaCloud

    Problems with Direct Input

    This is my initialize function; BOOL cls_JOYSTICK::InitJoystick(HWND* hWnd) { BOOL Success; HRESULT hr; DIPROPRANGE diprg; DIDEVCAPS g_diDevCaps; init = true; hwnd = hWnd; int NumOfTries = 0; if(FAILED(idi8->EnumDevices(DI8DEVCLASS_GAMECTRL, EnumJoysticks, this, DIEDFL_ATTACHEDONLY))) { return FALSE; } ii = 0; //Static member to access my EnumJoysticks Function; for(int i = 0; i < Joystick[0].NumOfJoysticks; i++) { if(FAILED(Joystick.Data->SetDataFormat(&c_dfDIJoystick2))) { Joystick.Data->Release(); Joystick.Data = NULL; return FALSE; } if(FAILED(Joystick.Data->SetCooperativeLevel(*hwnd,DISCL_FOREGROUND | DISCL_NONEXCLUSIVE))) { Joystick.Data->Release(); Joystick.Data = NULL; return FALSE; } g_diDevCaps.dwSize = sizeof(DIDEVCAPS); if (FAILED(hr = Joystick.Data->GetCapabilities(&g_diDevCaps))) return hr; diprg.diph.dwSize = sizeof( diprg ); diprg.diph.dwHeaderSize = sizeof( diprg.diph ); diprg.diph.dwObj = 0; diprg.diph.dwHow = DIPH_DEVICE; diprg.lMin = JOYMIN; diprg.lMax = JOYMAX; if ( FAILED( Joystick.Data->SetProperty( DIPROP_RANGE, &diprg.diph ) ) ) return FALSE; // Set deadzone. DIPROPDWORD dipdw; dipdw.diph.dwSize = sizeof( dipdw ); dipdw.diph.dwHeaderSize = sizeof( dipdw.diph ); dipdw.diph.dwObj = 0; dipdw.diph.dwHow = DIPH_DEVICE; dipdw.dwData = JOYDEAD; if ( FAILED( Joystick.Data->SetProperty( DIPROP_DEADZONE, &dipdw.diph ) ) ) return FALSE; // Set saturation. dipdw.dwData = JOYSAT; if ( FAILED( Joystick.Data->SetProperty( DIPROP_SATURATION, &dipdw.diph ) ) ) return FALSE; // Find out if force feedback available. DIDEVCAPS didc; didc.dwSize = sizeof( DIDEVCAPS ); if ( FAILED(Joystick.Data->GetCapabilities( &didc ) ) ) return FALSE; // m_FFAvailable = ( didc.dwFlags & DIDC_FORCEFEEDBACK ); // If it's a force feedback stick, turn off autocenter so it doesn't // get in the way of our effects. if ( didc.dwFlags & DIDC_FORCEFEEDBACK ) { DIPROPDWORD DIPropAutoCenter; DIPropAutoCenter.diph.dwSize = sizeof( DIPropAutoCenter ); DIPropAutoCenter.diph.dwHeaderSize = sizeof( DIPROPHEADER ); DIPropAutoCenter.diph.dwObj = 0; DIPropAutoCenter.diph.dwHow = DIPH_DEVICE; DIPropAutoCenter.dwData = 0; Joystick.Data->SetProperty( DIPROP_AUTOCENTER, &DIPropAutoCenter.diph ); } else {} do{ Joystick.Data->Poll(); Success = SUCCEEDED(Joystick.Data->Acquire()); NumOfTries++; }while(!Success && NumOfTries < 10); if(!Success)break; } NumOfJoysticks = unsigned char(i); if(i != 0 && Success) { Joy = Joystick[0].Data; return TRUE; } return FALSE; } This code is my initialize fullscreen BOOL cls_GFX::InitDispModeFull(int SizeX,int SizeY,int Bits) { // char Bytes; D3DFORMAT Fmt,AltFmt; Hal = TRUE; ZBuffer = TRUE; if(FAILED(id3d8->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&d3ddm))) {//if not able to get current display mode return FALSE; //return false } ZeroMemory(&d3dpp,sizeof(D3DPRESENT_PARAMETERS)); d3dpp.Windowed = FALSE; d3dpp.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC; d3dpp.BackBufferCount = NumOfBackBuffers; d3dpp.BackBufferWidth = SizeX; d3dpp.BackBufferHeight = SizeY; d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE; // or D3DPRESENT_INTERVAL_DEFAULT or D3DPRESENT_INTERVAL_IMMEDIATE //Bytes = GetFormat(d3ddm.Format); switch(Bits) { case 32: Fmt =D3DFMT_X8R8G8B8; AltFmt =D3DFMT_X8R8G8B8; break; case 24: Fmt =D3DFMT_R8G8B8; AltFmt =D3DFMT_R8G8B8; break; case 16: Fmt =D3DFMT_R5G6B5; AltFmt =D3DFMT_X1R5G5B5; break; case 8: Fmt =D3DFMT_P8; AltFmt =D3DFMT_P8; break; default: return FALSE; } if(FAILED(id3d8->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Fmt, Fmt, FALSE))) { if(FAILED(id3d8->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, AltFmt, AltFmt, FALSE))) { Hal = FALSE; } } if(!Hal) if(FAILED(id3d8->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, Fmt, Fmt, FALSE))) { if(FAILED(id3d8->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, AltFmt, AltFmt, FALSE))) { MessageBox(NULL,"ERROR: COULD NOT INITIALIZE FORMAT","ERROR",NULL); return FALSE; } else { Fmt = AltFmt; } } d3dpp.BackBufferFormat = Fmt; if(ZBuffer) { d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; } else { d3dpp.EnableAutoDepthStencil = FALSE; } return TRUE; } These are my functions for initializing windowed mode //Initialize Windowed Display mode BOOL cls_GFX::InitDispModeWind(void) { ZBuffer = FALSE; Hal = TRUE; if(FAILED(id3d8->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&d3ddm))) {//if not able to get current display mode return FALSE; //return false } return TRUE; } //Initialize Windowed presentation mode BOOL cls_GFX::InitPresentWind(int SizeX,int SizeY) { ZeroMemory(&d3dpp,sizeof(d3dpp)); //Zero the memory d3dpp.Windowed = TRUE; //Set windowed mode d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; //Set the Swap effect d3dpp.BackBufferCount = NumOfBackBuffers; d3dpp.BackBufferWidth = SizeX; d3dpp.BackBufferHeight = SizeY; d3dpp.BackBufferFormat = d3ddm.Format; //Set the back buffer format return TRUE; } Now the problem is that when I resize the display in fullscreen mode the joysticks reinitialize just fine but when I resize the display to windowed mode it isn't able to aquire the joysticks? [Edited by - LagunaCloud on November 28, 2005 9:21:06 PM]
  15. LagunaCloud

    Problems with Direct Input

    Okay now it's even weirder... It did reset everything and such, but it doesn't reinitialize the Joystick when I switch to a new windowed mode, but when I switch to a fullscreen mode, It works.
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!