Skip to content

Commit

Permalink
Began bringing Doom64's HUD up to date with recent changes.
Browse files Browse the repository at this point in the history
I'll return to this later once the rest of the refactoring is
complete but it now at least builds without error.
  • Loading branch information
danij-deng committed Jun 9, 2011
1 parent 7695df8 commit acd5bb3
Show file tree
Hide file tree
Showing 10 changed files with 568 additions and 98 deletions.
6 changes: 2 additions & 4 deletions doomsday/build/codeblocks/jdoom64.cbp
Expand Up @@ -101,6 +101,7 @@
<Unit filename="..\..\plugins\common\include\g_eventsequence.h" />
<Unit filename="..\..\plugins\common\include\g_update.h" />
<Unit filename="..\..\plugins\common\include\gl_drawpatch.h" />
<Unit filename="..\..\plugins\common\include\hu_automap.h" />
<Unit filename="..\..\plugins\common\include\hu_chat.h" />
<Unit filename="..\..\plugins\common\include\hu_lib.h" />
<Unit filename="..\..\plugins\common\include\hu_log.h" />
Expand All @@ -111,7 +112,6 @@
<Unit filename="..\..\plugins\common\include\m_argv.h" />
<Unit filename="..\..\plugins\common\include\m_ctrl.h" />
<Unit filename="..\..\plugins\common\include\p_actor.h" />
<Unit filename="..\..\plugins\common\include\p_automap.h" />
<Unit filename="..\..\plugins\common\include\p_ceiling.h" />
<Unit filename="..\..\plugins\common\include\p_door.h" />
<Unit filename="..\..\plugins\common\include\p_floor.h" />
Expand All @@ -134,7 +134,6 @@
<Unit filename="..\..\plugins\common\include\p_xgline.h" />
<Unit filename="..\..\plugins\common\include\p_xgsec.h" />
<Unit filename="..\..\plugins\common\include\r_common.h" />
<Unit filename="..\..\plugins\common\include\rend_automap.h" />
<Unit filename="..\..\plugins\common\include\x_hair.h" />
<Unit filename="..\..\plugins\common\include\xgclass.h" />
<Unit filename="..\..\plugins\common\src\am_map.c">
Expand Down Expand Up @@ -163,6 +162,7 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\plugins\common\src\gl_drawpatch.c" />
<Unit filename="..\..\plugins\common\src\hu_automap.c" />
<Unit filename="..\..\plugins\common\src\hu_chat.c" />
<Unit filename="..\..\plugins\common\src\hu_lib.c">
<Option compilerVar="CC" />
Expand All @@ -188,7 +188,6 @@
<Unit filename="..\..\plugins\common\src\p_actor.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\plugins\common\src\p_automap.c" />
<Unit filename="..\..\plugins\common\src\p_ceiling.c">
<Option compilerVar="CC" />
</Unit>
Expand Down Expand Up @@ -256,7 +255,6 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="..\..\plugins\common\src\r_common.c" />
<Unit filename="..\..\plugins\common\src\rend_automap.c" />
<Unit filename="..\..\plugins\common\src\x_hair.c">
<Option compilerVar="CC" />
</Unit>
Expand Down
3 changes: 1 addition & 2 deletions doomsday/build/win32/jdoom64_cl.rsp
Expand Up @@ -20,7 +20,6 @@
.\..\..\plugins\common\src\m_ctrl.c
.\..\..\plugins\common\src\m_fixed.c
.\..\..\plugins\common\src\p_actor.c
.\..\..\plugins\common\src\p_automap.c
.\..\..\plugins\common\src\p_ceiling.c
.\..\..\plugins\common\src\p_door.c
.\..\..\plugins\common\src\p_floor.c
Expand All @@ -44,7 +43,7 @@
.\..\..\plugins\common\src\p_xgsave.c
.\..\..\plugins\common\src\p_xgsec.c
.\..\..\plugins\common\src\r_common.c
.\..\..\plugins\common\src\rend_automap.c
.\..\..\plugins\common\src\hu_automap.c
.\..\..\plugins\common\src\x_hair.c
.\..\..\plugins\jdoom64\src\acfnlink.c
.\..\..\plugins\jdoom64\src\d_api.c
Expand Down
24 changes: 8 additions & 16 deletions doomsday/build/win32/vs8/jdoom64.vcproj
Expand Up @@ -852,6 +852,10 @@
RelativePath="..\..\..\plugins\common\include\gl_drawpatch.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\hu_automap.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\hu_chat.h"
>
Expand Down Expand Up @@ -892,10 +896,6 @@
RelativePath="..\..\..\plugins\common\include\p_actor.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\p_automap.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\p_ceiling.h"
>
Expand Down Expand Up @@ -984,10 +984,6 @@
RelativePath="..\..\..\plugins\common\include\r_common.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\rend_automap.h"
>
</File>
<File
RelativePath="..\..\..\plugins\common\include\x_hair.h"
>
Expand Down Expand Up @@ -1048,6 +1044,10 @@
RelativePath="..\..\..\plugins\common\src\gl_drawpatch.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\hu_automap.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\hu_chat.c"
>
Expand Down Expand Up @@ -1088,10 +1088,6 @@
RelativePath="..\..\..\plugins\common\src\p_actor.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\p_automap.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\p_ceiling.c"
>
Expand Down Expand Up @@ -1184,10 +1180,6 @@
RelativePath="..\..\..\plugins\common\src\r_common.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\rend_automap.c"
>
</File>
<File
RelativePath="..\..\..\plugins\common\src\x_hair.c"
>
Expand Down
9 changes: 9 additions & 0 deletions doomsday/plugins/jdoom64/include/r_defs.h
Expand Up @@ -124,6 +124,15 @@ xline_t* P_ToXLine(linedef_t* line);
xsector_t* P_ToXSector(sector_t* sector);
xsector_t* P_ToXSectorOfSubsector(subsector_t* sub);

