7 |
|
#include "Oni_Character.h" |
8 |
|
#include "BFW_ScriptLang.h" |
9 |
|
|
10 |
– |
#define DefVar(type, name, address) static type* _##name = (type*)address |
11 |
– |
DefVar( onibool, ai2_deaf, 0x005ec0c1 ); |
10 |
|
|
11 |
< |
DefVar( HINSTANCE, g_Instance, 0x0061F9E4 ); |
11 |
> |
//Define variables of Oni: #define VARNAME (*((TYPE*)ADDRESS)) |
12 |
|
|
13 |
< |
DefVar( gl_api_t*, gl_api, 0x00560604 ); |
14 |
< |
DefVar( gl_engine_t*, gl_eng, 0x00560600 ); |
17 |
< |
DefVar( WORD*, gl_gamma_ramp, 0x0055fdfc ); |
18 |
< |
DefVar( int, gl_gamma_ramp_valid, 0x005603fc ); |
19 |
< |
|
20 |
< |
DefVar( char, opt_ignore_private_data,0x006370f0 ); |
21 |
< |
DefVar( char, opt_sound, 0x006370fc ); |
22 |
< |
|
23 |
< |
DefVar( char, AKgDebug_DebugMaps, 0x002b2204 ); |
24 |
< |
|
25 |
< |
DefVar( bool, BFgDebugFileEnable, 0x0055c8d0 ); |
26 |
< |
|
27 |
< |
DefVar( uint32_t, COgConsoleLines, 0x005cb468 ); |
28 |
< |
DefVar( uint32_t, COgDefaultTextShade, 0x00533f70 ); |
29 |
< |
DefVar( uint32_t, COgDefaultTextShadow, 0x00533f74 ); |
30 |
< |
DefVar( uint32_t, COgFadeTimeValue, 0x00533f68 ); |
31 |
< |
|
32 |
< |
DefVar( FILE*, ONgFileStartup, 0x005711b8 ); |
33 |
< |
DefVar( GameState*, ONgGameState, 0x005ece7c ); |
34 |
< |
DefVar( ONtPlatformData,ONgPlatformData, 0x0053100c ); |
35 |
< |
|
36 |
< |
DefVar( char, M3gResolutionSwitch, 0x00531634 ); |
37 |
< |
|
38 |
< |
DefVar( bool, SSgSearchOnDisk, 0x005eb758 ); |
39 |
< |
#undef DefVar |
40 |
< |
//Yes, I'm aware that there are a few ways this could go wrong |
41 |
< |
//but in the interests of neatness and not having to go through and rename all the variables |
42 |
< |
//and use annoying dereferencing, this will do. |
43 |
< |
|
44 |
< |
//...too bad there is no way to nest #defines... |
45 |
< |
#define AKgDebug_DebugMaps (*_AKgDebug_DebugMaps) |
46 |
< |
#define ai2_deaf (*_ai2_deaf) |
47 |
< |
#define g_Instance (*_g_Instance) |
48 |
< |
#define M3gResolutionSwitch (*_M3gResolutionSwitch) |
49 |
< |
#define ONgGameState (*_ONgGameState) |
50 |
< |
#define ONgPlatformData (*_ONgPlatformData) |
51 |
< |
#define opt_ignore_private_data (*_opt_ignore_private_data) |
52 |
< |
#define opt_sound (*_opt_sound) |
53 |
< |
#define BFgDebugFileEnable (*_BFgDebugFileEnable) |
54 |
< |
#define SSgSearchOnDisk (*_SSgSearchOnDisk) |
55 |
< |
#define gl_gamma_ramp (*_gl_gamma_ramp) |
56 |
< |
#define gl_gamma_ramp_valid (*_gl_gamma_ramp_valid) |
57 |
< |
#define gl_api (*_gl_api) |
58 |
< |
#define gl_eng (*_gl_eng) |
59 |
< |
#define COgConsoleLines (*_COgConsoleLines) |
60 |
< |
#define COgFadeTimeValue (*_COgFadeTimeValue) |
61 |
< |
#define COgDefaultTextShade (*_COgDefaultTextShade) |
62 |
< |
#define COgDefaultTextShadow (*_COgDefaultTextShadow) |
63 |
< |
#define ONgFileStartup (*_ONgFileStartup) |
13 |
> |
// AIs are deaf (ger: "taub") |
14 |
> |
#define ai2_deaf (*((onibool*)0x005ec0c1)) |
15 |
|
|
16 |
+ |
// Option "debug" ... but what does it do? |
17 |
+ |
#define AKgDebug_DebugMaps (*((char*)0x002b2204)) |
18 |
|
|
19 |
+ |
// Option "debugfiles" ... but what does it do? |
20 |
+ |
#define BFgDebugFileEnable (*((bool*)0x0055c8d0)) |
21 |
+ |
|
22 |
+ |
// Parameter 1 to COrTextArea_Print. Context pointer? |
23 |
+ |
#define COgConsoleLines (*((uint32_t*)0x005cb468)) |
24 |
+ |
|
25 |
+ |
// Default console text color |
26 |
+ |
#define COgDefaultTextShade (*((uint32_t*)0x00533f70)) |
27 |
+ |
|
28 |
+ |
// Default console text shadow color |
29 |
+ |
#define COgDefaultTextShadow (*((uint32_t*)0x00533f74)) |
30 |
+ |
|
31 |
+ |
// Console text fade timeout |
32 |
+ |
#define COgFadeTimeValue (*((uint32_t*)0x00533f68)) |
33 |
+ |
|
34 |
+ |
// Some kind of graphics context? |
35 |
+ |
#define g_Instance (*((HINSTANCE*)0x0061F9E4)) |
36 |
+ |
|
37 |
+ |
// OpenGL Gamma related |
38 |
+ |
#define gl_gamma_ramp (*((WORD**)0x0055fdfc)) |
39 |
+ |
|
40 |
+ |
// OpenGL Gamma related |
41 |
+ |
#define gl_gamma_ramp_valid (*((int*)0x005603fc)) |
42 |
+ |
|
43 |
+ |
// OpenGL whatev? |
44 |
+ |
#define gl_api (*((gl_api_t**)0x00560604)) |
45 |
+ |
|
46 |
+ |
// OpenGL whatev? |
47 |
+ |
#define gl_eng (*((gl_engine_t**)0x00560600)) |
48 |
+ |
|
49 |
+ |
// Value of -switch/-noswitch? |
50 |
+ |
#define M3gResolutionSwitch (*((char*)0x00531634)) |
51 |
+ |
|
52 |
+ |
// Startup.txt file handle |
53 |
+ |
#define ONgFileStartup (*((FILE**)0x005711b8)) |
54 |
+ |
|
55 |
+ |
// Current GameState |
56 |
+ |
#define ONgGameState (*((GameState**)0x005ece7c)) |
57 |
+ |
|
58 |
+ |
// Current ONtPlatformData |
59 |
+ |
#define ONgPlatformData (*((ONtPlatformData*)0x0053100c)) |
60 |
+ |
|
61 |
+ |
// Load non levelX_final-files yes/no |
62 |
+ |
#define opt_ignore_private_data (*((char*)0x006370f0)) |
63 |
+ |
|
64 |
+ |
// Play sound yes/no |
65 |
+ |
#define opt_sound (*((char*)0x006370fc)) |
66 |
+ |
|
67 |
+ |
// Option "findsounds" ... but what does it do? |
68 |
+ |
#define SSgSearchOnDisk (*((bool*)0x005eb758)) |
69 |
+ |
|
70 |
+ |
|
71 |
+ |
// Method signature for script (BSL) functions |
72 |
|
typedef uint16_t ( ONICALL *sl_func)(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret); |
73 |
+ |
|
74 |
+ |
// Used by function definition below: OBJrObjectType_EnumerateObjects |
75 |
|
typedef char ( ONICALL *OBJtEnumCallback_Object)(void *inObject, int inUserData); |
76 |
|
|
77 |
|
|
78 |
< |
#undef DefFunc |
78 |
> |
|
79 |
|
#define DefFunc( type, name, callingconvention, args, address) typedef type ( callingconvention * _##name ) args; static _##name name = (_##name)address |
80 |
+ |
|
81 |
+ |
// Orig timing functions, replaced by DDrMachineTime_* if option "usegettickcount" is enabled |
82 |
|
DefFunc(int64_t, UUrMachineTime_High, ONICALL, (), 0x04026480); |
83 |
|
DefFunc(double, UUrMachineTime_High_Frequency, ONICALL, (), 0x040264b0); |
84 |
|
DefFunc(int64_t, UUrMachineTime_Sixtieths, ONICALL, (), 0x040263e0); |
85 |
+ |
|
86 |
+ |
// Code to initialize platform stuff (like disabling system key combination Alt+Tab) |
87 |
|
DefFunc(void, UUrPlatform_Initialize, ONICALL, (), 0x04026010); |
88 |
|
DefFunc(void, UUrPlatform_Terminate, ONICALL, (), 0x04026310); |
89 |
|
|
90 |
+ |
// Oni's file access methods |
91 |
|
DefFunc(FILE*, oni_fopen, __cdecl, (const char*, const char*), 0x0051ea9f); |
92 |
|
DefFunc(int, oni_fprintf, __cdecl, (FILE*, const char*, ...), 0x0051ebbf); |
93 |
|
DefFunc(int, oni_fflush, __cdecl, (FILE*), 0x0051eab2); |
94 |
|
|
95 |
+ |
// Oni's main method? |
96 |
|
DefFunc(void, ONiMain, __cdecl, (int ArgCount, char *ArgList[]), 0x004d3280); |
97 |
+ |
|
98 |
+ |
// Initialization code, used to hook in windowed modes |
99 |
|
DefFunc(short, ONrPlatform_Initialize, ONICALL, (ONtPlatformData *PlatformData), 0x0050f670); |
100 |
|
DefFunc(LRESULT, ONrPlatform_WindowProc, CALLBACK, (HWND Window, UINT Message, WPARAM WParam, LPARAM LParam), 0x0050f7a0); |
101 |
+ |
|
102 |
+ |
// Retrieves a list of resolutions, replaced by "daodan_enumerate_valid_display_modes" |
103 |
|
DefFunc(unsigned int, gl_enumerate_valid_display_modes, ONICALL, (M3tDisplayMode modes[16]), 0x004083a0); |
104 |
|
DefFunc(int, gl_platform_set_pixel_format, ONICALL, (HDC hdc), 0x00407b50); |
105 |
|
DefFunc(int, gl_platform_initialize, ONICALL, (), 0x00407da0); |