Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feat-map-search
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich committed Jun 4, 2024
2 parents 92aed17 + 62bb60a commit 218df54
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 29 deletions.
2 changes: 0 additions & 2 deletions data/base/stats/weapons.json
Original file line number Diff line number Diff line change
Expand Up @@ -2957,8 +2957,6 @@
"lightWorld": 1,
"longHit": 80,
"longRange": 12032,
"maxElevation": 90,
"minElevation": -30,
"minRange": 512,
"minimumDamage": 33,
"missGfx": "FXMExp.PIE",
Expand Down
2 changes: 0 additions & 2 deletions data/mods/campaign/wz2100_camclassic/stats/weapons.json
Original file line number Diff line number Diff line change
Expand Up @@ -2289,8 +2289,6 @@
"lightWorld": 1,
"longHit": 80,
"longRange": 12000,
"maxElevation": 90,
"minElevation": -30,
"minRange": 512,
"minimumDamage": 33,
"missGfx": "FXMExp.PIE",
Expand Down
4 changes: 2 additions & 2 deletions data/mp/multiplay/script/rules/events/gameinit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function eventGameInit()
setupGame();

//From script/rules/printsettings.js
printGameSettings();
queue("printGameSettings", TICK_TIME);

//From script/rules/oildrum.js
oilDrumInit();
Expand Down Expand Up @@ -49,7 +49,7 @@ function eventGameInit()

//Structures might have been removed so we need to update the reticule button states again
//From script/rules/reticule.js
setMainReticule();
queue("setMainReticule", TICK_TIME);

if (tilesetType === "URBAN" || tilesetType === "ROCKIES")
{
Expand Down
6 changes: 3 additions & 3 deletions data/mp/multiplay/script/rules/includes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include("multiplay/script/rules/variables.js");
// This file contain functions which contains the logic of technology research equated to time
include("multiplay/script/functions/camTechEnabler.js");

// Spectial effects of weather.
// Special effects of weather.
include("multiplay/script/functions/weather.js");

/* *** SETUP *** */
Expand Down Expand Up @@ -35,7 +35,7 @@ include("multiplay/script/rules/reticule.js");
// Logic and rules of "End conditions" of the match.
include("multiplay/script/rules/endconditions.js");

// Logic of places oil barrels on the battlefield
// Logic of placing oil barrels on the battlefield
include("multiplay/script/rules/oildrum.js");

/* *** EVENTS *** */
Expand All @@ -55,5 +55,5 @@ include("multiplay/script/rules/events/chat.js");

/* *** MODS *** */
//All mods, as well as modpacks, must start in this file.
//At the moment, it's an empty stub doll.
//At the moment, it's an empty stub.
include("multiplay/script/mods/init.js");
1 change: 0 additions & 1 deletion data/mp/multiplay/script/rules/reticule.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ function reticuleUpdate(obj, eventType)
if (mainReticule && update_reticule)
{
//Wait a tick for the counts to update
const TICK_TIME = 100;
queue("setMainReticule", TICK_TIME);
}
}
3 changes: 1 addition & 2 deletions data/mp/multiplay/script/rules/setup/components.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
function setupComponents(player) // inside hackNetOff()
{
// enable cyborgs components that can't be enabled with research
makeComponentAvailable("CyborgSpade", player);
// Use makeComponentAvailable() here to enable components at the start of a match.
}
2 changes: 1 addition & 1 deletion data/mp/multiplay/script/rules/setupgame.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ function setupGame()
setDesign(true);

showInterface(); // init buttons. This MUST come before setting the reticule button data
setMainReticule();
queue("setMainReticule", TICK_TIME);
mainReticule = true;
}
2 changes: 2 additions & 0 deletions data/mp/multiplay/script/rules/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var oilDrumData = {
maxOilDrums: 0 // maximum amount of random oil drums allowed on the map
};

const TICK_TIME = 100;

