MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / Map_Overview_Prepare

Method Map_Overview_Prepare

Source/Fodder.cpp:2942–2982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2940}
2941
2942void cFodder::Map_Overview_Prepare() {
2943
2944 if (mParams->mUnitTesting)
2945 return;
2946
2947 delete mSurfaceMapOverview;
2948 size_t Size = mMapLoaded->getWidth() < mMapLoaded->getHeight() ? mMapLoaded->getHeight() : mMapLoaded->getWidth();
2949 if ((Size * 16) * (Size * 16) >= 0x7FFFFFFF)
2950 return;
2951
2952 mSurfaceMapOverview = new cSurface(Size * 16, Size * 16);
2953 mSurfaceMapOverview->clearBuffer();
2954
2955 int16* MapPtr = (int16*)(mMap->data() + 0x60);
2956
2957 mSurfaceMapTop = mSurfaceMapLeft = 0;
2958
2959 if (mMapLoaded->getHeight() < mMapLoaded->getWidth()) {
2960 mSurfaceMapTop = (mMapLoaded->getWidth() / 2) - (mMapLoaded->getHeight() / 2);
2961 if (mSurfaceMapTop < 0)
2962 mSurfaceMapTop = 0;
2963 }
2964
2965 if (mMapLoaded->getWidth() < mMapLoaded->getHeight()) {
2966 mSurfaceMapLeft = (mMapLoaded->getHeight() / 2) - (mMapLoaded->getWidth() / 2);
2967 if (mSurfaceMapLeft < 0)
2968 mSurfaceMapLeft = 0;
2969 }
2970
2971 for (uint16 dx = 0; dx < mMapLoaded->getHeight(); ++dx) {
2972
2973 for (uint16 cx = 0; cx < mMapLoaded->getWidth(); ++cx, ++MapPtr) {
2974
2975 if (MapPtr < (int16*) mMap->data() || MapPtr >= (int16*) (mMap->data() + mMap->size()))
2976 continue;
2977
2978 mGraphics->MapOverview_Render_Tiles(*MapPtr & 0x1FF, cx + mSurfaceMapLeft, dx + mSurfaceMapTop);
2979 }
2980 }
2981
2982}
2983
2984void cFodder::eventProcess(const cEvent& pEvent) {
2985 switch (pEvent.mType) {

Callers

nothing calls this directly

Calls 5

clearBufferMethod · 0.80
getWidthMethod · 0.45
getHeightMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected