From dfc9e088f8530dca8f790f9ec9b89fd54816efb0 Mon Sep 17 00:00:00 2001 From: Nathan Fulton Date: Wed, 26 Apr 2017 01:08:12 -0400 Subject: [PATCH] Remove old palette code --- game/CutScene.cpp | 43 ++--------------------- game/GameOptions.cpp | 14 +++----- game/InputUI.cpp | 2 +- game/Level.cpp | 21 ----------- game/Shell.cpp | 24 +------------ game/TriggerActions.cpp | 2 -- game/Unit.cpp | 6 +--- game/form.cpp | 30 ---------------- game/game.cpp | 29 --------------- game/ht.h | 33 +---------------- game/misc.cpp | 70 +------------------------------------ game/sdl/display.cpp | 20 ----------- game/sdl/hosthelpers.h | 1 - game/sdl/htplatform.h | 2 -- game/sdl/ios/hosthelpers.mm | 9 ----- game/sdl/mac/hosthelpers.mm | 9 ----- game/sdl/sdlanimsprite.cpp | 27 -------------- game/sdl/sdlanimsprite.h | 1 - game/sprite.h | 2 -- 19 files changed, 11 insertions(+), 334 deletions(-) diff --git a/game/CutScene.cpp b/game/CutScene.cpp index 8814054..7833b37 100644 --- a/game/CutScene.cpp +++ b/game/CutScene.cpp @@ -46,12 +46,6 @@ void CutScene(const char *pszText, bool fPauseSimulation) gsim.Pause(false); delete pfrm; } - - // Set the palette back - - Palette *ppal = gsim.GetLevel()->GetPalette(); - SetHslAdjustedPalette(ppal, gnHueOffset, gnSatMultiplier, gnLumOffset); - gmpiclriclrShadow = gsim.GetLevel()->GetShadowMap(); } CutSceneForm::CutSceneForm() @@ -123,38 +117,10 @@ void CutSceneForm::More() // UNDONE: no image int cArgs = IniScanf(pch, "%+", szBitmap, &cch); if (cArgs != 0) { - if (cArgs == 1) + if (cArgs == 1) { pch += strlen(pch); - else + } else { pch += cch; - - { - // This little dance (hide the bitmap control, force a repaint, - // change the palette, show the bitmap control) is to avoid the - // ugly palette flash. - - char szPalette[kcbFilename]; - strcpy(szPalette, szBitmap); - char *pchDot = strchr(szPalette, '.'); - Assert(pchDot != NULL); - *pchDot = 0; - strcat(szPalette, ".palbin"); - - HideCutSceneBitmap(); - - FileMap fmapOld = m_fmapPalette; - Palette *ppal = (Palette *)gpakr.MapFile(szPalette, &m_fmapPalette); - if (ppal != NULL) { - if (m_wf & kfFrmHasPalette) - gpakr.UnmapFile(&fmapOld); - - m_wf |= kfFrmHasPalette; - - // Select palette - - SetHslAdjustedPalette(ppal, gnHueOffset, gnSatMultiplier, gnLumOffset); - } - ShowCutSceneBitmap(); } @@ -254,11 +220,6 @@ void CutSceneForm::OnControlSelected(word idc) } if (*m_pszText == 0) { - - // Hide the bitmap and force a repaint to avoid an ugly color flash - // if the palette changes upon return from the cut scene - - HideCutSceneBitmap(); EndForm(); } else { More(); diff --git a/game/GameOptions.cpp b/game/GameOptions.cpp index 83db6e1..3f1cf0a 100644 --- a/game/GameOptions.cpp +++ b/game/GameOptions.cpp @@ -66,7 +66,7 @@ private: class ColorOptionsForm : public Form { public: - ColorOptionsForm(Palette *ppal) secGameOptionsForm; + ColorOptionsForm() secGameOptionsForm; virtual bool Init(FormMgr *pfrmm, IniReader *pini, word idf) secGameOptionsForm; virtual void OnPaintBackground(DibBitmap *pbm, UpdateMap *pupd) secGameOptionsForm; virtual void OnControlSelected(word idc) secGameOptionsForm; @@ -75,7 +75,6 @@ private: void InitResettableControls() secGameOptionsForm; void UpdateLabels() secGameOptionsForm; - Palette *m_ppal; int m_nHueOffset; int m_nSatMultiplier; int m_nLumOffset; @@ -136,7 +135,7 @@ private: // +++ -bool DoModalGameOptionsForm(Palette *ppal, bool fInGame) +bool DoModalGameOptionsForm(bool fInGame) { #if !defined(IPHONE) && !defined(SDL) ShellForm *pfrm = (ShellForm *)gpmfrmm->LoadForm(gpiniForms, kidfGameOptions, new GameOptionsForm()); @@ -150,7 +149,7 @@ bool DoModalGameOptionsForm(Palette *ppal, bool fInGame) if (nResult == kidcColorOptions) { gpmfrmm->InvalidateRect(NULL); - Form *pfrmT = gpmfrmm->LoadForm(gpiniForms, kidfColorOptions, new ColorOptionsForm(ppal)); + Form *pfrmT = gpmfrmm->LoadForm(gpiniForms, kidfColorOptions, new ColorOptionsForm()); if (pfrmT != NULL) { pfrmT->DoModal(); delete pfrmT; @@ -576,9 +575,8 @@ void SoundOptionsForm::OnControlSelected(word idc) // Color Options Form // -ColorOptionsForm::ColorOptionsForm(Palette *ppal) +ColorOptionsForm::ColorOptionsForm() { - m_ppal = ppal; } bool ColorOptionsForm::Init(FormMgr *pfrmm, IniReader *pini, word idf) @@ -659,8 +657,6 @@ void ColorOptionsForm::OnControlSelected(word idc) UpdateLabels(); - SetHslAdjustedPalette(m_ppal, gnHueOffset, gnSatMultiplier, gnLumOffset); - // Some devices such as the PocketPC need the form redrawn because setting the palette // is only setting an 8->16 bit translation table, and only the controls are redrawing. @@ -675,7 +671,6 @@ void ColorOptionsForm::OnControlSelected(word idc) gnHueOffset = m_nHueOffset; gnSatMultiplier = m_nSatMultiplier; gnLumOffset = m_nLumOffset; - SetHslAdjustedPalette(m_ppal, gnHueOffset, gnSatMultiplier, gnLumOffset); } EndForm(idc); @@ -693,7 +688,6 @@ void ColorOptionsForm::OnControlSelected(word idc) gnHueOffset = 0; gnSatMultiplier = 0; gnLumOffset = 0; - SetHslAdjustedPalette(m_ppal, gnHueOffset, gnSatMultiplier, gnLumOffset); } InitResettableControls(); diff --git a/game/InputUI.cpp b/game/InputUI.cpp index d40af1b..2b3ddf7 100644 --- a/game/InputUI.cpp +++ b/game/InputUI.cpp @@ -403,7 +403,7 @@ void InputUIForm::InGameMenu() break; case kidcOptions: - DoModalGameOptionsForm(gsim.GetLevel()->GetPalette(), true); + DoModalGameOptionsForm(true); break; case kidcHelp: diff --git a/game/Level.cpp b/game/Level.cpp index 598eeb2..d140a92 100644 --- a/game/Level.cpp +++ b/game/Level.cpp @@ -8,8 +8,6 @@ Level::Level() m_pfogm = NULL; m_ptrmap = NULL; m_ptmap = NULL; - m_ppal = NULL; - m_mpiclriclrShadow = NULL; m_nPlayersMin = 1; m_nPlayersMax = 1; m_szTitle[0] = 0; @@ -33,11 +31,6 @@ Level::~Level() delete m_pfogm; delete m_ptrmap; - if (m_ppal != NULL) - gpakr.UnmapFile(&m_fmapPalette); - if (m_mpiclriclrShadow != NULL) - gpakr.UnmapFile(&m_fmapShadowMap); - // Free up any cached paths MobileUnitGob::FreeCachedPaths(); @@ -259,20 +252,6 @@ bool Level::LoadLevelConstants(const char *pszLevelName, IniReader *pini) return false; } - // Load palette - - if (!pini->GetPropertyValue("General", "Palette", szT, sizeof(szT))) { - Assert(false); - return false; - } - m_ppal = (Palette *)gpakr.MapFile(szT, &m_fmapPalette); - if (m_ppal == NULL) { - Assert(false); - return false; - } - strcat(szT, ".shadowmap"); - m_mpiclriclrShadow = (byte *)gpakr.MapFile(szT, &m_fmapShadowMap); - // Instantiate an OvermindGob for each Computer Player Player *pplr = gplrm.GetNextPlayer(NULL); diff --git a/game/Shell.cpp b/game/Shell.cpp index 65e3f13..489ce26 100644 --- a/game/Shell.cpp +++ b/game/Shell.cpp @@ -38,31 +38,15 @@ public: Shell gshl; Shell::Shell() { - m_ppal = NULL; - m_mpiclriclrShadow = NULL; } bool Shell::Init() { - m_ppal = (Palette *)gpakr.MapFile("shell.palbin", &m_fmapPalette); - Assert(m_ppal != NULL); - m_mpiclriclrShadow = (byte *)gpakr.MapFile("shell.palbin.shadowmap", &m_fmapShadowMap); - Assert(m_mpiclriclrShadow != NULL); return true; } void Shell::Exit() { - if (m_ppal != NULL) - gpakr.UnmapFile(&m_fmapPalette); - if (m_mpiclriclrShadow != NULL) - gpakr.UnmapFile(&m_fmapShadowMap); -} - -void Shell::SetPalette() -{ - gmpiclriclrShadow = m_mpiclriclrShadow; - SetHslAdjustedPalette(m_ppal, gnHueOffset, gnSatMultiplier, gnLumOffset); } int Shell::PlayGame(PlayMode pm, MissionIdentifier *pmiid, Stream *pstm, @@ -93,8 +77,6 @@ int Shell::PlayGame(PlayMode pm, MissionIdentifier *pmiid, Stream *pstm, // UNDONE: reload space-taking Shell resources - gmpiclriclrShadow = m_mpiclriclrShadow; - return nGo; } @@ -215,10 +197,6 @@ void Shell::Launch(bool fLoadReinitializeSave, MissionIdentifier *pmiid) pfrm->GetControlPtr(kidcBuyMe)->Show(false); #endif - // Make Shell palette and shadow map active - - gshl.SetPalette(); - int idc; pfrm->DoModal(&idc); delete pfrm; @@ -242,7 +220,7 @@ void Shell::Launch(bool fLoadReinitializeSave, MissionIdentifier *pmiid) continue; case kidcSetupGame: - DoModalGameOptionsForm(m_ppal, false); + DoModalGameOptionsForm(false); continue; case kidcForums: diff --git a/game/TriggerActions.cpp b/game/TriggerActions.cpp index 728873b..4c2d38c 100644 --- a/game/TriggerActions.cpp +++ b/game/TriggerActions.cpp @@ -1217,8 +1217,6 @@ bool CutSceneAction::Perform(Trigger *ptgr, Side side) return true; } - // UNDONE: clear screen for cleaner palette transition? - CutScene(m_pszMessage, true); // if the app was exited while the cut scene was up, return to it diff --git a/game/Unit.cpp b/game/Unit.cpp index 0f4b675..918ff1b 100644 --- a/game/Unit.cpp +++ b/game/Unit.cpp @@ -658,11 +658,7 @@ void UnitGob::Hilight(bool fHilight) AnimSprite *UnitGob::CreateHilightSprite() { - AnimSprite *panispr = gpsprm->CreateAnimSprite(); - if (panispr != NULL) { - panispr->SetPalette(gsim.GetLevel()->GetPalette()); - } - return panispr; + return gpsprm->CreateAnimSprite(); } void UnitGob::SetHealth(fix fxHealth) diff --git a/game/form.cpp b/game/form.cpp index 6067738..eadb0c2 100644 --- a/game/form.cpp +++ b/game/form.cpp @@ -39,11 +39,6 @@ Form::~Form() if (m_pfrmm != NULL) m_pfrmm->RemoveForm(this); - if (m_wf & kfFrmHasPalette) - gpakr.UnmapFile(&m_fmapPalette); - if (m_wf & kfFrmHasShadowMap) - gpakr.UnmapFile(&m_fmapShadowMap); - // Mark deleted for debugging purposes m_wf |= kfFrmDeleted; @@ -160,7 +155,6 @@ bool Form::InitFromProperties(FormMgr *pfrmm, word idf, IniReader *pini, char *p int x, y, cx, cy; char szBitmap[kcbFilename]; - char szPalette[kcbFilename]; int idcDefault; char szArgs[3][32]; int cArgs = pini->GetPropertyValue(pszForm, "FORM", "(%d %d %d %d) %d %s %s %s", @@ -213,9 +207,6 @@ bool Form::InitFromProperties(FormMgr *pfrmm, word idf, IniReader *pini, char *p cArgs = pini->GetPropertyValue(pszForm, "FORMBITMAP", "%s", szBitmap); if (cArgs == 0) szBitmap[0] = 0; - cArgs = pini->GetPropertyValue(pszForm, "FORMPALETTE", "%s", szPalette); - if (cArgs == 0) - szPalette[0] = 0; cArgs = pini->GetPropertyValue(pszForm, "FORMBACKCOLOR", "%d", &m_iclrBack); if (cArgs == 0) m_iclrBack = -1; @@ -235,27 +226,6 @@ bool Form::InitFromProperties(FormMgr *pfrmm, word idf, IniReader *pini, char *p m_pfrmm = pfrmm; m_idf = idf; - // Load and set the form Palette, if any - - if (szPalette[0] != 0) { - Palette *ppal = (Palette *)gpakr.MapFile(szPalette, &m_fmapPalette); - Assert(ppal != NULL); - if (ppal == NULL) - return false; - m_wf |= kfFrmHasPalette; - - // Select palette - - SetHslAdjustedPalette(ppal, gnHueOffset, gnSatMultiplier, gnLumOffset); - - // Load and set a corresponding shadow map if it exists - - strcat(szPalette, ".shadowmap"); - gmpiclriclrShadow = (byte *)gpakr.MapFile(szPalette, &m_fmapShadowMap); - if (gmpiclriclrShadow != NULL) - m_wf |= kfFrmHasShadowMap; - } - return true; } diff --git a/game/game.cpp b/game/game.cpp index 4c21ad8..86a9372 100644 --- a/game/game.cpp +++ b/game/game.cpp @@ -26,7 +26,6 @@ GobStateMachineMgr gsmm; GobMgr ggobm; byte *gpbScratch; word gcbScratch; -byte *gmpiclriclrShadow; int gimmReinitialize = -1; bool gfLoadReinitializeSave = false; int gcxTile; @@ -366,11 +365,6 @@ bool Game::Init(int imm) return false; } - // Make Shell palette and shadow map active - - ClearDisplay(); - gshl.SetPalette(); - // Init form / control requirements ButtonControl::InitClass(); @@ -1970,16 +1964,6 @@ bool Game::InitSimulation(Stream *pstm, char *pszLevel, word wfRole, if ((wfRole & kfRoleMultiplayer) == 0) m_pfrmSimUI->OnTimer(0); - // Clear the screen so the ugly palette change isn't apparent - - ClearDisplay(); - - // Set palette - - Palette *ppal = gsim.GetLevel()->GetPalette(); - SetHslAdjustedPalette(ppal, gnHueOffset, gnSatMultiplier, gnLumOffset); - gmpiclriclrShadow = gsim.GetLevel()->GetShadowMap(); - // Tell the sprite manager the clipping rects Rect rcClip1; @@ -2027,16 +2011,7 @@ void Game::ExitSimulation() delete m_pfrmMiniMap; m_pfrmMiniMap = NULL; - // Before the shell changes the palette... - ClearDisplay(); - - // Too many places are forgetting to set the palette when the - // simulation exits, so set it back to the shell palette and - // shadow map here. Note InitSimulation sets it to the level - // palette / shadowmap, so this is appropriate. - - gshl.SetPalette(); } void Game::Exit() @@ -2060,10 +2035,6 @@ void Game::Exit() Status("Exit Simulation (one-time)..."); gsim.OneTimeExit(); - // Clear so that when PalmOS switches palette we don't have screen trash - - ClearDisplay(); - m_pfrmSimUI = NULL; delete gpmfrmm; gpmfrmm = NULL; diff --git a/game/ht.h b/game/ht.h index a550316..e7339e2 100644 --- a/game/ht.h +++ b/game/ht.h @@ -635,14 +635,6 @@ public: return bottom - top; } }; - -// Palette - -struct Palette // pal -{ - word cEntries; - byte argb[1][3]; -}; } // namespace wi @@ -2405,7 +2397,6 @@ public: MissionIdentifier *pmiid = NULL) secShell; int PlayGame(PlayMode pm, MissionIdentifier *pmiid, Stream *pstm, int nRank) secShell; - void SetPalette() secShell; private: bool DoPlay(); @@ -2414,11 +2405,6 @@ private: bool PlaySinglePlayer(const PackId *ppackid) secShell; bool PlayMultiplayer(const PackId *ppackid) secShell; void DownloadMissionPack() secShell; - - FileMap m_fmapPalette; - FileMap m_fmapShadowMap; - Palette *m_ppal; - byte *m_mpiclriclrShadow; }; extern Shell gshl; @@ -2645,8 +2631,6 @@ private: #define kfFrmDoModal 0x02 #define kfFrmVisible 0x04 #define kfFrmPenInside 0x08 -#define kfFrmHasPalette 0x10 -#define kfFrmHasShadowMap 0x20 #define kfFrmScaleCoords 0x40 #define kfFrmAutoTakedown 0x80 #define kfFrmTranslucent 0x100 @@ -2742,8 +2726,6 @@ protected: Sfx m_sfxShow; Sfx m_sfxHide; Control *m_apctl[kcControlsMax]; - FileMap m_fmapPalette; - FileMap m_fmapShadowMap; int m_iclrBack; void* m_pUserData; @@ -5338,14 +5320,6 @@ public: return m_ptmap; } - Palette *GetPalette() { - return m_ppal; - } - - byte *GetShadowMap() { - return m_mpiclriclrShadow; - } - FogMap *GetFogMap() { return m_pfogm; } @@ -5404,10 +5378,6 @@ private: char m_szFileLevel[kcbFilename]; int m_nPlayersMin, m_nPlayersMax; TileMap *m_ptmap; - Palette *m_ppal; - FileMap m_fmapPalette; - byte *m_mpiclriclrShadow; - FileMap m_fmapShadowMap; FogMap *m_pfogm; TerrainMap *m_ptrmap; bool m_fInitialized; @@ -8597,7 +8567,6 @@ void FillHelper(DibBitmap *pbm, UpdateMap *pupd, Rect *prc, Color clr) secForm; void BltHelper(DibBitmap *pbm, TBitmap *ptbm, UpdateMap *pupd, int xDst, int yDst) secForm; void RgbToHsl(byte bR, byte bG, byte bB, word *pnH, word *pnS, word *pnL) secMisc; void HslToRgb(word nH, word nS, word nL, byte *pbR, byte *pbG, byte *pbB) secMisc; -void SetHslAdjustedPalette(Palette *ppal, short nHueOffset, short nSatMultiplier, short nLumOffset) secMisc; UnitConsts *GetUnitConsts(GobType gt) secGob; Sfx SfxFromCategory(SfxCategory sfxc) secMisc; bool ParseNumber(char **ppsz, int *pn) secTrigger; @@ -8609,7 +8578,7 @@ bool ParseString(char **ppsz, char *psz) secTrigger; SideMask GetSideMaskFromCaSideMask(Side sideCur, word wfCaSideMask) secTrigger; int GetPlayersListFromCaSideMask(Side sideCur, word wfMask, Player **applr) secTrigger; void Ecom(int nCharFrom, int nCharTo, char *pszMessage, int nBackground, bool fMore) secEcom; -bool DoModalGameOptionsForm(Palette *ppal, bool fInGame) secGameOptionsForm; +bool DoModalGameOptionsForm(bool fInGame) secGameOptionsForm; bool ShowDownloadMissionPackForm(PackId *ppackid); bool DownloadMissionPack(const PackId *ppackid, const char *pszTitle, bool fPlayButton); diff --git a/game/misc.cpp b/game/misc.cpp index 01f238f..aa180df 100644 --- a/game/misc.cpp +++ b/game/misc.cpp @@ -717,80 +717,12 @@ void WLineIterator::Init(WCoord wx1, WCoord wy1, WCoord wx2, WCoord wy2, int nIn } // -// Palette and color helpers +// Color helpers // const short SCALEFACTOR = 128; const word SCALEMAX = 256 * (word)SCALEFACTOR; -// nHueOffset is in the range from -100 to +100 -// nLumOffset is in the range from -100 to +100 -// nSatMultiplier is in the range from -100 to +100 and is scaled non-linearly -// to cover the desired (finely tuned) range. - -void SetHslAdjustedPalette(Palette *ppal, short nHueOffset, short nSatMultiplier, short nLumOffset) -{ - // Incorporate hardware-correcting values - - short nHueT, nSatT, nLumT; - gpdisp->GetHslAdjustments(&nHueT, &nSatT, &nLumT); - nHueOffset += nHueT; - if (nHueT < -100) - nHueT = -100; - else if (nHueT > 100) - nHueT = 100; - nSatMultiplier += nSatT; - if (nSatMultiplier < -100) - nSatMultiplier = -100; - else if (nSatMultiplier > 100) - nSatMultiplier = 100; - nLumOffset += nLumT; - if (nLumOffset < -100) - nLumOffset = -100; - else if (nLumOffset > 100) - nLumOffset = 100; - - short nHueAdd = (nHueOffset * (3 * SCALEFACTOR)) / 100; - short nLumAdd = (short)((nLumOffset * 10000L) / 100); - - // maps +/-100 to 128-384 - long nT = 128 + (((nSatMultiplier + 100L) * 256) / 200); - - // non-linearly transforms to the range 0-1024 (actually 64-576) - short nSatMult = (short)((nT * nT) / 256); - - int cEntries = BigWord(ppal->cEntries); - Palette *ppalMod = (Palette *)new byte[sizeof(word) + (cEntries * sizeof(ppal->argb))]; - ppalMod->cEntries = ppal->cEntries; - - word nH, nS, nL; - - for (int i = 0; i < cEntries; i++) { - RgbToHsl(ppal->argb[i][0], ppal->argb[i][1], ppal->argb[i][2], &nH, &nS, &nL); - - int nT = nH + nHueAdd; - if (nT >= 6 * SCALEFACTOR) - nT -= 6 * SCALEFACTOR; - else if (nT < 0) - nT += 6 * SCALEFACTOR; - - long lS = (nS * (long)nSatMult) / 256L; - if (lS > SCALEMAX) - lS = (long)SCALEMAX; - - long lL = nL + (long)nLumAdd; - if (lL > SCALEMAX) - lL = (long)SCALEMAX; - else if (lL < 0) - lL = 0; - - HslToRgb((word)nT, (word)lS, (word)lL, &ppalMod->argb[i][0], &ppalMod->argb[i][1], &ppalMod->argb[i][2]); - } - - gpdisp->SetPalette(ppalMod); - delete[] ppalMod; -} - // Takes byte-sized RGB values in the range from 0-255 and returns // word-sized HSL values in the range from 0-32768 (H, S, L). // H is special and ranges from 0 to SCALEFACTOR (128) * 6 diff --git a/game/sdl/display.cpp b/game/sdl/display.cpp index e52e845..dbeb02a 100644 --- a/game/sdl/display.cpp +++ b/game/sdl/display.cpp @@ -181,26 +181,6 @@ bool Display::Init() return true; } -void Display::SetPalette(Palette *ppal) -{ - SDL_Color aclr[256]; - int cEntries = BigWord(ppal->cEntries); - byte *pb = (byte *)ppal->argb; - SDL_Color *pclr = aclr; - - for (int i = 0; i < cEntries; i++) { - pclr->r = *pb++; - pclr->g = *pb++; - pclr->b = *pb++; - pclr++; - } - - for (int i = 0; i < cEntries; i++) { - m_palette[i] = ((Uint8)aclr[i].r << 16) | ((Uint8)aclr[i].g << 8) | ((Uint8)aclr[i].b << 0); - } - -} - int Display::GetModeCount() { return m_cmodes; diff --git a/game/sdl/hosthelpers.h b/game/sdl/hosthelpers.h index c09b0c2..ec811c1 100644 --- a/game/sdl/hosthelpers.h +++ b/game/sdl/hosthelpers.h @@ -41,7 +41,6 @@ public: static void ResetScrollOffset(); static void SetFormMgrs(FormMgr *pfrmmSimUI, FormMgr *pfrmmInput); static DibBitmap *CreateFrontDib(int cx, int cy, int nDegreeOrientation); - static void SetPalette(Palette *ppal); static const char *GetUdid(); static void InitiateAsk(const char *title, int max, const char *def, int keyboard, bool secure); diff --git a/game/sdl/htplatform.h b/game/sdl/htplatform.h index 66a6d9e..eba6446 100644 --- a/game/sdl/htplatform.h +++ b/game/sdl/htplatform.h @@ -93,7 +93,6 @@ struct ModeInfo }; #define kcmodesMax 16 -struct Palette; class Rect; class DibBitmap; class UpdateMap; @@ -107,7 +106,6 @@ public: ~Display(); bool Init(); - void SetPalette(Palette *ppal); int GetModeCount(); void GetModeInfo(int imode, ModeInfo *pmode); int GetMode(ModeInfo *pmode); diff --git a/game/sdl/ios/hosthelpers.mm b/game/sdl/ios/hosthelpers.mm index c8b5ac9..ec7f756 100644 --- a/game/sdl/ios/hosthelpers.mm +++ b/game/sdl/ios/hosthelpers.mm @@ -202,15 +202,6 @@ DibBitmap *HostHelpers::CreateFrontDib(int cx, int cy, int nDegreeOrientation) return NULL; #endif } - -void HostHelpers::SetPalette(Palette *ppal) -{ -#if 0 - [g_appDelegate setPalette:ppal]; -#else - Log("HostHelpers::SetPalette not implemented yet"); -#endif -} static char gszUdid[20]; diff --git a/game/sdl/mac/hosthelpers.mm b/game/sdl/mac/hosthelpers.mm index 824362b..0950e0a 100644 --- a/game/sdl/mac/hosthelpers.mm +++ b/game/sdl/mac/hosthelpers.mm @@ -186,15 +186,6 @@ DibBitmap *HostHelpers::CreateFrontDib(int cx, int cy, int nDegreeOrientation) return NULL; #endif } - -void HostHelpers::SetPalette(Palette *ppal) -{ -#if 0 - [g_appDelegate setPalette:ppal]; -#else - Log("HostHelpers::SetPalette not implemented yet"); -#endif -} static char gszUdid[20]; diff --git a/game/sdl/sdlanimsprite.cpp b/game/sdl/sdlanimsprite.cpp index 2e5dbbc..b768095 100644 --- a/game/sdl/sdlanimsprite.cpp +++ b/game/sdl/sdlanimsprite.cpp @@ -196,33 +196,6 @@ void SdlAnimSprite::GetBounds(Rect *prc) { prc->bottom = yNew + cyNew; } -void SdlAnimSprite::SetPalette(Palette *ppal) { - // Set the palette mapping table - // Note the AMXs use the first 131 colors of the palette. - for (int n = 0; n < BigWord(ppal->cEntries); n++) { - byte *pb = (byte *)&mp8bpp32bpp_[n]; - *pb++ = 255; - *pb++ = ppal->argb[n][0]; - *pb++ = ppal->argb[n][1]; - *pb++ = ppal->argb[n][2]; - } - - // Make the last color of the palete RGBA for transparent. - // We'll fill the 8bpp image with this, so that at 8->32 conversion, - // we get transparency. - - mp8bpp32bpp_[255] = 0; - - // Make the second to last 40% black. AMX transparent will map to this - // with clever remapping. 40% is equivalent to tbitmap shadowmap. - - byte *pb = (byte *)&mp8bpp32bpp_[254]; - *pb++ = 102; - *pb++ = 0; - *pb++ = 0; - *pb++ = 0; -} - void SdlAnimSprite::SetScale(float nScale) { if (nScale_ == nScale) { return; diff --git a/game/sdl/sdlanimsprite.h b/game/sdl/sdlanimsprite.h index da7413b..e888072 100644 --- a/game/sdl/sdlanimsprite.h +++ b/game/sdl/sdlanimsprite.h @@ -14,7 +14,6 @@ public: ~SdlAnimSprite(); // AnimationSprite - virtual void SetPalette(Palette *ppal); virtual void CaptureFrame(UnitGob *pgob); virtual void SetScaleAnimation(float nScaleStart, float nScaleEnd, dword cms, dword cmsRate, bool fAutoDestroy); diff --git a/game/sprite.h b/game/sprite.h index 06ad43e..1b0e877 100644 --- a/game/sprite.h +++ b/game/sprite.h @@ -5,7 +5,6 @@ namespace wi { -class Palette; class Animation; class AnimSprite; class SelectionSprite; @@ -36,7 +35,6 @@ public: class UnitGob; class AnimSprite : public Sprite { public: - virtual void SetPalette(Palette *ppal) = 0; virtual void CaptureFrame(UnitGob *pgob) = 0; virtual void SetScaleAnimation(float nScaleStart, float nScaleEnd, dword cms, dword cmsRate, bool fAutoDestroy) = 0;