OldSchoolHack

Registrieren / Anmelden Deutsch

Benutzersuche: kung foo man

Such-Informationen
kung foo man
Themen im Forum
Thema Forum Letzter Beitrag Beiträge Zugriffe
icon

Go to first new post Polygon in Welt zeichnen Erstellt am: Sa 7. Sep 2013, 23:03

kung foo man

preview Vorschau

Go To Post

Moin Leute,

hat mal jemand "echte" Polygone in die CoD2-Welt eingefügt? Ich habe cuBot und Tatnium in Visual Studio kombiniert, sodass ich jetzt D3D-Funktionen hooken kann, aber wenn ich DirectX Tutorials folge, kann ich keine Polygone zeichen. Das Fenster bleibt dann einfach schwarz. Diesen Code verwende ich bisher:

TEXT Code:
  1.  
  2. HRESULT APIENTRY hkIDirect3DDevice9::EndScene()
  3. {
  4.     #if 1
  5.     struct CUSTOMVERTEX
  6.     {
  7.     FLOAT x, y, z, rhw;    // from the D3DFVF_XYZRHW flag
  8.     DWORD color;    // from the D3DFVF_DIFFUSE flag
  9.     };
  10.  
  11.     static int first = 1;
  12.     static LPDIRECT3DVERTEXBUFFER9 v_buffer = NULL;
  13.  
  14.     printf("HRESULT APIENTRY hkIDirect3DDevice9::EndScene(%d)\n", first);
  15.     if (first)
  16.     {
  17.         first = 0;
  18.  
  19.         #define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
  20.  
  21.         CUSTOMVERTEX vertices[] =
  22.         {
  23.         { 1551.0f+320, 2663.0f+ 50, 415.0f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), },
  24.         { 1551.0f+520, 2663.0f+400, 415.0f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },
  25.         { 1551.0f+120, 2663.0f+400, 415.0f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
  26.         };
  27.  
  28.         m_pD3Ddev->CreateVertexBuffer(3*sizeof(struct CUSTOMVERTEX), 0, CUSTOMFVF, D3DPOOL_MANAGED, &v_buffer, NULL);
  29.  
  30.         VOID* pVoid;    // the void pointer
  31.  
  32.         v_buffer->Lock(0, 0, (void**)&pVoid, 0);
  33.         memcpy(pVoid, vertices, sizeof(vertices));
  34.         v_buffer->Unlock();
  35.     }
  36.  
  37.     LPDIRECT3DSTATEBLOCK9 pStateBlock = NULL;
  38.     m_pD3Ddev->CreateStateBlock( D3DSBT_ALL, &pStateBlock );  
  39.     pStateBlock->Capture();
  40.  
  41.         //m_pD3Ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
  42.         //m_pD3Ddev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);//<-
  43.         //m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  44.         //m_pD3Ddev->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
  45.         //m_pD3Ddev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCCOLOR);
  46.         //m_pD3Ddev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR);
  47.  
  48.     //D3DVECTOR vEyePt    = {0.0f, 0.0f, -10.0f };
  49.     //D3DVECTOR vLookatPt = {0.0f, 0.0f,   0.0f };
  50.     //D3DVECTOR vUpVec    = {0.0f, 1.0f,   0.0f };
  51.     //D3DMATRIX matWorld, matView, matProj;
  52.     //
  53.     //
  54.     //D3DUtil_SetIdentityMatrix( matWorld );
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.     //m_pD3Ddev->SetFVF(CUSTOMFVF); // select which vertex format we are using
  62.     m_pD3Ddev->SetStreamSource(0, v_buffer, 0, sizeof(struct CUSTOMVERTEX)); // select the vertex buffer to display
  63.     m_pD3Ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); // copy the vertex buffer to the back buffer
  64.  
  65.     pStateBlock->Apply();
  66.     pStateBlock->Release();
  67.     #endif
  68.  
  69.     return m_pD3Ddev->EndScene();
  70. }
  71.  

Ich hoffe, hier gibt's noch ein paar fähige Leute.

Das ganze soll eine CoD2-Erweiterung werden, mit der bullet physics engine.


Viele Grüße,
kung foo man
Call of Duty 2

Mi 11. Sep 2013, 09:52

von KN4CK3R Go to last post
7 749
icon

