Skip to content

Commit

Permalink
Moved patch drawing methods out of hu_stuff and into gl_drawpatch Ren…
Browse files Browse the repository at this point in the history
…amed all patch drawing methods swapping the prefix M_ for GL_
  • Loading branch information
danij-deng committed May 22, 2010
1 parent 2d7133d commit 9b3df05
Show file tree
Hide file tree
Showing 30 changed files with 326 additions and 201 deletions.
2 changes: 2 additions & 0 deletions doomsday/build/codeblocks/jdoom.cbp
Expand Up @@ -104,6 +104,7 @@
<Unit filename="..\..\plugins\common\include\g_controls.h" />
<Unit filename="..\..\plugins\common\include\g_update.h" />
<Unit filename="..\..\plugins\common\include\gl_drawcompositefont.h" />
<Unit filename="..\..\plugins\common\include\gl_drawpatch.h" />
<Unit filename="..\..\plugins\common\include\hu_lib.h" />
<Unit filename="..\..\plugins\common\include\hu_log.h" />
<Unit filename="..\..\plugins\common\include\hu_menu.h" />
Expand Down Expand Up @@ -170,6 +171,7 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\plugins\common\src\gl_drawcompositefont.c" />
<Unit filename="..\..\plugins\common\src\gl_patch.c" />
<Unit filename="..\..\plugins\common\src\hu_lib.c">
<Option compilerVar="CC" />
</Unit>
Expand Down
2 changes: 2 additions & 0 deletions doomsday/build/codeblocks/jdoom64.cbp
Expand Up @@ -100,6 +100,7 @@
<Unit filename="..\..\plugins\common\include\g_controls.h" />
<Unit filename="..\..\plugins\common\include\g_update.h" />
<Unit filename="..\..\plugins\common\include\gl_drawcompositefont.h" />
<Unit filename="..\..\plugins\common\include\gl_drawpatch.h" />
<Unit filename="..\..\plugins\common\include\hu_lib.h" />
<Unit filename="..\..\plugins\common\include\hu_log.h" />
<Unit filename="..\..\plugins\common\include\hu_menu.h" />
Expand Down Expand Up @@ -167,6 +168,7 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\plugins\common\src\gl_drawcompositefont.c" />
<Unit filename="..\..\plugins\common\src\gl_drawpatch.c" />
<Unit filename="..\..\plugins\common\src\hu_lib.c">
<Option compilerVar="CC" />
</Unit>
Expand Down
2 changes: 2 additions & 0 deletions doomsday/build/codeblocks/jheretic.cbp
Expand Up @@ -99,6 +99,7 @@
<Unit filename="..\..\plugins\common\include\g_controls.h" />
<Unit filename="..\..\plugins\common\include\g_update.h" />
<Unit filename="..\..\plugins\common\include\gl_drawcompositefont.h" />
<Unit filename="..\..\plugins\common\include\gl_drawpatch.h" />
<Unit filename="..\..\plugins\common\include\hu_inventory.h" />
<Unit filename="..\..\plugins\common\include\hu_lib.h" />
<Unit filename="..\..\plugins\common\include\hu_log.h" />
Expand Down Expand Up @@ -148,6 +149,7 @@
<Unit filename="..\..\plugins\common\src\g_game.c" />
<Unit filename="..\..\plugins\common\src\g_update.c" />
<Unit filename="..\..\plugins\common\src\gl_drawcompositefont.c" />
<Unit filename="..\..\plugins\common\src\gl_drawpatch.c" />
<Unit filename="..\..\plugins\common\src\hu_inventory.c" />
<Unit filename="..\..\plugins\common\src\hu_lib.c" />
<Unit filename="..\..\plugins\common\src\hu_log.c" />
Expand Down
2 changes: 2 additions & 0 deletions doomsday/build/codeblocks/jhexen.cbp
Expand Up @@ -100,6 +100,7 @@
<Unit filename="..\..\plugins\common\include\g_controls.h" />
<Unit filename="..\..\plugins\common\include\g_update.h" />
<Unit filename="..\..\plugins\common\include\gl_drawcompositefont.h" />
<Unit filename="..\..\plugins\common\include\gl_drawpatch.h" />
<Unit filename="..\..\plugins\common\include\hu_inventory.h" />
<Unit filename="..\..\plugins\common\include\hu_lib.h" />
<Unit filename="..\..\plugins\common\include\hu_log.h" />
Expand Down Expand Up @@ -167,6 +168,7 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\plugins\common\src\gl_drawcompositefont.c" />
<Unit filename="..\..\plugins\common\src\gl_drawpatch.c" />
<Unit filename="..\..\plugins\common\src\hu_inventory.c" />
<Unit filename="..\..\plugins\common\src\hu_lib.c" />
<Unit filename="..\..\plugins\common\src\hu_log.c">
Expand Down
1 change: 1 addition & 0 deletions doomsday/build/win32/jdoom64_cl.rsp
Expand Up @@ -9,6 +9,7 @@
.\..\..\plugins\common\src\g_game.c
.\..\..\plugins\common\src\g_update.c
.\..\..\plugins\common\src\gl_drawcompositefont.c
.\..\..\plugins\common\src\gl_drawpatch.c
.\..\..\plugins\common\src\hu_lib.c
.\..\..\plugins\common\src\hu_log.c
.\..\..\plugins\common\src\hu_menu.c
Expand Down
1 change: 1 addition & 0 deletions doomsday/build/win32/jdoom_cl.rsp
Expand Up @@ -67,5 +67,6 @@
.\..\..\plugins\common\src\g_game.c
.\..\..\plugins\common\src\g_update.c
.\..\..\plugins\common\src\gl_drawcompositefont.c
.\..\..\plugins\common\src\gl_drawpatch.c
.\..\..\plugins\jdoom\src\d_items.c
.\..\..\plugins\jdoom\src\acfnlink.c
1 change: 1 addition & 0 deletions doomsday/build/win32/jheretic_cl.rsp
Expand Up @@ -42,6 +42,7 @@
.\..\..\plugins\common\src\g_game.c
.\..\..\plugins\common\src\g_update.c
.\..\..\plugins\common\src\gl_drawcompositefont.c
.\..\..\plugins\common\src\gl_drawpatch.c
.\..\..\plugins\common\src\f_infine.c
.\..\..\plugins\common\src\hu_stuff.c
.\..\..\plugins\common\src\hu_lib.c
Expand Down
1 change: 1 addition & 0 deletions doomsday/build/win32/jhexen_cl.rsp
Expand Up @@ -36,6 +36,7 @@
.\..\..\plugins\common\src\g_controls.c
.\..\..\plugins\common\src\g_game.c
.\..\..\plugins\common\src\gl_drawcompositefont.c
.\..\..\plugins\common\src\gl_drawpatch.c
.\..\..\plugins\common\src\f_infine.c
.\..\..\plugins\common\src\p_saveg.c
.\..\..\plugins\common\src\hu_stuff.c
Expand Down
8 changes: 8 additions & 0 deletions doomsday/build/win32/vs8/jdoom.vcproj
Expand Up @@ -848,6 +848,10 @@
RelativePath="..\..\..\plugins\common\include\gl_drawcompositefont.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\gl_drawpatch.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\hu_lib.h"
>
Expand Down Expand Up @@ -1044,6 +1048,10 @@
RelativePath="..\..\..\plugins\common\src\gl_drawcompositefont.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\gl_drawpatch.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\hu_lib.c"
>
Expand Down
8 changes: 8 additions & 0 deletions doomsday/build/win32/vs8/jdoom64.vcproj
Expand Up @@ -844,6 +844,10 @@
RelativePath="..\..\..\plugins\common\include\gl_drawcompositefont.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\gl_drawpatch.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\hu_lib.h"
>
Expand Down Expand Up @@ -1036,6 +1040,10 @@
RelativePath="..\..\..\plugins\common\src\gl_drawcompositefont.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\gl_drawpatch.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\hu_lib.c"
>
Expand Down
8 changes: 8 additions & 0 deletions doomsday/build/win32/vs8/jheretic.vcproj
Expand Up @@ -847,6 +847,10 @@
RelativePath="..\..\..\plugins\common\include\gl_drawcompositefont.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\gl_drawpatch.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\hu_inventory.h"
>
Expand Down Expand Up @@ -1047,6 +1051,10 @@
RelativePath="..\..\..\plugins\common\src\gl_drawcompositefont.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\gl_drawpatch.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\hu_inventory.c"
>
Expand Down
8 changes: 8 additions & 0 deletions doomsday/build/win32/vs8/jhexen.vcproj
Expand Up @@ -852,6 +852,10 @@
RelativePath="..\..\..\plugins\common\include\gl_drawcompositefont.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\gl_drawpatch.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\hu_inventory.h"
>
Expand Down Expand Up @@ -1052,6 +1056,10 @@
RelativePath="..\..\..\plugins\common\src\gl_drawcompositefont.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\gl_drawpatch.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\hu_inventory.c"
>
Expand Down
20 changes: 10 additions & 10 deletions doomsday/plugins/common/include/gl_drawcompositefont.h
Expand Up @@ -84,9 +84,17 @@ void R_InitFont(gamefontid_t fontid, const fontpatch_t* patches, size
/*@}*/

/**
* Text string fragments:
* Text strings (formatted).
*/
void GL_DrawText(const char* string, int x, int y, gamefontid_t font, short flags, int defTracking, float defRed, float defGreen, float defBlue, float defAlpha, boolean defCase);

// Utility routines:
int GL_TextWidth(const char* string, gamefontid_t font);
int GL_TextHeight(const char* string, gamefontid_t font);

/**
* Text string fragments:
*/
void GL_DrawTextFragment(const char* string, int x, int y);
void GL_DrawTextFragment2(const char* string, int x, int y, gamefontid_t font);
void GL_DrawTextFragment3(const char* string, int x, int y, gamefontid_t font, short flags);
Expand All @@ -96,16 +104,8 @@ void GL_DrawTextFragment5(const char* string, int x, int y, gamefonti
// Utility routines:
int GL_TextFragmentWidth(const char* string, gamefontid_t font);
int GL_TextFragmentWidth2(const char* string, gamefontid_t font, int tracking);
int GL_TextFragmentHeight(const char* string, gamefontid_t font);

/**
* Text strings (formatted).
*/
void GL_DrawText(const char* string, int x, int y, gamefontid_t font, short flags, int defTracking, float defRed, float defGreen, float defBlue, float defAlpha, boolean defCase);

// Utility routines:
int GL_TextWidth(const char* string, gamefontid_t font);
int GL_TextHeight(const char* string, gamefontid_t font);
int GL_TextFragmentHeight(const char* string, gamefontid_t font);

/**
* Single character:
Expand Down
56 changes: 56 additions & 0 deletions doomsday/plugins/common/include/gl_drawpatch.h
@@ -0,0 +1,56 @@
/**\file
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 1999-2010 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2006-2010 Daniel Swanson <danij@dengine.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

/**
* gl_drawpatch.h: Convenient methods for drawing quads textured with
* Patch-format graphics.
*/

#ifndef LIBCOMMON_GRAPHICS_DRAW_PATCH_H
#define LIBCOMMON_GRAPHICS_DRAW_PATCH_H

#include "dd_types.h"

/**
* @defGroup drawPatchFlags Draw Patch Flags.
*/
/*@{*/
#define DPF_ALIGN_LEFT 0x0001
#define DPF_ALIGN_RIGHT 0x0002
#define DPF_ALIGN_BOTTOM 0x0004
#define DPF_ALIGN_TOP 0x0008
#define DPF_NO_OFFSETX 0x0010
#define DPF_NO_OFFSETY 0x0020

#define DPF_NO_OFFSET (DPF_NO_OFFSETX|DPF_NO_OFFSETY)
#define DPF_ALIGN_TOPLEFT (DPF_ALIGN_TOP|DPF_ALIGN_LEFT)
#define DPF_ALIGN_BOTTOMLEFT (DPF_ALIGN_BOTTOM|DPF_ALIGN_LEFT)
#define DPF_ALIGN_TOPRIGHT (DPF_ALIGN_TOP|DPF_ALIGN_RIGHT)
#define DPF_ALIGN_BOTTOMRIGHT (DPF_ALIGN_BOTTOM|DPF_ALIGN_RIGHT)
/*@}*/

void GL_DrawPatch(patchid_t id, int x, int y);
void GL_DrawPatch2(patchid_t id, int x, int y, short flags);

#endif /* LIBCOMMON_GRAPHICS_DRAW_PATCH_H */
26 changes: 1 addition & 25 deletions doomsday/plugins/common/include/hu_stuff.h
Expand Up @@ -31,6 +31,7 @@
#define __COMMON_HU_STUFF_H__

#include "gl_drawcompositefont.h"
#include "gl_drawpatch.h"

#if __JHEXEN__
# include "h2def.h"
Expand Down Expand Up @@ -91,31 +92,6 @@ void M_DrawShadowedChar(unsigned char ch, int x, int y);
void M_DrawShadowedChar2(unsigned char ch, int x, int y, gamefontid_t font);
void M_DrawShadowedChar3(unsigned char ch, int x, int y, gamefontid_t font, short flags, float r, float g, float b, float a);

/**
* Patches:
*/

/**
* @defGroup drawPatchFlags Draw Patch Flags.
*/
/*@{*/
#define DPF_ALIGN_LEFT 0x0001
#define DPF_ALIGN_RIGHT 0x0002
#define DPF_ALIGN_BOTTOM 0x0004
#define DPF_ALIGN_TOP 0x0008
#define DPF_NO_OFFSETX 0x0010
#define DPF_NO_OFFSETY 0x0020

#define DPF_NO_OFFSET (DPF_NO_OFFSETX|DPF_NO_OFFSETY)
#define DPF_ALIGN_TOPLEFT (DPF_ALIGN_TOP|DPF_ALIGN_LEFT)
#define DPF_ALIGN_BOTTOMLEFT (DPF_ALIGN_BOTTOM|DPF_ALIGN_LEFT)
#define DPF_ALIGN_TOPRIGHT (DPF_ALIGN_TOP|DPF_ALIGN_RIGHT)
#define DPF_ALIGN_BOTTOMRIGHT (DPF_ALIGN_BOTTOM|DPF_ALIGN_RIGHT)
/*@}*/

void M_DrawPatch(patchid_t id, int x, int y);
void M_DrawPatch2(patchid_t id, int x, int y, short flags);

void M_DrawShadowedPatch(patchid_t id, int x, int y);
void M_DrawShadowedPatch2(patchid_t id, int x, int y, short flags);
void M_DrawShadowedPatch3(patchid_t id, int x, int y, short flags, float r, float g, float b, float a);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/src/am_map.c
Expand Up @@ -1760,9 +1760,9 @@ void M_DrawMapMenu(void)

// Draw the page arrows.
token = dpInvPageLeft[!menu->firstItem || (menuTime & 8)];
M_DrawPatch(token, menu->x, menu->y - 22);
GL_DrawPatch(token, menu->x, menu->y - 22);
token = dpInvPageRight[menu->firstItem + menu->numVisItems >= menu->itemCount || (menuTime & 8)];
M_DrawPatch(token, 312 - menu->x, menu->y - 22);
GL_DrawPatch(token, 312 - menu->x, menu->y - 22);
#endif

idx = 0;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/f_infine.c
Expand Up @@ -1810,7 +1810,7 @@ void FI_Drawer(void)
}
else if(pic->flags.is_patch)
{
M_DrawPatch((patchid_t)pic->tex[sq], 0, 0);
GL_DrawPatch((patchid_t)pic->tex[sq], 0, 0);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/common/src/gl_drawcompositefont.c
Expand Up @@ -39,8 +39,8 @@
# include "jhexen.h"
#endif

#include "gl_drawpatch.h"
#include "gl_drawcompositefont.h"
#include "hu_stuff.h"

// MACROS ------------------------------------------------------------------

Expand Down Expand Up @@ -748,7 +748,7 @@ void GL_DrawTextFragment(const char* string, int x, int y)

void GL_DrawChar3(unsigned char ch, int x, int y, gamefontid_t font, short flags)
{
M_DrawPatch2(patchForFontChar(font, ch), x, y, translateTextToPatchDrawFlags(flags));
GL_DrawPatch2(patchForFontChar(font, ch), x, y, translateTextToPatchDrawFlags(flags));
}

void GL_DrawChar2(unsigned char ch, int x, int y, gamefontid_t font)
Expand Down

0 comments on commit 9b3df05

Please sign in to comment.