const CREATE_LIKE_EVENT = 0;
const DESTROY_LIKE_EVENT = 1;
const TRANSFER_LIKE_EVENT = 2;
Expand Down
6 changes: 2 additions & 4 deletions data/mp/stats/research.json
Original file line number Diff line number Diff line change
Expand Up @@ -3129,9 +3129,6 @@
"name": "Engineering",
"researchPoints": 1200,
"researchPower": 37,
"resultComponents": [
"CyborgSpade"
],
"results": [
{
"class": "Construct",
Expand Down Expand Up @@ -3426,7 +3423,8 @@
"name": "Construction Unit",
"researchPoints": 10,
"resultComponents": [
"Spade1Mk1"
"Spade1Mk1",
"CyborgSpade"
],
"statID": "Spade1Mk1",
"techCode": 1
Expand Down
4 changes: 0 additions & 4 deletions data/mp/stats/weapons.json
Original file line number Diff line number Diff line change
Expand Up @@ -3183,8 +3183,6 @@
"lightWorld": 1,
"longHit": 65,
"longRange": 1920,
"maxElevation": 90,
"minElevation": -30,
"minRange": 256,
"minimumDamage": 33,
"missGfx": "FXMExp.PIE",
Expand Down Expand Up @@ -4100,8 +4098,6 @@
"lightWorld": 1,
"longHit": 55,
"longRange": 1280,
"maxElevation": 90,
"minElevation": -60,
"minRange": 128,
"minimumDamage": 33,
"missGfx": "FXMNExp.PIE",
Expand Down
1 change: 1 addition & 0 deletions doc/js-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ In addition, the following properties are defined:
* ```status``` The completeness status of the structure. It will be one of ```BEING_BUILT``` and ```BUILT```.
* ```type``` The type will always be ```STRUCTURE```.
* ```cost``` What it would cost to build this structure. (3.2+ only)
* ```direction``` The direction the structure is facing. (4.5+ only)
* ```stattype``` The stattype defines the type of structure. It will be one of ```HQ```, ```FACTORY```, ```POWER_GEN```,
```RESOURCE_EXTRACTOR```, ```LASSAT```, ```DEFENSE```, ```WALL```, ```RESEARCH_LAB```, ```REPAIR_FACILITY```,
```CYBORG_FACTORY```, ```VTOL_FACTORY```, ```REARM_PAD```, ```SAT_UPLINK```, ```GATE``` and ```COMMAND_CONTROL```.
Expand Down
8 changes: 4 additions & 4 deletions lib/wzmaplib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

set(WZMAPLIB_VERSION_MAJOR 1)
set(WZMAPLIB_VERSION_MINOR 2)
set(WZMAPLIB_VERSION_REV 4)
set(WZMAPLIB_VERSION_REV 5)

###################
# Determine minimum CMake version
Expand All @@ -22,7 +22,7 @@ endif()
##############################
# wzmaplib project

cmake_minimum_required(VERSION ${_cmake_min_ver_supported}...3.18)
cmake_minimum_required(VERSION ${_cmake_min_ver_supported}...3.24)
project (wzmaplib CXX)

if(${CMAKE_VERSION} VERSION_LESS 3.12)
Expand Down Expand Up @@ -78,7 +78,7 @@ if(NOT TARGET nlohmann_json)
FetchContent_Declare(
nlohmannjson
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.11.2
GIT_TAG v3.11.3
GIT_SHALLOW TRUE
)
FetchContent_GetProperties(nlohmannjson)
Expand All @@ -97,7 +97,7 @@ if(NOT TARGET optional-lite)
FetchContent_Declare(
optionallite
GIT_REPOSITORY https://github.com/martinmoene/optional-lite.git
GIT_TAG v3.5.0
GIT_TAG v3.6.0
GIT_SHALLOW TRUE
)
FetchContent_GetProperties(optionallite)
Expand Down
4 changes: 3 additions & 1 deletion lib/wzmaplib/src/map_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,8 @@ bool MapPackage::exportMapPackageFiles(std::string basePath, LevelFormat levelFo
}

// 5.) Output the level info file
LevelDetails outputLevelDetails = m_levelDetails;
outputLevelDetails.mapFolderPath = mapFolderPath;
std::string fullPathToOutputLevelDetailsFolder = exportIO->pathJoin(basePath, levelFileOutputFolder);
if (!fullPathToOutputLevelDetailsFolder.empty())
{
Expand All @@ -1457,7 +1459,7 @@ bool MapPackage::exportMapPackageFiles(std::string basePath, LevelFormat levelFo
// for now, treat this as non-fatal...
}
}
if (!exportLevelDetails(m_levelDetails, levelFormat, fullPathToOutputLevelDetailsFolder, *exportIO, pCustomLogger))
if (!exportLevelDetails(outputLevelDetails, levelFormat, fullPathToOutputLevelDetailsFolder, *exportIO, pCustomLogger))
{
debug(pCustomLogger, LOG_ERROR, "Failed to export level details");
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/multimenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void addMultiRequest(const char *searchDir, const char *fileExtension, UDWORD mo
searchBox->setString(WzString::fromUtf8(current_searchString));

searchBox->setOnEditingStoppedHandler([searchDir, fileExtension, mode, numPlayers](W_EDITBOX& widg) {
const std::string &value = widg.getString().toUtf8();
std::string value = widg.getString().toUtf8();
if (value == current_searchString) {
return;
}
Expand Down
5 changes: 3 additions & 2 deletions src/projectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,15 +551,16 @@ static PROJECTILE* proj_SendProjectileAngledInternal(WEAPON* psWeap, SIMPLE_OBJE
proj.state = PROJ_INFLIGHT;

// If droid or structure, set muzzle pitch.
// Don't allow pitching the muzzle above outside the weapon's limits.
if (psAttacker != nullptr && weapon_slot >= 0)
{
if (psAttacker->type == OBJ_DROID)
{
((DROID *)psAttacker)->asWeaps[weapon_slot].rot.pitch = proj.rot.pitch;
((DROID *)psAttacker)->asWeaps[weapon_slot].rot.pitch = (uint16_t)clip(angleDelta(proj.rot.pitch), (int32_t)DEG(psStats->minElevation), (int32_t)DEG(psStats->maxElevation));
}
else if (psAttacker->type == OBJ_STRUCTURE)
{
((STRUCTURE *)psAttacker)->asWeaps[weapon_slot].rot.pitch = proj.rot.pitch;
((STRUCTURE *)psAttacker)->asWeaps[weapon_slot].rot.pitch = (uint16_t)clip(angleDelta(proj.rot.pitch), (int32_t)DEG(psStats->minElevation), (int32_t)DEG(psStats->maxElevation));
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/quickjs_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ JSValue convResearch(const RESEARCH *psResearch, JSContext *ctx, int player)
//;; * ```status``` The completeness status of the structure. It will be one of ```BEING_BUILT``` and ```BUILT```.
//;; * ```type``` The type will always be ```STRUCTURE```.
//;; * ```cost``` What it would cost to build this structure. (3.2+ only)
//;; * ```direction``` The direction the structure is facing. (4.5+ only)
//;; * ```stattype``` The stattype defines the type of structure. It will be one of ```HQ```, ```FACTORY```, ```POWER_GEN```,
//;; ```RESOURCE_EXTRACTOR```, ```LASSAT```, ```DEFENSE```, ```WALL```, ```RESEARCH_LAB```, ```REPAIR_FACILITY```,
//;; ```CYBORG_FACTORY```, ```VTOL_FACTORY```, ```REARM_PAD```, ```SAT_UPLINK```, ```GATE```, ```STRUCT_GENERIC```, and ```COMMAND_CONTROL```.
Expand Down Expand Up @@ -835,6 +836,7 @@ JSValue convStructure(const STRUCTURE *psStruct, JSContext *ctx)
QuickJS_DefinePropertyValue(ctx, value, "status", JS_NewInt32(ctx, (int)psStruct->status), JS_PROP_ENUMERABLE);
QuickJS_DefinePropertyValue(ctx, value, "health", JS_NewInt32(ctx, 100 * psStruct->body / MAX(1, psStruct->structureBody())), JS_PROP_ENUMERABLE);
QuickJS_DefinePropertyValue(ctx, value, "cost", JS_NewInt32(ctx, psStruct->pStructureType->powerToBuild), JS_PROP_ENUMERABLE);
QuickJS_DefinePropertyValue(ctx, value, "direction", JS_NewInt32(ctx, UNDEG(psStruct->rot.direction)), JS_PROP_ENUMERABLE);

Check warning on line 839 in src/quickjs_backend.cpp

View workflow job for this annotation

GitHub Actions / Arch :LATEST [GCC]

conversion from ‘float’ to ‘int32_t’ {aka ‘int’} may change value [-Wfloat-conversion]

Check warning on line 839 in src/quickjs_backend.cpp

View workflow job for this annotation

GitHub Actions / Arch :LATEST [Clang]

implicit conversion turns floating-point number into integer: 'float' to 'int32_t' (aka 'int') [-Wfloat-conversion]

Check warning on line 839 in src/quickjs_backend.cpp

View workflow job for this annotation

GitHub Actions / Fedora :LATEST [GCC]

conversion from 'float' to 'int32_t' {aka 'int'} may change value [-Wfloat-conversion]

Check warning on line 839 in src/quickjs_backend.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 20.04 [Clang]

implicit conversion turns floating-point number into integer: 'float' to 'int32_t' (aka 'int') [-Wfloat-conversion]

Check warning on line 839 in src/quickjs_backend.cpp

View workflow job for this annotation

GitHub Actions / Fedora :LATEST [GCC -m32]

conversion from 'float' to 'int32_t' {aka 'int'} may change value [-Wfloat-conversion]

Check warning on line 839 in src/quickjs_backend.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 22.04 [Clang]

implicit conversion turns floating-point number into integer: 'float' to 'int32_t' (aka 'int') [-Wfloat-conversion]
int stattype = 0;
switch (psStruct->pStructureType->type) // don't bleed our source insanities into the scripting world
{
Expand Down

0 comments on commit 218df54

Please sign in to comment.