MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / GUI_StrategicMap_ScenarioSelection

Function GUI_StrategicMap_ScenarioSelection

src/gui/gui.c:3119–3206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3117}
3118
3119static uint16 GUI_StrategicMap_ScenarioSelection(uint16 campaignID)
3120{
3121 uint16 count;
3122 char key[6];
3123 bool loop;
3124 bool hasRegions = false;
3125 char category[16];
3126 StrategicMapData data[20];
3127 uint16 scenarioID;
3128 uint16 region;
3129 uint16 i;
3130
3131 GUI_Palette_CreateRemap(g_playerHouseID);
3132
3133 sprintf(category, "GROUP%d", campaignID);
3134
3135 memset(data, 0, 20 * sizeof(StrategicMapData));
3136
3137 for (i = 0; i < 20; i++) {
3138 char buffer[81];
3139
3140 sprintf(key, "REG%d", i + 1);
3141
3142 if (Ini_GetString(category, key, NULL, buffer, sizeof(buffer) - 1, g_fileRegionINI) == NULL) break;
3143
3144 sscanf(buffer, "%hd,%hd,%hd,%hd", &data[i].index, &data[i].arrow, &data[i].offsetX, &data[i].offsetY);
3145
3146 if (!GUI_StrategicMap_IsRegionDone(data[i].index)) hasRegions = true;
3147
3148 GFX_Screen_Copy2(data[i].offsetX, data[i].offsetY, i * 16, 152, 16, 16, SCREEN_1, SCREEN_1, false);
3149 GFX_Screen_Copy2(data[i].offsetX, data[i].offsetY, i * 16, 0, 16, 16, SCREEN_1, SCREEN_1, false);
3150 GUI_DrawSprite(SCREEN_1, g_sprites[505 + data[i].arrow], i * 16, 152, 0, DRAWSPRITE_FLAG_REMAP, g_remap, 1);
3151 }
3152
3153 count = i;
3154
3155 if (!hasRegions) {
3156 /* This campaign has no available regions left; reset all regions for this campaign */
3157 for (i = 0; i < count; i++) {
3158 GUI_StrategicMap_SetRegionDone(data[i].index, false);
3159 }
3160 } else {
3161 /* Mark all regions that are already done as not-selectable */
3162 for (i = 0; i < count; i++) {
3163 if (GUI_StrategicMap_IsRegionDone(data[i].index)) data[i].index = 0;
3164 }
3165 }
3166
3167 GUI_Mouse_Hide_Safe();
3168
3169 for (i = 0; i < count; i++) {
3170 if (data[i].index == 0) continue;
3171
3172 GFX_Screen_Copy2(i * 16, 152, data[i].offsetX, data[i].offsetY, 16, 16, SCREEN_1, SCREEN_0, false);
3173 }
3174
3175 GUI_Mouse_Show_Safe();
3176 Input_History_Clear();

Callers 1

GUI_StrategicMap_ShowFunction · 0.85

Calls 13

GUI_Palette_CreateRemapFunction · 0.85
Ini_GetStringFunction · 0.85
GFX_Screen_Copy2Function · 0.85
GUI_DrawSpriteFunction · 0.85
GUI_Mouse_Hide_SafeFunction · 0.85
GUI_Mouse_Show_SafeFunction · 0.85
Input_History_ClearFunction · 0.85

Tested by

no test coverage detected