Skip to content

Commit

Permalink
Fixed|All Games|Automap: Map is not visible in the automap
Browse files Browse the repository at this point in the history
Two bugs contributed to the problem:
- map bounding box was not correctly passed to the automap widget
- Line's visibility tracking std::array was not initialized to zero

IssueID #2165
  • Loading branch information
skyjake committed Jul 14, 2016
1 parent e68ee17 commit a9ad086
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 19 deletions.
12 changes: 12 additions & 0 deletions doomsday/apps/client/src/dd_main.cpp
Expand Up @@ -1673,6 +1673,7 @@ void *DD_GetVariable(dint ddvalue)
static dint value;
static ddouble valueD;
static timespan_t valueT;
static AABoxd valueBox;

switch (ddvalue)
{
Expand All @@ -1683,6 +1684,17 @@ void *DD_GetVariable(dint ddvalue)
value = App_World().hasMap()? App_World().map().polyobjCount() : 0;
return &value;

case DD_MAP_BOUNDING_BOX:
if (App_World().hasMap())
{
valueBox = App_World().map().bounds();
}
else
{
valueBox = AABoxd(0.0, 0.0, 0.0, 0.0);
}
return &valueBox;

case DD_MAP_MIN_X:
valueD = App_World().hasMap()? App_World().map().bounds().minX : 0;
return &valueD;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/src/world/line.cpp
Expand Up @@ -1245,7 +1245,7 @@ DENG2_PIMPL(Line)
dint flags; ///< Public DDLF_* flags.
Side front; ///< Front side of the line.
Side back; ///< Back side of the line.
std::array<bool, DDMAXPLAYERS> mapped; ///< Whether the line has been seen by each player yet.
std::array<bool, DDMAXPLAYERS> mapped {}; ///< Whether the line has been seen by each player yet.

Vertex *from = nullptr; ///< Start vertex (not owned).
Vertex *to = nullptr; ///< End vertex (not owned).
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/libdoomsday/include/doomsday/gameapi.h
Expand Up @@ -87,7 +87,7 @@ enum {
DD_UNUSED15, // DD_DEF_MUSIC_CDTRACK

// Non-integer/special values for Set/Get
DD_UNUSED9, // DD_TRANSLATIONTABLES_ADDRESS
DD_MAP_BOUNDING_BOX,
DD_UNUSED4, // DD_TRACE_ADDRESS
DD_SPRITE_REPLACEMENT, ///< Sprite <-> model replacement.
DD_ACTION_LINK, ///< State action routine addresses.
Expand Down
6 changes: 2 additions & 4 deletions doomsday/apps/plugins/doom/src/st_stuff.cpp
Expand Up @@ -728,10 +728,8 @@ static void initAutomapForCurrentMap(AutomapWidget &automap)

automap.reset();

automap.setMapBounds(*((coord_t *) DD_GetVariable(DD_MAP_MIN_X)),
*((coord_t *) DD_GetVariable(DD_MAP_MAX_X)),
*((coord_t *) DD_GetVariable(DD_MAP_MIN_Y)),
*((coord_t *) DD_GetVariable(DD_MAP_MAX_Y)));
AABoxd const *mapBounds = reinterpret_cast<AABoxd *>(DD_GetVariable(DD_MAP_BOUNDING_BOX));
automap.setMapBounds(mapBounds->minX, mapBounds->maxX, mapBounds->minY, mapBounds->maxY);

AutomapStyle *style = automap.style();

Expand Down
7 changes: 2 additions & 5 deletions doomsday/apps/plugins/doom64/src/st_stuff.cpp
Expand Up @@ -331,11 +331,8 @@ static void initAutomapForCurrentMap(AutomapWidget& map)

map.reset();

map.setMapBounds(*((coord_t*) DD_GetVariable(DD_MAP_MIN_X)),
*((coord_t*) DD_GetVariable(DD_MAP_MAX_X)),
*((coord_t*) DD_GetVariable(DD_MAP_MIN_Y)),
*((coord_t*) DD_GetVariable(DD_MAP_MAX_Y)));

AABoxd const *mapBounds = reinterpret_cast<AABoxd *>(DD_GetVariable(DD_MAP_BOUNDING_BOX));
map.setMapBounds(mapBounds->minX, mapBounds->maxX, mapBounds->minY, mapBounds->maxY);

// Disable cheats for network games
if (IS_NETGAME)
Expand Down
6 changes: 2 additions & 4 deletions doomsday/apps/plugins/heretic/src/st_stuff.cpp
Expand Up @@ -720,10 +720,8 @@ static void initAutomapForCurrentMap(AutomapWidget &automap)

automap.reset();

automap.setMapBounds(*((coord_t *) DD_GetVariable(DD_MAP_MIN_X)),
*((coord_t *) DD_GetVariable(DD_MAP_MAX_X)),
*((coord_t *) DD_GetVariable(DD_MAP_MIN_Y)),
*((coord_t *) DD_GetVariable(DD_MAP_MAX_Y)));
AABoxd const *mapBounds = reinterpret_cast<AABoxd *>(DD_GetVariable(DD_MAP_BOUNDING_BOX));
automap.setMapBounds(mapBounds->minX, mapBounds->maxX, mapBounds->minY, mapBounds->maxY);

#if __JDOOM__
automapcfg_t *style = automap.style();
Expand Down
6 changes: 2 additions & 4 deletions doomsday/apps/plugins/hexen/src/st_stuff.cpp
Expand Up @@ -597,10 +597,8 @@ static void initAutomapForCurrentMap(AutomapWidget &automap)

automap.reset();

automap.setMapBounds(*((coord_t *) DD_GetVariable(DD_MAP_MIN_X)),
*((coord_t *) DD_GetVariable(DD_MAP_MAX_X)),
*((coord_t *) DD_GetVariable(DD_MAP_MIN_Y)),
*((coord_t *) DD_GetVariable(DD_MAP_MAX_Y)));
AABoxd const *mapBounds = reinterpret_cast<AABoxd *>(DD_GetVariable(DD_MAP_BOUNDING_BOX));
automap.setMapBounds(mapBounds->minX, mapBounds->maxX, mapBounds->minY, mapBounds->maxY);

#if __JDOOM__
automapcfg_t *style = automap.style();
Expand Down

0 comments on commit a9ad086

Please sign in to comment.