Show
Ignore:
Timestamp:
08/16/10 21:15:24 (21 months ago)
Author:
Carsten
Message:

Re-established most of the client functionality:

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cafu/branches/cafu_to_wx/Ca3DE/Client/ClientStateInGame.cpp

    r116 r119  
    383383            Graphs.PosZ   [ClientFrameNr & (512-1)]=((unsigned short)(OurEntityCurrentState->Origin.z/20.0)) & 511; 
    384384 
     385            MatSys::Renderer->PushMatrix(MatSys::RendererI::PROJECTION    ); 
     386            MatSys::Renderer->PushMatrix(MatSys::RendererI::MODEL_TO_WORLD); 
     387            MatSys::Renderer->PushMatrix(MatSys::RendererI::WORLD_TO_VIEW ); 
     388 
     389            MatSys::Renderer->SetMatrix(MatSys::RendererI::PROJECTION, 
     390                // Note that the far plane is located at infinity for our stencil shadows implementation! 
     391                // A fovY of 67.5 corresponds to a fovX of 90.0 when the aspect ratio is 4:3. 
     392                MatrixT::GetProjPerspectiveMatrix(67.5f, float(FrameSize.GetWidth())/float(FrameSize.GetHeight()), 100.0f, -1.0f)); 
     393 
     394            MatSys::Renderer->SetMatrix(MatSys::RendererI::MODEL_TO_WORLD, MatrixT()); 
     395            MatSys::Renderer->SetMatrix(MatSys::RendererI::WORLD_TO_VIEW,  MatrixT()); 
     396 
    385397            World->Draw(FrameTime, OurEntityCurrentState); 
     398 
     399            MatSys::Renderer->PopMatrix(MatSys::RendererI::PROJECTION    ); 
     400            MatSys::Renderer->PopMatrix(MatSys::RendererI::MODEL_TO_WORLD); 
     401            MatSys::Renderer->PopMatrix(MatSys::RendererI::WORLD_TO_VIEW ); 
    386402 
    387403            // Die Framerate ist zwar World-unabhängig, ihre Anzeige hier aber besser aufgehoben (aus rein kosmetischen Gründen). 
     
    811827    if (World) 
    812828    { 
    813         cf::GuiSys::GuiI* ActiveGui=cf::GuiSys::GuiMan->GetTopmostActiveAndInteractive(); 
     829        cf::GuiSys::GuiI*  ActiveGui =cf::GuiSys::GuiMan->GetTopmostActiveAndInteractive(); 
     830        const wxMouseState MouseState=wxGetMouseState(); 
    814831        assert(ActiveGui!=NULL);    // The GUI of the client for the world output must always be there. 
    815832 
    816833        // This is unfortunately needed, because the users last click (in the GUI) that brought us here may still have the "LMB up" event pending. 
    817 #if 0 
    818         WasLMBOnceUp|=(SingleOpenGLWindow->GetMouseButtonState() & 0x1)==0; 
     834        WasLMBOnceUp=WasLMBOnceUp || !MouseState.LeftIsDown(); 
    819835 
    820836        // FIXME: Should test for ActiveGui==ClientGui instead of ActiveGui->GetScriptName()=="". 
    821837        if (ActiveGui->GetScriptName()=="" && WasLMBOnceUp) 
    822838        { 
    823             if (SingleOpenGLWindow->GetMouseButtonState() & 0x1) PlayerCommand.Keys|=PCK_Fire1;  // Button 0 
    824             if (SingleOpenGLWindow->GetMouseButtonState() & 0x6) PlayerCommand.Keys|=PCK_Fire2;  // Button 1 oder 2 
     839            if (MouseState.LeftIsDown())                               PlayerCommand.Keys|=PCK_Fire1; 
     840            if (MouseState.MiddleIsDown() || MouseState.RightIsDown()) PlayerCommand.Keys|=PCK_Fire2; 
    825841 
    826842            // Alle anderen Keys via KeyboardState bestimmen und über die volle Frametime anwenden. 
     
    828844            // Mit anderen Worten: Diesen Kram mit in die obige Buffer-Schleife nehmen! 
    829845            // Player movement / state 
    830          // if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_RCONTROL   ]) ;                                       // R_Strg   Run 
    831             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_RSHIFT     ] ||                                       // R_Shift  Stealth 
    832                 SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_LSHIFT     ]) PlayerCommand.Keys|=PCK_Walk;           // L_Shift  Stealth 
    833             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_UP         ] ||                                       // Up       Walk forward 
    834                 SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_W          ]) PlayerCommand.Keys|=PCK_MoveForward;    // W        Walk forward 
    835             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_DOWN       ] ||                                       // Down     Walk backward 
    836                 SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_S          ]) PlayerCommand.Keys|=PCK_MoveBackward;   // S        Walk backward 
    837             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_A          ] ||                                       // A        Strafe left 
    838                 SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_COMMA      ]) PlayerCommand.Keys|=PCK_StrafeLeft;     // ,        Strafe left 
    839             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_D          ] ||                                       // D        Strafe right 
    840                 SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_PERIOD     ]) PlayerCommand.Keys|=PCK_StrafeRight;    // .        Strafe right 
    841             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_R          ]) PlayerCommand.Keys|=PCK_Fire1;          // R        Fire/Respawn 
    842             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_RETURN     ] ||                                       // RETURN   Use 
    843                 SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_NUMPADENTER]) PlayerCommand.Keys|=PCK_Use;            // ENTER    Use 
    844             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_LEFT       ]) PlayerCommand.Keys|=PCK_TurnLeft;       // Left     Turn left 
    845             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_RIGHT      ]) PlayerCommand.Keys|=PCK_TurnRight;      // Right    Turn right 
    846             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_PGDN       ]) PlayerCommand.Keys|=PCK_LookUp;         //          Look up 
    847             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_PGUP       ]) PlayerCommand.Keys|=PCK_LookDown;       //          Look down 
    848          // if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_HOME       ]) PlayerCommand.Keys|=PCK_BankCW          //          Bank CW 
    849          // if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_INSERT     ]) PlayerCommand.Keys|=PCK_BankCCW;        //          Bank CCW 
    850             if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_END        ]) PlayerCommand.Keys|=PCK_CenterView; 
    851         } 
    852 #endif 
     846         // if (wxGetKeyState(WXK_CONTROL)     ) ;                                       // R_Strg   Run 
     847            if (wxGetKeyState(WXK_SHIFT)       ) PlayerCommand.Keys|=PCK_Walk;           // Shift  Stealth 
     848            if (wxGetKeyState(WXK_UP) ||                                                 // Up       Walk forward 
     849                wxGetKeyState(wxKeyCode('W'))  ) PlayerCommand.Keys|=PCK_MoveForward;    // W        Walk forward 
     850            if (wxGetKeyState(WXK_DOWN) ||                                               // Down     Walk backward 
     851                wxGetKeyState(wxKeyCode('S'))  ) PlayerCommand.Keys|=PCK_MoveBackward;   // S        Walk backward 
     852            if (wxGetKeyState(wxKeyCode('A')) ||                                         // A        Strafe left 
     853                wxGetKeyState(wxKeyCode(','))  ) PlayerCommand.Keys|=PCK_StrafeLeft;     // ,        Strafe left 
     854            if (wxGetKeyState(wxKeyCode('D')) ||                                         // D        Strafe right 
     855                wxGetKeyState(wxKeyCode('.'))  ) PlayerCommand.Keys|=PCK_StrafeRight;    // .        Strafe right 
     856            if (wxGetKeyState(wxKeyCode('R'))  ) PlayerCommand.Keys|=PCK_Fire1;          // R        Fire/Respawn 
     857            if (wxGetKeyState(WXK_RETURN) ||                                             // RETURN   Use 
     858                wxGetKeyState(WXK_NUMPAD_ENTER)) PlayerCommand.Keys|=PCK_Use;            // ENTER    Use 
     859            if (wxGetKeyState(WXK_LEFT        )) PlayerCommand.Keys|=PCK_TurnLeft;       // Left     Turn left 
     860            if (wxGetKeyState(WXK_RIGHT       )) PlayerCommand.Keys|=PCK_TurnRight;      // Right    Turn right 
     861            if (wxGetKeyState(WXK_PAGEDOWN    )) PlayerCommand.Keys|=PCK_LookUp;         //          Look up 
     862            if (wxGetKeyState(WXK_PAGEUP      )) PlayerCommand.Keys|=PCK_LookDown;       //          Look down 
     863         // if (wxGetKeyState(WXK_HOME        )) PlayerCommand.Keys|=PCK_BankCW          //          Bank CW 
     864         // if (wxGetKeyState(WXK_INSERT      )) PlayerCommand.Keys|=PCK_BankCCW;        //          Bank CCW 
     865            if (wxGetKeyState(WXK_END         )) PlayerCommand.Keys|=PCK_CenterView; 
     866        } 
    853867 
    854868