Commit Graph
100 Commits
Author SHA1 Message Date
AsdowandGitHub 4338b5b909 Fix AI tactical retreat (#282)
Only perform tactical traversal if pSoldier is at the map edge
2024-02-11 12:42:21 +02:00
AsdowandGitHub ef69f9b2e6 Allow enemy to retreat (#279)
This check was preventing enemies from retreating into another sector if tactical AI retreat was enabled, leading into AI deadlock every time AI_ACTION_RUNAWAY was the decision.
2024-02-11 00:27:14 +02:00
AsdowandGitHub 28a4db0355 Guard against nullptr dereference (#278)
Encountered a situation where a pSoldier between bFirstID and bLastID was null and then we'd dereference it.
2024-02-10 17:18:19 +02:00
AsdowandGitHub d296789929 LOBOT: enemies wear pistol holsters (by Seven) (#271) 2024-01-30 22:53:19 +02:00
AsdowandGitHub 0910dba472 Revert "Disable AI logging by default" (#270)
This reverts commit 5a74323d1f.
2024-01-30 11:44:00 +02:00
AsdowandGitHub bb63cb9aa3 Merge pull request #268 from 1dot13/custom-music
Allow custom music to be added
2024-01-29 21:50:08 +02:00
Asdow a80fea00e2 Rename 2nd original battle music
If "Battle B" music file is found, use it instead of tensor B for the second original battle music. Allows us to replace either the enemy present or battle version of the same track instead of always both when "tensor B" is replaced.
2024-01-29 21:39:13 +02:00
Asdow e93dc3fb6d Allow separate enemy present & battle music for nighttime
Defaults to regular enemypresent and battle music if no nighttime music tracks are found
2024-01-29 21:37:05 +02:00
Asdow 51c3967c42 Smarter string formatting
Accept filenames with two digit running number
2024-01-29 21:37:05 +02:00
Asdow 2697a17010 Check if pSoldier is null
Prevent nullptr dereference in AI logging function
2024-01-28 11:16:41 +02:00
Asdow 5a74323d1f Disable AI logging by default
We only want this on when specifically debugging/working on AI.
2024-01-28 11:16:41 +02:00
Asdow 7546a23d0d Allow custom music to be added
Additional music can be added by placing sound files into Dataa/Music folder following this naming convention

musicmode_runningNumber.fileformat, so for example:

Mainmenu_001.mp3
Mainmenu_002.ogg
Laptop_002.ogg
Tactical_003.wav

*****************************************************************
Different musicmodes are

Mainmenu_ 		<-- Mainmenu music
Laptop_ 		<-- Laptop music
Tactical_		<-- Tactical with nothing special going on
Enemy_			<-- Tactical, enemy present
Battle_			<-- Tactical, enemy present and visible
Victory_		<-- Tactical, battle victory
Death_			<-- Tactical, battle defeat
Creepy_			<-- Tactical, creatures present
CreepyBattle_	<-- Tactical, creatures present and visible

Music files can be .mp3, .ogg or .wav formats and 100 songs in each category is supported.
The running numbering starts from 000

*****************************************************************
A few filenames are treated in a special way to facilitate easy replacement of original music.
To replace original music, insert the following named files into this folder

"menumix1"			<-- Mainmenu music
"marimbad 2"		<-- Laptop music
"nothing A"			<-- Tactical with nothing special going on
"nothing B"
"nothing C"
"nothing D"
"tensor A"			<-- Tactical, enemy present
"tensor B"
"tensor C"
"triumph"
"death"
"battle A"			<-- Tactical, enemy present and visible
"tensor B"			<-- This file is also used as battle music
"creepy"			<-- Tactical, creatures present
"creature battle"	<-- Tactical, creatures present and visible
2024-01-27 14:29:51 +02:00
AsdowandGitHub c7bd75b60d Merc arrival location fix (#263)
* User center insertion point for merc arrival

instead of initial arrival gridno that is meant only for the very first helidrop arrival at the start of a game.

* Prevent possible nullptr dereference
2024-01-24 00:35:39 +02:00
AsdowandGitHub 57bf3d9fa7 Call RemovePlayerFromGroup instead of RemoveGroup (#260)
There was a bug in a provided save where a merc's group had persistent flag set, even though the assignment was DRILL_MILITIA, which should never have a persistent group. When the code was calling RemoveGroup instead of RemovePlayerFromGroup at this point, it would crash the game with an assertion error in CancelEmptyPersistentGroupMovement() as the group in fact was not empty! Now we're removing the merc first and then checking if the group is empty and if so, attempt to delete it.
2024-01-03 00:39:44 +02:00
AsdowandGitHub 62dd0914fc Allocate one INT8 for ZStripInfo pbZChange (#256)
Fixes assertion errors in DEBUG build when LOBOT is enabled.
2023-12-24 17:29:01 +02:00
AsdowandGitHub 3d5294003a Copy drag info to dummy soldier (#255)
Fixes merc location shifted by one tile during loading a save when A* pathfinding is enabled
2023-12-24 13:48:21 +02:00
AsdowandGitHub f88b07b99b Fix loading item temp files (#245)
Call PruneWorldItems() before sectorinfo gets written to the save file.
Resetting the SF_ITEM_TEMP_FILE_EXISTS  would not transfer correctly into the save file.
2023-10-22 14:52:21 +03:00
Asdow 3f7b35c1a1 Delete JA2Prototypes.h 2023-10-21 15:38:31 +03:00
Asdow 153eb5fb10 Delete JA2 Demo Ads.h 2023-10-21 15:38:31 +03:00
Asdow f5f3bb94de Remove Install & RegInst .cpp and .h
Unused
2023-10-21 15:38:31 +03:00
Asdow 58a682db89 Remove flic.cpp & h
Not used anywhere and even inside the .cpp functions such as FlicPlay() had everything commented out and replaced with "return 1"
2023-10-21 15:38:31 +03:00
Asdow 2849590ef2 Remove readdir.cpp & h
Unused
2023-10-21 15:38:31 +03:00
Asdow 5b635784cd Remove FileCat.cpp & .h
Not used anywhere in the code.
Moved ChompSlash from FileCat.cpp to image.cpp, as the only two references besides ones in filecat.cpp for the function were in there. The references are inside an #ifdef 0 block so they are not compiled currently, but this should prevent them from not working IF we ever enable them
2023-10-21 15:38:31 +03:00
Asdow d43a597423 Remove commented out ifdefs 2023-10-21 15:38:31 +03:00
Asdow 5a7ef1930f Remove unused defines 2023-10-21 15:38:31 +03:00
Asdow 1483f15832 Remove unused globals 2023-10-21 15:38:31 +03:00
Asdow db0787b5a3 Remove unused functions
GetFreeSpaceOnHardDriveWhereGameIsRunningFrom()
GetFreeSpaceOnHardDrive()
FileReadLine() <- non VFS version
DoesUserHaveEnoughHardDriveSpace()
2023-10-21 15:38:31 +03:00
Asdow b7f974f41b Remove unused AddSubdirectoryToPath() & FileIsOlderThanFile() 2023-10-21 15:38:31 +03:00
Asdow c07f3f460b Remove unused autosave and filetime functions 2023-10-21 15:38:31 +03:00
Asdow eff1ccfe63 Remove unused functions
FileDebug()
DirectoryExists()
FileCopy()
FileMove()
2023-10-21 15:38:31 +03:00
Asdow 62b8d272e6 Remove GetHandleToRealFile() 2023-10-21 15:38:31 +03:00
Asdow 6c0b62cb42 Remove W32toSGPFileFind() 2023-10-21 15:38:31 +03:00
Asdow 02f733ce2f Remove CreateFileHandle() & DestroyFileHandle() 2023-10-21 15:38:31 +03:00
AsdowandGitHub 8f454e2aab Container.cpp & .h delete (#242)
* Remove GetFilesInDirectory()
* Remove BuildFileDirectory
* Remove container.cpp & .h

Not used in the code
2023-10-20 21:30:39 +03:00
AsdowandGitHub a47ed9ed55 Correct for loop end condition (#241) 2023-10-19 19:08:39 +03:00
AsdowandGitHub 5ec08231a3 Match new with delete (#238)
Only applicable if we actually fail to create a vsurface
2023-10-10 23:37:11 +03:00
AsdowandGitHub 7483829c65 Merge pull request #236 from 1dot13/container
Remove use of Container.cpp in vsurface, dialogue and event systems
2023-10-10 23:02:49 +03:00
Asdow d6a3a27b58 Address review feedback
* Dialogue control.cpp
* vsurface.cpp
* Event pump.cpp
2023-10-10 19:53:19 +03:00
Asdow f00214d00d Use std::queue and std::vector in event system
instead of old custom code from container.cpp

* Removed initialize and shutdown event manager calls from Init.cpp as they were only used to create and destroy the old HLIST globals

* Moved code from Event Manager.cpp to Event Pump.cpp as the event queue system is only used in said file.

* Removed now useless event manager.cpp and .h files
2023-10-09 23:07:54 +03:00
Asdow 029af63eb8 Remove unused global 2023-10-09 23:01:49 +03:00
Asdow d3b4874af0 Remove unused global 2023-10-09 23:01:49 +03:00
Asdow 8525d3f869 Use std::vector for HVSURFACE->RegionList
Replaces the use of old custom list implementation in container.cpp
2023-10-09 23:01:33 +03:00
AsdowandGitHub 48722f26d6 Merge pull request #237 from 1dot13/remove-novfs-ifdefs
Remove ifdefs related to USE_VFS
2023-10-08 18:53:35 +03:00
Asdow 5a922e3a42 Remove useless function 2023-10-08 16:48:18 +03:00
Asdow f11534e792 Remove orphan function declaration 2023-10-08 16:47:38 +03:00
Asdow f5e0d0bbd8 Remove useless function 2023-10-08 16:47:13 +03:00
Asdow 74a25a2069 Remove empty function 2023-10-08 16:46:36 +03:00
Asdow 0b5f14a3ad Remove empty function 2023-10-08 16:46:01 +03:00
Asdow 4b1de56b01 Remove #ifdefs for USE_VFS 2023-10-08 16:45:06 +03:00
Asdow 56a55f1bc4 Use std::queue instead of old custom queue
implemented in container.cpp
2023-10-07 18:53:39 +03:00
AsdowandGitHub b8a870df02 Reduce code duplication (#233)
* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY

* Add direction utility function

We have a lot of places in the code that calculate direction based on center cell coordinates, but lack a utility function for it similar to other direction methods.

* Use utility function for calculating direction

* Use ConvertGridNoToCenterCellXY

* Use utility function for direction

* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY

* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY

* Remove CenterX & CenterY functions

Use ConvertGridNoToCenterCellXY instead

* Remove CenterX & CenterY calls from UB configuration

* Address review feedback

* Remove duplicate function

ConvertGridNoToCenterCellXY and ConvertMapPosToWorldTileCenter do the exact same thing

* Use PythSpacesAway instead of GetRangeFromGridNoDiff

Both functions calculate the same thing

* Remove GetRangeFromGridNoDiff

* Remove calls to abs()

The values end up being squared anyways making these unnecessary
2023-10-07 15:14:15 +03:00
AsdowandGitHub fc5573f73d Correct check for stance (#222)
Same issue as in commit 23ceb0f
2023-09-05 18:57:40 +03:00
AsdowandGitHub 23ceb0fa4c Fix bug in OCTH prone CTH calculation (by Seven) (#221)
GetToHitBonus() expects BOOLEAN for fProneStance argument, with no comparison to ANIM_PRONE, the ubEndHeight ends up adding bipod bonuses to *all* stances
2023-09-05 17:33:42 +03:00
AsdowandGitHub 43c6943399 Don't modify gMAXITEM_READ when reading localized file (#198) 2023-08-04 14:25:35 +03:00
AsdowandGitHub 52ccc7cc3c Fix widescreen UI militia popup box y-coordinate (#196) 2023-08-04 13:45:54 +03:00
AsdowandGitHub d14c92e2a9 Add /lib/ folder to gitignore (#188) 2023-07-27 12:07:35 +03:00
AsdowandGitHub 0decb14856 Prevent endless clock (#186)
Stop AI from attempting to steal a weapon that has a sling attachment, which prevents stealing. (by Seven)
2023-07-26 10:18:13 +03:00
AsdowandGitHub 2163a66169 Prevent writing past array capacity (#185)
Game would crash with stack-based buffer overrun when a MOLLE item had enough attachments and their texts were written past attachString capacity
2023-07-25 14:19:30 +03:00
AsdowandGitHub c036160959 fix radarmap drawing in tactical inventory view (#177)
720p resolution with 10 man squads had radarscreen rendered in a wrong location
2023-07-14 07:56:27 +03:00
AsdowandGitHub 82aa1a6f7d Fix bug that prevented arms dealer inventory from restocking (#169)
if (numTotalItems.count(usItemIndex) == 1 ) would prevent dealers to reorder items if their current stock was zero
2023-06-22 15:59:27 +03:00
AsdowandGitHub 2571979f8a Fix message box text drawing in 720p when map inventory is up (#168)
Old 720p resolution had character inventory drawn over the message box so messages were hidden when inventory is up. New widescreen UI is similar to all the other higher resolutions where this is not the case anymore.
2023-06-12 14:47:24 +03:00
AsdowandGitHub 986d280193 Enable bigger squad sizes for 720p resolution (#160) 2023-05-28 16:32:12 +03:00
AsdowandGitHub 744e9c92ec Prevent illegal array access (#159)
When using mousewheel to switch between pages in features screen, the HandleHighLightedText() function sometimes would retain valid bHighlight index, but toggle_box_array[bHighlight] == -1, which is used to access z113FeaturesToggleText[] and would later trigger Assertion in gprintfdirty() with pFontString == NULL
2023-05-28 15:05:43 +03:00
AsdowandGitHub f2ab296b49 Display icon and tooltip for belt fed weapons (#155) 2023-05-26 08:12:55 +03:00
AsdowandGitHub 66c7fc1c8d Remove compiler warning for exceeding stack size (#154)
Use std::map & std::set instead of two 16001 elements long arrays
2023-05-25 23:36:55 +03:00
AsdowandGitHub e4e1d472fd Remove compiler warning for exceeding stack size. (#153)
* Use std::map instead of 16001 elements long array
* Remove old commented out code
2023-05-25 22:46:18 +03:00
AsdowandGitHub 35bb9a70ec Do not load language specific icon file (#146)
Unnecessary, as there is no translated text in the image files
2023-05-19 16:47:42 +03:00
AsdowandGitHub 690d2054c6 Added new filters for LOBOT (#145)
* Weapon class for SECONDHANDPOS items
* Check if weapon is two handed for HANDPOS and SECONDHANDPOS
2023-05-18 23:33:17 +03:00
AsdowandGitHub e1f7fa7bfb Fix button glitches in widescreen UI (#125)
In widescreen strategic UI, team panel sort buttons would be hidden when transferring items to and fro merc inventory via CTRL + left click
Exit inventory panel button should always be disabled in widescreen UI
2023-02-15 16:36:57 +02:00
AsdowandGitHub 17a0a08097 Add Astars pathing to ingame options (#124)
* Enabled astars pathing

* Add toggleable pathfinding choice to ingame options

You can choose between original and A* pathfinding algorithms
2023-02-15 11:49:04 +02:00
AsdowandGitHub 35109a5615 Guard against possible illegal array access (by Seven) (#121)
ClosestPanicTrigger() can return -1 but its use in indexing gTacticalStatus.bPanicTriggerIsAlarm was not checked in all the places in the code
2023-01-31 20:26:21 +02:00
AsdowandGitHub 3985dca2c1 Add on option to start at maximum aiming level (#112)
* Add on option to start at maximum aiming level

When hovering mouse on an enemy, aiming level is started at maximum instead of no aiming when this option is toggled.
2023-01-22 23:35:42 +02:00
AsdowandGitHub ae1fd0a2ee Prisoner feature bugfix (#110)
* Allow game to continue after offering to surrender to enemies

* Fix issues related to surrender and POW quests

- Quests were ended prematurely if one had prisoners in both alma and tixa
- Strategic status flags for rescue/escape were not set properly
- Only the maximum amount a prison can hold will be taken as POWs, rest of the mercs will either escape or have to fight to the death, to prevent a player having unrescuable POWs
- Capturing a mercenary had a lot of functions called that should not have been, IF the merc is not going to be captured after all

* Switch all tactical surrender calls to use one unified function

* Only mercs that are capable can escape

Incapacitated mercs left behind will die.
Should probably prioritize incapacitated mercs to be captured by the enemy to prevent needless deaths

* Combine pow quest state changes into one function

* Add JumpIntoEscapedSector to header file

* Allow enemy to demand surrender even if they already have POWs in Tixa and Alma

* Remove surrender from UB

* Address review feedback
2023-01-22 23:35:08 +02:00
AsdowandGitHub 8048dd4201 Fix mapeditor compilation in French language config (#107)
Wrong array had been commented out in _FrenchText.cpp
2023-01-21 20:09:40 +02:00
AsdowandGitHub 8733c2c2eb Improve vobject error messages (#106)
Error messages will now print the video object's file name when throwing the error, giving us an immediate starting point for debugging. Especially useful when those intermittent assertion errors happen.
2023-01-21 17:01:35 +02:00
AsdowandGitHub 1770f7f081 Fix illegal array access in imp gear selection (#104) 2023-01-20 20:41:09 +02:00
AsdowandGitHub a252a42ec7 Fix bug if vehicle holds more soldiers than can fit in a squad (by Seven) (#103)
* Fix bug if vehicle holds more soldiers than can fit in a squad (by Seven)

We would fail Assert(fSuccess) as all passengers would not fit in one squad, and the code wouldn't allow creating a new squad where they could be placed.

* Add missing if conditional to previous fix
My bad
2023-01-20 16:54:58 +02:00
AsdowandGitHub f0d0ba7307 Revert "Fix bug if vehicle holds more soldiers than can fit in a squad (by Seven) (#101)" (#102)
This reverts commit 46c4ac2b64.
2023-01-20 16:48:27 +02:00
AsdowandGitHub 46c4ac2b64 Fix bug if vehicle holds more soldiers than can fit in a squad (by Seven) (#101)
We would fail Assert(fSuccess) as all passengers would not fit in one squad, and the code wouldn't allow creating a new squad where they could be placed.
2023-01-20 16:24:18 +02:00
AsdowandGitHub fc0182118c Display item info in tooltip (#100) 2023-01-20 16:10:16 +02:00
AsdowandGitHub 57fcdaf4fe Add ability to match against leg armor attachments (#96) 2023-01-19 14:16:03 +02:00
AsdowandGitHub a55dab43b2 Prevent illegal array access if GridNo = NOWHERE (#93) 2023-01-19 00:47:01 +02:00
AsdowandGitHub a32e276e4d Add possibility to match against helmet attachments (#77) 2023-01-15 23:02:28 +02:00
AsdowandGitHub 08982d92e7 Fix illegal array access (#53)
Array length was too small when using old skill trait system.
2022-12-25 17:10:46 +02:00
AsdowandGitHub 1f567d9602 Fix CTD when displaying long names in map inventory (#52) 2022-12-25 16:01:01 +02:00
AsdowandGitHub 8f22d13fd9 Cache result of evaluating strategicmap.lua (#32) 2022-11-23 21:59:27 +02:00
AsdowandGitHub 468756d93f Merge pull request #23 from 1dot13/misc
Change shift + B to also pick up back packs in tactical
2022-11-10 18:41:50 +02:00
Asdow 6dbbfa227a Change shift + B to also pick up back packs in tactical
Instead of always dropping backpacks, it will now either pick up or drop backpacks depending on if any have been dropped
2022-11-10 18:40:00 +02:00
AsdowandGitHub f06e85575d Merge pull request #18 from 1dot13/MapEditor
Mapeditor items tab fix
2022-11-08 18:13:10 +02:00
Asdow 06065bb62f Update EditorItems.cpp
Removed unused clippingRect
2022-11-07 19:53:40 +02:00
Asdow f4e729ee80 Update EditorItems.cpp
Improve readability
2022-11-07 19:42:08 +02:00
Asdow af9e221578 Removed remnants of editoritems buffer as it is no longer used 2022-11-07 19:12:53 +02:00
Asdow 9919531f56 Fix INT16 buffer overflow when displaying items in items tab
Original implementation initializes a ridiculously wide buffer where item graphics and names are then copied to and is then shown in parts depending on what items should be visible in item tab.  When item counts go over ~32k in x-direction in pixel coordinates, the very low level drawing functions int16 variables overflow and item graphics are then drawn over each other.

It's now changed to blit item graphics and names by on demand depending on the item indices, which does not require a huge buffer and works regardless of the amount of items, since only 11 are visible at any one time and the x-coordinate stays well within INT16 limits
2022-11-07 18:03:45 +02:00
Asdow 49bedd3179 Create .gitignore 2022-11-05 12:34:06 +02:00
AsdowandGitHub 2d20a2baba Merge pull request #14 from 1dot13/Asdow-patch-1
Delete .vs directory
2022-11-04 21:04:39 +02:00
AsdowandGitHub a6ca3abfe2 Delete .vs directory
Delete a file that should not have been committed in the previous pull request
2022-11-04 21:02:52 +02:00
AsdowandGitHub 8e99410f52 Merge pull request #13 from 1dot13/bugfix
r9404: Prevent illegal array access
2022-11-04 20:27:10 +02:00
Asdow 95e9d83165 r9404: Prevent illegal array access
Using kill all enemies cheat via ALT + o caused reading MercPtrs from index 254 when its last element is at 253
2022-11-04 20:26:01 +02:00
AsdowandGitHub 62f3fc8453 Merge pull request #8 from FunkyFr3sh/master
Detect cnc-ddraw and disable windowed mode
2022-10-15 21:04:25 +03:00
Asdow 5197ef21e5 r9402: Fixed nullptr dereference & assertion error
https://github.com/1dot13/source/issues/3#issue-1400794531
https://github.com/1dot13/source/issues/2#issue-1400794162
2022-10-10 07:45:20 +03:00