diff --git a/docs/progress.svg b/docs/progress.svg
index 559c0ba..6d45f76 100644
--- a/docs/progress.svg
+++ b/docs/progress.svg
@@ -69,10 +69,10 @@
Tomb2.exe progress according to the physical function order:
-22.67% (272) · 74.83% (898) · 0.67% (8) · 1.83% (22)
+22.75% (273) · 74.75% (897) · 0.67% (8) · 1.83% (22)
-
-
+
+
@@ -801,27 +801,27 @@
void __cdecl SpiderLeap(int16_t item_num, int16_t angle);
void __cdecl SpiderControl(int16_t item_num);
void __cdecl BigSpiderControl(int16_t item_num);
-void __cdecl T_InitPrint(void);
-TEXTSTRING *__cdecl T_Print(int32_t xpos, int32_t ypos, int32_t zpos, char *string);
-void __cdecl T_ChangeText(struct TEXTSTRING *textstring, char *string);
-void __cdecl T_SetScale(struct TEXTSTRING *textstring, int32_t scale_h, int32_t scaleV);
-void __cdecl T_FlashText(struct TEXTSTRING *textstring, int16_t enable, int16_t rate);
-void __cdecl T_AddBackground(struct TEXTSTRING *textstring, int16_t xsize, int16_t ysize, int16_t xoff, int16_t yoff, int16_t zoff, int16_t colour, uint16_t *gourptr, uint16_t flags);
-void __cdecl T_RemoveBackground(struct TEXTSTRING *textstring);
-void __cdecl T_AddOutline(struct TEXTSTRING *textstring, int16_t enable, int16_t colour, uint16_t *gourptr, uint16_t flags);
-void __cdecl T_RemoveOutline(struct TEXTSTRING *textstring);
-void __cdecl T_CentreH(struct TEXTSTRING *textstring, int16_t enable);
-void __cdecl T_CentreV(struct TEXTSTRING *textstring, int16_t enable);
-void __cdecl T_RightAlign(struct TEXTSTRING *textstring, int16_t enable);
-void __cdecl T_BottomAlign(struct TEXTSTRING *textstring, int16_t enable);
-int32_t __cdecl T_GetTextWidth(struct TEXTSTRING *textstring);
-int32_t __cdecl T_RemovePrint(struct TEXTSTRING *textstring);
-int16_t __cdecl T_GetStringLen(char *string);
-void __cdecl T_DrawText(void);
-void __cdecl T_draw_border(int32_t xpos, int32_t ypos, int32_t zpos, int32_t width, int32_t height);
-void __cdecl T_DrawThisText(struct TEXTSTRING *textstring);
-uint32_t __cdecl GetTextScaleH(uint32_t scale_h);
-uint32_t __cdecl GetTextScaleV(uint32_t scale_v);
+void __cdecl Text_Init(void);
+TEXTSTRING *__cdecl Text_Create(int32_t x, int32_t y, int32_t z, const char *string);
+void __cdecl Text_ChangeText(struct TEXTSTRING *textstring, const char *string);
+void __cdecl Text_SetScale(struct TEXTSTRING *textstring, int32_t scale_h, int32_t scale_v);
+void __cdecl Text_Flash(struct TEXTSTRING *textstring, int16_t enable, int16_t rate);
+void __cdecl Text_AddBackground(struct TEXTSTRING *textstring, int16_t x_size, int16_t y_size, int16_t x_off, int16_t y_off, int16_t z_off, int16_t colour, uint16_t *gour_ptr, uint16_t flags);
+void __cdecl Text_RemoveBackground(struct TEXTSTRING *textstring);
+void __cdecl Text_AddOutline(struct TEXTSTRING *textstring, int16_t enable, int16_t colour, uint16_t *gour_ptr, uint16_t flags);
+void __cdecl Text_RemoveOutline(struct TEXTSTRING *textstring);
+void __cdecl Text_CentreH(struct TEXTSTRING *textstring, int16_t enable);
+void __cdecl Text_CentreV(struct TEXTSTRING *textstring, int16_t enable);
+void __cdecl Text_AlignRight(struct TEXTSTRING *textstring, int16_t enable);
+void __cdecl Text_AlignBottom(struct TEXTSTRING *textstring, int16_t enable);
+int32_t __cdecl Text_GetWidth(struct TEXTSTRING *textstring);
+int32_t __cdecl Text_Remove(struct TEXTSTRING *textstring);
+int16_t __cdecl Text_GetStringLength(const char *string);
+void __cdecl Text_Draw(void);
+void __cdecl Text_DrawBorder(int32_t x, int32_t y, int32_t z, int32_t width, int32_t height);
+void __cdecl T_DrawText(struct TEXTSTRING *textstring);
+uint32_t __cdecl Text_GetScaleH(uint32_t scale_h);
+uint32_t __cdecl Text_GetScaleV(uint32_t scale_v);
void __cdecl MineControl(int16_t mine_num);
void __cdecl ControlSpikeWall(int16_t item_num);
void __cdecl ControlCeilingSpikes(int16_t item_num);
@@ -944,7 +944,7 @@
bool __cdecl DInputCreate(void);
void __cdecl DInputRelease(void);
void __cdecl WinInReadKeyboard(LPVOID lpInputData);
-DWORD __cdecl WinInReadJoystick(int32_t *xPos, int32_t *yPos);
+DWORD __cdecl WinInReadJoystick(int32_t *x, int32_t *y);
sub_4473A0
bool __cdecl WinInputInit(void);
bool __cdecl DInputEnumDevices(JOYSTICK_LIST *joystickList);
@@ -1281,10 +1281,10 @@
Tomb2.exe progress according to the function sizes:
-20.28% · 79.39% · 0.02% · 0.31%
+20.29% · 79.38% · 0.02% · 0.31%
-
-
+
+
@@ -1356,7 +1356,7 @@
void __cdecl InitialiseDoor(int16_t item_num);
int32_t __cdecl Collide_CollideStaticObjects(struct COLL_INFO *coll, int32_t x, int32_t y, int32_t z, int16_t room_num, int32_t hite);
void __cdecl Room_Clip(struct ROOM_INFO *r);
-void __cdecl T_DrawThisText(struct TEXTSTRING *textstring);
+void __cdecl T_DrawText(struct TEXTSTRING *textstring);
const int16_t *__cdecl Output_InsertObjectG4(const int16_t *obj_ptr, int32_t num, enum SORT_TYPE sort_type);
void __cdecl Worker1Control(int16_t item_num);
void __cdecl WarriorControl(int16_t item_num);
@@ -1523,7 +1523,7 @@
void __cdecl PropellerControl(int16_t item_num);
void __cdecl Camera_Combat(const struct ITEM_INFO *item);
void __cdecl PistolHandler(int32_t weapon_type);
-void __cdecl T_draw_border(int32_t xpos, int32_t ypos, int32_t zpos, int32_t width, int32_t height);
+void __cdecl Text_DrawBorder(int32_t x, int32_t y, int32_t z, int32_t width, int32_t height);
BOOL __cdecl LoadTexturePages(HANDLE hFile);
BOOL __cdecl LoadDepthQ(HANDLE hFile);
int32_t __cdecl Boat_UserControl(struct ITEM_INFO *boat);
@@ -1633,12 +1633,12 @@
void __cdecl InitColours(void);
void __cdecl Pendulum(int16_t item_num);
void __cdecl KillerStatueControl(int16_t item_num);
-int32_t __cdecl T_GetTextWidth(struct TEXTSTRING *textstring);
+int32_t __cdecl Text_GetWidth(struct TEXTSTRING *textstring);
int32_t __cdecl Diver_GetWaterSurface(int32_t x, int32_t y, int32_t z, int16_t room_num);
void __cdecl InitialiseSlot(int16_t item_num, int32_t slot);
int32_t __cdecl SkidooCheckGetOffOK(int32_t direction);
INT_PTR __stdcall SE_ControlsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-TEXTSTRING *__cdecl T_Print(int32_t xpos, int32_t ypos, int32_t zpos, char *string);
+TEXTSTRING *__cdecl Text_Create(int32_t x, int32_t y, int32_t z, const char *string);
void __cdecl FallingBlock(int16_t item_num);
void __cdecl FmvBackToGame(void);
void __cdecl S_DisplayPicture(LPCTSTR fileName, BOOL isTitle);
@@ -1662,7 +1662,7 @@
void __cdecl Output_InsertPolygons(const int16_t *obj_ptr, int32_t clip);
void __cdecl ControlBubble1(int16_t fx_num);
void __cdecl Lara_SurfaceCollision(struct ITEM_INFO *item, struct COLL_INFO *coll);
-DWORD __cdecl WinInReadJoystick(int32_t *xPos, int32_t *yPos);
+DWORD __cdecl WinInReadJoystick(int32_t *x, int32_t *y);
int32_t __cdecl Box_StalkBox(struct ITEM_INFO *item, struct ITEM_INFO *enemy, int16_t box_num);
void __cdecl FireShotgun(void);
void __cdecl SphereOfDoom(int16_t item_num);
@@ -1867,7 +1867,7 @@
void __cdecl DetonatorControl(int16_t item_num);
const int16_t *__cdecl Output_InsertObjectGT4_Sorted(const int16_t *obj_ptr, int32_t num, enum SORT_TYPE sort_type);
int32_t __cdecl ItemNearLara(struct PHD_3DPOS *pos, int32_t distance);
-void __cdecl T_AddBackground(struct TEXTSTRING *textstring, int16_t xsize, int16_t ysize, int16_t xoff, int16_t yoff, int16_t zoff, int16_t colour, uint16_t *gourptr, uint16_t flags);
+void __cdecl Text_AddBackground(struct TEXTSTRING *textstring, int16_t x_size, int16_t y_size, int16_t x_off, int16_t y_off, int16_t z_off, int16_t colour, uint16_t *gour_ptr, uint16_t flags);
sub_444B20
bool __cdecl WinVidGetDisplayMode(DISPLAY_MODE *dispMode);
int32_t __cdecl Box_BadFloor(int32_t x, int32_t y, int32_t z, int32_t box_height, int32_t next_height, int16_t room_num, struct LOT_INFO *lot);
@@ -2176,7 +2176,7 @@
int16_t __cdecl CreateItem(void);
void __cdecl Lara_State_SwitchOn(struct ITEM_INFO *item, struct COLL_INFO *coll);
void __cdecl SwitchControl(int16_t item_num);
-uint32_t __cdecl GetTextScaleV(uint32_t scale_v);
+uint32_t __cdecl Text_GetScaleV(uint32_t scale_v);
sub_447170
void __cdecl TempVideoRemove(void);
sub_447B40
@@ -2189,8 +2189,8 @@
void __cdecl Item_ShiftCol(struct ITEM_INFO *item, struct COLL_INFO *coll);
int32_t __cdecl Game_DrawCinematic(void);
int32_t __cdecl Game_Draw(void);
-void __cdecl T_ChangeText(struct TEXTSTRING *textstring, char *string);
-uint32_t __cdecl GetTextScaleH(uint32_t scale_h);
+void __cdecl Text_ChangeText(struct TEXTSTRING *textstring, const char *string);
+uint32_t __cdecl Text_GetScaleH(uint32_t scale_h);
bool __cdecl D3DIsSupported(LPD3DDEVICEDESC desc);
void __cdecl S_InitialiseScreen(GF_LEVEL_TYPE levelType);
LONG __cdecl SetRegistryBinaryValue(LPCTSTR lpValueName, LPBYTE value, DWORD valueSize);
@@ -2278,13 +2278,13 @@
void __cdecl Lara_State_Fallback(struct ITEM_INFO *item, struct COLL_INFO *coll);
void __cdecl InitialiseMovingBlock(int16_t item_num);
void __cdecl DrawBridgeCollision(int16_t item_num, struct ITEM_INFO *laraitem, struct COLL_INFO *coll);
-void __cdecl T_InitPrint(void);
+void __cdecl Text_Init(void);
void __cdecl S_Audio_Sample_AdjustTrackVolumeAndPan(int32_t track_id, int32_t volume, int32_t pan);
LPTSTR __cdecl UT_FindArg(LPCTSTR str);
uint32_t __fastcall Math_Sqrt(uint32_t n);
void __cdecl Lara_State_Slide(struct ITEM_INFO *item, struct COLL_INFO *coll);
void __cdecl undraw_shotgun_meshes(int32_t weapon_type);
-void __cdecl T_FlashText(struct TEXTSTRING *textstring, int16_t enable, int16_t rate);
+void __cdecl Text_Flash(struct TEXTSTRING *textstring, int16_t enable, int16_t rate);
DWORD __cdecl GetZBufferDepth(void);
void __cdecl HWR_ResetColorKey(void);
void __cdecl Output_InsertPolygons_I(int16_t *ptr, int32_t clip);
@@ -2293,7 +2293,7 @@
void __cdecl S_UnloadLevelFile(void);
int32_t __cdecl S_Audio_Sample_CalculateSampleVolume(int32_t volume);
LONG __cdecl SetRegistryBoolValue(LPCTSTR lpValueName, bool value);
-void __cdecl T_AddOutline(struct TEXTSTRING *textstring, int16_t enable, int16_t colour, uint16_t *gourptr, uint16_t flags);
+void __cdecl Text_AddOutline(struct TEXTSTRING *textstring, int16_t enable, int16_t colour, uint16_t *gour_ptr, uint16_t flags);
void __cdecl DInputKeyboardRelease(void);
void __cdecl HWR_ResetTexSource(void);
void __cdecl MakeAmmoString(char *string);
@@ -2301,7 +2301,7 @@
void __cdecl Matrix_Push_I(void);
void __cdecl Lara_State_PPReady(struct ITEM_INFO *item, struct COLL_INFO *coll);
void __cdecl InitialiseLevelFlags(void);
-void __cdecl T_DrawText(void);
+void __cdecl Text_Draw(void);
void __cdecl S_FadeOutInventory(BOOL isFade);
void __cdecl Inv_RingMotionRadius(struct RING_INFO *ring, int16_t target);
LPCTSTR __cdecl GetFullPath(LPCTSTR fileName);
@@ -2310,7 +2310,7 @@
void __cdecl FreeTexturePages(void);
void __cdecl SE_PassMessageToImage(HWND hWnd, UINT uMsg, WPARAM wParam);
void __cdecl Inv_RingMotionCameraPos(struct RING_INFO *ring, int16_t target);
-int32_t __cdecl T_RemovePrint(struct TEXTSTRING *textstring);
+int32_t __cdecl Text_Remove(struct TEXTSTRING *textstring);
HRESULT __cdecl WinVidBufferUnlock(LPDDS surface, LPDDSDESC desc);
LPDIRECT3DTEXTURE2 __cdecl Create3DTexture(LPDDS surface);
HRESULT __cdecl EnumerateTextureFormats(void);
@@ -2318,7 +2318,7 @@
void __cdecl AssaultStart(struct ITEM_INFO *item);
void __cdecl RemoveInventoryText(void);
void __cdecl Sound_Shutdown(void);
-int16_t __cdecl T_GetStringLen(char *string);
+int16_t __cdecl Text_GetStringLength(const char *string);
bool __cdecl DInputEnumDevices(JOYSTICK_LIST *joystickList);
void __cdecl HWR_TexSource(HWR_TEXHANDLE texSource);
void __cdecl RubbleFX(struct ITEM_INFO *item);
@@ -2353,10 +2353,10 @@
void __cdecl Lara_Col_Slide(struct ITEM_INFO *item, struct COLL_INFO *coll);
void __cdecl Lara_State_ClimbEnd(struct ITEM_INFO *item, struct COLL_INFO *coll);
void __cdecl Lara_Col_SurfTread(struct ITEM_INFO *item, struct COLL_INFO *coll);
-void __cdecl T_CentreH(struct TEXTSTRING *textstring, int16_t enable);
-void __cdecl T_CentreV(struct TEXTSTRING *textstring, int16_t enable);
-void __cdecl T_RightAlign(struct TEXTSTRING *textstring, int16_t enable);
-void __cdecl T_BottomAlign(struct TEXTSTRING *textstring, int16_t enable);
+void __cdecl Text_CentreH(struct TEXTSTRING *textstring, int16_t enable);
+void __cdecl Text_CentreV(struct TEXTSTRING *textstring, int16_t enable);
+void __cdecl Text_AlignRight(struct TEXTSTRING *textstring, int16_t enable);
+void __cdecl Text_AlignBottom(struct TEXTSTRING *textstring, int16_t enable);
int32_t __cdecl Random_GetControl(void);
int32_t __cdecl GetRandomDraw(void);
LONG __cdecl SetRegistryDwordValue(LPCTSTR lpValueName, DWORD value);
@@ -2398,7 +2398,7 @@
BOOL __cdecl S_LoadLevelFile(LPCTSTR fileName, int32_t levelID, GF_LEVEL_TYPE levelType);
int32_t __cdecl UT_MessageBox(LPCTSTR lpText, HWND hWnd);
void __cdecl AssaultReset(struct ITEM_INFO *item);
-void __cdecl T_SetScale(struct TEXTSTRING *textstring, int32_t scale_h, int32_t scaleV);
+void __cdecl Text_SetScale(struct TEXTSTRING *textstring, int32_t scale_h, int32_t scale_v);
void __cdecl WinInRunControlPanel(HWND hWnd);
sub_44E860
void __cdecl SE_GraphicsAdapterSet(HWND hwndDlg, DISPLAY_ADAPTER_NODE *adapter);
@@ -2436,8 +2436,8 @@
HWND __cdecl WinVidFindGameWindow(void);
void __cdecl GameBuf_Shutdown(void);
HWND __cdecl SE_FindSetupDialog(void);
-void __cdecl T_RemoveBackground(struct TEXTSTRING *textstring);
-void __cdecl T_RemoveOutline(struct TEXTSTRING *textstring);
+void __cdecl Text_RemoveBackground(struct TEXTSTRING *textstring);
+void __cdecl Text_RemoveOutline(struct TEXTSTRING *textstring);
sub_44E880
void __cdecl ScreenPartialDump(void);
void __cdecl WinInFinish(void);
diff --git a/docs/progress.txt b/docs/progress.txt
index 849d4ca..be049c5 100644
--- a/docs/progress.txt
+++ b/docs/progress.txt
@@ -257,28 +257,40 @@ typedef struct __unaligned SPHERE {
} SPHERE;
typedef struct __unaligned TEXTSTRING {
- uint32_t flags;
+ union {
+ uint32_t all;
+ } flags;
uint16_t text_flags;
uint16_t bgnd_flags;
uint16_t outl_flags;
- int16_t xpos;
- int16_t ypos;
- int16_t zpos;
+ struct {
+ int16_t x;
+ int16_t y;
+ int16_t z;
+ } pos;
int16_t letter_spacing;
int16_t word_spacing;
- int16_t flash_rate;
- int16_t flash_count;
+ struct {
+ int16_t rate;
+ int16_t count;
+ } flash;
int16_t bgnd_colour;
uint16_t *bgnd_gour;
int16_t outl_colour;
uint16_t *outl_gour;
- int16_t bgnd_size_x;
- int16_t bgnd_size_y;
- int16_t bgnd_off_x;
- int16_t bgnd_off_y;
- int16_t bgnd_off_z;
- int32_t scale_h;
- int32_t scale_v;
+ struct {
+ int16_t x;
+ int16_t y;
+ } bgnd_size;
+ struct {
+ int16_t x;
+ int16_t y;
+ int16_t z;
+ } bgnd_off;
+ struct {
+ int32_t h;
+ int32_t v;
+ } scale;
char *string;
} TEXTSTRING;
@@ -1963,27 +1975,27 @@ typedef enum LARA_MESH {
00440290 000001A5 -R void __cdecl BigSpiderControl(int16_t item_num);
# game/text.c
-00440450 0000002C -R void __cdecl T_InitPrint(void);
-00440480 00000105 -R TEXTSTRING *__cdecl T_Print(int32_t xpos, int32_t ypos, int32_t zpos, char *string);
-00440590 00000037 -R void __cdecl T_ChangeText(struct TEXTSTRING *textstring, char *string);
-004405D0 00000017 -R void __cdecl T_SetScale(struct TEXTSTRING *textstring, int32_t scale_h, int32_t scaleV);
-004405F0 0000002B -R void __cdecl T_FlashText(struct TEXTSTRING *textstring, int16_t enable, int16_t rate);
-00440620 0000008C -R void __cdecl T_AddBackground(struct TEXTSTRING *textstring, int16_t xsize, int16_t ysize, int16_t xoff, int16_t yoff, int16_t zoff, int16_t colour, uint16_t *gourptr, uint16_t flags);
-004406B0 00000010 -R void __cdecl T_RemoveBackground(struct TEXTSTRING *textstring);
-004406C0 00000029 -R void __cdecl T_AddOutline(struct TEXTSTRING *textstring, int16_t enable, int16_t colour, uint16_t *gourptr, uint16_t flags);
-004406F0 00000010 -R void __cdecl T_RemoveOutline(struct TEXTSTRING *textstring);
-00440700 0000001E -R void __cdecl T_CentreH(struct TEXTSTRING *textstring, int16_t enable);
-00440720 0000001E -R void __cdecl T_CentreV(struct TEXTSTRING *textstring, int16_t enable);
-00440740 0000001E -R void __cdecl T_RightAlign(struct TEXTSTRING *textstring, int16_t enable);
-00440760 0000001E -R void __cdecl T_BottomAlign(struct TEXTSTRING *textstring, int16_t enable);
-00440780 00000107 -R int32_t __cdecl T_GetTextWidth(struct TEXTSTRING *textstring);
-00440890 00000025 -R int32_t __cdecl T_RemovePrint(struct TEXTSTRING *textstring);
-004408C0 00000024 -R int16_t __cdecl T_GetStringLen(char *string);
-004408F0 00000027 -R void __cdecl T_DrawText(void);
-00440920 00000189 -R void __cdecl T_draw_border(int32_t xpos, int32_t ypos, int32_t zpos, int32_t width, int32_t height);
-00440AB0 000003D2 -R void __cdecl T_DrawThisText(struct TEXTSTRING *textstring);
-00440E90 00000037 -R uint32_t __cdecl GetTextScaleH(uint32_t scale_h);
-00440ED0 00000039 -R uint32_t __cdecl GetTextScaleV(uint32_t scale_v);
+00440450 0000002C + void __cdecl Text_Init(void);
+00440480 00000105 - TEXTSTRING *__cdecl Text_Create(int32_t x, int32_t y, int32_t z, const char *string);
+00440590 00000037 - void __cdecl Text_ChangeText(struct TEXTSTRING *textstring, const char *string);
+004405D0 00000017 - void __cdecl Text_SetScale(struct TEXTSTRING *textstring, int32_t scale_h, int32_t scale_v);
+004405F0 0000002B - void __cdecl Text_Flash(struct TEXTSTRING *textstring, int16_t enable, int16_t rate);
+00440620 0000008C - void __cdecl Text_AddBackground(struct TEXTSTRING *textstring, int16_t x_size, int16_t y_size, int16_t x_off, int16_t y_off, int16_t z_off, int16_t colour, uint16_t *gour_ptr, uint16_t flags);
+004406B0 00000010 - void __cdecl Text_RemoveBackground(struct TEXTSTRING *textstring);
+004406C0 00000029 - void __cdecl Text_AddOutline(struct TEXTSTRING *textstring, int16_t enable, int16_t colour, uint16_t *gour_ptr, uint16_t flags);
+004406F0 00000010 - void __cdecl Text_RemoveOutline(struct TEXTSTRING *textstring);
+00440700 0000001E - void __cdecl Text_CentreH(struct TEXTSTRING *textstring, int16_t enable);
+00440720 0000001E - void __cdecl Text_CentreV(struct TEXTSTRING *textstring, int16_t enable);
+00440740 0000001E - void __cdecl Text_AlignRight(struct TEXTSTRING *textstring, int16_t enable);
+00440760 0000001E - void __cdecl Text_AlignBottom(struct TEXTSTRING *textstring, int16_t enable);
+00440780 00000107 - int32_t __cdecl Text_GetWidth(struct TEXTSTRING *textstring);
+00440890 00000025 - int32_t __cdecl Text_Remove(struct TEXTSTRING *textstring);
+004408C0 00000024 -R int16_t __cdecl Text_GetStringLength(const char *string);
+004408F0 00000027 - void __cdecl Text_Draw(void);
+00440920 00000189 - void __cdecl Text_DrawBorder(int32_t x, int32_t y, int32_t z, int32_t width, int32_t height);
+00440AB0 000003D2 - void __cdecl T_DrawText(struct TEXTSTRING *textstring);
+00440E90 00000037 -R uint32_t __cdecl Text_GetScaleH(uint32_t scale_h);
+00440ED0 00000039 -R uint32_t __cdecl Text_GetScaleV(uint32_t scale_v);
# game/traps.c
00440F10 000001F4 -R void __cdecl MineControl(int16_t mine_num);
@@ -2111,7 +2123,7 @@ typedef enum LARA_MESH {
004471F0 00000022 -R bool __cdecl DInputCreate(void);
00447220 0000001A -R void __cdecl DInputRelease(void);
00447240 0000005A -R void __cdecl WinInReadKeyboard(LPVOID lpInputData);
-004472A0 000000F3 -R DWORD __cdecl WinInReadJoystick(int32_t *xPos, int32_t *yPos);
+004472A0 000000F3 -R DWORD __cdecl WinInReadJoystick(int32_t *x, int32_t *y);
004473A0 00000005 -R sub_4473A0
004473B0 0000007F -R bool __cdecl WinInputInit(void);
00447430 00000024 -R bool __cdecl DInputEnumDevices(JOYSTICK_LIST *joystickList);
@@ -2539,6 +2551,7 @@ typedef enum LARA_MESH {
004D7380 - PALETTEENTRY g_GamePalette16[256];
004D7780 - int32_t g_CineFrameCurrent;
004D778C - int32_t g_IsChunkyCamera;
+004D77A0 - int32_t g_LOSNumRooms = 0;
004D7C80 - int32_t g_SoundTrackIds[128];
004D7F10 - HWND g_GameWindowHandle;
004D8378 - uint8_t g_IsGameToExit;
@@ -2566,6 +2579,7 @@ typedef enum LARA_MESH {
0051BDA8 - int32_t g_MasterVolume;
0051BDAC - MCIDEVICEID g_MciDeviceID;
0051BDB0 - int32_t g_CD_LoopTrack;
+0051C820 - struct TEXTSTRING g_TextstringTable[64];
0051E6C4 - int32_t g_SoundIsActive;
005206E0 - struct LARA_INFO g_Lara;
005207BC - struct ITEM_INFO *g_LaraItem;
@@ -2581,6 +2595,7 @@ typedef enum LARA_MESH {
0052618C - struct ROOM_INFO *g_Rooms;
00526240 - int32_t g_FlipStatus;
00526288 - int16_t *g_TriggerIndex;
+005262A0 - int32_t g_LOSRooms[20];
005262F0 - struct ITEM_INFO *g_Items;
005262F6 - int16_t g_NumCineFrames;
005262F8 - CINE_FRAME *g_CineData = NULL;
@@ -2588,5 +2603,4 @@ typedef enum LARA_MESH {
00526314 - int16_t g_CineFrameIdx;
00526320 - struct CAMERA_INFO g_Camera;
005263CC - struct BOX_INFO *g_Boxes;
-004D77A0 - int32_t g_LOSNumRooms = 0;
-005262A0 - int32_t g_LOSRooms[20];
+0051D6A0 - int16_t g_TextstringCount = 0;
diff --git a/meson.build b/meson.build
index 92ec7f3..341a91d 100644
--- a/meson.build
+++ b/meson.build
@@ -89,6 +89,7 @@ dll_sources = [
'src/game/output.c',
'src/game/shell.c',
'src/game/sound.c',
+ 'src/game/text.c',
'src/inject_exec.c',
'src/inject_util.c',
'src/lib/winmm.c',
diff --git a/src/game/text.c b/src/game/text.c
new file mode 100644
index 0000000..e663f44
--- /dev/null
+++ b/src/game/text.c
@@ -0,0 +1,15 @@
+#include "game/text.h"
+
+#include "global/funcs.h"
+#include "global/vars.h"
+
+#define TEXT_MAX_STRINGS 64
+
+void __cdecl Text_Init(void)
+{
+ DisplayModeInfo(0);
+ for (int i = 0; i < TEXT_MAX_STRINGS; i++) {
+ g_TextstringTable[i].flags.all = 0;
+ }
+ g_TextstringCount = 0;
+}
diff --git a/src/game/text.h b/src/game/text.h
new file mode 100644
index 0000000..43b2172
--- /dev/null
+++ b/src/game/text.h
@@ -0,0 +1,3 @@
+#pragma once
+
+void __cdecl Text_Init(void);
diff --git a/src/global/funcs.h b/src/global/funcs.h
index c68b5bf..782f030 100644
--- a/src/global/funcs.h
+++ b/src/global/funcs.h
@@ -507,27 +507,26 @@
#define SpiderLeap ((void __cdecl (*)(int16_t item_num, int16_t angle))0x0043FFC0)
#define SpiderControl ((void __cdecl (*)(int16_t item_num))0x00440070)
#define BigSpiderControl ((void __cdecl (*)(int16_t item_num))0x00440290)
-#define T_InitPrint ((void __cdecl (*)(void))0x00440450)
-#define T_Print ((TEXTSTRING *__cdecl (*)(int32_t xpos, int32_t ypos, int32_t zpos, char *string))0x00440480)
-#define T_ChangeText ((void __cdecl (*)(struct TEXTSTRING *textstring, char *string))0x00440590)
-#define T_SetScale ((void __cdecl (*)(struct TEXTSTRING *textstring, int32_t scale_h, int32_t scaleV))0x004405D0)
-#define T_FlashText ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable, int16_t rate))0x004405F0)
-#define T_AddBackground ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t xsize, int16_t ysize, int16_t xoff, int16_t yoff, int16_t zoff, int16_t colour, uint16_t *gourptr, uint16_t flags))0x00440620)
-#define T_RemoveBackground ((void __cdecl (*)(struct TEXTSTRING *textstring))0x004406B0)
-#define T_AddOutline ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable, int16_t colour, uint16_t *gourptr, uint16_t flags))0x004406C0)
-#define T_RemoveOutline ((void __cdecl (*)(struct TEXTSTRING *textstring))0x004406F0)
-#define T_CentreH ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable))0x00440700)
-#define T_CentreV ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable))0x00440720)
-#define T_RightAlign ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable))0x00440740)
-#define T_BottomAlign ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable))0x00440760)
-#define T_GetTextWidth ((int32_t __cdecl (*)(struct TEXTSTRING *textstring))0x00440780)
-#define T_RemovePrint ((int32_t __cdecl (*)(struct TEXTSTRING *textstring))0x00440890)
-#define T_GetStringLen ((int16_t __cdecl (*)(char *string))0x004408C0)
-#define T_DrawText ((void __cdecl (*)(void))0x004408F0)
-#define T_draw_border ((void __cdecl (*)(int32_t xpos, int32_t ypos, int32_t zpos, int32_t width, int32_t height))0x00440920)
-#define T_DrawThisText ((void __cdecl (*)(struct TEXTSTRING *textstring))0x00440AB0)
-#define GetTextScaleH ((uint32_t __cdecl (*)(uint32_t scale_h))0x00440E90)
-#define GetTextScaleV ((uint32_t __cdecl (*)(uint32_t scale_v))0x00440ED0)
+#define Text_Create ((TEXTSTRING *__cdecl (*)(int32_t x, int32_t y, int32_t z, const char *string))0x00440480)
+#define Text_ChangeText ((void __cdecl (*)(struct TEXTSTRING *textstring, const char *string))0x00440590)
+#define Text_SetScale ((void __cdecl (*)(struct TEXTSTRING *textstring, int32_t scale_h, int32_t scale_v))0x004405D0)
+#define Text_Flash ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable, int16_t rate))0x004405F0)
+#define Text_AddBackground ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t x_size, int16_t y_size, int16_t x_off, int16_t y_off, int16_t z_off, int16_t colour, uint16_t *gour_ptr, uint16_t flags))0x00440620)
+#define Text_RemoveBackground ((void __cdecl (*)(struct TEXTSTRING *textstring))0x004406B0)
+#define Text_AddOutline ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable, int16_t colour, uint16_t *gour_ptr, uint16_t flags))0x004406C0)
+#define Text_RemoveOutline ((void __cdecl (*)(struct TEXTSTRING *textstring))0x004406F0)
+#define Text_CentreH ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable))0x00440700)
+#define Text_CentreV ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable))0x00440720)
+#define Text_AlignRight ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable))0x00440740)
+#define Text_AlignBottom ((void __cdecl (*)(struct TEXTSTRING *textstring, int16_t enable))0x00440760)
+#define Text_GetWidth ((int32_t __cdecl (*)(struct TEXTSTRING *textstring))0x00440780)
+#define Text_Remove ((int32_t __cdecl (*)(struct TEXTSTRING *textstring))0x00440890)
+#define Text_GetStringLength ((int16_t __cdecl (*)(const char *string))0x004408C0)
+#define Text_Draw ((void __cdecl (*)(void))0x004408F0)
+#define Text_DrawBorder ((void __cdecl (*)(int32_t x, int32_t y, int32_t z, int32_t width, int32_t height))0x00440920)
+#define T_DrawText ((void __cdecl (*)(struct TEXTSTRING *textstring))0x00440AB0)
+#define Text_GetScaleH ((uint32_t __cdecl (*)(uint32_t scale_h))0x00440E90)
+#define Text_GetScaleV ((uint32_t __cdecl (*)(uint32_t scale_v))0x00440ED0)
#define MineControl ((void __cdecl (*)(int16_t mine_num))0x00440F10)
#define ControlSpikeWall ((void __cdecl (*)(int16_t item_num))0x00441110)
#define ControlCeilingSpikes ((void __cdecl (*)(int16_t item_num))0x00441250)
@@ -634,7 +633,7 @@
#define DInputCreate ((bool __cdecl (*)(void))0x004471F0)
#define DInputRelease ((void __cdecl (*)(void))0x00447220)
#define WinInReadKeyboard ((void __cdecl (*)(LPVOID lpInputData))0x00447240)
-#define WinInReadJoystick ((DWORD __cdecl (*)(int32_t *xPos, int32_t *yPos))0x004472A0)
+#define WinInReadJoystick ((DWORD __cdecl (*)(int32_t *x, int32_t *y))0x004472A0)
#define WinInputInit ((bool __cdecl (*)(void))0x004473B0)
#define DInputEnumDevices ((bool __cdecl (*)(JOYSTICK_LIST *joystickList))0x00447430)
#define DInputEnumDevicesCallback ((BOOL __stdcall (*)(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef))0x00447460)
diff --git a/src/global/types.h b/src/global/types.h
index d7b86da..f5031c5 100644
--- a/src/global/types.h
+++ b/src/global/types.h
@@ -267,28 +267,40 @@ typedef struct SPHERE {
} SPHERE;
typedef struct TEXTSTRING {
- uint32_t flags;
+ union {
+ uint32_t all;
+ } flags;
uint16_t text_flags;
uint16_t bgnd_flags;
uint16_t outl_flags;
- int16_t xpos;
- int16_t ypos;
- int16_t zpos;
+ struct {
+ int16_t x;
+ int16_t y;
+ int16_t z;
+ } pos;
int16_t letter_spacing;
int16_t word_spacing;
- int16_t flash_rate;
- int16_t flash_count;
+ struct {
+ int16_t rate;
+ int16_t count;
+ } flash;
int16_t bgnd_colour;
uint16_t *bgnd_gour;
int16_t outl_colour;
uint16_t *outl_gour;
- int16_t bgnd_size_x;
- int16_t bgnd_size_y;
- int16_t bgnd_off_x;
- int16_t bgnd_off_y;
- int16_t bgnd_off_z;
- int32_t scale_h;
- int32_t scale_v;
+ struct {
+ int16_t x;
+ int16_t y;
+ } bgnd_size;
+ struct {
+ int16_t x;
+ int16_t y;
+ int16_t z;
+ } bgnd_off;
+ struct {
+ int32_t h;
+ int32_t v;
+ } scale;
char *string;
} TEXTSTRING;
diff --git a/src/global/vars.h b/src/global/vars.h
index 73d5480..47fbd57 100644
--- a/src/global/vars.h
+++ b/src/global/vars.h
@@ -119,6 +119,8 @@
#define g_MasterVolume (*(int32_t*)0x0051BDA8)
#define g_MciDeviceID (*(MCIDEVICEID*)0x0051BDAC)
#define g_CD_LoopTrack (*(int32_t*)0x0051BDB0)
+#define g_TextstringTable (*(struct TEXTSTRING(*)[64])0x0051C820)
+#define g_TextstringCount (*(int16_t*)0x0051D6A0) // = 0
#define g_SoundIsActive (*(int32_t*)0x0051E6C4)
#define g_Lara (*(struct LARA_INFO*)0x005206E0)
#define g_LaraItem (*(struct ITEM_INFO **)0x005207BC)
diff --git a/src/inject_exec.c b/src/inject_exec.c
index d9e7cba..30fc9c8 100644
--- a/src/inject_exec.c
+++ b/src/inject_exec.c
@@ -12,6 +12,7 @@
#include "game/output.h"
#include "game/shell.h"
#include "game/sound.h"
+#include "game/text.h"
#include "inject_util.h"
#include "specific/s_audio_sample.h"
#include "specific/s_flagged_string.h"
@@ -20,6 +21,7 @@ static void Inject_Camera(void);
static void Inject_Math(void);
static void Inject_Matrix(void);
static void Inject_Shell(void);
+static void Inject_Text(void);
static void Inject_Output(void);
static void Inject_Music(void);
static void Inject_Sound(void);
@@ -91,6 +93,11 @@ static void Inject_Shell(void)
INJECT(1, 0x0044E890, Shell_ExitSystem);
}
+static void Inject_Text(void)
+{
+ INJECT(1, 0x00440450, Text_Init);
+}
+
static void Inject_Output(void)
{
INJECT(1, 0x004019E0, Output_InsertPolygons);
@@ -355,6 +362,7 @@ void Inject_Exec(void)
Inject_Math();
Inject_Matrix();
Inject_Shell();
+ Inject_Text();
Inject_Output();
Inject_Music();
Inject_Sound();