All pastes #336871 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-02-02 10:12 UTC
rendered paste body
			VertexCoords.clear();
			ColorCoords.clear();


			// Iterate over the visible part of the minimap and display it.
			for(temp_x = MinimapMinPosX; temp_x <= MinimapMaxPosX; temp_x++)
			{
				for(temp_y = MinimapMinPosY; temp_y <= MinimapMaxPosY; temp_y++)
				{
					RealX = temp_x % iMapWidth;
					while(RealX < 0) RealX += iMapWidth;
					RealY = temp_y % iMapHeight;
					while(RealY < 0) RealY += iMapHeight;

					if(Map.iMap[iLevel][RealX][RealY])
					{
						tile_x = minimap_x + ((minimap_width / 2) - Player1.X) * 4 + temp_x * 4;
						tile_y = minimap_y + ((minimap_width / 2) - Player1.Y) * 4 + temp_y * 4;

						/*
						if(Map.iMap[iLevel][RealX][RealY] == iTileInpassable)
						{
							if(Map.iMapLight[iLevel][RealX][RealY] > 0) { ColorCoords.push_back(0.75f); ColorCoords.push_back(0.5f); ColorCoords.push_back(0.25f); }
							if(Map.iMapLight[iLevel][RealX][RealY] == 0) { ColorCoords.push_back(0.0f); ColorCoords.push_back(0.0f); ColorCoords.push_back(0.0f); }
							if(Map.iMapLight[iLevel][RealX][RealY] < 0) { ColorCoords.push_back(0.5f); ColorCoords.push_back(0.25f); ColorCoords.push_back(0.0f); }
						}
						if(Map.iMap[iLevel][RealX][RealY] == iTilePassable || Map.iMap[iLevel][RealX][RealY] == iTileExit)
						{
							if(Map.iMapLight[iLevel][RealX][RealY] > 0) { ColorCoords.push_back(0.5f); ColorCoords.push_back(0.75f); ColorCoords.push_back(0.25f); }
							if(Map.iMapLight[iLevel][RealX][RealY] == 0) { ColorCoords.push_back(0.0f); ColorCoords.push_back(0.0f); ColorCoords.push_back(0.0f); }
							if(Map.iMapLight[iLevel][RealX][RealY] < 0) { ColorCoords.push_back(0.25f); ColorCoords.push_back(0.5f); ColorCoords.push_back(0.0f); }
						}
						*/
						ColorCoords.push_back(1.0f);
						ColorCoords.push_back(1.0f);
						ColorCoords.push_back(1.0f);

						VertexCoords.push_back(tile_x);
						VertexCoords.push_back(tile_y);

						VertexCoords.push_back(tile_x);
						VertexCoords.push_back(tile_y + 4);

						VertexCoords.push_back(tile_x + 4);
						VertexCoords.push_back(tile_y + 4);

						VertexCoords.push_back(tile_x + 4);
						VertexCoords.push_back(tile_y);
						//Video.DrawImage(Video.ImageName["MiniMapTile"], tile_x, tile_y);
					}
				}
			}
			// Enable vertex and color arrays (and potaentially texture arrays, later on.
			glEnableClientState(GL_VERTEX_ARRAY);
			glEnableClientState(GL_COLOR_ARRAY);
	
			// Feed the arrays.
			glVertexPointer(2, GL_INT, 0, &VertexCoords.at(0));
			glColorPointer(3, GL_FLOAT, 0, &ColorCoords.at(0));
	
			// Draw a number of primitives based upon currently fed arrays.
			glDrawArrays(GL_QUADS, 0, 2304);
	
			glDisableClientState(GL_VERTEX_ARRAY);
			glDisableClientState(GL_COLOR_ARRAY);