MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / d3d_MakeBitmapCurrent

Function d3d_MakeBitmapCurrent

legacy/renderer/Direct3D.cpp:1704–1782  ·  view source on GitHub ↗

Sets up our bitmap/lightmap/bumpmap to be the next thing drawn

Source from the content-addressed store, hash-verified

1702extern bool Force_one_texture;
1703// Sets up our bitmap/lightmap/bumpmap to be the next thing drawn
1704int d3d_MakeBitmapCurrent(int handle, int map_type, int tn) {
1705 LPDIRECT3DTEXTURE2 tex_interface;
1706 HRESULT ddrval;
1707 LPDIRECTDRAWSURFACE4 sp;
1708
1709 if (map_type == MAP_TYPE_BITMAP) {
1710 if (Force_one_texture)
1711 handle = 0;
1712
1713 if (GameBitmaps[handle].cache_slot == -1) {
1714 int retval = d3d_CreateTextureFromBitmap(handle, map_type);
1715 if (retval < 0)
1716 return 0;
1717 } else {
1718 if (GameBitmaps[handle].flags & BF_CHANGED) {
1719 d3d_UploadBitmapToSurface(handle, map_type, GameBitmaps[handle].cache_slot, 0);
1720 }
1721 }
1722
1723 ASSERT(GameBitmaps[handle].cache_slot != -1);
1724
1725 sp = BitmapTextureSurfaces[GameBitmaps[handle].cache_slot];
1726 } else if (map_type == MAP_TYPE_BUMPMAP) {
1727 if (GameBumpmaps[handle].cache_slot == -1) {
1728 int retval = d3d_CreateTextureFromBitmap(handle, map_type);
1729 if (retval < 0)
1730 return 0;
1731 } else {
1732 if (GameBumpmaps[handle].flags & BUMPF_CHANGED) {
1733 d3d_UploadBitmapToSurface(handle, map_type, GameBumpmaps[handle].cache_slot, 0);
1734 }
1735 }
1736
1737 ASSERT(GameBumpmaps[handle].cache_slot != -1);
1738
1739 sp = BumpmapTextureSurfaces[GameBumpmaps[handle].cache_slot];
1740 } else {
1741 if (Force_one_texture)
1742 handle = 0;
1743
1744 if (GameLightmaps[handle].cache_slot == -1) {
1745 int retval = d3d_CreateTextureFromBitmap(handle, map_type);
1746 if (retval < 0)
1747 return 0;
1748 } else {
1749 if (GameLightmaps[handle].flags & LF_CHANGED) {
1750 d3d_UploadBitmapToSurface(handle, map_type, GameLightmaps[handle].cache_slot, 0);
1751 }
1752 }
1753
1754 ASSERT(GameLightmaps[handle].cache_slot != -1);
1755 sp = LightmapTextureSurfaces[GameLightmaps[handle].cache_slot];
1756 }
1757
1758 int texnum = handle;
1759 if (map_type == MAP_TYPE_LIGHTMAP)
1760 texnum += 100000;
1761 else if (map_type == MAP_TYPE_BUMPMAP)

Callers 3

d3d_DrawPolygonFunction · 0.85

Calls 3

d3d_ErrorStringFunction · 0.85

Tested by

no test coverage detected