Rev 116 | Rev 131 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 116 | Rev 124 | ||
|---|---|---|---|
| Line 10... | Line 10... | ||
| 10 | #include "DirectX9/Include/d3dx9.h" | 10 | #include "DirectX9/Include/d3dx9.h" | 
| 11 | 11 | ||
| 12 | // include the Direct3D library files | 12 | // include the Direct3D library files | 
| 13 | #pragma comment (lib, "DirectX9/Lib/x86/d3d9.lib") | 13 | #pragma comment (lib, "DirectX9/Lib/x86/d3d9.lib") | 
| 14 | #pragma comment (lib, "DirectX9/Lib/x86/d3dx9.lib") | 14 | #pragma comment (lib, "DirectX9/Lib/x86/d3dx9.lib") | 
| 15 | - | ||
| 16 | - | ||
| 17 | // define this to display framerate | - | |
| 18 | #define WANT_FRAMERATE | - | |
| 19 | 15 | ||
| 20 | 16 | ||
| 21 | // handy macro to print a chatter channel reply | 17 | // handy macro to print a chatter channel reply | 
| 22 | #define PRINT_CCREPLY(ccreply) \ | 18 | #define PRINT_CCREPLY(ccreply) \ | 
| 23 | { \ | 19 | { \ | 
| 24 |    Render_wprintf (rect. | 20 |    Render_wprintf (rect.right * 100.0f / initial_width, 100 - combinedheight_percent, (initial_width - rect.right) * 100.0f / initial_width, ALIGN_LEFT, ALIGN_TOP, ALIGN_LEFT, \ | 
| 25 |                    chat_fontindex, (ccreply)->color, &rect, \ | 21 |                    chat_fontindex, (ccreply)->color, &rect, \ | 
| 26 |                    L"["); \ | 22 |                    L"["); \ | 
| 27 |    Render_wprintf (rect. | 23 |    Render_wprintf (rect.right * 100.0f / initial_width, 100 - combinedheight_percent, (initial_width - rect.right) * 100.0f / initial_width, ALIGN_LEFT, ALIGN_TOP, ALIGN_LEFT, \ | 
| 28 |                    chat_fontindex, RGBA_TO_RGBACOLOR (159, 159, 159, RGBACOLOR_ALPHA ((ccreply)->color)), &rect, \ | 24 |                    chat_fontindex, RGBA_TO_RGBACOLOR (159, 159, 159, RGBACOLOR_ALPHA ((ccreply)->color)), &rect, \ | 
| 29 |                    (ccreply)->channelname); \ | 25 |                    (ccreply)->channelname); \ | 
| 30 |    Render_wprintf (rect. | 26 |    Render_wprintf (rect.right * 100.0f / initial_width, 100 - combinedheight_percent, (initial_width - rect.right) * 100.0f / initial_width, ALIGN_LEFT, ALIGN_TOP, ALIGN_LEFT, \ | 
| 31 |                    chat_fontindex, (ccreply)->color, &rect, \ | 27 |                    chat_fontindex, (ccreply)->color, &rect, \ | 
| 32 |                    L"] "); /* closing bracket + non-breakable space */ \ | 28 |                    L"] "); /* closing bracket + non-breakable space */ \ | 
| 33 |    Render_wprintf (rect. | 29 |    Render_wprintf (rect.right * 100.0f / initial_width, 100 - combinedheight_percent, (initial_width - rect.right) * 100.0f / initial_width, ALIGN_LEFT, ALIGN_TOP, ALIGN_LEFT, \ | 
| 34 |                    chat_fontindex, RGBA_TO_RGBACOLOR (159, 159, 159, RGBACOLOR_ALPHA ((ccreply)->color)), &rect, \ | 30 |                    chat_fontindex, RGBA_TO_RGBACOLOR (159, 159, 159, RGBACOLOR_ALPHA ((ccreply)->color)), &rect, \ | 
| 35 |                    (ccreply)->nickname); \ | 31 |                    (ccreply)->nickname); \ | 
| 36 |    Render_wprintf (rect. | 32 |    Render_wprintf (rect.right * 100.0f / initial_width, 100 - combinedheight_percent, (initial_width - rect.right) * 100.0f / initial_width, ALIGN_LEFT, ALIGN_TOP, ALIGN_LEFT, \ | 
| 37 |                    chat_fontindex, (ccreply)->color, &rect, \ | 33 |                    chat_fontindex, (ccreply)->color, &rect, \ | 
| 38 |                    L": "); /* colon + non-breakable space */ \ | 34 |                    L": "); /* colon + non-breakable space */ \ | 
| 39 |    if ((ccreply)->text != NULL) \ | 35 |    if ((ccreply)->text != NULL) \ | 
| 40 |       Render_wprintf (rect. | 36 |       Render_wprintf (rect.right * 100.0f / initial_width, 100 - combinedheight_percent, (initial_width - rect.right) * 100.0f / initial_width, ALIGN_LEFT, ALIGN_TOP, ALIGN_LEFT, \ | 
| 41 |                       chat_fontindex, (ccreply)->color, &rect, \ | 37 |                       chat_fontindex, (ccreply)->color, &rect, \ | 
| 42 |                       (ccreply)->text); \ | 38 |                       (ccreply)->text); \ | 
| 43 | } | 39 | } | 
| 44 | 40 | ||
| 45 | 41 | ||
| 46 | // handy macro to draw a GUI button | 42 | // handy macro to draw a GUI button | 
| 47 | #define DRAW_BUTTON_IF_NEEDED(button) \ | 43 | #define DRAW_BUTTON_IF_NEEDED(button) \ | 
| 48 | { \ | 44 | { \ | 
| 49 |    if ((button).state != 0) \ | 45 |    if ((button).state != 0) \ | 
| - | 46 |    { \ | |
| 50 |       Render_DrawSprite (&sprites[(button).sprite_index], (button).left, (button).top, (button).width, (button).height, ((button).state == 2 ? 0xFF : 0x7F)); \ | 47 |       Render_DrawSprite (&sprites[(button).sprite_index], (button).left, (button).top, (button).width, (button).height, ((button).state == 2 ? 0xFF : 0x7F)); \ | 
| - | 48 |       if ((button).text[0] != 0) \ | |
| - | 49 |          Render_wprintf ((button).left + (button).width / 2.0f, (button).top + (button).height / 2.0f, (button).width, ALIGN_CENTER, ALIGN_CENTER, ALIGN_CENTER, chat_fontindex, D3DCOLOR_ARGB (255, 255, 255, /*alpha*/ ((button).state == 2 ? 0xFF : 0x7F)), NULL, (button).text); \ | |
| - | 50 |    } \ | |
| 51 | } | 51 | } | 
| 52 | 52 | ||
| 53 | 53 | ||
| 54 | // handy macro to draw a GUI text | 54 | // handy macro to draw a GUI text | 
| 55 | #define DRAW_TEXT_IF_NEEDED(text) \ | 55 | #define DRAW_TEXT_IF_NEEDED(text) \ | 
| 56 | { \ | 56 | { \ | 
| 57 |    if ((text).is_displayed) \ | 57 |    if ((text).is_displayed) \ | 
| 58 |    { \ | 58 |    { \ | 
| 59 |       Render_wprintf | 59 |       Render_wprintf ((text).xpos_percent, (text).ypos_percent, \ | 
| 60 |                        | 60 |                       (text).maxwidth_percent, (text).horizontal_align, (text).vertical_align, (text).text_align, (text).font_index, \ | 
| 61 |                       ((text).want_fade ? \ | 61 |                       ((text).want_fade ? \ | 
| 62 |                        RGBACOLOR_SETALPHA ((text).color, \ | 62 |                        RGBACOLOR_SETALPHA ((text).color, \ | 
| 63 |                                            (((text).appear_time + (text).disappear_time) * 0.5f > current_time ? \ | 63 |                                            (((text).appear_time + (text).disappear_time) * 0.5f > current_time ? \ | 
| 64 |                                            /* fading in  */ (int) FadeFloat (0, RGBACOLOR_ALPHA ((text).color), (text).appear_time, (text).appear_time + 0.5f) : \ | 64 |                                            /* fading in  */ (int) FadeFloat (0, RGBACOLOR_ALPHA ((text).color), (text).appear_time, (text).appear_time + 0.5f) : \ | 
| 65 |                                            /* fading out */ (int) FadeFloat (RGBACOLOR_ALPHA ((text).color), 0, (text).disappear_time - 3.0f, (text).disappear_time))) : \ | 65 |                                            /* fading out */ (int) FadeFloat (RGBACOLOR_ALPHA ((text).color), 0, (text).disappear_time - 3.0f, (text).disappear_time))) : \ | 
| Line 200... | Line 200... | ||
| 200 | static bool Render_LoadMesh_Obj (mesh_t *mesh, const wchar_t *objfile_pathname); | 200 | static bool Render_LoadMesh_Obj (mesh_t *mesh, const wchar_t *objfile_pathname); | 
| 201 | static void Render_DrawSceneObjectReflection (sceneobject_t *sceneobject); | 201 | static void Render_DrawSceneObjectReflection (sceneobject_t *sceneobject); | 
| 202 | static void Render_DrawSceneObject (sceneobject_t *sceneobject); | 202 | static void Render_DrawSceneObject (sceneobject_t *sceneobject); | 
| 203 | static void Render_DrawSceneTile (sceneobject_t *sceneobject); | 203 | static void Render_DrawSceneTile (sceneobject_t *sceneobject); | 
| 204 | static void Render_DrawSprite (sprite_t *sprite, float x_percent, float y_percent, float width_percent, float height_percent, int alpha); | 204 | static void Render_DrawSprite (sprite_t *sprite, float x_percent, float y_percent, float width_percent, float height_percent, int alpha); | 
| 205 | static void Render_GetTextBoundaries ( | 205 | static void Render_GetTextBoundaries (float maxwidth_percent, int font_id, wchar_t *text, RECT *rect); | 
| 206 | static void Render_wprintf ( | 206 | static void Render_wprintf (float x_percent, float y_percent, float maxwidth_percent, int horiz_align, int vert_align, int text_align, int font_id, unsigned long color_rgba, RECT *out_rect, const wchar_t *fmt, ...); | 
| 207 | static float DistanceToCamera (float x, float y, float z); | 207 | static float DistanceToCamera (float x, float y, float z); | 
| 208 | static float FadeFloat (float from, float to, float start_time, float end_time); | 208 | static float FadeFloat (float from, float to, float start_time, float end_time); | 
| 209 | static unsigned long HashString (const wchar_t *string_buffer); | 209 | static unsigned long HashString (const wchar_t *string_buffer); | 
| 210 | static unsigned long HashFile (const wchar_t *file_pathname); | 210 | static unsigned long HashFile (const wchar_t *file_pathname); | 
| 211 | static void ResolveWildcard (wchar_t *file_pathname, wchar_t *extensions_separated_by_bars); | 211 | static void ResolveWildcard (wchar_t *file_pathname, wchar_t *extensions_separated_by_bars); | 
| Line 546... | Line 546... | ||
| 546 | float cos_yaw; | 546 | float cos_yaw; | 
| 547 | int light_index; | 547 | int light_index; | 
| 548 | int object_index; | 548 | int object_index; | 
| 549 | int cchistory_index; | 549 | int cchistory_index; | 
| 550 | int cchistory_index2; | 550 | int cchistory_index2; | 
| 551 | 
 | 551 | float combinedwidth_percent; | 
| 552 | 
 | 552 | float combinedheight_percent; | 
| 553 | light_t *light; | 553 | light_t *light; | 
| 554 | ccreply_t *ccreply; | 554 | ccreply_t *ccreply; | 
| 555 | sceneobject_t *sceneobject; | 555 | sceneobject_t *sceneobject; | 
| 556 | reflectedobject_t *reflectedobjects; // mallocated | 556 | reflectedobject_t *reflectedobjects; // mallocated | 
| 557 | int reflectedobject_count; | 557 | int reflectedobject_count; | 
| Line 768... | Line 768... | ||
| 768 | if (scene->overlay_spriteindex >= 0) | 768 | if (scene->overlay_spriteindex >= 0) | 
| 769 | Render_DrawSprite (&sprites[scene->overlay_spriteindex], 0.0f, 0.0f, 100.0f, 100.0f, 0x4F); | 769 | Render_DrawSprite (&sprites[scene->overlay_spriteindex], 0.0f, 0.0f, 100.0f, 100.0f, 0x4F); | 
| 770 | 770 | ||
| 771 |    /////////////// | 771 |    /////////////// | 
| 772 |    // draw the GUI | 772 |    // draw the GUI | 
| - | 773 | ||
| - | 774 | DRAW_BUTTON_IF_NEEDED (scene->gui.newgamebutton); // new game | |
| - | 775 | DRAW_BUTTON_IF_NEEDED (scene->gui.opengamebutton); // open game | |
| 773 | 776 | ||
| 774 |    // draw the arrows | 777 |    // draw the arrows | 
| 775 | DRAW_BUTTON_IF_NEEDED (scene->gui.larrow); // left arrow | 778 | DRAW_BUTTON_IF_NEEDED (scene->gui.larrow); // left arrow | 
| 776 | DRAW_BUTTON_IF_NEEDED (scene->gui.rarrow); // right arrow | 779 | DRAW_BUTTON_IF_NEEDED (scene->gui.rarrow); // right arrow | 
| 777 | DRAW_TEXT_IF_NEEDED (scene->gui.arrow_text); // arrow text | 780 | DRAW_TEXT_IF_NEEDED (scene->gui.arrow_text); // arrow text | 
| 778 | 781 | ||
| 779 | if (want_framerate) | 782 | if (want_framerate) | 
| 780 | Render_wprintf ( | 783 | Render_wprintf (99.0f, 1.0f, 0.0f, ALIGN_RIGHT, ALIGN_TOP, ALIGN_CENTER, arrow_fontindex, D3DCOLOR_RGBA (255, 255, 255, 255), NULL, | 
| 781 | L"%d textures\n" | 784 | L"%d textures\n" | 
| 782 | L"%d meshes\n" | 785 | L"%d meshes\n" | 
| 783 | L"%d fonts\n" | 786 | L"%d fonts\n" | 
| 784 | L"%d sprites\n" | 787 | L"%d sprites\n" | 
| 785 | L"%d fps", texture_count, mesh_count, font_count, sprite_count, framerate_value); | 788 | L"%d fps", texture_count, mesh_count, font_count, sprite_count, framerate_value); | 
| Line 830... | Line 833... | ||
| 830 | DRAW_TEXT_IF_NEEDED (scene->gui.history_text); // game history | 833 | DRAW_TEXT_IF_NEEDED (scene->gui.history_text); // game history | 
| 831 | DRAW_TEXT_IF_NEEDED (scene->gui.clock_text); // game clock | 834 | DRAW_TEXT_IF_NEEDED (scene->gui.clock_text); // game clock | 
| 832 | 835 | ||
| 833 |    // draw the chatter channels text | 836 |    // draw the chatter channels text | 
| 834 | Render_GetTextBoundaries (-1, chat_fontindex, L"a", &rect); | 837 | Render_GetTextBoundaries (-1, chat_fontindex, L"a", &rect); | 
| 835 | 
 | 838 | combinedheight_percent = (float) (rect.bottom * 100 / initial_height); // get a string's height | 
| 836 | 839 | ||
| 837 |    // cycle through all the chat strings... | 840 |    // cycle through all the chat strings... | 
| 838 | ccreply = NULL; | 841 | ccreply = NULL; | 
| 839 | for (cchistory_index = 0; cchistory_index < scene->gui.cchistory_count; cchistory_index++) | 842 | for (cchistory_index = 0; cchistory_index < scene->gui.cchistory_count; cchistory_index++) | 
| 840 |    { | 843 |    { | 
| Line 849... | Line 852... | ||
| 849 |       // first, get the remaining text's combined height | 852 |       // first, get the remaining text's combined height | 
| 850 | for (cchistory_index2 = cchistory_index; cchistory_index2 < scene->gui.cchistory_count; cchistory_index2++) | 853 | for (cchistory_index2 = cchistory_index; cchistory_index2 < scene->gui.cchistory_count; cchistory_index2++) | 
| 851 |       { | 854 |       { | 
| 852 | ccreply = &scene->gui.cchistory[cchistory_index2]; // quick access to CC reply | 855 | ccreply = &scene->gui.cchistory[cchistory_index2]; // quick access to CC reply | 
| 853 | 856 | ||
| 854 | 
 | 857 | combinedwidth_percent = 1.0f; | 
| 855 | Render_GetTextBoundaries ( | 858 | Render_GetTextBoundaries (100 - combinedwidth_percent, chat_fontindex, L"[] : ", &rect); | 
| 856 | 
 | 859 | combinedwidth_percent += (float) (rect.right * 100 / initial_width); | 
| 857 | Render_GetTextBoundaries ( | 860 | Render_GetTextBoundaries (100 - combinedwidth_percent, chat_fontindex, ccreply->channelname, &rect); | 
| 858 | 
 | 861 | combinedwidth_percent += (float) (rect.right * 100 / initial_width); | 
| 859 | Render_GetTextBoundaries ( | 862 | Render_GetTextBoundaries (100 - combinedwidth_percent, chat_fontindex, ccreply->nickname, &rect); | 
| 860 | 
 | 863 | combinedwidth_percent += (float) (rect.right * 100 / initial_width); | 
| 861 | Render_GetTextBoundaries ( | 864 | Render_GetTextBoundaries (100 - combinedwidth_percent, chat_fontindex, ccreply->text, &rect); | 
| 862 | 
 | 865 | combinedheight_percent += (float) (rect.bottom * 100 / initial_height); // add this string's height | 
| 863 |       } | 866 |       } | 
| 864 | 867 | ||
| 865 |       // now for each string remaining... | 868 |       // now for each string remaining... | 
| 866 | for (; cchistory_index < scene->gui.cchistory_count; cchistory_index++) | 869 | for (; cchistory_index < scene->gui.cchistory_count; cchistory_index++) | 
| 867 |       { | 870 |       { | 
| 868 | ccreply = &scene->gui.cchistory[cchistory_index]; // quick access to CC reply | 871 | ccreply = &scene->gui.cchistory[cchistory_index]; // quick access to CC reply | 
| 869 | rect.right = 10; | 872 | rect.right = 10; | 
| 870 | PRINT_CCREPLY (ccreply); // print CC reply on screen | 873 | PRINT_CCREPLY (ccreply); // print CC reply on screen | 
| 871 | 
 | 874 | combinedheight_percent -= (float) ((rect.bottom - rect.top) * 100 / initial_height); // draw it from top of zone to bottom | 
| 872 |       } | 875 |       } | 
| 873 |    } | 876 |    } | 
| 874 | 877 | ||
| 875 |    // are we online ? | 878 |    // are we online ? | 
| 876 | if (Player_FindByType (PLAYER_INTERNET) != NULL) | 879 | if (Player_FindByType (PLAYER_INTERNET) != NULL) | 
| Line 891... | Line 894... | ||
| 891 | if (scene->gui.want_spinwheel) | 894 | if (scene->gui.want_spinwheel) | 
| 892 | Render_DrawSprite (&sprites[spinner_spriteindex[(int) (10.0f * current_time) % 12]], 47.0f, 46.0f, 6.0f, 8.0f, 255); | 895 | Render_DrawSprite (&sprites[spinner_spriteindex[(int) (10.0f * current_time) % 12]], 47.0f, 46.0f, 6.0f, 8.0f, 255); | 
| 893 | 896 | ||
| 894 |    // are we in demo mode ? if so, display the program name as a watermark | 897 |    // are we in demo mode ? if so, display the program name as a watermark | 
| 895 | if (!is_registered) | 898 | if (!is_registered) | 
| 896 | Render_wprintf ( | 899 | Render_wprintf (50.0f, 60.0f, 0.0f, ALIGN_CENTER, ALIGN_CENTER, ALIGN_CENTER, chat_fontindex, | 
| 897 | D3DCOLOR_RGBA (255, 255, 255, 255), | 900 | D3DCOLOR_RGBA (255, 255, 255, 255), | 
| 898 | NULL, PROGRAM_NAME L"%s - " PROGRAM_URL L"\n- %d:%02d -", LOCALIZE (L"EvaluationMode"), (int) (DEMO_TIMEOUT - current_time) / 60, (int) (DEMO_TIMEOUT - current_time) % 60); | 901 | NULL, PROGRAM_NAME L"%s - " PROGRAM_URL L"\n- %d:%02d -", LOCALIZE (L"EvaluationMode"), (int) (DEMO_TIMEOUT - current_time) / 60, (int) (DEMO_TIMEOUT - current_time) % 60); | 
| 899 | 902 | ||
| 900 |    // end 3D rendering on the back buffer | 903 |    // end 3D rendering on the back buffer | 
| 901 |    ////////////////////////////////////// | 904 |    ////////////////////////////////////// | 
| Line 1637... | Line 1640... | ||
| 1637 | 1640 | ||
| 1638 | return; // finished | 1641 | return; // finished | 
| 1639 | } | 1642 | } | 
| 1640 | 1643 | ||
| 1641 | 1644 | ||
| 1642 | static void Render_GetTextBoundaries ( | 1645 | static void Render_GetTextBoundaries (float maxwidth_percent, int font_id, wchar_t *text, RECT *rect) | 
| 1643 | { | 1646 | { | 
| 1644 |    // this function computes and returns the size of the rectangle the specified text will fit into. Note that text may be modified | 1647 |    // this function computes and returns the size of the rectangle the specified text will fit into. Note that text may be modified | 
| 1645 |    // to insert new lines if it doesn't fit in a single line. | 1648 |    // to insert new lines if it doesn't fit in a single line. | 
| 1646 | 1649 | ||
| 1647 | int char_index; | 1650 | int char_index; | 
| 1648 | int length; | 1651 | int length; | 
| 1649 | int optimal_length; | 1652 | int optimal_length; | 
| 1650 | bool have_split; | 1653 | bool have_split; | 
| - | 1654 | int max_width; | |
| 1651 | 1655 | ||
| 1652 |    // blank out the output rectangle | 1656 |    // blank out the output rectangle | 
| 1653 | memset (rect, 0, sizeof (RECT)); | 1657 | memset (rect, 0, sizeof (RECT)); | 
| 1654 | 1658 | ||
| 1655 |    // ask direct3D to compute the text size a first time | 1659 |    // ask direct3D to compute the text size a first time | 
| 1656 | fonts[font_id].font->DrawText (NULL, text, -1, rect, DT_CALCRECT, D3DCOLOR (0)); | 1660 | fonts[font_id].font->DrawText (NULL, text, -1, rect, DT_CALCRECT, D3DCOLOR (0)); | 
| 1657 | 1661 | ||
| 1658 |    // if max width is not set, set it to viewport width | 1662 |    // if max width is not set, set it to viewport width | 
| 1659 | if ( | 1663 | if (maxwidth_percent <= 0) | 
| 1660 | max_width = initial_width; // then use it to compute the real max width | 1664 | max_width = initial_width; // then use it to compute the real max width | 
| - | 1665 |    else | |
| - | 1666 | max_width = (int) ((maxwidth_percent * (float) initial_width) / 100.0f); // else if specified, convert this percentage to an absolute pixel width | |
| 1661 | 1667 | ||
| 1662 |    // do we need more than one line ? | 1668 |    // do we need more than one line ? | 
| 1663 | if (rect->right > max_width) | 1669 | if (rect->right > max_width) | 
| 1664 |    { | 1670 |    { | 
| 1665 |       // see how many lines we need and compute the optimal length of one line | 1671 |       // see how many lines we need and compute the optimal length of one line | 
| Line 1680... | Line 1686... | ||
| 1680 | 1686 | ||
| 1681 | return; // finished | 1687 | return; // finished | 
| 1682 | } | 1688 | } | 
| 1683 | 1689 | ||
| 1684 | 1690 | ||
| 1685 | static void Render_wprintf ( | 1691 | static void Render_wprintf (float x_percent, float y_percent, float maxwidth_percent, int horiz_align, int vert_align, int text_align, int font_id, unsigned long color_rgba, RECT *out_rect, const wchar_t *fmt, ...) | 
| 1686 | { | 1692 | { | 
| 1687 |    // this function displays text on the Direct3D interface according to the given parameters. X and Y are the base coordinates of | 1693 |    // this function displays text on the Direct3D interface according to the given parameters. X and Y are the base coordinates of | 
| 1688 |    // the text's bounding rectangle. Max_width is the maximum allowed width of this rectangle before wrapping words on a new line. | 1694 |    // the text's bounding rectangle. Max_width is the maximum allowed width of this rectangle before wrapping words on a new line. | 
| 1689 |    // Horiz_align and vert_align are the alignment parameters of the RECTANGLE relatively to X and Y. Text_align is the alignment of | 1695 |    // Horiz_align and vert_align are the alignment parameters of the RECTANGLE relatively to X and Y. Text_align is the alignment of | 
| 1690 |    // the TEXT inside this rectangle (meaning, you can have right-aligned text in a rectangle that is centered on a point). Font_id | 1696 |    // the TEXT inside this rectangle (meaning, you can have right-aligned text in a rectangle that is centered on a point). Font_id | 
| Line 1694... | Line 1700... | ||
| 1694 | 1700 | ||
| 1695 | va_list argptr; | 1701 | va_list argptr; | 
| 1696 |    RECT rect; | 1702 |    RECT rect; | 
| 1697 | int left; | 1703 | int left; | 
| 1698 | int top; | 1704 | int top; | 
| - | 1705 | int x; | |
| - | 1706 | int y; | |
| 1699 | 1707 | ||
| 1700 |    // concatenate all the arguments in one string | 1708 |    // concatenate all the arguments in one string | 
| 1701 | va_start (argptr, fmt); | 1709 | va_start (argptr, fmt); | 
| 1702 | wvsprintf (printf_buffer, fmt, argptr); | 1710 | wvsprintf (printf_buffer, fmt, argptr); | 
| 1703 | va_end (argptr); | 1711 | va_end (argptr); | 
| - | 1712 | ||
| - | 1713 |    // translate percent coordinates into absolute coordinates | |
| - | 1714 | x = (int) ((x_percent * (float) initial_width) / 100.0f); | |
| - | 1715 | y = (int) ((y_percent * (float) initial_height) / 100.0f); | |
| 1704 | 1716 | ||
| 1705 |    // get the text boundaries | 1717 |    // get the text boundaries | 
| 1706 | Render_GetTextBoundaries ( | 1718 | Render_GetTextBoundaries (maxwidth_percent, font_id, printf_buffer, &rect); | 
| 1707 | 1719 | ||
| 1708 |    // horizontal alignment | 1720 |    // horizontal alignment | 
| 1709 | if (horiz_align == ALIGN_LEFT) | 1721 | if (horiz_align == ALIGN_LEFT) | 
| 1710 | left = x; | 1722 | left = x; | 
| 1711 | else if (horiz_align == ALIGN_RIGHT) | 1723 | else if (horiz_align == ALIGN_RIGHT) |