@@ -1153,24 +1153,92 @@ void Gui::drawMenuBar() {
1153
1153
ImGui::PushItemFlag (ImGuiItemFlags_AutoClosePopups, false );
1154
1154
1155
1155
bool changed = false ;
1156
- ImGui::MenuItem (" Engine" , 0 , false , false );
1156
+ if (ImGui::BeginMenu (" Engine" )) {
1157
+ if (ImGui::MenuItem (" Half-Life" , 0 , g_settings.engine == ENGINE_HALF_LIFE, !app->isLoading )) {
1158
+ changed = g_settings.engine != ENGINE_HALF_LIFE;
1159
+ g_settings.engine = ENGINE_HALF_LIFE;
1160
+ if (g_settings.mapsize_auto ) {
1161
+ g_settings.mapsize_min = -4096 ;
1162
+ g_settings.mapsize_max = 4096 ;
1163
+ }
1164
+ }
1165
+ tooltip (g, " The standard GoldSrc engine.\n " );
1157
1166
1158
- if (ImGui::MenuItem (" Half-Life" , 0 , g_settings.engine == ENGINE_HALF_LIFE, !app->isLoading )) {
1159
- changed = g_settings.engine != ENGINE_HALF_LIFE;
1160
- g_settings.engine = ENGINE_HALF_LIFE;
1167
+ if (ImGui::MenuItem (" Sven Co-op" , 0 , g_settings.engine == ENGINE_SVEN_COOP, !app->isLoading )) {
1168
+ changed = g_settings.engine != ENGINE_SVEN_COOP;
1169
+ g_settings.engine = ENGINE_SVEN_COOP;
1170
+ if (g_settings.mapsize_auto ) {
1171
+ g_settings.mapsize_min = -32768 ;
1172
+ g_settings.mapsize_max = 32768 ;
1173
+ }
1174
+ }
1175
+ tooltip (g, " Sven Co-op has higher map limits than Half-Life. Some maps need this selected to display correctly in the editor."
1176
+ " \n\n Attempting to run a "
1177
+ " Sven Co-op map in Half-Life may result in AllocBlock Full errors, Bad Surface Extents, "
1178
+ " crashes caused by large textures, and visual glitches caused by crossing the +/-4096 map boundary. "
1179
+ " See the Porting Tools menu for solutions to these problems." );
1180
+
1181
+ ImGui::EndMenu ();
1161
1182
}
1162
- tooltip (g, " The standard GoldSrc engine. Assumes a +/-4096 map boundary.\n " );
1163
1183
1164
- if (ImGui::MenuItem (" Sven Co-op" , 0 , g_settings.engine == ENGINE_SVEN_COOP, !app->isLoading )) {
1165
- changed = g_settings.engine != ENGINE_SVEN_COOP;
1166
- g_settings.engine = ENGINE_SVEN_COOP;
1184
+ if (ImGui::BeginMenu (" Map Size" )) {
1185
+ if (ImGui::MenuItem (" Auto" , 0 , g_settings.mapsize_auto )) {
1186
+ if (g_settings.engine == ENGINE_HALF_LIFE) {
1187
+ g_settings.mapsize_min = -4096 ;
1188
+ g_settings.mapsize_max = 4096 ;
1189
+ }
1190
+ else if (g_settings.engine == ENGINE_SVEN_COOP) {
1191
+ g_settings.mapsize_min = -32768 ;
1192
+ g_settings.mapsize_max = 32768 ;
1193
+ }
1194
+ g_settings.mapsize_auto = true ;
1195
+ }
1196
+ tooltip (g, " The map size will be set according to the Engine you choose." );
1197
+
1198
+ if (ImGui::MenuItem (" +/-4096 (Half-Life)" , 0 , !g_settings.mapsize_auto && g_settings.mapsize_min == -4096 && g_settings.mapsize_max == 4096 )) {
1199
+ g_settings.mapsize_min = -4096 ;
1200
+ g_settings.mapsize_max = 4096 ;
1201
+ g_settings.mapsize_auto = false ;
1202
+ }
1203
+ tooltip (g, " The default map size for Half-Life and most of its mods." );
1204
+
1205
+ if (ImGui::MenuItem (" +/-32768 (Sven Co-op)" , 0 , !g_settings.mapsize_auto && g_settings.mapsize_min == -32768 && g_settings.mapsize_max == 32768 )) {
1206
+ g_settings.mapsize_min = -32768 ;
1207
+ g_settings.mapsize_max = 32768 ;
1208
+ g_settings.mapsize_auto = false ;
1209
+ }
1210
+ tooltip (g, " The safe maximum map size for Sven Co-op maps." );
1211
+
1212
+ if (ImGui::MenuItem (" +/-131072 (Sven Co-op)" , 0 , !g_settings.mapsize_auto && g_settings.mapsize_min == -131072 && g_settings.mapsize_max == 131072 )) {
1213
+ g_settings.mapsize_min = -131072 ;
1214
+ g_settings.mapsize_max = 131072 ;
1215
+ g_settings.mapsize_auto = false ;
1216
+ }
1217
+ tooltip (g, " Players can technically run around in this giant area but the game may become buggy mess once you pass the +/-32768 boundary." );
1218
+
1219
+ for (int i = 0 ; i < g_app->fgds .size (); i++) {
1220
+ Fgd* fgd = g_app->fgds [i];
1221
+ int min = fgd->mapSizeMin ;
1222
+ int max = fgd->mapSizeMax ;
1223
+
1224
+ if (min == 0 && max == 0 ) {
1225
+ continue ;
1226
+ }
1227
+
1228
+ string name;
1229
+ if (min != -max)
1230
+ name = " (" + to_string (min) + " , " + to_string (max) + " ) " + fgd->name + " .fgd" ;
1231
+ else
1232
+ name = " +/-" + to_string (max) + " (" + fgd->name + " .fgd)" ;
1233
+
1234
+ if (ImGui::MenuItem (name.c_str (), 0 , g_settings.mapsize_min == min && g_settings.mapsize_max == max)) {
1235
+ g_settings.mapsize_min = min;
1236
+ g_settings.mapsize_max = max;
1237
+ }
1238
+ tooltip (g, (" The @mapsize loaded from " + fgd->name + " .fgd." ).c_str ());
1239
+ }
1240
+ ImGui::EndMenu ();
1167
1241
}
1168
- tooltip (g, " Sven Co-op has higher map limits than Half-Life. Some maps need this selected to display correctly in the editor."
1169
- " \n\n Attempting to run a "
1170
- " Sven Co-op map in Half-Life may result in AllocBlock Full errors, Bad Surface Extents, "
1171
- " crashes caused by large textures, and visual glitches caused by crossing the +/-4096 map boundary. "
1172
- " See the Porting Tools menu for solutions to these problems.\n\n "
1173
- " The map boundary for Sven Co-op is effectively +/-32768. Rendering glitches occur beyond that point." );
1174
1242
1175
1243
if (changed) {
1176
1244
g_limits = g_engine_limits[g_settings.engine ];
@@ -1395,6 +1463,8 @@ void Gui::drawMenuBar() {
1395
1463
1396
1464
for (int i = 0 ; i < 10 ; i++) {
1397
1465
if (ImGui::MenuItem (optionNames[i], 0 , false , !app->isLoading )) {
1466
+ LumpReplaceCommand* command = new LumpReplaceCommand (" Delete OOB Data" );
1467
+
1398
1468
if (map->ents [0 ]->hasKey (" origin" )) {
1399
1469
vec3 ori = map->ents [0 ]->getOrigin ();
1400
1470
logf (" Moved worldspawn origin by %f %f %f\n " , ori.x , ori.y , ori.z );
@@ -1403,7 +1473,6 @@ void Gui::drawMenuBar() {
1403
1473
1404
1474
}
1405
1475
1406
- LumpReplaceCommand* command = new LumpReplaceCommand (" Delete OOB Data" );
1407
1476
map->delete_oob_data (clipFlags[i]);
1408
1477
command->pushUndoState ();
1409
1478
}
0 commit comments