source: Daodan/src/Oni_Symbols.h@ 685

Last change on this file since 685 was 677, checked in by alloc, 12 years ago

Daodan: Updated src to work with MinGW

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