mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Remove palette stuff
This commit is contained in:
parent
cdfebc9d1a
commit
67573c7920
10
blupi.cpp
10
blupi.cpp
@ -256,7 +256,7 @@ bool RestoreGame()
|
||||
if ( g_pPixmap == NULL ) return false;
|
||||
|
||||
g_pEvent->RestoreGame();
|
||||
return g_pPixmap->Restore();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Libère le jeu avant une désactivation en mode fullScreen.
|
||||
@ -336,9 +336,6 @@ void WindowProc2 (const SDL_Event &event)
|
||||
iconDim.y = 66 / 2;
|
||||
g_pPixmap->Cache (CHHILI, "image\\hili.blp", totalDim, iconDim, true);
|
||||
g_pPixmap->SetTransparent (CHHILI, RGB (0, 0, 255)); // bleu
|
||||
|
||||
g_pPixmap->SavePalette ();
|
||||
g_pPixmap->InitSysPalette ();
|
||||
}
|
||||
SDL_SetWindowTitle (g_window, "Blupi");
|
||||
if (g_pSound != NULL) g_pSound->RestartMusic ();
|
||||
@ -495,11 +492,6 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
#endif
|
||||
return false;
|
||||
|
||||
OutputDebug("SavePalette\n");
|
||||
g_pPixmap->SavePalette();
|
||||
OutputDebug("InitSysPalette\n");
|
||||
g_pPixmap->InitSysPalette();
|
||||
|
||||
OutputDebug("Image: init\n");
|
||||
totalDim.x = LXIMAGE;
|
||||
totalDim.y = LYIMAGE;
|
||||
|
@ -4024,7 +4024,6 @@ bool CEvent::StartMovie(char *pFilename)
|
||||
rect.bottom = LYIMAGE-2;
|
||||
|
||||
m_pSound->StopMusic();
|
||||
m_pPixmap->SavePalette();
|
||||
|
||||
strcpy(filename, pFilename);
|
||||
strcpy(filename+strlen(filename)-4, ".blp"); // remplace .avi par .blp
|
||||
|
94
pixmap.cpp
94
pixmap.cpp
@ -187,44 +187,6 @@ bool CPixmap::Flush()
|
||||
return true;
|
||||
}
|
||||
|
||||
// Restitue les bitmaps.
|
||||
|
||||
bool CPixmap::Restore()
|
||||
{
|
||||
RestoreAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Initialise la palette système.
|
||||
|
||||
bool CPixmap::InitSysPalette()
|
||||
{
|
||||
HDC hdc;
|
||||
int caps;
|
||||
|
||||
hdc = CreateCompatibleDC(NULL);
|
||||
if ( hdc == NULL ) return false;
|
||||
|
||||
if ( !m_bFullScreen )
|
||||
{
|
||||
caps = GetDeviceCaps(hdc, SIZEPALETTE);
|
||||
if ( caps == 0 ) m_bPalette = false;
|
||||
else m_bPalette = true;
|
||||
}
|
||||
|
||||
GetSystemPaletteEntries(hdc, 0, 256, m_sysPal);
|
||||
DeleteDC(hdc);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Indique si l'on utilise une palette.
|
||||
|
||||
bool CPixmap::IsPalette()
|
||||
{
|
||||
return m_bPalette;
|
||||
}
|
||||
|
||||
|
||||
// Rempli une zone rectangulaire avec une couleur uniforme.
|
||||
|
||||
void CPixmap::Fill(RECT rect, COLORREF color)
|
||||
@ -232,35 +194,6 @@ void CPixmap::Fill(RECT rect, COLORREF color)
|
||||
// à faire si nécessaire ...
|
||||
}
|
||||
|
||||
|
||||
// Restore all lost objects.
|
||||
|
||||
HRESULT CPixmap::RestoreAll()
|
||||
{
|
||||
if ( m_bDebug ) OutputDebug("CPixmap::RestoreAll\n");
|
||||
HRESULT ddrval;
|
||||
|
||||
if ( m_lpDDSPrimary && m_lpDDSPrimary->IsLost() )
|
||||
{
|
||||
ddrval = m_lpDDSPrimary->Restore();
|
||||
// if( ddrval != DD_OK ) return ddrval;
|
||||
}
|
||||
|
||||
if ( m_lpDDSBack && m_lpDDSBack->IsLost() )
|
||||
{
|
||||
ddrval = m_lpDDSBack->Restore();
|
||||
// if( ddrval != DD_OK ) return ddrval;
|
||||
}
|
||||
|
||||
if ( m_lpDDSMouse && m_lpDDSMouse->IsLost() )
|
||||
{
|
||||
ddrval = m_lpDDSMouse->Restore();
|
||||
// if( ddrval != DD_OK ) return ddrval;
|
||||
}
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
// Effectue un appel BltFast.
|
||||
// Les modes sont 0=transparent, 1=opaque.
|
||||
|
||||
@ -299,8 +232,6 @@ HRESULT CPixmap::BltFast(int chDst, int channel,
|
||||
if ( rcRect.left >= rcRect.right ||
|
||||
rcRect.top >= rcRect.bottom ) return DD_OK;
|
||||
|
||||
while( true )
|
||||
{
|
||||
if ( chDst < 0 )
|
||||
{
|
||||
SDL_Rect srcRect, dstRect;
|
||||
@ -332,16 +263,6 @@ HRESULT CPixmap::BltFast(int chDst, int channel,
|
||||
SDL_SetRenderTarget (g_renderer, nullptr);
|
||||
//SDL_RenderCopy (g_renderer, m_lpSDLTexture[chDst], NULL, NULL);
|
||||
}
|
||||
if ( ddrval == DD_OK ) break;
|
||||
|
||||
if ( ddrval == DDERR_SURFACELOST )
|
||||
{
|
||||
ddrval = RestoreAll();
|
||||
if ( ddrval != DD_OK ) break;
|
||||
}
|
||||
|
||||
if ( ddrval != DDERR_WASSTILLDRAWING ) break;
|
||||
}
|
||||
|
||||
return ddrval;
|
||||
}
|
||||
@ -374,21 +295,6 @@ HRESULT CPixmap::BltFast(SDL_Texture *lpSDL,
|
||||
return ddrval;
|
||||
}
|
||||
|
||||
|
||||
// Sauve toute la palette de couleurs.
|
||||
|
||||
bool CPixmap::SavePalette()
|
||||
{
|
||||
HRESULT ddrval;
|
||||
|
||||
if ( m_lpDDPal == NULL ) return false;
|
||||
|
||||
ddrval = m_lpDDPal->GetEntries(0, 0, 256, m_pal);
|
||||
|
||||
if ( ddrval != DD_OK ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cherche une couleur dans la palette principale.
|
||||
// En mode plein écran, il faut chercher dans la palette
|
||||
// correspondant aux images (obtenue avec SavePalette),
|
||||
|
5
pixmap.h
5
pixmap.h
@ -20,12 +20,8 @@ public:
|
||||
|
||||
bool Create(POINT dim, bool bFullScreen, int mouseType);
|
||||
bool Flush();
|
||||
bool Restore();
|
||||
bool InitSysPalette();
|
||||
bool IsPalette();
|
||||
void Fill(RECT rect, COLORREF color);
|
||||
|
||||
bool SavePalette();
|
||||
int SearchColor(int red, int green, int blue);
|
||||
bool Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, bool bUsePalette);
|
||||
bool Cache(int channel, char *pFilename, POINT totalDim, bool bUsePalette);
|
||||
@ -54,7 +50,6 @@ public:
|
||||
void ChangeSprite (MouseSprites sprite);
|
||||
|
||||
protected:
|
||||
HRESULT RestoreAll();
|
||||
HRESULT BltFast(int chDst, int channel, POINT dst, RECT rcRect, int mode);
|
||||
HRESULT BltFast(SDL_Texture *lpSDL,
|
||||
int channel, POINT dst, RECT rcRect, int mode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user