Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Campaign Selector, enhanced support for campaign mods (and campaign balance mods) #3688

Merged
merged 51 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
07fe79c
Remove old setCampaignNumber(getCampaign()) code
past-due Feb 28, 2024
a752a80
Remove unused package / loading campaign file options
past-due Feb 28, 2024
a49d936
Store and save campaignName
past-due Feb 28, 2024
0612eee
Refactor campaign selector title UI
past-due Feb 28, 2024
347e6ff
Persist override_mods until stageOneShutDown()
past-due Mar 1, 2024
806bd49
gameLoadV7: Simplify, remove branch that shouldn't be triggered
past-due Mar 7, 2024
ef59b59
Add loadFileToBufferVectorT
past-due Mar 8, 2024
666a254
Add wzjsonhelpers
past-due Mar 8, 2024
f024f43
Split campaign info from mission.h/.cpp
past-due Mar 8, 2024
847bdb3
widget: Add methods to cliprect and scrollablelist
past-due Mar 8, 2024
d4121a2
widget: DropdownWidget: Improve overlay appearance and positioning
past-due Mar 8, 2024
b73d2a5
Add iV_DrawImageFileAnisotropicTint()
past-due Mar 9, 2024
0525243
Additional frontend images
past-due Mar 9, 2024
5ba6ec3
widget: Paragraph: Improve shadeColour position
past-due Mar 9, 2024
2ef7e2e
widget: Paragraph: Implement getScrollSnapOffsets()
past-due Mar 9, 2024
3a63488
modding: Additional methods
past-due Mar 9, 2024
0dfaf99
widget: DropdownWidget: Add clear() & getItem()
past-due Mar 11, 2024
a39d6ed
widget: DropdownWidget: Fix child sizing
past-due Mar 11, 2024
4497a2e
widget: Add new mouse drag handling to WIDGET
past-due Mar 13, 2024
2f44f03
widget: W_SLIDER: Use new widget framework mouse drag events
past-due Mar 13, 2024
2343e7c
W_NOTIFICATION: Use new widget framework mouse drag events
past-due Mar 13, 2024
1305728
W_NOTIFICATION: Remove old workaround
past-due Mar 13, 2024
b3ef5bd
RadarWidget: Use new widget framework mouse drag events
past-due Mar 13, 2024
ee260e0
widget: Paragraph: Add forceSetAllFontColor()
past-due Mar 13, 2024
62abe07
widget: Stricter clipping behavior in displayRecursive()
past-due Mar 13, 2024
e5f8de2
Save campaignName in replay options
past-due Mar 15, 2024
e3c7264
Update script global: "modList"
past-due Mar 16, 2024
24df3e0
widget: Add methods to scrollablelist
past-due Mar 16, 2024
4b968fd
widget: Adjust minimum scrollbar slider visible height
past-due Mar 16, 2024
33326cb
New Campaign Selector screen, support for new campaign mod packages
past-due Mar 16, 2024
237709c
Tweak palette.txt
past-due Mar 16, 2024
7f3c47e
Only require "campaigns" list for alternateCampaigns
past-due Mar 16, 2024
b7e67fa
Fix: Radar resizing soft-lock after away mission transition
past-due Mar 18, 2024
0d2e799
Add support for built-in campaign tweak options
KJeff01 Mar 16, 2024
f4a037f
Add Classic Balance campaign support
KJeff01 Mar 1, 2024
192a8ec
Allow campaign to reduce structure HP through research
KJeff01 Mar 17, 2024
6206968
Add 3.2 balance option to Classic Balance
KJeff01 Mar 18, 2024
de3a205
Improve research on the two classic balances
KJeff01 Mar 18, 2024
97c15fa
Add classic campaign balance mod files
past-due Mar 18, 2024
a6fb284
[CMake] Package classic campaign balance mod
past-due Mar 18, 2024
a3c76cc
Add support for "Autosaves-Only" tweak option
past-due Mar 18, 2024
c7343c5
Fix: Only reload level list if there are actually override mods
past-due Mar 19, 2024
2338871
Save tweakOptions in replay options
past-due Mar 19, 2024
0d43fc7
Additional validation for campaign mods
past-due Mar 19, 2024
ff40faa
Fix cam3-a.js classic
past-due Mar 19, 2024
0a714b2
Fix Classic template for Beta
KJeff01 Mar 19, 2024
3628188
Correct MRA/MRP damage on Beta 1 for Classic
KJeff01 Mar 19, 2024
39f3784
Move ClickableScrollableList to lib/widget
past-due Mar 20, 2024
ed43331
campaign.cpp: Minor tweaks
past-due Mar 20, 2024
d76fb33
[CMake] Package mods as .wz (zip) files for Emscripten builds
past-due Mar 21, 2024
0a20111
campaign.cpp: Ensure consistent tweak option status width
past-due Mar 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions COPYING.NONGPL
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,18 @@ data/base/components/prop/prhlwhl1.pie
- CC BY SA 3.0 - Copyright (c) 2008 <Mysteryem>
data/fonts/NotoSansCJK-VF.otf.ttc
- OFL 1.1 - Copyright (c) 2014-2021 Adobe (https://github.com/googlefonts/noto-cjk)
data/base/images/wz_original_campaign_banner.png
- CC BY SA 3.0 - Copyright (c) 2007-2008 "B. V. Edwards" <cathuria>
data/base/images/flags/flag-*.png
- MIT License, Copyright (c) 2016 Bowtie AB (https://github.com/madebybowtie/FlagKit)
data/base/images/frontend/image_cam_universe_stars.png
data/base/images/frontend/image_check_circle.png
data/base/images/frontend/image_question_circle.png
data/base/images/frontend/image_info_circle.png
data/base/images/frontend/image_check_square_fill.png
data/base/images/frontend/image_check_square_empty.png
data/base/images/frontend/image_arrow_undo.png
- MIT License - Copyright (c) 2019-2024 The Bootstrap Authors (https://github.com/twbs/icons/blob/main/LICENSE)
data/base/images/intfac/image_volume_mute.png
data/base/images/intfac/image_volume_up.png
data/base/images/notifications/connect_wait.png
Expand Down
30 changes: 30 additions & 0 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@ if(WZ_INCLUDE_VIDEOS)
endif()
endif()

add_subdirectory(mods mods_staging)

ADD_CUSTOM_TARGET(data ALL
DEPENDS data_base data_mp)
if(TARGET data_terrain_overrides_classic)
Expand Down Expand Up @@ -611,6 +613,23 @@ foreach(font_file ${wz2100_fonts_FILES})
)
endforeach()

# Copy mod files to build directory to support IDE build+run (from the build dir) scenarios
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/mods")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mods")
endif()
add_dependencies(data data_mods)
foreach(mod_file ${wz2100_mods_FILES})
file(RELATIVE_PATH _mods_file_relative_path "${CMAKE_CURRENT_BINARY_DIR}/mods_staging" "${mod_file}")
get_filename_component(_mods_file_subdir_path "${_mods_file_relative_path}" DIRECTORY)
get_filename_component(_mods_file_name "${_mods_file_relative_path}" NAME)
add_custom_command(
TARGET data
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${mod_file}" "${CMAKE_CURRENT_BINARY_DIR}/mods/${_mods_file_subdir_path}/${_mods_file_name}"
VERBATIM
)
endforeach()

set(DATA_FILES
"${CMAKE_CURRENT_BINARY_DIR}/base.wz"
"${CMAKE_CURRENT_BINARY_DIR}/mp.wz"
Expand Down Expand Up @@ -651,6 +670,15 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
)
endforeach()

foreach(_mod_file ${wz2100_mods_FILES})
file(RELATIVE_PATH _mods_file_relative_path "${CMAKE_CURRENT_BINARY_DIR}/mods_staging" "${_mod_file}")
get_filename_component(_mods_file_subdir_path "${_mods_file_relative_path}" DIRECTORY)
install(FILES ${_mod_file}
DESTINATION "${WZ_DATADIR}/mods/${_mods_file_subdir_path}"
COMPONENT Data
)
endforeach()

else()
# Emscripten:

Expand Down Expand Up @@ -703,3 +731,5 @@ set(DATA_TERRAIN_OVERRIDES_FILES ${DATA_TERRAIN_OVERRIDES_FILES} PARENT_SCOPE)
set(DATA_FONTS ${wz2100_fonts_FILES} PARENT_SCOPE)
set(DATA_MUSIC_FILES ${DATA_MUSIC_FILES} PARENT_SCOPE)
set(DATA_MUSIC_BASE_SOURCEDIR "${CMAKE_CURRENT_SOURCE_DIR}/music" PARENT_SCOPE)
set(DATA_MODS_FILES ${wz2100_mods_FILES} PARENT_SCOPE)
set(DATA_MODS_BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}/mods_staging" PARENT_SCOPE)
8 changes: 8 additions & 0 deletions data/base/images/frontend.img
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,11 @@
0,0,image_spectate.png
0,0,image_spectate_hi.png
0,0,image_spectate_sm.png
0,0,image_cam_universe_stars.png
0,0,image_check_circle.png
0,0,image_question_circle.png
0,0,image_ban_circle.png
0,0,image_info_circle.png
0,0,image_check_square_fill.png
0,0,image_check_square_empty.png
0,0,image_arrow_undo.png
Binary file added data/base/images/frontend/image_arrow_undo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/base/images/frontend/image_ban_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/base/images/frontend/image_check_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/base/images/frontend/image_info_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/base/images/wz_original_campaign_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion data/base/palette.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ ff,00,00,ff // demolish beam
98,98,98,ff // Don't know this player.
ff,ff,f0,ff // Seen this player before.
b0,b0,ff,ff // Server knows this player.
10,10,80,80 // Default filled GUI box colour
10,10,80,96 // Default filled GUI box colour
1b,ff,5f,ff // Info messages text color
10,10,80,bb // Default notification box colour
b0,8f,5f,ff // Arizona fog
Expand Down
102 changes: 74 additions & 28 deletions data/base/script/campaign/cam1-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const mis_scavengerRes = [
"R-Wpn-Flamer-Damage01", "R-Wpn-MG-Damage02", "R-Wpn-MG-ROF01",
];

// CLASSIC: No research.

//Ambush player from scav base - triggered from middle path
camAreaEvent("scavBaseTrigger", function()
{
Expand All @@ -29,6 +31,10 @@ camAreaEvent("ambush2Trigger", function()

camAreaEvent("factoryTrigger", function()
{
if (camClassicMode())
{
return; // No factory in original.
}
camEnableFactory("scavFactory1");
});

Expand Down Expand Up @@ -58,6 +64,10 @@ function eventPickup(feature, droid)

function eventAttacked(victim, attacker)
{
if (camClassicMode())
{
return;
}
if (victim.player === CAM_HUMAN_PLAYER)
{
return;
Expand All @@ -79,15 +89,35 @@ function checkFrontBunkers()
{
if (getObject("frontBunkerLeft") === null && getObject("frontBunkerRight") === null)
{
removeTimer("checkFrontBunkers");
const AMBUSH_GROUP = camMakeGroup(enumArea("eastScavsSouth", CAM_SCAV_7, false));
camManageGroup(AMBUSH_GROUP, CAM_ORDER_ATTACK, {
count: -1,
regroup: false
});
}
else
}

function blowupNonOriginalStructures()
{
const flameTower = getObject("originalFlamerTower");
const lookoutTower = getObject("originalLookoutTower");
if (flameTower === null || lookoutTower === null)
{
return;
}

const flameTowerID = flameTower.id;
const lookoutTowerID = lookoutTower.id;
const objects = enumArea(0, 0, mapWidth, mapHeight, ALL_PLAYERS, false);

for (let i = 0, len = objects.length; i < len; ++i)
{
queue("checkFrontBunkers", camSecondsToMilliseconds(5));
const obj = objects[i];
if (obj.type === STRUCTURE && obj.id !== flameTowerID && obj.id !== lookoutTowerID)
{
camSafeRemoveObject(obj, false);
}
}
}

Expand All @@ -110,38 +140,54 @@ function eventStartLevel()
startTransporterEntry(tEnt.x, tEnt.y, CAM_HUMAN_PLAYER);
setTransporterExit(tExt.x, tExt.y, CAM_HUMAN_PLAYER);

camCompleteRequiredResearch(mis_scavengerRes, CAM_SCAV_7);
if (difficulty >= HARD)
if (camClassicMode())
{
completeResearch("R-Wpn-Flamer-Range01", CAM_SCAV_7);
camSetArtifacts({
"artifactLocation": { tech: "R-Wpn-MG3Mk1" }, //Heavy machine gun
});
}
else
{
camCompleteRequiredResearch(mis_scavengerRes, CAM_SCAV_7);
if (difficulty >= HARD)
{
completeResearch("R-Wpn-Flamer-Range01", CAM_SCAV_7);
}

camUpgradeOnMapTemplates(cTempl.bloke, cTempl.blokeheavy, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.trike, cTempl.triketwin, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.buggy, cTempl.buggytwin, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.bjeep, cTempl.bjeeptwin, CAM_SCAV_7);

camSetArtifacts({
"scavFactory1": { tech: "R-Wpn-MG3Mk1" }, //Heavy machine gun
});

camUpgradeOnMapTemplates(cTempl.bloke, cTempl.blokeheavy, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.trike, cTempl.triketwin, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.buggy, cTempl.buggytwin, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.bjeep, cTempl.bjeeptwin, CAM_SCAV_7);

camSetArtifacts({
"scavFactory1": { tech: "R-Wpn-MG3Mk1" }, //Heavy machine gun
});

camSetFactories({
"scavFactory1": {
assembly: "Assembly",
order: CAM_ORDER_ATTACK,
data: {
regroup: false,
repair: 66,
count: -1,
camSetFactories({
"scavFactory1": {
assembly: "Assembly",
order: CAM_ORDER_ATTACK,
data: {
regroup: false,
repair: 66,
count: -1,
},
groupSize: 4,
throttle: camChangeOnDiff(camSecondsToMilliseconds((difficulty <= MEDIUM) ? 40 : 30)),
templates: [((difficulty <= MEDIUM) ? cTempl.triketwin : cTempl.trikeheavy), cTempl.blokeheavy, ((difficulty <= MEDIUM) ? cTempl.buggytwin : cTempl.buggyheavy), cTempl.bjeepheavy]
},
groupSize: 4,
throttle: camChangeOnDiff(camSecondsToMilliseconds((difficulty <= MEDIUM) ? 40 : 30)),
templates: [((difficulty <= MEDIUM) ? cTempl.triketwin : cTempl.trikeheavy), cTempl.blokeheavy, ((difficulty <= MEDIUM) ? cTempl.buggytwin : cTempl.buggyheavy), cTempl.bjeepheavy]
},
});
});
}

camPlayVideos({video: "FLIGHT", type: CAMP_MSG});
hackAddMessage("C1-1_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, false);

queue("checkFrontBunkers", camSecondsToMilliseconds(5));
if (!camClassicMode())
{
setTimer("checkFrontBunkers", camSecondsToMilliseconds(5));
}
else
{
queue("blowupNonOriginalStructures", camSecondsToMilliseconds(2));
}
}
4 changes: 2 additions & 2 deletions data/base/script/campaign/cam1-1s.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function checkForPowerModule()
if (cheat || powerModuleBuilt())
{
camSetupTransporter(mis_Labels.trPlace.x, mis_Labels.trPlace.y, mis_Labels.trExit.x, mis_Labels.trExit.y);
setMissionTime(camChangeOnDiff(camMinutesToSeconds(25))); // 25 min for offworld
setMissionTime((tweakOptions.classicTimers) ? camMinutesToSeconds(15) : camChangeOnDiff(camMinutesToSeconds(25))); // 25 min for offworld
secondVideo();

if (powModVideoPlayed)
Expand All @@ -64,7 +64,7 @@ function eventStartLevel()
{
centreView(mis_Labels.startPos.x, mis_Labels.startPos.y);
setNoGoArea(mis_Labels.lz.x, mis_Labels.lz.y, mis_Labels.lz.x2, mis_Labels.lz.y2, CAM_HUMAN_PLAYER);
setMissionTime(camChangeOnDiff(camMinutesToSeconds(10))); // 10 min for building module.
setMissionTime((tweakOptions.classicTimers) ? -1 : camChangeOnDiff(camMinutesToSeconds(10))); // 10 min for building module.
camSetStandardWinLossConditions(CAM_VICTORY_PRE_OFFWORLD, "SUB_1_1");
cheat = false;
powModVideoPlayed = false;
Expand Down
40 changes: 26 additions & 14 deletions data/base/script/campaign/cam1-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const mis_scavengerRes = [
"R-Defense-WallUpgrade01", "R-Struc-Materials01",
];

// CLASSIC: No research.

function exposeNorthBase()
{
camDetectEnemyBase("NorthGroup"); // no problem if already detected
Expand All @@ -31,7 +33,7 @@ function camArtifactPickup_ScavLab()
groupSize: 5,
maxSize: 9,
throttle: camChangeOnDiff(camSecondsToMilliseconds((difficulty <= MEDIUM) ? 13 : 10)),
templates: [ cTempl.trikeheavy, cTempl.blokeheavy, cTempl.buggyheavy, cTempl.bjeepheavy ]
templates: (!camClassicMode()) ? [ cTempl.trikeheavy, cTempl.blokeheavy, cTempl.buggyheavy, cTempl.bjeepheavy ] : [ cTempl.trike, cTempl.bloke, cTempl.buggy, cTempl.bjeep ]
});
camEnableFactory("WestFactory");
}
Expand Down Expand Up @@ -75,12 +77,27 @@ function eventStartLevel()
startTransporterEntry(tEnt.x, tEnt.y, CAM_HUMAN_PLAYER);
setTransporterExit(tExt.x, tExt.y, CAM_HUMAN_PLAYER);

camCompleteRequiredResearch(mis_scavengerRes, CAM_SCAV_7);

camUpgradeOnMapTemplates(cTempl.bloke, cTempl.blokeheavy, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.trike, cTempl.triketwin, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.buggy, cTempl.buggytwin, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.bjeep, cTempl.bjeeptwin, CAM_SCAV_7);
if (camClassicMode())
{
camSetArtifacts({
"ScavLab": { tech: "R-Wpn-Mortar01Lt" },
"NorthFactory": { tech: "R-Vehicle-Prop-Halftracks" },
});
}
else
{
camCompleteRequiredResearch(mis_scavengerRes, CAM_SCAV_7);

camUpgradeOnMapTemplates(cTempl.bloke, cTempl.blokeheavy, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.trike, cTempl.triketwin, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.buggy, cTempl.buggytwin, CAM_SCAV_7);
camUpgradeOnMapTemplates(cTempl.bjeep, cTempl.bjeeptwin, CAM_SCAV_7);

camSetArtifacts({
"ScavLab": { tech: "R-Wpn-Mortar01Lt" },
"NorthFactory": { tech: ["R-Vehicle-Prop-Halftracks", "R-Wpn-Cannon1Mk1"] },
});
}

camSetEnemyBases({
"NorthGroup": {
Expand All @@ -103,11 +120,6 @@ function eventStartLevel()

camDetectEnemyBase("ScavLabGroup");

camSetArtifacts({
"ScavLab": { tech: "R-Wpn-Mortar01Lt" },
"NorthFactory": { tech: ["R-Vehicle-Prop-Halftracks", "R-Wpn-Cannon1Mk1"] },
});

camSetFactories({
"NorthFactory": {
assembly: "NorthAssembly",
Expand All @@ -125,7 +137,7 @@ function eventStartLevel()
count: -1,
},
group: camMakeGroup("NorthTankGroup"),
templates: [ cTempl.trikeheavy, cTempl.blokeheavy, cTempl.buggyheavy, cTempl.bjeepheavy ]
templates: (!camClassicMode()) ? [ cTempl.trikeheavy, cTempl.blokeheavy, cTempl.buggyheavy, cTempl.bjeepheavy ] : [ cTempl.trike, cTempl.bloke, cTempl.buggy, cTempl.bjeep ]
},
"WestFactory": {
assembly: "WestAssembly",
Expand All @@ -143,7 +155,7 @@ function eventStartLevel()
count: -1,
},

templates: [ cTempl.trikeheavy, cTempl.blokeheavy, cTempl.buggyheavy, cTempl.bjeepheavy ]
templates: (!camClassicMode()) ? [ cTempl.trikeheavy, cTempl.blokeheavy, cTempl.buggyheavy, cTempl.bjeepheavy ] : [ cTempl.trike, cTempl.bloke, cTempl.buggy, cTempl.bjeep ]
},
});

Expand Down
Loading
Loading