#ifndef ONI_SYMBOLS_H #define ONI_SYMBOLS_H #include "bool.h" #include #include "oni_gl.h" #include "Oni_Character.h" #include "BFW_ScriptLang.h" #define DefVar(type, name, address) extern type* _##name //variables ///BADBAD DONT DO THIS extern onibool* _ai2_deaf; extern char* _AKgDebug_DebugMaps; extern HINSTANCE* _g_Instance; extern ONtPlatformData* _ONgPlatformData; extern char* _opt_ignore_private_data; extern char* _opt_sound; //DO THIS INSTEAD! DefVar( GameState* , ONgGameState , 0x005ece7c ); DefVar( bool, BFgDebugFileEnable, 0x0055c8d0 ); DefVar( bool, SSgSearchOnDisk, 0x005eb758); DefVar( char, M3gResolutionSwitch, 0x00531634); DefVar( gl_engine_t*, gl_eng, 0x00560600 ); DefVar( gl_api_t*, gl_api, 0x00560604 ); DefVar( WORD*, gl_gamma_ramp, 0x0055fdfc ); DefVar( int, gl_gamma_ramp_valid, 0x005603fc ); DefVar( uint32_t, COgConsoleLines , 0x005cb468 ); DefVar( uint32_t, COgFadeTimeValue , 0x00533f68 ); DefVar( uint32_t, COgDefaultTextShade , 0x00533f70 ); DefVar( uint32_t, COgDefaultTextShadow , 0x00533f74 ); DefVar( FILE*, ONgFileStartup , 0x005711b8 ); #undef DefVar //Yes, I'm aware that there are a few ways this could go wrong //but in the interests of neatness and not having to go through and rename all the variables //and use annoying dereferencing, this will do. //...too bad there is no way to nest #defines... #define AKgDebug_DebugMaps (*_AKgDebug_DebugMaps) #define ai2_deaf (*_ai2_deaf) #define g_Instance (*_g_Instance) #define M3gResolutionSwitch (*_M3gResolutionSwitch) #define ONgGameState (*_ONgGameState) #define ONgPlatformData (*_ONgPlatformData) #define opt_ignore_private_data (*_opt_ignore_private_data) #define opt_sound (*_opt_sound) #define BFgDebugFileEnable (*_BFgDebugFileEnable) #define SSgSearchOnDisk (*_SSgSearchOnDisk) #define gl_gamma_ramp (*_gl_gamma_ramp) #define gl_gamma_ramp_valid (*_gl_gamma_ramp_valid) #define gl_api (*_gl_api) #define gl_eng (*_gl_eng) #define COgConsoleLines (*_COgConsoleLines) #define COgFadeTimeValue (*_COgFadeTimeValue) #define COgDefaultTextShade (*_COgDefaultTextShade) #define COgDefaultTextShadow (*_COgDefaultTextShadow) #define ONgFileStartup (*_ONgFileStartup) #undef $ //functions //__fastcall isn't neccessary if you specify the correct calling convention. typedef int64_t ( *_UUrMachineTime_High)(); typedef double ( *_UUrMachineTime_High_Frequency)(); typedef int64_t ( *_UUrMachineTime_Sixtieths)(); typedef void ( *_UUrPlatform_Initialize)(); typedef void ( *_UUrPlatform_Terminate)(); typedef FILE* ( __cdecl *_oni_fopen)(const char*, const char*); typedef int ( __cdecl *_oni_fprintf)(FILE*, const char*, ...); typedef int ( __cdecl *_oni_fflush)(FILE*); typedef void ( __cdecl *_ONiMain)(int ArgCount, char *ArgList[]); typedef short ( *_ONrPlatform_Initialize)(ONtPlatformData *PlatformData); typedef LRESULT ( CALLBACK *_ONrPlatform_WindowProc)(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam); typedef unsigned int ( *_gl_enumerate_valid_display_modes)(M3tDisplayMode modes[16]); typedef int ( *_gl_platform_set_pixel_format)(HDC hdc); typedef int ( *_gl_platform_initialize)(); typedef float ( *_ONrPersist_GetGamma)(); typedef uint8_t ( *_ONrPersist_GetWonGame)(); typedef void ( __cdecl *_UUrStartupMessage)(const char* fmt, ...); typedef int16_t ( *_ONrGameState_NewCharacter)(void* CHAR, void* AISA, void* flag, uint32_t* list_location); typedef ActiveCharacter* ( *_ONrGetActiveCharacter)(void* CharacterPtr); typedef void ( *_ONrCharacter_NewAnimationHook)(Character *ioCharacter, ActiveCharacter *ioActiveCharacter); //int16_t ONICALL ONrGameState_GetPlayerCharacter(); typedef void ( *_COrTextArea_Print)(uint32_t area, uint32_t priority, uint32_t textshade, uint32_t textshadowshade, const char* text, uint32_t unk_alwaws_0, uint32_t fadetime); typedef uint8_t ( *_ONrCheater)(uint32_t cheat); typedef int ( __cdecl *_AUrMessageBox)(int Buttons, char *Message, ...); typedef char* ( *_SSrMessage_Find)(char* message_key); //Returns a prompt message from a message key typedef void ( *_ONiGameState_FindAutoPromptMessage)(char* Note, void* ptr); typedef uint16_t (ONICALL *sl_func)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); typedef uint16_t (ONICALL *_SLrScript_Command_Register_ReturnType)(char* name, char* desc, char* argfmt, sl_type type, sl_func callback); typedef uint16_t (ONICALL *_SLrScript_Command_Register_Void)(char* name, char* desc, char* argfmt, sl_func callback); typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_Int32)(char* name, char* desc, int32_t* data); typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_Float)(char* name, char* desc, float* data); typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_String)(char* name, char* desc, char* data); typedef int ( *_COrMessage_Print)(char* Message, char* Key, void* noidea); typedef void ( *_COrConsole_StatusLine_Display)(); typedef int16_t ( *_TMrInstance_GetDataPtr)(int tag, char* name, void* pointer); typedef char* ( *_TMrInstance_GetInstanceName)(void* InstancePointer); typedef int16_t ( *_TSrContext_DrawText)(uint32_t TSrContext, char* Text, int alpha, uint32_t usuallyzero, void* pRect); //int16_t TSrContext_New ( TSFF*, size 7, ??? 1, ??? 1, ??? 0, TSrContext*); typedef int16_t ( *_TSrContext_New)( void* FontInstance, int size, int hthsik1,int hthsik2,int hthsik3, void* TSrContext); typedef int16_t ( *_TSrContext_SetShade)( void *ioTextContext, uint32_t inShade); typedef uint16_t ( *_TRrAnimation_GetDuration)(int Animation); typedef uint16_t ( *_TRrAnimation_GetTo)(int Animation); typedef uint16_t ( *_TRrAnimation_GetFrom)(int Animation); typedef void ( *_ONrCharacter_SetHitPoints)( Character *ioCharacter, uint32_t inHitPoints); typedef void ( *_ONrCorpse_Create)(Character* Character); //yes im cheating so badly. typedef uint16_t ( *_iSetCharacterClass)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); typedef uint16_t ( *_AI2iScript_Spawn)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); typedef void * ( *_OBJrObjectType_GetObject_ByNumber)(int inObjectType, int inIndex); typedef int ( *_OBJiObjectGroup_GetNumObjects)(void *inObjectGroup); typedef void ( *_ONrGameState_DeleteCharacter)(Character *inCharacter); typedef char (*OBJtEnumCallback_Object)( void *inObject, int inUserData); typedef int ( *_OBJrObjectType_EnumerateObjects)( int inObjectType, OBJtEnumCallback_Object inEnumCallback, int inUserData); typedef void ( *_OBJrDoor_Open)( DoorObject *inObject, Character *inCharacter ); typedef void ( *_OBJrDoor_ForceOpen)(short id); #define ExtFunc(name) extern _##name name ExtFunc(SLrScript_Command_Register_ReturnType); ExtFunc(SLrScript_Command_Register_Void); ExtFunc(SLrGlobalVariable_Register_Int32); ExtFunc(SLrGlobalVariable_Register_Float); ExtFunc(SLrGlobalVariable_Register_String); ExtFunc(COrConsole_StatusLine_Display); ExtFunc(OBJrObjectType_EnumerateObjects); //ExtFunc(OBJiObjectGroup_GetNumObjects); ExtFunc(AI2iScript_Spawn); ExtFunc(TRrAnimation_GetDuration); ExtFunc(TRrAnimation_GetFrom); ExtFunc(TRrAnimation_GetTo); extern _UUrMachineTime_High UUrMachineTime_High; extern _UUrMachineTime_High_Frequency UUrMachineTime_High_Frequency; extern _UUrMachineTime_Sixtieths UUrMachineTime_Sixtieths; extern _UUrPlatform_Initialize UUrPlatform_Initialize; extern _UUrPlatform_Terminate UUrPlatform_Terminate; extern _oni_fopen oni_fopen; extern _oni_fprintf oni_fprintf; extern _oni_fflush oni_fflush; extern _ONiMain ONiMain; extern _ONrPlatform_Initialize ONrPlatform_Initialize; extern _ONrPlatform_WindowProc ONrPlatform_WindowProc; ExtFunc(COrMessage_Print); ExtFunc(TMrInstance_GetDataPtr); ExtFunc(TMrInstance_GetInstanceName); ExtFunc(gl_enumerate_valid_display_modes); ExtFunc(gl_platform_set_pixel_format); ExtFunc(gl_platform_initialize); ExtFunc(ONrPersist_GetGamma); ExtFunc(ONrPersist_GetWonGame); ExtFunc(UUrStartupMessage); ExtFunc(ONrCharacter_NewAnimationHook); ExtFunc(ONrCharacter_SetHitPoints); ExtFunc(ONrGameState_NewCharacter); ExtFunc(ONrGameState_DeleteCharacter); ExtFunc(ONrGetActiveCharacter); ExtFunc(ONrCorpse_Create); ExtFunc(iSetCharacterClass); ExtFunc(COrTextArea_Print); ExtFunc(ONrCheater); ExtFunc(AUrMessageBox); ExtFunc(SSrMessage_Find); ExtFunc(ONiGameState_FindAutoPromptMessage); ExtFunc(TSrContext_DrawText); ExtFunc(TSrContext_New); ExtFunc(TSrContext_SetShade); ExtFunc(OBJrDoor_Open); ExtFunc(OBJrDoor_ForceOpen); #endif