/**
* Update the specified player's automap.
*
* @param player Local player number whose map is to change.
* @param line Line to change.
* @param visible @c true= mark the line as visible.
*/
void P_SetLinedefAutomapVisibility(int player, uint line, boolean visible);

xline_t* P_GetXLine(uint index);
xsector_t* P_GetXSector(uint index);
#endif
61 changes: 54 additions & 7 deletions doomsday/plugins/jdoom64/include/st_stuff.h
Expand Up @@ -36,17 +36,20 @@
# error "Using jDoom64 headers without __JDOOM64__"
#endif

#include "hu_chat.h"
#include "hu_lib.h"
#include "d_config.h"

// Palette indices.
// For damage/bonus red-/gold-shifts
#define STARTREDPALS (1)
#define STARTBONUSPALS (9)
#define NUMREDPALS (8)
#define NUMBONUSPALS (4)
#define STARTREDPALS (1)
#define STARTBONUSPALS (9)
#define NUMREDPALS (8)
#define NUMBONUSPALS (4)

#define HUDBORDERX (14)
#define HUDBORDERY (18)
#define HUDBORDERX (14)
#define HUDBORDERY (18)

#define ST_AUTOMAP_OBSCURE_TOLERANCE (.9999f)

void ST_Register(void);
void ST_Init(void);
Expand All @@ -59,6 +62,10 @@ void ST_Drawer(int player);
void ST_Start(int player);
void ST_Stop(int player);

uiwidget_t* ST_UIChatForPlayer(int player);
uiwidget_t* ST_UILogForPlayer(int player);
uiwidget_t* ST_UIAutomapForPlayer(int player);

boolean ST_ChatIsActive(int player);

/**
Expand Down Expand Up @@ -92,6 +99,46 @@ void ST_LogStart(int player);
void ST_LogUpdateAlignment(void);
void ST_LogPostVisibilityChangeNotification(void);

/**
* Start the automap.
*/
void ST_AutomapOpen(int player, boolean yes, boolean fast);

boolean ST_AutomapIsActive(int player);

void ST_ToggleAutomapPanMode(int player);

void ST_ToggleAutomapMaxZoom(int player);

float ST_AutomapOpacity(int player);

/**
* Does the player's automap obscure this region completely?
* \assume: Window dimensions use the fixed coordinate space {x} 0 - 320, {y} 0 - 200.
*
* @param player Local player number whose automap to check.
* @param region Window region.
*
* @return @true= there is no point even partially visible.
*/
boolean ST_AutomapWindowObscures2(int player, const rectanglei_t* region);
boolean ST_AutomapWindowObscures(int player, int x, int y, int width, int height);

int ST_AutomapAddPoint(int player, float x, float y, float z);
void ST_AutomapClearPoints(int player);
boolean ST_AutomapPointOrigin(int player, int point, float* x, float* y, float* z);

void ST_SetAutomapCameraRotation(int player, boolean on);

int ST_AutomapCheatLevel(int player);
void ST_SetAutomapCheatLevel(int player, int level);
void ST_CycleAutomapCheatLevel(int player);

void ST_RevealAutomap(int player, boolean on);
boolean ST_AutomapHasReveal(int player);

void ST_RebuildAutomap(int player);

/// Call when it might be neccessary for the hud to unhide.
void ST_HUDUnHide(int player, hueevent_t event);

Expand Down
16 changes: 7 additions & 9 deletions doomsday/plugins/jdoom64/src/d_refresh.c
Expand Up @@ -38,7 +38,7 @@
#include "hu_pspr.h"
#include "hu_msg.h"
#include "hu_log.h"
#include "am_map.h"
#include "hu_automap.h"
#include "g_common.h"
#include "r_common.h"
#include "d_net.h"
Expand All @@ -47,7 +47,6 @@
#include "p_mapsetup.h"
#include "p_tick.h"
#include "p_actor.h"
#include "rend_automap.h"

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

Expand Down Expand Up @@ -101,7 +100,7 @@ static void drawSpecialFilter(int pnum, int x, int y, int w, int h)
g = MINMAX_OF(0.f, str * 2 - .4, 1.f);
b = MINMAX_OF(0.f, str * 2 - .8, 1.f);

