Pasza196 Temat założony przez niniejszego użytkownika |
format pliku dll. » 2009-02-23 18:57:49 Witam chciałbym zapytać czy ktoś by mógł z tego kodu: centity_t * getEntityByIndex( int index ) { return & cg_entities[ index ]; }
int target = - 1; vec3_t pAngles;
qboolean isVisible( int index ) { centity_t * cent = getEntityByIndex( index ); trace_t tr; CG_Trace( & tr, cg.refdef.vieworg, vec3_origin, vec3_origin, cent->ent.origin, cg.chasedNum + 1, MASK_OPAQUE ); if( tr.fraction == 1.0 ) return qtrue; else return qfalse; }
qboolean isValidPlayer( int index ) { if( index != cgs.playerNum || index != cg.chasedNum ) return qfalse; return qtrue; }
void calcAimingOrigin( int index ) { vec3_t forward, right, up, tAngles; centity_t * cent = getEntityByIndex( index ); VectorCopy( cent->ent.origin, pAngles ); AngleVectors( tAngles, forward, right, up ); pAngles = pAngles + forward; pAngles = pAngles + right; pAngles = pAngles + up; }
void searchTarget() { target = - 1; for( int index = 0; index < MAX_CLIENTS; index++ ) { if( isValidPlayer( index ) && isVisible( index ) ) { target = index; break; } } }
if( target != - 1 ) { if( cg_aim->integer ) { float vecScreen[ 2 ]; calcAimingOrigin( target ); trap_R_TransformVectorToScreen( & cg.refdef, pAngles, vecScreen ); if( cg_aim->integer == 1 ) SetCursorPos( vecScreen[ 0 ], vecScreen[ 1 ] ); else if( cg_aim->integer == 2 ) VectorCopy( pAngles, cg.refdef.viewangles ); } if( cg_shoot->integer ) { usercmd_t cmd; trap_NET_GetUserCmd( trap_NET_GetCurrentUserCmdNum(), & cmd ); cmd.buttons |= BUTTON_ATTACK; } } zrobić plik dll. a jak nie to proszę o nakierowanie mnie jak to zrobić Pozdrawiam Ps. jak nie chcesz pomóc to nie pisze głupot |
|
pekfos |
» 2009-02-23 19:07:06 poszukaj. było już tu kilka takich tematów; na początku nowy projekt->biblioteka dll tam gdzie jest #if BUILDING_DLL # define DLLIMPORT __declspec (dllexport) #else # define DLLIMPORT __declspec (dllimport) #endif
ma być #if BUILDING_DLL # define DLLIMPORT __declspec (dllexport) # define DLLFUNCTION __stdcall __declspec (dllexport) #else # define DLLIMPORT __declspec (dllimport) # define DLLFUNCTION __stdcall __declspec (dllimport) #endif
a funkcje przykładowo int dodaj( int, int ); napisać trzeba tak int DLLFUNCTION dodaj( int, int ); na samym początku pliku.h napisz extern "C" aby nie było tworzenia dziwacznych przerobionych nazw. to w pliku *.h a w *.cpp definicje funkcji. tak jak ta: int DLLFUNCTION dodaj( int a, int b ); DLLFUNCTION jest do funkcji a DLLIMPORT do klas to chyba wszystko; |
|
DejaVu |
» 2009-02-23 19:10:23 |
|
Pasza196 Temat założony przez niniejszego użytkownika |
» 2009-02-23 19:22:49 wiem że nie powinienem prosić ale czy mógłby ktoś zrobić mi tą dll???? zielony jestem w programowaniu a potrzebuje ten plik;) |
|
pekfos |
» 2009-02-23 19:59:19 przerób ten kod i dokładnie zapoznaj sie z jego działaniem a może sie czegoś nauczysz:) Plik: dllmain.cpp #include "dll.h" #include <windows.h>
centity_t * DLLFUNCTION getEntityByIndex( int index ) { return & cg_entities[ index ]; }
int target = - 1; vec3_t pAngles;
qboolean DLLFUNCTION isVisible( int index ) { centity_t * cent = getEntityByIndex( index ); trace_t tr; CG_Trace( & tr, cg.refdef.vieworg, vec3_origin, vec3_origin, cent->ent.origin, cg.chasedNum + 1, MASK_OPAQUE ); if( tr.fraction == 1.0 ) return qtrue; else return qfalse; }
qboolean DLLFUNCTION isValidPlayer( int index ) { if( index != cgs.playerNum || index != cg.chasedNum ) return qfalse; return qtrue; }
void DLLFUNCTION calcAimingOrigin( int index ) { vec3_t forward, right, up, tAngles; centity_t * cent = getEntityByIndex( index ); VectorCopy( cent->ent.origin, pAngles ); AngleVectors( tAngles, forward, right, up ); pAngles = pAngles + forward; pAngles = pAngles + right; pAngles = pAngles + up; }
void DLLFUNCTION searchTarget() { target = - 1; for( int index = 0; index < MAX_CLIENTS; index++ ) { if( isValidPlayer( index ) && isVisible( index ) ) { target = index; break; } } }
BOOL APIENTRY DllMain( HINSTANCE hInst , DWORD reason , LPVOID reserved ) { switch( reason ) { case DLL_PROCESS_ATTACH: break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return TRUE; }
Plik: dll.hextern "C" #ifndef _DLL_H_ #define _DLL_H_
#if BUILDING_DLL # define DLLFUNCTION __stdcall __declspec (dllexport) #else # define DLLFUNCTION __stdcall __declspec (dllimport) #endif
centiy_t * DLLFUNCTION getEntityByIndex( int ); qboolean DLLFUNCTION isVisible( int ); qboolean DLLFUNCTION isValidPlayer( int ); void DLLFUNCTION calcAimingOrigin( int ); void DLLFUNCTION searchTarget();
#endif
|
|
« 1 » |