Skip to content

Commit

Permalink
Fixed logic errors exposed by the previous refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Mar 3, 2012
1 parent ee1e41a commit e8a3eca
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 49 deletions.
5 changes: 4 additions & 1 deletion doomsday/engine/portable/src/dd_loop.c
Expand Up @@ -174,7 +174,10 @@ static void drawAndUpdate(void)
if(DD_GameLoaded())
{
// Interpolate the world ready for drawing view(s) of it.
R_BeginWorldFrame();
if(theMap)
{
R_BeginWorldFrame();
}
R_RenderViewPorts();
}
else if(titleFinale == 0)
Expand Down
90 changes: 44 additions & 46 deletions doomsday/engine/portable/src/dd_main.c
Expand Up @@ -2096,35 +2096,35 @@ void* DD_GetVariable(int ddvalue)
return &gx;

case DD_SECTOR_COUNT:
valueU = GameMap_SectorCount(theMap);
valueU = theMap? GameMap_SectorCount(theMap) : 0;
return &valueU;

case DD_LINE_COUNT:
valueU = GameMap_LineDefCount(theMap);
valueU = theMap? GameMap_LineDefCount(theMap) : 0;
return &valueU;

case DD_SIDE_COUNT:
valueU = GameMap_SideDefCount(theMap);
valueU = theMap? GameMap_SideDefCount(theMap) : 0;
return &valueU;

case DD_VERTEX_COUNT:
valueU = GameMap_VertexCount(theMap);
valueU = theMap? GameMap_VertexCount(theMap) : 0;
return &valueU;

case DD_POLYOBJ_COUNT:
valueU = GameMap_PolyobjCount(theMap);
valueU = theMap? GameMap_PolyobjCount(theMap) : 0;
return &valueU;

case DD_HEDGE_COUNT:
valueU = GameMap_HEdgeCount(theMap);
valueU = theMap? GameMap_HEdgeCount(theMap) : 0;
return &valueU;

case DD_SUBSECTOR_COUNT:
valueU = GameMap_SubsectorCount(theMap);
valueU = theMap? GameMap_SubsectorCount(theMap) : 0;
return &valueU;

case DD_NODE_COUNT:
valueU = GameMap_NodeCount(theMap);
valueU = theMap? GameMap_NodeCount(theMap) : 0;
return &valueU;

case DD_TRACE_ADDRESS:
Expand All @@ -2133,11 +2133,10 @@ void* DD_GetVariable(int ddvalue)
case DD_TRANSLATIONTABLES_ADDRESS:
return translationTables;

case DD_MAP_NAME: {
GameMap* map = theMap;
if(map)
case DD_MAP_NAME:
if(theMap)
{
ded_mapinfo_t* mapInfo = Def_GetMapInfo(GameMap_Uri(map));
ded_mapinfo_t* mapInfo = Def_GetMapInfo(GameMap_Uri(theMap));
if(mapInfo && mapInfo->name[0])
{
int id = Def_Get(DD_DEF_TEXT, mapInfo->name, NULL);
Expand All @@ -2149,47 +2148,46 @@ void* DD_GetVariable(int ddvalue)
}
}
return NULL;
}
case DD_MAP_AUTHOR: {
GameMap* map = theMap;
if(map)

case DD_MAP_AUTHOR:
if(theMap)
{
ded_mapinfo_t* mapInfo = Def_GetMapInfo(GameMap_Uri(map));
ded_mapinfo_t* mapInfo = Def_GetMapInfo(GameMap_Uri(theMap));
if(mapInfo && mapInfo->author[0])
{
return mapInfo->author;
}
}
return NULL;
}
case DD_MAP_MIN_X: {
GameMap* map = theMap;
if(map)
return &map->bBox[BOXLEFT];
else
return NULL;
}
case DD_MAP_MIN_Y: {
GameMap* map = theMap;
if(map)
return &map->bBox[BOXBOTTOM];
else
return NULL;
}
case DD_MAP_MAX_X: {
GameMap* map = theMap;
if(map)
return &map->bBox[BOXRIGHT];
else
return NULL;
}
case DD_MAP_MAX_Y: {
GameMap* map = theMap;
if(map)
return &map->bBox[BOXTOP];
else
return NULL;
}

case DD_MAP_MIN_X:
if(theMap)
{
return &theMap->bBox[BOXLEFT];
}
return NULL;

case DD_MAP_MIN_Y:
if(theMap)
{
return &theMap->bBox[BOXBOTTOM];
}
return NULL;

case DD_MAP_MAX_X:
if(theMap)
{
return &theMap->bBox[BOXRIGHT];
}
return NULL;

case DD_MAP_MAX_Y:
if(theMap)
{
return &theMap->bBox[BOXTOP];
}
return NULL;

case DD_PSPRITE_OFFSET_X:
return &pspOffset[VX];

Expand Down
5 changes: 3 additions & 2 deletions doomsday/engine/portable/src/s_environ.c
Expand Up @@ -208,8 +208,9 @@ Con_Message("sector %i: (%f,%f) - (%f,%f)\n", c,
p = node->next;
*ptr = (subsector_t*) node->data;

if(i < NUM_SECTORS - 1)
{ // Move this node to the unused list for re-use.
if(i < map->numSectors - 1)
{
// Move this node to the unused list for re-use.
node->next = unusedNodeList;
unusedNodeList = node;
}
Expand Down

0 comments on commit e8a3eca

Please sign in to comment.