Commit Graph
100 Commits
Author SHA1 Message Date
Asdow 58c134bd8e Combine search loops into one
Reduces code duplication and fixes an illegal memory access that was still present.
2025-11-19 13:57:18 +02:00
Asdow f902b01497 Fix ubID underflow
Fixes illegal memory access if we tried to find previous merc and our currently selected one has ubID == 0
2025-11-19 10:12:53 +02:00
Asdow 0bbb01ae87 Fix pTeamSoldier initialization 2025-11-18 17:39:27 +02:00
AsdowandGitHub 264105071a Load old ObjectData correctly (#553)
* Load old ObjectData correctly

ITS changed ObjectDataStructs::OBJECT_BOMBS_AND_OTHER::ubBombOwner data size from 1 byte to 2 bytes, and it was not taken into account when loading ObjectData
2025-11-11 20:14:46 +02:00
Asdow 584f6b47e6 Supply ProfileID to LUA scripts instead of SoldierID
Lua scripts expect to receive the same profileID value back from l_FindSolderByProfileID() that is supplied to it on the script side. This is a bit suboptimal as we constantly keep searching for the correct soldier on different calls to C++ side with the way it works now.
2025-10-11 11:43:37 +03:00
Asdow da83c6a557 Fix power gen fan sound
* Stop fan sound when switching sector
* Start fan sound when loading a save where current sector is power gen sector
2025-10-06 22:09:39 +03:00
Asdow 710941edd3 Dynamically adjust contract box position
Create contract renewal box right next to mouse position. Small QoL change to have the box closer.
2025-10-03 23:47:15 +03:00
Asdow 0b0fffa21d Improve multiselection contract renewal
* Contract duration lines are greyed out if the player lacks funds
*Selecting a mix of AIM and other merc types allows renewing contracts for selected AIM mercs
* Multiselection of only mercs whose contracts are not renewable (IMPs, rebels, etc) will have greyed out contract lines
2025-10-03 23:47:15 +03:00
Asdow e1acf181df Add FIXME 2025-09-29 11:58:55 +03:00
Asdow 0f8c14e72e Remove FindSoldierByProfileID_()
All the calls where this was used are functionally identical when we just supply UID to the original FindSoldierByProfileID() call with fPlayerMercsOnly set to FALSE
2025-09-29 11:58:55 +03:00
Asdow ecea18f57c Add FIXME to l_ActionInProgress 2025-09-29 11:58:55 +03:00
Asdow e63e936715 Clean up
* Removed superfluous for-if loops
* Wrapped function contents inside if(lua_gettop(L)) scopes similar to other, already fixed functions
* Harmonized whitespace
* Added FIXMEs to two unfinished functions
2025-09-29 11:58:55 +03:00
Asdow a15ed3aceb Fix l_SoldierGiveItem(lua_State* L)
Don't use SoldierID when matching for profile id
2025-09-29 11:58:55 +03:00
Asdow 0cb13650ed Fix whitespace formatting 2025-09-29 11:58:55 +03:00
Asdow 601ef4dc30 Remove duplicate includes 2025-09-29 11:58:55 +03:00
Asdow 8fa2189a66 Fix schedule compatibility between map versions 7 & 8 2025-09-28 10:35:13 +03:00
Asdow fb34eb6776 Use SoldierID for checks 2025-09-28 00:34:07 +03:00
Asdow 35984f57d0 Check for valid ubAttacker 2025-09-27 23:57:14 +03:00
Asdow 6c42f222e1 Fix PBI when enemy attacks starting sector in tactical view
When enemy attacks the starting sector and player is in tactical view. We go from tactical to strategic screen to show the prebattle interface instead of staying in tactical. The game errors on the sector assert when trying to draw the glowing red locator around the sector just before displaying the prebattle interface.

Normally the sector gets set properly when compressing time for the first time in a new game start but due to UB going into playing the intro video, it skips the call to HandleTimeCompressWithTeamJackedInAndGearedToGo() that would eventually set it. Neither can we rely on setting the sector when initiating the prebattle interface since MapScreenHandle() tries to display the locator before the PBI gets initialized.
2025-09-27 01:01:23 +03:00
Asdow 1f6e545a39 Make enemy battle sound respect speech volume setting 2025-09-25 23:26:29 +03:00
Asdow 2b9efd3702 Make helicopter sound respect sound effect volume setting
Helicopter sound would play upon heli insertion even if sound effects volume was set to 0 in options.
2025-09-25 22:55:33 +03:00
Asdow f5a7c32bff Use SoldierID instead of pSoldier
ContinueDialogue was possible to be called with pSoldier that isn't null but is not valid pointer to MercPtrs array resulting in debugger catching an illegal memory access.
2025-09-25 22:47:51 +03:00
Asdow d21b487884 Fix include filenames 2025-09-25 13:06:18 +03:00
Asdow a161dcc509 Fix selecting soldiers via right click in editor 2025-09-25 10:17:04 +03:00
Asdow f3b99edbff Fix Debug build 2025-09-24 19:21:58 +03:00
Asdow f47908e033 Fix debug mode defines
JA2BETAVERSION gets defined in cmake depending on selected config
2025-09-24 19:21:58 +03:00
AsdowandGitHub f52ab32952 Merge pull request #331 from 1dot13/ExtraMercs
Increased Team Sizes (ITS)
2025-09-24 17:07:51 +03:00
Asdow 82aca548f5 Merge branch 'master' into ExtraMercs 2025-09-24 16:14:10 +03:00
Asdow f3194718e4 Remove useless check for savegame version
ITS breaks save games.
2025-08-08 21:21:48 +03:00
Asdow fd9611ae04 Remove compiler warnings 2025-08-08 18:38:53 +03:00
Asdow c62d767622 Update to Master 2025-08-08 18:00:31 +03:00
Asdow b7bfd8a2eb Use FLAGS64 for flagmasks 2025-08-08 17:42:25 +03:00
Asdow c78f8faefc Whitespace changes 2025-08-08 17:41:51 +03:00
Asdow 63f614f957 Add FLAGS64 typedef 2025-08-08 17:41:40 +03:00
Asdow d078a3439f Fix squad movement popupbox for increased squads 2025-08-08 17:01:13 +03:00
Asdow 9b83d6a3bc Increase squad amount to 40 2025-08-08 16:39:52 +03:00
Asdow 56dc0088b6 Fix underflow in loop 2025-08-07 23:46:24 +03:00
Asdow c3a34a660d Check squads are on the same level 2025-08-07 22:02:49 +03:00
Asdow 1074e9c408 Fix save game compability for MERCPROFILESTRUCT 2025-08-07 21:34:54 +03:00
Asdow 872a356e82 Correct column size check 2025-07-23 15:11:03 +03:00
AsdowandGitHub 7bb7c54317 Guard against integer underflow (#462) 2025-07-20 17:30:22 -07:00
Asdow 49a56d01ac Load correct militia icons for 720p resolution 2025-07-08 20:21:54 +03:00
Asdow 9d1e9e8948 Fix line highlighting 2025-06-27 20:28:15 +03:00
Asdow b3b3270e1e Adjust constructors 2025-06-27 19:59:01 +03:00
Asdow 1a8db5d15b More conversions to SoldierID 2025-06-27 19:58:20 +03:00
Asdow 09ce332721 Allow 10 size squads for 720p resolution in UB 2025-06-27 16:00:10 +03:00
Asdow 5e2c61ef12 Externalized UB bloodcat quest sector 2025-06-25 22:54:53 +03:00
Asdow 4d948fda06 Fix powergen fan stopping in UB
Sector Y & Z coordinates were mixed up in code, which would then always fail the check for correct sector.
2025-06-24 22:54:44 +03:00
Asdow 2ae110971b spelling fixes 2025-06-24 22:54:44 +03:00
Asdow 9a78e7dfa0 Formatting changes 2025-06-24 22:54:44 +03:00
Asdow d95bae2bf6 Re-enable power generator fan sound effect for UB 2025-06-24 22:54:44 +03:00
Asdow a1bb85ca95 Externalize fan exitgrid location in the source sector 2025-06-24 22:54:44 +03:00
Asdow d9391de58a Fix laptop crush popup text
Due to additional dialogue flag having the value 8, and UB not having a specific flag for mercs standing up after heli crash, the FindSoldierByProfileID would always find Steroid if he was on the team, and then display the crunched laptop popup text.

Adding a new flag that is checked before we go into that branch in HandleDialogue fixes the issue.
2025-06-22 12:43:33 +03:00
Asdow c02bbc90cb Fix helicopter for UB
No need to force an assert error here. We can simply ignore the meanwhile scene just like all the others.
2025-06-18 22:58:17 +03:00
Asdow efb54202ea Fix Mercprofile usStrategicInsertionData for bigmaps
NPCs would not appear in the map if their gridno was over 65535 in large maps
2025-06-15 14:42:34 +03:00
Asdow e2f296c42c Remove #pragma optimize("", off)
Managed to slip in in commit f21cb38. Bad Asdow, bad!
2025-05-01 10:39:19 +03:00
Asdow ee2807ae64 Default to 1st kit if deciding not to buy gear in UB
1st one is included in the hiring fee
2025-04-26 00:37:38 +03:00
Asdow b23c9ac8b1 Do not prompt for buying inventory for 1st kit in UB 2025-04-26 00:37:38 +03:00
Asdow fa0c5a2862 Prevent hiring MERC in UB if not enough funds 2025-04-26 00:37:38 +03:00
Asdow db6da100e1 Reset selected gear kit when browsing mercs 2025-04-26 00:37:38 +03:00
Asdow a3e7ce5794 Display special offer for 1st M.E.R.C. inv kit in UB
* Use weekly instead of daily salary for total cost calculation
2025-04-26 00:37:38 +03:00
Asdow 5062ae74f2 Display correct salary info for MERCs in UB campaign 2025-04-26 00:37:38 +03:00
Asdow dd58f904f4 Do not offer surrender for multiplayer 2025-04-24 21:52:11 +03:00
Asdow 8dcb431ef2 Use (0,0) sector coordinates as unused cache
Makes the comment in Mod_Settings.ini valid advice
2025-04-17 23:51:44 +03:00
Asdow 5f45d06852 Fix possible integer overflow 2025-04-16 20:10:11 +03:00
Asdow 92103e36a6 Fix formatting 2025-04-16 01:28:07 +03:00
Asdow 8f98a9b985 Move UpdateAirspaceControl() out of #ifdef
Fixes UB not updating samsite airspace correctly after battle
2025-04-16 01:28:07 +03:00
Asdow c2e78d0461 Use correct macro to index StrategicMap 2025-04-16 01:28:07 +03:00
Asdow 36a84ffe59 Remove pSecondColumnString
* Use the new columns added to Text instead
* Changed most functions to allow choosing a column
* Removed unneeded SecondColumn specific functions to lessen code duplication
* Lots of formatting changes to Popupbox.cpp, indentation was messed up in majority of the functions
2025-04-13 22:26:32 +03:00
Asdow 865288e622 Implement multicolumn popupbox
Mainly aimed for strategic movement popup box to accommodate increased team sizes
2025-04-13 19:11:45 +03:00
AsdowandGitHub 3e45217a9a Add compilationFlags to {exe} (#428)
* Add compilationFlags to {exe}

sgp.cpp is not recognizing JA2EDITOR preprocessor definition otherwise and therefore does not read EDITOR_SCREEN_RESOLUTION when starting map editor

* Add debugFlags too
2025-04-12 17:48:12 -03:00
Asdow da3c3bace8 Use mouse position for squad movement popup box initial location 2025-04-09 23:11:11 +03:00
Asdow ec4dc8b058 Provide gMapViewRegion through mapscreen.h 2025-04-09 23:10:32 +03:00
Asdow 07320ba996 Limit TeamList mouseregions to correct amount 2025-04-09 21:33:28 +03:00
Asdow f21cb38647 Increase TileNo to UINT32
Bigmap grid number values go over uint16 max
2025-04-05 16:20:37 +03:00
Asdow 4823ef4929 Add check for vest position attachments 2025-03-06 17:39:35 +02:00
Asdow 586a46bb78 Remove last reference to gbPixelDepth 2025-02-24 23:08:52 +02:00
Asdow fffb3a45fb Remove 8bit mode
Obsolete and doesn't work

* Remove gbPixelDepth
* Remove 8-bit to 8-bit blitters
* FileNameForBPP now only calls strcopy
2025-02-24 21:42:36 +02:00
Asdow 9c951adfea Read correct variable from CTHconstants.ini 2025-02-24 16:11:58 +02:00
Asdow e3a542bf5d Exclude robots from trying to activate panic triggers 2025-02-14 16:47:03 +02:00
Asdow 222daead0e Remove unused ItemFlags
Detonator and Remote Detonator are specified by AttachmentClass
No items in items.xml actually even contained these flags.
2025-01-27 18:30:11 +02:00
Asdow dcf202990f Remove duplicate header includes 2025-01-05 17:08:02 +02:00
Asdow db40cd433e Move mapscreen bottom coordinates' initialization
Fixes radar map's initial  position in strategic screen being in the top right corner.
2025-01-05 17:08:02 +02:00
Asdow 3cfde817ba Set table mouse_region priorities lower than bookmark bar 2024-12-30 21:21:30 +02:00
Asdow 4ed7b1fb98 Increase selection window size 2024-12-25 22:03:03 +02:00
Asdow 5499d1fba2 Whitespace formatting 2024-12-25 22:03:03 +02:00
Asdow 22af6e8ec8 Implement mousewheel scroll for selection window 2024-12-25 22:03:03 +02:00
Asdow a9ab60e5e5 Fix road tiles for big maps 2024-12-25 17:35:11 +02:00
Asdow c30b1c1b25 Reimplement UB pricing for AIM 2024-12-24 22:48:41 +02:00
Asdow 5b966b4df9 Provide MAX_TACTICAL_ENEMIES to lua 2024-12-24 00:16:09 +02:00
Asdow eb7837bc3e Increase filename buffer length
The mapeditor filedialog is big enough to show longer filenames than 20 characters.
2024-12-23 20:45:48 +02:00
Asdow c88fbbe749 Fix assertion error due to too long filenames 2024-12-23 20:45:48 +02:00
Asdow a580052e40 Read new tags
Maybe *this* time it'll finally be fixed. Sigh...
2024-12-23 19:26:37 +02:00
Asdow 7fa8ff930b Remove unused tag
PercentCounterForceFrequency is never read from items.xml and INVTYPE doesn't have a field for it either
2024-12-22 00:08:45 +02:00
Asdow c7d021f5f3 Read updated items.xml format
Requires accompanying GameDir change.

Removed ItemFlag as an xml tag and added  bitmask flags as their own individual tags. Makes modding easier when the flags can be modified without math in the xml files
2024-12-22 00:08:45 +02:00
AsdowandGitHub dcde413b7b Initialize AI morale to normal instead of hopeless (#345) 2024-12-05 23:05:50 +02:00
Asdow febb283c3a Allow bloodcats in RED state to roam farther
Bloodcat lair had a few cats with CLOSE PATROL orders, resulting them to move only 15 tiles from their starting point, allowing them to be picked off from afar with scoped rifles.
2024-12-05 22:56:57 +02:00
Asdow 678ef822ca Fix passive bloodcats 2024-12-05 22:56:57 +02:00
AsdowandGitHub 1eff9f6aaa Fix bloodcat ambush endless loop (#343)
Some bloodcats during ambushes could have ubInsertionDirection with values > 100, which then causes endless looping in pathfinding algorithms as valid direction values range from 0 to 7
2024-12-05 16:13:09 +02:00
Asdow 20a33893d9 Fix Teamlist for smaller resolutions
Merc names were being printed past the end of teamlist area
2024-12-04 20:49:53 +02:00