DGL_DrawRect(x, y, w, h, r, g, b, 1);
DGL_DrawRectColor(x, y, w, h, r, g, b, 1);

// Restore the normal rendering state.
DGL_BlendMode(BM_NORMAL);
Expand Down Expand Up @@ -207,7 +206,6 @@ static void rendHUD(int player, int viewW, int viewH)
if(!DD_GetInteger(DD_GAME_DRAW_HUD_HINT))
return; // The engine advises not to draw any HUD displays.

AM_Drawer(player);
ST_Drawer(player);
HU_DrawScoreBoard(player);

Expand Down Expand Up @@ -262,7 +260,7 @@ void D_Display(int layer)
if(G_GetGameState() == GS_MAP && cfg.screenBlocks <= 10 &&
!(P_MobjIsCamera(plr->plr->mo) && Get(DD_PLAYBACK))) // $democam: can be set on every frame.
{
R_GetViewWindow(&winX, &winY, &winW, &winH);
R_GetSmoothedViewWindow(&winX, &winY, &winW, &winH);
}
else
{ // Full screen.
Expand All @@ -279,12 +277,12 @@ void D_Display(int layer)
vY = ROUND(winY * yScale);
vW = ROUND(winW * xScale);
vH = ROUND(winH * yScale);
R_SetViewWindow(vX, vY, vW, vH);
R_SetViewWindow(player, vX, vY, vW, vH);

switch(G_GetGameState())
{
case GS_MAP:
if(!R_MapObscures(player, winX, winY, winW, winH))
if(!ST_AutomapWindowObscures(player, winX, winY, winW, winH))
{
if(IS_CLIENT && (!Get(DD_GAME_READY) || !Get(DD_GOTFRAME)))
return;
Expand All @@ -299,7 +297,7 @@ void D_Display(int layer)
}
break;
case GS_STARTUP:
DGL_DrawRect(0, 0, vpWidth, vpHeight, 0, 0, 0, 1);
DGL_DrawRectColor(0, 0, vpWidth, vpHeight, 0, 0, 0, 1);
break;
default:
break;
Expand All @@ -318,7 +316,7 @@ void D_Display2(void)

if(G_GetGameAction() == GA_QUIT)
{
DGL_DrawRect(0, 0, 320, 200, 0, 0, 0, quitDarkenOpacity);
DGL_DrawRectColor(0, 0, 320, 200, 0, 0, 0, quitDarkenOpacity);
}
}

Expand Down
20 changes: 10 additions & 10 deletions doomsday/plugins/jdoom64/src/m_cheat.c
Expand Up @@ -405,24 +405,24 @@ D_CMD(CheatWarp)

D_CMD(CheatReveal)
{
int option;
automapid_t map;
int option, i;

if(!cheatsEnabled())
return false;

map = AM_MapForPlayer(CONSOLEPLAYER);
AM_SetCheatLevel(map, 0);
AM_RevealMap(map, false);

option = atoi(argv[1]);
if(option < 0 || option > 3)
return false;

if(option == 1)
AM_RevealMap(map, true);
else if(option != 0)
AM_SetCheatLevel(map, option -1);
for(i = 0; i < MAXPLAYERS; ++i)
{
ST_SetAutomapCheatLevel(i, 0);
ST_RevealAutomap(i, false);
if(option == 1)
ST_RevealAutomap(i, true);
else if(option != 0)
ST_SetAutomapCheatLevel(i, option -1);
}

return true;
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/jdoom64/src/p_inter.c
Expand Up @@ -330,7 +330,7 @@ boolean P_GivePower(player_t* player, int power)
}

if(power == PT_ALLMAP)
AM_RevealMap(AM_MapForPlayer(player - players), true);
ST_RevealAutomap(player - players, true);

// Maybe unhide the HUD?
ST_HUDUnHide(player - players, HUE_ON_PICKUP_POWER);
Expand Down Expand Up @@ -946,7 +946,7 @@ void P_KillMobj(mobj_t *source, mobj_t *target, boolean stomping)
P_DropWeapon(target->player);

// Don't die with the automap open.
AM_Open(AM_MapForPlayer(target->player - players), false, false);
ST_AutomapOpen(target->player - players, false, false);
#if __JHERETIC__ || __JHEXEN__
Hu_InventoryOpen(target->player - players, false);
#endif
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/jdoom64/src/p_setup.c
Expand Up @@ -165,7 +165,7 @@ int P_HandleMapObjectStatusReport(int code, uint id, int dtype, void *data)
* *data is a pointer to int, giving the player id which has seen it.
* We'll utilize this to mark it as being visible in the automap.
*/
AM_UpdateLinedef(AM_MapForPlayer(*(int *) data), id, true);
P_SetLinedefAutomapVisibility(*(int*)data, id, true);
break;

default:
Expand Down

0 comments on commit acd5bb3

Please sign in to comment.