[567] | 1 | #ifndef ONI_SYMBOLS_H
|
---|
| 2 | #define ONI_SYMBOLS_H
|
---|
| 3 | #include "bool.h"
|
---|
| 4 | #include <stdio.h>
|
---|
| 5 | #include "oni_gl.h"
|
---|
| 6 | #include "Oni_Character.h"
|
---|
| 7 | #include "BFW_ScriptLang.h"
|
---|
| 8 | #define DefVar(type, name, address) extern type* _##name
|
---|
| 9 | //variables
|
---|
| 10 |
|
---|
| 11 | ///BADBAD DONT DO THIS
|
---|
| 12 | extern onibool* _ai2_deaf;
|
---|
| 13 | extern char* _AKgDebug_DebugMaps;
|
---|
| 14 | extern HINSTANCE* _g_Instance;
|
---|
| 15 | extern ONtPlatformData* _ONgPlatformData;
|
---|
| 16 | extern char* _opt_ignore_private_data;
|
---|
| 17 | extern char* _opt_sound;
|
---|
| 18 |
|
---|
| 19 | //DO THIS INSTEAD!
|
---|
| 20 | DefVar( GameState* , ONgGameState , 0x005ece7c );
|
---|
| 21 |
|
---|
| 22 | DefVar( bool, BFgDebugFileEnable, 0x0055c8d0 );
|
---|
| 23 | DefVar( bool, SSgSearchOnDisk, 0x005eb758);
|
---|
| 24 | DefVar( char, M3gResolutionSwitch, 0x00531634);
|
---|
| 25 | DefVar( gl_engine_t*, gl_eng, 0x00560600 );
|
---|
| 26 | DefVar( gl_api_t*, gl_api, 0x00560604 );
|
---|
| 27 | DefVar( WORD*, gl_gamma_ramp, 0x0055fdfc );
|
---|
| 28 | DefVar( int, gl_gamma_ramp_valid, 0x005603fc );
|
---|
| 29 | DefVar( uint32_t, COgConsoleLines , 0x005cb468 );
|
---|
| 30 | DefVar( uint32_t, COgFadeTimeValue , 0x00533f68 );
|
---|
| 31 | DefVar( uint32_t, COgDefaultTextShade , 0x00533f70 );
|
---|
| 32 | DefVar( uint32_t, COgDefaultTextShadow , 0x00533f74 );
|
---|
| 33 | DefVar( FILE*, ONgFileStartup , 0x005711b8 );
|
---|
| 34 |
|
---|
| 35 | #undef DefVar
|
---|
| 36 | //Yes, I'm aware that there are a few ways this could go wrong
|
---|
| 37 | //but in the interests of neatness and not having to go through and rename all the variables
|
---|
| 38 | //and use annoying dereferencing, this will do.
|
---|
| 39 |
|
---|
| 40 | //...too bad there is no way to nest #defines...
|
---|
| 41 | #define AKgDebug_DebugMaps (*_AKgDebug_DebugMaps)
|
---|
| 42 | #define ai2_deaf (*_ai2_deaf)
|
---|
| 43 | #define g_Instance (*_g_Instance)
|
---|
| 44 | #define M3gResolutionSwitch (*_M3gResolutionSwitch)
|
---|
| 45 | #define ONgGameState (*_ONgGameState)
|
---|
| 46 | #define ONgPlatformData (*_ONgPlatformData)
|
---|
| 47 | #define opt_ignore_private_data (*_opt_ignore_private_data)
|
---|
| 48 | #define opt_sound (*_opt_sound)
|
---|
| 49 | #define BFgDebugFileEnable (*_BFgDebugFileEnable)
|
---|
| 50 | #define SSgSearchOnDisk (*_SSgSearchOnDisk)
|
---|
| 51 | #define gl_gamma_ramp (*_gl_gamma_ramp)
|
---|
| 52 | #define gl_gamma_ramp_valid (*_gl_gamma_ramp_valid)
|
---|
| 53 | #define gl_api (*_gl_api)
|
---|
| 54 | #define gl_eng (*_gl_eng)
|
---|
| 55 | #define COgConsoleLines (*_COgConsoleLines)
|
---|
| 56 | #define COgFadeTimeValue (*_COgFadeTimeValue)
|
---|
| 57 | #define COgDefaultTextShade (*_COgDefaultTextShade)
|
---|
| 58 | #define COgDefaultTextShadow (*_COgDefaultTextShadow)
|
---|
| 59 | #define ONgFileStartup (*_ONgFileStartup)
|
---|
[573] | 60 |
|
---|
| 61 |
|
---|
[567] | 62 | #undef $
|
---|
| 63 |
|
---|
| 64 | //functions
|
---|
| 65 | //__fastcall isn't neccessary if you specify the correct calling convention.
|
---|
| 66 | typedef int64_t ( *_UUrMachineTime_High)();
|
---|
| 67 | typedef double ( *_UUrMachineTime_High_Frequency)();
|
---|
| 68 | typedef int64_t ( *_UUrMachineTime_Sixtieths)();
|
---|
| 69 | typedef void ( *_UUrPlatform_Initialize)();
|
---|
| 70 | typedef void ( *_UUrPlatform_Terminate)();
|
---|
| 71 |
|
---|
| 72 | typedef FILE* ( __cdecl *_oni_fopen)(const char*, const char*);
|
---|
| 73 | typedef int ( __cdecl *_oni_fprintf)(FILE*, const char*, ...);
|
---|
| 74 | typedef int ( __cdecl *_oni_fflush)(FILE*);
|
---|
| 75 |
|
---|
| 76 | typedef void ( __cdecl *_ONiMain)(int ArgCount, char *ArgList[]);
|
---|
| 77 | typedef short ( *_ONrPlatform_Initialize)(ONtPlatformData *PlatformData);
|
---|
| 78 | typedef LRESULT ( CALLBACK *_ONrPlatform_WindowProc)(HWND Window, UINT Message,
|
---|
| 79 | WPARAM WParam, LPARAM LParam);
|
---|
| 80 | typedef unsigned int ( *_gl_enumerate_valid_display_modes)(M3tDisplayMode modes[16]);
|
---|
| 81 | typedef int ( *_gl_platform_set_pixel_format)(HDC hdc);
|
---|
| 82 | typedef int ( *_gl_platform_initialize)();
|
---|
| 83 |
|
---|
| 84 | typedef float ( *_ONrPersist_GetGamma)();
|
---|
| 85 | typedef uint8_t ( *_ONrPersist_GetWonGame)();
|
---|
| 86 |
|
---|
| 87 | typedef void ( __cdecl *_UUrStartupMessage)(const char* fmt, ...);
|
---|
| 88 | typedef int16_t ( *_ONrGameState_NewCharacter)(void* CHAR, void* AISA,
|
---|
| 89 | void* flag, uint32_t* list_location);
|
---|
| 90 | typedef ActiveCharacter* ( *_ONrGetActiveCharacter)(void* CharacterPtr);
|
---|
[573] | 91 | typedef void ( *_ONrCharacter_NewAnimationHook)(Character *ioCharacter, ActiveCharacter *ioActiveCharacter);
|
---|
[567] | 92 | //int16_t ONICALL ONrGameState_GetPlayerCharacter();
|
---|
| 93 |
|
---|
| 94 | typedef void ( *_COrTextArea_Print)(uint32_t area, uint32_t priority,
|
---|
| 95 | uint32_t textshade, uint32_t textshadowshade,
|
---|
| 96 | const char* text, uint32_t unk_alwaws_0, uint32_t fadetime);
|
---|
| 97 | typedef uint8_t ( *_ONrCheater)(uint32_t cheat);
|
---|
| 98 | typedef int ( __cdecl *_AUrMessageBox)(int Buttons, char *Message, ...);
|
---|
| 99 | typedef char* ( *_SSrMessage_Find)(char* message_key); //Returns a prompt message from a message key
|
---|
| 100 | typedef void ( *_ONiGameState_FindAutoPromptMessage)(char* Note, void* ptr);
|
---|
| 101 |
|
---|
| 102 | typedef uint16_t (ONICALL *sl_func)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret);
|
---|
| 103 | typedef uint16_t (ONICALL *_SLrScript_Command_Register_ReturnType)(char* name, char* desc, char* argfmt, sl_type type, sl_func callback);
|
---|
| 104 | typedef uint16_t (ONICALL *_SLrScript_Command_Register_Void)(char* name, char* desc, char* argfmt, sl_func callback);
|
---|
| 105 | typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_Int32)(char* name, char* desc, int32_t* data);
|
---|
| 106 | typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_Float)(char* name, char* desc, float* data);
|
---|
| 107 | typedef uint16_t (ONICALL *_SLrGlobalVariable_Register_String)(char* name, char* desc, char* data);
|
---|
| 108 |
|
---|
| 109 | typedef int ( *_COrMessage_Print)(char* Message, char* Key, void* noidea);
|
---|
[572] | 110 | typedef void ( *_COrConsole_StatusLine_Display)();
|
---|
[567] | 111 | typedef int16_t ( *_TMrInstance_GetDataPtr)(int tag, char* name, void* pointer);
|
---|
| 112 | typedef char* ( *_TMrInstance_GetInstanceName)(void* InstancePointer);
|
---|
| 113 |
|
---|
| 114 | typedef int16_t ( *_TSrContext_DrawText)(uint32_t TSrContext, char* Text, int alpha, uint32_t usuallyzero, void* pRect);
|
---|
| 115 | //int16_t TSrContext_New ( TSFF*, size 7, ??? 1, ??? 1, ??? 0, TSrContext*);
|
---|
| 116 | typedef int16_t ( *_TSrContext_New)( void* FontInstance, int size, int hthsik1,int hthsik2,int hthsik3, void* TSrContext);
|
---|
| 117 |
|
---|
[573] | 118 | typedef int16_t ( *_TSrContext_SetShade)(
|
---|
| 119 | void *ioTextContext,
|
---|
| 120 | uint32_t inShade);
|
---|
| 121 |
|
---|
| 122 | typedef uint16_t ( *_TRrAnimation_GetDuration)(int Animation);
|
---|
| 123 | typedef uint16_t ( *_TRrAnimation_GetTo)(int Animation);
|
---|
| 124 | typedef uint16_t ( *_TRrAnimation_GetFrom)(int Animation);
|
---|
| 125 |
|
---|
| 126 | typedef void
|
---|
| 127 | ( *_ONrCharacter_SetHitPoints)(
|
---|
| 128 | Character *ioCharacter,
|
---|
| 129 | uint32_t inHitPoints);
|
---|
| 130 | typedef void ( *_ONrCorpse_Create)(Character* Character);
|
---|
[568] | 131 | //yes im cheating so badly.
|
---|
| 132 | typedef uint16_t ( *_iSetCharacterClass)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret);
|
---|
[573] | 133 | typedef uint16_t ( *_AI2iScript_Spawn)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret);
|
---|
| 134 | typedef void * ( *_OBJrObjectType_GetObject_ByNumber)(int inObjectType, int inIndex);
|
---|
| 135 | typedef int ( *_OBJiObjectGroup_GetNumObjects)(void *inObjectGroup);
|
---|
[567] | 136 |
|
---|
[573] | 137 | typedef void ( *_ONrGameState_DeleteCharacter)(Character *inCharacter);
|
---|
| 138 |
|
---|
| 139 | typedef char (*OBJtEnumCallback_Object)(
|
---|
| 140 | void *inObject,
|
---|
| 141 | int inUserData);
|
---|
| 142 |
|
---|
| 143 | typedef int ( *_OBJrObjectType_EnumerateObjects)(
|
---|
| 144 | int inObjectType,
|
---|
| 145 | OBJtEnumCallback_Object inEnumCallback,
|
---|
| 146 | int inUserData);
|
---|
| 147 |
|
---|
| 148 | typedef void ( *_OBJrDoor_Open)( DoorObject *inObject, Character *inCharacter );
|
---|
| 149 | typedef void ( *_OBJrDoor_ForceOpen)(short id);
|
---|
| 150 |
|
---|
[567] | 151 | #define ExtFunc(name) extern _##name name
|
---|
| 152 | ExtFunc(SLrScript_Command_Register_ReturnType);
|
---|
| 153 | ExtFunc(SLrScript_Command_Register_Void);
|
---|
| 154 | ExtFunc(SLrGlobalVariable_Register_Int32);
|
---|
| 155 | ExtFunc(SLrGlobalVariable_Register_Float);
|
---|
| 156 | ExtFunc(SLrGlobalVariable_Register_String);
|
---|
[572] | 157 | ExtFunc(COrConsole_StatusLine_Display);
|
---|
[573] | 158 | ExtFunc(OBJrObjectType_EnumerateObjects);
|
---|
| 159 | //ExtFunc(OBJiObjectGroup_GetNumObjects);
|
---|
| 160 | ExtFunc(AI2iScript_Spawn);
|
---|
[567] | 161 |
|
---|
[573] | 162 | ExtFunc(TRrAnimation_GetDuration);
|
---|
| 163 | ExtFunc(TRrAnimation_GetFrom);
|
---|
| 164 | ExtFunc(TRrAnimation_GetTo);
|
---|
| 165 |
|
---|
[567] | 166 | extern _UUrMachineTime_High UUrMachineTime_High;
|
---|
| 167 | extern _UUrMachineTime_High_Frequency UUrMachineTime_High_Frequency;
|
---|
| 168 | extern _UUrMachineTime_Sixtieths UUrMachineTime_Sixtieths;
|
---|
| 169 | extern _UUrPlatform_Initialize UUrPlatform_Initialize;
|
---|
| 170 | extern _UUrPlatform_Terminate UUrPlatform_Terminate;
|
---|
| 171 |
|
---|
| 172 | extern _oni_fopen oni_fopen;
|
---|
| 173 | extern _oni_fprintf oni_fprintf;
|
---|
| 174 | extern _oni_fflush oni_fflush;
|
---|
| 175 |
|
---|
| 176 | extern _ONiMain ONiMain;
|
---|
| 177 | extern _ONrPlatform_Initialize ONrPlatform_Initialize;
|
---|
| 178 | extern _ONrPlatform_WindowProc ONrPlatform_WindowProc;
|
---|
| 179 |
|
---|
| 180 | ExtFunc(COrMessage_Print);
|
---|
| 181 |
|
---|
| 182 | ExtFunc(TMrInstance_GetDataPtr);
|
---|
| 183 | ExtFunc(TMrInstance_GetInstanceName);
|
---|
| 184 |
|
---|
| 185 | ExtFunc(gl_enumerate_valid_display_modes);
|
---|
| 186 | ExtFunc(gl_platform_set_pixel_format);
|
---|
| 187 | ExtFunc(gl_platform_initialize);
|
---|
| 188 | ExtFunc(ONrPersist_GetGamma);
|
---|
| 189 | ExtFunc(ONrPersist_GetWonGame);
|
---|
| 190 | ExtFunc(UUrStartupMessage);
|
---|
| 191 |
|
---|
[573] | 192 | ExtFunc(ONrCharacter_NewAnimationHook);
|
---|
| 193 | ExtFunc(ONrCharacter_SetHitPoints);
|
---|
[567] | 194 | ExtFunc(ONrGameState_NewCharacter);
|
---|
[573] | 195 | ExtFunc(ONrGameState_DeleteCharacter);
|
---|
[567] | 196 | ExtFunc(ONrGetActiveCharacter);
|
---|
[573] | 197 | ExtFunc(ONrCorpse_Create);
|
---|
[568] | 198 | ExtFunc(iSetCharacterClass);
|
---|
| 199 |
|
---|
[567] | 200 | ExtFunc(COrTextArea_Print);
|
---|
| 201 |
|
---|
| 202 | ExtFunc(ONrCheater);
|
---|
| 203 | ExtFunc(AUrMessageBox);
|
---|
| 204 |
|
---|
| 205 | ExtFunc(SSrMessage_Find);
|
---|
| 206 | ExtFunc(ONiGameState_FindAutoPromptMessage);
|
---|
| 207 |
|
---|
| 208 | ExtFunc(TSrContext_DrawText);
|
---|
| 209 | ExtFunc(TSrContext_New);
|
---|
[573] | 210 | ExtFunc(TSrContext_SetShade);
|
---|
| 211 | ExtFunc(OBJrDoor_Open);
|
---|
| 212 | ExtFunc(OBJrDoor_ForceOpen);
|
---|
[567] | 213 | #endif
|
---|