orpheu_stocks.inc
Original include source with line numbers.
| 1 | |
| 2 | #if defined _orpheu_stocks_included |
| 3 | #endinput |
| 4 | #endif |
| 5 | #define _orpheu_stocks_included |
| 6 | |
| 7 | #include <orpheu_const> |
| 8 | #include <orpheu> |
| 9 | #include <orpheu_advanced> |
| 10 | |
| 11 | |
| 12 | /** |
| 13 | * Retrieves an engine function handler by having its name as a member of the struct that hold |
| 14 | * engine functions and the name that you give it in the file where you define the function |
| 15 | * The name must be the same as the one in the file where the function is defined |
| 16 | * |
| 17 | * @param memberName The name of the member of the struct that holds the address of the function |
| 18 | * Example: pfnPrecacheModel |
| 19 | * The struct representation can be seen in hlsdk at multiplayer/engine/eiface.h with the name "enginefuncs_s" |
| 20 | * |
| 21 | * @param libFunctionName The name of the function as it is in the file where the function is defined |
| 22 | * |
| 23 | * @return A handler to the function |
| 24 | */ |
| 25 | stock OrpheuFunction:OrpheuGetEngineFunction(const memberName[],const libFunctionName[]) |
| 26 | { |
| 27 | static OrpheuStruct:engineFunctions |
| 28 | |
| 29 | if(!engineFunctions) |
| 30 | { |
| 31 | engineFunctions = OrpheuGetEngineFunctionsStruct() |
| 32 | } |
| 33 | |
| 34 | return OrpheuCreateFunction( OrpheuGetStructMember(engineFunctions,memberName),libFunctionName ) |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Retrieves a dll function handler by having its name as a member of the struct that hold |
| 39 | * dll functions and the name that you give it in the file where you define the function |
| 40 | * The name must be the same as the one in the file where the function is defined |
| 41 | * |
| 42 | * @param memberName The name of the member of the struct that holds the address of the function |
| 43 | * Example: pfnGameInit |
| 44 | * The struct representation can be seen in hlsdk at multiplayer/engine/eiface.h with the name "DLL_FUNCTIONS" |
| 45 | * |
| 46 | * @param libFunctionName The name of the function as it is in the file where the function is defined |
| 47 | * |
| 48 | * @return A handler to the function |
| 49 | */ |
| 50 | stock OrpheuFunction:OrpheuGetDLLFunction(const memberName[],const libFunctionName[]) |
| 51 | { |
| 52 | static OrpheuStruct:OrpheuDLLFunctions |
| 53 | |
| 54 | if(!OrpheuDLLFunctions) |
| 55 | { |
| 56 | OrpheuDLLFunctions = OrpheuGetDLLFunctionsStruct() |
| 57 | } |
| 58 | |
| 59 | return OrpheuCreateFunction( OrpheuGetStructMember(OrpheuDLLFunctions,memberName),libFunctionName ) |
| 60 | } |
| 61 | |
| 62 | stock OrpheuHook:OrpheuRegisterHookFromClass(const entityClassName[],const libFunctionName[],const libClassName[],const hookFunctionName[],OrpheuHookPhase:phase = OrpheuHookPre) |
| 63 | { |
| 64 | return OrpheuRegisterHook(OrpheuGetFunctionFromClass(entityClassName,libFunctionName,libClassName),hookFunctionName,phase) |
| 65 | } |
| 66 | |
| 67 | stock OrpheuHook:OrpheuRegisterHookFromEntity(id,const libFunctionName[],const libClassName[],const hookFunctionName[],OrpheuHookPhase:phase = OrpheuHookPre) |
| 68 | { |
| 69 | return OrpheuRegisterHook(OrpheuGetFunctionFromEntity(id,libFunctionName,libClassName),hookFunctionName,phase) |
| 70 | } |
| 71 | |
| 72 | stock OrpheuHook:OrpheuRegisterHookFromObject(object,const libFunctionName[],const libClassName[],const hookFunctionName[],OrpheuHookPhase:phase = OrpheuHookPre) |
| 73 | { |
| 74 | return OrpheuRegisterHook(OrpheuGetFunctionFromObject(object,libFunctionName,libClassName),hookFunctionName,phase) |
| 75 | } |
| 76 | |