diff --git a/README.md b/README.md
index ce0e0dc04d..1ae0cc8af3 100644
--- a/README.md
+++ b/README.md
@@ -126,6 +126,21 @@ If you encounter any issues while playing, please create an issue with the Vega
# Compiling Vegastrike
+## Saving some space while downloading
+
+The Vega Strike Engine Source repository contains a lot of history not all of which is relevant to current developers if they want to quickly download and build something.
+By default, the full clone will download over 800 MB of data. There are several options to minimize this:
+
+1. Download a compressed copy of the source from the release
+2. Download a master.zip from GitHub
+3. Do a shallow clone using the following:
+
+```bash
+$ git clone git@github.com:vegastrike/Vega-Strike-Engine-Source.git --shallow-since=2023-09-27
+```
+
+This will produce a significantly smaller download - in the order of 22-30 MB; well over a 10x reduction.
+
## Compiling On Linux
1. Install the development dependencies:
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 3e7b54bcbe..956e569d66 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -23,8 +23,6 @@
#
-CMAKE_MINIMUM_REQUIRED(VERSION 3.16 FATAL_ERROR)
-
INCLUDE(GNUInstallDirs)
MESSAGE("Always using preferred method now to install doc files")
INSTALL(FILES AUTHORS TYPE DOC RENAME AUTHORS.SF)
@@ -32,4 +30,3 @@ INSTALL(FILES "${PROJECT_SOURCE_DIR}/AUTHORS" TYPE DOC RENAME AUTHORS.GITHUB)
INSTALL(FILES ChangeLog TYPE DOC)
ADD_SUBDIRECTORY(man)
-
diff --git a/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt
index e694498c63..27442d22cd 100644
--- a/doc/man/CMakeLists.txt
+++ b/doc/man/CMakeLists.txt
@@ -23,8 +23,6 @@
#
-CMAKE_MINIMUM_REQUIRED(VERSION 3.16 FATAL_ERROR)
-
IF (UNIX)
MESSAGE("Always using preferred method now to install man pages")
INSTALL(FILES vegastrike-engine.1 TYPE MAN)
diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt
index 9cd66fe607..05a7997866 100644
--- a/engine/CMakeLists.txt
+++ b/engine/CMakeLists.txt
@@ -32,17 +32,8 @@
MESSAGE("PROCESSING DIRECTORY: ${CMAKE_CURRENT_SOURCE_DIR}")
-CMAKE_MINIMUM_REQUIRED(VERSION 3.21 FATAL_ERROR)
-
-IF (POLICY CMP0087)
- cmake_policy(SET CMP0087 NEW)
-ENDIF ()
SET(X_VCPKG_APPLOCAL_DEPS_INSTALL ON)
-IF (POLICY CMP0167)
- CMAKE_POLICY (SET CMP0167 OLD)
-ENDIF (POLICY CMP0167)
-
# One version header generator to rule them all
CONFIGURE_FILE(src/version.h.in ${Vega_Strike_BINARY_DIR}/src/version.h)
CONFIGURE_FILE(src/version.h.in ${Vega_Strike_BINARY_DIR}/setup/src/include/version.h)
diff --git a/engine/objconv/CMakeLists.txt b/engine/objconv/CMakeLists.txt
index 2deb9bc89e..1f6228a6a2 100644
--- a/engine/objconv/CMakeLists.txt
+++ b/engine/objconv/CMakeLists.txt
@@ -23,8 +23,6 @@
#
-CMAKE_MINIMUM_REQUIRED(VERSION 3.16 FATAL_ERROR)
-
#SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "")
INCLUDE_DIRECTORIES("..")
SET(TRISORT_SOURCES trisort.cpp)
diff --git a/engine/setup/CMakeLists.txt b/engine/setup/CMakeLists.txt
index fbcb998f1f..1d0d361248 100644
--- a/engine/setup/CMakeLists.txt
+++ b/engine/setup/CMakeLists.txt
@@ -22,17 +22,8 @@
# along with Vega Strike. If not, see .
#
-CMAKE_MINIMUM_REQUIRED(VERSION 3.21 FATAL_ERROR)
-
-IF (POLICY CMP0087)
- cmake_policy(SET CMP0087 NEW)
-ENDIF ()
SET(X_VCPKG_APPLOCAL_DEPS_INSTALL ON)
-IF (POLICY CMP0167)
- CMAKE_POLICY (SET CMP0167 OLD)
-ENDIF (POLICY CMP0167)
-
IF (CMAKE_SYSTEM_NAME STREQUAL BEOS OR CMAKE_SYSTEM_NAME STREQUAL Windows)
MESSAGE ("SKIPPING vegasettings - not supported on this platform at this time")
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux)
diff --git a/engine/setup/src/include/display.h b/engine/setup/src/include/display.h
index 712c657661..dd62de8f5e 100644
--- a/engine/setup/src/include/display.h
+++ b/engine/setup/src/include/display.h
@@ -1,10 +1,3 @@
-/*
-#====================================
-# @file : display.h
-# @brief : setup configuration
-#====================================
-*/
-
/*
* Copyright (C) 2001-2025 Daniel Horn, David Ranger, pyramid3d,
* Stephen G. Tuggy, Benjamen R. Meyer, and other Vega Strike contributors.
@@ -39,7 +32,7 @@ void ShowMain();
#define GET_TITLE char title[1000]="Vega Strike Settings"; \
if (strlen(CONFIG.program_name)+strlen(VERSION)<800) { \
- snprintf(title, 1000, "Settings - %s - Version %s", \
+ snprintf(title, 999, "Settings - %s - Version %s", \
CONFIG.program_name, VEGASTRIKE_VERSION_STR); \
}
diff --git a/engine/setup/src/include/display_gtk.cpp b/engine/setup/src/include/display_gtk.cpp
index ef516615f8..e39b15ceac 100644
--- a/engine/setup/src/include/display_gtk.cpp
+++ b/engine/setup/src/include/display_gtk.cpp
@@ -1,5 +1,7 @@
/*
- * Copyright (C) 2001-2022 Daniel Horn, David Ranger,
+ * display_gtk.cpp
+ *
+ * Copyright (C) 2001-2025 Daniel Horn, David Ranger,
* pyramid3d, Stephen G. Tuggy, and other Vega Strike contributors.
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
@@ -36,6 +38,8 @@ void ClickButton(GtkWidget *w, struct catagory *CUR);
#include
+#include
+
//#define USE_RADIO
@@ -47,11 +51,13 @@ void exit_0(GtkWidget *w, void *arg) {
void InitGraphics(int *argc, char ***argv) {
gtk_init(argc, argv);
- GET_TITLE; // sets title; uses sprintf, not snprintf -- //[MSVC-Warn]
+ GET_TITLE;
GET_STATIC_TEXT;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 600, 400);
- gtk_window_set_title(GTK_WINDOW(window), title);
+ gtk_window_set_title(
+ GTK_WINDOW(window),
+ (boost::format("Settings - %1% - Version %2%") % CONFIG.program_name % VEGASTRIKE_VERSION_STR).str().c_str());
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(exit_0), NULL);
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(exit_0), NULL);
diff --git a/engine/src/cmd/script/script_variables.cpp b/engine/src/cmd/script/script_variables.cpp
index 4670b78566..918613f363 100644
--- a/engine/src/cmd/script/script_variables.cpp
+++ b/engine/src/cmd/script/script_variables.cpp
@@ -1,9 +1,8 @@
/*
* script_variables.cpp
*
- * Copyright (C) 2001-2002 Daniel Horn
- * Copyright (C) Alexander Rawass
- * Copyright (C) 2021-2022 Stephen G. Tuggy
+ * Copyright (C) 2001-2025 Daniel Horn, Alexander Rawass, Stephen G. Tuggy,
+ * and other Vega Strike contributors
*
* https://github.com/vegastrike/Vega-Strike-Engine-Source
*
@@ -11,7 +10,7 @@
*
* Vega Strike is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Vega Strike is distributed in the hope that it will be useful,
@@ -439,35 +438,42 @@ void Mission::doSetVar(missionNode *node, int mode) {
node->script.name = node->attr_value("name");
if (node->script.name.empty()) {
fatalError(node, mode, "you have to give a variable name");
+ VS_LOG_FLUSH_EXIT(fatal, "you have to give a variable name", -1);
}
}
debug(3, node, mode, "trying to set variable " + node->script.name);
if (node->subnodes.size() != 1) {
fatalError(node, mode, "setvar takes exactly one argument");
- assert(0);
+ VS_LOG_FLUSH_EXIT(fatal, "setvar takes exactly one argument", -1);
}
missionNode *expr = (missionNode *) node->subnodes[0];
if (mode == SCRIPT_PARSE) {
varInst *vi = searchScopestack(node->script.name);
- if (vi == NULL) {
+ if (vi == nullptr) {
missionNode *global_var = runtime.global_variables[node->script.name];
- if (global_var == NULL) {
+ if (global_var == nullptr) {
fatalError(node, mode, "no variable " + node->script.name + " found on the scopestack (setvar)");
- assert(0);
+ VS_LOG_FLUSH_EXIT(fatal, (boost::format("no variable %1% found on the scopestack (setvar)") % node->script.name), -1);
}
vi = global_var->script.varinst;
}
- if (vi->type != VAR_BOOL && vi->type != VAR_FLOAT && vi->type != VAR_INT && vi->type != VAR_OBJECT) {
- fatalError(node, mode, "unsupported type in setvar");
- assert(0);
+ switch (vi->type) {
+ case VAR_FLOAT: // fall-through
+ case VAR_INT: // fall-through
+ case VAR_BOOL: // fall-through
+ case VAR_OBJECT:// fall-through
+ break;
+ default:
+ fatalError(node, mode, "unsupported type in setvar");
+ VS_LOG_FLUSH_EXIT(fatal, "unsupported type in setvar", -1);
}
}
if (mode == SCRIPT_RUN) {
varInst *var_inst = doVariable(node, mode); //lookup variable instance
- if (var_inst == NULL) {
+ if (var_inst == nullptr) {
fatalError(node, mode, "variable lookup failed for " + node->script.name);
printRuntime();
- assert(0);
+ VS_LOG_FLUSH_EXIT(fatal, (boost::format("variable lookup failed for %1%") % node->script.name), -1);
}
if (var_inst->type == VAR_BOOL) {
bool res = checkBoolExpr(expr, mode);
@@ -488,7 +494,7 @@ void Mission::doSetVar(missionNode *node, int mode) {
deleteVarInst(ovi);
} else {
fatalError(node, mode, "unsupported datatype");
- assert(0);
+ VS_LOG_FLUSH_EXIT(fatal, "unsupported datatype", -1);
}
}
}
@@ -636,4 +642,3 @@ void Mission::saveVarInst(varInst *vi, std::ostream &aa_out) {
}
}
}
-
diff --git a/engine/src/galaxy_gen.cpp b/engine/src/galaxy_gen.cpp
index ae7c757511..899b42a4ec 100644
--- a/engine/src/galaxy_gen.cpp
+++ b/engine/src/galaxy_gen.cpp
@@ -1327,7 +1327,7 @@ void readplanetentity(vector &starinfos, string planetlist, unsigned i
if (starinfos[u % numstars].planets.back().num == 0) {
num[0] = 0;
} else {
- snprintf(num, sizeof(num), "%d", starinfos[u % numstars].planets.back().num);
+ snprintf(num, sizeof(num) - 1, "%d", starinfos[u % numstars].planets.back().num);
}
numpos = 0;
@@ -1517,4 +1517,3 @@ int main( int argc, char **argv )
return 0;
}
#endif
-
diff --git a/engine/src/gfx/vdu.cpp b/engine/src/gfx/vdu.cpp
index 6e15f3e5cd..1d41415917 100644
--- a/engine/src/gfx/vdu.cpp
+++ b/engine/src/gfx/vdu.cpp
@@ -1185,21 +1185,18 @@ void VDU::DrawDamage(Unit *parent) {
float x, y, w, h;
//float th;
//char st[1024];
- GFXColor4f(1, parent->GetHull() / (*maxhull), parent->GetHull() / (*maxhull), 1);
+ double health_percent = parent->layers[0].facets[0].Percent();
+ GFXColor4f(1, health_percent, health_percent, 1);
GFXEnable(TEXTURE0);
float armor[8];
parent->ArmorData(armor);
const bool draw_damage_sprite = configuration()->graphics_config.hud.draw_damage_sprite;
- DrawHUDSprite(this, draw_damage_sprite ? parent->getHudImage() : NULL, .6, x, y, w, h,
- (armor[0] + armor[2] + armor[4] + armor[6])
- / (float) (StartArmor[0] + StartArmor[2] + StartArmor[4] + StartArmor[6]),
- (armor[0] + armor[1] + armor[4] + armor[5])
- / (float) (StartArmor[0] + StartArmor[1] + StartArmor[4] + StartArmor[5]),
- (armor[2] + armor[3] + armor[6] + armor[7])
- / (float) (StartArmor[2] + StartArmor[3] + StartArmor[6] + StartArmor[7]),
- (armor[1] + armor[3] + armor[5]
- + armor[7]) / (float) (StartArmor[1] + StartArmor[3] + StartArmor[5] + StartArmor[7]),
- parent->GetHull() / (*maxhull), true, false);
+ DrawHUDSprite(this, draw_damage_sprite ? parent->getHudImage() : nullptr, .6, x, y, w, h,
+ parent->layers[1].facets[0].Percent(),
+ parent->layers[1].facets[3].Percent(),
+ parent->layers[1].facets[2].Percent(),
+ parent->layers[1].facets[1].Percent(),
+ health_percent, true, false);
GFXDisable(TEXTURE0);
//Unit *thr = parent->Threat();
parent->Threat();
diff --git a/engine/src/gldrv/gl_program.cpp b/engine/src/gldrv/gl_program.cpp
index 7b5027350c..b89dfdb397 100644
--- a/engine/src/gldrv/gl_program.cpp
+++ b/engine/src/gldrv/gl_program.cpp
@@ -156,7 +156,7 @@ static VSFileSystem::VSError getProgramSource(const std::string &path,
} else {
// Append a blank line to avoid issues and restore line numbers
lines.push_back("\n");
- snprintf(buf, buflen, "#line %zu\n", lineno);
+ snprintf(buf, buflen - 1, "#line %zu\n", lineno);
lines.push_back(buf);
}
} else {