From 479430d315ed49a5ece27c417f692024afb6d75d Mon Sep 17 00:00:00 2001 From: danij Date: Thu, 10 Jul 2014 23:23:14 +0100 Subject: [PATCH] Refactor|libcommon: Replaced WI_DrawPatch*() with a single C++ function --- doomsday/plugins/common/include/hu_stuff.h | 38 ++-- doomsday/plugins/common/src/hu_lib.cpp | 6 +- doomsday/plugins/common/src/hu_menu.cpp | 28 +-- doomsday/plugins/common/src/hu_stuff.cpp | 43 +--- doomsday/plugins/doom/src/st_stuff.cpp | 22 +- doomsday/plugins/doom/src/wi_stuff.cpp | 242 ++++++++++----------- doomsday/plugins/doom64/src/wi_stuff.cpp | 97 +++++---- 7 files changed, 225 insertions(+), 251 deletions(-) diff --git a/doomsday/plugins/common/include/hu_stuff.h b/doomsday/plugins/common/include/hu_stuff.h index a468ed1fe6..5aea944d87 100644 --- a/doomsday/plugins/common/include/hu_stuff.h +++ b/doomsday/plugins/common/include/hu_stuff.h @@ -27,6 +27,10 @@ #include "doomsday.h" #include "gl_drawpatch.h" +#ifdef __cplusplus +# include +#endif + DENG_EXTERN_C patchid_t *pMapNames; // Name graphics of each map. DENG_EXTERN_C uint pMapNamesSize; @@ -164,6 +168,15 @@ const char* Hu_FindPatchReplacementString(patchid_t patchId, int flags); const char* Hu_ChoosePatchReplacement2(patchreplacemode_t replaceMode, patchid_t patchId, const char* text); const char* Hu_ChoosePatchReplacement(patchreplacemode_t replaceMode, patchid_t patchId); +/** + * Misc specialised elements: + */ + +void M_DrawGlowBar(const float a[2], const float b[2], float thickness, dd_bool left, dd_bool right, dd_bool caps, float red, float green, float blue, float alpha); + +#ifdef __cplusplus +} // extern "C" + /** * Implements patch replacement. * @@ -175,25 +188,8 @@ const char* Hu_ChoosePatchReplacement(patchreplacemode_t replaceMode, patchid_t * @param patchFlags @ref drawPatchFlags * @param textFlags @ref drawTextFlags */ -void WI_DrawPatch3(patchid_t patchId, const char* replacement, const Point2Raw* origin, int alignFlags, int patchFlags, short textFlags); -void WI_DrawPatch2(patchid_t patchId, const char* replacement, const Point2Raw* origin, int alignFlags); -void WI_DrawPatch(patchid_t patchId, const char* replacement, const Point2Raw* origin); - -/** - * Same as @a WI_DrawPatch except origin is specified with separate xy coordinates. - */ -void WI_DrawPatchXY3(patchid_t patchId, const char* replacement, int x, int y, int alignFlags, int patchFlags, short textFlags); -void WI_DrawPatchXY2(patchid_t patchId, const char* replacement, int x, int y, int alignFlags); -void WI_DrawPatchXY(patchid_t patchId, const char* replacement, int x, int y); - -/** - * Misc specialised elements: - */ - -void M_DrawGlowBar(const float a[2], const float b[2], float thickness, dd_bool left, dd_bool right, dd_bool caps, float red, float green, float blue, float alpha); - -#ifdef __cplusplus -} // extern "C" -#endif +void WI_DrawPatch(patchid_t patchId, char const *replacement, de::Vector2i const &origin = de::Vector2i(0, 0), + int alignFlags = ALIGN_TOPLEFT, int patchFlags = 0, short textFlags = 0); -#endif /* LIBCOMMON_HU_STUFF_H */ +#endif // __cplusplus +#endif // LIBCOMMON_HU_STUFF_H diff --git a/doomsday/plugins/common/src/hu_lib.cpp b/doomsday/plugins/common/src/hu_lib.cpp index c874173ad4..6489483d4d 100644 --- a/doomsday/plugins/common/src/hu_lib.cpp +++ b/doomsday/plugins/common/src/hu_lib.cpp @@ -1784,7 +1784,8 @@ void MNText_Drawer(mn_object_t *ob, Point2Raw const *origin) } DGL_Enable(DGL_TEXTURE_2D); - WI_DrawPatch3(*txt->patch, replacement, origin, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); + WI_DrawPatch(*txt->patch, replacement, de::Vector2i(origin->x, origin->y), + ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); DGL_Disable(DGL_TEXTURE_2D); return; @@ -2579,7 +2580,8 @@ void MNButton_Drawer(mn_object_t *ob, Point2Raw const *origin) } DGL_Enable(DGL_TEXTURE_2D); - WI_DrawPatch3(*btn->patch, replacement, origin, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); + WI_DrawPatch(*btn->patch, replacement, de::Vector2i(origin->x, origin->y), + ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); DGL_Disable(DGL_TEXTURE_2D); return; diff --git a/doomsday/plugins/common/src/hu_menu.cpp b/doomsday/plugins/common/src/hu_menu.cpp index fc484702ae..6f99c38c21 100644 --- a/doomsday/plugins/common/src/hu_menu.cpp +++ b/doomsday/plugins/common/src/hu_menu.cpp @@ -5510,8 +5510,8 @@ void Hu_MenuDrawMainPage(mn_page_t * /*page*/, Point2Raw const *origin) FR_SetFont(FID(GF_FONTB)); FR_SetColorAndAlpha(1, 1, 1, mnRendState->pageAlpha); - WI_DrawPatchXY3(pMainTitle, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pMainTitle), - origin->x + TITLEOFFSET_X, origin->y + TITLEOFFSET_Y, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); + WI_DrawPatch(pMainTitle, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pMainTitle), + de::Vector2i(origin->x + TITLEOFFSET_X, origin->y + TITLEOFFSET_Y), ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); #if __JHEXEN__ GL_DrawPatchXY(pBullWithFire[(frame + 2) % 7], origin->x - 73, origin->y + 24); GL_DrawPatchXY(pBullWithFire[frame], origin->x + 168, origin->y + 24); @@ -5672,8 +5672,8 @@ void Hu_MenuDrawEpisodePage(mn_page_t *page, Point2Raw const *origin) FR_SetColorv(cfg.menuTextColors[0]); FR_SetAlpha(mnRendState->pageAlpha); - WI_DrawPatchXY3(pEpisode, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pEpisode), - origin->x + 7, origin->y - 25, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); + WI_DrawPatch(pEpisode, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pEpisode), + de::Vector2i(origin->x + 7, origin->y - 25), ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); DGL_Disable(DGL_TEXTURE_2D); #endif @@ -5688,10 +5688,10 @@ void Hu_MenuDrawSkillPage(mn_page_t * /*page*/, Point2Raw const *origin) FR_SetFont(FID(GF_FONTB)); FR_SetColorAndAlpha(cfg.menuTextColors[0][CR], cfg.menuTextColors[0][CG], cfg.menuTextColors[0][CB], mnRendState->pageAlpha); - WI_DrawPatchXY3(pNewGame, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pNewGame), - origin->x + 48, origin->y - 49, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); - WI_DrawPatchXY3(pSkill, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pSkill), - origin->x + 6, origin->y - 25, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); + WI_DrawPatch(pNewGame, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pNewGame), + de::Vector2i(origin->x + 48, origin->y - 49), ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); + WI_DrawPatch(pSkill, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pSkill), + de::Vector2i(origin->x + 6, origin->y - 25), ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); DGL_Disable(DGL_TEXTURE_2D); #elif __JHEXEN__ @@ -5940,8 +5940,8 @@ void Hu_MenuDrawLoadGamePage(mn_page_t * /*page*/, Point2Raw const *origin) #if __JHERETIC__ || __JHEXEN__ FR_DrawTextXY3("Load Game", SCREENWIDTH/2, origin->y-20, ALIGN_TOP, MN_MergeMenuEffectWithDrawTextFlags(0)); #else - WI_DrawPatchXY3(pLoadGame, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pLoadGame), - origin->x - 8, origin->y - 26, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); + WI_DrawPatch(pLoadGame, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pLoadGame), + de::Vector2i(origin->x - 8, origin->y - 26), ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); #endif DGL_Disable(DGL_TEXTURE_2D); @@ -5961,8 +5961,8 @@ void Hu_MenuDrawSaveGamePage(mn_page_t * /*page*/, Point2Raw const *origin) FR_SetFont(FID(GF_FONTB)); FR_SetColorAndAlpha(cfg.menuTextColors[0][CR], cfg.menuTextColors[0][CG], cfg.menuTextColors[0][CB], mnRendState->pageAlpha); - WI_DrawPatchXY3(pSaveGame, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pSaveGame), - origin->x - 8, origin->y - 26, ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); + WI_DrawPatch(pSaveGame, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pSaveGame), + de::Vector2i(origin->x - 8, origin->y - 26), ALIGN_TOPLEFT, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); DGL_Disable(DGL_TEXTURE_2D); #endif @@ -5992,8 +5992,8 @@ void Hu_MenuDrawOptionsPage(mn_page_t * /*page*/, Point2Raw const *origin) FR_SetFont(FID(GF_FONTB)); FR_SetColorAndAlpha(cfg.menuTextColors[0][CR], cfg.menuTextColors[0][CG], cfg.menuTextColors[0][CB], mnRendState->pageAlpha); - WI_DrawPatchXY3(pOptionsTitle, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pOptionsTitle), - origin->x + 42, origin->y - 20, ALIGN_TOP, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); + WI_DrawPatch(pOptionsTitle, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.menuPatchReplaceMode), pOptionsTitle), + de::Vector2i(origin->x + 42, origin->y - 20), ALIGN_TOP, 0, MN_MergeMenuEffectWithDrawTextFlags(0)); DGL_Disable(DGL_TEXTURE_2D); #endif diff --git a/doomsday/plugins/common/src/hu_stuff.cpp b/doomsday/plugins/common/src/hu_stuff.cpp index 4805410a36..90ad0d71ff 100644 --- a/doomsday/plugins/common/src/hu_stuff.cpp +++ b/doomsday/plugins/common/src/hu_stuff.cpp @@ -1186,46 +1186,18 @@ const char* Hu_ChoosePatchReplacement(patchreplacemode_t mode, patchid_t patchId return Hu_ChoosePatchReplacement2(mode, patchId, NULL); } -void WI_DrawPatch3(patchid_t patchId, const char* replacement, const Point2Raw* origin, +void WI_DrawPatch(patchid_t patchId, char const *replacement, de::Vector2i const &origin, int alignFlags, int patchFlags, short textFlags) { + Point2Raw const originAsPoint2Raw(origin.x, origin.y); if(replacement && replacement[0]) { // Use the replacement string. - FR_DrawText3(replacement, origin, alignFlags, textFlags); + FR_DrawText3(replacement, &originAsPoint2Raw, alignFlags, textFlags); return; } // Use the original patch. - GL_DrawPatch3(patchId, origin, alignFlags, patchFlags); -} - -void WI_DrawPatch2(patchid_t patchId, const char* replacement, const Point2Raw* origin, int alignFlags) -{ - WI_DrawPatch3(patchId, replacement, origin, alignFlags, 0, 0); -} - -void WI_DrawPatch(patchid_t patchId, const char* replacement, const Point2Raw* origin) -{ - WI_DrawPatch2(patchId, replacement, origin, ALIGN_TOPLEFT); -} - -void WI_DrawPatchXY3(patchid_t patchId, const char* replacement, int x, int y, int alignFlags, - int patchFlags, short textFlags) -{ - Point2Raw origin; - origin.x = x; - origin.y = y; - WI_DrawPatch3(patchId, replacement, &origin, alignFlags, patchFlags, textFlags); -} - -void WI_DrawPatchXY2(patchid_t patchId, const char* replacement, int x, int y, int alignFlags) -{ - WI_DrawPatchXY3(patchId, replacement, x, y, alignFlags, 0, 0); -} - -void WI_DrawPatchXY(patchid_t patchId, const char* replacement, int x, int y) -{ - WI_DrawPatchXY2(patchId, replacement, x, y, ALIGN_TOPLEFT); + GL_DrawPatch3(patchId, &originAsPoint2Raw, alignFlags, patchFlags); } void Draw_BeginZoom(float s, float originX, float originY) @@ -1419,7 +1391,8 @@ void Hu_Drawer(void) FR_LoadDefaultAttrib(); FR_SetLeading(0); - WI_DrawPatchXY3(m_pause, Hu_ChoosePatchReplacement(PRM_ALLOW_TEXT, m_pause), 0, 0, ALIGN_TOP, DPF_NO_OFFSET, 0); + WI_DrawPatch(m_pause, Hu_ChoosePatchReplacement(PRM_ALLOW_TEXT, m_pause), + de::Vector2i(), ALIGN_TOP, DPF_NO_OFFSET, 0); DGL_Disable(DGL_TEXTURE_2D); @@ -1514,8 +1487,8 @@ void Hu_DrawMapTitle(float alpha, dd_bool mapIdInsteadOfAuthor) #if __JDOOM__ || __JDOOM64__ patchid_t patchId = G_MapTitlePatch(); // current map - WI_DrawPatchXY3(patchId, Hu_ChoosePatchReplacement2(PRM_ALLOW_TEXT, patchId, title.toUtf8().constData()), - 0, 0, ALIGN_TOP, 0, DTF_ONLY_SHADOW); + WI_DrawPatch(patchId, Hu_ChoosePatchReplacement2(PRM_ALLOW_TEXT, patchId, title.toUtf8().constData()), + de::Vector2i(), ALIGN_TOP, 0, DTF_ONLY_SHADOW); // Following line of text placed according to patch height. y += Hu_MapTitleFirstLineHeight(); diff --git a/doomsday/plugins/doom/src/st_stuff.cpp b/doomsday/plugins/doom/src/st_stuff.cpp index df27ac8ae6..f062a29876 100644 --- a/doomsday/plugins/doom/src/st_stuff.cpp +++ b/doomsday/plugins/doom/src/st_stuff.cpp @@ -46,6 +46,8 @@ #include "r_common.h" #include "am_map.h" +using namespace de; + // N/256*100% probability // that the normal face state will change #define ST_FACEPROBABILITY (96) @@ -1493,16 +1495,16 @@ void WeaponSlot_Drawer(uiwidget_t *ob, Point2Raw const *offset) #define ORIGINX (-ST_WIDTH/2) #define ORIGINY (-ST_HEIGHT) - static Point2Raw const elements[] = { - Point2Raw( ORIGINX+ST_ARMSX, ORIGINY+ST_ARMSY ), - Point2Raw( ORIGINX+ST_ARMSX + ST_ARMSXSPACE, ORIGINY+ST_ARMSY ), - Point2Raw( ORIGINX+ST_ARMSX + ST_ARMSXSPACE*2, ORIGINY+ST_ARMSY ), - Point2Raw( ORIGINX+ST_ARMSX, ORIGINY+ST_ARMSY + ST_ARMSYSPACE ), - Point2Raw( ORIGINX+ST_ARMSX + ST_ARMSXSPACE, ORIGINY+ST_ARMSY + ST_ARMSYSPACE ), - Point2Raw( ORIGINX+ST_ARMSX + ST_ARMSXSPACE*2, ORIGINY+ST_ARMSY + ST_ARMSYSPACE ), + static Vector2i const elements[] = { + Vector2i( ORIGINX+ST_ARMSX, ORIGINY+ST_ARMSY ), + Vector2i( ORIGINX+ST_ARMSX + ST_ARMSXSPACE, ORIGINY+ST_ARMSY ), + Vector2i( ORIGINX+ST_ARMSX + ST_ARMSXSPACE*2, ORIGINY+ST_ARMSY ), + Vector2i( ORIGINX+ST_ARMSX, ORIGINY+ST_ARMSY + ST_ARMSYSPACE ), + Vector2i( ORIGINX+ST_ARMSX + ST_ARMSXSPACE, ORIGINY+ST_ARMSY + ST_ARMSYSPACE ), + Vector2i( ORIGINX+ST_ARMSX + ST_ARMSXSPACE*2, ORIGINY+ST_ARMSY + ST_ARMSYSPACE ), }; guidata_weaponslot_t *wpns = (guidata_weaponslot_t *)ob->typedata; - Point2Raw const *element = &elements[wpns->slot-1]; + Vector2i const &element = elements[wpns->slot-1]; hudstate_t const *hud = &hudStates[ob->player]; int yOffset = ST_HEIGHT * (1 - hud->showBar); int fullscreen = headupDisplayMode(ob->player); @@ -1531,8 +1533,8 @@ void WeaponSlot_Drawer(uiwidget_t *ob, Point2Raw const *offset) { FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], textAlpha); } - WI_DrawPatch3(wpns->patchId, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.hudPatchReplaceMode), wpns->patchId), - element, ALIGN_TOPLEFT, 0, DTF_NO_EFFECTS); + WI_DrawPatch(wpns->patchId, Hu_ChoosePatchReplacement(patchreplacemode_t(cfg.hudPatchReplaceMode), wpns->patchId), + element, ALIGN_TOPLEFT, 0, DTF_NO_EFFECTS); DGL_Disable(DGL_TEXTURE_2D); DGL_MatrixMode(DGL_MODELVIEW); diff --git a/doomsday/plugins/doom/src/wi_stuff.cpp b/doomsday/plugins/doom/src/wi_stuff.cpp index b122289a5e..f9ee05298b 100644 --- a/doomsday/plugins/doom/src/wi_stuff.cpp +++ b/doomsday/plugins/doom/src/wi_stuff.cpp @@ -30,15 +30,17 @@ #include "p_mapsetup.h" #include "p_start.h" +using namespace de; + #define MAX_ANIM_FRAMES (3) #define NUMMAPS (9) struct wianimdef_t { - int mapNum; ///< If not @c 0= the logical map-number+1 for which this animation should only be displayed. - int tics; ///< Number of tics each frame of the animation lasts for. - Point2Raw origin; ///< Location origin of the animation on the map. - int numFrames; ///< Number of used frames in the animation. + int mapNum; ///< If not @c 0= the logical map-number+1 for which this animation should only be displayed. + int tics; ///< Number of tics each frame of the animation lasts for. + Vector2i origin; ///< Location origin of the animation on the map. + int numFrames; ///< Number of used frames in the animation. /// Names of the patches for each frame of the animation. char const *patchNames[MAX_ANIM_FRAMES]; @@ -66,74 +68,74 @@ struct teaminfo_t int secret; }; -static Point2Raw const locations[][NUMMAPS] = { +static Vector2i const locations[][NUMMAPS] = { { // Episode 0 - Point2Raw( 185, 164 ), - Point2Raw( 148, 143 ), - Point2Raw( 69, 122 ), - Point2Raw( 209, 102 ), - Point2Raw( 116, 89 ), - Point2Raw( 166, 55 ), - Point2Raw( 71, 56 ), - Point2Raw( 135, 29 ), - Point2Raw( 71, 24 ) + Vector2i( 185, 164 ), + Vector2i( 148, 143 ), + Vector2i( 69, 122 ), + Vector2i( 209, 102 ), + Vector2i( 116, 89 ), + Vector2i( 166, 55 ), + Vector2i( 71, 56 ), + Vector2i( 135, 29 ), + Vector2i( 71, 24 ) }, { // Episode 1 - Point2Raw( 254, 25 ), - Point2Raw( 97, 50 ), - Point2Raw( 188, 64 ), - Point2Raw( 128, 78 ), - Point2Raw( 214, 92 ), - Point2Raw( 133, 130 ), - Point2Raw( 208, 136 ), - Point2Raw( 148, 140 ), - Point2Raw( 235, 158 ) + Vector2i( 254, 25 ), + Vector2i( 97, 50 ), + Vector2i( 188, 64 ), + Vector2i( 128, 78 ), + Vector2i( 214, 92 ), + Vector2i( 133, 130 ), + Vector2i( 208, 136 ), + Vector2i( 148, 140 ), + Vector2i( 235, 158 ) }, { // Episode 2 - Point2Raw( 156, 168 ), - Point2Raw( 48, 154 ), - Point2Raw( 174, 95 ), - Point2Raw( 265, 75 ), - Point2Raw( 130, 48 ), - Point2Raw( 279, 23 ), - Point2Raw( 198, 48 ), - Point2Raw( 140, 25 ), - Point2Raw( 281, 136 ) + Vector2i( 156, 168 ), + Vector2i( 48, 154 ), + Vector2i( 174, 95 ), + Vector2i( 265, 75 ), + Vector2i( 130, 48 ), + Vector2i( 279, 23 ), + Vector2i( 198, 48 ), + Vector2i( 140, 25 ), + Vector2i( 281, 136 ) } }; static wianimdef_t const episode0AnimDefs[] = { - { 0, 11, Point2Raw( 224, 104 ), 3, { "wia00000", "wia00001", "wia00002" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 184, 160 ), 3, { "wia00100", "wia00101", "wia00102" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 112, 136 ), 3, { "wia00200", "wia00201", "wia00202" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 72, 112 ), 3, { "wia00300", "wia00301", "wia00302" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 88, 96 ), 3, { "wia00400", "wia00401", "wia00402" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 64, 48 ), 3, { "wia00500", "wia00501", "wia00502" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 192, 40 ), 3, { "wia00600", "wia00601", "wia00602" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 136, 16 ), 3, { "wia00700", "wia00701", "wia00702" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 80, 16 ), 3, { "wia00800", "wia00801", "wia00802" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 64, 24 ), 3, { "wia00900", "wia00901", "wia00902" }, ILS_SHOW_STATS } + { 0, 11, Vector2i( 224, 104 ), 3, { "wia00000", "wia00001", "wia00002" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 184, 160 ), 3, { "wia00100", "wia00101", "wia00102" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 112, 136 ), 3, { "wia00200", "wia00201", "wia00202" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 72, 112 ), 3, { "wia00300", "wia00301", "wia00302" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 88, 96 ), 3, { "wia00400", "wia00401", "wia00402" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 64, 48 ), 3, { "wia00500", "wia00501", "wia00502" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 192, 40 ), 3, { "wia00600", "wia00601", "wia00602" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 136, 16 ), 3, { "wia00700", "wia00701", "wia00702" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 80, 16 ), 3, { "wia00800", "wia00801", "wia00802" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 64, 24 ), 3, { "wia00900", "wia00901", "wia00902" }, ILS_SHOW_STATS } }; static wianimdef_t const episode1AnimDefs[] = { - { 1, 0, Point2Raw( 128, 136 ), 1, { "wia10000" }, ILS_SHOW_STATS }, - { 2, 0, Point2Raw( 128, 136 ), 1, { "wia10100" }, ILS_SHOW_STATS }, - { 3, 0, Point2Raw( 128, 136 ), 1, { "wia10200" }, ILS_SHOW_STATS }, - { 4, 0, Point2Raw( 128, 136 ), 1, { "wia10300" }, ILS_SHOW_STATS }, - { 5, 0, Point2Raw( 128, 136 ), 1, { "wia10400" }, ILS_SHOW_STATS }, - { 6, 0, Point2Raw( 128, 136 ), 1, { "wia10500" }, ILS_SHOW_STATS }, - { 7, 0, Point2Raw( 128, 136 ), 1, { "wia10600" }, ILS_SHOW_STATS }, - { 8, 11, Point2Raw( 192, 144 ), 3, { "wia10700", "wia10701", "wia10702" }, ILS_SHOW_NEXTMAP }, - { 8, 0, Point2Raw( 128, 136 ), 1, { "wia10400" }, ILS_SHOW_STATS } + { 1, 0, Vector2i( 128, 136 ), 1, { "wia10000" }, ILS_SHOW_STATS }, + { 2, 0, Vector2i( 128, 136 ), 1, { "wia10100" }, ILS_SHOW_STATS }, + { 3, 0, Vector2i( 128, 136 ), 1, { "wia10200" }, ILS_SHOW_STATS }, + { 4, 0, Vector2i( 128, 136 ), 1, { "wia10300" }, ILS_SHOW_STATS }, + { 5, 0, Vector2i( 128, 136 ), 1, { "wia10400" }, ILS_SHOW_STATS }, + { 6, 0, Vector2i( 128, 136 ), 1, { "wia10500" }, ILS_SHOW_STATS }, + { 7, 0, Vector2i( 128, 136 ), 1, { "wia10600" }, ILS_SHOW_STATS }, + { 8, 11, Vector2i( 192, 144 ), 3, { "wia10700", "wia10701", "wia10702" }, ILS_SHOW_NEXTMAP }, + { 8, 0, Vector2i( 128, 136 ), 1, { "wia10400" }, ILS_SHOW_STATS } }; static wianimdef_t const episode2AnimDefs[] = { - { 0, 11, Point2Raw( 104, 168 ), 3, { "wia20000", "wia20001", "wia20002" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 40, 136 ), 3, { "wia20100", "wia20101", "wia20102" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 160, 96 ), 3, { "wia20200", "wia20201", "wia20202" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 104, 80 ), 3, { "wia20300", "wia20301", "wia20302" }, ILS_SHOW_STATS }, - { 0, 11, Point2Raw( 120, 32 ), 3, { "wia20400", "wia20401", "wia20402" }, ILS_SHOW_STATS }, - { 0, 8, Point2Raw( 40, 0 ), 3, { "wia20500", "wia20501", "wia20502" }, ILS_SHOW_STATS } + { 0, 11, Vector2i( 104, 168 ), 3, { "wia20000", "wia20001", "wia20002" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 40, 136 ), 3, { "wia20100", "wia20101", "wia20102" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 160, 96 ), 3, { "wia20200", "wia20201", "wia20202" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 104, 80 ), 3, { "wia20300", "wia20301", "wia20302" }, ILS_SHOW_STATS }, + { 0, 11, Vector2i( 120, 32 ), 3, { "wia20400", "wia20401", "wia20402" }, ILS_SHOW_STATS }, + { 0, 8, Vector2i( 40, 0 ), 3, { "wia20500", "wia20501", "wia20502" }, ILS_SHOW_STATS } }; static int const animCounts[] = { @@ -246,14 +248,14 @@ static void drawBackground() if(state->frame < 0) continue; patchid_t patchId = state->patches[state->frame]; - WI_DrawPatch3(patchId, patchReplacementText(patchId), &def->origin, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(patchId, patchReplacementText(patchId), def->origin, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } } DGL_Disable(DGL_TEXTURE_2D); } -static void drawFinishedTitle(int x = SCREENWIDTH / 2, int y = WI_TITLEY) +static void drawFinishedTitle(Vector2i &origin = Vector2i(SCREENWIDTH / 2, WI_TITLEY)) { DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); @@ -265,19 +267,19 @@ static void drawFinishedTitle(int x = SCREENWIDTH / 2, int y = WI_TITLEY) // Draw patchid_t const patchId = G_MapTitlePatch(&wbs->currentMap); de::String const mapTitle = G_MapTitle(&wbs->currentMap); - WI_DrawPatchXY3(patchId, patchReplacementText(patchId, mapTitle.toUtf8().constData()), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); + WI_DrawPatch(patchId, patchReplacementText(patchId, mapTitle.toUtf8().constData()), origin, ALIGN_TOP, 0, DTF_NO_TYPEIN); patchinfo_t info; if(R_GetPatchInfo(patchId, &info)) - y += (5 * info.geometry.size.height) / 4; + origin.y += (5 * info.geometry.size.height) / 4; // Draw "Finished!" FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); - WI_DrawPatchXY3(pFinished, patchReplacementText(pFinished), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pFinished, patchReplacementText(pFinished), origin, ALIGN_TOP, 0, DTF_NO_TYPEIN); DGL_Disable(DGL_TEXTURE_2D); } -static void drawEnteringTitle(int x = SCREENWIDTH / 2, int y = WI_TITLEY) +static void drawEnteringTitle(Vector2i &origin = Vector2i(SCREENWIDTH / 2, WI_TITLEY)) { /// @kludge We need to properly externalize the map progression. if((gameModeBits & (GM_DOOM2|GM_DOOM2_PLUT|GM_DOOM2_TNT)) && @@ -314,52 +316,48 @@ static void drawEnteringTitle(int x = SCREENWIDTH / 2, int y = WI_TITLEY) FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); // Draw "Entering" - WI_DrawPatchXY3(pEntering, patchReplacementText(pEntering), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pEntering, patchReplacementText(pEntering), origin, ALIGN_TOP, 0, DTF_NO_TYPEIN); patchinfo_t info; patchid_t const mapTitlePatch = G_MapTitlePatch(&wbs->nextMap); if(R_GetPatchInfo(mapTitlePatch, &info)) - y += (5 * info.geometry.size.height) / 4; + origin.y += (5 * info.geometry.size.height) / 4; // Draw map. FR_SetColorAndAlpha(defFontRGB[CR], defFontRGB[CG], defFontRGB[CB], 1); - WI_DrawPatchXY3(mapTitlePatch, patchReplacementText(mapTitlePatch, mapName), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); + WI_DrawPatch(mapTitlePatch, patchReplacementText(mapTitlePatch, mapName), origin, ALIGN_TOP, 0, DTF_NO_TYPEIN); DGL_Disable(DGL_TEXTURE_2D); } -static bool patchFits(patchid_t patchId, int x, int y) +static bool patchFits(patchid_t patchId, Vector2i const &origin) { patchinfo_t info; if(!R_GetPatchInfo(patchId, &info)) return false; - int const left = x + info.geometry.origin.x; - int const top = y + info.geometry.origin.y; + int const left = origin.x + info.geometry.origin.x; + int const top = origin.y + info.geometry.origin.y; int const right = left + info.geometry.size.width; int const bottom = top + info.geometry.size.height; return (left >= 0 && right < SCREENWIDTH && top >= 0 && bottom < SCREENHEIGHT); } -static patchid_t chooseYouAreHerePatch(Point2Raw const *origin) +static patchid_t chooseYouAreHerePatch(Vector2i const &origin) { - DENG2_ASSERT(origin != 0); - - if(patchFits(pYouAreHereRight, origin->x, origin->y)) + if(patchFits(pYouAreHereRight, origin)) return pYouAreHereRight; - if(patchFits(pYouAreHereLeft, origin->x, origin->y)) + if(patchFits(pYouAreHereLeft, origin)) return pYouAreHereLeft; return 0; // None fits. } -static void drawPatchIfFits(patchid_t patchId, Point2Raw const *origin) +static void drawPatchIfFits(patchid_t patchId, Vector2i const &origin) { - DENG2_ASSERT(origin != 0); - - if(patchFits(patchId, origin->x, origin->y)) + if(patchFits(patchId, origin)) { - WI_DrawPatch3(patchId, patchReplacementText(patchId), origin, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(patchId, patchReplacementText(patchId), origin, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } } @@ -455,27 +453,27 @@ static void drawPercent(int x, int y, int p) /** * Display map completion time and par, or "sucks" message if overflow. */ -static void drawTime(int x, int y, int t) +static void drawTime(Vector2i &origin, int t) { if(t < 0) return; if(t <= 61 * 59) { - x -= 22; + origin.x -= 22; int const seconds = t % 60; int const minutes = t / 60 % 60; char buf[20]; - FR_DrawCharXY3(':', x, y, ALIGN_TOPLEFT, DTF_NO_TYPEIN); + FR_DrawCharXY3(':', origin.x, origin.y, ALIGN_TOPLEFT, DTF_NO_TYPEIN); if(minutes > 0) { dd_snprintf(buf, 20, "%d", minutes); - FR_DrawTextXY3(buf, x, y, ALIGN_TOPRIGHT, DTF_NO_TYPEIN); + FR_DrawTextXY3(buf, origin.x, origin.y, ALIGN_TOPRIGHT, DTF_NO_TYPEIN); } dd_snprintf(buf, 20, "%02d", seconds); - FR_DrawTextXY3(buf, x+FR_CharWidth(':'), y, ALIGN_TOPLEFT, DTF_NO_TYPEIN); + FR_DrawTextXY3(buf, origin.x + FR_CharWidth(':'), origin.y, ALIGN_TOPLEFT, DTF_NO_TYPEIN); return; } @@ -484,7 +482,7 @@ static void drawTime(int x, int y, int t) patchinfo_t info; if(!R_GetPatchInfo(pSucks, &info)) return; - WI_DrawPatchXY3(pSucks, patchReplacementText(pSucks), x - info.geometry.size.width, y, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pSucks, patchReplacementText(pSucks), Vector2i(origin.x - info.geometry.size.width, origin.y), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } void WI_End() @@ -551,22 +549,22 @@ static void drawLocationMarks() for(int i = 0; i <= last; ++i) { - drawPatchIfFits(pSplat, &locations[::gameEpisode][i]); + drawPatchIfFits(pSplat, locations[::gameEpisode][i]); } // Splat the secret map? if(wbs->didSecret) { - drawPatchIfFits(pSplat, &locations[::gameEpisode][8]); + drawPatchIfFits(pSplat, locations[::gameEpisode][8]); } if(drawYouAreHere) { - Point2Raw const *origin = &locations[::gameEpisode][G_MapNumberFor(wbs->nextMap)]; + Vector2i const &origin = locations[::gameEpisode][G_MapNumberFor(wbs->nextMap)]; patchid_t const patchId = chooseYouAreHerePatch(origin); if(patchId) { - WI_DrawPatch3(patchId, patchReplacementText(patchId), origin, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(patchId, patchReplacementText(patchId), origin, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } } @@ -679,7 +677,7 @@ static void updateDeathmatchStats() } } -static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MATRIXY) +static void drawDeathmatchStats(Vector2i &origin = Vector2i(DM_MATRIXX + DM_SPACINGX, DM_MATRIXY)) { DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); @@ -692,11 +690,11 @@ static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MAT patchinfo_t info; if(R_GetPatchInfo(pTotal, &info)) { - WI_DrawPatchXY3(pTotal, patchReplacementText(pTotal), DM_TOTALSX - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY + 10, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pTotal, patchReplacementText(pTotal), Vector2i(DM_TOTALSX - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY + 10), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } - WI_DrawPatchXY3(pKillers, patchReplacementText(pKillers), DM_KILLERSX, DM_KILLERSY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); - WI_DrawPatchXY3(pVictims, patchReplacementText(pVictims), DM_VICTIMSX, DM_VICTIMSY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pKillers, patchReplacementText(pKillers), Vector2i(DM_KILLERSX, DM_KILLERSY), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pVictims, patchReplacementText(pVictims), Vector2i(DM_VICTIMSX, DM_VICTIMSY), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); for(int i = 0; i < NUMTEAMS; ++i) { @@ -709,13 +707,13 @@ static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MAT patchinfo_t info; R_GetPatchInfo(patchId, &info); - WI_DrawPatchXY3(patchId, replacement, x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); - WI_DrawPatchXY3(patchId, replacement, DM_MATRIXX - info.geometry.size.width / 2, y, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(patchId, replacement, Vector2i(origin.x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(patchId, replacement, Vector2i(DM_MATRIXX - info.geometry.size.width / 2, origin.y), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); if(i == inPlayerTeam) { - WI_DrawPatchXY3(pFaceDead, patchReplacementText(pFaceDead), x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); - WI_DrawPatchXY3(pFaceAlive, patchReplacementText(pFaceAlive), DM_MATRIXX - info.geometry.size.width / 2, y, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pFaceDead, patchReplacementText(pFaceDead), Vector2i(origin.x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pFaceAlive, patchReplacementText(pFaceAlive), Vector2i(DM_MATRIXX - info.geometry.size.width / 2, origin.y), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } // If more than 1 member, show the member count. @@ -724,8 +722,8 @@ static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MAT char tmp[20]; sprintf(tmp, "%i", teamInfo[i].playerCount); FR_SetFont(FID(GF_FONTA)); - FR_DrawTextXY3(tmp, x - info.geometry.size.width / 2 + 1, DM_MATRIXY - WI_SPACINGY + info.geometry.size.height - 8, ALIGN_TOPLEFT, DTF_NO_TYPEIN); - FR_DrawTextXY3(tmp, DM_MATRIXX - info.geometry.size.width / 2 + 1, y + info.geometry.size.height - 8, ALIGN_TOPLEFT, DTF_NO_TYPEIN); + FR_DrawTextXY3(tmp, origin.x - info.geometry.size.width / 2 + 1, DM_MATRIXY - WI_SPACINGY + info.geometry.size.height - 8, ALIGN_TOPLEFT, DTF_NO_TYPEIN); + FR_DrawTextXY3(tmp, DM_MATRIXX - info.geometry.size.width / 2 + 1, origin.y + info.geometry.size.height - 8, ALIGN_TOPLEFT, DTF_NO_TYPEIN); } } else @@ -737,23 +735,23 @@ static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MAT patchinfo_t info; R_GetPatchInfo(patchId, &info); - WI_DrawPatchXY3(patchId, replacement, x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY + 10, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); - WI_DrawPatchXY3(patchId, replacement, DM_MATRIXX - info.geometry.size.width / 2, y + 10, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(patchId, replacement, Vector2i(origin.x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY + 10), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(patchId, replacement, Vector2i(DM_MATRIXX - info.geometry.size.width / 2, origin.y + 10), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } - x += DM_SPACINGX; - y += WI_SPACINGY; + origin.x += DM_SPACINGX; + origin.y += WI_SPACINGY; } // Draw stats. - y = DM_MATRIXY + 10; + origin.y = DM_MATRIXY + 10; FR_SetFont(FID(GF_SMALL)); FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); int const w = FR_CharWidth('0'); for(int i = 0; i < NUMTEAMS; ++i) { - x = DM_MATRIXX + DM_SPACINGX; + origin.x = DM_MATRIXX + DM_SPACINGX; if(teamInfo[i].playerCount > 0) { char buf[20]; @@ -762,15 +760,15 @@ static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MAT if(teamInfo[k].playerCount > 0) { dd_snprintf(buf, 20, "%i", dmFrags[i][k]); - FR_DrawTextXY3(buf, x + w, y, ALIGN_TOPRIGHT, DTF_NO_TYPEIN); + FR_DrawTextXY3(buf, origin.x + w, origin.y, ALIGN_TOPRIGHT, DTF_NO_TYPEIN); } - x += DM_SPACINGX; + origin.x += DM_SPACINGX; } dd_snprintf(buf, 20, "%i", dmTotals[i]); - FR_DrawTextXY3(buf, DM_TOTALSX + w, y, ALIGN_TOPRIGHT, DTF_NO_TYPEIN); + FR_DrawTextXY3(buf, DM_TOTALSX + w, origin.y, ALIGN_TOPRIGHT, DTF_NO_TYPEIN); } - y += WI_SPACINGY; + origin.y += WI_SPACINGY; } DGL_Disable(DGL_TEXTURE_2D); @@ -960,14 +958,14 @@ static void drawNetgameStats() // Draw stat titles (top line). R_GetPatchInfo(pKills, &info); - WI_DrawPatchXY3(pKills, patchReplacementText(pKills), ORIGINX + NG_SPACINGX, NG_STATSY, ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pKills, patchReplacementText(pKills), Vector2i(ORIGINX + NG_SPACINGX, NG_STATSY), ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); int y = NG_STATSY + info.geometry.size.height; - WI_DrawPatchXY3(pItems, patchReplacementText(pItems), ORIGINX + 2 * NG_SPACINGX, NG_STATSY, ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); - WI_DrawPatchXY3(pSecret, patchReplacementText(pSecret), ORIGINX + 3 * NG_SPACINGX, NG_STATSY, ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pItems, patchReplacementText(pItems), Vector2i(ORIGINX + 2 * NG_SPACINGX, NG_STATSY), ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pSecret, patchReplacementText(pSecret), Vector2i(ORIGINX + 3 * NG_SPACINGX, NG_STATSY), ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); if(doFrags) { - WI_DrawPatchXY3(pFrags, patchReplacementText(pFrags), ORIGINX + 4 * NG_SPACINGX, NG_STATSY, ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pFrags, patchReplacementText(pFrags), Vector2i(ORIGINX + 4 * NG_SPACINGX, NG_STATSY), ALIGN_TOPRIGHT, 0, DTF_NO_TYPEIN); } // Draw stats. @@ -983,7 +981,7 @@ static void drawNetgameStats() patchinfo_t info; R_GetPatchInfo(pTeamBackgrounds[i], &info); - WI_DrawPatchXY3(pTeamBackgrounds[i], patchReplacementText(pTeamBackgrounds[i]), x - info.geometry.size.width, y, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pTeamBackgrounds[i], patchReplacementText(pTeamBackgrounds[i]), Vector2i(x - info.geometry.size.width, y), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); // If more than 1 member, show the member count. if(1 != teamInfo[i].playerCount) @@ -996,7 +994,7 @@ static void drawNetgameStats() if(i == inPlayerTeam) { - WI_DrawPatchXY3(pFaceAlive, patchReplacementText(pFaceAlive), x - info.geometry.size.width, y, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pFaceAlive, patchReplacementText(pFaceAlive), Vector2i(x - info.geometry.size.width, y), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } x += NG_SPACINGX; @@ -1035,13 +1033,13 @@ static void drawSinglePlayerStats() FR_LoadDefaultAttrib(); FR_SetColorAndAlpha(defFontRGB2[CR], defFontRGB2[CG], defFontRGB2[CB], 1); - WI_DrawPatchXY3(pKills, patchReplacementText(pKills), SP_STATSX, SP_STATSY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); - WI_DrawPatchXY3(pItems, patchReplacementText(pItems), SP_STATSX, SP_STATSY + lh, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); - WI_DrawPatchXY3(pSecretSP, patchReplacementText(pSecretSP), SP_STATSX, SP_STATSY + 2 * lh, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); - WI_DrawPatchXY3(pTime, patchReplacementText(pTime), SP_TIMEX, SP_TIMEY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pKills, patchReplacementText(pKills), Vector2i(SP_STATSX, SP_STATSY), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pItems, patchReplacementText(pItems), Vector2i(SP_STATSX, SP_STATSY + lh), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pSecretSP, patchReplacementText(pSecretSP), Vector2i(SP_STATSX, SP_STATSY + 2 * lh), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pTime, patchReplacementText(pTime), Vector2i(SP_TIMEX, SP_TIMEY), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); if(wbs->parTime != -1) { - WI_DrawPatchXY3(pPar, patchReplacementText(pPar), SCREENWIDTH / 2 + SP_TIMEX, SP_TIMEY, ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); + WI_DrawPatch(pPar, patchReplacementText(pPar), Vector2i(SCREENWIDTH / 2 + SP_TIMEX, SP_TIMEY), ALIGN_TOPLEFT, 0, DTF_NO_TYPEIN); } FR_SetFont(FID(GF_SMALL)); @@ -1051,12 +1049,12 @@ static void drawSinglePlayerStats() if(cntTime >= 0) { - drawTime(SCREENWIDTH / 2 - SP_TIMEX, SP_TIMEY, cntTime / TICRATE); + drawTime(Vector2i(SCREENWIDTH / 2 - SP_TIMEX, SP_TIMEY), cntTime / TICRATE); } if(wbs->parTime != -1 && cntPar >= 0) { - drawTime(SCREENWIDTH - SP_TIMEX, SP_TIMEY, cntPar / TICRATE); + drawTime(Vector2i(SCREENWIDTH - SP_TIMEX, SP_TIMEY), cntPar / TICRATE); } DGL_Disable(DGL_TEXTURE_2D); diff --git a/doomsday/plugins/doom64/src/wi_stuff.cpp b/doomsday/plugins/doom64/src/wi_stuff.cpp index ca5c020942..1e9a085e2b 100644 --- a/doomsday/plugins/doom64/src/wi_stuff.cpp +++ b/doomsday/plugins/doom64/src/wi_stuff.cpp @@ -32,6 +32,8 @@ #include "p_mapsetup.h" #include "p_start.h" +using namespace de; + #define NUMMAPS (9) struct teaminfo_t @@ -120,9 +122,9 @@ static void drawBackground() DGL_Disable(DGL_TEXTURE_2D); } -static void drawFinishedTitle(int x = SCREENWIDTH / 2, int y = WI_TITLEY) +static void drawFinishedTitle(Vector2i &origin = Vector2i(SCREENWIDTH / 2, WI_TITLEY)) { - de::String const mapTitle = G_MapTitle(); // current map + String const mapTitle = G_MapTitle(); // current map DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); @@ -131,18 +133,19 @@ static void drawFinishedTitle(int x = SCREENWIDTH / 2, int y = WI_TITLEY) // Draw patchid_t const mapTitlePatch = G_MapTitlePatch(&wbs->currentMap); - WI_DrawPatchXY3(mapTitlePatch, patchReplacementText(mapTitlePatch, mapTitle.toUtf8().constData()), x, y, ALIGN_TOP, 0, DTF_NO_TYPEIN); + WI_DrawPatch(mapTitlePatch, patchReplacementText(mapTitlePatch, mapTitle.toUtf8().constData()), + origin, ALIGN_TOP, 0, DTF_NO_TYPEIN); patchinfo_t info; if(R_GetPatchInfo(mapTitlePatch, &info)) - y += (5 * info.geometry.size.height) / 4; + origin.y += (5 * info.geometry.size.height) / 4; // Draw "Finished!" - WI_DrawPatchXY2(pFinished, patchReplacementText(pFinished), x, y, ALIGN_TOP); + WI_DrawPatch(pFinished, patchReplacementText(pFinished), origin, ALIGN_TOP); DGL_Disable(DGL_TEXTURE_2D); } -static void drawEnteringTitle(int x = SCREENWIDTH / 2, int y = WI_TITLEY) +static void drawEnteringTitle(Vector2i &origin = Vector2i(SCREENWIDTH / 2, WI_TITLEY)) { // See if there is a map name... char *mapName = 0; @@ -169,15 +172,15 @@ static void drawEnteringTitle(int x = SCREENWIDTH / 2, int y = WI_TITLEY) FR_LoadDefaultAttrib(); // Draw "Entering" - WI_DrawPatchXY2(pEntering, patchReplacementText(pEntering), x, y, ALIGN_TOP); + WI_DrawPatch(pEntering, patchReplacementText(pEntering), origin, ALIGN_TOP); patchinfo_t info; patchid_t const mapTitlePatch = G_MapTitlePatch(&wbs->nextMap); if(R_GetPatchInfo(mapTitlePatch, &info)) - y += (5 * info.geometry.size.height) / 4; + origin.y += (5 * info.geometry.size.height) / 4; // Draw map. - WI_DrawPatchXY2(mapTitlePatch, patchReplacementText(mapTitlePatch, mapName), x, y, ALIGN_TOP); + WI_DrawPatch(mapTitlePatch, patchReplacementText(mapTitlePatch, mapName), origin, ALIGN_TOP); DGL_Disable(DGL_TEXTURE_2D); } @@ -195,27 +198,27 @@ static void drawPercent(int x, int y, int p) /** * Display map completion time and par, or "sucks" message if overflow. */ -static void drawTime(int x, int y, int t) +static void drawTime(Vector2i &origin, int t) { if(t < 0) return; if(t <= 61 * 59) { - x -= 22; + origin.x -= 22; int const seconds = t % 60; int const minutes = t / 60 % 60; char buf[20]; - FR_DrawCharXY(':', x, y); + FR_DrawCharXY(':', origin.x, origin.y); if(minutes > 0) { dd_snprintf(buf, 20, "%d", minutes); - FR_DrawTextXY3(buf, x, y, ALIGN_TOPRIGHT, DTF_NO_EFFECTS); + FR_DrawTextXY3(buf, origin.x, origin.y, ALIGN_TOPRIGHT, DTF_NO_EFFECTS); } dd_snprintf(buf, 20, "%02d", seconds); - FR_DrawTextXY(buf, x+FR_CharWidth(':'), y); + FR_DrawTextXY(buf, origin.x + FR_CharWidth(':'), origin.y); return; } @@ -224,7 +227,7 @@ static void drawTime(int x, int y, int t) patchinfo_t info; if(!R_GetPatchInfo(pSucks, &info)) return; - WI_DrawPatchXY3(pSucks, patchReplacementText(pSucks), x - info.geometry.size.width, y, ALIGN_TOPLEFT, 0, DTF_NO_EFFECTS); + WI_DrawPatch(pSucks, patchReplacementText(pSucks), Vector2i(origin.x - info.geometry.size.width, origin.y), ALIGN_TOPLEFT, 0, DTF_NO_EFFECTS); } void WI_End() @@ -349,7 +352,7 @@ static void updateDeathmatchStats() } } -static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MATRIXY) +static void drawDeathmatchStats(Vector2i &origin = Vector2i(DM_MATRIXX + DM_SPACINGX, DM_MATRIXY)) { DGL_Enable(DGL_TEXTURE_2D); DGL_Color4f(1, 1, 1, 1); @@ -361,11 +364,11 @@ static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MAT patchinfo_t info; if(R_GetPatchInfo(pTotal, &info)) { - WI_DrawPatchXY(pTotal, patchReplacementText(pTotal), DM_TOTALSX - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY + 10); + WI_DrawPatch(pTotal, patchReplacementText(pTotal), Vector2i(DM_TOTALSX - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY + 10)); } - WI_DrawPatchXY(pKillers, patchReplacementText(pKillers), DM_KILLERSX, DM_KILLERSY); - WI_DrawPatchXY(pVictims, patchReplacementText(pVictims), DM_VICTIMSX, DM_VICTIMSY); + WI_DrawPatch(pKillers, patchReplacementText(pKillers), Vector2i(DM_KILLERSX, DM_KILLERSY)); + WI_DrawPatch(pVictims, patchReplacementText(pVictims), Vector2i(DM_VICTIMSX, DM_VICTIMSY)); for(int i = 0; i < NUMTEAMS; ++i) { @@ -377,13 +380,13 @@ static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MAT patchinfo_t info; R_GetPatchInfo(patchId, &info); - WI_DrawPatchXY(patchId, replacement, x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY); - WI_DrawPatchXY(patchId, replacement, DM_MATRIXX - info.geometry.size.width / 2, y); + WI_DrawPatch(patchId, replacement, Vector2i(origin.x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY)); + WI_DrawPatch(patchId, replacement, Vector2i(DM_MATRIXX - info.geometry.size.width / 2, origin.y)); /*if(i == inPlayerTeam) { - WI_DrawPatchXY(pFaceDead, Hu_ChoosePatchReplacement(pFaceDead), x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY); - WI_DrawPatchXY(pFaceAlive, Hu_ChoosePatchReplacement(pFaceAlive), DM_MATRIXX - info.width / 2, y); + WI_DrawPatch(pFaceDead, Hu_ChoosePatchReplacement(pFaceDead ), Vector2i(origin.x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY)); + WI_DrawPatch(pFaceAlive, Hu_ChoosePatchReplacement(pFaceAlive), Vector2i(DM_MATRIXX - info.width / 2, origin.y)); }*/ // If more than 1 member, show the member count. @@ -392,8 +395,8 @@ static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MAT char tmp[20]; sprintf(tmp, "%i", teamInfo[i].playerCount); FR_SetFont(FID(GF_FONTA)); - FR_DrawTextXY(tmp, x - info.geometry.size.width / 2 + 1, DM_MATRIXY - WI_SPACINGY + info.geometry.size.height - 8); - FR_DrawTextXY(tmp, DM_MATRIXX - info.geometry.size.width / 2 + 1, y + info.geometry.size.height - 8); + FR_DrawTextXY(tmp, origin.x - info.geometry.size.width / 2 + 1, DM_MATRIXY - WI_SPACINGY + info.geometry.size.height - 8); + FR_DrawTextXY(tmp, DM_MATRIXX - info.geometry.size.width / 2 + 1, origin.y + info.geometry.size.height - 8); } } else @@ -404,22 +407,22 @@ static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MAT patchinfo_t info; R_GetPatchInfo(patchId, &info); - WI_DrawPatchXY(patchId, replacement, x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY); - WI_DrawPatchXY(patchId, replacement, DM_MATRIXX - info.geometry.size.width / 2, y); + WI_DrawPatch(patchId, replacement, Vector2i(origin.x - info.geometry.size.width / 2, DM_MATRIXY - WI_SPACINGY)); + WI_DrawPatch(patchId, replacement, Vector2i(DM_MATRIXX - info.geometry.size.width / 2, origin.y)); } - x += DM_SPACINGX; - y += WI_SPACINGY; + origin.x += DM_SPACINGX; + origin.y += WI_SPACINGY; } // Draw stats. - y = DM_MATRIXY + 10; + origin.y = DM_MATRIXY + 10; FR_SetFont(FID(GF_SMALL)); int const w = FR_CharWidth('0'); for(int i = 0; i < NUMTEAMS; ++i) { - x = DM_MATRIXX + DM_SPACINGX; + origin.x = DM_MATRIXX + DM_SPACINGX; if(teamInfo[i].playerCount > 0) { char buf[20]; @@ -428,15 +431,15 @@ static void drawDeathmatchStats(int x = DM_MATRIXX + DM_SPACINGX, int y = DM_MAT if(teamInfo[k].playerCount > 0) { dd_snprintf(buf, 20, "%i", dmFrags[i][k]); - FR_DrawTextXY3(buf, x + w, y, ALIGN_TOPRIGHT, DTF_NO_EFFECTS); + FR_DrawTextXY3(buf, origin.x + w, origin.y, ALIGN_TOPRIGHT, DTF_NO_EFFECTS); } - x += DM_SPACINGX; + origin.x += DM_SPACINGX; } dd_snprintf(buf, 20, "%i", dmTotals[i]); - FR_DrawTextXY3(buf, DM_TOTALSX + w, y, ALIGN_TOPRIGHT, DTF_NO_EFFECTS); + FR_DrawTextXY3(buf, DM_TOTALSX + w, origin.y, ALIGN_TOPRIGHT, DTF_NO_EFFECTS); } - y += WI_SPACINGY; + origin.y += WI_SPACINGY; } DGL_Disable(DGL_TEXTURE_2D); @@ -614,19 +617,19 @@ static void drawNetgameStats() // Draw stat titles (top line). patchinfo_t info; R_GetPatchInfo(pKills, &info); - WI_DrawPatchXY(pKills, patchReplacementText(pKills), ORIGINX + NG_SPACINGX - info.geometry.size.width, NG_STATSY); + WI_DrawPatch(pKills, patchReplacementText(pKills), Vector2i(ORIGINX + NG_SPACINGX - info.geometry.size.width), NG_STATSY); int y = NG_STATSY + info.geometry.size.height; R_GetPatchInfo(pItems, &info); - WI_DrawPatchXY(pItems, patchReplacementText(pItems), ORIGINX + 2 * NG_SPACINGX - info.geometry.size.width, NG_STATSY); + WI_DrawPatch(pItems, patchReplacementText(pItems), Vector2i(ORIGINX + 2 * NG_SPACINGX - info.geometry.size.width), NG_STATSY); R_GetPatchInfo(pSecret, &info); - WI_DrawPatchXY(pSecret, patchReplacementText(pSecret), ORIGINX + 3 * NG_SPACINGX - info.geometry.size.width, NG_STATSY); + WI_DrawPatch(pSecret, patchReplacementText(pSecret), Vector2i(ORIGINX + 3 * NG_SPACINGX - info.geometry.size.width), NG_STATSY); if(doFrags) { R_GetPatchInfo(pFrags, &info); - WI_DrawPatchXY(pFrags, patchReplacementText(pFrags), ORIGINX + 4 * NG_SPACINGX - info.geometry.size.width, NG_STATSY); + WI_DrawPatch(pFrags, patchReplacementText(pFrags), Vector2i(ORIGINX + 4 * NG_SPACINGX - info.geometry.size.width), NG_STATSY); } // Draw stats. @@ -640,7 +643,7 @@ static void drawNetgameStats() patchinfo_t info; R_GetPatchInfo(patchId, &info); - WI_DrawPatchXY(patchId, patchReplacementText(patchId), x - info.geometry.size.width, y); + WI_DrawPatch(patchId, patchReplacementText(patchId), Vector2i(x - info.geometry.size.width, y)); // If more than 1 member, show the member count. if(1 != teamInfo[i].playerCount) @@ -692,27 +695,27 @@ static void drawSinglePlayerStats() int const lh = (3 * FR_CharHeight('0')) / 2; // Line height. - WI_DrawPatchXY(pKills, patchReplacementText(pKills), SP_STATSX, SP_STATSY); + WI_DrawPatch(pKills, patchReplacementText(pKills), Vector2i(SP_STATSX, SP_STATSY)); drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY, cntKills[0]); - WI_DrawPatchXY(pItems, patchReplacementText(pItems), SP_STATSX, SP_STATSY + lh); + WI_DrawPatch(pItems, patchReplacementText(pItems), Vector2i(SP_STATSX, SP_STATSY + lh)); drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY + lh, cntItems[0]); - WI_DrawPatchXY(pSecretSP, patchReplacementText(pSecretSP), SP_STATSX, SP_STATSY + 2 * lh); + WI_DrawPatch(pSecretSP, patchReplacementText(pSecretSP), Vector2i(SP_STATSX, SP_STATSY + 2 * lh)); drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY + 2 * lh, cntSecret[0]); - WI_DrawPatchXY(pTime, patchReplacementText(pTime), SP_TIMEX, SP_TIMEY); + WI_DrawPatch(pTime, patchReplacementText(pTime), Vector2i(SP_TIMEX, SP_TIMEY)); if(cntTime >= 0) { - drawTime(SCREENWIDTH / 2 - SP_TIMEX, SP_TIMEY, cntTime / TICRATE); + drawTime(Vector2i(SCREENWIDTH / 2 - SP_TIMEX, SP_TIMEY), cntTime / TICRATE); } if(wbs->parTime != -1) { - WI_DrawPatchXY(pPar, patchReplacementText(pPar), SCREENWIDTH / 2 + SP_TIMEX, SP_TIMEY); + WI_DrawPatch(pPar, patchReplacementText(pPar), Vector2i(SCREENWIDTH / 2 + SP_TIMEX, SP_TIMEY)); if(cntPar >= 0) { - drawTime(SCREENWIDTH - SP_TIMEX, SP_TIMEY, cntPar / TICRATE); + drawTime(Vector2i(SCREENWIDTH - SP_TIMEX, SP_TIMEY), cntPar / TICRATE); } } DGL_Disable(DGL_TEXTURE_2D);