Skip to content

Commit

Permalink
Cleanup a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Nov 13, 2017
1 parent e23199a commit c6ff8ec
Show file tree
Hide file tree
Showing 7 changed files with 645 additions and 708 deletions.
47 changes: 23 additions & 24 deletions CDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,10 @@ void CDebug::actualizeData()
}
if(VertexDataText == NULL)
{
sprintf(puffer1, "Vertex Data: x=%d, y=%d, z=%d i=%.2f h=%#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].x,
map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].y,
map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].z,
((float)map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].i) / pow(2, 16),
map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].h);
sprintf(puffer1, "Vertex Data: x=%d, y=%d, z=%d i=%.2f h=%#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).x,
map->getVertex(MapObj->VertexX, MapObj->VertexY).y, map->getVertex(MapObj->VertexX, MapObj->VertexY).z,
((float)map->getVertex(MapObj->VertexX, MapObj->VertexY).i) / pow(2, 16),
map->getVertex(MapObj->VertexX, MapObj->VertexY).h);
VertexDataText = dbgWnd->addText(puffer1, 260, 70, fontsize);
}
if(VertexVectorText != NULL)
Expand All @@ -256,9 +255,9 @@ void CDebug::actualizeData()
}
if(VertexVectorText == NULL)
{
sprintf(puffer1, "Vertex Vector: (%.2f, %.2f, %.2f)", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].normVector.x,
map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].normVector.y,
map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].normVector.z);
sprintf(puffer1, "Vertex Vector: (%.2f, %.2f, %.2f)", map->getVertex(MapObj->VertexX, MapObj->VertexY).normVector.x,
map->getVertex(MapObj->VertexX, MapObj->VertexY).normVector.y,
map->getVertex(MapObj->VertexX, MapObj->VertexY).normVector.z);
VertexVectorText = dbgWnd->addText(puffer1, 260, 80, fontsize);
}
if(FlatVectorText != NULL)
Expand All @@ -268,9 +267,9 @@ void CDebug::actualizeData()
}
if(FlatVectorText == NULL)
{
sprintf(puffer1, "Flat Vector: (%.2f, %.2f, %.2f)", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].flatVector.x,
map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].flatVector.y,
map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].flatVector.z);
sprintf(puffer1, "Flat Vector: (%.2f, %.2f, %.2f)", map->getVertex(MapObj->VertexX, MapObj->VertexY).flatVector.x,
map->getVertex(MapObj->VertexX, MapObj->VertexY).flatVector.y,
map->getVertex(MapObj->VertexX, MapObj->VertexY).flatVector.z);
FlatVectorText = dbgWnd->addText(puffer1, 260, 90, fontsize);
}
if(rsuTextureText != NULL)
Expand All @@ -280,7 +279,7 @@ void CDebug::actualizeData()
}
if(rsuTextureText == NULL)
{
sprintf(puffer1, "RSU-Texture: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].rsuTexture);
sprintf(puffer1, "RSU-Texture: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).rsuTexture);
rsuTextureText = dbgWnd->addText(puffer1, 260, 100, fontsize);
}
if(usdTextureText != NULL)
Expand All @@ -290,7 +289,7 @@ void CDebug::actualizeData()
}
if(usdTextureText == NULL)
{
sprintf(puffer1, "USD-Texture: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].usdTexture);
sprintf(puffer1, "USD-Texture: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).usdTexture);
usdTextureText = dbgWnd->addText(puffer1, 260, 110, fontsize);
}
if(roadText != NULL)
Expand All @@ -300,7 +299,7 @@ void CDebug::actualizeData()
}
if(roadText == NULL)
{
sprintf(puffer1, "road: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].road);
sprintf(puffer1, "road: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).road);
roadText = dbgWnd->addText(puffer1, 260, 120, fontsize);
}
if(objectTypeText != NULL)
Expand All @@ -310,7 +309,7 @@ void CDebug::actualizeData()
}
if(objectTypeText == NULL)
{
sprintf(puffer1, "objectType: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].objectType);
sprintf(puffer1, "objectType: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).objectType);
objectTypeText = dbgWnd->addText(puffer1, 260, 130, fontsize);
}
if(objectInfoText != NULL)
Expand All @@ -320,7 +319,7 @@ void CDebug::actualizeData()
}
if(objectInfoText == NULL)
{
sprintf(puffer1, "objectInfo: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].objectInfo);
sprintf(puffer1, "objectInfo: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).objectInfo);
objectInfoText = dbgWnd->addText(puffer1, 260, 140, fontsize);
}
if(animalText != NULL)
Expand All @@ -330,7 +329,7 @@ void CDebug::actualizeData()
}
if(animalText == NULL)
{
sprintf(puffer1, "animal: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].animal);
sprintf(puffer1, "animal: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).animal);
animalText = dbgWnd->addText(puffer1, 260, 150, fontsize);
}
if(unknown1Text != NULL)
Expand All @@ -340,7 +339,7 @@ void CDebug::actualizeData()
}
if(unknown1Text == NULL)
{
sprintf(puffer1, "unknown1: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].unknown1);
sprintf(puffer1, "unknown1: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).unknown1);
unknown1Text = dbgWnd->addText(puffer1, 260, 160, fontsize);
}
if(buildText != NULL)
Expand All @@ -350,7 +349,7 @@ void CDebug::actualizeData()
}
if(buildText == NULL)
{
sprintf(puffer1, "build: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].build);
sprintf(puffer1, "build: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).build);
buildText = dbgWnd->addText(puffer1, 260, 170, fontsize);
}
if(unknown2Text != NULL)
Expand All @@ -360,7 +359,7 @@ void CDebug::actualizeData()
}
if(unknown2Text == NULL)
{
sprintf(puffer1, "unknown2: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].unknown2);
sprintf(puffer1, "unknown2: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).unknown2);
unknown2Text = dbgWnd->addText(puffer1, 260, 180, fontsize);
}
if(unknown3Text != NULL)
Expand All @@ -370,7 +369,7 @@ void CDebug::actualizeData()
}
if(unknown3Text == NULL)
{
sprintf(puffer1, "unknown3: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].unknown3);
sprintf(puffer1, "unknown3: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).unknown3);
unknown3Text = dbgWnd->addText(puffer1, 260, 190, fontsize);
}
if(resourceText != NULL)
Expand All @@ -380,7 +379,7 @@ void CDebug::actualizeData()
}
if(resourceText == NULL)
{
sprintf(puffer1, "resource: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].resource);
sprintf(puffer1, "resource: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).resource);
resourceText = dbgWnd->addText(puffer1, 260, 200, fontsize);
}
if(shadingText != NULL)
Expand All @@ -390,7 +389,7 @@ void CDebug::actualizeData()
}
if(shadingText == NULL)
{
sprintf(puffer1, "shading: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].shading);
sprintf(puffer1, "shading: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).shading);
shadingText = dbgWnd->addText(puffer1, 260, 210, fontsize);
}
if(unknown5Text != NULL)
Expand All @@ -400,7 +399,7 @@ void CDebug::actualizeData()
}
if(unknown5Text == NULL)
{
sprintf(puffer1, "unknown5: %#04x", map->vertex[MapObj->VertexY * map->width + MapObj->VertexX].unknown5);
sprintf(puffer1, "unknown5: %#04x", map->getVertex(MapObj->VertexX, MapObj->VertexY).unknown5);
unknown5Text = dbgWnd->addText(puffer1, 260, 220, fontsize);
}
if(editorModeText != NULL)
Expand Down
24 changes: 12 additions & 12 deletions CGame_Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ void CGame::EventHandling(SDL_Event* Event)

for(int i = 0; i < myMap->width; i++)
{
heightFactor = myMap->vertex[j * myMap->width + i].h;
myMap->vertex[j * myMap->width + i].x = a;
myMap->vertex[j * myMap->width + i].y = b + (-TRIANGLE_INCREASE) * (heightFactor - 0x0A);
myMap->vertex[j * myMap->width + i].z = TRIANGLE_INCREASE * (heightFactor - 0x0A);
heightFactor = myMap->getVertex(i, j).h;
myMap->getVertex(i, j).x = a;
myMap->getVertex(i, j).y = b + (-TRIANGLE_INCREASE) * (heightFactor - 0x0A);
myMap->getVertex(i, j).z = TRIANGLE_INCREASE * (heightFactor - 0x0A);
a += TRIANGLE_WIDTH;
}
b += TRIANGLE_HEIGHT;
Expand Down Expand Up @@ -143,10 +143,10 @@ void CGame::EventHandling(SDL_Event* Event)

for(int i = 0; i < myMap->width; i++)
{
heightFactor = myMap->vertex[j * myMap->width + i].h;
myMap->vertex[j * myMap->width + i].x = a;
myMap->vertex[j * myMap->width + i].y = b + (-TRIANGLE_INCREASE) * (heightFactor - 0x0A);
myMap->vertex[j * myMap->width + i].z = TRIANGLE_INCREASE * (heightFactor - 0x0A);
heightFactor = myMap->getVertex(i, j).h;
myMap->getVertex(i, j).x = a;
myMap->getVertex(i, j).y = b + (-TRIANGLE_INCREASE) * (heightFactor - 0x0A);
myMap->getVertex(i, j).z = TRIANGLE_INCREASE * (heightFactor - 0x0A);
a += TRIANGLE_WIDTH;
}
b += TRIANGLE_HEIGHT;
Expand Down Expand Up @@ -175,10 +175,10 @@ void CGame::EventHandling(SDL_Event* Event)

for(int i = 0; i < myMap->width; i++)
{
heightFactor = myMap->vertex[j * myMap->width + i].h;
myMap->vertex[j * myMap->width + i].x = a;
myMap->vertex[j * myMap->width + i].y = b + (-TRIANGLE_INCREASE) * (heightFactor - 0x0A);
myMap->vertex[j * myMap->width + i].z = TRIANGLE_INCREASE * (heightFactor - 0x0A);
heightFactor = myMap->getVertex(i, j).h;
myMap->getVertex(i, j).x = a;
myMap->getVertex(i, j).y = b + (-TRIANGLE_INCREASE) * (heightFactor - 0x0A);
myMap->getVertex(i, j).z = TRIANGLE_INCREASE * (heightFactor - 0x0A);
a += TRIANGLE_WIDTH;
}
b += TRIANGLE_HEIGHT;
Expand Down
Loading

0 comments on commit c6ff8ec

Please sign in to comment.