From b563a07d9fcaa58514eeb3ec78438db56ecf2e63 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 8 Mar 2022 18:17:59 +0100 Subject: Replaced GetRealTime uses with Game->Clock equivalent --- Stars45/Bitmap.cpp | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'Stars45/Bitmap.cpp') diff --git a/Stars45/Bitmap.cpp b/Stars45/Bitmap.cpp index 33d8502..e69a755 100644 --- a/Stars45/Bitmap.cpp +++ b/Stars45/Bitmap.cpp @@ -19,8 +19,6 @@ // +--------------------------------------------------------------------+ -DWORD GetRealTime(); - static inline void swap(int& a, int& b) { int tmp=a; a=b; b=tmp; } static inline void sort(int& a, int& b) { if (a>b) swap(a,b); } static inline void swap(double& a, double& b) { double tmp=a; a=b; b=tmp; } @@ -73,7 +71,7 @@ Bitmap::Bitmap(int w, int h, ColorIndex* p, int t) : type(t), width(w), height(h), ownpix(false), alpha_loaded(false), texture(false), pix(p), hipix(0), mapsize(w*h), - last_modified(GetRealTime()) + last_modified(Game::GetInstance()->GetClock()->RealTime()) { sprintf_s(filename, "Bitmap(%d, %d, index, type=%d)", w, h, (int) t); } @@ -82,7 +80,7 @@ Bitmap::Bitmap(int w, int h, Color* p, int t) : type(t), width(w), height(h), ownpix(false), alpha_loaded(false), texture(false), pix(0), hipix(p), mapsize(w*h), - last_modified(GetRealTime()) + last_modified(Game::GetInstance()->GetClock()->RealTime()) { sprintf_s(filename, "Bitmap(%d, %d, hicolor, type=%d)", w, h, (int) t); } @@ -239,7 +237,7 @@ Bitmap::BitBlt(int x, int y, const Bitmap& srcBmp, int sx, int sy, int w, int h, } alpha_loaded = srcBmp.alpha_loaded; - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -291,7 +289,7 @@ Bitmap::CopyBitmap(const Bitmap& rhs) } } - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -313,7 +311,7 @@ Bitmap::ClearImage() ownpix = false; texture = false; - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -348,7 +346,7 @@ Bitmap::CopyImage(int w, int h, BYTE* p, int t) memcpy(pix, p, mapsize); } - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -383,7 +381,7 @@ Bitmap::CopyHighColorImage(int w, int h, DWORD* p, int t) memcpy(hipix, p, mapsize*sizeof(DWORD)); } - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -405,7 +403,7 @@ Bitmap::CopyAlphaImage(int w, int h, BYTE* a) a++; } - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } void @@ -425,7 +423,7 @@ Bitmap::CopyAlphaRedChannel(int w, int h, DWORD* a) a++; } - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -451,7 +449,7 @@ Bitmap::AutoMask(DWORD mask) p++; } - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -480,7 +478,7 @@ Bitmap::FillColor(Color c) } } - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -750,7 +748,7 @@ Bitmap::SetIndex(int x, int y, ColorIndex c) *(hipix + y*width + x) = c.Index(); } - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -768,7 +766,7 @@ Bitmap::SetColor(int x, int y, Color c) *(hipix + y*width + x) = c; } - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -1024,7 +1022,7 @@ Bitmap::DrawLine(int x1, int y1, int x2, int y2, Color color) if (!s) return; - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); // vertical lines: if (x1==x2) { @@ -1302,7 +1300,7 @@ Bitmap::DrawRect(int x1, int y1, int x2, int y2, Color color) if (top) draw_strip(s, pitch, pixsize, x1, y1, fw, color); if (bottom) draw_strip(s, pitch, pixsize, x1, y2, fw, color); - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -1333,7 +1331,7 @@ Bitmap::DrawRect(const Rect& r, Color color) if (top) draw_strip(s, pitch, pixsize, x1, y1, r.w, color); if (bottom) draw_strip(s, pitch, pixsize, x1, y2, r.w, color); - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -1360,7 +1358,7 @@ Bitmap::FillRect(int x1, int y1, int x2, int y2, Color color) for (int i = 0; i < fh; i++) draw_strip(s, pitch, pixsize, x1, y1+i, fw, color); - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -1392,7 +1390,7 @@ Bitmap::FillRect(const Rect& r, Color color) for (int i = 0; i < fh; i++) draw_strip(s, pitch, pixsize, x1, y1+i, fw, color); - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } // +--------------------------------------------------------------------+ @@ -1473,7 +1471,7 @@ Bitmap::DrawEllipse(int x1, int y1, int x2, int y2, Color color, BYTE quad) DrawEllipsePoints(x0,y0,x,y,color,quad); } - last_modified = GetRealTime(); + last_modified = Game::GetInstance()->GetClock()->RealTime(); } void -- cgit v1.1