Go to first new post Polygon in Welt zeichnen Erstellt am: Sa 7. Sep 2013, 23:03

kung foo man

preview Vorschau

Go To Post

Ich habe jetzt herausgefunden, warum alles schwarz geworden ist (Crash). Die Engine lädt beim Map-Beginn D3D neu und alle gespeicherten Vertices etc. sind dann natürlich ungültig. Nachdem ich die jetzt immer reinitialisiere, funktionert es ohne Crash, jedoch kann ich noch kein Polygon sehen.

Ich muss wahrscheinlich noch eine Matrix setzen, aber das muss ich morgen ausprobieren.
Call of Duty 2

Mi 11. Sep 2013, 09:52

von KN4CK3R Go to last post
7 749
icon

Go to first new post Polygon in Welt zeichnen Erstellt am: Sa 7. Sep 2013, 23:03

kung foo man

preview Vorschau

Go To Post

Jo genau, nur weiß ich nicht, ob es sich bei der Sphere um eine "echte" Sphere handelt. Also ob D3D die Sphere per Projektionsmatrix erzeugt oder ob der Programmierer jede einzelne Linie durch eine world2screen-Funktion gejagd hat und dann nur 2D auf der Oberfläche zeichnet.

In OpenGL wäre das einfach:
glPushMatrix()
glLoadIdentity()
glTransform(Position von Objekt)
glRotate(...)
glBegin()
glVertex(Fixe Objekt-Koordinaten)
glEnd()
glPopMatrix()

Mit D3D komme ich nicht klar. :S
Call of Duty 2

Mi 11. Sep 2013, 09:52

von KN4CK3R Go to last post
7 749
icon

Go to first new post Polygon in Welt zeichnen Erstellt am: Sa 7. Sep 2013, 23:03

kung foo man

preview Vorschau

Go To Post

Zitat von KN4CK3R

Wie genau du die anderen Matrizen setzen musst (Projection und View) kann ich dir grad nicht sagen und ist sicher spielabhängig.

Der FOV für die Projektion ist natürlich cvar-Abhängig, aber genau diesen Code brauche ich. Egal was ich probiere, ich kann die Matrizen nicht ändern.

TEXT Code:
  1.  
  2. D3DXMATRIXA16 matView;
  3. D3DXMATRIXA16 matProj;
  4. matView._41 = matView._42 = matView._43 = 0.0f;
  5. D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/2, 1.0f, 0.5f, 10000.0f );
  6. m_pD3Ddev->SetTransform( D3DTS_PROJECTION, &matProj );
  7. m_pD3Ddev->SetTransform( D3DTS_VIEW,       &matView );
  8. m_pD3Ddev->SetRenderState( D3DRS_ZENABLE,  FALSE );
  9.  
  10. m_pD3Ddev->SetStreamSource(0, v_buffer, 0, sizeof(struct CUSTOMVERTEX)); // select the vertex buffer to display
  11. m_pD3Ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); // copy the vertex buffer to the back buffer
  12.  

Das Polygon bleibt einfach links/oben orthogonal sitzen...

Edit: Die Methode setTransform() im Tatnium Basehook funktioniert einfach nicht! Ich habe diese Code geschrieben und nichts wird ausgegeben:

TEXT Code:
  1.  
  2. HRESULT APIENTRY hkIDirect3DDevice9::SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix)
  3. {
  4.     printf("Set Transform!\n");
  5.     if (State == D3DTS_PROJECTION)
  6.     {
  7.         printf("Set Projection!\n");
  8.         return NULL;
  9.     }
  10.     return m_pD3Ddev->SetTransform(State, pMatrix);
  11.  

Weiß jemand, wie man setTransform in Tatnium funktionsfähig macht? Das wäre ultimativ.
Call of Duty 2

Mi 11. Sep 2013, 09:52

von KN4CK3R Go to last post
7 749
icon

Go to first new post [Release] CoD2 chams Erstellt am: Fr 4. Feb 2011, 18:55

KN4CK3R

preview Vorschau

Go To Post

File ist leider down, war Source auch dabei?
Call of Duty 2

Sa 7. Sep 2013, 22:43

von kung foo man Go to last post
1 3908
Downloads
Es wurden keine entsprechenden Downloads gefunden.